Add SDK sandbox network usage to corresponding apps.

SDK sandboxes run in a separate UID range. Their network usage should be
attributed to the corresponding app.

Make sure we collapse the usage collection of sandboxes to the
corresponding app UID in DataUsageList.

For AppDataUsage, make sure we add in the sandbox UID when being asked
to calculate data usage for a regular app UID. Invoke
DataUsageCycleLoader with all UIDs in AppItem, because there can now be
multiple UIDs associated with a regular app, too. Also make sure that
all new instances of AppItem for regular applications have their own
application UID.

Bug: 225319220
Test: manual
Change-Id: Id101a96ee4e3ba02376fa2ac64a9f9c2581acb61
This commit is contained in:
Martijn Coenen
2022-04-26 09:04:57 +00:00
parent b18b106300
commit bc9856104d
4 changed files with 38 additions and 14 deletions

View File

@@ -306,6 +306,7 @@ public class AppDataUsageTest {
final Context context = RuntimeEnvironment.application;
final int testUid = 123123;
final AppItem appItem = new AppItem(testUid);
appItem.addUid(testUid);
appItem.category = AppItem.CATEGORY_APP;
ReflectionHelpers.setField(mFragment, "mContext", context);
ReflectionHelpers.setField(mFragment, "mAppItem", appItem);