Merge "Cache the Binder call for PlaybackState" into udc-dev am: 5f716d1882 am: 1050df121a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23377421 Change-Id: I9d2e4f6f6d8d0ec9b74a351e266f8498d507d51f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -252,13 +252,16 @@ public class PipMediaController {
|
||||
// It can be removed when min_sdk of the app is set to 31 or greater.
|
||||
@SuppressLint("NewApi")
|
||||
private List<RemoteAction> getMediaActions() {
|
||||
if (mMediaController == null || mMediaController.getPlaybackState() == null) {
|
||||
// Cache the PlaybackState since it's a Binder call.
|
||||
final PlaybackState playbackState;
|
||||
if (mMediaController == null
|
||||
|| (playbackState = mMediaController.getPlaybackState()) == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
ArrayList<RemoteAction> mediaActions = new ArrayList<>();
|
||||
boolean isPlaying = mMediaController.getPlaybackState().isActive();
|
||||
long actions = mMediaController.getPlaybackState().getActions();
|
||||
boolean isPlaying = playbackState.isActive();
|
||||
long actions = playbackState.getActions();
|
||||
|
||||
// Prev action
|
||||
mPrevAction.setEnabled((actions & PlaybackState.ACTION_SKIP_TO_PREVIOUS) != 0);
|
||||
|
||||
Reference in New Issue
Block a user