Restart loader in onResume
We need to refresh batterystatsHelper in onResume, so we need to call restartLoader instead of initLoader Bug: 62237848 Test: RunSettingsRoboTests Change-Id: I6f7e1b57b945c92d34587ca24db192600e7f797f
This commit is contained in:
@@ -139,7 +139,8 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
|
||||
private static final int LOADER_CHART_DATA = 2;
|
||||
private static final int LOADER_STORAGE = 3;
|
||||
private static final int LOADER_BATTERY = 4;
|
||||
@VisibleForTesting
|
||||
static final int LOADER_BATTERY = 4;
|
||||
|
||||
private static final int DLG_FORCE_STOP = DLG_BASE + 1;
|
||||
private static final int DLG_DISABLE = DLG_BASE + 2;
|
||||
@@ -202,7 +203,8 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
private AppStorageStats mLastResult;
|
||||
private String mBatteryPercent;
|
||||
|
||||
private final LoaderCallbacks<BatteryStatsHelper> mBatteryCallbacks =
|
||||
@VisibleForTesting
|
||||
final LoaderCallbacks<BatteryStatsHelper> mBatteryCallbacks =
|
||||
new LoaderCallbacks<BatteryStatsHelper>() {
|
||||
|
||||
@Override
|
||||
@@ -410,11 +412,16 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
mDataCallbacks);
|
||||
loaderManager.restartLoader(LOADER_STORAGE, Bundle.EMPTY, this);
|
||||
}
|
||||
getLoaderManager().initLoader(LOADER_BATTERY, Bundle.EMPTY, mBatteryCallbacks);
|
||||
restartBatteryStatsLoader();
|
||||
new MemoryUpdater().execute();
|
||||
updateDynamicPrefs();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void restartBatteryStatsLoader() {
|
||||
getLoaderManager().restartLoader(LOADER_BATTERY, Bundle.EMPTY, mBatteryCallbacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
getLoaderManager().destroyLoader(LOADER_CHART_DATA);
|
||||
|
Reference in New Issue
Block a user