OSDN Git Service

Fixed exception in BondStateMachine when quit message occurs. Fixed exception in...
authorfredc <fredc@broadcom.com>
Tue, 24 Apr 2012 18:51:48 +0000 (11:51 -0700)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 17 Jul 2012 05:03:55 +0000 (22:03 -0700)
Change-Id: Ibb43a26ee0ac62967518468d243880a0af987ba0

src/com/android/bluetooth/btservice/BondStateMachine.java
src/com/android/bluetooth/opp/BluetoothOppTransfer.java

index e854dcf..5ef2a57 100755 (executable)
@@ -65,7 +65,7 @@ final class BondStateMachine extends StateMachine {
     private class StableState extends State {
         @Override
         public void enter() {
-            infoLog("Entering Off State");
+            infoLog("StableState(): Entering Off State");
         }
 
         @Override
@@ -122,6 +122,11 @@ final class BondStateMachine extends StateMachine {
 
         @Override
         public boolean processMessage(Message msg) {
+            if (msg.what == SM_QUIT_CMD) {
+                Log.d(TAG, "PendingCommandState(): Received quit request...");
+                return false;
+            }
+
             BluetoothDevice dev = (BluetoothDevice)msg.obj;
             boolean result = false;
             if (mDevices.contains(dev) &&
index 0893370..e345f4e 100755 (executable)
@@ -302,7 +302,11 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
             }
         }
 
-        BluetoothOppShareInfo info = mBatch.getPendingShare();
+        BluetoothOppShareInfo info = null;
+        if (mBatch == null) {
+            return;
+        }
+        info = mBatch.getPendingShare();
         while (info != null) {
             if (info.mStatus < 200) {
                 info.mStatus = failReason;
@@ -694,6 +698,10 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
 
     /* update a trivial field of a share to notify Provider the batch status change */
     private void tickShareStatus(BluetoothOppShareInfo share) {
+        if (share == null) {
+            Log.d(TAG,"Share is null");
+            return;
+        }
         Uri contentUri = Uri.parse(BluetoothShare.CONTENT_URI + "/" + share.mId);
         ContentValues updateValues = new ContentValues();
         updateValues.put(BluetoothShare.DIRECTION, share.mDirection);