diff options
author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2019-11-17 16:18:03 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2019-11-18 18:03:47 +0100 |
commit | 14f8a0a8b720ff13bc9e6732407aef726166afd4 (patch) | |
tree | f38e36c974f2aa2c6e832efd9a48fafe3e2d84a2 | |
parent | 79b51ecbdeef70f94d6fbe1fb19aa1fea47b51de (diff) | |
download | android_frameworks_base-14f8a0a8b720ff13bc9e6732407aef726166afd4.tar.gz android_frameworks_base-14f8a0a8b720ff13bc9e6732407aef726166afd4.tar.bz2 android_frameworks_base-14f8a0a8b720ff13bc9e6732407aef726166afd4.zip |
Revert "SystemUI: Update the media notification only when needed"
Whenever the notifications are shown it takes ~1 second for the notification to be updated, go back to the original behavior
This reverts commit cf5cfe3dc3bb998040a72978bfee29585f9a9386.
Change-Id: I9379ae15fdae792dde35a9a9fe045c4e6af4f73d
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java index 209135a786b..20e8b733ce6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java @@ -32,7 +32,6 @@ import android.text.format.DateUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewStub; -import android.view.ViewTreeObserver; import android.widget.SeekBar; import android.widget.TextView; @@ -46,6 +45,7 @@ import com.android.systemui.statusbar.TransformableView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import java.util.Timer; +import java.util.TimerTask; /** * Wraps a notification containing a media template @@ -208,19 +208,13 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi private void startTimer() { clearTimer(); - updateSeekBarView(); - } - - private void updateSeekBarView() { - mSeekBarView.getViewTreeObserver().addOnPreDrawListener( - new ViewTreeObserver.OnPreDrawListener(){ + mSeekBarTimer = new Timer(true /* isDaemon */); + mSeekBarTimer.schedule(new TimerTask() { @Override - public boolean onPreDraw() { - mSeekBarView.getViewTreeObserver().removeOnPreDrawListener(this); - mHandler.postDelayed(mOnUpdateTimerTick, PROGRESS_UPDATE_INTERVAL); - return true; + public void run() { + mHandler.post(mOnUpdateTimerTick); } - }); + }, 0, PROGRESS_UPDATE_INTERVAL); } private void clearTimer() { @@ -267,7 +261,7 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi public void run() { if (mMediaController != null && mSeekBar != null) { PlaybackState playbackState = mMediaController.getPlaybackState(); - updateSeekBarView(); + if (playbackState != null) { updatePlaybackUi(playbackState); } else { |