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

Commit 093ba7e5 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Allow to exempt apps from restrictions to RECORD_AUDIO" into rvc-dev

parents 7004577d ad787aa1
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -79,6 +79,7 @@ package android {
    field public static final String DEVICE_POWER = "android.permission.DEVICE_POWER";
    field public static final String DEVICE_POWER = "android.permission.DEVICE_POWER";
    field public static final String DISPATCH_PROVISIONING_MESSAGE = "android.permission.DISPATCH_PROVISIONING_MESSAGE";
    field public static final String DISPATCH_PROVISIONING_MESSAGE = "android.permission.DISPATCH_PROVISIONING_MESSAGE";
    field public static final String ENTER_CAR_MODE_PRIORITIZED = "android.permission.ENTER_CAR_MODE_PRIORITIZED";
    field public static final String ENTER_CAR_MODE_PRIORITIZED = "android.permission.ENTER_CAR_MODE_PRIORITIZED";
    field public static final String EXEMPT_FROM_AUDIO_RECORD_RESTRICTIONS = "android.permission.EXEMPT_FROM_AUDIO_RECORD_RESTRICTIONS";
    field public static final String FORCE_BACK = "android.permission.FORCE_BACK";
    field public static final String FORCE_BACK = "android.permission.FORCE_BACK";
    field public static final String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
    field public static final String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
    field public static final String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS";
    field public static final String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS";
+128 −105
Original line number Original line Diff line number Diff line
@@ -1988,108 +1988,108 @@ public class AppOpsManager {
    };
    };


    /**
    /**
     * This specifies whether each option should allow the system
     * In which cases should an app be allowed to bypass the {@link #setUserRestriction user
     * (and system ui) to bypass the user restriction when active.
     * restriction} for a certain app-op.
     */
     */
    private static boolean[] sOpAllowSystemRestrictionBypass = new boolean[] {
    private static RestrictionBypass[] sOpAllowSystemRestrictionBypass = new RestrictionBypass[] {
            true, //COARSE_LOCATION
            new RestrictionBypass(true, false), //COARSE_LOCATION
            true, //FINE_LOCATION
            new RestrictionBypass(true, false), //FINE_LOCATION
            false, //GPS
            null, //GPS
            false, //VIBRATE
            null, //VIBRATE
            false, //READ_CONTACTS
            null, //READ_CONTACTS
            false, //WRITE_CONTACTS
            null, //WRITE_CONTACTS
            false, //READ_CALL_LOG
            null, //READ_CALL_LOG
            false, //WRITE_CALL_LOG
            null, //WRITE_CALL_LOG
            false, //READ_CALENDAR
            null, //READ_CALENDAR
            false, //WRITE_CALENDAR
            null, //WRITE_CALENDAR
            true, //WIFI_SCAN
            new RestrictionBypass(true, false), //WIFI_SCAN
            false, //POST_NOTIFICATION
            null, //POST_NOTIFICATION
            false, //NEIGHBORING_CELLS
            null, //NEIGHBORING_CELLS
            false, //CALL_PHONE
            null, //CALL_PHONE
            false, //READ_SMS
            null, //READ_SMS
            false, //WRITE_SMS
            null, //WRITE_SMS
            false, //RECEIVE_SMS
            null, //RECEIVE_SMS
            false, //RECEIVE_EMERGECY_SMS
            null, //RECEIVE_EMERGECY_SMS
            false, //RECEIVE_MMS
            null, //RECEIVE_MMS
            false, //RECEIVE_WAP_PUSH
            null, //RECEIVE_WAP_PUSH
            false, //SEND_SMS
            null, //SEND_SMS
            false, //READ_ICC_SMS
            null, //READ_ICC_SMS
            false, //WRITE_ICC_SMS
            null, //WRITE_ICC_SMS
            false, //WRITE_SETTINGS
            null, //WRITE_SETTINGS
            true, //SYSTEM_ALERT_WINDOW
            new RestrictionBypass(true, false), //SYSTEM_ALERT_WINDOW
            false, //ACCESS_NOTIFICATIONS
            null, //ACCESS_NOTIFICATIONS
            false, //CAMERA
            null, //CAMERA
            false, //RECORD_AUDIO
            new RestrictionBypass(false, true), //RECORD_AUDIO
            false, //PLAY_AUDIO
            null, //PLAY_AUDIO
            false, //READ_CLIPBOARD
            null, //READ_CLIPBOARD
            false, //WRITE_CLIPBOARD
            null, //WRITE_CLIPBOARD
            false, //TAKE_MEDIA_BUTTONS
            null, //TAKE_MEDIA_BUTTONS
            false, //TAKE_AUDIO_FOCUS
            null, //TAKE_AUDIO_FOCUS
            false, //AUDIO_MASTER_VOLUME
            null, //AUDIO_MASTER_VOLUME
            false, //AUDIO_VOICE_VOLUME
            null, //AUDIO_VOICE_VOLUME
            false, //AUDIO_RING_VOLUME
            null, //AUDIO_RING_VOLUME
            false, //AUDIO_MEDIA_VOLUME
            null, //AUDIO_MEDIA_VOLUME
            false, //AUDIO_ALARM_VOLUME
            null, //AUDIO_ALARM_VOLUME
            false, //AUDIO_NOTIFICATION_VOLUME
            null, //AUDIO_NOTIFICATION_VOLUME
            false, //AUDIO_BLUETOOTH_VOLUME
            null, //AUDIO_BLUETOOTH_VOLUME
            false, //WAKE_LOCK
            null, //WAKE_LOCK
            false, //MONITOR_LOCATION
            null, //MONITOR_LOCATION
            false, //MONITOR_HIGH_POWER_LOCATION
            null, //MONITOR_HIGH_POWER_LOCATION
            false, //GET_USAGE_STATS
            null, //GET_USAGE_STATS
            false, //MUTE_MICROPHONE
            null, //MUTE_MICROPHONE
            true, //TOAST_WINDOW
            new RestrictionBypass(true, false), //TOAST_WINDOW
            false, //PROJECT_MEDIA
            null, //PROJECT_MEDIA
            false, //ACTIVATE_VPN
            null, //ACTIVATE_VPN
            false, //WALLPAPER
            null, //WALLPAPER
            false, //ASSIST_STRUCTURE
            null, //ASSIST_STRUCTURE
            false, //ASSIST_SCREENSHOT
            null, //ASSIST_SCREENSHOT
            false, //READ_PHONE_STATE
            null, //READ_PHONE_STATE
            false, //ADD_VOICEMAIL
            null, //ADD_VOICEMAIL
            false, // USE_SIP
            null, // USE_SIP
            false, // PROCESS_OUTGOING_CALLS
            null, // PROCESS_OUTGOING_CALLS
            false, // USE_FINGERPRINT
            null, // USE_FINGERPRINT
            false, // BODY_SENSORS
            null, // BODY_SENSORS
            false, // READ_CELL_BROADCASTS
            null, // READ_CELL_BROADCASTS
            false, // MOCK_LOCATION
            null, // MOCK_LOCATION
            false, // READ_EXTERNAL_STORAGE
            null, // READ_EXTERNAL_STORAGE
            false, // WRITE_EXTERNAL_STORAGE
            null, // WRITE_EXTERNAL_STORAGE
            false, // TURN_ON_SCREEN
            null, // TURN_ON_SCREEN
            false, // GET_ACCOUNTS
            null, // GET_ACCOUNTS
            false, // RUN_IN_BACKGROUND
            null, // RUN_IN_BACKGROUND
            false, // AUDIO_ACCESSIBILITY_VOLUME
            null, // AUDIO_ACCESSIBILITY_VOLUME
            false, // READ_PHONE_NUMBERS
            null, // READ_PHONE_NUMBERS
            false, // REQUEST_INSTALL_PACKAGES
            null, // REQUEST_INSTALL_PACKAGES
            false, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
            null, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
            false, // INSTANT_APP_START_FOREGROUND
            null, // INSTANT_APP_START_FOREGROUND
            false, // ANSWER_PHONE_CALLS
            null, // ANSWER_PHONE_CALLS
            false, // OP_RUN_ANY_IN_BACKGROUND
            null, // OP_RUN_ANY_IN_BACKGROUND
            false, // OP_CHANGE_WIFI_STATE
            null, // OP_CHANGE_WIFI_STATE
            false, // OP_REQUEST_DELETE_PACKAGES
            null, // OP_REQUEST_DELETE_PACKAGES
            false, // OP_BIND_ACCESSIBILITY_SERVICE
            null, // OP_BIND_ACCESSIBILITY_SERVICE
            false, // ACCEPT_HANDOVER
            null, // ACCEPT_HANDOVER
            false, // MANAGE_IPSEC_HANDOVERS
            null, // MANAGE_IPSEC_HANDOVERS
            false, // START_FOREGROUND
            null, // START_FOREGROUND
            true, // BLUETOOTH_SCAN
            new RestrictionBypass(true, false), // BLUETOOTH_SCAN
            false, // USE_BIOMETRIC
            null, // USE_BIOMETRIC
            false, // ACTIVITY_RECOGNITION
            null, // ACTIVITY_RECOGNITION
            false, // SMS_FINANCIAL_TRANSACTIONS
            null, // SMS_FINANCIAL_TRANSACTIONS
            false, // READ_MEDIA_AUDIO
            null, // READ_MEDIA_AUDIO
            false, // WRITE_MEDIA_AUDIO
            null, // WRITE_MEDIA_AUDIO
            false, // READ_MEDIA_VIDEO
            null, // READ_MEDIA_VIDEO
            false, // WRITE_MEDIA_VIDEO
            null, // WRITE_MEDIA_VIDEO
            false, // READ_MEDIA_IMAGES
            null, // READ_MEDIA_IMAGES
            false, // WRITE_MEDIA_IMAGES
            null, // WRITE_MEDIA_IMAGES
            false, // LEGACY_STORAGE
            null, // LEGACY_STORAGE
            false, // ACCESS_ACCESSIBILITY
            null, // ACCESS_ACCESSIBILITY
            false, // READ_DEVICE_IDENTIFIERS
            null, // READ_DEVICE_IDENTIFIERS
            false, // ACCESS_MEDIA_LOCATION
            null, // ACCESS_MEDIA_LOCATION
            false, // QUERY_ALL_PACKAGES
            null, // QUERY_ALL_PACKAGES
            false, // MANAGE_EXTERNAL_STORAGE
            null, // MANAGE_EXTERNAL_STORAGE
            false, // INTERACT_ACROSS_PROFILES
            null, // INTERACT_ACROSS_PROFILES
            false, // ACTIVATE_PLATFORM_VPN
            null, // ACTIVATE_PLATFORM_VPN
            false, // LOADER_USAGE_STATS
            null, // LOADER_USAGE_STATS
            false, // ACCESS_CALL_AUDIO
            null, // ACCESS_CALL_AUDIO
            false, // AUTO_REVOKE_PERMISSIONS_IF_UNUSED
            null, // AUTO_REVOKE_PERMISSIONS_IF_UNUSED
    };
    };


    /**
    /**
@@ -2485,11 +2485,11 @@ public class AppOpsManager {
    }
    }


    /**
    /**
     * Retrieve whether the op allows the system (and system ui) to
     * Retrieve whether the op allows to bypass the user restriction.
     * bypass the user restriction.
     *
     * @hide
     * @hide
     */
     */
    public static boolean opAllowSystemBypassRestriction(int op) {
    public static RestrictionBypass opAllowSystemBypassRestriction(int op) {
        return sOpAllowSystemRestrictionBypass[op];
        return sOpAllowSystemRestrictionBypass[op];
    }
    }


