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

Commit 86b5a0af authored by Anubhav Kakkar's avatar Anubhav Kakkar Committed by Android (Google) Code Review
Browse files

Merge "Implement special app access settings for MEDIA_ROUTING_CONTROL app-op." into main

parents 57fe15ae 642bc5a6
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -4185,6 +4185,25 @@
                       android:value="@string/menu_key_apps"/>
        </activity>

        <!-- @FlaggedApi("com.android.media.flags.enable_privileged_routing_for_media_routing_control") -->
        <activity-alias
            android:name="MediaRoutingControlActivity"
            android:knownActivityEmbeddingCerts="@array/config_known_host_certs"
            android:exported="true"
            android:targetActivity=".spa.SpaBridgeActivity"
            android:label="@string/media_routing_control_title">
            <intent-filter android:priority="1">
                <action android:name="android.settings.REQUEST_MEDIA_ROUTING_CONTROL" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.spa.DESTINATION"
                       android:value="TogglePermissionAppList/MediaRoutingControl"/>
            <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
                       android:value="@string/menu_key_apps"/>
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                       android:value="true" />
        </activity-alias>

        <!-- Keep compatibility with old WebView-picker implementation -->
        <activity-alias android:name=".WebViewImplementation"
                  android:targetActivity="Settings$WebViewAppPickerActivity"
+8 −0
Original line number Diff line number Diff line
@@ -9479,6 +9479,14 @@
    <!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
    <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. This app will be able to see where you tap or change what\u2019s displayed on the screen.</string>
    <!-- Change Media Output settings -->
    <!-- Title for Change Media Output screen [CHAR LIMIT=30] -->
    <string name="media_routing_control_title">Change media output</string>
    <!-- Label for setting which controls whether app can change media outputs for other apps [CHAR LIMIT=45] -->
    <string name="allow_media_routing_control">Allow app to switch media output</string>
    <!-- Description for allowing change media output setting [CHAR LIMIT=NONE] -->
    <string name="allow_media_routing_description">Allow this app to choose which connected device plays audio or video from other apps. If allowed, this app can access a list of available devices such as headphones and speakers and choose which output device is used to stream or cast audio or video.</string>
    <!-- Manager External Storage settings title [CHAR LIMIT=40] -->
    <string name="manage_external_storage_title">All files access</string>
    <!-- Label for a setting which controls whether an app can manage external storage [CHAR LIMIT=45] -->
+7 −0
Original line number Diff line number Diff line
@@ -94,6 +94,13 @@
        android:fragment="com.android.settings.notification.NotificationAccessSettings"
        settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />

    <Preference
        android:key="media_routing_control"
        android:title="@string/media_routing_control_title"
        android:order="-1100"
        settings:controller="com.android.settings.applications.specialaccess.MediaRoutingControlPreferenceController" >
    </Preference>

    <Preference
        android:key="use_full_screen_intent"
        android:title="@string/full_screen_intent_title"
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.settings.applications.specialaccess;

import android.Manifest;
import android.content.Context;
import android.text.TextUtils;

import androidx.preference.Preference;

import com.android.media.flags.Flags;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.spa.SpaActivity;
import com.android.settings.spa.app.specialaccess.MediaRoutingControlAppListProvider;

/**
 * This controller manages features availability for special app access for
 * {@link Manifest.permission#MEDIA_ROUTING_CONTROL} permission.
 */
public class MediaRoutingControlPreferenceController extends BasePreferenceController {
    public MediaRoutingControlPreferenceController(Context context, String preferenceKey) {
        super(context, preferenceKey);
    }

    @Override
    public int getAvailabilityStatus() {
        return Flags.enablePrivilegedRoutingForMediaRoutingControl()
                ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
    }

    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
        if (TextUtils.equals(preference.getKey(), mPreferenceKey)) {
            SpaActivity.startSpaActivity(
                    mContext, MediaRoutingControlAppListProvider.INSTANCE.getAppListRoute());
            return true;
        }
        return false;
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.settings.spa.app.specialaccess.DisplayOverOtherAppsAppListPro
import com.android.settings.spa.app.specialaccess.InstallUnknownAppsListProvider
import com.android.settings.spa.app.specialaccess.LongBackgroundTasksAppListProvider
import com.android.settings.spa.app.specialaccess.MediaManagementAppsAppListProvider
import com.android.settings.spa.app.specialaccess.MediaRoutingControlAppListProvider
import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListProvider
import com.android.settings.spa.app.specialaccess.NfcTagAppsSettingsProvider
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
@@ -64,6 +65,7 @@ open class SettingsSpaEnvironment(context: Context) : SpaEnvironment(context) {
            AllFilesAccessAppListProvider,
            DisplayOverOtherAppsAppListProvider,
            MediaManagementAppsAppListProvider,
            MediaRoutingControlAppListProvider,
            ModifySystemSettingsAppListProvider,
            UseFullScreenIntentAppListProvider,
            PictureInPictureListProvider,
Loading