summaryrefslogtreecommitdiff
path: root/core/java/android/bluetooth
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2012-05-29 12:40:46 -0700
committerWink Saville <wink@google.com>2012-05-29 12:40:46 -0700
commitbbf30dfd767f823f5f40d14b498e2a593454c5c9 (patch)
tree8a73a775e4f6ac59eade4b465e7e2a3672078358 /core/java/android/bluetooth
parentfe002daf4aa6a7ba6cfc2379f11c517f419c77d1 (diff)
Enhance StateMachine Quitting and logging support.
Make StateMachine#quit non-conditional and remove the need to process the SM_QUIT_CMD it is now private. Rename halting to onHalting. Add onQuitting Change the message specific logging to be more generic and change the xxxProcessedMessagesYyy methods to xxxLogRecXyy names. Also add addLogRec(String) and addLogRec(String, State) as the generic logging methods. bug: 5678189 Change-Id: I22f66d11828bfd70498db625fe1be728b90478b7
Diffstat (limited to 'core/java/android/bluetooth')
-rw-r--r--core/java/android/bluetooth/BluetoothDeviceProfileState.java48
1 files changed, 28 insertions, 20 deletions
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
index c9603bf3ed55..020f051b77b3 100644
--- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java
+++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
@@ -304,6 +304,25 @@ public final class BluetoothDeviceProfileState extends StateMachine {
}
}
+ @Override
+ protected void onQuitting() {
+ mContext.unregisterReceiver(mBroadcastReceiver);
+ mBroadcastReceiver = null;
+ mAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mHeadsetService);
+ mBluetoothProfileServiceListener = null;
+ mOutgoingHandsfree = null;
+ mPbap = null;
+ mPbapService.close();
+ mPbapService = null;
+ mIncomingHid = null;
+ mOutgoingHid = null;
+ mIncomingHandsfree = null;
+ mOutgoingHandsfree = null;
+ mIncomingA2dp = null;
+ mOutgoingA2dp = null;
+ mBondedDevice = null;
+ }
+
private class BondedDevice extends State {
@Override
public void enter() {
@@ -416,26 +435,6 @@ public final class BluetoothDeviceProfileState extends StateMachine {
case TRANSITION_TO_STABLE:
// ignore.
break;
- case SM_QUIT_CMD:
- mContext.unregisterReceiver(mBroadcastReceiver);
- mBroadcastReceiver = null;
- mAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mHeadsetService);
- mBluetoothProfileServiceListener = null;
- mOutgoingHandsfree = null;
- mPbap = null;
- mPbapService.close();
- mPbapService = null;
- mIncomingHid = null;
- mOutgoingHid = null;
- mIncomingHandsfree = null;
- mOutgoingHandsfree = null;
- mIncomingA2dp = null;
- mOutgoingA2dp = null;
- mBondedDevice = null;
- // There is a problem in the State Machine code
- // where things are not cleaned up properly, when quit message
- // is handled so return NOT_HANDLED as a workaround.
- return NOT_HANDLED;
default:
return NOT_HANDLED;
}
@@ -1341,6 +1340,15 @@ public final class BluetoothDeviceProfileState extends StateMachine {
return mDevice;
}
+ /**
+ * Quit the state machine, only to be called by BluetoothService.
+ *
+ * @hide
+ */
+ public void doQuit() {
+ this.quit();
+ }
+
private void log(String message) {
if (DBG) {
Log.i(TAG, "Device:" + mDevice + " Message:" + message);