diff options
| author | 2017-06-22 03:48:45 +0000 | |
|---|---|---|
| committer | 2017-06-22 03:48:45 +0000 | |
| commit | 3bf4b6f1fe4004fd19eb24f5def0100edecac316 (patch) | |
| tree | e3944d87ecfa3481af4a94cf4877578a16eb7152 | |
| parent | dcc8d1566db26cb9de8b3fc610d2dbf2b3a67712 (diff) | |
| parent | 65a3b2ccc4b6bbf6d87a7f3a94ddbe4c4792cd64 (diff) | |
Merge "Clean up dismiss target when last activity is unpinned." into oc-dr1-dev
am: 65a3b2ccc4
Change-Id: I576f611e4a1a6567e7cd2e80b4f5575ba99e2f4d
| -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); |