From 66e34105e3ac82ef91a23ae28e44d3b4ec95b950 Mon Sep 17 00:00:00 2001 From: Steve Elliott Date: Thu, 19 May 2022 16:05:01 -0400 Subject: [PATCH] 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 --- .../systemui/statusbar/RemoteInputController.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java b/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java index 31ab6bdf02401..f44f59805889f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java @@ -114,14 +114,17 @@ 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)); } - - apply(entry); + // 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); + } } /**