mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +01:00
Merge branch '2407-bluetooth-permission' into 'master'
Always check Bluetooth permission when trying to get own address Closes #2407 See merge request briar/briar!1753
This commit is contained in:
@@ -65,6 +65,9 @@ public class AndroidUtils {
|
|||||||
|
|
||||||
public static Pair<String, String> getBluetoothAddressAndMethod(Context ctx,
|
public static Pair<String, String> getBluetoothAddressAndMethod(Context ctx,
|
||||||
BluetoothAdapter adapter) {
|
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
|
// Return the adapter's address if it's valid and not fake
|
||||||
@SuppressLint("HardwareIds")
|
@SuppressLint("HardwareIds")
|
||||||
String address = adapter.getAddress();
|
String address = adapter.getAddress();
|
||||||
|
|||||||
@@ -310,14 +310,12 @@ class BriarReportCollector {
|
|||||||
btLeAdvertise);
|
btLeAdvertise);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBtConnectPermission(ctx)) {
|
Pair<String, String> p = getBluetoothAddressAndMethod(ctx, bt);
|
||||||
Pair<String, String> p = getBluetoothAddressAndMethod(ctx, bt);
|
String address = p.getFirst();
|
||||||
String address = p.getFirst();
|
String method = p.getSecond();
|
||||||
String method = p.getSecond();
|
connectivityInfo.add("BluetoothAddress",
|
||||||
connectivityInfo.add("BluetoothAddress",
|
scrubMacAddress(address));
|
||||||
scrubMacAddress(address));
|
connectivityInfo.add("BluetoothAddressMethod", method);
|
||||||
connectivityInfo.add("BluetoothAddressMethod", method);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new ReportItem("Connectivity", R.string.dev_report_connectivity,
|
return new ReportItem("Connectivity", R.string.dev_report_connectivity,
|
||||||
connectivityInfo);
|
connectivityInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user