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

Commit 9dfa566c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6461449 from 9bb55e10 to rvc-release

Change-Id: I7ac8edaaa28ae39c40283051e3ec396a78c08da2
parents 75374854 9bb55e10
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -8470,7 +8470,7 @@
    <string name="notification_priority_title">Priority</string>
    <!-- [CHAR LIMIT=150] Notification Importance title: important conversation level summary -->
    <string name="notification_channel_summary_priority">Shows at top of conversation section and appears as a bubble.</string>
    <string name="notification_channel_summary_priority">Shows at top of conversation section and appears as a bubble</string>
    <string name="convo_not_supported_summary"><xliff:g id="app_name" example="Android Services">%1$s</xliff:g> does not support conversation-specific settings.</string>
@@ -8491,6 +8491,9 @@
    <!-- [CHAR LIMIT=100] Label for on/off toggle -->
    <string name="notification_switch_label">All \"<xliff:g id="app_name" example="Android Services">%1$s</xliff:g>\" notifications</string>
    <!-- [CHAR LIMIT=100] Label for on/off toggle -->
    <string name="notification_app_switch_label">All <xliff:g id="app_name" example="Android Services">%1$s</xliff:g> notifications</string>
    <!-- Default Apps > Default notification assistant -->
    <string name="default_notification_assistant">Adaptive Notifications</string>
@@ -11795,6 +11798,11 @@
    <!-- Summary for the top level Privacy Settings [CHAR LIMIT=NONE]-->
    <string name="privacy_dashboard_summary">Permissions, account activity, personal data</string>
    <!-- UI debug setting: show media player on quick settings title [CHAR LIMIT=60] -->
    <string name="quick_settings_media_player">Media resumption</string>
    <!-- UI debug setting: show media player on quick settings summary [CHAR_LIMIT=NONE] -->
    <string name="quick_settings_media_player_summary">Shows and persists media player in Quick Settings. Requires reboot.</string>
    <!-- Label for button in contextual card for users to remove the card [CHAR LIMIT=30] -->
    <string name="contextual_card_dismiss_remove">Remove</string>
    <!-- Label for button in contextual card for users to keep the card [CHAR LIMIT=30] -->
+5 −0
Original line number Diff line number Diff line
@@ -525,6 +525,11 @@
            android:title="@string/usb_audio_disable_routing"
            android:summary="@string/usb_audio_disable_routing_summary" />

        <SwitchPreference
            android:key="quick_settings_media_player"
            android:title="@string/quick_settings_media_player"
            android:summary="@string/quick_settings_media_player_summary" />

    </PreferenceCategory>

    <PreferenceCategory
+1 −0
Original line number Diff line number Diff line
@@ -491,6 +491,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
        controllers.add(new DebugNonRectClipOperationsPreferenceController(context));
        controllers.add(new ForceDarkPreferenceController(context));
        controllers.add(new EnableBlursPreferenceController(context));
        controllers.add(new QuickSettingsMediaPlayerPreferenceController(context));
        controllers.add(new ForceMSAAPreferenceController(context));
        controllers.add(new HardwareOverlaysPreferenceController(context));
        controllers.add(new SimulateColorSpacePreferenceController(context));
+73 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.development;

import android.content.Context;
import android.provider.Settings;

import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;

import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;

/**
 * Controls whether the media player should be visible in quick settings.
 */
public class QuickSettingsMediaPlayerPreferenceController extends
        DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
        PreferenceControllerMixin {
    private static final String PREFERENCE_KEY = "quick_settings_media_player";
    @VisibleForTesting
    static final String SETTING_NAME = Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS;
    @VisibleForTesting
    static final int SETTING_VALUE_ON = 1;
    @VisibleForTesting
    static final int SETTING_VALUE_OFF = 0;

    public QuickSettingsMediaPlayerPreferenceController(Context context) {
        super(context);
    }

    @Override
    public String getPreferenceKey() {
        return PREFERENCE_KEY;
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        final boolean isEnabled = (Boolean) newValue;
        Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME,
                isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
        return true;
    }

    @Override
    public void updateState(Preference preference) {
        final int mode = Settings.Global.getInt(mContext.getContentResolver(), SETTING_NAME,
                SETTING_VALUE_OFF);
        ((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
    }

    @Override
    protected void onDeveloperOptionsSwitchDisabled() {
        super.onDeveloperOptionsSwitchDisabled();
        Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME, SETTING_VALUE_OFF);
        ((SwitchPreference) mPreference).setChecked(false);
    }
}
+13 −9
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.media.RoutingSessionInfo;
import android.net.Uri;
import android.os.UserHandle;
import android.os.UserManager;
@@ -173,6 +174,10 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker
        return mLocalMediaManager.getSelectedMediaDevice();
    }

    void adjustSessionVolume(String sessionId, int volume) {
        mLocalMediaManager.adjustSessionVolume(sessionId, volume);
    }

    void adjustSessionVolume(int volume) {
        mLocalMediaManager.adjustSessionVolume(volume);
    }
@@ -189,15 +194,14 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker
        return mLocalMediaManager.getSessionName();
    }

    /**
     * Find the active MediaDevice.
     *
     * @param type the media device type.
     * @return MediaDevice list
     *
     */
    public List<MediaDevice> getActiveMediaDevice(@MediaDevice.MediaDeviceType int type) {
        return mLocalMediaManager.getActiveMediaDevice(type);
    List<RoutingSessionInfo> getActiveRemoteMediaDevice() {
        final List<RoutingSessionInfo> sessionInfos = new ArrayList<>();
        for (RoutingSessionInfo info : mLocalMediaManager.getActiveMediaSession()) {
            if (!info.isSystemSession()) {
                sessionInfos.add(info);
            }
        }
        return sessionInfos;
    }

    /**
Loading