Remove lock for internal isGetTasksAllowed

The method only checks recents and permission. The former is a field
which won't change since boot. The latter doesn't involve any WM
stuffs. Other places also use it without lock.

This avoids unnecessary lock contention when calling ActivityManager#
getRunningAppProcesses, getProcessMemoryInfo, getRunningServices.

Bug: 204870457
Test: Test: CtsWindowManagerDeviceTestCases
Change-Id: Ie1f1d1f58543cf25197f42caa01565039ced4b32
This commit is contained in:
Riddle Hsu
2021-11-02 22:39:19 +08:00
parent 318be1a431
commit fbb75b3eee

View File

@@ -5488,10 +5488,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public boolean isGetTasksAllowed(String caller, int callingPid, int callingUid) {
synchronized (mGlobalLock) {
return ActivityTaskManagerService.this.isGetTasksAllowed(
caller, callingPid, callingUid);
}
return ActivityTaskManagerService.this.isGetTasksAllowed(
caller, callingPid, callingUid);
}
@HotPath(caller = HotPath.PROCESS_CHANGE)