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

Commit ed56174e authored by Daniel Norman's avatar Daniel Norman
Browse files

A11yMenu: also delay before locking the screen.

Internally the screen lock action is handled in SysUI by taking
a screenshot and then fading that to black, so the delay allows
us to hide the UI before that screenshot is taken.

Uses the same flag `a11y_menu_hide_before_taking_action`
that was used for the "take screenshot" delay because this flag
has not yet rolled out to the larger population.


Bug: 309557993
Test: Enable the flag, lock the screen, observe A11yMenu UI
      is hidden from lockscreen fade animation.
Change-Id: I55cd656bdfa10670dd4eb6db943625ae00793ba8
parent c6f6d547
Loading
Loading
Loading
Loading
+10 −3
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ public class AccessibilityMenuService extends AccessibilityService


    private static final String TAG = "A11yMenuService";
    private static final String TAG = "A11yMenuService";
    private static final long BUFFER_MILLISECONDS_TO_PREVENT_UPDATE_FAILURE = 100L;
    private static final long BUFFER_MILLISECONDS_TO_PREVENT_UPDATE_FAILURE = 100L;
    private static final long TAKE_SCREENSHOT_DELAY_MS = 100L;
    private static final long HIDE_UI_DELAY_MS = 100L;


    private static final int BRIGHTNESS_UP_INCREMENT_GAMMA =
    private static final int BRIGHTNESS_UP_INCREMENT_GAMMA =
            (int) Math.ceil(BrightnessUtils.GAMMA_SPACE_MAX * 0.11f);
            (int) Math.ceil(BrightnessUtils.GAMMA_SPACE_MAX * 0.11f);
@@ -296,7 +296,14 @@ public class AccessibilityMenuService extends AccessibilityService
        } else if (viewTag == ShortcutId.ID_RECENT_VALUE.ordinal()) {
        } else if (viewTag == ShortcutId.ID_RECENT_VALUE.ordinal()) {
            performGlobalActionInternal(GLOBAL_ACTION_RECENTS);
            performGlobalActionInternal(GLOBAL_ACTION_RECENTS);
        } else if (viewTag == ShortcutId.ID_LOCKSCREEN_VALUE.ordinal()) {
        } else if (viewTag == ShortcutId.ID_LOCKSCREEN_VALUE.ordinal()) {
            if (Flags.a11yMenuHideBeforeTakingAction()) {
                // Delay before locking the screen to give time for the UI to close.
                mHandler.postDelayed(
                        () -> performGlobalActionInternal(GLOBAL_ACTION_LOCK_SCREEN),
                        HIDE_UI_DELAY_MS);
            } else {
                performGlobalActionInternal(GLOBAL_ACTION_LOCK_SCREEN);
                performGlobalActionInternal(GLOBAL_ACTION_LOCK_SCREEN);
            }
        } else if (viewTag == ShortcutId.ID_QUICKSETTING_VALUE.ordinal()) {
        } else if (viewTag == ShortcutId.ID_QUICKSETTING_VALUE.ordinal()) {
            performGlobalActionInternal(GLOBAL_ACTION_QUICK_SETTINGS);
            performGlobalActionInternal(GLOBAL_ACTION_QUICK_SETTINGS);
        } else if (viewTag == ShortcutId.ID_NOTIFICATION_VALUE.ordinal()) {
        } else if (viewTag == ShortcutId.ID_NOTIFICATION_VALUE.ordinal()) {
@@ -306,7 +313,7 @@ public class AccessibilityMenuService extends AccessibilityService
                // Delay before taking a screenshot to give time for the UI to close.
                // Delay before taking a screenshot to give time for the UI to close.
                mHandler.postDelayed(
                mHandler.postDelayed(
                        () -> performGlobalActionInternal(GLOBAL_ACTION_TAKE_SCREENSHOT),
                        () -> performGlobalActionInternal(GLOBAL_ACTION_TAKE_SCREENSHOT),
                        TAKE_SCREENSHOT_DELAY_MS);
                        HIDE_UI_DELAY_MS);
            } else {
            } else {
                performGlobalActionInternal(GLOBAL_ACTION_TAKE_SCREENSHOT);
                performGlobalActionInternal(GLOBAL_ACTION_TAKE_SCREENSHOT);
            }
            }