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

Commit e2887a76 authored by Evan Severson's avatar Evan Severson
Browse files

Remove background microphone and camera from public api

Also make them ungrantable. These permissions only exist so that
RECORD_AUDIO and CAMERA are true foreground permissions.

Test: atest CtsPermission{1,3}TestCases
      Attempt to grant the permissions
Bug: 158311343
Change-Id: I383883a67acee9a0fb4ade5ca34092c29f8ac254
parent eb500d65
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ package android {
    field public static final String ACTIVITY_RECOGNITION = "android.permission.ACTIVITY_RECOGNITION";
    field public static final String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL";
    field public static final String ANSWER_PHONE_CALLS = "android.permission.ANSWER_PHONE_CALLS";
    field public static final String BACKGROUND_CAMERA = "android.permission.BACKGROUND_CAMERA";
    field public static final String BATTERY_STATS = "android.permission.BATTERY_STATS";
    field public static final String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE";
    field public static final String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
@@ -134,7 +133,6 @@ package android {
    field public static final String RECEIVE_SMS = "android.permission.RECEIVE_SMS";
    field public static final String RECEIVE_WAP_PUSH = "android.permission.RECEIVE_WAP_PUSH";
    field public static final String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
    field public static final String RECORD_BACKGROUND_AUDIO = "android.permission.RECORD_BACKGROUND_AUDIO";
    field public static final String REORDER_TASKS = "android.permission.REORDER_TASKS";
    field public static final String REQUEST_COMPANION_PROFILE_WATCH = "android.permission.REQUEST_COMPANION_PROFILE_WATCH";
    field public static final String REQUEST_COMPANION_RUN_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND";
@@ -12668,7 +12666,6 @@ package android.content.pm {
    field public static final int FLAG_HARD_RESTRICTED = 4; // 0x4
    field public static final int FLAG_IMMUTABLY_RESTRICTED = 16; // 0x10
    field public static final int FLAG_INSTALLED = 1073741824; // 0x40000000
    field public static final int FLAG_INSTALLER_EXEMPT_IGNORED = 32; // 0x20
    field public static final int FLAG_SOFT_RESTRICTED = 8; // 0x8
    field public static final int PROTECTION_DANGEROUS = 1; // 0x1
    field public static final int PROTECTION_FLAG_APPOP = 64; // 0x40
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ package android {
    field public static final String ALLOW_ANY_CODEC_FOR_PLAYBACK = "android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK";
    field public static final String AMBIENT_WALLPAPER = "android.permission.AMBIENT_WALLPAPER";
    field public static final String APPROVE_INCIDENT_REPORTS = "android.permission.APPROVE_INCIDENT_REPORTS";
    field public static final String BACKGROUND_CAMERA = "android.permission.BACKGROUND_CAMERA";
    field public static final String BACKUP = "android.permission.BACKUP";
    field public static final String BATTERY_PREDICTION = "android.permission.BATTERY_PREDICTION";
    field public static final String BIND_ATTENTION_SERVICE = "android.permission.BIND_ATTENTION_SERVICE";
@@ -214,6 +215,7 @@ package android {
    field public static final String RECEIVE_DEVICE_CUSTOMIZATION_READY = "android.permission.RECEIVE_DEVICE_CUSTOMIZATION_READY";
    field public static final String RECEIVE_EMERGENCY_BROADCAST = "android.permission.RECEIVE_EMERGENCY_BROADCAST";
    field public static final String RECEIVE_WIFI_CREDENTIAL_CHANGE = "android.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE";
    field public static final String RECORD_BACKGROUND_AUDIO = "android.permission.RECORD_BACKGROUND_AUDIO";
    field public static final String RECOVERY = "android.permission.RECOVERY";
    field public static final String RECOVER_KEYSTORE = "android.permission.RECOVER_KEYSTORE";
    field public static final String REGISTER_CALL_PROVIDER = "android.permission.REGISTER_CALL_PROVIDER";
+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ package android {
    field public static final String ACCESS_NOTIFICATIONS = "android.permission.ACCESS_NOTIFICATIONS";
    field public static final String ACTIVITY_EMBEDDING = "android.permission.ACTIVITY_EMBEDDING";
    field public static final String APPROVE_INCIDENT_REPORTS = "android.permission.APPROVE_INCIDENT_REPORTS";
    field public static final String BACKGROUND_CAMERA = "android.permission.BACKGROUND_CAMERA";
    field public static final String BIND_CELL_BROADCAST_SERVICE = "android.permission.BIND_CELL_BROADCAST_SERVICE";
    field public static final String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE";
    field public static final String BROADCAST_CLOSE_SYSTEM_DIALOGS = "android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS";
@@ -28,6 +29,7 @@ package android {
    field public static final String QUERY_USERS = "android.permission.QUERY_USERS";
    field public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
    field public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
    field public static final String RECORD_BACKGROUND_AUDIO = "android.permission.RECORD_BACKGROUND_AUDIO";
    field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
    field public static final String RESET_APP_ERRORS = "android.permission.RESET_APP_ERRORS";
    field public static final String START_TASKS_FROM_RECENTS = "android.permission.START_TASKS_FROM_RECENTS";
+0 −13
Original line number Diff line number Diff line
@@ -410,14 +410,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int FLAG_IMMUTABLY_RESTRICTED = 1<<4;

    /**
     * Flag for {@link #flags}, corresponding to <code>installerExemptIgnored</code>
     * value of {@link android.R.attr#permissionFlags}.
     *
     * <p> Modifier for permission restriction. This permission cannot be exempted by the installer.
     */
    public static final int FLAG_INSTALLER_EXEMPT_IGNORED = 1 << 5;

    /**
     * Flag for {@link #flags}, indicating that this permission has been
     * installed into the system's globally defined permissions.
@@ -723,11 +715,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
        return isHardRestricted() || isSoftRestricted();
    }

    /** @hide */
    public boolean isInstallerExemptIgnored() {
        return (flags & PermissionInfo.FLAG_INSTALLER_EXEMPT_IGNORED) != 0;
    }

    /** @hide */
    public boolean isAppOp() {
        return (protectionLevel & PermissionInfo.PROTECTION_FLAG_APPOP) != 0;
+10 −10
Original line number Diff line number Diff line
@@ -1284,15 +1284,15 @@
        android:backgroundPermission="android.permission.RECORD_BACKGROUND_AUDIO"
        android:protectionLevel="dangerous|instant" />

    <!-- Allows an application to record audio while in the background.
         <p>Protection level: dangerous
    -->
    <!-- @SystemApi @TestApi Allows an application to record audio while in the background.
         This permission is not intended to be held by apps.
         <p>Protection level: internal
        @hide -->
    <permission android:name="android.permission.RECORD_BACKGROUND_AUDIO"
        android:permissionGroup="android.permission-group.UNDEFINED"
        android:label="@string/permlab_recordBackgroundAudio"
        android:description="@string/permdesc_recordBackgroundAudio"
        android:permissionFlags="hardRestricted|installerExemptIgnored"
        android:protectionLevel="dangerous" />
        android:protectionLevel="internal" />

    <!-- ====================================================================== -->
    <!-- Permissions for activity recognition                        -->
@@ -1368,15 +1368,15 @@
        android:backgroundPermission="android.permission.BACKGROUND_CAMERA"
        android:protectionLevel="dangerous|instant" />

    <!-- Required to be able to access the camera device in the background.
         <p>Protection level: dangerous
    -->
    <!-- @SystemApi @TestApi Required to be able to access the camera device in the background.
         This permission is not intended to be held by apps.
         <p>Protection level: internal
        @hide -->
    <permission android:name="android.permission.BACKGROUND_CAMERA"
            android:permissionGroup="android.permission-group.UNDEFINED"
            android:label="@string/permlab_backgroundCamera"
            android:description="@string/permdesc_backgroundCamera"
            android:permissionFlags="hardRestricted|installerExemptIgnored"
            android:protectionLevel="dangerous" />
            android:protectionLevel="internal" />

    <!-- @SystemApi Required in addition to android.permission.CAMERA to be able to access
           system only camera devices.
Loading