diff options
author | zachh <zachh@google.com> | 2017-09-26 12:18:18 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-09-27 08:26:30 -0700 |
commit | f838726676381241f578f7d21d660d28410469e7 (patch) | |
tree | 4b60fb193130268b2914faa8bff18e0e9f22a160 /java/com/android/incallui/calllocation | |
parent | 418dc0004c59b3380e2dc6408fb87800c4460479 (diff) | |
download | android_packages_apps_Dialer-f838726676381241f578f7d21d660d28410469e7.tar.gz android_packages_apps_Dialer-f838726676381241f578f7d21d660d28410469e7.tar.bz2 android_packages_apps_Dialer-f838726676381241f578f7d21d660d28410469e7.zip |
Bypassed some strict mode violations.
These are old code and considered to be grandfathered in.
Cleaned up some warnings in GoogleLocationSettingHelper.
Bug: 66498656
Test: none
PiperOrigin-RevId: 170090310
Change-Id: I2c43564af751eb5f431a395d75afa5ce126b5d18
Diffstat (limited to 'java/com/android/incallui/calllocation')
-rw-r--r-- | java/com/android/incallui/calllocation/impl/GoogleLocationSettingHelper.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/java/com/android/incallui/calllocation/impl/GoogleLocationSettingHelper.java b/java/com/android/incallui/calllocation/impl/GoogleLocationSettingHelper.java index 18a80b8ce..ed2e84368 100644 --- a/java/com/android/incallui/calllocation/impl/GoogleLocationSettingHelper.java +++ b/java/com/android/incallui/calllocation/impl/GoogleLocationSettingHelper.java @@ -26,6 +26,7 @@ import android.net.Uri; import android.provider.Settings.Secure; import android.provider.Settings.SettingNotFoundException; import com.android.dialer.common.LogUtil; +import com.android.dialer.strictmode.DialerStrictMode; /** * Helper class to check if Google Location Services is enabled. This class is based on @@ -48,7 +49,7 @@ public class GoogleLocationSettingHelper { private static final String USE_LOCATION_FOR_SERVICES = "use_location_for_services"; /** Determine if Google apps need to conform to the USE_LOCATION_FOR_SERVICES setting. */ - public static boolean isEnforceable(Context context) { + private static boolean isEnforceable(Context context) { final ResolveInfo ri = context .getPackageManager() @@ -102,7 +103,7 @@ public class GoogleLocationSettingHelper { } /** Whether or not the system location setting is enable */ - public static boolean isSystemLocationSettingEnabled(Context context) { + static boolean isSystemLocationSettingEnabled(Context context) { try { return Secure.getInt(context.getContentResolver(), Secure.LOCATION_MODE) != Secure.LOCATION_MODE_OFF; @@ -116,8 +117,11 @@ public class GoogleLocationSettingHelper { } /** Convenience method that returns true is GLS is ON or if it's not enforceable. */ - public static boolean isGoogleLocationServicesEnabled(Context context) { - return !isEnforceable(context) - || getUseLocationForServices(context) == USE_LOCATION_FOR_SERVICES_ON; + static boolean isGoogleLocationServicesEnabled(Context context) { + if (!isEnforceable(context)) { + return true; + } + int locationServiceStatus = DialerStrictMode.bypass(() -> getUseLocationForServices(context)); + return locationServiceStatus == USE_LOCATION_FOR_SERVICES_ON; } } |