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

Commit ae78e21d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Show "Device" for remote playback device." into rvc-dev am: c0941a10...

Merge "Show "Device" for remote playback device." into rvc-dev am: c0941a10 am: d2ed4097 am: 69d6ad40

Change-Id: I5543116263b590447aa8e027e90f6d967a98a28d
parents 06ba3ea9 69d6ad40
Loading
Loading
Loading
Loading
+24 −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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="18dp"
    android:height="18dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
  <path
      android:pathData="M17,2L7,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,1.99 2,1.99L17,22c1.1,0 2,-0.9 2,-2L19,4c0,-1.1 -0.9,-2 -2,-2zM7,20L7,4h10v16L7,20zM12,9c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2c-1.11,0 -2,0.9 -2,2s0.89,2 2,2zM12,11c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z"
      android:fillColor="#000000"/>
</vector>
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@
                android:id="@+id/media_seamless"
                android:background="@*android:drawable/media_seamless_background"
                android:layout_weight="1"
                android:forceHasOverlappingRendering="false"
            >
                <ImageView
                    android:layout_width="@dimen/qs_seamless_icon_size"
+3 −0
Original line number Diff line number Diff line
@@ -1021,6 +1021,9 @@
    <!-- QuickSettings: Text to prompt the user to stop an ongoing recording [CHAR LIMIT=20] -->
    <string name="quick_settings_screen_record_stop">Stop</string>

    <!-- Default name for the media device shown in the output switcher when the name is not available [CHAR LIMIT=30] -->
    <string name="media_seamless_remote_device">Device</string>

    <!-- Recents: Text that shows above the navigation bar after launching a few apps. [CHAR LIMIT=NONE] -->
    <string name="recents_swipe_up_onboarding">Swipe up to switch apps</string>
    <!-- Recents: Text that shows above the navigation bar after launching several apps. [CHAR LIMIT=NONE] -->
+21 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.media.MediaDescription;
import android.media.MediaMetadata;
import android.media.ThumbnailUtils;
import android.media.session.MediaController;
import android.media.session.MediaController.PlaybackInfo;
import android.media.session.MediaSession;
import android.media.session.PlaybackState;
import android.net.Uri;
@@ -96,6 +97,7 @@ public class MediaControlPanel {
    public static final String MEDIA_PREFERENCE_KEY = "browser_components";
    private SharedPreferences mSharedPrefs;
    private boolean mCheckedForResumption = false;
    private boolean mIsRemotePlayback;

    // Button IDs used in notifications
    protected static final int[] NOTIF_ACTION_IDS = {
@@ -300,6 +302,13 @@ public class MediaControlPanel {
                Log.d(TAG, "LocalMediaManager is null. Not binding output chip for pkg=" + pkgName);
            }
        }
        PlaybackInfo playbackInfo = mController.getPlaybackInfo();
        if (playbackInfo != null) {
            mIsRemotePlayback = playbackInfo.getPlaybackType() == PlaybackInfo.PLAYBACK_TYPE_REMOTE;
        } else {
            Log.d(TAG, "PlaybackInfo was null. Defaulting to local playback.");
            mIsRemotePlayback = false;
        }

        makeActive();

@@ -545,7 +554,16 @@ public class MediaControlPanel {
        TextView deviceName = mSeamless.findViewById(R.id.media_seamless_text);
        deviceName.setTextColor(fgTintList);

        if (device != null) {
        if (mIsRemotePlayback) {
            mSeamless.setEnabled(false);
            mSeamless.setAlpha(0.38f);
            iconView.setImageResource(R.drawable.ic_hardware_speaker);
            iconView.setVisibility(View.VISIBLE);
            iconView.setImageTintList(fgTintList);
            deviceName.setText(R.string.media_seamless_remote_device);
        } else if (device != null) {
            mSeamless.setEnabled(true);
            mSeamless.setAlpha(1f);
            Drawable icon = device.getIcon();
            iconView.setVisibility(View.VISIBLE);
            iconView.setImageTintList(fgTintList);
@@ -561,6 +579,8 @@ public class MediaControlPanel {
        } else {
            // Reset to default
            Log.d(TAG, "device is null. Not binding output chip.");
            mSeamless.setEnabled(true);
            mSeamless.setAlpha(1f);
            iconView.setVisibility(View.GONE);
            deviceName.setText(com.android.internal.R.string.ext_media_seamless_action);
        }