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

Commit 87f521ff authored by Mathew Inwood's avatar Mathew Inwood Committed by Android (Google) Code Review
Browse files

Merge "Enforce permission when disabling API checks." into pi-dev

parents 2a915264 5f1f29a9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3943,6 +3943,11 @@
    <permission android:name="android.permission.OPEN_APPLICATION_DETAILS_OPEN_BY_DEFAULT_PAGE"
                android:protectionLevel="signature" />

    <!-- Allows hidden API checks to be disabled when starting a process.
         @hide <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.DISABLE_HIDDEN_API_CHECKS"
                android:protectionLevel="signature" />

    <application android:process="system"
                 android:persistent="true"
                 android:hasCode="false"
+1 −0
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.SET_TIME" />
    <uses-permission android:name="android.permission.SET_TIME_ZONE" />
    <uses-permission android:name="android.permission.DISABLE_HIDDEN_API_CHECKS" />
    <!-- Permission needed to rename bugreport notifications (so they're not shown as Shell) -->
    <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
    <!-- Permission needed to hold a wakelock in dumpstate.cpp (drop_root_user()) -->
+7 −3
Original line number Diff line number Diff line
@@ -22080,6 +22080,13 @@ public class ActivityManagerService extends IActivityManager.Stub
            activeInstr.mUiAutomationConnection = uiAutomationConnection;
            activeInstr.mResultClass = className;
            boolean disableHiddenApiChecks =
                    (flags & INSTRUMENTATION_FLAG_DISABLE_HIDDEN_API_CHECKS) != 0;
            if (disableHiddenApiChecks) {
                enforceCallingPermission(android.Manifest.permission.DISABLE_HIDDEN_API_CHECKS,
                        "disable hidden API checks");
            }
            final long origId = Binder.clearCallingIdentity();
            // Instrumentation can kill and relaunch even persistent processes
            forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true, false, userId,
@@ -22089,9 +22096,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                mUsageStatsService.reportEvent(ii.targetPackage, userId,
                        UsageEvents.Event.SYSTEM_INTERACTION);
            }
            boolean disableHiddenApiChecks =
                    (flags & INSTRUMENTATION_FLAG_DISABLE_HIDDEN_API_CHECKS) != 0;
            // TODO: Temporary whitelist of packages which need to be exempt from hidden API
            //       checks. Remove this as soon as the testing infrastructure allows to set
            //       the flag in AndroidTest.xml.