summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/location/RecentLocationApps.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/location/RecentLocationApps.java')
-rw-r--r--src/com/android/settings/location/RecentLocationApps.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/com/android/settings/location/RecentLocationApps.java b/src/com/android/settings/location/RecentLocationApps.java
index 23e6dcf..1fa8aac 100644
--- a/src/com/android/settings/location/RecentLocationApps.java
+++ b/src/com/android/settings/location/RecentLocationApps.java
@@ -140,7 +140,7 @@ public class RecentLocationApps {
public List<Preference> getAppList() {
// Retrieve Uid-based battery blaming info and generate a package to BatterySipper HashMap
// for later faster looking up.
- mStatsHelper.refreshStats();
+ mStatsHelper.refreshStats(true);
List<BatterySipper> usageList = mStatsHelper.getUsageList();
// Key: package Uid. Value: BatterySipperWrapper.
HashMap<Integer, BatterySipperWrapper> sipperMap =
@@ -243,11 +243,22 @@ public class RecentLocationApps {
try {
ApplicationInfo appInfo = mPackageManager.getApplicationInfo(
packageName, PackageManager.GET_META_DATA);
- pref = createRecentLocationEntry(
- mPackageManager.getApplicationIcon(appInfo),
- mPackageManager.getApplicationLabel(appInfo),
- highBattery,
- new PackageEntryClickedListener(packageName));
+ // Multiple users can install the same package. Each user gets a different Uid for
+ // the same package.
+ //
+ // Here we retrieve the Uid with package name, that will be the Uid for that package
+ // associated with the current active user. If the Uid differs from the Uid in ops,
+ // that means this entry belongs to another inactive user and we should ignore that.
+ if (appInfo.uid == ops.getUid()) {
+ pref = createRecentLocationEntry(
+ mPackageManager.getApplicationIcon(appInfo),
+ mPackageManager.getApplicationLabel(appInfo),
+ highBattery,
+ new PackageEntryClickedListener(packageName));
+ } else if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "package " + packageName + " with Uid " + ops.getUid() +
+ " belongs to another inactive account, ignored.");
+ }
} catch (PackageManager.NameNotFoundException e) {
Log.wtf(TAG, "Package not found: " + packageName);
}