Add null check for wireless charging animation.
StatusBarManagerService is not started in SystemServer on
wearable devices.
Bug: 78357692
Change-Id: I0e30a4996addb599b8c90aa86b5ccb5ee7d80490
diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java
index 61e82cd..20283a7 100644
--- a/services/core/java/com/android/server/power/Notifier.java
+++ b/services/core/java/com/android/server/power/Notifier.java
@@ -16,6 +16,7 @@
package com.android.server.power;
+import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManagerInternal;
import android.app.AppOpsManager;
@@ -97,7 +98,7 @@
private final ActivityManagerInternal mActivityManagerInternal;
private final InputManagerInternal mInputManagerInternal;
private final InputMethodManagerInternal mInputMethodManagerInternal;
- private final StatusBarManagerInternal mStatusBarManagerInternal;
+ @Nullable private final StatusBarManagerInternal mStatusBarManagerInternal;
private final TrustManager mTrustManager;
private final NotifierHandler mHandler;
@@ -738,7 +739,9 @@
private void showWirelessChargingStarted(int batteryLevel) {
playChargingStartedSound();
- mStatusBarManagerInternal.showChargingAnimation(batteryLevel);
+ if (mStatusBarManagerInternal != null) {
+ mStatusBarManagerInternal.showChargingAnimation(batteryLevel);
+ }
mSuspendBlocker.release();
}