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

Commit e6e0603f authored by Mathew Inwood's avatar Mathew Inwood Committed by android-build-merger
Browse files

Merge "Enforce permission when disabling API checks." into pi-dev am: 87f521ff

am: 6614f28d

Change-Id: Iab6854adff71f3a89fc0b937a9be5f791ecab0f5
parents 4dec3057 6614f28d
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -3943,6 +3943,11 @@
    <permission android:name="android.permission.OPEN_APPLICATION_DETAILS_OPEN_BY_DEFAULT_PAGE"
    <permission android:name="android.permission.OPEN_APPLICATION_DETAILS_OPEN_BY_DEFAULT_PAGE"
                android:protectionLevel="signature" />
                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"
    <application android:process="system"
                 android:persistent="true"
                 android:persistent="true"
                 android:hasCode="false"
                 android:hasCode="false"
+1 −0
Original line number Original line Diff line number Diff line
@@ -130,6 +130,7 @@
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <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" />
    <uses-permission android:name="android.permission.SET_TIME_ZONE" />
    <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) -->
    <!-- Permission needed to rename bugreport notifications (so they're not shown as Shell) -->
    <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
    <uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
    <!-- Permission needed to hold a wakelock in dumpstate.cpp (drop_root_user()) -->
    <!-- Permission needed to hold a wakelock in dumpstate.cpp (drop_root_user()) -->
+7 −3
Original line number Original line Diff line number Diff line
@@ -21954,6 +21954,13 @@ public class ActivityManagerService extends IActivityManager.Stub
            activeInstr.mUiAutomationConnection = uiAutomationConnection;
            activeInstr.mUiAutomationConnection = uiAutomationConnection;
            activeInstr.mResultClass = className;
            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();
            final long origId = Binder.clearCallingIdentity();
            // Instrumentation can kill and relaunch even persistent processes
            // Instrumentation can kill and relaunch even persistent processes
            forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true, false, userId,
            forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true, false, userId,
@@ -21963,9 +21970,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                mUsageStatsService.reportEvent(ii.targetPackage, userId,
                mUsageStatsService.reportEvent(ii.targetPackage, userId,
                        UsageEvents.Event.SYSTEM_INTERACTION);
                        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
            // 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
            //       checks. Remove this as soon as the testing infrastructure allows to set
            //       the flag in AndroidTest.xml.
            //       the flag in AndroidTest.xml.