mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Prevent SecurityException when accessing bluetooth_name on some devices
This commit is contained in:
parent
57d38398f2
commit
939c6c6c29
1 changed files with 10 additions and 4 deletions
|
|
@ -160,13 +160,19 @@ class AppUtils {
|
|||
context.contentResolver,
|
||||
Settings.Global.DEVICE_NAME
|
||||
)
|
||||
|
||||
if (name == null) {
|
||||
Log.w("$TAG Failed to obtain device name, trying to get bluetooth name")
|
||||
name = Settings.Secure.getString(
|
||||
context.contentResolver,
|
||||
"bluetooth_name"
|
||||
)
|
||||
try {
|
||||
name = Settings.Secure.getString(
|
||||
context.contentResolver,
|
||||
"bluetooth_name"
|
||||
)
|
||||
} catch (e: SecurityException) {
|
||||
Log.e("$TAG Failed to get bluetooth_name: $e")
|
||||
}
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
Log.w("$TAG Failed to obtain bluetooth name, using device's manufacturer & model")
|
||||
name = "${Build.MANUFACTURER} ${Build.MODEL}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue