Show QS shortcut option if the a11y feature provides a tile.
Bug: 314852953 Test: atest com.android.settings.accessibility Test: atest com.android.settings.accessibility.shortcuts Test: manual Flag: ACONFIG android.view.accessibility.a11y_qs_shortcut STAGING Change-Id: Id7a6b3adfd4c4f3cb2b9f7fe15269b57a3d00543
This commit is contained in:
@@ -21,8 +21,10 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.UserHandle;
|
||||
import android.util.ArrayMap;
|
||||
import android.view.accessibility.Flags;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.accessibility.common.ShortcutConstants;
|
||||
import com.android.internal.accessibility.util.ShortcutUtils;
|
||||
@@ -98,6 +100,11 @@ public final class PreferredShortcuts {
|
||||
@NonNull Context context, @NonNull Set<String> components) {
|
||||
final Map<Integer, Set<String>> shortcutTypeToTargets = new ArrayMap<>();
|
||||
for (int shortcutType : ShortcutConstants.USER_SHORTCUT_TYPES) {
|
||||
if (!Flags.a11yQsShortcut()
|
||||
&& shortcutType == ShortcutConstants.UserShortcutType.QUICK_SETTINGS) {
|
||||
// Skip saving quick setting as preferred shortcut option when flag is not enabled
|
||||
continue;
|
||||
}
|
||||
shortcutTypeToTargets.put(
|
||||
shortcutType,
|
||||
ShortcutUtils.getShortcutTargetsFromSettings(
|
||||
@@ -138,6 +145,11 @@ public final class PreferredShortcuts {
|
||||
return context.getSharedPreferences(ACCESSIBILITY_PERF, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||
static void clearPreferredShortcuts(Context context) {
|
||||
getSharedPreferences(context).edit().clear().apply();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default shortcut types for the given accessibility feature.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user