diff options
3 files changed, 27 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java index 28bd23ce9825..df03fdc46d06 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java @@ -103,6 +103,7 @@ public class PipManager implements BasePipManager { // Re-enable touches after the animation completes mTouchHandler.setTouchEnabled(true); mTouchHandler.onPinnedStackAnimationEnded(); + mMenuController.onPinnedStackAnimationEnded(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java index 79ac8160c095..80305a5adc02 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java @@ -80,6 +80,7 @@ public class PipMenuActivity extends Activity { public static final int MESSAGE_HIDE_MENU = 3; public static final int MESSAGE_UPDATE_ACTIONS = 4; public static final int MESSAGE_UPDATE_DISMISS_FRACTION = 5; + public static final int MESSAGE_ANIMATION_ENDED = 6; private static final long INITIAL_DISMISS_DELAY = 3500; private static final long POST_INTERACTION_DISMISS_DELAY = 2000; @@ -92,6 +93,7 @@ public class PipMenuActivity extends Activity { private int mMenuState; private boolean mAllowMenuTimeout = true; + private boolean mAllowTouches = true; private final List<RemoteAction> mActions = new ArrayList<>(); @@ -149,6 +151,10 @@ public class PipMenuActivity extends Activity { updateDismissFraction(data.getFloat(EXTRA_DISMISS_FRACTION)); break; } + case MESSAGE_ANIMATION_ENDED: { + mAllowTouches = true; + break; + } } } }); @@ -245,6 +251,10 @@ public class PipMenuActivity extends Activity { @Override public boolean dispatchTouchEvent(MotionEvent ev) { + if (!mAllowTouches) { + return super.dispatchTouchEvent(ev); + } + // On the first action outside the window, hide the menu switch (ev.getAction()) { case MotionEvent.ACTION_OUTSIDE: @@ -284,6 +294,9 @@ public class PipMenuActivity extends Activity { boolean allowMenuTimeout) { mAllowMenuTimeout = allowMenuTimeout; if (mMenuState != menuState) { + boolean deferTouchesUntilAnimationEnds = (mMenuState == MENU_STATE_FULL) || + (menuState == MENU_STATE_FULL); + mAllowTouches = !deferTouchesUntilAnimationEnds; cancelDelayedFinish(); updateActionViews(stackBounds); if (mMenuContainerAnimator != null) { diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java index c41f898ef4fe..d5cf1dd0387d 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java @@ -197,6 +197,19 @@ public class PipMenuActivityController { } } + public void onPinnedStackAnimationEnded() { + // Note: Only active menu activities care about this event + if (mToActivityMessenger != null) { + Message m = Message.obtain(); + m.what = PipMenuActivity.MESSAGE_ANIMATION_ENDED; + try { + mToActivityMessenger.send(m); + } catch (RemoteException e) { + Log.e(TAG, "Could not notify menu pinned animation ended", e); + } + } + } + /** * Adds a new menu activity listener. */ |