[Wi-Fi] Fix data usage screen flash 1~2 times problem
Data loaders should be destroyed at onPause or the APP list will be updated twice. Bug: 146841747 Test: make RunSettingsRoboTests ROBOTEST_FILTER=DataUsageListTest Change-Id: Ic1b8ef443dd8e50777f1e3a16977add654748c54
This commit is contained in:
@@ -90,8 +90,10 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
private static final String KEY_APP = "app";
|
||||
private static final String KEY_FIELDS = "fields";
|
||||
|
||||
private static final int LOADER_CHART_DATA = 2;
|
||||
private static final int LOADER_SUMMARY = 3;
|
||||
@VisibleForTesting
|
||||
static final int LOADER_CHART_DATA = 2;
|
||||
@VisibleForTesting
|
||||
static final int LOADER_SUMMARY = 3;
|
||||
|
||||
@VisibleForTesting
|
||||
MobileDataEnabledListener mDataStateListener;
|
||||
@@ -188,6 +190,13 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mDataStateListener.start(mSubId);
|
||||
|
||||
// kick off loader for network history
|
||||
// TODO: consider chaining two loaders together instead of reloading
|
||||
// network history when showing app detail.
|
||||
getLoaderManager().restartLoader(LOADER_CHART_DATA,
|
||||
buildArgs(mTemplate), mNetworkCycleDataCallbacks);
|
||||
|
||||
updateBody();
|
||||
}
|
||||
|
||||
@@ -195,6 +204,9 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mDataStateListener.stop();
|
||||
|
||||
getLoaderManager().destroyLoader(LOADER_CHART_DATA);
|
||||
getLoaderManager().destroyLoader(LOADER_SUMMARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -246,12 +258,6 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
|
||||
final Context context = getActivity();
|
||||
|
||||
// kick off loader for network history
|
||||
// TODO: consider chaining two loaders together instead of reloading
|
||||
// network history when showing app detail.
|
||||
getLoaderManager().restartLoader(LOADER_CHART_DATA,
|
||||
buildArgs(mTemplate), mNetworkCycleDataCallbacks);
|
||||
|
||||
// detail mode can change visible menus, invalidate
|
||||
getActivity().invalidateOptionsMenu();
|
||||
|
||||
|
Reference in New Issue
Block a user