summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/location
diff options
context:
space:
mode:
authorDavid Christie <dnchrist@google.com>2013-09-23 15:16:57 -0700
committerDavid Christie <dnchrist@google.com>2013-09-23 15:52:24 -0700
commitb1e381be2175dc1855a3de456dacd549ab282b2b (patch)
tree4789aed73a5b6a0c32ca6a917e500866da2c5af9 /src/com/android/settings/location
parent1efb1b52d6901ca58104030e3b98512473bed7fb (diff)
downloadpackages_apps_Settings-b1e381be2175dc1855a3de456dacd549ab282b2b.zip
packages_apps_Settings-b1e381be2175dc1855a3de456dacd549ab282b2b.tar.gz
packages_apps_Settings-b1e381be2175dc1855a3de456dacd549ab282b2b.tar.bz2
Don't show background apps in Settings->Location (b/10806272)
Change-Id: I7ed0249bbc4509e4116dfc88181faccde60365e1
Diffstat (limited to 'src/com/android/settings/location')
-rw-r--r--src/com/android/settings/location/RecentLocationApps.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/settings/location/RecentLocationApps.java b/src/com/android/settings/location/RecentLocationApps.java
index dceafb7..3cd5406 100644
--- a/src/com/android/settings/location/RecentLocationApps.java
+++ b/src/com/android/settings/location/RecentLocationApps.java
@@ -16,6 +16,7 @@
package com.android.settings.location;
+import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -23,6 +24,7 @@ import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Process;
+import android.os.UserHandle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.util.Log;
@@ -168,9 +170,12 @@ public class RecentLocationApps {
long now = System.currentTimeMillis();
for (AppOpsManager.PackageOps ops : appOps) {
// Don't show the Android System in the list - it's not actionable for the user.
- if (ops.getUid() != Process.SYSTEM_UID
- || !ANDROID_SYSTEM_PACKAGE_NAME.equals(ops.getPackageName())) {
- BatterySipperWrapper wrapper = sipperMap.get(ops.getUid());
+ // Also don't show apps belonging to background users.
+ int uid = ops.getUid();
+ boolean isAndroidOs = (uid == Process.SYSTEM_UID)
+ && ANDROID_SYSTEM_PACKAGE_NAME.equals(ops.getPackageName());
+ if (!isAndroidOs && ActivityManager.getCurrentUser() == UserHandle.getUserId(uid)) {
+ BatterySipperWrapper wrapper = sipperMap.get(uid);
Preference pref = getPreferenceFromOps(now, ops, wrapper);
if (pref != null) {
prefs.add(pref);
@@ -267,7 +272,7 @@ public class RecentLocationApps {
" belongs to another inactive account, ignored.");
}
} catch (PackageManager.NameNotFoundException e) {
- Log.wtf(TAG, "Package not found: " + packageName);
+ Log.wtf(TAG, "Package not found: " + packageName, e);
}
}