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

Commit 6382b39f authored by Tony Wickham's avatar Tony Wickham
Browse files

Add null check to sendCustomAccessibilityEvent()

ag/10273975 caused a regression where launcher crashes if RecentsView is
empty.

Change-Id: I1607627be0a9748fd552adc757296d7b6bbfd1e2
parent 43657340
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -40,8 +40,16 @@ public class AccessibilityManagerCompat {
        return isAccessibilityEnabled(context);
    }

    public static void sendCustomAccessibilityEvent(View target, int type, @Nullable String text) {
        if (isObservedEventType(target.getContext(), type)) {
    /**
     *
     * @param target The view the accessibility event is initialized on.
     *               If null, this method has no effect.
     * @param type See TYPE_ constants defined in {@link AccessibilityEvent}.
     * @param text Optional text to add to the event, which will be announced to the user.
     */
    public static void sendCustomAccessibilityEvent(@Nullable View target, int type,
            @Nullable String text) {
        if (target != null && isObservedEventType(target.getContext(), type)) {
            AccessibilityEvent event = AccessibilityEvent.obtain(type);
            target.onInitializeAccessibilityEvent(event);
            if (!TextUtils.isEmpty(text)) {