diff options
4 files changed, 49 insertions, 1 deletions
diff --git a/packages/SystemUI/res/drawable/ic_hardware_speaker.xml b/packages/SystemUI/res/drawable/ic_hardware_speaker.xml new file mode 100644 index 000000000000..0081e56a45f2 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_hardware_speaker.xml @@ -0,0 +1,24 @@ +<!-- + 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> diff --git a/packages/SystemUI/res/layout/qs_media_panel.xml b/packages/SystemUI/res/layout/qs_media_panel.xml index e5ac5f89cd25..a194569dcca4 100644 --- a/packages/SystemUI/res/layout/qs_media_panel.xml +++ b/packages/SystemUI/res/layout/qs_media_panel.xml @@ -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" diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index d639ed074240..9f0f48233458 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -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] --> diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java index ddc9c9d7c314..b12d02d26b9b 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java +++ b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java @@ -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); } |