Dialer: Fix crash when missing BLUETOOTH_CONNECT permission
* getAlias() needs BLUETOOTH_CONNECT
* we are missing checks if we have that permission resulting in the
InCallScreen crashing with the phone call still going on - no
possibility to hang up
Change-Id: Ib9c7988c32bab95060b5f4a35bf9a3498610c3f8
diff --git a/java/com/android/incallui/util/BluetoothUtil.java b/java/com/android/incallui/util/BluetoothUtil.java
index 6e39215..82aec8f 100644
--- a/java/com/android/incallui/util/BluetoothUtil.java
+++ b/java/com/android/incallui/util/BluetoothUtil.java
@@ -4,12 +4,14 @@
*/
package com.android.incallui.util;
-import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
public class BluetoothUtil {
- @SuppressLint("MissingPermission")
public static String getAliasName(BluetoothDevice bluetoothDevice) {
- return bluetoothDevice == null ? "" : bluetoothDevice.getAlias();
+ try {
+ return bluetoothDevice == null ? "" : bluetoothDevice.getAlias();
+ } catch (SecurityException ignored) {
+ return "";
+ }
}
}