Update the supported type in ACCESSIBILITY_BUTTON_MODE according to navigation gestural mode or button mode am: 58a8eaa26e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15124971 Change-Id: Ie08c66250f34a437bd5535abae5cea950b53d9a1
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package com.android.systemui.accessibility;
|
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_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.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
@@ -49,7 +50,8 @@ public class AccessibilityButtonModeObserver extends
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({
|
@IntDef({
|
||||||
ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR,
|
ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR,
|
||||||
ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU
|
ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU,
|
||||||
|
ACCESSIBILITY_BUTTON_MODE_GESTURE
|
||||||
})
|
})
|
||||||
public @interface AccessibilityButtonMode {}
|
public @interface AccessibilityButtonMode {}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import static android.app.StatusBarManager.WindowVisibleState;
|
|||||||
import static android.app.StatusBarManager.windowStateToString;
|
import static android.app.StatusBarManager.windowStateToString;
|
||||||
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
|
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_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.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;
|
||||||
@@ -589,7 +591,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
mDeviceProvisionedController.addCallback(mUserSetupListener);
|
mDeviceProvisionedController.addCallback(mUserSetupListener);
|
||||||
mNotificationShadeDepthController.addListener(mDepthListener);
|
mNotificationShadeDepthController.addListener(mDepthListener);
|
||||||
|
|
||||||
setAccessibilityFloatingMenuModeIfNeeded();
|
updateAccessibilityButtonModeIfNeeded();
|
||||||
|
|
||||||
return barView;
|
return barView;
|
||||||
}
|
}
|
||||||
@@ -1379,11 +1381,31 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
updateSystemUiStateFlags(a11yFlags);
|
updateSystemUiStateFlags(a11yFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAccessibilityFloatingMenuModeIfNeeded() {
|
private void updateAccessibilityButtonModeIfNeeded() {
|
||||||
if (QuickStepContract.isGesturalMode(mNavBarMode)) {
|
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.putIntForUser(mContentResolver,
|
||||||
Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
|
Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
|
||||||
ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU, UserHandle.USER_CURRENT);
|
ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR, UserHandle.USER_CURRENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1511,7 +1533,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateScreenPinningGestures();
|
updateScreenPinningGestures();
|
||||||
setAccessibilityFloatingMenuModeIfNeeded();
|
updateAccessibilityButtonModeIfNeeded();
|
||||||
|
|
||||||
if (!canShowSecondaryHandle()) {
|
if (!canShowSecondaryHandle()) {
|
||||||
resetSecondaryHandle();
|
resetSecondaryHandle();
|
||||||
|
|||||||
Reference in New Issue
Block a user