Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f64b3cf authored by Bernardo Rufino's avatar Bernardo Rufino
Browse files

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
parent 628045a4
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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();
    }

+4 −3
Original line number Diff line number Diff line
@@ -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);
    }