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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user