Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/Utils.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/Utils.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/Utils.java |
index c1f90655bbc31164bf119db1e83e6b9883c63094..4680e1958e9a5b0f3877157d54e3e03207b1b2a1 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/Utils.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/Utils.java |
@@ -11,6 +11,8 @@ import android.content.pm.PackageManager; |
import android.net.ConnectivityManager; |
import android.support.v4.content.PermissionChecker; |
+import org.chromium.base.ContextUtils; |
+ |
/** |
* This class provides basic static utilities for the Physical Web. |
@@ -20,21 +22,22 @@ class Utils { |
public static final int RESULT_SUCCESS = 1; |
public static final int RESULT_INDETERMINATE = 2; |
- public static boolean isDataConnectionActive(Context context) { |
- ConnectivityManager cm = |
- (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); |
+ public static boolean isDataConnectionActive() { |
+ ConnectivityManager cm = (ConnectivityManager) ContextUtils.getApplicationContext() |
+ .getSystemService(Context.CONNECTIVITY_SERVICE); |
return (cm.getActiveNetworkInfo() != null |
&& cm.getActiveNetworkInfo().isConnectedOrConnecting()); |
} |
- public static boolean isBluetoothPermissionGranted(Context context) { |
- return PermissionChecker.checkSelfPermission(context, Manifest.permission.BLUETOOTH) |
+ public static boolean isBluetoothPermissionGranted() { |
+ return PermissionChecker.checkSelfPermission( |
+ ContextUtils.getApplicationContext(), Manifest.permission.BLUETOOTH) |
== PackageManager.PERMISSION_GRANTED; |
} |
- public static int getBluetoothEnabledStatus(Context context) { |
+ public static int getBluetoothEnabledStatus() { |
int statusResult = RESULT_INDETERMINATE; |
- if (isBluetoothPermissionGranted(context)) { |
+ if (isBluetoothPermissionGranted()) { |
BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter(); |
statusResult = (bt != null && bt.isEnabled()) ? RESULT_SUCCESS : RESULT_FAILURE; |
} |