Add a missing null check inside A2dpService.resetAvrcpBlacklist()
Add a missing null pointer check inside method
A2dpService.resetAvrcpBlacklist()
Also:
- Removed BondStateMachine.setProfilePriority() because it is
not used.
- Fix a typo "priorty" -> "priority"
- Fix a log message.
Bug: 27837879
Change-Id: Ieabf00d2ff1e49aa06598674f14e97eb9086d432
diff --git a/jni/com_android_bluetooth_sdp.cpp b/jni/com_android_bluetooth_sdp.cpp
index dde5e54..889ab7b 100644
--- a/jni/com_android_bluetooth_sdp.cpp
+++ b/jni/com_android_bluetooth_sdp.cpp
@@ -547,7 +547,7 @@
}
if (sCallbacksObj != NULL) {
- ALOGW("Cleaning up Bluetooth Health object");
+ ALOGW("Cleaning up Bluetooth SDP object");
env->DeleteGlobalRef(sCallbacksObj);
sCallbacksObj = NULL;
}
diff --git a/src/com/android/bluetooth/a2dp/A2dpService.java b/src/com/android/bluetooth/a2dp/A2dpService.java
index a278927..41c31d1 100755
--- a/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -214,7 +214,9 @@
}
public void resetAvrcpBlacklist(BluetoothDevice device) {
- mAvrcp.resetBlackList(device.getAddress());
+ if (mAvrcp != null) {
+ mAvrcp.resetBlackList(device.getAddress());
+ }
}
synchronized boolean isA2dpPlaying(BluetoothDevice device) {
diff --git a/src/com/android/bluetooth/btservice/BondStateMachine.java b/src/com/android/bluetooth/btservice/BondStateMachine.java
index 790597f..353157e 100644
--- a/src/com/android/bluetooth/btservice/BondStateMachine.java
+++ b/src/com/android/bluetooth/btservice/BondStateMachine.java
@@ -216,15 +216,7 @@
mAdapterService.setSimAccessPermission(dev,
BluetoothDevice.ACCESS_UNKNOWN);
// Set the profile Priorities to undefined
- clearProfilePriorty(dev);
- }
- else if (newState == BluetoothDevice.BOND_BONDED)
- {
- // Do not set profile priority
- // Profile priority should be set after SDP completion
-
- // Restore the profile priorty settings
- //setProfilePriorty(dev);
+ clearProfilePriority(dev);
}
}
else if(!mDevices.contains(dev))
@@ -450,28 +442,7 @@
sendMessage(msg);
}
- private void setProfilePriorty (BluetoothDevice device){
- HidService hidService = HidService.getHidService();
- A2dpService a2dpService = A2dpService.getA2dpService();
- HeadsetService headsetService = HeadsetService.getHeadsetService();
-
- if ((hidService != null) &&
- (hidService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED)){
- hidService.setPriority(device,BluetoothProfile.PRIORITY_ON);
- }
-
- if ((a2dpService != null) &&
- (a2dpService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED)){
- a2dpService.setPriority(device,BluetoothProfile.PRIORITY_ON);
- }
-
- if ((headsetService != null) &&
- (headsetService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED)){
- headsetService.setPriority(device,BluetoothProfile.PRIORITY_ON);
- }
- }
-
- private void clearProfilePriorty (BluetoothDevice device){
+ private void clearProfilePriority(BluetoothDevice device) {
HidService hidService = HidService.getHidService();
A2dpService a2dpService = A2dpService.getA2dpService();
HeadsetService headsetService = HeadsetService.getHeadsetService();