diff options
| author | 2013-09-06 18:09:20 +0000 | |
|---|---|---|
| committer | 2013-09-06 18:09:20 +0000 | |
| commit | ba957652bf7aa32cf09de6a5a05a3acfc8912824 (patch) | |
| tree | 598991523d180ecdf81fb09846fd4bdd69782e44 | |
| parent | 9b40bdf64420bf1585ccadd36d0a7d38f3c77865 (diff) | |
| parent | a2b73480c0958ba5605ea3fe097af0f032a2257e (diff) | |
Merge "Fix QuickSettings to honor location setting for restricted users (b/10553306). Generally when a user is location restricted, location will be off. But just in case location is on and locked in that state, we should respect that in the UI." into klp-dev
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java index 5f6063db6882..312bba37725d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java @@ -129,6 +129,8 @@ public class LocationController extends BroadcastReceiver { // setting won't be fully enabled until the user accepts the agreement. int mode = enabled ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY : Settings.Secure.LOCATION_MODE_OFF; + // QuickSettings always runs as the owner, so specifically set the settings + // for the current foreground user. return Settings.Secure .putIntForUser(cr, Settings.Secure.LOCATION_MODE, mode, currentUserId); } @@ -137,14 +139,11 @@ public class LocationController extends BroadcastReceiver { * Returns true if location isn't disabled in settings. */ public boolean isLocationEnabled() { - int currentUserId = ActivityManager.getCurrentUser(); - if (isUserLocationRestricted(currentUserId)) { - return false; - } - ContentResolver resolver = mContext.getContentResolver(); + // QuickSettings always runs as the owner, so specifically retrieve the settings + // for the current foreground user. int mode = Settings.Secure.getIntForUser(resolver, Settings.Secure.LOCATION_MODE, - Settings.Secure.LOCATION_MODE_OFF, currentUserId); + Settings.Secure.LOCATION_MODE_OFF, ActivityManager.getCurrentUser()); return mode != Settings.Secure.LOCATION_MODE_OFF; } |