diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2023-06-22 17:20:58 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-06-22 17:20:58 +0000 |
commit | 04c08fe37cef3bf2f11e8b4ff97032f9170521ba (patch) | |
tree | a909ab5e9191910569d65a082755e82ddf66f5cf | |
parent | abd3cd928524f46031e95abaca5417e9bb59e99c (diff) | |
parent | 103188a89c2e143d93a22a8e55f5ead46ee4b7ad (diff) | |
download | base-04c08fe37cef3bf2f11e8b4ff97032f9170521ba.tar.gz |
Merge "Avoid refreshing the media output dialog UI while dismissing." into udc-dev
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java index 0a5b4b3066a0..7712690de195 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java @@ -105,6 +105,7 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements private WallpaperColors mWallpaperColors; private boolean mShouldLaunchLeBroadcastDialog; private boolean mIsLeBroadcastCallbackRegistered; + private boolean mDismissing; MediaOutputBaseAdapter mAdapter; @@ -265,13 +266,22 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements mDevicesRecyclerView.setHasFixedSize(false); // Init bottom buttons mDoneButton.setOnClickListener(v -> dismiss()); - mStopButton.setOnClickListener(v -> { - mMediaOutputController.releaseSession(); - dismiss(); - }); + mStopButton.setOnClickListener(v -> onStopButtonClick()); mAppButton.setOnClickListener(mMediaOutputController::tryToLaunchMediaApplication); mMediaMetadataSectionLayout.setOnClickListener( mMediaOutputController::tryToLaunchMediaApplication); + + mDismissing = false; + } + + @Override + public void dismiss() { + // TODO(287191450): remove this once expensive binder calls are removed from refresh(). + // Due to these binder calls on the UI thread, calling refresh() during dismissal causes + // significant frame drops for the dismissal animation. Since the dialog is going away + // anyway, we use this state to turn refresh() into a no-op. + mDismissing = true; + super.dismiss(); } @Override @@ -299,7 +309,9 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements } void refresh(boolean deviceSetChanged) { - if (mMediaOutputController.isRefreshing()) { + // TODO(287191450): remove binder calls in this method from the UI thread. + // If the dialog is going away or is already refreshing, do nothing. + if (mDismissing || mMediaOutputController.isRefreshing()) { return; } mMediaOutputController.setRefreshing(true); |