diff options
author | Soonil Nagarkar <sooniln@google.com> | 2019-01-24 18:07:07 -0800 |
---|---|---|
committer | Soonil Nagarkar <sooniln@google.com> | 2019-01-31 10:32:28 -0800 |
commit | 32bee192b4f1f18c2ba02f46d511acf946402bc7 (patch) | |
tree | a3376fbba016b02d4a257e5e1c93be024475e8b8 /packages/SettingsLib/src/com/android/settingslib/Utils.java | |
parent | d73433cf253652fd2e819618d463b4ba08a506b5 (diff) |
Remove dead code
Bug: 118883513
Test: manually
Change-Id: I0bbdfac91cbe26d08445178b5690c2e9171a39c8
Diffstat (limited to 'packages/SettingsLib/src/com/android/settingslib/Utils.java')
-rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/Utils.java | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java index c751c39aebbd..d32e85f01962 100644 --- a/packages/SettingsLib/src/com/android/settingslib/Utils.java +++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java @@ -56,37 +56,25 @@ public class Utils { public static void updateLocationEnabled(Context context, boolean enabled, int userId, int source) { + LocationManager locationManager = context.getSystemService(LocationManager.class); + Settings.Secure.putIntForUser( context.getContentResolver(), Settings.Secure.LOCATION_CHANGER, source, userId); - Intent intent = new Intent(LocationManager.MODE_CHANGING_ACTION); - final int oldMode = Settings.Secure.getIntForUser(context.getContentResolver(), - Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF, userId); + Intent intent = new Intent(LocationManager.MODE_CHANGING_ACTION); + final int oldMode = locationManager.isLocationEnabled() + ? Settings.Secure.LOCATION_MODE_ON + : Settings.Secure.LOCATION_MODE_OFF; final int newMode = enabled - ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY + ? Settings.Secure.LOCATION_MODE_ON : Settings.Secure.LOCATION_MODE_OFF; intent.putExtra(CURRENT_MODE_KEY, oldMode); intent.putExtra(NEW_MODE_KEY, newMode); context.sendBroadcastAsUser( intent, UserHandle.of(userId), android.Manifest.permission.WRITE_SECURE_SETTINGS); - LocationManager locationManager = - (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); - locationManager.setLocationEnabledForUser(enabled, UserHandle.of(userId)); - } - public static boolean updateLocationMode(Context context, int oldMode, int newMode, int userId, - int source) { - Settings.Secure.putIntForUser( - context.getContentResolver(), Settings.Secure.LOCATION_CHANGER, source, - userId); - Intent intent = new Intent(LocationManager.MODE_CHANGING_ACTION); - intent.putExtra(CURRENT_MODE_KEY, oldMode); - intent.putExtra(NEW_MODE_KEY, newMode); - context.sendBroadcastAsUser( - intent, UserHandle.of(userId), android.Manifest.permission.WRITE_SECURE_SETTINGS); - return Settings.Secure.putIntForUser( - context.getContentResolver(), Settings.Secure.LOCATION_MODE, newMode, userId); + locationManager.setLocationEnabledForUser(enabled, UserHandle.of(userId)); } /** |