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

Commit d3a34ef9 authored by Iván Budnik's avatar Iván Budnik Committed by Android (Google) Code Review
Browse files

Merge "Create MEDIA_ROUTING_CONTROL app op permission for proxy routing" into main

parents 5eb17cf2 0534fe13
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ package android {
    field public static final String MANAGE_WIFI_NETWORK_SELECTION = "android.permission.MANAGE_WIFI_NETWORK_SELECTION";
    field public static final String MASTER_CLEAR = "android.permission.MASTER_CLEAR";
    field public static final String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL";
    field @FlaggedApi("com.android.media.flags.enable_privileged_routing_for_media_routing_control") public static final String MEDIA_ROUTING_CONTROL = "android.permission.MEDIA_ROUTING_CONTROL";
    field public static final String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS";
    field public static final String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE";
    field public static final String MOUNT_FORMAT_FILESYSTEMS = "android.permission.MOUNT_FORMAT_FILESYSTEMS";
+1 −0
Original line number Diff line number Diff line
@@ -640,6 +640,7 @@ package android.app {
    field public static final String OPSTR_MANAGE_EXTERNAL_STORAGE = "android:manage_external_storage";
    field public static final String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels";
    field public static final String OPSTR_MANAGE_ONGOING_CALLS = "android:manage_ongoing_calls";
    field @FlaggedApi("com.android.media.flags.enable_privileged_routing_for_media_routing_control") public static final String OPSTR_MEDIA_ROUTING_CONTROL = "android:media_routing_control";
    field public static final String OPSTR_MUTE_MICROPHONE = "android:mute_microphone";
    field public static final String OPSTR_NEIGHBORING_CELLS = "android:neighboring_cells";
    field public static final String OPSTR_PHONE_CALL_CAMERA = "android:phone_call_camera";
+28 −2
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import android.content.pm.ParceledListSlice;
import android.database.DatabaseUtils;
import android.health.connect.HealthConnectManager;
import android.media.AudioAttributes.AttributeUsage;
import android.media.MediaRouter2;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
@@ -89,6 +90,7 @@ import com.android.internal.util.DataClass;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.Parcelling;
import com.android.internal.util.Preconditions;
import com.android.media.flags.Flags;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -1506,9 +1508,15 @@ public class AppOpsManager {
    public static final int OP_CREATE_ACCESSIBILITY_OVERLAY =
            AppProtoEnums.APP_OP_CREATE_ACCESSIBILITY_OVERLAY;

    /**
     * See {@link #OPSTR_MEDIA_ROUTING_CONTROL}.
     * @hide
     */
    public static final int OP_MEDIA_ROUTING_CONTROL = AppProtoEnums.APP_OP_MEDIA_ROUTING_CONTROL;

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

    /**
     * All app ops represented as strings.
@@ -1654,6 +1662,7 @@ public class AppOpsManager {
            OPSTR_RECEIVE_SANDBOX_TRIGGER_AUDIO,
            OPSTR_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA,
            OPSTR_CREATE_ACCESSIBILITY_OVERLAY,
            OPSTR_MEDIA_ROUTING_CONTROL,
    })
    public @interface AppOpString {}

@@ -1980,6 +1989,19 @@ public class AppOpsManager {
    @TestApi
    public static final String OPSTR_MANAGE_ONGOING_CALLS = "android:manage_ongoing_calls";

    /**
     * Allows apps holding this permission to control the routing of other apps via {@link
     * MediaRouter2}.
     *
     * <p>For example, holding this permission allows watches (via companion apps) to control the
     * routing of applications running on the phone.
     *
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_ENABLE_PRIVILEGED_ROUTING_FOR_MEDIA_ROUTING_CONTROL)
    public static final String OPSTR_MEDIA_ROUTING_CONTROL = "android:media_routing_control";

    /**
     * AppOp granted to apps that we are started via {@code am instrument -e --no-isolated-storage}
     *
@@ -2404,7 +2426,8 @@ public class AppOpsManager {
            OP_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD,
            OP_USE_FULL_SCREEN_INTENT,
            OP_RECEIVE_SANDBOX_TRIGGER_AUDIO,
            OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA
            OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA,
            OP_MEDIA_ROUTING_CONTROL,
    };

    static final AppOpInfo[] sAppOpInfos = new AppOpInfo[]{
@@ -2846,6 +2869,9 @@ public class AppOpsManager {
                OPSTR_CREATE_ACCESSIBILITY_OVERLAY,
                "CREATE_ACCESSIBILITY_OVERLAY")
                .setDefaultMode(AppOpsManager.MODE_ALLOWED).build(),
        new AppOpInfo.Builder(OP_MEDIA_ROUTING_CONTROL, OPSTR_MEDIA_ROUTING_CONTROL,
                "MEDIA_ROUTING_CONTROL")
                .setPermission(Manifest.permission.MEDIA_ROUTING_CONTROL).build(),
    };

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

    <!-- Allows an application to control the routing of media apps.
         <p>Only for use by role COMPANION_DEVICE_WATCH</p>
         @FlaggedApi("com.android.media.flags.enable_privileged_routing_for_media_routing_control")
         -->
    <permission android:name="android.permission.MEDIA_ROUTING_CONTROL"
                android:protectionLevel="signature|appop" />

    <!-- @SystemApi @hide Allows an application to set the volume key long-press listener.
         <p>When it's set, the application will receive the volume key long-press event
         instead of changing volume.</p>
+7 −0
Original line number Diff line number Diff line
@@ -48,3 +48,10 @@ flag {
    description: "Enables the following type constants in MediaRoute2Info: CAR, COMPUTER, GAME_CONSOLE, SMARTPHONE, SMARTWATCH, TABLET, TABLET_DOCKED. Note that this doesn't gate any behavior. It only guards some API int symbols."
    bug: "301713440"
}

flag {
    name: "enable_privileged_routing_for_media_routing_control"
    namespace: "media_solutions"
    description: "Allow access to privileged routing capabilities to MEDIA_ROUTING_CONTROL holders."
    bug: "305919655"
}
Loading