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

Commit 8c2e86d1 authored by Steven Lee's avatar Steven Lee
Browse files

Add permission for CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD AppOp

Add new CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD permission. Couple it with OP_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD.
Protection level for the permission is currently internal|appop.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Existing SystemConfig attribute name

Legal tracker bug: 262936053
Privacy tracker bug: 262936015

Bug: 259436697
Bug: 262628255
Bug: 263163141
Test: device boots
Test: atest CtsPermission2TestCases:android.permission2.cts.RuntimePermissionProperties#allAppOpPermissionNeedAnAppOp
Change-Id: I01bc38108fa2054019032e18bb56fba69160a4d3
parent b7a44e84
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -91,6 +91,7 @@ package android {
    field public static final String CAMERA_DISABLE_TRANSMIT_LED = "android.permission.CAMERA_DISABLE_TRANSMIT_LED";
    field public static final String CAMERA_DISABLE_TRANSMIT_LED = "android.permission.CAMERA_DISABLE_TRANSMIT_LED";
    field public static final String CAMERA_OPEN_CLOSE_LISTENER = "android.permission.CAMERA_OPEN_CLOSE_LISTENER";
    field public static final String CAMERA_OPEN_CLOSE_LISTENER = "android.permission.CAMERA_OPEN_CLOSE_LISTENER";
    field public static final String CAPTURE_AUDIO_HOTWORD = "android.permission.CAPTURE_AUDIO_HOTWORD";
    field public static final String CAPTURE_AUDIO_HOTWORD = "android.permission.CAPTURE_AUDIO_HOTWORD";
    field public static final String CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD = "android.permission.CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD";
    field public static final String CAPTURE_MEDIA_OUTPUT = "android.permission.CAPTURE_MEDIA_OUTPUT";
    field public static final String CAPTURE_MEDIA_OUTPUT = "android.permission.CAPTURE_MEDIA_OUTPUT";
    field public static final String CAPTURE_TUNER_AUDIO_INPUT = "android.permission.CAPTURE_TUNER_AUDIO_INPUT";
    field public static final String CAPTURE_TUNER_AUDIO_INPUT = "android.permission.CAPTURE_TUNER_AUDIO_INPUT";
    field public static final String CAPTURE_TV_INPUT = "android.permission.CAPTURE_TV_INPUT";
    field public static final String CAPTURE_TV_INPUT = "android.permission.CAPTURE_TV_INPUT";
@@ -582,6 +583,7 @@ package android.app {
    field public static final String OPSTR_AUTO_REVOKE_MANAGED_BY_INSTALLER = "android:auto_revoke_managed_by_installer";
    field public static final String OPSTR_AUTO_REVOKE_MANAGED_BY_INSTALLER = "android:auto_revoke_managed_by_installer";
    field public static final String OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED = "android:auto_revoke_permissions_if_unused";
    field public static final String OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED = "android:auto_revoke_permissions_if_unused";
    field public static final String OPSTR_BIND_ACCESSIBILITY_SERVICE = "android:bind_accessibility_service";
    field public static final String OPSTR_BIND_ACCESSIBILITY_SERVICE = "android:bind_accessibility_service";
    field public static final String OPSTR_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD = "android:capture_consentless_bugreport_on_userdebug_build";
    field public static final String OPSTR_CHANGE_WIFI_STATE = "android:change_wifi_state";
    field public static final String OPSTR_CHANGE_WIFI_STATE = "android:change_wifi_state";
    field public static final String OPSTR_ESTABLISH_VPN_MANAGER = "android:establish_vpn_manager";
    field public static final String OPSTR_ESTABLISH_VPN_MANAGER = "android:establish_vpn_manager";
    field public static final String OPSTR_ESTABLISH_VPN_SERVICE = "android:establish_vpn_service";
    field public static final String OPSTR_ESTABLISH_VPN_SERVICE = "android:establish_vpn_service";
+28 −2
Original line number Original line Diff line number Diff line
@@ -1439,9 +1439,18 @@ public class AppOpsManager {
    public static final int OP_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON =
    public static final int OP_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON =
            AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON;
            AppProtoEnums.APP_OP_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON;


    /**
     * Allows an application to capture bugreport directly without consent dialog when using the
     * bugreporting API on userdebug/eng build.
     *
     * @hide
     */
    public static final int OP_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD =
            AppProtoEnums.APP_OP_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD;

    /** @hide */
    /** @hide */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int _NUM_OP = 131;
    public static final int _NUM_OP = 132;


    /** Access to coarse location information. */
    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -2011,6 +2020,16 @@ public class AppOpsManager {
    public static final String OPSTR_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON =
    public static final String OPSTR_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON =
            "android:system_exempt_from_fgs_stop_button";
            "android:system_exempt_from_fgs_stop_button";


    /**
     * Allows an application to capture bugreport directly without consent dialog when using the
     * bugreporting API on userdebug/eng build.
     *
     * @hide
     */
    @SystemApi
    public static final String OPSTR_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD =
            "android:capture_consentless_bugreport_on_userdebug_build";

    /** {@link #sAppOpsToNote} not initialized yet for this op */
    /** {@link #sAppOpsToNote} not initialized yet for this op */
    private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
    private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
    /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */
    /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */
@@ -2108,6 +2127,7 @@ public class AppOpsManager {
            OP_RUN_LONG_JOBS,
            OP_RUN_LONG_JOBS,
            OP_READ_MEDIA_VISUAL_USER_SELECTED,
            OP_READ_MEDIA_VISUAL_USER_SELECTED,
            OP_FOREGROUND_SERVICE_SPECIAL_USE,
            OP_FOREGROUND_SERVICE_SPECIAL_USE,
            OP_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD,
    };
    };


    static final AppOpInfo[] sAppOpInfos = new AppOpInfo[]{
    static final AppOpInfo[] sAppOpInfos = new AppOpInfo[]{
@@ -2515,7 +2535,13 @@ public class AppOpsManager {
                .build(),
                .build(),
        new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON,
        new AppOpInfo.Builder(OP_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON,
                OPSTR_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON,
                OPSTR_SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON,
                "SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON").build()
                "SYSTEM_EXEMPT_FROM_FGS_STOP_BUTTON").build(),
        new AppOpInfo.Builder(
                OP_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD,
                OPSTR_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD,
                "CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD")
                .setPermission(Manifest.permission.CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD)
                .build()
    };
    };


    // The number of longs needed to form a full bitmask of app ops
    // The number of longs needed to form a full bitmask of app ops
+13 −0
Original line number Original line Diff line number Diff line
@@ -7050,6 +7050,19 @@
    <permission android:name="android.permission.QUERY_CLONED_APPS"
    <permission android:name="android.permission.QUERY_CLONED_APPS"
                android:protectionLevel="signature|privileged" />
                android:protectionLevel="signature|privileged" />


    <!-- @hide @SystemApi
         Allows applications to capture bugreport directly without consent dialog when using the
         bugreporting API on userdebug/eng build.
         <p>The application still needs to hold {@link android.permission.DUMP} permission and be
         bugreport-whitelisted to be able to capture a bugreport using the bugreporting API in the
         first place. Then, when the corresponding app op of this permission is ALLOWED, the
         bugreport can be captured directly without going through the consent dialog.
         <p>Protection level: internal|appop
         <p>Intended to only be used on userdebug/eng build.
         <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD"
                android:protectionLevel="internal|appop" />

    <!-- Attribution for Geofencing service. -->
    <!-- Attribution for Geofencing service. -->
    <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/>
    <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/>
    <!-- Attribution for Country Detector. -->
    <!-- Attribution for Country Detector. -->