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

Commit 26559bcb authored by Andrei Onea's avatar Andrei Onea Committed by Andrei-Valentin Onea
Browse files

Add permissions for using PlatformCompat methods

- READ_COMPAT_CHANGE_CONFIG is required to read the current state of the
config
- LOG_COMPAT_CHANGE is required to log the status of a compat change for
a package and/or uid to statsd
- OVERRIDE_COMPAT_CHANGE_CONFIG is required to add overrides

The permissions must be signature|privileged, as there are already
examples of code which this would not be sufficient (e.g.
MediaProvider).

This is a re-landing of https://r.android.com/1209240, which was
reverted due to http://b/142942524. The actual fix was done in
http://ag/10234812.


Bug: 142650523
Test: atest PlatformCompatTest
Test: atest PlatformCompatPermissionsTest
Change-Id: Ie9429477c9a1725b5cb67756787bf742038e5d2b
parent 55d16fac
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -4700,6 +4700,19 @@
    <permission android:name="android.permission.ACCESS_SHARED_LIBRARIES"
                android:protectionLevel="signature|installer" />

    <!-- Allows an app to log compat change usage.
         @hide  <p>Not for use by third-party applications.</p> -->
    <permission android:name="android.permission.LOG_COMPAT_CHANGE"
                android:protectionLevel="signature|privileged" />
    <!-- Allows an app to read compat change config.
         @hide  <p>Not for use by third-party applications.</p> -->
    <permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG"
                android:protectionLevel="signature|privileged" />
    <!-- Allows an app to override compat change config.
         @hide  <p>Not for use by third-party applications.</p> -->
    <permission android:name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG"
                android:protectionLevel="signature|privileged" />

    <!-- Allows input events to be monitored. Very dangerous!  @hide -->
    <permission android:name="android.permission.MONITOR_INPUT"
                android:protectionLevel="signature" />
+4 −0
Original line number Diff line number Diff line
@@ -110,6 +110,10 @@
    <uses-permission android:name="android.permission.MOVE_PACKAGE" />
    <uses-permission android:name="android.permission.PACKAGE_VERIFICATION_AGENT" />

    <!-- gating and logging permissions -->
    <uses-permission android:name="android.permission.LOG_COMPAT_CHANGE" />
    <uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG" />

    <!-- os storage test permissions -->
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.ASEC_ACCESS" />
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
        <permission name="android.permission.DELETE_PACKAGES"/>
        <permission name="android.permission.FORCE_STOP_PACKAGES"/>
        <permission name="android.permission.LOCAL_MAC_ADDRESS"/>
        <permission name="android.permission.LOG_COMPAT_CHANGE" />
        <permission name="android.permission.MANAGE_DEBUGGING"/>
        <permission name="android.permission.MANAGE_DEVICE_ADMINS"/>
        <permission name="android.permission.MANAGE_FINGERPRINT"/>
@@ -37,8 +38,10 @@
        <permission name="android.permission.MODIFY_PHONE_STATE"/>
        <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
        <permission name="android.permission.MOVE_PACKAGE"/>
        <permission name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG" />
        <permission name="android.permission.OVERRIDE_WIFI_CONFIG"/>
        <permission name="android.permission.PACKAGE_USAGE_STATS"/>
        <permission name="android.permission.READ_COMPAT_CHANGE_CONFIG" />
        <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
        <permission name="android.permission.READ_SEARCH_INDEXABLES"/>
        <permission name="android.permission.REBOOT"/>
+4 −0
Original line number Diff line number Diff line
@@ -343,6 +343,10 @@ applications that come with the platform
        <permission name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
        <!-- Permission required for Tethering CTS tests. -->
        <permission name="android.permission.TETHER_PRIVILEGED"/>
        <!-- Permissions required for ganting and logging -->
        <permission name="android.permission.LOG_COMPAT_CHANGE" />
        <permission name="android.permission.READ_COMPAT_CHANGE_CONFIG" />
        <permission name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG" />
        <!-- Permissions required to test ambient display. -->
        <permission name="android.permission.READ_DREAM_STATE" />
        <permission name="android.permission.WRITE_DREAM_STATE" />
+5 −0
Original line number Diff line number Diff line
@@ -214,6 +214,11 @@
    <!-- permissions required for CTS test - PhoneStateListenerTest -->
    <uses-permission android:name="android.permission.LISTEN_ALWAYS_REPORTED_SIGNAL_STRENGTH" />

    <!-- Permissions required for ganting and logging -->
    <uses-permission android:name="android.permission.LOG_COMPAT_CHANGE"/>
    <uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG"/>
    <uses-permission android:name="android.permission.OVERRIDE_COMPAT_CHANGE_CONFIG"/>

    <!-- Permission required for CTS test - UiModeManagerTest -->
    <uses-permission android:name="android.permission.ENTER_CAR_MODE_PRIORITIZED"/>

Loading