Home | History | Annotate | Download | only in phone

Lines Matching full:device

122        for (BluetoothDevice device : mRemoteHeadsets.keySet()) {
123 int state = mRemoteHeadsets.get(device).mState;
126 return device;
135 Log.w(TAG, "Stopping BluetoothHeadsetService: device does not have BT");
181 BluetoothDevice device = getCurrentDevice();
184 if (device != null) {
185 state = mRemoteHeadsets.get(device).mState;
202 if (!info.mRemoteDevice.equals(device)) {
204 Log.i(TAG, "Already attempting connect to " + device +
227 Log.i(TAG, "Already connected to " + device + ", disconnecting " +
248 BluetoothDevice device =
260 device.equals(currDevice)) {
287 if (getPriority(device) == BluetoothHeadset.PRIORITY_UNDEFINED) {
288 setPriority(device, BluetoothHeadset.PRIORITY_ON);
292 setPriority(device, BluetoothHeadset.PRIORITY_UNDEFINED);
303 if (device.equals(mDeviceSdpQuery) && device.equals(currDevice)) {
304 // We have got SDP records for the device we are interested in.
305 getSdpRecordsAndConnect(device);
317 BluetoothDevice device = (BluetoothDevice) msg.obj;
318 getSdpRecordsAndConnect(device);
343 private BluetoothDevice device;
350 public RfcommConnectThread(BluetoothDevice device, int channel, int type) {
352 this.device = device;
376 HeadsetBase headset = new HeadsetBase(mPowerManager, mAdapter, device, channel);
385 device.fetchUuidsWithSdp();
425 BluetoothDevice device = getCurrentDevice();
426 if (device == null ||
427 mRemoteHeadsets.get(device).mState != BluetoothHeadset.STATE_CONNECTING) {
435 setState(device,
443 setState(device,
446 mRemoteHeadsets.get(device).mHeadset = headset;
447 mBtHandsfree.connectHeadset(headset, mRemoteHeadsets.get(device).mHeadsetType);
462 BluetoothDevice device = getCurrentDevice();
463 if (device != null) {
464 setState(device,
473 private void setState(BluetoothDevice device, int state) {
474 setState(device, state, BluetoothHeadset.RESULT_SUCCESS);
477 private void setState(BluetoothDevice device, int state, int result) {
478 setState(device, state, result, -1);
481 private synchronized void setState(BluetoothDevice device,
483 int prevState = mRemoteHeadsets.get(device).mState;
485 if (DBG) log("Device: " + device +
493 intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
502 mRemoteHeadsets.get(device).mHeadset = null;
503 mRemoteHeadsets.get(device).mHeadsetType = BluetoothHandsfree.TYPE_UNKNOWN;
506 mRemoteHeadsets.get(device).mState = state;
511 setPriority(device, BluetoothHeadset.PRIORITY_AUTO_CONNECT);
512 adjustOtherHeadsetPriorities(device);
518 for (BluetoothDevice device : mAdapter.getBondedDevices()) {
519 if (getPriority(device) >= BluetoothHeadset.PRIORITY_AUTO_CONNECT &&
520 !device.equals(connectedDevice)) {
521 setPriority(device, BluetoothHeadset.PRIORITY_ON);
526 private void setPriority(BluetoothDevice device, int priority) {
528 mBinder.setPriority(device, priority);
530 Log.e(TAG, "Error while setting priority for: " + device);
534 private int getPriority(BluetoothDevice device) {
536 return mBinder.getPriority(device);
538 Log.e(TAG, "Error while getting priority for: " + device);
545 // Only 1 device is set to AUTO_CONNECT
549 for (BluetoothDevice device : mAdapter.getBondedDevices()) {
550 int priority = getPriority(device);
552 setPriority(device, BluetoothHeadset.PRIORITY_ON);
556 savedDevice = device;
565 private synchronized void getSdpRecordsAndConnect(BluetoothDevice device) {
566 if (!device.equals(getCurrentDevice())) {
572 if (mRemoteHeadsets.get(device).mState == BluetoothHeadset.STATE_CONNECTED) {
576 ParcelUuid[] uuids = device.getUuids();
582 mRemoteHeadsets.get(device).mHeadsetType = type;
583 int channel = device.getServiceChannel(BluetoothUuid.Handsfree);
584 mConnectThread = new RfcommConnectThread(device, channel, type);
586 if (getPriority(device) < BluetoothHeadset.PRIORITY_AUTO_CONNECT) {
587 setPriority(device, BluetoothHeadset.PRIORITY_AUTO_CONNECT);
593 mRemoteHeadsets.get(device).mHeadsetType = type;
594 int channel = device.getServiceChannel(BluetoothUuid.HSP);
595 mConnectThread = new RfcommConnectThread(device, channel, type);
597 if (getPriority(device) < BluetoothHeadset.PRIORITY_AUTO_CONNECT) {
598 setPriority(device, BluetoothHeadset.PRIORITY_AUTO_CONNECT);
604 mRemoteHeadsets.get(device).mHeadsetType = type;
605 setState(device, BluetoothHeadset.STATE_DISCONNECTED,
614 public int getState(BluetoothDevice device) {
616 BluetoothRemoteHeadset headset = mRemoteHeadsets.get(device);
626 public boolean connectHeadset(BluetoothDevice device) {
631 return mBluetoothService.connectHeadset(device.getAddress());
638 public void disconnectHeadset(BluetoothDevice device) {
643 mBluetoothService.disconnectHeadset(device.getAddress());
649 public boolean isConnected(BluetoothDevice device) {
652 BluetoothRemoteHeadset headset = mRemoteHeadsets.get(device);
658 BluetoothDevice device = getCurrentDevice();
660 if (device == null ||
661 mRemoteHeadsets.get(device).mState != BluetoothHeadset.STATE_CONNECTED) {
670 BluetoothDevice device = getCurrentDevice();
672 if (device == null ||
673 mRemoteHeadsets.get(device).mState != BluetoothHeadset.STATE_CONNECTED) {
685 public int getPriority(BluetoothDevice device) {
690 Settings.Secure.getBluetoothHeadsetPriorityKey(device.getAddress()),
696 public boolean setPriority(BluetoothDevice device, int priority) {
700 if (!BluetoothAdapter.checkBluetoothAddress(device.getAddress())) {
707 Settings.Secure.getBluetoothHeadsetPriorityKey(device.getAddress()),
709 if (DBG) log("Saved priority " + device + " = " + priority);
714 public boolean createIncomingConnect(BluetoothDevice device) {
717 setState(device, BluetoothHeadset.STATE_CONNECTING);
719 IncomingConnectionInfo info = mRemoteHeadsets.get(device).mIncomingInfo;
720 headset = new HeadsetBase(mPowerManager, mAdapter, device,
724 mRemoteHeadsets.get(device).mHeadset = headset;
731 public boolean rejectIncomingConnect(BluetoothDevice device) {
733 BluetoothRemoteHeadset headset = mRemoteHeadsets.get(device);
744 public boolean acceptIncomingConnect(BluetoothDevice device) {
747 BluetoothRemoteHeadset cachedHeadset = mRemoteHeadsets.get(device);
753 headset = new HeadsetBase(mPowerManager, mAdapter, device,
756 setState(device, BluetoothHeadset.STATE_CONNECTED, BluetoothHeadset.RESULT_SUCCESS);
782 public boolean connectHeadsetInternal(BluetoothDevice device) {
787 mRemoteHeadsets.put(device, headset);
789 setState(device, BluetoothHeadset.STATE_CONNECTING);
790 if (device.getUuids() == null) {
795 msg.obj = device;
798 getSdpRecordsAndConnect(device);
802 Log.w(TAG, "connectHeadset(" + device + "): failed: already in state " +
810 public boolean disconnectHeadsetInternal(BluetoothDevice device) {
812 BluetoothRemoteHeadset remoteHeadset = mRemoteHeadsets.get(device);
832 setState(device, BluetoothHeadset.STATE_DISCONNECTED,
839 setState(device, BluetoothHeadset.STATE_DISCONNECTED,