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

Commit 713924b1 authored by Daniel Norman's avatar Daniel Norman
Browse files

Recalculate restricted actions each time A11yMenu is opened.

The set of restricted actions may change at runtime, and this also fixes
a testing flake caused by restarting the service multiple times mid
test.

Bug: 347269196
Bug: 357747420
Test: atest AccessibilityMenuServiceTest
Test: Same test on go/abtd
Flag: com.android.systemui.accessibility.accessibilitymenu.hide_restricted_actions
Change-Id: I5517a8a36ceb55f5f4b35d22a1b24ab569cd0426
parent 67271f5b
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -348,7 +348,17 @@ public class A11yMenuOverlayLayout {

    /** Toggles a11y menu layout visibility. */
    public void toggleVisibility() {
        mLayout.setVisibility((mLayout.getVisibility() == View.VISIBLE) ? View.GONE : View.VISIBLE);
        if (mLayout.getVisibility() == View.VISIBLE) {
            mLayout.setVisibility(View.GONE);
        } else {
            if (Flags.hideRestrictedActions()) {
                // Reconfigure the shortcut list in case the set of restricted actions has changed.
                mA11yMenuViewPager.configureViewPagerAndFooter(
                        mLayout, createShortcutList(), getPageIndex());
                updateViewLayout();
            }
            mLayout.setVisibility(View.VISIBLE);
        }
    }

    /** Shows hint text on a minimal Snackbar-like text view. */
+0 −2
Original line number Diff line number Diff line
@@ -542,8 +542,6 @@ public class AccessibilityMenuServiceTest {
        final Context context = sInstrumentation.getTargetContext();
        final UserManager userManager = context.getSystemService(UserManager.class);
        userManager.setUserRestriction(restriction, isRestricted);
        // Re-enable the service for the restriction to take effect.
        enableA11yMenuService(context);
    }

    private static void unlockSignal() throws IOException {