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:
@@ -368,7 +368,7 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
final int collapseKey;
|
||||
final int category;
|
||||
final int userId = UserHandle.getUserId(uid);
|
||||
if (UserHandle.isApp(uid)) {
|
||||
if (UserHandle.isApp(uid) || Process.isSdkSandboxUid(uid)) {
|
||||
if (profiles.contains(new UserHandle(userId))) {
|
||||
if (userId != currentUserId) {
|
||||
// Add to a managed user item.
|
||||
@@ -376,8 +376,12 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
largest = accumulate(managedKey, knownItems, bucket,
|
||||
AppItem.CATEGORY_USER, items, largest);
|
||||
}
|
||||
// Add to app item.
|
||||
collapseKey = uid;
|
||||
// Map SDK sandbox back to its corresponding app
|
||||
if (Process.isSdkSandboxUid(uid)) {
|
||||
collapseKey = Process.getAppUidForSdkSandboxUid(uid);
|
||||
} else {
|
||||
collapseKey = uid;
|
||||
}
|
||||
category = AppItem.CATEGORY_APP;
|
||||
} else {
|
||||
// If it is a removed user add it to the removed users' key
|
||||
@@ -415,6 +419,7 @@ public class DataUsageList extends DataUsageBaseFragment
|
||||
if (item == null) {
|
||||
item = new AppItem(uid);
|
||||
item.total = -1;
|
||||
item.addUid(uid);
|
||||
items.add(item);
|
||||
knownItems.put(item.key, item);
|
||||
}
|
||||
|
Reference in New Issue
Block a user