Make Taskbar focusable when a popup is open.

- Added ArrowPopup#OnPopupClosedCallback to automatically remove Taskbar focus when the popup closes.

Fixes: 209917078
Test: opened popup in taskbar and closed it with switch access, touching anywhere on the screen and using the back gesture. went home to check if focus was removed.
Change-Id: Ie7aafc9cf0f03fadaa44e77818508e9e1d8db610
This commit is contained in:
Schneider Victor-tulias
2022-01-12 14:33:43 -08:00
parent 66971f87e1
commit 291d88460b
4 changed files with 34 additions and 8 deletions

View File

@@ -501,19 +501,30 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
return mTaskbarHeightForIme;
}
/**
* Either adds or removes {@link WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} on the taskbar
* window.
*/
public void setTaskbarWindowFocusable(boolean focusable) {
if (focusable) {
mWindowLayoutParams.flags &= ~FLAG_NOT_FOCUSABLE;
} else {
mWindowLayoutParams.flags |= FLAG_NOT_FOCUSABLE;
}
mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams);
}
/**
* Either adds or removes {@link WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} on the taskbar
* window. If we're now focusable, also move nav buttons to a separate window above IME.
*/
public void setTaskbarWindowFocusableForIme(boolean focusable) {
if (focusable) {
mWindowLayoutParams.flags &= ~FLAG_NOT_FOCUSABLE;
mControllers.navbarButtonsViewController.moveNavButtonsToNewWindow();
} else {
mWindowLayoutParams.flags |= FLAG_NOT_FOCUSABLE;
mControllers.navbarButtonsViewController.moveNavButtonsBackToTaskbarWindow();
}
mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams);
setTaskbarWindowFocusable(focusable);
}
/** Adds the given view to WindowManager with the provided LayoutParams (creates new window). */