OSDN Git Service

Fix discoverability timeout issues. (a) implement timeout logic (b) persist 'never...
authorSrikanth Uppala <suppala@broadcom.com>
Wed, 4 Apr 2012 10:33:43 +0000 (03:33 -0700)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 17 Jul 2012 04:56:13 +0000 (21:56 -0700)
Change-Id: I9313277c39c69f90d0b0556cf24d9c30a774a0a6

src/com/android/bluetooth/btservice/AdapterProperties.java [changed mode: 0644->0755]
src/com/android/bluetooth/btservice/RemoteDevices.java

old mode 100644 (file)
new mode 100755 (executable)
index bd8ae4b..36de84f
@@ -430,7 +430,15 @@ class AdapterProperties {
         synchronized (mObject) {
             if (getState() == BluetoothAdapter.STATE_TURNING_ON &&
                     mScanMode == BluetoothAdapter.SCAN_MODE_NONE) {
-                    setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);
+                    /* mDiscoverableTimeout is part of the
+                       adapterPropertyChangedCallback received before
+                       onBluetoothReady */
+                    if (mDiscoverableTimeout != 0)
+                      setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);
+                    else /* if timeout == never (0) at startup */
+                      setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
+                    /* though not always required, this keeps NV up-to date on first-boot after flash */
+                    setDiscoverableTimeout(mDiscoverableTimeout);
             }
         }
     }
index 4d31751..1bafdf6 100755 (executable)
@@ -222,7 +222,7 @@ final class RemoteDevices {
                         intent.putExtra(BluetoothDevice.EXTRA_NAME, device.mName);
                         intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
                         mContext.sendBroadcast(intent, mAdapterService.BLUETOOTH_PERM);
-                        debugLog("Remote Device ame is: " + device.mName);
+                        debugLog("Remote Device name is: " + device.mName);
                         break;
                     case AbstractionLayer.BT_PROPERTY_REMOTE_FRIENDLY_NAME:
                         // TODO(BT) is null device.mAlias a valid senario?