From 4d3511b94f046e4623dead2aca7d879403892e97 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 24 Apr 2020 14:07:21 -0700 Subject: [PATCH] Force update sysui flags after binding to overview service - There is a rare chance where SysUI state can change prior to the overview service being connected in which the sysui state would not be passed to launcher, and when the service connects, the updating of the sysui state could trigger no changes (due to what it thinks is no changes in the flags). ie: sysui or launcher crashes > OPS registers callbacks but service is not yet connected so initial callback does nothing (only for sysui crash) > sysui notification state changes, updates sysui state, notifies OPS via callback, but still not yet connected > OPS service connects, triggers update of all relevant states, but notifications is already in that state, so sysui state skips callbacks to OPS Change-Id: I7635ed19bfc2767d380703a52b8fb623f8a43e21 Bug: 146964271 Test: Force delay OPS service connection, change sysui state and ensure launcher is still notified --- .../SystemUI/src/com/android/systemui/model/SysUiState.java | 5 +++++ .../com/android/systemui/recents/OverviewProxyService.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/model/SysUiState.java b/packages/SystemUI/src/com/android/systemui/model/SysUiState.java index a827f59ac7d19..f900f1e1db63c 100644 --- a/packages/SystemUI/src/com/android/systemui/model/SysUiState.java +++ b/packages/SystemUI/src/com/android/systemui/model/SysUiState.java @@ -60,6 +60,11 @@ public class SysUiState implements Dumpable { mCallbacks.remove(callback); } + /** Returns the current sysui state flags. */ + public int getFlags() { + return mFlags; + } + /** Methods to this call can be chained together before calling {@link #commitUpdate(int)}. */ public SysUiState setFlag(int flag, boolean enabled) { if (enabled) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 2c0ba605f2955..34a9e28b943a1 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -495,8 +495,9 @@ public class OverviewProxyService implements CallbackController