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
This commit is contained in:
Steve Elliott
2022-05-19 16:05:01 -04:00
parent 95d2e13cc1
commit 66e34105e3

View File

@@ -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);
}
}
/**