Home | History | Annotate | Download | only in phone

Lines Matching full:device

124        for (BluetoothDevice device : mRemoteHeadsets.keySet()) {
125 int state = mRemoteHeadsets.get(device).mState;
128 return device;
137 Log.w(TAG, "Stopping BluetoothHeadsetService: device does not have BT");
185 BluetoothDevice device = getCurrentDevice();
188 if (device != null) {
189 state = mRemoteHeadsets.get(device).mState;
206 if (!info.mRemoteDevice.equals(device)) {
208 Log.i(TAG, "Already attempting connect to " + device +
233 Log.i(TAG, "Already connected to " + device + ", disconnecting " +
254 BluetoothDevice device =
266 device.equals(currDevice)) {
295 if (device.equals(mDeviceSdpQuery) && device.equals(currDevice)) {
296 // We have got SDP records for the device we are interested in.
297 getSdpRecordsAndConnect(device);
309 BluetoothDevice device = (BluetoothDevice) msg.obj;
310 getSdpRecordsAndConnect(device);
335 private BluetoothDevice device;
342 public RfcommConnectThread(BluetoothDevice device, int channel, int type) {
344 this.device = device;
369 device, channel);
378 device.fetchUuidsWithSdp();
420 BluetoothDevice device = getCurrentDevice();
421 if (device == null ||
422 mRemoteHeadsets.get(device).mState != BluetoothProfile.STATE_CONNECTING) {
430 setState(device, BluetoothProfile.STATE_DISCONNECTED);
436 setState(device, BluetoothProfile.STATE_CONNECTED);
438 mRemoteHeadsets.get(device).mHeadset = headset;
439 mBtHandsfree.connectHeadset(headset, mRemoteHeadsets.get(device).mHeadsetType);
455 BluetoothDevice device = getCurrentDevice();
456 if (device != null) {
457 setState(device, BluetoothProfile.STATE_DISCONNECTED);
464 private synchronized void setState(BluetoothDevice device, int state) {
465 int prevState = mRemoteHeadsets.get(device).mState;
467 if (DBG) log("Device: " + device +
476 intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
478 mRemoteHeadsets.get(device).mHeadset = null;
479 mRemoteHeadsets.get(device).mHeadsetType = BluetoothHandsfree.TYPE_UNKNOWN;
482 mRemoteHeadsets.get(device).mState = state;
487 setPriority(device, BluetoothHeadset.PRIORITY_AUTO_CONNECT);
488 adjustOtherHeadsetPriorities(device);
491 mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.HEADSET,
500 for (BluetoothDevice device : mAdapter.getBondedDevices()) {
501 if (getPriority(device) >= BluetoothHeadset.PRIORITY_AUTO_CONNECT &&
502 !device.equals(connectedDevice)) {
503 setPriority(device, BluetoothHeadset.PRIORITY_ON);
508 private void setPriority(BluetoothDevice device, int priority) {
510 mBinder.setPriority(device, priority);
512 Log.e(TAG, "Error while setting priority for: " + device);
516 private int getPriority(BluetoothDevice device) {
518 return mBinder.getPriority(device);
520 Log.e(TAG, "Error while getting priority for: " + device);
525 private synchronized void getSdpRecordsAndConnect(BluetoothDevice device) {
526 if (!device.equals(getCurrentDevice())) {
532 if (mRemoteHeadsets.get(device).mState == BluetoothProfile.STATE_CONNECTED) {
536 ParcelUuid[] uuids = device.getUuids();
544 mRemoteHeadsets.get(device).mHeadsetType = type;
545 int channel = device.getServiceChannel(BluetoothUuid.Handsfree);
546 mConnectThread = new RfcommConnectThread(device, channel, type);
551 if (getPriority(device) < BluetoothHeadset.PRIORITY_AUTO_CONNECT) {
552 setPriority(device, BluetoothHeadset.PRIORITY_AUTO_CONNECT);
559 mRemoteHeadsets.get(device).mHeadsetType = type;
560 int channel = device.getServiceChannel(BluetoothUuid.HSP);
561 mConnectThread = new RfcommConnectThread(device, channel, type);
566 if (getPriority(device) < BluetoothHeadset.PRIORITY_AUTO_CONNECT) {
567 setPriority(device, BluetoothHeadset.PRIORITY_AUTO_CONNECT);
573 mRemoteHeadsets.get(device).mHeadsetType = type;
574 setState(device, BluetoothProfile.STATE_DISCONNECTED);
582 public int getConnectionState(BluetoothDevice device) {
584 BluetoothRemoteHeadset headset = mRemoteHeadsets.get(device);
597 public boolean connect(BluetoothDevice device) {
603 if (currDevice == device ||
604 getPriority(device) == BluetoothProfile.PRIORITY_OFF) {
611 return mBluetoothService.connectHeadset(device.getAddress());
619 public boolean disconnect(BluetoothDevice device) {
623 BluetoothRemoteHeadset headset = mRemoteHeadsets.get(device);
630 return mBluetoothService.disconnectHeadset(device.getAddress());
638 public synchronized boolean isAudioConnected(BluetoothDevice device) {
640 if (device.equals(mAudioConnectedDevice)) return true;
647 for (BluetoothDevice device: mRemoteHeadsets.keySet()) {
648 int headsetState = getConnectionState(device);
651 headsets.add(device);
659 public boolean startVoiceRecognition(BluetoothDevice device) {
662 if (device == null ||
663 mRemoteHeadsets.get(device) == null ||
664 mRemoteHeadsets.get(device).mState != BluetoothProfile.STATE_CONNECTED) {
671 public boolean stopVoiceRecognition(BluetoothDevice device) {
674 if (device == null ||
675 mRemoteHeadsets.get(device) == null ||
676 mRemoteHeadsets.get(device).mState != BluetoothProfile.STATE_CONNECTED) {
684 public int getBatteryUsageHint(BluetoothDevice device) {
690 public int getPriority(BluetoothDevice device) {
695 Settings.Secure.getBluetoothHeadsetPriorityKey(device.getAddress()),
701 public boolean setPriority(BluetoothDevice device, int priority) {
706 Settings.Secure.getBluetoothHeadsetPriorityKey(device.getAddress()),
708 if (DBG) log("Saved priority " + device + " = " + priority);
713 public boolean createIncomingConnect(BluetoothDevice device) {
716 setState(device, BluetoothProfile.STATE_CONNECTING);
718 IncomingConnectionInfo info = mRemoteHeadsets.get(device).mIncomingInfo;
720 device,
724 mRemoteHeadsets.get(device).mHeadset = headset;
731 public boolean startScoUsingVirtualVoiceCall(BluetoothDevice device) {
734 if (device == null ||
735 mRemoteHeadsets.get(device) == null ||
736 mRemoteHeadsets.get(device).mState != BluetoothProfile.STATE_CONNECTED ||
737 getAudioState(device) != BluetoothHeadset.STATE_AUDIO_DISCONNECTED) {
744 public boolean stopScoUsingVirtualVoiceCall(BluetoothDevice device) {
747 if (device == null ||
748 mRemoteHeadsets.get(device) == null ||
749 mRemoteHeadsets.get(device).mState != BluetoothProfile.STATE_CONNECTED ||
750 getAudioState(device) == BluetoothHeadset.STATE_AUDIO_DISCONNECTED) {
757 public boolean rejectIncomingConnect(BluetoothDevice device) {
759 BluetoothRemoteHeadset headset = mRemoteHeadsets.get(device);
770 public boolean acceptIncomingConnect(BluetoothDevice device) {
773 BluetoothRemoteHeadset cachedHeadset = mRemoteHeadsets.get(device);
780 device,
784 setState(device, BluetoothProfile.STATE_CONNECTED);
810 public boolean connectHeadsetInternal(BluetoothDevice device) {
815 mRemoteHeadsets.put(device, headset);
817 setState(device, BluetoothProfile.STATE_CONNECTING);
818 if (device.getUuids() == null) {
823 msg.obj = device;
826 getSdpRecordsAndConnect(device);
830 Log.w(TAG, "connectHeadset(" + device + "): failed: already in state " +
838 public boolean disconnectHeadsetInternal(BluetoothDevice device) {
840 BluetoothRemoteHeadset remoteHeadset = mRemoteHeadsets.get(device);
851 setState(device, BluetoothProfile.STATE_DISCONNECTING);
862 setState(device, BluetoothProfile.STATE_DISCONNECTED);
867 setState(device, BluetoothProfile.STATE_DISCONNECTED);
874 public boolean setAudioState(BluetoothDevice device, int state) {
876 int prevState = mRemoteHeadsets.get(device).mAudioState;
877 mRemoteHeadsets.get(device).mAudioState = state;
879 mAudioConnectedDevice = device;
886 intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
888 if (DBG) log("AudioStateIntent: " + device + " State: " + state
894 public int getAudioState(BluetoothDevice device) {
896 BluetoothRemoteHeadset headset = mRemoteHeadsets.get(device);
912 BluetoothDevice device = getCurrentDevice();
913 if (device != null) {
914 setState(device, BluetoothProfile.STATE_DISCONNECTED);