Cleanup deprecated functions in AccessibilityUtil
Flag: EXEMPT code cleanup Bug: 367414968 Test: atest com.android.settings.accessibility Change-Id: If69a964720fc91ce0ad3661f956c4818f4f2f9dd
This commit is contained in:
@@ -60,7 +60,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/** Provides utility methods to accessibility settings only. */
|
||||
public final class AccessibilityUtil {
|
||||
@@ -195,114 +194,6 @@ public final class AccessibilityUtil {
|
||||
: AccessibilityServiceFragmentType.TOGGLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opts in component name into multiple {@code shortcutTypes} colon-separated string in
|
||||
* Settings.
|
||||
*
|
||||
* @param context The current context.
|
||||
* @param shortcutTypes A combination of {@link UserShortcutType}.
|
||||
* @param componentName The component name that need to be opted in Settings.
|
||||
*
|
||||
* @deprecated use
|
||||
* {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead.
|
||||
*
|
||||
* (TODO 367414968: finish removal.)
|
||||
*/
|
||||
@Deprecated
|
||||
static void optInAllValuesToSettings(Context context, int shortcutTypes,
|
||||
@NonNull ComponentName componentName) {
|
||||
AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class);
|
||||
if (a11yManager != null) {
|
||||
a11yManager.enableShortcutsForTargets(
|
||||
/* enable= */ true,
|
||||
shortcutTypes,
|
||||
Set.of(componentName.flattenToString()),
|
||||
UserHandle.myUserId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opts in component name into {@code shortcutType} colon-separated string in Settings.
|
||||
*
|
||||
* @param context The current context.
|
||||
* @param shortcutType The preferred shortcut type user selected.
|
||||
* @param componentName The component name that need to be opted in Settings.
|
||||
*
|
||||
* @deprecated use
|
||||
* {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead.
|
||||
*
|
||||
* (TODO 367414968: finish removal.)
|
||||
*/
|
||||
@Deprecated
|
||||
@VisibleForTesting
|
||||
static void optInValueToSettings(Context context, @UserShortcutType int shortcutType,
|
||||
@NonNull ComponentName componentName) {
|
||||
AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class);
|
||||
if (a11yManager != null) {
|
||||
a11yManager.enableShortcutsForTargets(
|
||||
/* enable= */ true,
|
||||
shortcutType,
|
||||
Set.of(componentName.flattenToString()),
|
||||
UserHandle.myUserId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opts out component name into multiple {@code shortcutTypes} colon-separated string in
|
||||
* Settings.
|
||||
*
|
||||
* @param context The current context.
|
||||
* @param shortcutTypes A combination of {@link UserShortcutType}.
|
||||
* @param componentName The component name that need to be opted out from Settings.
|
||||
*
|
||||
* @deprecated use
|
||||
* {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead.
|
||||
*
|
||||
* (TODO 367414968: finish removal.)
|
||||
*/
|
||||
@Deprecated
|
||||
static void optOutAllValuesFromSettings(Context context, int shortcutTypes,
|
||||
@NonNull ComponentName componentName) {
|
||||
AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class);
|
||||
if (a11yManager != null) {
|
||||
a11yManager.enableShortcutsForTargets(
|
||||
/* enable= */ false,
|
||||
shortcutTypes,
|
||||
Set.of(componentName.flattenToString()),
|
||||
UserHandle.myUserId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opts out component name into {@code shortcutType} colon-separated string in Settings.
|
||||
*
|
||||
* @param context The current context.
|
||||
* @param shortcutType The preferred shortcut type user selected.
|
||||
* @param componentName The component name that need to be opted out from Settings.
|
||||
*
|
||||
* @deprecated use
|
||||
* {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead.
|
||||
*
|
||||
* (TODO 367414968: finish removal.)
|
||||
*/
|
||||
@Deprecated
|
||||
@VisibleForTesting
|
||||
static void optOutValueFromSettings(Context context, @UserShortcutType int shortcutType,
|
||||
@NonNull ComponentName componentName) {
|
||||
AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class);
|
||||
if (a11yManager != null) {
|
||||
a11yManager.enableShortcutsForTargets(
|
||||
/* enable= */ false,
|
||||
shortcutType,
|
||||
Set.of(componentName.flattenToString()),
|
||||
UserHandle.myUserId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if component name existed in one of {@code shortcutTypes} string in Settings.
|
||||
*
|
||||
|
Reference in New Issue
Block a user