summaryrefslogtreecommitdiff
path: root/packages/SettingsLib/src/com/android/settingslib/Utils.java
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2019-09-18 13:07:51 -0700
committerDaniel Norman <danielnorman@google.com>2019-09-27 15:58:29 -0700
commit18970c4d9d55a44040fe6fb762dac93a077c64b5 (patch)
tree195aeff87242ff8aed950fb3ab2d45ccd3b582b9 /packages/SettingsLib/src/com/android/settingslib/Utils.java
parent18a31dbd995e49683f46db4e7bbe020e742dd09a (diff)
parentdbf9e87c7871fcfa682ff8be1d7901e6433f0955 (diff)
Merge RP1A.190822.001
Change-Id: I515dc97a1060fccf4c2fd8f678f8f90753aa1289
Diffstat (limited to 'packages/SettingsLib/src/com/android/settingslib/Utils.java')
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/Utils.java24
1 files changed, 8 insertions, 16 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java
index 31b3548b2dae..7b3eff6b1231 100644
--- a/packages/SettingsLib/src/com/android/settingslib/Utils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java
@@ -35,8 +35,6 @@ import java.text.NumberFormat;
public class Utils {
- private static final String CURRENT_MODE_KEY = "CURRENT_MODE";
- private static final String NEW_MODE_KEY = "NEW_MODE";
@VisibleForTesting
static final String STORAGE_MANAGER_ENABLED_PROPERTY =
"ro.storage_manager.enabled";
@@ -80,24 +78,11 @@ 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 = locationManager.isLocationEnabled()
- ? Settings.Secure.LOCATION_MODE_ON
- : Settings.Secure.LOCATION_MODE_OFF;
- final int newMode = enabled
- ? 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 = context.getSystemService(LocationManager.class);
locationManager.setLocationEnabledForUser(enabled, UserHandle.of(userId));
}
@@ -242,6 +227,13 @@ public class Utils {
return list.getDefaultColor();
}
+ /**
+ * This method computes disabled color from normal color
+ *
+ * @param context
+ * @param inputColor normal color.
+ * @return disabled color.
+ */
@ColorInt
public static int getDisabled(Context context, int inputColor) {
return applyAlphaAttr(context, android.R.attr.disabledAlpha, inputColor);