Tutorial improvement for Accessibility shortcut (1/n).
Because can't save the value into setting keys for the service before version R, and in order to let tutorial dialog can get the consistent value, using alternative that each fragment with shortcut to must implement the new abstract method. Bug: 148989018 Test: manual test Change-Id: Iba2a7daa70eb00f0bba37317c9355531fbb77628
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.accessibility;
|
||||
|
||||
import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
||||
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
@@ -48,6 +49,22 @@ public class LegacyAccessibilityServicePreferenceFragment extends
|
||||
setAllowedPreferredShortcutType(UserShortcutType.HARDWARE);
|
||||
}
|
||||
|
||||
@Override
|
||||
int getUserShortcutTypes() {
|
||||
int shortcutTypes = super.getUserShortcutTypes();
|
||||
|
||||
final AccessibilityServiceInfo info = getAccessibilityServiceInfo();
|
||||
final boolean hasRequestAccessibilityButtonFlag =
|
||||
(info.flags & AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON) != 0;
|
||||
if (hasRequestAccessibilityButtonFlag) {
|
||||
shortcutTypes |= UserShortcutType.SOFTWARE;
|
||||
} else {
|
||||
shortcutTypes &= (~UserShortcutType.SOFTWARE);
|
||||
}
|
||||
|
||||
return shortcutTypes;
|
||||
}
|
||||
|
||||
private void setAllowedPreferredShortcutType(int type) {
|
||||
final AccessibilityUserShortcutType shortcut = new AccessibilityUserShortcutType(
|
||||
mComponentName.flattenToString(), type);
|
||||
|
Reference in New Issue
Block a user