Add null check when restart batteryinfo loader

Even though we unregister contentObserver in onPause and register
in onResume, callback still be called while fragment is detached.

Anyhow add a null check in settings to stop crash

Fixes: 131905853
Test: RunSettingsRoboTests
Change-Id: I8c0c2c04c3b8d942e0c97cf71a7d3e735a24b467
This commit is contained in:
Lei Yu
2019-05-08 11:12:55 -07:00
parent 65a258e2a2
commit b47b99ed38
2 changed files with 15 additions and 0 deletions

View File

@@ -378,6 +378,9 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
@VisibleForTesting
void restartBatteryInfoLoader() {
if (getContext() == null) {
return;
}
getLoaderManager().restartLoader(BATTERY_INFO_LOADER, Bundle.EMPTY,
mBatteryInfoLoaderCallbacks);
if (mPowerFeatureProvider.isEstimateDebugEnabled()) {