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

Commit 66e34105 authored by Steve Elliott's avatar Steve Elliott
Browse files

Break infinite recursion in RemoteInputView

Test: manual
  1. Receive a HUN
  2. Activate remote input from the HUN
  3. Receive an update to the HUN while remote input is still focused
  Observe: no crash
Fixes: 231875547
Change-Id: I3e844e337b9ef33bb9885cb6b2a2dfc865cf560d
parent 95d2e13c
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -114,15 +114,18 @@ public class RemoteInputController {
    public void addRemoteInput(NotificationEntry entry, Object token) {
        Objects.requireNonNull(entry);
        Objects.requireNonNull(token);

        boolean isActive = isRemoteInputActive(entry);
        boolean found = pruneWeakThenRemoveAndContains(
                entry /* contains */, null /* remove */, token /* removeToken */);
        if (!found) {
            mOpen.add(new Pair<>(new WeakReference<>(entry), token));
        }

        // If the remote input focus is being transferred between different notification layouts
        // (ex: Expanded->Contracted), then we don't want to re-apply.
        if (!isActive) {
            apply(entry);
        }
    }

    /**
     * Removes a currently active remote input.