Always check Bluetooth permission when trying to get own address.

This commit is contained in:
akwizgran
2022-12-22 17:46:12 +00:00
parent c6e9554026
commit c3a9eff96b
2 changed files with 9 additions and 8 deletions

View File

@@ -65,6 +65,9 @@ public class AndroidUtils {
public static Pair<String, String> 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();