Merge "Remove discoverable timeout handler. DO NOT MERGE" into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
1b755dea38
@@ -103,7 +103,6 @@ public class BluetoothService extends IBluetooth.Stub {
|
|||||||
private static final int MESSAGE_REGISTER_SDP_RECORDS = 1;
|
private static final int MESSAGE_REGISTER_SDP_RECORDS = 1;
|
||||||
private static final int MESSAGE_FINISH_DISABLE = 2;
|
private static final int MESSAGE_FINISH_DISABLE = 2;
|
||||||
private static final int MESSAGE_UUID_INTENT = 3;
|
private static final int MESSAGE_UUID_INTENT = 3;
|
||||||
private static final int MESSAGE_DISCOVERABLE_TIMEOUT = 4;
|
|
||||||
private static final int MESSAGE_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY = 5;
|
private static final int MESSAGE_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY = 5;
|
||||||
|
|
||||||
// The time (in millisecs) to delay the pairing attempt after the first
|
// The time (in millisecs) to delay the pairing attempt after the first
|
||||||
@@ -501,15 +500,6 @@ public class BluetoothService extends IBluetooth.Stub {
|
|||||||
makeServiceChannelCallbacks(address);
|
makeServiceChannelCallbacks(address);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MESSAGE_DISCOVERABLE_TIMEOUT:
|
|
||||||
int mode = msg.arg1;
|
|
||||||
if (isEnabledInternal()) {
|
|
||||||
// TODO: Switch back to the previous scan mode
|
|
||||||
// This is ok for now, because we only use
|
|
||||||
// CONNECTABLE and CONNECTABLE_DISCOVERABLE
|
|
||||||
setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE, -1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MESSAGE_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY:
|
case MESSAGE_AUTO_PAIRING_FAILURE_ATTEMPT_DELAY:
|
||||||
address = (String)msg.obj;
|
address = (String)msg.obj;
|
||||||
if (address != null) {
|
if (address != null) {
|
||||||
@@ -1078,21 +1068,17 @@ public class BluetoothService extends IBluetooth.Stub {
|
|||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case BluetoothAdapter.SCAN_MODE_NONE:
|
case BluetoothAdapter.SCAN_MODE_NONE:
|
||||||
mHandler.removeMessages(MESSAGE_DISCOVERABLE_TIMEOUT);
|
|
||||||
pairable = false;
|
pairable = false;
|
||||||
discoverable = false;
|
discoverable = false;
|
||||||
break;
|
break;
|
||||||
case BluetoothAdapter.SCAN_MODE_CONNECTABLE:
|
case BluetoothAdapter.SCAN_MODE_CONNECTABLE:
|
||||||
mHandler.removeMessages(MESSAGE_DISCOVERABLE_TIMEOUT);
|
|
||||||
pairable = true;
|
pairable = true;
|
||||||
discoverable = false;
|
discoverable = false;
|
||||||
break;
|
break;
|
||||||
case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE:
|
case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE:
|
||||||
mHandler.removeMessages(MESSAGE_DISCOVERABLE_TIMEOUT);
|
setDiscoverableTimeout(duration);
|
||||||
pairable = true;
|
pairable = true;
|
||||||
discoverable = true;
|
discoverable = true;
|
||||||
Message msg = mHandler.obtainMessage(MESSAGE_DISCOVERABLE_TIMEOUT);
|
|
||||||
mHandler.sendMessageDelayed(msg, duration * 1000);
|
|
||||||
if (DBG) Log.d(TAG, "BT Discoverable for " + duration + " seconds");
|
if (DBG) Log.d(TAG, "BT Discoverable for " + duration + " seconds");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user