diff options
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 27 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/AppStartInfoTracker.java | 2 |
2 files changed, 25 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 8022eb37fce7..73ce47c9536f 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -10167,7 +10167,11 @@ public class ActivityManagerService extends IActivityManager.Stub } final int callingUid = Binder.getCallingUid(); - mProcessList.getAppStartInfoTracker().addStartInfoCompleteListener(listener, callingUid); + mUserController.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, true, + ALLOW_NON_FULL, "addApplicationStartInfoCompleteListener", null); + + mProcessList.getAppStartInfoTracker().addStartInfoCompleteListener(listener, + UserHandle.getUid(userId, UserHandle.getAppId(callingUid))); } @@ -10182,13 +10186,30 @@ public class ActivityManagerService extends IActivityManager.Stub } final int callingUid = Binder.getCallingUid(); - mProcessList.getAppStartInfoTracker().removeStartInfoCompleteListener(listener, callingUid, - true); + mUserController.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, true, + ALLOW_NON_FULL, "removeApplicationStartInfoCompleteListener", null); + + mProcessList.getAppStartInfoTracker().removeStartInfoCompleteListener(listener, + UserHandle.getUid(userId, UserHandle.getAppId(callingUid)), true); } @Override public void addStartInfoTimestamp(int key, long timestampNs, int userId) { enforceNotIsolatedCaller("addStartInfoTimestamp"); + + // For the simplification, we don't support USER_ALL nor USER_CURRENT here. + if (userId == UserHandle.USER_ALL || userId == UserHandle.USER_CURRENT) { + throw new IllegalArgumentException("Unsupported userId"); + } + + final int callingUid = Binder.getCallingUid(); + mUserController.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, true, + ALLOW_NON_FULL, "addStartInfoTimestamp", null); + + final String packageName = Settings.getPackageNameForUid(mContext, callingUid); + + mProcessList.getAppStartInfoTracker().addTimestampToStart(packageName, + UserHandle.getUid(userId, UserHandle.getAppId(callingUid)), timestampNs, key); } @Override diff --git a/services/core/java/com/android/server/am/AppStartInfoTracker.java b/services/core/java/com/android/server/am/AppStartInfoTracker.java index ddf1d5f5ab71..0728ea8e5604 100644 --- a/services/core/java/com/android/server/am/AppStartInfoTracker.java +++ b/services/core/java/com/android/server/am/AppStartInfoTracker.java @@ -464,7 +464,7 @@ public final class AppStartInfoTracker { addTimestampToStart(app.info.packageName, app.uid, timeNs, key); } - private void addTimestampToStart(String packageName, int uid, long timeNs, int key) { + void addTimestampToStart(String packageName, int uid, long timeNs, int key) { synchronized (mLock) { AppStartInfoContainer container = mData.get(packageName, uid); if (container == null) { |