Merge branch 'catch-security-exception-for-bluetooth-address-setting' into 'master'

Catch SecurityException for bluetooth_address setting

See merge request briar/briar!1811
This commit is contained in:
Torsten Grote
2023-09-12 16:24:05 +00:00

View File

@@ -64,11 +64,16 @@ public class AndroidUtils {
}
// Return the address from settings if it's valid and not fake
if (SDK_INT < 33) {
try {
address = Settings.Secure.getString(ctx.getContentResolver(),
"bluetooth_address");
if (isValidBluetoothAddress(address)) {
return new Pair<>(address, "settings");
}
} catch (SecurityException e) {
// Some custom ROMs throw this exception on SDK_INT < 33.
// Fall through
}
}
// Try to get the address via reflection
address = getBluetoothAddressByReflection(adapter);