Mirror pending temp whitelist from AMS to ATMS (30/n)
Allows ATMS to get the pending temp whitelist for uids without calling
into AMS.
Also removed ATMS.mAm since this was the last reference to it.
Bug: 80414790
Test: Existing tests pass
Change-Id: I9eaff82c003b6a65e94adf7fad671c0cd7c56482
diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
index fa3039f..0db7765 100644
--- a/services/core/java/com/android/server/am/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
@@ -331,7 +331,6 @@
final ActivityThread mSystemThread;
H mH;
UiHandler mUiHandler;
- ActivityManagerService mAm;
ActivityManagerInternal mAmInternal;
UriGrantsManagerInternal mUgmInternal;
private PackageManagerInternal mPmInternal;
@@ -349,7 +348,8 @@
private UserManagerService mUserManager;
private AppOpsService mAppOpsService;
/** All active uids in the system. */
- final SparseArray<Integer> mActiveUids = new SparseArray<>();
+ private final SparseArray<Integer> mActiveUids = new SparseArray<>();
+ private final SparseArray<String> mPendingTempWhitelist = new SparseArray<>();
/** All processes currently running that might have a window organized by name. */
final ProcessMap<WindowProcessController> mProcessNames = new ProcessMap<>();
/** All processes we currently have running mapped by pid */
@@ -708,10 +708,9 @@
}
// TODO: Will be converted to WM lock once transition is complete.
- void setActivityManagerService(ActivityManagerService am, Looper looper,
+ void setActivityManagerService(Object globalLock, Looper looper,
IntentFirewall intentFirewall, PendingIntentController intentController) {
- mAm = am;
- mGlobalLock = mAm;
+ mGlobalLock = globalLock;
mH = new H(looper);
mUiHandler = new UiHandler();
mIntentFirewall = intentFirewall;
@@ -5462,6 +5461,14 @@
return mActiveUids.get(uid, PROCESS_STATE_NONEXISTENT);
}
+ /**
+ * @return whitelist tag for a uid from mPendingTempWhitelist, null if not currently on
+ * the whitelist
+ */
+ String getPendingTempWhitelistTagForUidLocked(int uid) {
+ return mPendingTempWhitelist.get(uid);
+ }
+
void logAppTooSlow(WindowProcessController app, long startTime, String msg) {
if (true || Build.IS_USER) {
return;
@@ -6664,5 +6671,19 @@
}
}
}
+
+ @Override
+ public void onUidAddedToPendingTempWhitelist(int uid, String tag) {
+ synchronized (mGlobalLock) {
+ mPendingTempWhitelist.put(uid, tag);
+ }
+ }
+
+ @Override
+ public void onUidRemovedFromPendingTempWhitelist(int uid) {
+ synchronized (mGlobalLock) {
+ mPendingTempWhitelist.remove(uid);
+ }
+ }
}
}