From 1c6fb37b3f32c96f99f6b6b4c22ac5494e4e0ef8 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Mon, 8 Feb 2021 14:14:56 -0800 Subject: [PATCH] Instrument PM classes with @Watched Bug: 179388643 Annotate more PackageManagerService classes with the @Watched attribute. Test: atest * FrameworksServicesTests:UserSystemPackageInstallerTest * FrameworksServicesTests:PackageManagerSettingsTests * FrameworksServicesTests:PackageManagerServiceTest * FrameworksServicesTests:AppsFilterTest * FrameworksServicesTests:PackageInstallerSessionTest * FrameworksServicesTests:ScanTests * UserLifecycleTests#startUser * UserLifecycleTests#stopUser * UserLifecycleTests#switchUser * android.appsecurity.cts.EphemeralTest#testEphemeralStartExposed06 * android.appsecurity.cts.InstantAppUserTest#testStartExposed06 Change-Id: Iab2da530786a0abc91d356da8e1bbd4c824f0333 --- .../core/java/com/android/server/pm/InstantAppRegistry.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/pm/InstantAppRegistry.java b/services/core/java/com/android/server/pm/InstantAppRegistry.java index 15e1d5281bfad..7bf704299373e 100644 --- a/services/core/java/com/android/server/pm/InstantAppRegistry.java +++ b/services/core/java/com/android/server/pm/InstantAppRegistry.java @@ -59,6 +59,7 @@ import com.android.server.pm.permission.PermissionManagerServiceInternal; import com.android.server.utils.Snappable; import com.android.server.utils.Watchable; import com.android.server.utils.WatchableImpl; +import com.android.server.utils.Watched; import com.android.server.utils.WatchedSparseArray; import com.android.server.utils.WatchedSparseBooleanArray; import com.android.server.utils.Watcher; @@ -123,6 +124,7 @@ class InstantAppRegistry implements Watchable, Snappable { private final CookiePersistence mCookiePersistence; /** State for uninstalled instant apps */ + @Watched @GuardedBy("mService.mLock") private final WatchedSparseArray> mUninstalledInstantApps; @@ -132,10 +134,12 @@ class InstantAppRegistry implements Watchable, Snappable { * The value is a set of instant app UIDs. * UserID -> TargetAppId -> InstantAppId */ + @Watched @GuardedBy("mService.mLock") private final WatchedSparseArray> mInstantGrants; /** The set of all installed instant apps. UserID -> AppID */ + @Watched @GuardedBy("mService.mLock") private final WatchedSparseArray mInstalledInstantAppUids; @@ -189,6 +193,7 @@ class InstantAppRegistry implements Watchable, Snappable { mUninstalledInstantApps.registerObserver(mObserver); mInstantGrants.registerObserver(mObserver); mInstalledInstantAppUids.registerObserver(mObserver); + Watchable.verifyWatchedAttributes(this, mObserver); } /**