summaryrefslogtreecommitdiffstats
path: root/core/java/android/server/BluetoothService.java
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2011-09-20 14:14:29 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-09-20 14:14:29 -0700
commite0515aad3a51aa2eadce5c448f771d2372916939 (patch)
tree4d580a85e9319c36aed0e30fd564fcc53402e98f /core/java/android/server/BluetoothService.java
parentde5e4455c5a750e70e43674e1fe9f95bce09654b (diff)
parent778eccf4923571c77f158e92b2f5f0f7dfd21875 (diff)
downloadframeworks_base-e0515aad3a51aa2eadce5c448f771d2372916939.zip
frameworks_base-e0515aad3a51aa2eadce5c448f771d2372916939.tar.gz
frameworks_base-e0515aad3a51aa2eadce5c448f771d2372916939.tar.bz2
am 778eccf4: Merge "Check null of pidPair to skip the case the service record has been removed" into ics-factoryrom
* commit '778eccf4923571c77f158e92b2f5f0f7dfd21875': Check null of pidPair to skip the case the service record has been removed
Diffstat (limited to 'core/java/android/server/BluetoothService.java')
-rwxr-xr-xcore/java/android/server/BluetoothService.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index f0fb4e0..63da926 100755
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -390,8 +390,7 @@ public class BluetoothService extends IBluetooth.Stub {
}
/**
- * The Bluetooth has been turned off, but hot. Do bonding, profile,
- * and internal cleanup
+ * The Bluetooth has been turned off, but hot. Do bonding, profile cleanup
*/
synchronized void finishDisable() {
// mark in progress bondings as cancelled
@@ -409,8 +408,17 @@ public class BluetoothService extends IBluetooth.Stub {
Intent intent = new Intent(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
intent.putExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE);
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
+ }
+ /**
+ * Local clean up after broadcasting STATE_OFF intent
+ */
+ synchronized void cleanupAfterFinishDisable() {
mAdapterProperties.clear();
+
+ for (Integer srHandle : mServiceRecordToPid.keySet()) {
+ removeServiceRecordNative(srHandle);
+ }
mServiceRecordToPid.clear();
mProfilesConnected = 0;
@@ -1526,6 +1534,8 @@ public class BluetoothService extends IBluetooth.Stub {
public void removeServiceRecord(int handle) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
"Need BLUETOOTH permission");
+ // Since this is a binder call check if Bluetooth is off
+ if (getBluetoothStateInternal() == BluetoothAdapter.STATE_OFF) return;
Message message = mHandler.obtainMessage(MESSAGE_REMOVE_SERVICE_RECORD);
message.obj = new Pair<Integer, Integer>(handle, Binder.getCallingPid());
mHandler.sendMessage(message);
@@ -1533,8 +1543,7 @@ public class BluetoothService extends IBluetooth.Stub {
private synchronized void checkAndRemoveRecord(int handle, int pid) {
Pair<Integer, IBinder> pidPair = mServiceRecordToPid.get(handle);
- Integer owner = pidPair.first;
- if (owner != null && pid == owner.intValue()) {
+ if (pidPair != null && pid == pidPair.first) {
if (DBG) Log.d(TAG, "Removing service record " +
Integer.toHexString(handle) + " for pid " + pid);
mServiceRecordToPid.remove(handle);