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

Commit 663e7731 authored by Daniel Norman's avatar Daniel Norman Committed by Android (Google) Code Review
Browse files

Merge "A11yMenu: also delay before locking the screen." into main

parents 23daba73 ed56174e
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);
            }
            }