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
5 changed files with 46 additions and 0 deletions

View File

@@ -333,6 +333,10 @@ public abstract class AccessibilityShortcutPreferenceFragment extends DashboardF
mShortcutPreference.setChecked(shortcutAssigned);
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
if (mHardwareTypeCheckBox.isChecked()) {
AccessibilityUtil.skipVolumeShortcutDialogTimeoutRestriction(getPrefContext());
}
// Show the quick setting tooltip if the shortcut assigned in the first time
if (shortcutAssigned) {
showQuickSettingsTooltipIfNeeded();

View File

@@ -434,4 +434,15 @@ public final class AccessibilityUtil {
public static boolean isSystemApp(@NonNull AccessibilityServiceInfo info) {
return info.getResolveInfo().serviceInfo.applicationInfo.isSystemApp();
}
/**
* Bypasses the timeout restriction if volume key shortcut assigned.
*
* @param context the current context.
*/
public static void skipVolumeShortcutDialogTimeoutRestriction(Context context) {
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.SKIP_ACCESSIBILITY_SHORTCUT_DIALOG_TIMEOUT_RESTRICTION, /*
true */ 1);
}
}

View File

@@ -725,6 +725,10 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
mShortcutPreference.setChecked(shortcutAssigned);
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
if (mHardwareTypeCheckBox.isChecked()) {
AccessibilityUtil.skipVolumeShortcutDialogTimeoutRestriction(getPrefContext());
}
// Show the quick setting tooltip if the shortcut assigned in the first time
if (shortcutAssigned) {
showQuickSettingsTooltipIfNeeded();

View File

@@ -367,6 +367,10 @@ public class ToggleScreenMagnificationPreferenceFragment extends
mShortcutPreference.setChecked(value != UserShortcutType.EMPTY);
mShortcutPreference.setSummary(
getShortcutTypeSummary(getPrefContext()));
if (mHardwareTypeCheckBox.isChecked()) {
AccessibilityUtil.skipVolumeShortcutDialogTimeoutRestriction(getPrefContext());
}
}
@Override