Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c6fb37b authored by Lee Shombert's avatar Lee Shombert
Browse files

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
parent c88f2e72
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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<List<UninstalledInstantAppState>> 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<WatchedSparseArray<WatchedSparseBooleanArray>> mInstantGrants;

    /** The set of all installed instant apps. UserID -> AppID */
    @Watched
    @GuardedBy("mService.mLock")
    private final WatchedSparseArray<WatchedSparseBooleanArray> mInstalledInstantAppUids;

@@ -189,6 +193,7 @@ class InstantAppRegistry implements Watchable, Snappable {
        mUninstalledInstantApps.registerObserver(mObserver);
        mInstantGrants.registerObserver(mObserver);
        mInstalledInstantAppUids.registerObserver(mObserver);
        Watchable.verifyWatchedAttributes(this, mObserver);
    }

    /**