public static synchronized A2dpService getA2dpService() { if (sAd2dpService != null && sAd2dpService.isAvailable()) { if (DBG) Log.d(TAG, "getA2DPService(): returning " + sAd2dpService); return sAd2dpService; } if (DBG) { if (sAd2dpService == null) { Log.d(TAG, "getA2dpService(): service is NULL"); } else if (!(sAd2dpService.isAvailable())) { Log.d(TAG, "getA2dpService(): service is not available"); } } return null; }
private static synchronized void setA2dpService(A2dpService instance) { if (instance != null && instance.isAvailable()) { if (DBG) Log.d(TAG, "setA2dpService(): set to: " + sAd2dpService); sAd2dpService = instance; } else { if (DBG) { if (sAd2dpService == null) { Log.d(TAG, "setA2dpService(): service not available"); } else if (!sAd2dpService.isAvailable()) { Log.d(TAG, "setA2dpService(): service is cleaning up"); } } } }
private A2dpService getService() { if (!Utils.checkCaller()) { Log.w(TAG, "A2dp call not allowed for non-active user"); return null; } if (mService != null && mService.isAvailable()) { return mService; } return null; }
boolean okToConnect(BluetoothDevice device) { AdapterService adapterService = AdapterService.getAdapterService(); int priority = mService.getPriority(device); boolean ret = false; // check if this is an incoming connection in Quiet mode. if ((adapterService == null) || ((adapterService.isQuietModeEnabled() == true) && (mTargetDevice == null))) { ret = false; } // check priority and accept or reject the connection. if priority is undefined // it is likely that our SDP has not completed and peer is initiating the // connection. Allow this connection, provided the device is bonded else if ((BluetoothProfile.PRIORITY_OFF < priority) || ((BluetoothProfile.PRIORITY_UNDEFINED == priority) && (device.getBondState() != BluetoothDevice.BOND_NONE))) { ret = true; } return ret; }
public boolean isA2dpPlaying(BluetoothDevice device) { A2dpService service = getService(); if (service == null) return false; return service.isA2dpPlaying(device); }
public void setAvrcpAbsoluteVolume(int volume) { A2dpService service = getService(); if (service == null) return; service.setAvrcpAbsoluteVolume(volume); }
public void adjustAvrcpAbsoluteVolume(int direction) { A2dpService service = getService(); if (service == null) return; service.adjustAvrcpAbsoluteVolume(direction); }
public boolean isAvrcpAbsoluteVolumeSupported() { A2dpService service = getService(); if (service == null) return false; return service.isAvrcpAbsoluteVolumeSupported(); }
public int getPriority(BluetoothDevice device) { A2dpService service = getService(); if (service == null) return BluetoothProfile.PRIORITY_UNDEFINED; return service.getPriority(device); }
public boolean setPriority(BluetoothDevice device, int priority) { A2dpService service = getService(); if (service == null) return false; return service.setPriority(device, priority); }
public int getConnectionState(BluetoothDevice device) { A2dpService service = getService(); if (service == null) return BluetoothProfile.STATE_DISCONNECTED; return service.getConnectionState(device); }
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { A2dpService service = getService(); if (service == null) return new ArrayList<BluetoothDevice>(0); return service.getDevicesMatchingConnectionStates(states); }
public List<BluetoothDevice> getConnectedDevices() { A2dpService service = getService(); if (service == null) return new ArrayList<BluetoothDevice>(0); return service.getConnectedDevices(); }
public boolean disconnect(BluetoothDevice device) { A2dpService service = getService(); if (service == null) return false; return service.disconnect(device); }