diff --git a/bramble-android/src/main/java/org/briarproject/bramble/util/AndroidUtils.java b/bramble-android/src/main/java/org/briarproject/bramble/util/AndroidUtils.java index a3a64fa9d..5783e150e 100644 --- a/bramble-android/src/main/java/org/briarproject/bramble/util/AndroidUtils.java +++ b/bramble-android/src/main/java/org/briarproject/bramble/util/AndroidUtils.java @@ -65,6 +65,9 @@ public class AndroidUtils { public static Pair getBluetoothAddressAndMethod(Context ctx, BluetoothAdapter adapter) { + // If we don't have permission to access the adapter's address, let + // the caller know we can't find it + if (!hasBtConnectPermission(ctx)) return new Pair<>("", ""); // Return the adapter's address if it's valid and not fake @SuppressLint("HardwareIds") String address = adapter.getAddress(); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/reporting/BriarReportCollector.java b/briar-android/src/main/java/org/briarproject/briar/android/reporting/BriarReportCollector.java index 89b128045..db3752d77 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/reporting/BriarReportCollector.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/reporting/BriarReportCollector.java @@ -310,14 +310,12 @@ class BriarReportCollector { btLeAdvertise); } - if (hasBtConnectPermission(ctx)) { - Pair p = getBluetoothAddressAndMethod(ctx, bt); - String address = p.getFirst(); - String method = p.getSecond(); - connectivityInfo.add("BluetoothAddress", - scrubMacAddress(address)); - connectivityInfo.add("BluetoothAddressMethod", method); - } + Pair p = getBluetoothAddressAndMethod(ctx, bt); + String address = p.getFirst(); + String method = p.getSecond(); + connectivityInfo.add("BluetoothAddress", + scrubMacAddress(address)); + connectivityInfo.add("BluetoothAddressMethod", method); } return new ReportItem("Connectivity", R.string.dev_report_connectivity, connectivityInfo);