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

Commit aba156e2 authored by David Brazdil's avatar David Brazdil Committed by Android (Google) Code Review
Browse files

Merge "Exempt instrumented processes from hidden API checks"

parents 45ae0fba 4bf7443a
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -4084,9 +4084,9 @@ public class ActivityManagerService extends IActivityManager.Stub
                runtimeFlags |= Zygote.ONLY_USE_SYSTEM_OAT_FILES;
            }
            if (app.info.isAllowedToUseHiddenApi()) {
                // This app is allowed to use undocumented and private APIs. Set
                // up its runtime with the appropriate flag.
            if (app.info.isAllowedToUseHiddenApi() || app.instr != null) {
                // This app is allowed to use undocumented and private APIs or is
                // being instrumented. Set up its runtime with the appropriate flag.
                runtimeFlags |= Zygote.DISABLE_HIDDEN_API_CHECKS;
            }
@@ -7218,7 +7218,7 @@ public class ActivityManagerService extends IActivityManager.Stub
            handleAppDiedLocked(app, willRestart, allowRestart);
            if (willRestart) {
                removeLruProcessLocked(app);
                addAppLocked(app.info, null, false, null /* ABI override */);
                addAppLocked(app.info, null, false, null /* ABI override */, app.instr);
            }
        } else {
            mRemovedProcesses.add(app);
@@ -12490,7 +12490,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                        .getPersistentApplications(STOCK_PM_FLAGS | matchFlags).getList();
                for (ApplicationInfo app : apps) {
                    if (!"android".equals(app.packageName)) {
                        addAppLocked(app, null, false, null /* ABI override */);
                        addAppLocked(app, null, false, null /* ABI override */,
                                null /* instrumentation */);
                    }
                }
            } catch (RemoteException ex) {
@@ -12706,7 +12707,7 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    final ProcessRecord addAppLocked(ApplicationInfo info, String customProcess, boolean isolated,
            String abiOverride) {
            String abiOverride, ActiveInstrumentation instrumentation) {
        ProcessRecord app;
        if (!isolated) {
            app = getProcessRecordLocked(customProcess != null ? customProcess : info.processName,
@@ -12735,6 +12736,9 @@ public class ActivityManagerService extends IActivityManager.Stub
            app.persistent = true;
            app.maxAdj = ProcessList.PERSISTENT_PROC_ADJ;
        }
        app.instr = instrumentation;
        if (app.thread == null && mPersistentStartingProcesses.indexOf(app) < 0) {
            mPersistentStartingProcesses.add(app);
            startProcessLocked(app, "added application",
@@ -21541,8 +21545,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                mUsageStatsService.reportEvent(ii.targetPackage, userId,
                        UsageEvents.Event.SYSTEM_INTERACTION);
            }
            ProcessRecord app = addAppLocked(ai, defProcess, false, abiOverride);
            app.instr = activeInstr;
            ProcessRecord app = addAppLocked(ai, defProcess, false, abiOverride, activeInstr);
            activeInstr.mFinished = false;
            activeInstr.mRunningProcesses.add(app);
            if (!mActiveInstrumentation.contains(activeInstr)) {
@@ -24941,7 +24944,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    mRemovedProcesses.remove(i);
                    if (app.persistent) {
                        addAppLocked(app.info, null, false, null /* ABI override */);
                        addAppLocked(app.info, null, false, null /* ABI override */, app.instr);
                    }
                }
            }