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:
@@ -193,17 +193,13 @@ public class DataUsageList extends DataUsageBaseFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mDataStateListener.setListener(true, mSubId, getContext());
|
||||
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;
|
||||
@@ -211,10 +207,8 @@ public class DataUsageList extends DataUsageBaseFragment {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (isAdded()) {
|
||||
updateBody();
|
||||
}
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
|
@@ -187,28 +187,6 @@ public class DataUsageListV2 extends DataUsageBaseFragment {
|
||||
super.onResume();
|
||||
mDataStateListener.setListener(true, mSubId, getContext());
|
||||
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
|
||||
|
Reference in New Issue
Block a user