diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java | 17 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java | 23 |
2 files changed, 39 insertions, 1 deletions
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 3396f7097ce0..a3185a2ad796 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java @@ -99,6 +99,7 @@ public class PipMenuActivity extends Activity { public static final int MESSAGE_ANIMATION_ENDED = 6; public static final int MESSAGE_POINTER_EVENT = 7; public static final int MESSAGE_MENU_EXPANDED = 8; + public static final int MESSAGE_FADE_OUT_MENU = 9; private static final int INITIAL_DISMISS_DELAY = 3500; private static final int POST_INTERACTION_DISMISS_DELAY = 2000; @@ -182,6 +183,10 @@ public class PipMenuActivity extends Activity { mMenuContainerAnimator.start(); break; } + case MESSAGE_FADE_OUT_MENU: { + fadeOutMenu(); + break; + } } } }; @@ -409,6 +414,18 @@ public class PipMenuActivity extends Activity { } } + /** + * Different from {@link #hideMenu()}, this function does not try to finish this menu activity + * and instead, it fades out the controls by setting the alpha to 0 directly without menu + * visibility callbacks invoked. + */ + private void fadeOutMenu() { + mMenuContainer.setAlpha(0f); + mSettingsButton.setAlpha(0f); + mDismissButton.setAlpha(0f); + mResizeHandle.setAlpha(0f); + } + private void hideMenu() { hideMenu(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 bf2c3e9d0d6e..8b4d932619a9 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java @@ -262,6 +262,9 @@ public class PipMenuActivityController { */ public void showMenuWithDelay(int menuState, Rect stackBounds, boolean allowMenuTimeout, boolean willResizeMenu, boolean showResizeHandle) { + // hide all visible controls including close button and etc. first, this is to ensure + // menu is totally invisible during the transition to eliminate unpleasant artifacts + fadeOutMenu(); showMenuInternal(menuState, stackBounds, allowMenuTimeout, willResizeMenu, true /* withDelay */, showResizeHandle); } @@ -347,6 +350,23 @@ public class PipMenuActivityController { } } + private void fadeOutMenu() { + if (DEBUG) { + Log.d(TAG, "fadeOutMenu() state=" + mMenuState + + " hasActivity=" + (mToActivityMessenger != null) + + " callers=\n" + Debug.getCallers(5, " ")); + } + if (mToActivityMessenger != null) { + Message m = Message.obtain(); + m.what = PipMenuActivity.MESSAGE_FADE_OUT_MENU; + try { + mToActivityMessenger.send(m); + } catch (RemoteException e) { + Log.e(TAG, "Could not notify menu to fade out", e); + } + } + } + /** * Hides the menu activity. */ @@ -513,7 +533,8 @@ public class PipMenuActivityController { private void onMenuStateChanged(int menuState, boolean resize, Runnable callback) { if (DEBUG) { Log.d(TAG, "onMenuStateChanged() mMenuState=" + mMenuState - + " menuState=" + menuState + " resize=" + resize); + + " menuState=" + menuState + " resize=" + resize + + " callers=\n" + Debug.getCallers(5, " ")); } if (menuState != mMenuState) { |