Fix NPE in UiCallManager which will happen if Bluetooth is not
supported.

Test: build and load the app.
Bug: 109894902

Change-Id: I67ab9ef3bb8d9f67183c6d01e2448bec1d06e8a2
diff --git a/src/com/android/car/dialer/telecom/UiCallManager.java b/src/com/android/car/dialer/telecom/UiCallManager.java
index 0e9c2a1..be42487 100644
--- a/src/com/android/car/dialer/telecom/UiCallManager.java
+++ b/src/com/android/car/dialer/telecom/UiCallManager.java
@@ -134,18 +134,20 @@
         context.bindService(intent, mInCallServiceConnection, Context.BIND_AUTO_CREATE);
 
         BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
-        adapter.getProfileProxy(mContext, new BluetoothProfile.ServiceListener() {
-            @Override
-            public void onServiceConnected(int profile, BluetoothProfile proxy) {
-                if (profile == BluetoothProfile.HEADSET_CLIENT) {
-                    mBluetoothHeadsetClient = (BluetoothHeadsetClient) proxy;
+        if (adapter != null) {
+            adapter.getProfileProxy(mContext, new BluetoothProfile.ServiceListener() {
+                @Override
+                public void onServiceConnected(int profile, BluetoothProfile proxy) {
+                    if (profile == BluetoothProfile.HEADSET_CLIENT) {
+                        mBluetoothHeadsetClient = (BluetoothHeadsetClient) proxy;
+                    }
                 }
-            }
 
-            @Override
-            public void onServiceDisconnected(int profile) {
-            }
-        }, BluetoothProfile.HEADSET_CLIENT);
+                @Override
+                public void onServiceDisconnected(int profile) {
+                }
+            }, BluetoothProfile.HEADSET_CLIENT);
+        }
     }
 
     private final ServiceConnection mInCallServiceConnection = new ServiceConnection() {