Set to accessibility floating menu mode when navigation mode is gestural

Bug: 173938894
Test: manual test
Change-Id: I2cbe690040a7e4ad15c1340a5ee146eb315b1d27
This commit is contained in:
jasonwshsu
2021-01-20 15:57:59 +08:00
parent 05a4536411
commit bc4516eb22

View File

@@ -23,6 +23,7 @@ import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.WindowType; import static android.app.StatusBarManager.WindowType;
import static android.app.StatusBarManager.WindowVisibleState; import static android.app.StatusBarManager.WindowVisibleState;
import static android.app.StatusBarManager.windowStateToString; import static android.app.StatusBarManager.windowStateToString;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.InsetsState.containsType; import static android.view.InsetsState.containsType;
@@ -548,6 +549,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mIsCurrentUserSetup = mDeviceProvisionedController.isCurrentUserSetup(); mIsCurrentUserSetup = mDeviceProvisionedController.isCurrentUserSetup();
mDeviceProvisionedController.addCallback(mUserSetupListener); mDeviceProvisionedController.addCallback(mUserSetupListener);
setAccessibilityFloatingMenuModeIfNeeded();
return barView; return barView;
} }
@@ -1392,6 +1395,13 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
updateSystemUiStateFlags(a11yFlags); updateSystemUiStateFlags(a11yFlags);
} }
private void setAccessibilityFloatingMenuModeIfNeeded() {
if (QuickStepContract.isGesturalMode(mNavBarMode)) {
Settings.Secure.putInt(mContentResolver, Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU);
}
}
public void updateSystemUiStateFlags(int a11yFlags) { public void updateSystemUiStateFlags(int a11yFlags) {
if (a11yFlags < 0) { if (a11yFlags < 0) {
a11yFlags = getA11yButtonState(null); a11yFlags = getA11yButtonState(null);
@@ -1449,7 +1459,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
// If accessibility button is floating menu mode, click and long click state should be // If accessibility button is floating menu mode, click and long click state should be
// disabled. // disabled.
if (mA11yBtnMode == Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU) { if (mA11yBtnMode == ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU) {
return 0; return 0;
} }
@@ -1531,6 +1541,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
public void onNavigationModeChanged(int mode) { public void onNavigationModeChanged(int mode) {
mNavBarMode = mode; mNavBarMode = mode;
updateScreenPinningGestures(); updateScreenPinningGestures();
setAccessibilityFloatingMenuModeIfNeeded();
if (!canShowSecondaryHandle()) { if (!canShowSecondaryHandle()) {
resetSecondaryHandle(); resetSecondaryHandle();