Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java +16 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis private TvPipBackgroundView mPipBackgroundView; private boolean mIsReloading; private static final int PIP_MENU_FORCE_CLOSE_DELAY_MS = 10_000; private final Runnable mClosePipMenuRunnable = this::closeMenu; @TvPipMenuMode private int mCurrentMenuMode = MODE_NO_MENU; Loading Loading @@ -280,6 +282,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: closeMenu()", TAG); requestMenuMode(MODE_NO_MENU); mMainHandler.removeCallbacks(mClosePipMenuRunnable); } @Override Loading Loading @@ -488,13 +491,17 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis private void requestMenuMode(@TvPipMenuMode int menuMode) { if (isMenuOpen() == isMenuOpen(menuMode)) { if (mMainHandler.hasCallbacks(mClosePipMenuRunnable)) { mMainHandler.removeCallbacks(mClosePipMenuRunnable); mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); } // No need to request a focus change. We can directly switch to the new mode. switchToMenuMode(menuMode); } else { if (isMenuOpen(menuMode)) { mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); mMenuModeOnFocus = menuMode; } // Send a request to gain window focus if the menu is open, or lose window focus // otherwise. Once the focus change happens, we will request the new mode in the // callback {@link #onPipWindowFocusChanged}. Loading Loading @@ -583,6 +590,14 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis requestMenuMode(isInMoveMode() ? mPrevMenuMode : MODE_NO_MENU); } @Override public void onUserInteracting() { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: onUserInteracting - mCurrentMenuMode=%s", TAG, getMenuModeString()); mMainHandler.removeCallbacks(mClosePipMenuRunnable); mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); } @Override public void onPipMovement(int keycode) { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java +22 −14 Original line number Diff line number Diff line Loading @@ -491,30 +491,33 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == ACTION_UP) { if (event.getKeyCode() == KEYCODE_BACK) { mListener.onExitCurrentMenuMode(); return true; } if (mCurrentMenuMode == MODE_MOVE_MENU && !mA11yManager.isEnabled()) { switch (event.getKeyCode()) { case KEYCODE_DPAD_UP: case KEYCODE_DPAD_DOWN: case KEYCODE_DPAD_LEFT: case KEYCODE_DPAD_RIGHT: mListener.onUserInteracting(); if (mCurrentMenuMode == MODE_MOVE_MENU && !mA11yManager.isEnabled()) { mListener.onPipMovement(event.getKeyCode()); return true; } break; case KEYCODE_ENTER: case KEYCODE_DPAD_CENTER: mListener.onUserInteracting(); if (mCurrentMenuMode == MODE_MOVE_MENU && !mA11yManager.isEnabled()) { mListener.onExitCurrentMenuMode(); return true; } break; default: // Dispatch key event as normal below } } } return super.dispatchKeyEvent(event); } Loading Loading @@ -636,6 +639,11 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L interface Listener { /** * Called when any button (that affects the menu) on current menu mode was pressed. */ void onUserInteracting(); /** * Called when a button for exiting the current menu mode was pressed. */ Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java +16 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis private TvPipBackgroundView mPipBackgroundView; private boolean mIsReloading; private static final int PIP_MENU_FORCE_CLOSE_DELAY_MS = 10_000; private final Runnable mClosePipMenuRunnable = this::closeMenu; @TvPipMenuMode private int mCurrentMenuMode = MODE_NO_MENU; Loading Loading @@ -280,6 +282,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: closeMenu()", TAG); requestMenuMode(MODE_NO_MENU); mMainHandler.removeCallbacks(mClosePipMenuRunnable); } @Override Loading Loading @@ -488,13 +491,17 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis private void requestMenuMode(@TvPipMenuMode int menuMode) { if (isMenuOpen() == isMenuOpen(menuMode)) { if (mMainHandler.hasCallbacks(mClosePipMenuRunnable)) { mMainHandler.removeCallbacks(mClosePipMenuRunnable); mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); } // No need to request a focus change. We can directly switch to the new mode. switchToMenuMode(menuMode); } else { if (isMenuOpen(menuMode)) { mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); mMenuModeOnFocus = menuMode; } // Send a request to gain window focus if the menu is open, or lose window focus // otherwise. Once the focus change happens, we will request the new mode in the // callback {@link #onPipWindowFocusChanged}. Loading Loading @@ -583,6 +590,14 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis requestMenuMode(isInMoveMode() ? mPrevMenuMode : MODE_NO_MENU); } @Override public void onUserInteracting() { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s: onUserInteracting - mCurrentMenuMode=%s", TAG, getMenuModeString()); mMainHandler.removeCallbacks(mClosePipMenuRunnable); mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); } @Override public void onPipMovement(int keycode) { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java +22 −14 Original line number Diff line number Diff line Loading @@ -491,30 +491,33 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == ACTION_UP) { if (event.getKeyCode() == KEYCODE_BACK) { mListener.onExitCurrentMenuMode(); return true; } if (mCurrentMenuMode == MODE_MOVE_MENU && !mA11yManager.isEnabled()) { switch (event.getKeyCode()) { case KEYCODE_DPAD_UP: case KEYCODE_DPAD_DOWN: case KEYCODE_DPAD_LEFT: case KEYCODE_DPAD_RIGHT: mListener.onUserInteracting(); if (mCurrentMenuMode == MODE_MOVE_MENU && !mA11yManager.isEnabled()) { mListener.onPipMovement(event.getKeyCode()); return true; } break; case KEYCODE_ENTER: case KEYCODE_DPAD_CENTER: mListener.onUserInteracting(); if (mCurrentMenuMode == MODE_MOVE_MENU && !mA11yManager.isEnabled()) { mListener.onExitCurrentMenuMode(); return true; } break; default: // Dispatch key event as normal below } } } return super.dispatchKeyEvent(event); } Loading Loading @@ -636,6 +639,11 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L interface Listener { /** * Called when any button (that affects the menu) on current menu mode was pressed. */ void onUserInteracting(); /** * Called when a button for exiting the current menu mode was pressed. */ Loading