diff options
author | 2025-01-30 22:34:07 +0100 | |
---|---|---|
committer | 2025-01-31 11:55:30 -0800 | |
commit | 1a2e101560f04189d25049f245d8c36ff0fcf0af (patch) | |
tree | c39bef64985586e697141025b51b72edafd120ea | |
parent | a39afd3f941b6b8aed971a0367e740b7840cc4ff (diff) |
TV PIP: don't close menu after 10s if A11y enabled
DPAD navigation is not recognized as activity within the menu causing
the menu to close too early.
Bug: 393606618
Test: manual - enabled Talkback, open PiP menu and wait
Flag: EXEMPT bugfix
Change-Id: Iac9ff13cf5ea55cf569680e6ad3d9428f4215bb4
-rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java index e74870d4d139..5894ea8d0b5c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java @@ -32,6 +32,7 @@ import android.view.View; import android.view.ViewRootImpl; import android.view.WindowManager; import android.view.WindowManagerGlobal; +import android.view.accessibility.AccessibilityManager; import android.window.SurfaceSyncGroup; import androidx.annotation.Nullable; @@ -63,6 +64,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis private TvPipMenuView mPipMenuView; private TvPipBackgroundView mPipBackgroundView; + private final AccessibilityManager mA11yManager; + private boolean mIsReloading; private static final int PIP_MENU_FORCE_CLOSE_DELAY_MS = 10_000; private final Runnable mClosePipMenuRunnable = this::closeMenu; @@ -107,6 +110,8 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis mSystemWindows = systemWindows; mMainHandler = mainHandler; + mA11yManager = context.getSystemService(AccessibilityManager.class); + // We need to "close" the menu the platform call for all the system dialogs to close (for // example, on the Home button press). final BroadcastReceiver closeSystemDialogsBroadcastReceiver = new BroadcastReceiver() { @@ -499,7 +504,9 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis switchToMenuMode(menuMode); } else { if (isMenuOpen(menuMode)) { - mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); + if (!mA11yManager.isEnabled()) { + 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 @@ -594,8 +601,10 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis 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); + if (mMainHandler.hasCallbacks(mClosePipMenuRunnable)) { + mMainHandler.removeCallbacks(mClosePipMenuRunnable); + mMainHandler.postDelayed(mClosePipMenuRunnable, PIP_MENU_FORCE_CLOSE_DELAY_MS); + } } @Override |