diff options
| author | 2020-02-14 13:45:20 +0000 | |
|---|---|---|
| committer | 2020-02-14 13:45:20 +0000 | |
| commit | 0f64b3cf0a2a8d5cebd89d9ce49a51f93fa49df4 (patch) | |
| tree | daa8f69697831b69f764ac1a0dc4a8298d71f2d3 | |
| parent | 628045a49d30252e9fe9faef4656423e5dcf934c (diff) | |
Remove FLAG_SHOW_FOR_ALL_USERS to avoid crash in a11y
Text toasts now return null for getWindowParams() because they are
rendered by sys UI. Removing the flag for now to avoid crash. Working on
a long-term solution for this in the first bug linked.
Bug: 149408635
Bug: 149401510
Test: 1. Settings > Accessibility > Volume key shortcut > Use Volume key
shortcut
2. Press vol up and down together and observe no crash
Change-Id: Ie924666e457982986eb282d4cba7ba0beda6faca
2 files changed, 4 insertions, 5 deletions
diff --git a/core/java/com/android/internal/accessibility/AccessibilityShortcutController.java b/core/java/com/android/internal/accessibility/AccessibilityShortcutController.java index 93659a4ac1eb..eafa1e42af8b 100644 --- a/core/java/com/android/internal/accessibility/AccessibilityShortcutController.java +++ b/core/java/com/android/internal/accessibility/AccessibilityShortcutController.java @@ -245,8 +245,6 @@ public class AccessibilityShortcutController { String toastMessage = String.format(toastMessageFormatString, serviceName); Toast warningToast = mFrameworkObjectProvider.makeToastFromText( mContext, toastMessage, Toast.LENGTH_LONG); - warningToast.getWindowParams().privateFlags |= - WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; warningToast.show(); } diff --git a/core/tests/coretests/src/com/android/internal/accessibility/AccessibilityShortcutControllerTest.java b/core/tests/coretests/src/com/android/internal/accessibility/AccessibilityShortcutControllerTest.java index 6784ede5b5da..bbf3b12d9b7d 100644 --- a/core/tests/coretests/src/com/android/internal/accessibility/AccessibilityShortcutControllerTest.java +++ b/core/tests/coretests/src/com/android/internal/accessibility/AccessibilityShortcutControllerTest.java @@ -362,9 +362,10 @@ public class AccessibilityShortcutControllerTest { accessibilityShortcutController.performAccessibilityShortcut(); accessibilityShortcutController.performAccessibilityShortcut(); verify(mToast).show(); - assertEquals(WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS, - mLayoutParams.privateFlags - & WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS); + // TODO(b/149408635): Reintroduce assertion + // assertEquals(WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS, + // mLayoutParams.privateFlags + // & WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS); verify(mAccessibilityManagerService, times(1)).performAccessibilityShortcut(null); } |