Remove the 2 seconds wait time to sync app data usage list.

- in v2, completely remove the asyn task to force update the network
stats since the network stats apis is actually not used.
- in v1, remove the 2s delay and only update the list when the asyn task
is done.

Change-Id: I10e887022d07fe38504036cbf3f12362eec939b3
Fixes: 119562454
Test: manual
This commit is contained in:
Doris Ling
2018-11-29 13:18:21 -08:00
parent 662b209b15
commit d13b50b39e
2 changed files with 1 additions and 29 deletions

View File

@@ -193,17 +193,13 @@ public class DataUsageList extends DataUsageBaseFragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
mDataStateListener.setListener(true, mSubId, getContext()); mDataStateListener.setListener(true, mSubId, getContext());
updateBody();
// kick off background task to update stats // kick off background task to update stats
new AsyncTask<Void, Void, Void>() { new AsyncTask<Void, Void, Void>() {
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
try { try {
// wait a few seconds before kicking off
Thread.sleep(2 * DateUtils.SECOND_IN_MILLIS);
services.mStatsService.forceUpdate(); services.mStatsService.forceUpdate();
} catch (InterruptedException e) {
} catch (RemoteException e) { } catch (RemoteException e) {
} }
return null; return null;
@@ -211,10 +207,8 @@ public class DataUsageList extends DataUsageBaseFragment {
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
if (isAdded()) {
updateBody(); updateBody();
} }
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }

View File

@@ -187,28 +187,6 @@ public class DataUsageListV2 extends DataUsageBaseFragment {
super.onResume(); super.onResume();
mDataStateListener.setListener(true, mSubId, getContext()); mDataStateListener.setListener(true, mSubId, getContext());
updateBody(); updateBody();
// kick off background task to update stats
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
// wait a few seconds before kicking off
Thread.sleep(2 * DateUtils.SECOND_IN_MILLIS);
services.mStatsService.forceUpdate();
} catch (InterruptedException e) {
} catch (RemoteException e) {
}
return null;
}
@Override
protected void onPostExecute(Void result) {
if (isAdded()) {
updateBody();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
@Override @Override