Merge "Fix an NPE in BatteryService" into rvc-qpr-dev

This commit is contained in:
TreeHugger Robot
2021-03-18 20:10:12 +00:00
committed by Android (Google) Code Review

View File

@@ -1505,6 +1505,8 @@ public final class BatteryService extends SystemService {
if (Objects.equals(newService, oldService)) return; if (Objects.equals(newService, oldService)) return;
Slog.i(TAG, "health: new instance registered " + mInstanceName); 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); mCallback.onRegistration(oldService, newService, mInstanceName);
} catch (NoSuchElementException | RemoteException ex) { } catch (NoSuchElementException | RemoteException ex) {
Slog.e(TAG, "health: Cannot get instance '" + mInstanceName Slog.e(TAG, "health: Cannot get instance '" + mInstanceName