diff options
author | David Christie <dnchrist@google.com> | 2013-08-21 17:18:51 -0700 |
---|---|---|
committer | David Christie <dnchrist@google.com> | 2013-08-21 17:18:51 -0700 |
commit | 5eed792a76970e4271e03547e61dbbd6fabbf2f4 (patch) | |
tree | f6aa2a20ab2325c2bc0a9e5fb9617e804fd0071a /src/com | |
parent | e873aeb3a659ac970609cebb5ec2f460afd1206a (diff) | |
download | packages_apps_Settings-5eed792a76970e4271e03547e61dbbd6fabbf2f4.zip packages_apps_Settings-5eed792a76970e4271e03547e61dbbd6fabbf2f4.tar.gz packages_apps_Settings-5eed792a76970e4271e03547e61dbbd6fabbf2f4.tar.bz2 |
Update power widget to represent gps instead of location master.
Change-Id: I62f701b612db2e31f9ad8b016dbf37ed7fd4ef26
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/widget/SettingsAppWidgetProvider.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java index 50f6671..71994a9 100644 --- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java +++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java @@ -521,8 +521,14 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider { @Override public int getActualState(Context context) { ContentResolver resolver = context.getContentResolver(); - return Settings.Secure.getLocationMode(resolver) != Settings.Secure.LOCATION_MODE_OFF - ? STATE_ENABLED : STATE_DISABLED; + int currentLocationMode = Settings.Secure.getLocationMode(resolver); + switch (currentLocationMode) { + case Settings.Secure.LOCATION_MODE_BATTERY_SAVING: + case Settings.Secure.LOCATION_MODE_OFF: + return STATE_DISABLED; + } + + return STATE_ENABLED; } @Override @@ -543,13 +549,12 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider { if (!um.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION)) { int mode = desiredState ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY - : Settings.Secure.LOCATION_MODE_OFF; + : Settings.Secure.LOCATION_MODE_BATTERY_SAVING; Settings.Secure.setLocationMode(resolver, mode); return desiredState; } - return Settings.Secure.getLocationMode(resolver) - != Settings.Secure.LOCATION_MODE_OFF; + return getActualState(context) == STATE_ENABLED; } @Override |