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

Commit 11d21a29 authored by Nicolas Geoffray's avatar Nicolas Geoffray
Browse files

Rewrite handling of oob priv-apps in framework.

- Use 'verify' compiler filter for dexopt.
- Don't pass DISABLE_VERIFIER, instead rely on the oat file status.

This is made possible by:
https://android-review.googlesource.com/#/c/platform/art/+/568546/

Which allows loading oat files, but not executing them.

bug: 30972906
Test: build, set pm.dexopt.priv-apps-oob to true, shell stop && start, see we're not
      using the compiled code.

Change-Id: Idb909c68304f74a720499db3a6cc4a457b52f1e1
parent f68e5b63
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -4020,7 +4020,6 @@ public class ActivityManagerService extends IActivityManager.Stub
            if (app.info.isPrivilegedApp() &&
                    SystemProperties.getBoolean("pm.dexopt.priv-apps-oob", false)) {
                runtimeFlags |= Zygote.DISABLE_VERIFIER;
                runtimeFlags |= Zygote.ONLY_USE_SYSTEM_OAT_FILES;
            }
+5 −5
Original line number Diff line number Diff line
@@ -110,11 +110,6 @@ public class PackageDexOptimizer {
            return false;
        }

        // We do not dexopt a priv-app package when pm.dexopt.priv-apps-oob is true.
        if (pkg.isPrivileged()) {
            return !SystemProperties.getBoolean("pm.dexopt.priv-apps-oob", false);
        }

        return true;
    }

@@ -480,6 +475,11 @@ public class PackageDexOptimizer {
            boolean isUsedByOtherApps) {
        int flags = info.flags;
        boolean vmSafeMode = (flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0;
        // When pm.dexopt.priv-apps-oob is true, we only verify privileged apps.
        if (info.isPrivilegedApp() &&
            SystemProperties.getBoolean("pm.dexopt.priv-apps-oob", false)) {
          return "verify";
        }
        if (vmSafeMode) {
            return getSafeModeCompilerFilter(targetCompilerFilter);
        }