Create AppDataUsageListController
For better organization and testings. Bug: 240931350 Test: manual - on AppDataUsage Test: unit test Change-Id: I77ceeccc7055fcd948fe40d5dfb9cc4a9b9ad2ee
This commit is contained in:
@@ -126,12 +126,7 @@ class AppDataUsageRepository(
|
||||
items = items,
|
||||
)
|
||||
}
|
||||
// Map SDK sandbox back to its corresponding app
|
||||
collapseKey = if (Process.isSdkSandboxUid(uid)) {
|
||||
Process.getAppUidForSdkSandboxUid(uid)
|
||||
} else {
|
||||
uid
|
||||
}
|
||||
collapseKey = getAppUid(uid)
|
||||
category = AppItem.CATEGORY_APP
|
||||
} else {
|
||||
// If it is a removed user add it to the removed users' key
|
||||
@@ -200,6 +195,15 @@ class AppDataUsageRepository(
|
||||
val bytes: Long,
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
fun getAppUid(uid: Int): Int {
|
||||
if (Process.isSdkSandboxUid(uid)) {
|
||||
// For a sandbox process, get the associated app UID
|
||||
return Process.getAppUidForSdkSandboxUid(uid)
|
||||
}
|
||||
return uid
|
||||
}
|
||||
|
||||
private fun convertToBuckets(stats: NetworkStats): List<Bucket> {
|
||||
val buckets = mutableListOf<Bucket>()
|
||||
stats.use {
|
||||
|
Reference in New Issue
Block a user