Use correct uid when querying usage data for specific user.

- the data usage list shows usage data for each app, and also the
aggregated data for work apps and other user. When user clicks on the
app item, we will shows the detail usage data for that item using the
app item key. However, if the app item is not for app but for user, the
key will not be the app uid, but a key built from the user id. So,
querying using the key will not get any data.
- for app item corresponding for user, need to sum up all usage data
for the uids associated with the user.

Change-Id: I1a185ee6b4d59e477f3a03cade97d85d6982e416
Fixes: 122200400
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2019-01-30 11:22:45 -08:00
parent 1cf1d9b643
commit 97866f0b50
3 changed files with 81 additions and 19 deletions

View File

@@ -89,7 +89,7 @@ public class AppDataUsagePreferenceController extends AppInfoPreferenceControlle
public Loader<List<NetworkCycleDataForUid>> onCreateLoader(int id, Bundle args) {
final NetworkTemplate template = getTemplate(mContext);
return NetworkCycleDataForUidLoader.builder(mContext)
.setUid(mParent.getAppEntry().info.uid)
.addUid(mParent.getAppEntry().info.uid)
.setRetrieveDetail(false)
.setNetworkTemplate(template)
.setSubscriberId(template.getSubscriberId())