Adjust edit shortcuts page to display button & gesture

Page is altered to display the FAB shortcut
and gesture shortcut simultaneously when the user is in
gesture navigation mode.
The gesture option does not display the "more options" link.
Additionally, the gesture option controller uses the GESTURE type,
which means it will read from & write to the gesture setting.
All this behavior is flag protected.

Bug: 300318311
Test: atest FloatingButtonShortcutOptionControllerTest GestureShortcutOptionControllerTest
Flag: android.provider.a11y_standalone_gesture_enabled
Change-Id: I915f05b2102ce499bb906df2c13e0870ae0a36d5
This commit is contained in:
Riley Jones
2024-07-02 03:22:41 +00:00
parent b22a9d03af
commit 1e80db4ee3
6 changed files with 109 additions and 33 deletions

View File

@@ -20,6 +20,8 @@ import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATIN
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -46,20 +48,15 @@ public class AccessibilityTestUtils {
public static void setSoftwareShortcutMode(
Context context, boolean gestureNavEnabled, boolean floatingButtonEnabled) {
int mode = floatingButtonEnabled ? ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU : -1;
int buttonMode = floatingButtonEnabled ? ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU : -1;
int navMode = gestureNavEnabled ? NAV_BAR_MODE_GESTURAL : NAV_BAR_MODE_3BUTTON;
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, mode);
if (gestureNavEnabled) {
SettingsShadowResources.overrideResource(
com.android.internal.R.integer.config_navBarInteractionMode,
NAV_BAR_MODE_GESTURAL);
} else {
SettingsShadowResources.overrideResource(
com.android.internal.R.integer.config_navBarInteractionMode,
NAV_BAR_MODE_3BUTTON);
}
Settings.Secure.ACCESSIBILITY_BUTTON_MODE, buttonMode);
SettingsShadowResources.overrideResource(
com.android.internal.R.integer.config_navBarInteractionMode, navMode);
assertThat(context.getResources().getInteger(
com.android.internal.R.integer.config_navBarInteractionMode)).isEqualTo(navMode);
}
/**