Fix NPE when calling updateStateLw

In multi-display environment, the existance of status bar and navigation
bar may differ per disply. In other words, we may not have status bar or
navigation bar on a external displays. Add null check to prevent this
NPE happens.

Test: WmTests
Fixes: 120779126

Change-Id: I805a061733cdbe09c5c1941a0f44e2e49964671a
This commit is contained in:
Charles Chen
2018-12-11 20:30:28 +08:00
parent 919cad6ce4
commit 99b98845ed

View File

@@ -219,7 +219,7 @@ public class BarController {
}
private boolean updateStateLw(final int state) {
if (state != mState) {
if (mWin != null && state != mState) {
mState = state;
if (DEBUG) Slog.d(mTag, "mState: " + StatusBarManager.windowStateToString(state));
mHandler.post(new Runnable() {