Update the supported type in ACCESSIBILITY_BUTTON_MODE according to navigation gestural mode or button mode
Root cause: From the user feedback, accessibiltiy gesture has more benifits than floating accessibility button especially to low vision users. Solution: Bring back accessibility gesture to be one of the options of the accessibility button, then update to supported type according to navigation gestural mode or button mode. ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR is incompatible under gestural mode; ACCESSIBILITY_BUTTON_MODE_GESTURE is incompatible under non gestural mode; ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU is compatible under both mode. Bug: 190563948 Test: install new SettingsProvider.apk & adb reboot & manual test Change-Id: I9ac163603112bc899f64164bee5752a5249ed0dc
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.accessibility;
|
||||
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
@@ -49,7 +50,8 @@ public class AccessibilityButtonModeObserver extends
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR,
|
||||
ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU
|
||||
ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU,
|
||||
ACCESSIBILITY_BUTTON_MODE_GESTURE
|
||||
})
|
||||
public @interface AccessibilityButtonMode {}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import static android.app.StatusBarManager.WindowVisibleState;
|
||||
import static android.app.StatusBarManager.windowStateToString;
|
||||
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE;
|
||||
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
|
||||
import static android.view.InsetsState.containsType;
|
||||
@@ -579,7 +581,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
||||
mDeviceProvisionedController.addCallback(mUserSetupListener);
|
||||
mNotificationShadeDepthController.addListener(mDepthListener);
|
||||
|
||||
setAccessibilityFloatingMenuModeIfNeeded();
|
||||
updateAccessibilityButtonModeIfNeeded();
|
||||
|
||||
return barView;
|
||||
}
|
||||
@@ -1364,11 +1366,31 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
||||
updateSystemUiStateFlags(a11yFlags);
|
||||
}
|
||||
|
||||
private void setAccessibilityFloatingMenuModeIfNeeded() {
|
||||
if (QuickStepContract.isGesturalMode(mNavBarMode)) {
|
||||
private void updateAccessibilityButtonModeIfNeeded() {
|
||||
final int mode = Settings.Secure.getIntForUser(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
|
||||
ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR, UserHandle.USER_CURRENT);
|
||||
|
||||
// ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU is compatible under gestural or non-gestural
|
||||
// mode, so we don't need to update it.
|
||||
if (mode == ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR is incompatible under gestural mode. Need to
|
||||
// force update to ACCESSIBILITY_BUTTON_MODE_GESTURE.
|
||||
if (QuickStepContract.isGesturalMode(mNavBarMode)
|
||||
&& mode == ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR) {
|
||||
Settings.Secure.putIntForUser(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, ACCESSIBILITY_BUTTON_MODE_GESTURE,
|
||||
UserHandle.USER_CURRENT);
|
||||
// ACCESSIBILITY_BUTTON_MODE_GESTURE is incompatible under non gestural mode. Need to
|
||||
// force update to ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR.
|
||||
} else if (!QuickStepContract.isGesturalMode(mNavBarMode)
|
||||
&& mode == ACCESSIBILITY_BUTTON_MODE_GESTURE) {
|
||||
Settings.Secure.putIntForUser(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
|
||||
ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU, UserHandle.USER_CURRENT);
|
||||
ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR, UserHandle.USER_CURRENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1495,7 +1517,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
||||
}
|
||||
}
|
||||
updateScreenPinningGestures();
|
||||
setAccessibilityFloatingMenuModeIfNeeded();
|
||||
updateAccessibilityButtonModeIfNeeded();
|
||||
|
||||
if (!canShowSecondaryHandle()) {
|
||||
resetSecondaryHandle();
|
||||
|
||||
Reference in New Issue
Block a user