@@ -2535,6 +2535,29 @@ public class AppOpsManager {
        return !sOpDisableReset[op];
        return !sOpDisableReset[op];
    }
    }


    /**
     * When to not enforce {@link #setUserRestriction restrictions}.
     *
     * @hide
     */
    public static class RestrictionBypass {
        /** Does the app need to be privileged to bypass the restriction */
        public boolean isPrivileged;

        /**
         * Does the app need to have the EXEMPT_FROM_AUDIO_RESTRICTIONS permission to bypass the
         * restriction
         */
        public boolean isRecordAudioRestrictionExcept;

        public RestrictionBypass(boolean isPrivileged, boolean isRecordAudioRestrictionExcept) {
            this.isPrivileged = isPrivileged;
            this.isRecordAudioRestrictionExcept = isRecordAudioRestrictionExcept;
        }

        public static RestrictionBypass UNRESTRICTED = new RestrictionBypass(true, true);
    }

    /**
    /**
     * Class holding all of the operation information associated with an app.
     * Class holding all of the operation information associated with an app.
     * @hide
     * @hide
+10 −0
Original line number Original line Diff line number Diff line
@@ -1187,6 +1187,16 @@
                android:description="@string/permdesc_callCompanionApp"
                android:description="@string/permdesc_callCompanionApp"
                android:protectionLevel="normal" />
                android:protectionLevel="normal" />


    <!-- Exempt this uid from restrictions to background audio recoding
     <p>Protection level: signature|privileged
     @hide
     @SystemApi
    -->
    <permission android:name="android.permission.EXEMPT_FROM_AUDIO_RECORD_RESTRICTIONS"
                android:label="@string/permlab_exemptFromAudioRecordRestrictions"
                android:description="@string/permdesc_exemptFromAudioRecordRestrictions"
                android:protectionLevel="signature|privileged" />

    <!-- Allows a calling app to continue a call which was started in another app.  An example is a
    <!-- Allows a calling app to continue a call which was started in another app.  An example is a
         video calling app that wants to continue a voice call on the user's mobile network.<p>
         video calling app that wants to continue a voice call on the user's mobile network.<p>
         When the handover of a call from one app to another takes place, there are two devices
         When the handover of a call from one app to another takes place, there are two devices
+8 −0
Original line number Original line Diff line number Diff line
@@ -1217,6 +1217,14 @@
        device. This includes information such as call numbers for calls and the state of the
        device. This includes information such as call numbers for calls and the state of the
        calls.</string>
        calls.</string>


    <!-- Title of an application permission. When granted the app is exempt from audio record
    restrictions.
    [CHAR LIMIT=NONE]-->
    <string name="permlab_exemptFromAudioRecordRestrictions">exempt from audio record restrictions</string>
    <!-- Description of an application permission. When granted the app is exempt from audio record
    restrictions. [CHAR LIMIT=NONE]-->
    <string name="permdesc_exemptFromAudioRecordRestrictions">Exempt the app from restrictions to record audio.</string>

    <!-- Title of an application permission.  When granted the user is giving access to a third
    <!-- Title of an application permission.  When granted the user is giving access to a third
         party app to continue a call which originated in another app.  For example, the user
         party app to continue a call which originated in another app.  For example, the user
         could be in a voice call over their carrier's mobile network, and a third party video
         could be in a voice call over their carrier's mobile network, and a third party video
+88 −135

File changed.

Preview size limit exceeded, changes collapsed.