Merge "Bypassed some strict mode violations."
diff --git a/java/com/android/dialer/app/settings/DialerSettingsActivity.java b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
index 6286bfc..10ef9ed 100644
--- a/java/com/android/dialer/app/settings/DialerSettingsActivity.java
+++ b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
@@ -52,7 +52,7 @@
   @Override
   protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
-    mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+    mPreferences = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
   }
 
   @Override
diff --git a/java/com/android/incallui/calllocation/impl/GoogleLocationSettingHelper.java b/java/com/android/incallui/calllocation/impl/GoogleLocationSettingHelper.java
index 18a80b8..ed2e843 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.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 @@
   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 @@
   }
 
   /** 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 @@
   }
 
   /** 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;
   }
 }