Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.systemui.media; |
| 18 | |
| 19 | import android.annotation.LayoutRes; |
| 20 | import android.app.PendingIntent; |
| 21 | import android.content.ComponentName; |
Beth Thibodeau | dba74bc | 2020-04-27 14:17:08 -0400 | [diff] [blame] | 22 | import android.content.ContentResolver; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 23 | import android.content.Context; |
| 24 | import android.content.Intent; |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 25 | import android.content.SharedPreferences; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 26 | import android.content.pm.PackageManager; |
| 27 | import android.content.pm.ResolveInfo; |
| 28 | import android.content.res.ColorStateList; |
| 29 | import android.graphics.Bitmap; |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 30 | import android.graphics.ImageDecoder; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 31 | import android.graphics.drawable.Drawable; |
| 32 | import android.graphics.drawable.GradientDrawable; |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 33 | import android.graphics.drawable.Icon; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 34 | import android.graphics.drawable.RippleDrawable; |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 35 | import android.media.MediaDescription; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 36 | import android.media.MediaMetadata; |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 37 | import android.media.ThumbnailUtils; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 38 | import android.media.session.MediaController; |
Robert Snoeberger | c981dc9 | 2020-04-27 15:00:50 -0400 | [diff] [blame] | 39 | import android.media.session.MediaController.PlaybackInfo; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 40 | import android.media.session.MediaSession; |
| 41 | import android.media.session.PlaybackState; |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 42 | import android.net.Uri; |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 43 | import android.service.media.MediaBrowserService; |
Beth Thibodeau | dba74bc | 2020-04-27 14:17:08 -0400 | [diff] [blame] | 44 | import android.text.TextUtils; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 45 | import android.util.Log; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 46 | import android.view.LayoutInflater; |
| 47 | import android.view.View; |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 48 | import android.view.View.OnAttachStateChangeListener; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 49 | import android.view.ViewGroup; |
| 50 | import android.widget.ImageButton; |
| 51 | import android.widget.ImageView; |
| 52 | import android.widget.LinearLayout; |
| 53 | import android.widget.TextView; |
| 54 | |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 55 | import androidx.annotation.Nullable; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 56 | import androidx.core.graphics.drawable.RoundedBitmapDrawable; |
| 57 | import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory; |
| 58 | |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 59 | import com.android.settingslib.media.LocalMediaManager; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 60 | import com.android.settingslib.media.MediaDevice; |
| 61 | import com.android.settingslib.media.MediaOutputSliceConstants; |
| 62 | import com.android.settingslib.widget.AdaptiveIcon; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 63 | import com.android.systemui.R; |
| 64 | import com.android.systemui.plugins.ActivityStarter; |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 65 | import com.android.systemui.qs.QSMediaBrowser; |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 66 | import com.android.systemui.util.Assert; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 67 | |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 68 | import java.io.IOException; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 69 | import java.util.List; |
| 70 | import java.util.concurrent.Executor; |
| 71 | |
| 72 | /** |
| 73 | * Base media control panel for System UI |
| 74 | */ |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 75 | public class MediaControlPanel { |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 76 | private static final String TAG = "MediaControlPanel"; |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 77 | @Nullable private final LocalMediaManager mLocalMediaManager; |
Beth Thibodeau | a51c314 | 2020-03-17 17:27:04 -0400 | [diff] [blame] | 78 | private final Executor mForegroundExecutor; |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 79 | protected final Executor mBackgroundExecutor; |
Beth Thibodeau | e561c00 | 2020-04-23 17:33:00 -0400 | [diff] [blame] | 80 | private final ActivityStarter mActivityStarter; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 81 | |
| 82 | private Context mContext; |
| 83 | protected LinearLayout mMediaNotifView; |
| 84 | private View mSeamless; |
| 85 | private MediaSession.Token mToken; |
| 86 | private MediaController mController; |
| 87 | private int mForegroundColor; |
| 88 | private int mBackgroundColor; |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 89 | private MediaDevice mDevice; |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 90 | protected ComponentName mServiceComponent; |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 91 | private boolean mIsRegistered = false; |
Beth Thibodeau | a3d9098 | 2020-04-13 23:42:48 -0400 | [diff] [blame] | 92 | private String mKey; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 93 | |
| 94 | private final int[] mActionIds; |
| 95 | |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 96 | public static final String MEDIA_PREFERENCES = "media_control_prefs"; |
| 97 | public static final String MEDIA_PREFERENCE_KEY = "browser_components"; |
| 98 | private SharedPreferences mSharedPrefs; |
| 99 | private boolean mCheckedForResumption = false; |
Robert Snoeberger | c981dc9 | 2020-04-27 15:00:50 -0400 | [diff] [blame] | 100 | private boolean mIsRemotePlayback; |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 101 | |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 102 | // Button IDs used in notifications |
| 103 | protected static final int[] NOTIF_ACTION_IDS = { |
| 104 | com.android.internal.R.id.action0, |
| 105 | com.android.internal.R.id.action1, |
| 106 | com.android.internal.R.id.action2, |
| 107 | com.android.internal.R.id.action3, |
| 108 | com.android.internal.R.id.action4 |
| 109 | }; |
| 110 | |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 111 | // URI fields to try loading album art from |
| 112 | private static final String[] ART_URIS = { |
| 113 | MediaMetadata.METADATA_KEY_ALBUM_ART_URI, |
| 114 | MediaMetadata.METADATA_KEY_ART_URI, |
| 115 | MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI |
| 116 | }; |
| 117 | |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 118 | private final MediaController.Callback mSessionCallback = new MediaController.Callback() { |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 119 | @Override |
| 120 | public void onSessionDestroyed() { |
| 121 | Log.d(TAG, "session destroyed"); |
| 122 | mController.unregisterCallback(mSessionCallback); |
| 123 | clearControls(); |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 124 | makeInactive(); |
| 125 | } |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 126 | @Override |
Robert Snoeberger | 445d441 | 2020-04-15 00:03:13 -0400 | [diff] [blame] | 127 | public void onPlaybackStateChanged(PlaybackState state) { |
| 128 | final int s = state != null ? state.getState() : PlaybackState.STATE_NONE; |
Beth Thibodeau | d664de2 | 2020-04-28 16:29:36 -0400 | [diff] [blame] | 129 | if (s == PlaybackState.STATE_NONE) { |
Robert Snoeberger | 445d441 | 2020-04-15 00:03:13 -0400 | [diff] [blame] | 130 | Log.d(TAG, "playback state change will trigger resumption, state=" + state); |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 131 | clearControls(); |
| 132 | makeInactive(); |
| 133 | } |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | private final OnAttachStateChangeListener mStateListener = new OnAttachStateChangeListener() { |
| 138 | @Override |
| 139 | public void onViewAttachedToWindow(View unused) { |
| 140 | makeActive(); |
| 141 | } |
| 142 | @Override |
| 143 | public void onViewDetachedFromWindow(View unused) { |
| 144 | makeInactive(); |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 145 | } |
| 146 | }; |
| 147 | |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 148 | private final LocalMediaManager.DeviceCallback mDeviceCallback = |
| 149 | new LocalMediaManager.DeviceCallback() { |
| 150 | @Override |
| 151 | public void onDeviceListUpdate(List<MediaDevice> devices) { |
| 152 | if (mLocalMediaManager == null) { |
| 153 | return; |
| 154 | } |
| 155 | MediaDevice currentDevice = mLocalMediaManager.getCurrentConnectedDevice(); |
| 156 | // Check because this can be called several times while changing devices |
| 157 | if (mDevice == null || !mDevice.equals(currentDevice)) { |
| 158 | mDevice = currentDevice; |
| 159 | updateDevice(mDevice); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | @Override |
| 164 | public void onSelectedDeviceStateChanged(MediaDevice device, int state) { |
| 165 | if (mDevice == null || !mDevice.equals(device)) { |
| 166 | mDevice = device; |
| 167 | updateDevice(mDevice); |
| 168 | } |
| 169 | } |
| 170 | }; |
| 171 | |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 172 | /** |
| 173 | * Initialize a new control panel |
| 174 | * @param context |
| 175 | * @param parent |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 176 | * @param routeManager Manager used to listen for device change events. |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 177 | * @param layoutId layout resource to use for this control panel |
| 178 | * @param actionIds resource IDs for action buttons in the layout |
Beth Thibodeau | a51c314 | 2020-03-17 17:27:04 -0400 | [diff] [blame] | 179 | * @param foregroundExecutor foreground executor |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 180 | * @param backgroundExecutor background executor, used for processing artwork |
Beth Thibodeau | e561c00 | 2020-04-23 17:33:00 -0400 | [diff] [blame] | 181 | * @param activityStarter activity starter |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 182 | */ |
Robert Snoeberger | 445d441 | 2020-04-15 00:03:13 -0400 | [diff] [blame] | 183 | public MediaControlPanel(Context context, ViewGroup parent, |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 184 | @Nullable LocalMediaManager routeManager, @LayoutRes int layoutId, int[] actionIds, |
Beth Thibodeau | e561c00 | 2020-04-23 17:33:00 -0400 | [diff] [blame] | 185 | Executor foregroundExecutor, Executor backgroundExecutor, |
| 186 | ActivityStarter activityStarter) { |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 187 | mContext = context; |
| 188 | LayoutInflater inflater = LayoutInflater.from(mContext); |
| 189 | mMediaNotifView = (LinearLayout) inflater.inflate(layoutId, parent, false); |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 190 | // TODO(b/150854549): removeOnAttachStateChangeListener when this doesn't inflate views |
| 191 | // mStateListener shouldn't need to be unregistered since this object shares the same |
| 192 | // lifecycle with the inflated view. It would be better, however, if this controller used an |
| 193 | // attach/detach of views instead of inflating them in the constructor, which would allow |
| 194 | // mStateListener to be unregistered in detach. |
| 195 | mMediaNotifView.addOnAttachStateChangeListener(mStateListener); |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 196 | mLocalMediaManager = routeManager; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 197 | mActionIds = actionIds; |
Beth Thibodeau | a51c314 | 2020-03-17 17:27:04 -0400 | [diff] [blame] | 198 | mForegroundExecutor = foregroundExecutor; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 199 | mBackgroundExecutor = backgroundExecutor; |
Beth Thibodeau | e561c00 | 2020-04-23 17:33:00 -0400 | [diff] [blame] | 200 | mActivityStarter = activityStarter; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Get the view used to display media controls |
| 205 | * @return the view |
| 206 | */ |
| 207 | public View getView() { |
| 208 | return mMediaNotifView; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Get the context |
| 213 | * @return context |
| 214 | */ |
| 215 | public Context getContext() { |
| 216 | return mContext; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Update the media panel view for the given media session |
| 221 | * @param token |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 222 | * @param iconDrawable |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 223 | * @param largeIcon |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 224 | * @param iconColor |
| 225 | * @param bgColor |
| 226 | * @param contentIntent |
| 227 | * @param appNameString |
Beth Thibodeau | a3d9098 | 2020-04-13 23:42:48 -0400 | [diff] [blame] | 228 | * @param key |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 229 | */ |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 230 | public void setMediaSession(MediaSession.Token token, Drawable iconDrawable, Icon largeIcon, |
| 231 | int iconColor, int bgColor, PendingIntent contentIntent, String appNameString, |
| 232 | String key) { |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 233 | // Ensure that component names are updated if token has changed |
| 234 | if (mToken == null || !mToken.equals(token)) { |
| 235 | mToken = token; |
| 236 | mServiceComponent = null; |
| 237 | mCheckedForResumption = false; |
| 238 | } |
| 239 | |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 240 | mForegroundColor = iconColor; |
| 241 | mBackgroundColor = bgColor; |
| 242 | mController = new MediaController(mContext, mToken); |
Beth Thibodeau | a3d9098 | 2020-04-13 23:42:48 -0400 | [diff] [blame] | 243 | mKey = key; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 244 | |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 245 | // Try to find a browser service component for this app |
| 246 | // TODO also check for a media button receiver intended for restarting (b/154127084) |
| 247 | // Only check if we haven't tried yet or the session token changed |
Robert Snoeberger | 4429917 | 2020-04-24 22:22:21 -0400 | [diff] [blame] | 248 | final String pkgName = mController.getPackageName(); |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 249 | if (mServiceComponent == null && !mCheckedForResumption) { |
| 250 | Log.d(TAG, "Checking for service component"); |
| 251 | PackageManager pm = mContext.getPackageManager(); |
| 252 | Intent resumeIntent = new Intent(MediaBrowserService.SERVICE_INTERFACE); |
| 253 | List<ResolveInfo> resumeInfo = pm.queryIntentServices(resumeIntent, 0); |
| 254 | if (resumeInfo != null) { |
| 255 | for (ResolveInfo inf : resumeInfo) { |
| 256 | if (inf.serviceInfo.packageName.equals(mController.getPackageName())) { |
| 257 | mBackgroundExecutor.execute(() -> |
| 258 | tryUpdateResumptionList(inf.getComponentInfo().getComponentName())); |
| 259 | break; |
| 260 | } |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 261 | } |
| 262 | } |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 263 | mCheckedForResumption = true; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | mController.registerCallback(mSessionCallback); |
| 267 | |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 268 | mMediaNotifView.setBackgroundTintList(ColorStateList.valueOf(mBackgroundColor)); |
| 269 | |
| 270 | // Click action |
Beth Thibodeau | a51c314 | 2020-03-17 17:27:04 -0400 | [diff] [blame] | 271 | if (contentIntent != null) { |
| 272 | mMediaNotifView.setOnClickListener(v -> { |
Beth Thibodeau | e561c00 | 2020-04-23 17:33:00 -0400 | [diff] [blame] | 273 | mActivityStarter.postStartActivityDismissingKeyguard(contentIntent); |
Beth Thibodeau | a51c314 | 2020-03-17 17:27:04 -0400 | [diff] [blame] | 274 | }); |
| 275 | } |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 276 | |
| 277 | // App icon |
| 278 | ImageView appIcon = mMediaNotifView.findViewById(R.id.icon); |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 279 | iconDrawable.setTint(mForegroundColor); |
| 280 | appIcon.setImageDrawable(iconDrawable); |
| 281 | |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 282 | // Transfer chip |
| 283 | mSeamless = mMediaNotifView.findViewById(R.id.media_seamless); |
Robert Snoeberger | 4429917 | 2020-04-24 22:22:21 -0400 | [diff] [blame] | 284 | if (mSeamless != null) { |
| 285 | if (mLocalMediaManager != null) { |
| 286 | mSeamless.setVisibility(View.VISIBLE); |
| 287 | updateDevice(mLocalMediaManager.getCurrentConnectedDevice()); |
| 288 | mSeamless.setOnClickListener(v -> { |
| 289 | final Intent intent = new Intent() |
| 290 | .setAction(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT) |
| 291 | .putExtra(MediaOutputSliceConstants.EXTRA_PACKAGE_NAME, |
| 292 | mController.getPackageName()) |
| 293 | .putExtra(MediaOutputSliceConstants.KEY_MEDIA_SESSION_TOKEN, mToken); |
| 294 | mActivityStarter.startActivity(intent, false, true /* dismissShade */, |
| 295 | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| 296 | }); |
| 297 | } else { |
| 298 | Log.d(TAG, "LocalMediaManager is null. Not binding output chip for pkg=" + pkgName); |
| 299 | } |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 300 | } |
Robert Snoeberger | c981dc9 | 2020-04-27 15:00:50 -0400 | [diff] [blame] | 301 | PlaybackInfo playbackInfo = mController.getPlaybackInfo(); |
| 302 | if (playbackInfo != null) { |
| 303 | mIsRemotePlayback = playbackInfo.getPlaybackType() == PlaybackInfo.PLAYBACK_TYPE_REMOTE; |
| 304 | } else { |
| 305 | Log.d(TAG, "PlaybackInfo was null. Defaulting to local playback."); |
| 306 | mIsRemotePlayback = false; |
| 307 | } |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 308 | |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 309 | makeActive(); |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 310 | |
| 311 | // App title (not in mini player) |
| 312 | TextView appName = mMediaNotifView.findViewById(R.id.app_name); |
| 313 | if (appName != null) { |
| 314 | appName.setText(appNameString); |
| 315 | appName.setTextColor(mForegroundColor); |
| 316 | } |
| 317 | |
| 318 | MediaMetadata mediaMetadata = mController.getMetadata(); |
| 319 | if (mediaMetadata == null) { |
| 320 | Log.e(TAG, "Media metadata was null"); |
| 321 | return; |
| 322 | } |
| 323 | |
| 324 | ImageView albumView = mMediaNotifView.findViewById(R.id.album_art); |
| 325 | if (albumView != null) { |
| 326 | // Resize art in a background thread |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 327 | mBackgroundExecutor.execute(() -> processAlbumArt(mediaMetadata, largeIcon, albumView)); |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | // Song name |
| 331 | TextView titleText = mMediaNotifView.findViewById(R.id.header_title); |
| 332 | String songName = mediaMetadata.getString(MediaMetadata.METADATA_KEY_TITLE); |
| 333 | titleText.setText(songName); |
| 334 | titleText.setTextColor(mForegroundColor); |
| 335 | |
| 336 | // Artist name (not in mini player) |
| 337 | TextView artistText = mMediaNotifView.findViewById(R.id.header_artist); |
| 338 | if (artistText != null) { |
| 339 | String artistName = mediaMetadata.getString(MediaMetadata.METADATA_KEY_ARTIST); |
| 340 | artistText.setText(artistName); |
| 341 | artistText.setTextColor(mForegroundColor); |
| 342 | } |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | /** |
| 346 | * Return the token for the current media session |
| 347 | * @return the token |
| 348 | */ |
| 349 | public MediaSession.Token getMediaSessionToken() { |
| 350 | return mToken; |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * Get the current media controller |
| 355 | * @return the controller |
| 356 | */ |
| 357 | public MediaController getController() { |
| 358 | return mController; |
| 359 | } |
| 360 | |
| 361 | /** |
| 362 | * Get the name of the package associated with the current media controller |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 363 | * @return the package name, or null if no controller |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 364 | */ |
| 365 | public String getMediaPlayerPackage() { |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 366 | if (mController == null) { |
| 367 | return null; |
| 368 | } |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 369 | return mController.getPackageName(); |
| 370 | } |
| 371 | |
| 372 | /** |
Beth Thibodeau | a3d9098 | 2020-04-13 23:42:48 -0400 | [diff] [blame] | 373 | * Return the original notification's key |
| 374 | * @return The notification key |
| 375 | */ |
| 376 | public String getKey() { |
| 377 | return mKey; |
| 378 | } |
| 379 | |
| 380 | /** |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 381 | * Check whether this player has an attached media session. |
| 382 | * @return whether there is a controller with a current media session. |
| 383 | */ |
| 384 | public boolean hasMediaSession() { |
| 385 | return mController != null && mController.getPlaybackState() != null; |
| 386 | } |
| 387 | |
| 388 | /** |
| 389 | * Check whether the media controlled by this player is currently playing |
| 390 | * @return whether it is playing, or false if no controller information |
| 391 | */ |
| 392 | public boolean isPlaying() { |
| 393 | return isPlaying(mController); |
| 394 | } |
| 395 | |
| 396 | /** |
| 397 | * Check whether the given controller is currently playing |
| 398 | * @param controller media controller to check |
| 399 | * @return whether it is playing, or false if no controller information |
| 400 | */ |
| 401 | protected boolean isPlaying(MediaController controller) { |
| 402 | if (controller == null) { |
| 403 | return false; |
| 404 | } |
| 405 | |
| 406 | PlaybackState state = controller.getPlaybackState(); |
| 407 | if (state == null) { |
| 408 | return false; |
| 409 | } |
| 410 | |
| 411 | return (state.getState() == PlaybackState.STATE_PLAYING); |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Process album art for layout |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 416 | * @param description media description |
| 417 | * @param albumView view to hold the album art |
| 418 | */ |
| 419 | protected void processAlbumArt(MediaDescription description, ImageView albumView) { |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 420 | Bitmap albumArt = null; |
| 421 | |
| 422 | // First try loading from URI |
| 423 | albumArt = loadBitmapFromUri(description.getIconUri()); |
| 424 | |
| 425 | // Then check bitmap |
| 426 | if (albumArt == null) { |
| 427 | albumArt = description.getIconBitmap(); |
| 428 | } |
| 429 | |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 430 | processAlbumArtInternal(albumArt, albumView); |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | * Process album art for layout |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 435 | * @param metadata media metadata |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 436 | * @param largeIcon from notification, checked as a fallback if metadata does not have art |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 437 | * @param albumView view to hold the album art |
| 438 | */ |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 439 | private void processAlbumArt(MediaMetadata metadata, Icon largeIcon, ImageView albumView) { |
| 440 | Bitmap albumArt = null; |
| 441 | |
| 442 | // First look in URI fields |
| 443 | for (String field : ART_URIS) { |
| 444 | String uriString = metadata.getString(field); |
Beth Thibodeau | dba74bc | 2020-04-27 14:17:08 -0400 | [diff] [blame] | 445 | if (!TextUtils.isEmpty(uriString)) { |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 446 | albumArt = loadBitmapFromUri(Uri.parse(uriString)); |
| 447 | if (albumArt != null) { |
| 448 | Log.d(TAG, "loaded art from " + field); |
| 449 | break; |
| 450 | } |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | // Then check bitmap field |
| 455 | if (albumArt == null) { |
| 456 | albumArt = metadata.getBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART); |
| 457 | } |
| 458 | |
| 459 | // Finally try the notification's largeIcon |
| 460 | if (albumArt == null && largeIcon != null) { |
| 461 | albumArt = largeIcon.getBitmap(); |
| 462 | } |
| 463 | |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 464 | processAlbumArtInternal(albumArt, albumView); |
| 465 | } |
| 466 | |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 467 | /** |
| 468 | * Load a bitmap from a URI |
| 469 | * @param uri |
| 470 | * @return bitmap, or null if couldn't be loaded |
| 471 | */ |
| 472 | private Bitmap loadBitmapFromUri(Uri uri) { |
Beth Thibodeau | dba74bc | 2020-04-27 14:17:08 -0400 | [diff] [blame] | 473 | // ImageDecoder requires a scheme of the following types |
| 474 | if (uri.getScheme() == null) { |
| 475 | return null; |
| 476 | } |
| 477 | |
| 478 | if (!uri.getScheme().equals(ContentResolver.SCHEME_CONTENT) |
| 479 | && !uri.getScheme().equals(ContentResolver.SCHEME_ANDROID_RESOURCE) |
| 480 | && !uri.getScheme().equals(ContentResolver.SCHEME_FILE)) { |
| 481 | return null; |
| 482 | } |
| 483 | |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 484 | ImageDecoder.Source source = ImageDecoder.createSource(mContext.getContentResolver(), uri); |
| 485 | try { |
| 486 | return ImageDecoder.decodeBitmap(source); |
| 487 | } catch (IOException e) { |
| 488 | e.printStackTrace(); |
| 489 | return null; |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | /** |
| 494 | * Resize and crop the image if provided and update the control view |
| 495 | * @param albumArt Bitmap of art to display, or null to hide view |
| 496 | * @param albumView View that will hold the art |
| 497 | */ |
| 498 | private void processAlbumArtInternal(@Nullable Bitmap albumArt, ImageView albumView) { |
| 499 | // Resize |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 500 | RoundedBitmapDrawable roundedDrawable = null; |
| 501 | if (albumArt != null) { |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 502 | float radius = mContext.getResources().getDimension(R.dimen.qs_media_corner_radius); |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 503 | Bitmap original = albumArt.copy(Bitmap.Config.ARGB_8888, true); |
| 504 | int albumSize = (int) mContext.getResources().getDimension( |
| 505 | R.dimen.qs_media_album_size); |
Beth Thibodeau | d3ad81d | 2020-04-20 23:26:25 -0400 | [diff] [blame] | 506 | Bitmap scaled = ThumbnailUtils.extractThumbnail(original, albumSize, albumSize); |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 507 | roundedDrawable = RoundedBitmapDrawableFactory.create(mContext.getResources(), scaled); |
| 508 | roundedDrawable.setCornerRadius(radius); |
| 509 | } else { |
| 510 | Log.e(TAG, "No album art available"); |
| 511 | } |
| 512 | |
| 513 | // Now that it's resized, update the UI |
| 514 | final RoundedBitmapDrawable result = roundedDrawable; |
Beth Thibodeau | a51c314 | 2020-03-17 17:27:04 -0400 | [diff] [blame] | 515 | mForegroundExecutor.execute(() -> { |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 516 | if (result != null) { |
| 517 | albumView.setImageDrawable(result); |
| 518 | albumView.setVisibility(View.VISIBLE); |
| 519 | } else { |
| 520 | albumView.setImageDrawable(null); |
| 521 | albumView.setVisibility(View.GONE); |
| 522 | } |
| 523 | }); |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * Update the current device information |
| 528 | * @param device device information to display |
| 529 | */ |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 530 | private void updateDevice(MediaDevice device) { |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 531 | if (mSeamless == null) { |
| 532 | return; |
| 533 | } |
Beth Thibodeau | a51c314 | 2020-03-17 17:27:04 -0400 | [diff] [blame] | 534 | mForegroundExecutor.execute(() -> { |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 535 | updateChipInternal(device); |
| 536 | }); |
| 537 | } |
| 538 | |
| 539 | private void updateChipInternal(MediaDevice device) { |
| 540 | ColorStateList fgTintList = ColorStateList.valueOf(mForegroundColor); |
| 541 | |
| 542 | // Update the outline color |
| 543 | LinearLayout viewLayout = (LinearLayout) mSeamless; |
| 544 | RippleDrawable bkgDrawable = (RippleDrawable) viewLayout.getBackground(); |
| 545 | GradientDrawable rect = (GradientDrawable) bkgDrawable.getDrawable(0); |
| 546 | rect.setStroke(2, mForegroundColor); |
| 547 | rect.setColor(mBackgroundColor); |
| 548 | |
| 549 | ImageView iconView = mSeamless.findViewById(R.id.media_seamless_image); |
| 550 | TextView deviceName = mSeamless.findViewById(R.id.media_seamless_text); |
| 551 | deviceName.setTextColor(fgTintList); |
| 552 | |
Robert Snoeberger | c981dc9 | 2020-04-27 15:00:50 -0400 | [diff] [blame] | 553 | if (mIsRemotePlayback) { |
| 554 | mSeamless.setEnabled(false); |
| 555 | mSeamless.setAlpha(0.38f); |
| 556 | iconView.setImageResource(R.drawable.ic_hardware_speaker); |
| 557 | iconView.setVisibility(View.VISIBLE); |
| 558 | iconView.setImageTintList(fgTintList); |
| 559 | deviceName.setText(R.string.media_seamless_remote_device); |
| 560 | } else if (device != null) { |
| 561 | mSeamless.setEnabled(true); |
| 562 | mSeamless.setAlpha(1f); |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 563 | Drawable icon = device.getIcon(); |
| 564 | iconView.setVisibility(View.VISIBLE); |
| 565 | iconView.setImageTintList(fgTintList); |
| 566 | |
| 567 | if (icon instanceof AdaptiveIcon) { |
| 568 | AdaptiveIcon aIcon = (AdaptiveIcon) icon; |
| 569 | aIcon.setBackgroundColor(mBackgroundColor); |
| 570 | iconView.setImageDrawable(aIcon); |
| 571 | } else { |
| 572 | iconView.setImageDrawable(icon); |
| 573 | } |
| 574 | deviceName.setText(device.getName()); |
| 575 | } else { |
| 576 | // Reset to default |
Robert Snoeberger | 4429917 | 2020-04-24 22:22:21 -0400 | [diff] [blame] | 577 | Log.d(TAG, "device is null. Not binding output chip."); |
Robert Snoeberger | c981dc9 | 2020-04-27 15:00:50 -0400 | [diff] [blame] | 578 | mSeamless.setEnabled(true); |
| 579 | mSeamless.setAlpha(1f); |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 580 | iconView.setVisibility(View.GONE); |
| 581 | deviceName.setText(com.android.internal.R.string.ext_media_seamless_action); |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | /** |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 586 | * Puts controls into a resumption state if possible, or calls removePlayer if no component was |
| 587 | * found that could resume playback |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 588 | */ |
| 589 | public void clearControls() { |
Robert Snoeberger | 445d441 | 2020-04-15 00:03:13 -0400 | [diff] [blame] | 590 | Log.d(TAG, "clearControls to resumption state package=" + getMediaPlayerPackage()); |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 591 | if (mServiceComponent == null) { |
| 592 | // If we don't have a way to resume, just remove the player altogether |
| 593 | Log.d(TAG, "Removing unresumable controls"); |
| 594 | removePlayer(); |
| 595 | return; |
| 596 | } |
| 597 | resetButtons(); |
| 598 | } |
| 599 | |
| 600 | /** |
| 601 | * Hide the media buttons and show only a restart button |
| 602 | */ |
| 603 | protected void resetButtons() { |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 604 | // Hide all the old buttons |
| 605 | for (int i = 0; i < mActionIds.length; i++) { |
| 606 | ImageButton thisBtn = mMediaNotifView.findViewById(mActionIds[i]); |
| 607 | if (thisBtn != null) { |
| 608 | thisBtn.setVisibility(View.GONE); |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | // Add a restart button |
| 613 | ImageButton btn = mMediaNotifView.findViewById(mActionIds[0]); |
| 614 | btn.setOnClickListener(v -> { |
| 615 | Log.d(TAG, "Attempting to restart session"); |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 616 | QSMediaBrowser browser = new QSMediaBrowser(mContext, null, mServiceComponent); |
| 617 | browser.restart(); |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 618 | }); |
| 619 | btn.setImageDrawable(mContext.getResources().getDrawable(R.drawable.lb_ic_play)); |
| 620 | btn.setImageTintList(ColorStateList.valueOf(mForegroundColor)); |
| 621 | btn.setVisibility(View.VISIBLE); |
| 622 | } |
| 623 | |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 624 | private void makeActive() { |
| 625 | Assert.isMainThread(); |
| 626 | if (!mIsRegistered) { |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 627 | if (mLocalMediaManager != null) { |
| 628 | mLocalMediaManager.registerCallback(mDeviceCallback); |
| 629 | mLocalMediaManager.startScan(); |
| 630 | } |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 631 | mIsRegistered = true; |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 632 | } |
| 633 | } |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 634 | |
| 635 | private void makeInactive() { |
| 636 | Assert.isMainThread(); |
| 637 | if (mIsRegistered) { |
Robert Snoeberger | 9a7409b | 2020-04-09 18:12:27 -0400 | [diff] [blame] | 638 | if (mLocalMediaManager != null) { |
| 639 | mLocalMediaManager.stopScan(); |
| 640 | mLocalMediaManager.unregisterCallback(mDeviceCallback); |
| 641 | } |
Robert Snoeberger | 3cc2222 | 2020-03-25 15:36:31 -0400 | [diff] [blame] | 642 | mIsRegistered = false; |
| 643 | } |
| 644 | } |
| 645 | |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 646 | /** |
| 647 | * Verify that we can connect to the given component with a MediaBrowser, and if so, add that |
| 648 | * component to the list of resumption components |
| 649 | */ |
| 650 | private void tryUpdateResumptionList(ComponentName componentName) { |
| 651 | Log.d(TAG, "Testing if we can connect to " + componentName); |
| 652 | QSMediaBrowser.testConnection(mContext, |
| 653 | new QSMediaBrowser.Callback() { |
| 654 | @Override |
| 655 | public void onConnected() { |
| 656 | Log.d(TAG, "yes we can resume with " + componentName); |
| 657 | mServiceComponent = componentName; |
| 658 | updateResumptionList(componentName); |
| 659 | } |
| 660 | |
| 661 | @Override |
| 662 | public void onError() { |
| 663 | Log.d(TAG, "Cannot resume with " + componentName); |
| 664 | mServiceComponent = null; |
Beth Thibodeau | 89f5c76 | 2020-04-21 13:09:55 -0400 | [diff] [blame] | 665 | if (!hasMediaSession()) { |
| 666 | // If it's not active and we can't resume, remove |
| 667 | removePlayer(); |
| 668 | } |
Beth Thibodeau | 23a33ab | 2020-04-07 20:51:57 -0400 | [diff] [blame] | 669 | } |
| 670 | }, |
| 671 | componentName); |
| 672 | } |
| 673 | |
| 674 | /** |
| 675 | * Add the component to the saved list of media browser services, checking for duplicates and |
| 676 | * removing older components that exceed the maximum limit |
| 677 | * @param componentName |
| 678 | */ |
| 679 | private synchronized void updateResumptionList(ComponentName componentName) { |
| 680 | // Add to front of saved list |
| 681 | if (mSharedPrefs == null) { |
| 682 | mSharedPrefs = mContext.getSharedPreferences(MEDIA_PREFERENCES, 0); |
| 683 | } |
| 684 | String componentString = componentName.flattenToString(); |
| 685 | String listString = mSharedPrefs.getString(MEDIA_PREFERENCE_KEY, null); |
| 686 | if (listString == null) { |
| 687 | listString = componentString; |
| 688 | } else { |
| 689 | String[] components = listString.split(QSMediaBrowser.DELIMITER); |
| 690 | StringBuilder updated = new StringBuilder(componentString); |
| 691 | int nBrowsers = 1; |
| 692 | for (int i = 0; i < components.length |
| 693 | && nBrowsers < QSMediaBrowser.MAX_RESUMPTION_CONTROLS; i++) { |
| 694 | if (componentString.equals(components[i])) { |
| 695 | continue; |
| 696 | } |
| 697 | updated.append(QSMediaBrowser.DELIMITER).append(components[i]); |
| 698 | nBrowsers++; |
| 699 | } |
| 700 | listString = updated.toString(); |
| 701 | } |
| 702 | mSharedPrefs.edit().putString(MEDIA_PREFERENCE_KEY, listString).apply(); |
| 703 | } |
| 704 | |
| 705 | /** |
| 706 | * Called when a player can't be resumed to give it an opportunity to hide or remove itself |
| 707 | */ |
| 708 | protected void removePlayer() { } |
Beth Thibodeau | 7b6c178 | 2020-03-05 11:43:51 -0500 | [diff] [blame] | 709 | } |