summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-08-01 00:20:01 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-08-01 00:20:01 +0000
commitfc638c76158a5a5a6050fe9a439785ca63880c80 (patch)
tree80aa2a92e45d3012db83d280317a3d6af68243fc
parent690eef6d7c3636dec9a08351babfa505fbfe6f82 (diff)
parent6ec7dd25a25c527c933fbeacd1897fa53a485cf0 (diff)
downloadbase-fc638c76158a5a5a6050fe9a439785ca63880c80.tar.gz
Merge cherrypicks of [9111140, 9111141, 9111142, 9111143, 9109055] into qt-releaseandroid-vts-10.0_r1android-cts-10.0_r1
Change-Id: Ic77feced411fac42d289171f3c68ef95d64b1636
-rw-r--r--core/java/com/android/internal/widget/MediaNotificationView.java47
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java47
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java4
3 files changed, 11 insertions, 87 deletions
diff --git a/core/java/com/android/internal/widget/MediaNotificationView.java b/core/java/com/android/internal/widget/MediaNotificationView.java
index 0d87afa42e3e..e7d240a1035e 100644
--- a/core/java/com/android/internal/widget/MediaNotificationView.java
+++ b/core/java/com/android/internal/widget/MediaNotificationView.java
@@ -26,8 +26,6 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RemoteViews;
-import java.util.ArrayList;
-
/**
* A TextView that can float around an image on the end.
*
@@ -44,7 +42,6 @@ public class MediaNotificationView extends FrameLayout {
private View mMainColumn;
private View mMediaContent;
private int mImagePushIn;
- private ArrayList<VisibilityChangeListener> mListeners;
public MediaNotificationView(Context context) {
this(context, null);
@@ -171,48 +168,4 @@ public class MediaNotificationView extends FrameLayout {
mMainColumn = findViewById(com.android.internal.R.id.notification_main_column);
mMediaContent = findViewById(com.android.internal.R.id.notification_media_content);
}
-
- @Override
- public void onVisibilityAggregated(boolean isVisible) {
- super.onVisibilityAggregated(isVisible);
- for (int i = 0; i < mListeners.size(); i++) {
- mListeners.get(i).onAggregatedVisibilityChanged(isVisible);
- }
- }
-
- /**
- * Add a listener to receive updates on the visibility of this view
- *
- * @param listener The listener to add.
- */
- public void addVisibilityListener(VisibilityChangeListener listener) {
- if (mListeners == null) {
- mListeners = new ArrayList<>();
- }
- if (!mListeners.contains(listener)) {
- mListeners.add(listener);
- }
- }
-
- /**
- * Remove the specified listener
- *
- * @param listener The listener to remove.
- */
- public void removeVisibilityListener(VisibilityChangeListener listener) {
- if (mListeners != null) {
- mListeners.remove(listener);
- }
- }
-
- /**
- * Interface for receiving updates when the view's visibility changes
- */
- public interface VisibilityChangeListener {
- /**
- * Method called when the visibility of this view has changed
- * @param isVisible true if the view is now visible
- */
- void onAggregatedVisibilityChanged(boolean isVisible);
- }
}
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 38f9bff2a63f..20e8b733ce6a 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
@@ -39,7 +39,6 @@ import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.widget.MediaNotificationView;
import com.android.systemui.Dependency;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.TransformableView;
@@ -68,7 +67,6 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi
private View mSeekBarView;
private Context mContext;
private MetricsLogger mMetricsLogger;
- private boolean mIsViewVisible;
@VisibleForTesting
protected SeekBar.OnSeekBarChangeListener mSeekListener =
@@ -90,33 +88,11 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi
}
};
- MediaNotificationView.VisibilityChangeListener mVisibilityListener =
- new MediaNotificationView.VisibilityChangeListener() {
- @Override
- public void onAggregatedVisibilityChanged(boolean isVisible) {
- mIsViewVisible = isVisible;
- if (isVisible) {
- // Restart timer if we're currently playing and didn't already have one going
- PlaybackState state = mMediaController.getPlaybackState();
- if (state != null && state.getState() == PlaybackState.STATE_PLAYING
- && mSeekBarTimer == null && mSeekBarView != null
- && mSeekBarView.getVisibility() != View.GONE) {
- startTimer();
- }
- } else {
- clearTimer();
- }
- }
- };
-
private MediaController.Callback mMediaCallback = new MediaController.Callback() {
@Override
public void onSessionDestroyed() {
clearTimer();
mMediaController.unregisterCallback(this);
- if (mView instanceof MediaNotificationView) {
- ((MediaNotificationView) mView).removeVisibilityListener(mVisibilityListener);
- }
}
@Override
@@ -150,16 +126,10 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi
mContext = ctx;
mMediaManager = Dependency.get(NotificationMediaManager.class);
mMetricsLogger = Dependency.get(MetricsLogger.class);
-
- if (mView instanceof MediaNotificationView) {
- MediaNotificationView mediaView = (MediaNotificationView) mView;
- mediaView.addVisibilityListener(mVisibilityListener);
- }
}
private void resolveViews() {
mActions = mView.findViewById(com.android.internal.R.id.media_actions);
- mIsViewVisible = mView.isShown();
final MediaSession.Token token = mRow.getEntry().notification.getNotification().extras
.getParcelable(Notification.EXTRA_MEDIA_SESSION);
@@ -238,19 +208,18 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi
private void startTimer() {
clearTimer();
- if (mIsViewVisible) {
- mSeekBarTimer = new Timer(true /* isDaemon */);
- mSeekBarTimer.schedule(new TimerTask() {
- @Override
- public void run() {
- mHandler.post(mOnUpdateTimerTick);
- }
- }, 0, PROGRESS_UPDATE_INTERVAL);
- }
+ mSeekBarTimer = new Timer(true /* isDaemon */);
+ mSeekBarTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ mHandler.post(mOnUpdateTimerTick);
+ }
+ }, 0, PROGRESS_UPDATE_INTERVAL);
}
private void clearTimer() {
if (mSeekBarTimer != null) {
+ // TODO: also trigger this when the notification panel is collapsed
mSeekBarTimer.cancel();
mSeekBarTimer.purge();
mSeekBarTimer = null;
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index fb57d73c9a21..436a5c729b86 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -7670,10 +7670,12 @@ public class WindowManagerService extends IWindowManager.Stub
isDown = motionEvent.getAction() == MotionEvent.ACTION_DOWN;
isUp = motionEvent.getAction() == MotionEvent.ACTION_UP;
}
+ final boolean isMouseEvent = ev.getSource() == InputDevice.SOURCE_MOUSE;
// For ACTION_DOWN, syncInputTransactions before injecting input.
+ // For all mouse events, also sync before injecting.
// For ACTION_UP, sync after injecting.
- if (isDown) {
+ if (isDown || isMouseEvent) {
syncInputTransactions();
}
final boolean result =