Lines Matching defs:device

81             BluetoothDevice device =
99 if (getSinkPriority(device) == BluetoothA2dp.PRIORITY_UNDEFINED) {
100 setSinkPriority(device, BluetoothA2dp.PRIORITY_ON);
104 setSinkPriority(device, BluetoothA2dp.PRIORITY_UNDEFINED);
108 if (getSinkPriority(device) == BluetoothA2dp.PRIORITY_AUTO_CONNECT &&
109 isSinkDevice(device)) {
110 // This device is a preferred sink. Make an A2DP connection
114 Message msg = Message.obtain(mHandler, MESSAGE_CONNECT_TO, device);
119 if (mAudioDevices.containsKey(device)) {
120 int state = mAudioDevices.get(device);
121 handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED);
147 private boolean isPhoneDocked(BluetoothDevice device) {
154 if (dockDevice != null && device.equals(dockDevice)) {
206 BluetoothDevice device = (BluetoothDevice) msg.obj;
207 // check bluetooth is still on, device is still preferred, and
210 getSinkPriority(device) == BluetoothA2dp.PRIORITY_AUTO_CONNECT &&
216 log("Auto-connecting A2DP to sink " + device);
217 connectSink(device);
236 private boolean isSinkDevice(BluetoothDevice device) {
237 ParcelUuid[] uuids = mBluetoothService.getRemoteUuids(device.getAddress());
244 private synchronized boolean addAudioSink (BluetoothDevice device) {
245 String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
248 Log.e(TAG, "Error while getting AudioSink properties for device: " + device);
259 mAudioDevices.put(device, state);
260 handleSinkStateChange(device, BluetoothA2dp.STATE_DISCONNECTED, state);
271 BluetoothDevice device = mAdapter.getRemoteDevice(address);
277 addAudioSink(device);
289 for (BluetoothDevice device : devices) {
290 int state = getSinkState(device);
296 device.getAddress()));
297 handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED);
300 handleSinkStateChange(device, BluetoothA2dp.STATE_DISCONNECTING,
311 public synchronized boolean connectSink(BluetoothDevice device) {
314 if (DBG) log("connectSink(" + device + ")");
327 if (mAudioDevices.get(device) == null && !addAudioSink(device))
330 int state = mAudioDevices.get(device);
341 String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
346 handleSinkStateChange(device, state, BluetoothA2dp.STATE_CONNECTING);
350 handleSinkStateChange(device, mAudioDevices.get(device), state);
356 public synchronized boolean disconnectSink(BluetoothDevice device) {
359 if (DBG) log("disconnectSink(" + device + ")");
361 String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
366 int state = getSinkState(device);
375 handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTING);
378 handleSinkStateChange(device, mAudioDevices.get(device), state);
384 public synchronized boolean suspendSink(BluetoothDevice device) {
387 if (DBG) log("suspendSink(" + device + "), mTargetA2dpState: "+mTargetA2dpState);
388 if (device == null || mAudioDevices == null) {
391 String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
392 Integer state = mAudioDevices.get(device);
401 public synchronized boolean resumeSink(BluetoothDevice device) {
404 if (DBG) log("resumeSink(" + device + "), mTargetA2dpState: "+mTargetA2dpState);
405 if (device == null || mAudioDevices == null) {
408 String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
409 Integer state = mAudioDevices.get(device);
434 public synchronized int getSinkState(BluetoothDevice device) {
436 Integer state = mAudioDevices.get(device);
442 public synchronized int getSinkPriority(BluetoothDevice device) {
445 Settings.Secure.getBluetoothA2dpSinkPriorityKey(device.getAddress()),
449 public synchronized boolean setSinkPriority(BluetoothDevice device, int priority) {
452 if (!BluetoothAdapter.checkBluetoothAddress(device.getAddress())) {
456 Settings.Secure.getBluetoothA2dpSinkPriorityKey(device.getAddress()), priority);
467 Log.e(TAG, "onSinkPropertyChanged: Address of the remote device in null");
471 BluetoothDevice device = mAdapter.getRemoteDevice(address);
475 if (mAudioDevices.get(device) == null) {
476 // This is for an incoming connection for a device not known to us.
478 addAudioSink(device);
480 int prevState = mAudioDevices.get(device);
481 handleSinkStateChange(device, prevState, state);
486 private void handleSinkStateChange(BluetoothDevice device, int prevState, int state) {
494 mAudioDevices.put(device, state);
499 if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF &&
504 setSinkPriority(device, BluetoothA2dp.PRIORITY_AUTO_CONNECT);
508 intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
513 if (DBG) log("A2DP state : device: " + device + " State:" + prevState + "->" + state);
522 for (BluetoothDevice device: mAudioDevices.keySet()) {
523 int sinkState = getSinkState(device);
526 sinks.add(device);
557 BluetoothDevice device = mAdapter.getRemoteDevice(address);
558 int state = getSinkState(device);
559 handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED);
568 for (BluetoothDevice device : mAudioDevices.keySet()) {
569 int state = mAudioDevices.get(device);
570 pw.println(device + " " + BluetoothA2dp.stateToString(state));