Fix recents split-screen icon
The funny thing about weak references is, they are weak.
Test: manual
Change-Id: I93b32e0432e6527bb590990f7f62b8b05a7e94fb
Fixes: 63749049
diff --git a/packages/SystemUI/src/com/android/systemui/DockedStackExistsListener.java b/packages/SystemUI/src/com/android/systemui/DockedStackExistsListener.java
index 6296297..9fe730a 100644
--- a/packages/SystemUI/src/com/android/systemui/DockedStackExistsListener.java
+++ b/packages/SystemUI/src/com/android/systemui/DockedStackExistsListener.java
@@ -74,8 +74,11 @@
private static void onDockedStackExistsChanged(boolean exists) {
synchronized (sCallbacks) {
- sCallbacks.removeIf(wf -> wf.get() == null);
- sCallbacks.forEach(wf -> wf.get().accept(exists));
+ sCallbacks.removeIf(wf -> {
+ Consumer<Boolean> l = wf.get();
+ if (l != null) l.accept(exists);
+ return l == null;
+ });
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 12fa946..7451e82 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -59,6 +59,7 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.function.Consumer;
public class NavigationBarView extends FrameLayout implements PluginListener<NavGesture> {
final static boolean DEBUG = false;
@@ -564,10 +565,7 @@
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
- DockedStackExistsListener.register(exists -> mHandler.post(() -> {
- mDockedStackExists = exists;
- updateRecentsIcon();
- }));
+ DockedStackExistsListener.register(mDockedListener);
}
void updateRotatedViews() {
@@ -841,4 +839,8 @@
void onVerticalChanged(boolean isVertical);
}
+ private final Consumer<Boolean> mDockedListener = exists -> mHandler.post(() -> {
+ mDockedStackExists = exists;
+ updateRecentsIcon();
+ });
}