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

Commit 728fc342 authored by Evan Severson's avatar Evan Severson
Browse files

Split appops.xml into two files

Currently AppOpsService persists appop state into a single "appops.xml"
file. Instead, split this file into two:

1. "appops.xml": stores appop state
2. "appops_accesses.xml": stores recent appop accesses

This allows us to split the responsibility of maintaining different
types of state across different services:

- app-op state: maintained by AppOpsServiceInterface (where the
  implementation can vary)
- app-op accesses: maintained by AppOpsService

For transition purposes, the app-op history will be read from the
original "appops.xml" file before the new file exists.

(Also, bring back the unrelated AppOpsCheckingServiceTracingDecorator
which was accidentally nuked in a recent change.)

Test: atest AppOpsUpgradeTest CtsAppOpsTestCases
Bug: 266163878
Change-Id: I1ffc6375abaf8c62f91e7aefe0b76923f437ee0e
parent e07c6141
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -2314,7 +2314,8 @@ public class ActivityManagerService extends IActivityManager.Stub
        mUiContext = null;
        mAppErrors = null;
        mPackageWatchdog = null;
        mAppOpsService = mInjector.getAppOpsService(null /* file */, null /* handler */);
        mAppOpsService = mInjector.getAppOpsService(null /* recentAccessesFile */,
            null /* storageFile */, null /* handler */);
        mBatteryStatsService = mInjector.getBatteryStatsService();
        mHandler = new MainHandler(handlerThread.getLooper());
        mHandlerThread = handlerThread;
@@ -2443,7 +2444,8 @@ public class ActivityManagerService extends IActivityManager.Stub
        mProcessStats = new ProcessStatsService(this, new File(systemDir, "procstats"));
        mAppOpsService = mInjector.getAppOpsService(new File(systemDir, "appops.xml"), mHandler);
        mAppOpsService = mInjector.getAppOpsService(new File(systemDir, "appops_accesses.xml"),
                new File(systemDir, "appops.xml"), mHandler);
        mUgmInternal = LocalServices.getService(UriGrantsManagerInternal.class);
@@ -19001,8 +19003,9 @@ public class ActivityManagerService extends IActivityManager.Stub
            return mContext;
        }
        public AppOpsService getAppOpsService(File file, Handler handler) {
            return new AppOpsService(file, handler, getContext());
        public AppOpsService getAppOpsService(File recentAccessesFile, File storageFile,
                Handler handler) {
            return new AppOpsService(recentAccessesFile, storageFile, handler, getContext());
        }
        public Handler getUiHandler(ActivityManagerService service) {
Loading