Improve the latency of DataUsageList
Up to 30x faster. Currently it load the usage detail for every day at the beginning, so it's quite slow. To fix, - Not load the usage detail for every day at the beginning - Load only the cycles first - And only load the daily detail for the selected month Fix: 290856342 Test: manual - on DataUsageList (cell & wifi) Test: unit tests Change-Id: Ie18fa68f801743389bd6b6a28e236dcf1fea00e4
This commit is contained in:
@@ -31,6 +31,7 @@ import android.telephony.SubscriptionManager;
|
||||
import android.util.ArraySet;
|
||||
import android.util.IconDrawableFactory;
|
||||
import android.util.Log;
|
||||
import android.util.Range;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
@@ -472,7 +473,9 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
|
||||
List<NetworkCycleDataForUid> data) {
|
||||
mUsageData = data;
|
||||
mCycle.setOnItemSelectedListener(mCycleListener);
|
||||
mCycleAdapter.updateCycleList(data);
|
||||
mCycleAdapter.updateCycleList(data.stream()
|
||||
.map(cycle -> new Range<>(cycle.getStartTime(), cycle.getEndTime()))
|
||||
.toList());
|
||||
if (mSelectedCycle > 0L) {
|
||||
final int numCycles = data.size();
|
||||
int position = 0;
|
||||
|
Reference in New Issue
Block a user