diff options
author | Android Build Merger (Role) <android-build-merger@google.com> | 2017-06-22 03:58:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-06-22 03:58:36 +0000 |
commit | ff09314508b3d24d34ebb8658735f9a19ed8005c (patch) | |
tree | fbe1f15b1a23607a5398ebee20d2764e92bc7413 | |
parent | 1e7ffc1104a70b8949d4ff9205f05ab5457cda6e (diff) | |
parent | 507a090cacbe4e92e8996f3a60aef99c6dafb060 (diff) |
Merge "Merge "Clean up dismiss target when last activity is unpinned." into oc-dr1-dev am: 65a3b2ccc4 am: 3bf4b6f1fe"
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java | 1 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java | 26 |
2 files changed, 20 insertions, 7 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 0373d77940d7..ebf4b5d83029 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java @@ -93,6 +93,7 @@ public class PipManager implements BasePipManager { ComponentName topPipActivity = PipUtils.getTopPinnedActivity(mContext, mActivityManager); mMenuController.hideMenu(); + mTouchHandler.onActivityUnpinned(topPipActivity); mNotificationController.onActivityUnpinned(topPipActivity); SystemServicesProxy.getInstance(mContext).setPipVisibility(topPipActivity != null); diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java index ddaeb04f8443..3682ae655f7c 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java @@ -25,6 +25,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.app.IActivityManager; +import android.content.ComponentName; import android.content.Context; import android.graphics.Point; import android.graphics.PointF; @@ -116,7 +117,7 @@ public class PipTouchHandler { }; // Behaviour states - private int mMenuState; + private int mMenuState = MENU_STATE_NONE; private boolean mIsMinimized; private boolean mIsImeShowing; private int mImeHeight; @@ -212,14 +213,15 @@ public class PipTouchHandler { } public void onActivityPinned() { - // Reset some states once we are pinned - mMenuState = MENU_STATE_NONE; + cleanUp(); + mShowPipMenuOnAnimationEnd = true; + } - if (mIsMinimized) { - setMinimizedStateInternal(false); + public void onActivityUnpinned(ComponentName topPipActivity) { + if (topPipActivity == null) { + // Clean up state after the last PiP activity is removed + cleanUp(); } - cleanUpDismissTarget(); - mShowPipMenuOnAnimationEnd = true; } public void onPinnedStackAnimationEnded() { @@ -729,6 +731,16 @@ public class PipTouchHandler { mDismissViewController.destroyDismissTarget(); } + /** + * Resets some states related to the touch handling. + */ + private void cleanUp() { + if (mIsMinimized) { + setMinimizedStateInternal(false); + } + cleanUpDismissTarget(); + } + public void dump(PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; pw.println(prefix + TAG); |