Merge "Show "Device" for remote playback device." into rvc-dev am: c0941a1016
Change-Id: I95055d38062ce1b06834a8a22775ff52515a8f8a
This commit is contained in:
24
packages/SystemUI/res/drawable/ic_hardware_speaker.xml
Normal file
24
packages/SystemUI/res/drawable/ic_hardware_speaker.xml
Normal file
@@ -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>
|
||||||
@@ -119,6 +119,7 @@
|
|||||||
android:id="@+id/media_seamless"
|
android:id="@+id/media_seamless"
|
||||||
android:background="@*android:drawable/media_seamless_background"
|
android:background="@*android:drawable/media_seamless_background"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:forceHasOverlappingRendering="false"
|
||||||
>
|
>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="@dimen/qs_seamless_icon_size"
|
android:layout_width="@dimen/qs_seamless_icon_size"
|
||||||
|
|||||||
@@ -1021,6 +1021,9 @@
|
|||||||
<!-- QuickSettings: Text to prompt the user to stop an ongoing recording [CHAR LIMIT=20] -->
|
<!-- QuickSettings: Text to prompt the user to stop an ongoing recording [CHAR LIMIT=20] -->
|
||||||
<string name="quick_settings_screen_record_stop">Stop</string>
|
<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] -->
|
<!-- 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>
|
<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] -->
|
<!-- Recents: Text that shows above the navigation bar after launching several apps. [CHAR LIMIT=NONE] -->
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import android.media.MediaDescription;
|
|||||||
import android.media.MediaMetadata;
|
import android.media.MediaMetadata;
|
||||||
import android.media.ThumbnailUtils;
|
import android.media.ThumbnailUtils;
|
||||||
import android.media.session.MediaController;
|
import android.media.session.MediaController;
|
||||||
|
import android.media.session.MediaController.PlaybackInfo;
|
||||||
import android.media.session.MediaSession;
|
import android.media.session.MediaSession;
|
||||||
import android.media.session.PlaybackState;
|
import android.media.session.PlaybackState;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -96,6 +97,7 @@ public class MediaControlPanel {
|
|||||||
public static final String MEDIA_PREFERENCE_KEY = "browser_components";
|
public static final String MEDIA_PREFERENCE_KEY = "browser_components";
|
||||||
private SharedPreferences mSharedPrefs;
|
private SharedPreferences mSharedPrefs;
|
||||||
private boolean mCheckedForResumption = false;
|
private boolean mCheckedForResumption = false;
|
||||||
|
private boolean mIsRemotePlayback;
|
||||||
|
|
||||||
// Button IDs used in notifications
|
// Button IDs used in notifications
|
||||||
protected static final int[] NOTIF_ACTION_IDS = {
|
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);
|
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();
|
makeActive();
|
||||||
|
|
||||||
@@ -545,7 +554,16 @@ public class MediaControlPanel {
|
|||||||
TextView deviceName = mSeamless.findViewById(R.id.media_seamless_text);
|
TextView deviceName = mSeamless.findViewById(R.id.media_seamless_text);
|
||||||
deviceName.setTextColor(fgTintList);
|
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();
|
Drawable icon = device.getIcon();
|
||||||
iconView.setVisibility(View.VISIBLE);
|
iconView.setVisibility(View.VISIBLE);
|
||||||
iconView.setImageTintList(fgTintList);
|
iconView.setImageTintList(fgTintList);
|
||||||
@@ -561,6 +579,8 @@ public class MediaControlPanel {
|
|||||||
} else {
|
} else {
|
||||||
// Reset to default
|
// Reset to default
|
||||||
Log.d(TAG, "device is null. Not binding output chip.");
|
Log.d(TAG, "device is null. Not binding output chip.");
|
||||||
|
mSeamless.setEnabled(true);
|
||||||
|
mSeamless.setAlpha(1f);
|
||||||
iconView.setVisibility(View.GONE);
|
iconView.setVisibility(View.GONE);
|
||||||
deviceName.setText(com.android.internal.R.string.ext_media_seamless_action);
|
deviceName.setText(com.android.internal.R.string.ext_media_seamless_action);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user