Fix the accessibility shortcut funtionaility.

1) Set default value when the
   Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE is empty.
2) Fix the filter condition to check if the value is empty or not.

Root cause of the issue: the value of ACCESSIBILITY_SHORTCUT_TARGET_SERVICE is
"", an empty string, which make a11y shortcut no responisble.

Preview: https://screenshot.googleplex.com/YWMnRGsPTm4hz6X

Test: tested on ADT3
Bug: 244128422
Change-Id: Id6f9d6f2ca90b79ff35ee5b14579915f059deb13
This commit is contained in:
Kaiqiang Wang
2022-09-12 23:50:13 +02:00
parent dd028ec3fe
commit 72c52dfb48

View File

@@ -183,7 +183,7 @@ public class AccessibilityUtils {
final String currentShortcutServiceId = Settings.Secure.getStringForUser(
context.getContentResolver(), Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
userId);
if (currentShortcutServiceId != null) {
if (!TextUtils.isEmpty(currentShortcutServiceId)) {
return currentShortcutServiceId;
}
return context.getString(R.string.config_defaultAccessibilityService);