Add the enabled status into the condition for the service which is VolumeShortcutToggle type.

Root cause: Shouldn't show the tutorial related to accessibility button when the service which has the accessibility button flag and is VolumeShortcutToggle type is not turned on.

Next: Add the status of the corresponding service.

Bug: 148989018
Test: manual test
Change-Id: Icc1dc071387e34401ecf67ed9fbc7bd4f9f9d612
This commit is contained in:
Peter_Liang
2020-04-24 22:30:40 +08:00
committed by PETER LIANG
parent a26a7afe8e
commit 9e50eb1598

View File

@@ -52,11 +52,12 @@ public class LegacyAccessibilityServicePreferenceFragment extends
@Override
int getUserShortcutTypes() {
int shortcutTypes = super.getUserShortcutTypes();
final boolean isServiceOn =
getArguments().getBoolean(AccessibilitySettings.EXTRA_CHECKED);
final AccessibilityServiceInfo info = getAccessibilityServiceInfo();
final boolean hasRequestAccessibilityButtonFlag =
(info.flags & AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON) != 0;
if (hasRequestAccessibilityButtonFlag) {
if (hasRequestAccessibilityButtonFlag && isServiceOn) {
shortcutTypes |= UserShortcutType.SOFTWARE;
} else {
shortcutTypes &= (~UserShortcutType.SOFTWARE);