Merge "Fix that holding volume buttons to activate Extra dim feature doesn't do anything." into tm-dev

This commit is contained in:
PETER LIANG
2022-03-25 14:06:00 +00:00
committed by Android (Google) Code Review
2 changed files with 24 additions and 5 deletions

View File

@@ -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.

View File

@@ -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() {