diff options
author | Lifu Tang <lifu@google.com> | 2013-08-28 15:55:49 -0700 |
---|---|---|
committer | Lifu Tang <lifu@google.com> | 2013-08-28 17:01:43 -0700 |
commit | 3d0bee59b875c7a47045408a46a599ae290659ef (patch) | |
tree | 6310f602856c1a9d6c6279ae98f8d72b9cd761d4 /src/com/android/settings/widget | |
parent | dcf2509e75059fcf3f34f82226597681107efb09 (diff) | |
download | packages_apps_Settings-3d0bee59b875c7a47045408a46a599ae290659ef.zip packages_apps_Settings-3d0bee59b875c7a47045408a46a599ae290659ef.tar.gz packages_apps_Settings-3d0bee59b875c7a47045408a46a599ae290659ef.tar.bz2 |
Fixed the widget location toggle button
- Fix b/10531669
Change-Id: Iba08d515119c42e5c4de4ee02d6dd8aea404fc69
Diffstat (limited to 'src/com/android/settings/widget')
-rw-r--r-- | src/com/android/settings/widget/SettingsAppWidgetProvider.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java index da085f7..bf3f497 100644 --- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java +++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java @@ -548,9 +548,23 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider { final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); if (!um.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION)) { - int mode = desiredState - ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY - : Settings.Secure.LOCATION_MODE_BATTERY_SAVING; + int currentMode = Settings.Secure.getInt(resolver, + Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); + int mode = Settings.Secure.LOCATION_MODE_HIGH_ACCURACY; + switch (currentMode) { + case Settings.Secure.LOCATION_MODE_HIGH_ACCURACY: + mode = Settings.Secure.LOCATION_MODE_BATTERY_SAVING; + break; + case Settings.Secure.LOCATION_MODE_BATTERY_SAVING: + mode = Settings.Secure.LOCATION_MODE_HIGH_ACCURACY; + break; + case Settings.Secure.LOCATION_MODE_SENSORS_ONLY: + mode = Settings.Secure.LOCATION_MODE_OFF; + break; + case Settings.Secure.LOCATION_MODE_OFF: + mode = Settings.Secure.LOCATION_MODE_HIGH_ACCURACY; + break; + } Settings.Secure.putInt(resolver, Settings.Secure.LOCATION_MODE, mode); return desiredState; } |