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

Commit 277ed260 authored by PETER LIANG's avatar PETER LIANG Committed by Android (Google) Code Review
Browse files

Merge "Fix that holding volume buttons to activate Extra dim feature doesn't...

Merge "Fix that holding volume buttons to activate Extra dim feature doesn't do anything." into tm-dev
parents 9d55afe2 684722c3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ import android.util.Log;
import android.util.MemoryIntArray;
import android.view.Display;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.Editor;
@@ -7476,6 +7477,16 @@ public final class Settings {
        public static final String ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN =
                "accessibility_shortcut_dialog_shown";
        /**
         * Setting specifying if the timeout restriction
         * {@link ViewConfiguration#getAccessibilityShortcutKeyTimeout()}
         * of the accessibility shortcut dialog is skipped.
         *
         * @hide
         */
        public static final String SKIP_ACCESSIBILITY_SHORTCUT_DIALOG_TIMEOUT_RESTRICTION =
                "skip_accessibility_shortcut_dialog_timeout_restriction";
        /**
         * Setting specifying the accessibility services, accessibility shortcut targets,
         * or features to be toggled via the accessibility shortcut.
+13 −5
Original line number Diff line number Diff line
@@ -1491,11 +1491,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private long getAccessibilityShortcutTimeout() {
        ViewConfiguration config = ViewConfiguration.get(mContext);
        return Settings.Secure.getIntForUser(mContext.getContentResolver(),
                Settings.Secure.ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, 0, mCurrentUserId) == 0
                ? config.getAccessibilityShortcutKeyTimeout()
                : config.getAccessibilityShortcutKeyTimeoutAfterConfirmation();
        final ViewConfiguration config = ViewConfiguration.get(mContext);
        final boolean hasDialogShown = Settings.Secure.getIntForUser(mContext.getContentResolver(),
                Settings.Secure.ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, 0, mCurrentUserId) != 0;
        final boolean skipTimeoutRestriction =
                Settings.Secure.getIntForUser(mContext.getContentResolver(),
                        Settings.Secure.SKIP_ACCESSIBILITY_SHORTCUT_DIALOG_TIMEOUT_RESTRICTION, 0,
                        mCurrentUserId) != 0;

        // If users manually set the volume key shortcut for any accessibility service, the
        // system would bypass the timeout restriction of the shortcut dialog.
        return hasDialogShown || skipTimeoutRestriction
                ? config.getAccessibilityShortcutKeyTimeoutAfterConfirmation()
                : config.getAccessibilityShortcutKeyTimeout();
    }

    private long getScreenshotChordLongPressDelay() {