Merge "Fix an NPE in BatteryService" into rvc-qpr-dev am: 2b534bde0e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13856050

Change-Id: I5086c0425b71654ac2115ce8f504ee65a5715766
This commit is contained in:
TreeHugger Robot
2021-03-18 21:56:23 +00:00
committed by Automerger Merge Worker

View File

@@ -1508,6 +1508,8 @@ public final class BatteryService extends SystemService {
if (Objects.equals(newService, oldService)) return;
Slog.i(TAG, "health: new instance registered " + mInstanceName);
// #init() may be called with null callback. Skip null callbacks.
if (mCallback == null) return;
mCallback.onRegistration(oldService, newService, mInstanceName);
} catch (NoSuchElementException | RemoteException ex) {
Slog.e(TAG, "health: Cannot get instance '" + mInstanceName