Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5821a853 authored by Chun-Ku Lin's avatar Chun-Ku Lin
Browse files

[Cleanup] Remove the usage of the flag - a11y_standalone_gesture_enabled

Bug: 297544054
Test: Build succeed
Test: atest
Flag: EXEMPT flag clean up
Change-Id: I74b1e7a966257a1eb42f800845c3b9b25454eb31
parent eb171866
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
package: "android.provider"
container: "system"

flag {
    name: "a11y_standalone_gesture_enabled"
    namespace: "accessibility"
    description: "Separating a11y software shortcut and gesture shortcut"
    bug: "297544054"
}

flag {
    name: "system_settings_default"
    is_exported: true
+1 −5
Original line number Diff line number Diff line
@@ -57,9 +57,6 @@ public class AccessibilityButtonChooserActivity extends Activity {
            rdl.setOnDismissedListener(this::finish);
        }

        final String component = Settings.Secure.getString(getContentResolver(),
                Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT);

        final AccessibilityManager accessibilityManager =
                getSystemService(AccessibilityManager.class);
        final boolean isTouchExploreOn =
@@ -68,8 +65,7 @@ public class AccessibilityButtonChooserActivity extends Activity {
                NAV_BAR_MODE_GESTURAL == getResources().getInteger(
                        com.android.internal.R.integer.config_navBarInteractionMode);

        final int targetType = android.provider.Flags.a11yStandaloneGestureEnabled()
                ? getIntent().getIntExtra(EXTRA_TYPE_TO_CHOOSE, SOFTWARE) : SOFTWARE;
        final int targetType = getIntent().getIntExtra(EXTRA_TYPE_TO_CHOOSE, SOFTWARE);

        if (isGestureNavigateEnabled) {
            final TextView promptPrologue = findViewById(R.id.accessibility_button_prompt_prologue);
+1 −4
Original line number Diff line number Diff line
@@ -185,10 +185,7 @@ public abstract class AccessibilityTarget implements TargetOperations, OnTargetS
     */
    @VisibleForTesting
    public static boolean isRecognizedShortcutType(@UserShortcutType int shortcutType) {
        int mask = SOFTWARE | HARDWARE;
        if (android.provider.Flags.a11yStandaloneGestureEnabled()) {
            mask = mask | GESTURE;
        }
        int mask = SOFTWARE | HARDWARE | GESTURE;
        return (shortcutType != 0 && (shortcutType & mask) == shortcutType);
    }
}
+0 −31
Original line number Diff line number Diff line
@@ -20,18 +20,10 @@ import static com.android.internal.accessibility.common.ShortcutConstants.UserSh
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.HARDWARE;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE;

import static com.google.common.truth.Truth.assertThat;

import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.Flags;

import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.android.internal.accessibility.common.ShortcutConstants;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@@ -39,31 +31,9 @@ import java.util.stream.IntStream;

@RunWith(AndroidJUnit4.class)
public class AccessibilityTargetTest {
    @Rule
    public SetFlagsRule mSetFlagsRule = new SetFlagsRule();
    private static final int[] EXPECTED_TYPES = { HARDWARE, SOFTWARE };
    private static final int[] EXPECTED_TYPES_GESTURE = { HARDWARE, SOFTWARE, GESTURE };

    @Test
    @DisableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void isRecognizedShortcutType_expectedType_isTrue() {
        for (int type : EXPECTED_TYPES) {
            assertThat(AccessibilityTarget.isRecognizedShortcutType(type)).isTrue();
        }
    }

    @Test
    @DisableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void isRecognizedShortcutType_notExpectedType_isFalse() {
        for (int type: ShortcutConstants.USER_SHORTCUT_TYPES) {
            if (IntStream.of(EXPECTED_TYPES).noneMatch(x -> x == type)) {
                assertThat(AccessibilityTarget.isRecognizedShortcutType(type)).isFalse();
            }
        }
    }

    @Test
    @EnableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void isRecognizedShortcutType_expectedType_gestureIncluded_isTrue() {
        for (int type : EXPECTED_TYPES_GESTURE) {
            if (!AccessibilityTarget.isRecognizedShortcutType(type)) {
@@ -74,7 +44,6 @@ public class AccessibilityTargetTest {
    }

    @Test
    @EnableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void isRecognizedShortcutType_notExpectedType_gestureIncluded_isFalse() {
        for (int type: ShortcutConstants.USER_SHORTCUT_TYPES) {
            if (IntStream.of(EXPECTED_TYPES_GESTURE).noneMatch(x -> x == type)) {
+0 −23
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.navigationbar;

import static android.app.StatusBarManager.WINDOW_NAVIGATION_BAR;
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.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;

@@ -39,9 +38,6 @@ import static org.mockito.Mockito.when;
import android.content.ComponentName;
import android.content.res.Configuration;
import android.os.Handler;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.provider.Flags;
import android.view.IWindowManager;
import android.view.accessibility.AccessibilityManager;

@@ -380,23 +376,6 @@ public class NavBarHelperTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void updateA11yState_gestureMode_softwareTargets_isClickable() {
        when(mAccessibilityButtonModeObserver.getCurrentAccessibilityButtonMode()).thenReturn(
                ACCESSIBILITY_BUTTON_MODE_GESTURE);
        when(mAccessibilityManager.getAccessibilityShortcutTargets(UserShortcutType.SOFTWARE))
                .thenReturn(createFakeShortcutTargets());

        mNavBarHelper.updateA11yState();
        long state = mNavBarHelper.getA11yButtonState();
        assertThat(state & SYSUI_STATE_A11Y_BUTTON_CLICKABLE).isEqualTo(
                SYSUI_STATE_A11Y_BUTTON_CLICKABLE);
        assertThat(state & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE).isEqualTo(
                SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE);
    }

    @Test
    @EnableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void updateA11yState_gestureNavMode_floatingButtonMode_gestureTargets_isClickable() {
        mNavBarHelper.onNavigationModeChanged(NAV_BAR_MODE_GESTURAL);
        when(mAccessibilityButtonModeObserver.getCurrentAccessibilityButtonMode()).thenReturn(
@@ -413,7 +392,6 @@ public class NavBarHelperTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void updateA11yState_navBarMode_gestureTargets_isNotClickable() {
        when(mAccessibilityButtonModeObserver.getCurrentAccessibilityButtonMode()).thenReturn(
                ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR);
@@ -427,7 +405,6 @@ public class NavBarHelperTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(Flags.FLAG_A11Y_STANDALONE_GESTURE_ENABLED)
    public void updateA11yState_singleTarget_clickableButNotLongClickable() {
        when(mAccessibilityButtonModeObserver.getCurrentAccessibilityButtonMode()).thenReturn(
                ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR);
Loading