Snap for 11361184 from 317173b7cd
to 24Q2-release
Change-Id: I3c679f5edf3fd926df7d5b72aa61166e21bee4e6
This commit is contained in:
@@ -2283,6 +2283,21 @@
|
|||||||
android:value="true" />
|
android:value="true" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="Settings$AccessibilityEditShortcutsActivity"
|
||||||
|
android:label="@string/accessibility_settings"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="android.permission.MANAGE_ACCESSIBILITY">
|
||||||
|
<intent-filter android:priority="1">
|
||||||
|
<action android:name="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
android:value="com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragment" />
|
||||||
|
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
|
||||||
|
android:value="@string/menu_key_accessibility"/>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".accessibility.AccessibilitySettingsForSetupWizardActivity"
|
<activity android:name=".accessibility.AccessibilitySettingsForSetupWizardActivity"
|
||||||
android:icon="@drawable/ic_accessibility_suggestion"
|
android:icon="@drawable/ic_accessibility_suggestion"
|
||||||
android:label="@string/vision_settings_title"
|
android:label="@string/vision_settings_title"
|
||||||
|
@@ -9,6 +9,19 @@ flag {
|
|||||||
bug: "300302098"
|
bug: "300302098"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag {
|
||||||
|
name: "enable_hearing_aid_preset_control"
|
||||||
|
namespace: "accessibility"
|
||||||
|
description: "Allows users to control hearing aid preset in the Bluetooth device details page."
|
||||||
|
bug: "300015207"
|
||||||
|
}
|
||||||
|
|
||||||
|
flag {
|
||||||
|
name: "enable_hearing_aid_volume_offset_control"
|
||||||
|
namespace: "accessibility"
|
||||||
|
description: "Allows users to control hearing aid volume offset in the Bluetooth device details page."
|
||||||
|
bug: "301198830"
|
||||||
|
}
|
||||||
|
|
||||||
flag {
|
flag {
|
||||||
name: "remove_qs_tooltip_in_suw"
|
name: "remove_qs_tooltip_in_suw"
|
||||||
|
@@ -1743,7 +1743,7 @@
|
|||||||
<string name="bluetooth_pairing_request">Pair with <xliff:g id="device_name">%1$s</xliff:g>?</string>
|
<string name="bluetooth_pairing_request">Pair with <xliff:g id="device_name">%1$s</xliff:g>?</string>
|
||||||
|
|
||||||
<!-- Message when a bluetooth device from a coordinated set is bonding late. [CHAR LIMIT=NONE] -->
|
<!-- Message when a bluetooth device from a coordinated set is bonding late. [CHAR LIMIT=NONE] -->
|
||||||
<string name="bluetooth_pairing_group_late_bonding">Add new member to the existing coordinated set</string>
|
<string name="bluetooth_pairing_group_late_bonding">Confirm to add the second piece of your audio device</string>
|
||||||
|
|
||||||
<!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] -->
|
<!-- Message when bluetooth is informing the user of the pairing key. [CHAR LIMIT=NONE] -->
|
||||||
<string name="bluetooth_pairing_key_msg">Bluetooth pairing code</string>
|
<string name="bluetooth_pairing_key_msg">Bluetooth pairing code</string>
|
||||||
@@ -1766,7 +1766,7 @@
|
|||||||
<string name="bluetooth_enter_passkey_other_device">You may also need to type this passkey on the other device.</string>
|
<string name="bluetooth_enter_passkey_other_device">You may also need to type this passkey on the other device.</string>
|
||||||
|
|
||||||
<!-- Pairing dialog text to remind user the pairing including all of the devices in a coordinated set. [CHAR LIMIT=NONE] -->
|
<!-- Pairing dialog text to remind user the pairing including all of the devices in a coordinated set. [CHAR LIMIT=NONE] -->
|
||||||
<string name="bluetooth_paring_group_msg">Confirm to pair with the coordinated set</string>
|
<string name="bluetooth_paring_group_msg">Confirm to pair with the audio device</string>
|
||||||
|
|
||||||
<!-- Checkbox message in pairing dialogs. [CHAR LIMIT=NONE] -->
|
<!-- Checkbox message in pairing dialogs. [CHAR LIMIT=NONE] -->
|
||||||
<string name="bluetooth_pairing_shares_phonebook">Allow access to your contacts and call history</string>
|
<string name="bluetooth_pairing_shares_phonebook">Allow access to your contacts and call history</string>
|
||||||
@@ -4311,6 +4311,10 @@
|
|||||||
<string name="bounce_keys">Bounce keys</string>
|
<string name="bounce_keys">Bounce keys</string>
|
||||||
<!-- Summary text for the 'Bounce keys' preference sub-screen. [CHAR LIMIT=100] -->
|
<!-- Summary text for the 'Bounce keys' preference sub-screen. [CHAR LIMIT=100] -->
|
||||||
<string name="bounce_keys_summary">Enable Bounce keys for physical keyboard accessibility</string>
|
<string name="bounce_keys_summary">Enable Bounce keys for physical keyboard accessibility</string>
|
||||||
|
<!-- Title for the 'Slow keys' preference switch. [CHAR LIMIT=35] -->
|
||||||
|
<string name="slow_keys">Slow keys</string>
|
||||||
|
<!-- Summary text for the 'Slow keys' preference sub-screen. [CHAR LIMIT=100] -->
|
||||||
|
<string name="slow_keys_summary">Enable Slow keys for physical keyboard accessibility</string>
|
||||||
<!-- Title for the 'Sticky keys' preference switch. [CHAR LIMIT=35] -->
|
<!-- Title for the 'Sticky keys' preference switch. [CHAR LIMIT=35] -->
|
||||||
<string name="sticky_keys">Sticky keys</string>
|
<string name="sticky_keys">Sticky keys</string>
|
||||||
<!-- Summary text for the 'Sticky keys' preference sub-screen. [CHAR LIMIT=100] -->
|
<!-- Summary text for the 'Sticky keys' preference sub-screen. [CHAR LIMIT=100] -->
|
||||||
|
@@ -43,17 +43,23 @@
|
|||||||
android:key="keyboard_a11y_category"
|
android:key="keyboard_a11y_category"
|
||||||
android:title="@string/keyboard_a11y_category">
|
android:title="@string/keyboard_a11y_category">
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="accessibility_bounce_keys"
|
|
||||||
android:title="@string/bounce_keys"
|
|
||||||
android:summary="@string/bounce_keys_summary"
|
|
||||||
android:defaultValue="false" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="accessibility_sticky_keys"
|
android:key="accessibility_sticky_keys"
|
||||||
android:title="@string/sticky_keys"
|
android:title="@string/sticky_keys"
|
||||||
android:summary="@string/sticky_keys_summary"
|
android:summary="@string/sticky_keys_summary"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="accessibility_slow_keys"
|
||||||
|
android:title="@string/slow_keys"
|
||||||
|
android:summary="@string/slow_keys_summary"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="accessibility_bounce_keys"
|
||||||
|
android:title="@string/bounce_keys"
|
||||||
|
android:summary="@string/bounce_keys_summary"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -102,6 +102,7 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class DevelopmentSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class DevelopmentSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AccessibilitySettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilitySettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AccessibilityDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilityDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
public static class AccessibilityEditShortcutsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class CaptioningSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class CaptioningSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AccessibilityInversionSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilityInversionSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AccessibilityContrastSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AccessibilityContrastSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@@ -25,6 +25,7 @@ import android.content.res.Resources;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import com.android.settingslib.R;
|
import com.android.settingslib.R;
|
||||||
|
import com.android.window.flags.Flags;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -38,12 +39,11 @@ final class FontSizeData extends PreviewSizeData<Float> {
|
|||||||
|
|
||||||
FontSizeData(Context context) {
|
FontSizeData(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
final Resources resources = getContext().getResources();
|
final Resources resources = getContext().getResources();
|
||||||
final ContentResolver resolver = getContext().getContentResolver();
|
final ContentResolver resolver = getContext().getContentResolver();
|
||||||
final List<String> strEntryValues =
|
final List<String> strEntryValues =
|
||||||
Arrays.asList(resources.getStringArray(R.array.entryvalues_font_size));
|
Arrays.asList(resources.getStringArray(R.array.entryvalues_font_size));
|
||||||
setDefaultValue(FONT_SCALE_DEF_VALUE);
|
setDefaultValue(getFontScaleDefValue(resolver));
|
||||||
final float currentScale =
|
final float currentScale =
|
||||||
Settings.System.getFloat(resolver, Settings.System.FONT_SCALE, getDefaultValue());
|
Settings.System.getFloat(resolver, Settings.System.FONT_SCALE, getDefaultValue());
|
||||||
setInitialIndex(fontSizeValueToIndex(currentScale, strEntryValues.toArray(new String[0])));
|
setInitialIndex(fontSizeValueToIndex(currentScale, strEntryValues.toArray(new String[0])));
|
||||||
@@ -78,4 +78,10 @@ final class FontSizeData extends PreviewSizeData<Float> {
|
|||||||
}
|
}
|
||||||
return indices.length - 1;
|
return indices.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float getFontScaleDefValue(ContentResolver resolver) {
|
||||||
|
return Flags.configurableFontScaleDefault() ? Settings.System.getFloat(resolver,
|
||||||
|
Settings.System.DEFAULT_DEVICE_FONT_SCALE, FONT_SCALE_DEF_VALUE)
|
||||||
|
: FONT_SCALE_DEF_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -270,6 +270,7 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mShortcutTargets = Set.of(targets);
|
mShortcutTargets = Set.of(targets);
|
||||||
|
// TODO(318748373): use 'targets' to populate title when no title is given
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -34,6 +34,7 @@ import com.android.settings.accessibility.TextReadingPreferenceFragmentForSetupW
|
|||||||
import com.android.settings.accessibility.ToggleColorInversionPreferenceFragment;
|
import com.android.settings.accessibility.ToggleColorInversionPreferenceFragment;
|
||||||
import com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment;
|
import com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment;
|
||||||
import com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment;
|
import com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment;
|
||||||
|
import com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragment;
|
||||||
import com.android.settings.accounts.AccountDashboardFragment;
|
import com.android.settings.accounts.AccountDashboardFragment;
|
||||||
import com.android.settings.accounts.AccountSyncSettings;
|
import com.android.settings.accounts.AccountSyncSettings;
|
||||||
import com.android.settings.accounts.ChooseAccountFragment;
|
import com.android.settings.accounts.ChooseAccountFragment;
|
||||||
@@ -250,6 +251,7 @@ public class SettingsGateway {
|
|||||||
AccessibilityDetailsSettingsFragment.class.getName(),
|
AccessibilityDetailsSettingsFragment.class.getName(),
|
||||||
AccessibilitySettings.class.getName(),
|
AccessibilitySettings.class.getName(),
|
||||||
AccessibilitySettingsForSetupWizard.class.getName(),
|
AccessibilitySettingsForSetupWizard.class.getName(),
|
||||||
|
EditShortcutsPreferenceFragment.class.getName(),
|
||||||
TextReadingPreferenceFragment.class.getName(),
|
TextReadingPreferenceFragment.class.getName(),
|
||||||
TextReadingPreferenceFragmentForSetupWizard.class.getName(),
|
TextReadingPreferenceFragmentForSetupWizard.class.getName(),
|
||||||
CaptioningPropertiesFragment.class.getName(),
|
CaptioningPropertiesFragment.class.getName(),
|
||||||
|
@@ -52,6 +52,9 @@ public class ClearAdbKeysPreferenceController extends DeveloperOptionsPreference
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
|
// If the build is insecure (any -user build, 'ro.adb.secure=0'), adbd does not
|
||||||
|
// requests/store authorizations. There is no need for a "revoke authorizations"
|
||||||
|
// button.
|
||||||
return AdbProperties.secure().orElse(false);
|
return AdbProperties.secure().orElse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -70,6 +70,7 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
private static final String KEYBOARD_A11Y_CATEGORY = "keyboard_a11y_category";
|
private static final String KEYBOARD_A11Y_CATEGORY = "keyboard_a11y_category";
|
||||||
private static final String SHOW_VIRTUAL_KEYBOARD_SWITCH = "show_virtual_keyboard_switch";
|
private static final String SHOW_VIRTUAL_KEYBOARD_SWITCH = "show_virtual_keyboard_switch";
|
||||||
private static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys";
|
private static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys";
|
||||||
|
private static final String ACCESSIBILITY_SLOW_KEYS = "accessibility_slow_keys";
|
||||||
private static final String ACCESSIBILITY_STICKY_KEYS = "accessibility_sticky_keys";
|
private static final String ACCESSIBILITY_STICKY_KEYS = "accessibility_sticky_keys";
|
||||||
private static final String KEYBOARD_SHORTCUTS_HELPER = "keyboard_shortcuts_helper";
|
private static final String KEYBOARD_SHORTCUTS_HELPER = "keyboard_shortcuts_helper";
|
||||||
private static final String MODIFIER_KEYS_SETTINGS = "modifier_keys_settings";
|
private static final String MODIFIER_KEYS_SETTINGS = "modifier_keys_settings";
|
||||||
@@ -78,6 +79,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
Secure.SHOW_IME_WITH_HARD_KEYBOARD);
|
Secure.SHOW_IME_WITH_HARD_KEYBOARD);
|
||||||
private static final Uri sAccessibilityBounceKeysUri = Secure.getUriFor(
|
private static final Uri sAccessibilityBounceKeysUri = Secure.getUriFor(
|
||||||
Secure.ACCESSIBILITY_BOUNCE_KEYS);
|
Secure.ACCESSIBILITY_BOUNCE_KEYS);
|
||||||
|
private static final Uri sAccessibilitySlowKeysUri = Secure.getUriFor(
|
||||||
|
Secure.ACCESSIBILITY_SLOW_KEYS);
|
||||||
private static final Uri sAccessibilityStickyKeysUri = Secure.getUriFor(
|
private static final Uri sAccessibilityStickyKeysUri = Secure.getUriFor(
|
||||||
Secure.ACCESSIBILITY_STICKY_KEYS);
|
Secure.ACCESSIBILITY_STICKY_KEYS);
|
||||||
|
|
||||||
@@ -97,6 +100,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
@Nullable
|
@Nullable
|
||||||
private TwoStatePreference mAccessibilityBounceKeys = null;
|
private TwoStatePreference mAccessibilityBounceKeys = null;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
private TwoStatePreference mAccessibilitySlowKeys = null;
|
||||||
|
@Nullable
|
||||||
private TwoStatePreference mAccessibilityStickyKeys = null;
|
private TwoStatePreference mAccessibilityStickyKeys = null;
|
||||||
|
|
||||||
|
|
||||||
@@ -127,6 +132,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
mKeyboardA11yCategory = Objects.requireNonNull(findPreference(KEYBOARD_A11Y_CATEGORY));
|
mKeyboardA11yCategory = Objects.requireNonNull(findPreference(KEYBOARD_A11Y_CATEGORY));
|
||||||
mAccessibilityBounceKeys = Objects.requireNonNull(
|
mAccessibilityBounceKeys = Objects.requireNonNull(
|
||||||
mKeyboardA11yCategory.findPreference(ACCESSIBILITY_BOUNCE_KEYS));
|
mKeyboardA11yCategory.findPreference(ACCESSIBILITY_BOUNCE_KEYS));
|
||||||
|
mAccessibilitySlowKeys = Objects.requireNonNull(
|
||||||
|
mKeyboardA11yCategory.findPreference(ACCESSIBILITY_SLOW_KEYS));
|
||||||
mAccessibilityStickyKeys = Objects.requireNonNull(
|
mAccessibilityStickyKeys = Objects.requireNonNull(
|
||||||
mKeyboardA11yCategory.findPreference(ACCESSIBILITY_STICKY_KEYS));
|
mKeyboardA11yCategory.findPreference(ACCESSIBILITY_STICKY_KEYS));
|
||||||
|
|
||||||
@@ -147,6 +154,9 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
if (!InputSettings.isAccessibilityBounceKeysFeatureEnabled()) {
|
if (!InputSettings.isAccessibilityBounceKeysFeatureEnabled()) {
|
||||||
mKeyboardA11yCategory.removePreference(mAccessibilityBounceKeys);
|
mKeyboardA11yCategory.removePreference(mAccessibilityBounceKeys);
|
||||||
}
|
}
|
||||||
|
if (!InputSettings.isAccessibilitySlowKeysFeatureFlagEnabled()) {
|
||||||
|
mKeyboardA11yCategory.removePreference(mAccessibilitySlowKeys);
|
||||||
|
}
|
||||||
if (!InputSettings.isAccessibilityStickyKeysFeatureEnabled()) {
|
if (!InputSettings.isAccessibilityStickyKeysFeatureEnabled()) {
|
||||||
mKeyboardA11yCategory.removePreference(mAccessibilityStickyKeys);
|
mKeyboardA11yCategory.removePreference(mAccessibilityStickyKeys);
|
||||||
}
|
}
|
||||||
@@ -196,6 +206,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
mShowVirtualKeyboardSwitchPreferenceChangeListener);
|
mShowVirtualKeyboardSwitchPreferenceChangeListener);
|
||||||
Objects.requireNonNull(mAccessibilityBounceKeys).setOnPreferenceChangeListener(
|
Objects.requireNonNull(mAccessibilityBounceKeys).setOnPreferenceChangeListener(
|
||||||
mAccessibilityBounceKeysSwitchPreferenceChangeListener);
|
mAccessibilityBounceKeysSwitchPreferenceChangeListener);
|
||||||
|
Objects.requireNonNull(mAccessibilitySlowKeys).setOnPreferenceChangeListener(
|
||||||
|
mAccessibilitySlowKeysSwitchPreferenceChangeListener);
|
||||||
Objects.requireNonNull(mAccessibilityStickyKeys).setOnPreferenceChangeListener(
|
Objects.requireNonNull(mAccessibilityStickyKeys).setOnPreferenceChangeListener(
|
||||||
mAccessibilityStickyKeysSwitchPreferenceChangeListener);
|
mAccessibilityStickyKeysSwitchPreferenceChangeListener);
|
||||||
registerSettingsObserver();
|
registerSettingsObserver();
|
||||||
@@ -208,6 +220,7 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
mIm.unregisterInputDeviceListener(this);
|
mIm.unregisterInputDeviceListener(this);
|
||||||
Objects.requireNonNull(mShowVirtualKeyboardSwitch).setOnPreferenceChangeListener(null);
|
Objects.requireNonNull(mShowVirtualKeyboardSwitch).setOnPreferenceChangeListener(null);
|
||||||
Objects.requireNonNull(mAccessibilityBounceKeys).setOnPreferenceChangeListener(null);
|
Objects.requireNonNull(mAccessibilityBounceKeys).setOnPreferenceChangeListener(null);
|
||||||
|
Objects.requireNonNull(mAccessibilitySlowKeys).setOnPreferenceChangeListener(null);
|
||||||
Objects.requireNonNull(mAccessibilityStickyKeys).setOnPreferenceChangeListener(null);
|
Objects.requireNonNull(mAccessibilityStickyKeys).setOnPreferenceChangeListener(null);
|
||||||
unregisterSettingsObserver();
|
unregisterSettingsObserver();
|
||||||
}
|
}
|
||||||
@@ -315,10 +328,12 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
updateShowVirtualKeyboardSwitch();
|
updateShowVirtualKeyboardSwitch();
|
||||||
|
|
||||||
if (InputSettings.isAccessibilityBounceKeysFeatureEnabled()
|
if (InputSettings.isAccessibilityBounceKeysFeatureEnabled()
|
||||||
|| InputSettings.isAccessibilityStickyKeysFeatureEnabled()) {
|
|| InputSettings.isAccessibilityStickyKeysFeatureEnabled()
|
||||||
|
|| InputSettings.isAccessibilitySlowKeysFeatureFlagEnabled()) {
|
||||||
Objects.requireNonNull(mKeyboardA11yCategory).setOrder(2);
|
Objects.requireNonNull(mKeyboardA11yCategory).setOrder(2);
|
||||||
preferenceScreen.addPreference(mKeyboardA11yCategory);
|
preferenceScreen.addPreference(mKeyboardA11yCategory);
|
||||||
updateAccessibilityBounceKeysSwitch();
|
updateAccessibilityBounceKeysSwitch();
|
||||||
|
updateAccessibilitySlowKeysSwitch();
|
||||||
updateAccessibilityStickyKeysSwitch();
|
updateAccessibilityStickyKeysSwitch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -356,6 +371,13 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
mContentObserver,
|
mContentObserver,
|
||||||
UserHandle.myUserId());
|
UserHandle.myUserId());
|
||||||
}
|
}
|
||||||
|
if (InputSettings.isAccessibilitySlowKeysFeatureFlagEnabled()) {
|
||||||
|
contentResolver.registerContentObserver(
|
||||||
|
sAccessibilitySlowKeysUri,
|
||||||
|
false,
|
||||||
|
mContentObserver,
|
||||||
|
UserHandle.myUserId());
|
||||||
|
}
|
||||||
if (InputSettings.isAccessibilityStickyKeysFeatureEnabled()) {
|
if (InputSettings.isAccessibilityStickyKeysFeatureEnabled()) {
|
||||||
contentResolver.registerContentObserver(
|
contentResolver.registerContentObserver(
|
||||||
sAccessibilityStickyKeysUri,
|
sAccessibilityStickyKeysUri,
|
||||||
@@ -365,6 +387,7 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
updateShowVirtualKeyboardSwitch();
|
updateShowVirtualKeyboardSwitch();
|
||||||
updateAccessibilityBounceKeysSwitch();
|
updateAccessibilityBounceKeysSwitch();
|
||||||
|
updateAccessibilitySlowKeysSwitch();
|
||||||
updateAccessibilityStickyKeysSwitch();
|
updateAccessibilityStickyKeysSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,6 +408,14 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
InputSettings.isAccessibilityBounceKeysEnabled(getContext()));
|
InputSettings.isAccessibilityBounceKeysEnabled(getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAccessibilitySlowKeysSwitch() {
|
||||||
|
if (!InputSettings.isAccessibilitySlowKeysFeatureFlagEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Objects.requireNonNull(mAccessibilitySlowKeys).setChecked(
|
||||||
|
InputSettings.isAccessibilitySlowKeysEnabled(getContext()));
|
||||||
|
}
|
||||||
|
|
||||||
private void updateAccessibilityStickyKeysSwitch() {
|
private void updateAccessibilityStickyKeysSwitch() {
|
||||||
if (!InputSettings.isAccessibilityStickyKeysFeatureEnabled()) {
|
if (!InputSettings.isAccessibilityStickyKeysFeatureEnabled()) {
|
||||||
return;
|
return;
|
||||||
@@ -413,6 +444,13 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private final OnPreferenceChangeListener
|
||||||
|
mAccessibilitySlowKeysSwitchPreferenceChangeListener = (preference, newValue) -> {
|
||||||
|
InputSettings.setAccessibilitySlowKeysThreshold(getContext(),
|
||||||
|
((Boolean) newValue) ? 500 : 0);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
private final OnPreferenceChangeListener
|
private final OnPreferenceChangeListener
|
||||||
mAccessibilityStickyKeysSwitchPreferenceChangeListener = (preference, newValue) -> {
|
mAccessibilityStickyKeysSwitchPreferenceChangeListener = (preference, newValue) -> {
|
||||||
InputSettings.setAccessibilityStickyKeysEnabled(getContext(), (Boolean) newValue);
|
InputSettings.setAccessibilityStickyKeysEnabled(getContext(), (Boolean) newValue);
|
||||||
@@ -426,6 +464,8 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
|
|||||||
updateShowVirtualKeyboardSwitch();
|
updateShowVirtualKeyboardSwitch();
|
||||||
} else if (sAccessibilityBounceKeysUri.equals(uri)) {
|
} else if (sAccessibilityBounceKeysUri.equals(uri)) {
|
||||||
updateAccessibilityBounceKeysSwitch();
|
updateAccessibilityBounceKeysSwitch();
|
||||||
|
} else if (sAccessibilitySlowKeysUri.equals(uri)) {
|
||||||
|
updateAccessibilitySlowKeysSwitch();
|
||||||
} else if (sAccessibilityStickyKeysUri.equals(uri)) {
|
} else if (sAccessibilityStickyKeysUri.equals(uri)) {
|
||||||
updateAccessibilityStickyKeysSwitch();
|
updateAccessibilityStickyKeysSwitch();
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,7 @@ import android.app.settings.SettingsEnums;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.icu.text.MessageFormat;
|
import android.icu.text.MessageFormat;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
@@ -30,6 +31,7 @@ import android.provider.Settings;
|
|||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
@@ -45,7 +47,11 @@ import com.android.settings.password.ChooseLockSettingsHelper;
|
|||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.widget.SettingsMainSwitchBar;
|
import com.android.settings.widget.SettingsMainSwitchBar;
|
||||||
import com.android.settingslib.search.SearchIndexable;
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
|
import com.android.settingslib.search.SearchIndexableRaw;
|
||||||
import com.android.settingslib.widget.FooterPreference;
|
import com.android.settingslib.widget.FooterPreference;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screen pinning settings.
|
* Screen pinning settings.
|
||||||
*/
|
*/
|
||||||
@@ -174,9 +180,8 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getCurrentSecurityTitle() {
|
private static int getCurrentSecurityTitle(LockPatternUtils lockPatternUtils) {
|
||||||
int quality = mLockPatternUtils.getKeyguardStoredPasswordQuality(
|
int quality = lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId());
|
||||||
UserHandle.myUserId());
|
|
||||||
switch (quality) {
|
switch (quality) {
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
|
||||||
@@ -187,7 +192,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
|
case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
|
||||||
return R.string.screen_pinning_unlock_password;
|
return R.string.screen_pinning_unlock_password;
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||||
if (mLockPatternUtils.isLockPatternEnabled(UserHandle.myUserId())) {
|
if (lockPatternUtils.isLockPatternEnabled(UserHandle.myUserId())) {
|
||||||
return R.string.screen_pinning_unlock_pattern;
|
return R.string.screen_pinning_unlock_pattern;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,7 +237,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
mUseScreenLock.setChecked(isScreenLockUsed());
|
mUseScreenLock.setChecked(isScreenLockUsed());
|
||||||
mUseScreenLock.setTitle(getCurrentSecurityTitle());
|
mUseScreenLock.setTitle(getCurrentSecurityTitle(mLockPatternUtils));
|
||||||
} else {
|
} else {
|
||||||
mFooterPreference.setSummary(getAppPinningContent());
|
mFooterPreference.setSummary(getAppPinningContent());
|
||||||
mUseScreenLock.setEnabled(false);
|
mUseScreenLock.setEnabled(false);
|
||||||
@@ -252,8 +257,30 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For search
|
* For search.
|
||||||
|
*
|
||||||
|
* This page only provides an index for the toggle preference of using screen lock for
|
||||||
|
* unpinning. The preference name will change with various lock configurations. Indexing data
|
||||||
|
* from XML isn't suitable since it uses a static title by default. So, we skip XML indexing
|
||||||
|
* by omitting the XML argument in the constructor and use a dynamic index method instead.
|
||||||
*/
|
*/
|
||||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider(R.xml.screen_pinning_settings);
|
new BaseSearchIndexProvider() {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public List<SearchIndexableRaw> getDynamicRawDataToIndex(@NonNull Context context,
|
||||||
|
boolean enabled) {
|
||||||
|
List<SearchIndexableRaw> dynamicRaws =
|
||||||
|
super.getDynamicRawDataToIndex(context, enabled);
|
||||||
|
final SearchIndexableRaw raw = new SearchIndexableRaw(context);
|
||||||
|
final Resources res = context.getResources();
|
||||||
|
final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
|
||||||
|
raw.key = KEY_USE_SCREEN_LOCK;
|
||||||
|
raw.title = res.getString(getCurrentSecurityTitle(lockPatternUtils));
|
||||||
|
raw.screenTitle = res.getString(R.string.screen_pinning_title);
|
||||||
|
dynamicRaws.add(raw);
|
||||||
|
return dynamicRaws;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.security;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.app.admin.DevicePolicyManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
|
||||||
|
import com.android.settingslib.search.SearchIndexableRaw;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
@Config(shadows = ShadowLockPatternUtils.class)
|
||||||
|
public class ScreenPinningSettingsTest {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mContext = ApplicationProvider.getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
ShadowLockPatternUtils.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDynamicRawDataToIndex_numericPassword_shouldIndexUnlockPinTitle() {
|
||||||
|
ShadowLockPatternUtils.setKeyguardStoredPasswordQuality(
|
||||||
|
DevicePolicyManager.PASSWORD_QUALITY_NUMERIC);
|
||||||
|
|
||||||
|
final List<SearchIndexableRaw> indexRaws =
|
||||||
|
ScreenPinningSettings.SEARCH_INDEX_DATA_PROVIDER.getDynamicRawDataToIndex(
|
||||||
|
mContext, /* enabled= */ true);
|
||||||
|
|
||||||
|
assertThat(indexRaws.size()).isEqualTo(1);
|
||||||
|
assertThat(indexRaws.get(0).title).isEqualTo(
|
||||||
|
mContext.getString(R.string.screen_pinning_unlock_pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDynamicRawDataToIndex_alphabeticPassword_shouldIndexUnlockPasswordTitle() {
|
||||||
|
ShadowLockPatternUtils.setKeyguardStoredPasswordQuality(
|
||||||
|
DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC);
|
||||||
|
|
||||||
|
final List<SearchIndexableRaw> indexRaws =
|
||||||
|
ScreenPinningSettings.SEARCH_INDEX_DATA_PROVIDER.getDynamicRawDataToIndex(
|
||||||
|
mContext, /* enabled= */ true);
|
||||||
|
|
||||||
|
assertThat(indexRaws.size()).isEqualTo(1);
|
||||||
|
assertThat(indexRaws.get(0).title).isEqualTo(
|
||||||
|
mContext.getString(R.string.screen_pinning_unlock_password));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDynamicRawDataToIndex_patternPassword_shouldIndexUnlockPatternTitle() {
|
||||||
|
ShadowLockPatternUtils.setKeyguardStoredPasswordQuality(
|
||||||
|
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
|
||||||
|
ShadowLockPatternUtils.setIsLockPatternEnabled(
|
||||||
|
UserHandle.myUserId(), /* isLockPatternEnabled= */ true);
|
||||||
|
|
||||||
|
final List<SearchIndexableRaw> indexRaws =
|
||||||
|
ScreenPinningSettings.SEARCH_INDEX_DATA_PROVIDER.getDynamicRawDataToIndex(
|
||||||
|
mContext, /* enabled= */ true);
|
||||||
|
|
||||||
|
assertThat(indexRaws.size()).isEqualTo(1);
|
||||||
|
assertThat(indexRaws.get(0).title).isEqualTo(
|
||||||
|
mContext.getString(R.string.screen_pinning_unlock_pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDynamicRawDataToIndex_nonePassword_shouldIndexUnlockNoneTitle() {
|
||||||
|
ShadowLockPatternUtils.setKeyguardStoredPasswordQuality(
|
||||||
|
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
|
||||||
|
|
||||||
|
final List<SearchIndexableRaw> indexRaws =
|
||||||
|
ScreenPinningSettings.SEARCH_INDEX_DATA_PROVIDER.getDynamicRawDataToIndex(
|
||||||
|
mContext, /* enabled= */ true);
|
||||||
|
|
||||||
|
assertThat(indexRaws.size()).isEqualTo(1);
|
||||||
|
assertThat(indexRaws.get(0).title).isEqualTo(
|
||||||
|
mContext.getString(R.string.screen_pinning_unlock_none));
|
||||||
|
}
|
||||||
|
}
|
@@ -50,6 +50,7 @@ public class ShadowLockPatternUtils {
|
|||||||
private static Map<Integer, Boolean> sUserToVisiblePatternEnabledMap = new HashMap<>();
|
private static Map<Integer, Boolean> sUserToVisiblePatternEnabledMap = new HashMap<>();
|
||||||
private static Map<Integer, Boolean> sUserToBiometricAllowedMap = new HashMap<>();
|
private static Map<Integer, Boolean> sUserToBiometricAllowedMap = new HashMap<>();
|
||||||
private static Map<Integer, Boolean> sUserToLockPatternEnabledMap = new HashMap<>();
|
private static Map<Integer, Boolean> sUserToLockPatternEnabledMap = new HashMap<>();
|
||||||
|
private static Map<Integer, Integer> sKeyguardStoredPasswordQualityMap = new HashMap<>();
|
||||||
|
|
||||||
private static boolean sIsUserOwnsFrpCredential;
|
private static boolean sIsUserOwnsFrpCredential;
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ public class ShadowLockPatternUtils {
|
|||||||
sUserToLockPatternEnabledMap.clear();
|
sUserToLockPatternEnabledMap.clear();
|
||||||
sDeviceEncryptionEnabled = false;
|
sDeviceEncryptionEnabled = false;
|
||||||
sIsUserOwnsFrpCredential = false;
|
sIsUserOwnsFrpCredential = false;
|
||||||
|
sKeyguardStoredPasswordQualityMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
@@ -97,7 +99,7 @@ public class ShadowLockPatternUtils {
|
|||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
protected int getKeyguardStoredPasswordQuality(int userHandle) {
|
protected int getKeyguardStoredPasswordQuality(int userHandle) {
|
||||||
return 1;
|
return sKeyguardStoredPasswordQualityMap.getOrDefault(userHandle, /* defaultValue= */ 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
@@ -171,7 +173,7 @@ public class ShadowLockPatternUtils {
|
|||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
public boolean isLockPatternEnabled(int userId) {
|
public boolean isLockPatternEnabled(int userId) {
|
||||||
return sUserToBiometricAllowedMap.getOrDefault(userId, false);
|
return sUserToLockPatternEnabledMap.getOrDefault(userId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setIsLockPatternEnabled(int userId, boolean isLockPatternEnabled) {
|
public static void setIsLockPatternEnabled(int userId, boolean isLockPatternEnabled) {
|
||||||
@@ -238,4 +240,8 @@ public class ShadowLockPatternUtils {
|
|||||||
public boolean isSeparateProfileChallengeEnabled(int userHandle) {
|
public boolean isSeparateProfileChallengeEnabled(int userHandle) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setKeyguardStoredPasswordQuality(int quality) {
|
||||||
|
sKeyguardStoredPasswordQualityMap.put(UserHandle.myUserId(), quality);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user