在程序启动时注册了广播BluetoothDiscoverableTimeoutReceiver,当可检测时间结束后就会将蓝牙的扫描状态设置为BluetoothAdapter.SCAN_MODE_CONNECTABLE,即取消对所有设备的可检测性:
frameworks/base/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothDiscoverableTimeoutReceiver.java:
29 public class BluetoothDiscoverableTimeoutReceiver extends BroadcastReceiver { 30 private static final String TAG = "BluetoothDiscoverableTimeoutReceiver"; 31 32 private static final String INTENT_DISCOVERABLE_TIMEOUT = 33 "android.bluetooth.intent.DISCOVERABLE_TIMEOUT"; 34 35 public static void setDiscoverableAlarm(Context context, long alarmTime) { 55 56 public static void cancelDiscoverableAlarm(Context context) { 71 72 @Override 73 public void onReceive(Context context, Intent intent) { 85 };