Loading api/system-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -1158,14 +1158,18 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean cancelBondProcess(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public String getMetadata(int); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean getSilenceMode(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isConnected(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isEncrypted(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean removeBond(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setMetadata(int, String); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setPhonebookAccessPermission(int); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setSilenceMode(boolean); field public static final int ACCESS_ALLOWED = 1; // 0x1 field public static final int ACCESS_REJECTED = 2; // 0x2 field public static final int ACCESS_UNKNOWN = 0; // 0x0 field public static final String ACTION_SILENCE_MODE_CHANGED = "android.bluetooth.device.action.SILENCE_MODE_CHANGED"; field public static final String EXTRA_SILENCE_ENABLED = "android.bluetooth.device.extra.SILENCE_ENABLED"; field public static final int METADATA_COMPANION_APP = 4; // 0x4 field public static final int METADATA_ENHANCED_SETTINGS_UI_URI = 16; // 0x10 field public static final int METADATA_HARDWARE_VERSION = 3; // 0x3 Loading core/java/android/bluetooth/BluetoothDevice.java +86 −0 Original line number Diff line number Diff line Loading @@ -531,6 +531,28 @@ public final class BluetoothDevice implements Parcelable { public static final String ACTION_CONNECTION_ACCESS_CANCEL = "android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL"; /** * Intent to broadcast silence mode changed. * Alway contains the extra field {@link #EXTRA_DEVICE} * Alway contains the extra field {@link #EXTRA_SILENCE_ENABLED} * * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) @SystemApi public static final String ACTION_SILENCE_MODE_CHANGED = "android.bluetooth.device.action.SILENCE_MODE_CHANGED"; /** * Used as an extra field in {@link #ACTION_SILENCE_MODE_CHANGED} intent, * contains whether device is in silence mode as boolean. * * @hide */ @SystemApi public static final String EXTRA_SILENCE_ENABLED = "android.bluetooth.device.extra.SILENCE_ENABLED"; /** * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST} intent. * Loading Loading @@ -1591,6 +1613,70 @@ public final class BluetoothDevice implements Parcelable { return ACCESS_UNKNOWN; } /** * Set the Bluetooth device silence mode. * * When the {@link BluetoothDevice} enters silence mode, and the {@link BluetoothDevice} * is an active device (for A2DP or HFP), the active device for that profile * will be set to null. * If the {@link BluetoothDevice} exits silence mode while the A2DP or HFP * active device is null, the {@link BluetoothDevice} will be set as the * active device for that profile. * If the {@link BluetoothDevice} is disconnected, it exits silence mode. * If the {@link BluetoothDevice} is set as the active device for A2DP or * HFP, while silence mode is enabled, then the device will exit silence mode. * If the {@link BluetoothDevice} is in silence mode, AVRCP position change * event and HFP AG indicators will be disabled. * If the {@link BluetoothDevice} is not connected with A2DP or HFP, it cannot * enter silence mode. * * <p> Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. * * @param silence true to enter silence mode, false to exit * @return true on success, false on error. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setSilenceMode(boolean silence) { final IBluetooth service = sService; if (service == null) { return false; } try { if (getSilenceMode() == silence) { return true; } return service.setSilenceMode(this, silence); } catch (RemoteException e) { Log.e(TAG, "setSilenceMode fail", e); return false; } } /** * Get the device silence mode status * * <p> Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. * * @return true on device in silence mode, otherwise false. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean getSilenceMode() { final IBluetooth service = sService; if (service == null) { return false; } try { return service.getSilenceMode(this); } catch (RemoteException e) { Log.e(TAG, "getSilenceMode fail", e); return false; } } /** * Sets whether the phonebook access is allowed to this device. * <p>Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. Loading Loading
api/system-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -1158,14 +1158,18 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean cancelBondProcess(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public String getMetadata(int); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean getSilenceMode(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isConnected(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isEncrypted(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean removeBond(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setMetadata(int, String); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setPhonebookAccessPermission(int); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setSilenceMode(boolean); field public static final int ACCESS_ALLOWED = 1; // 0x1 field public static final int ACCESS_REJECTED = 2; // 0x2 field public static final int ACCESS_UNKNOWN = 0; // 0x0 field public static final String ACTION_SILENCE_MODE_CHANGED = "android.bluetooth.device.action.SILENCE_MODE_CHANGED"; field public static final String EXTRA_SILENCE_ENABLED = "android.bluetooth.device.extra.SILENCE_ENABLED"; field public static final int METADATA_COMPANION_APP = 4; // 0x4 field public static final int METADATA_ENHANCED_SETTINGS_UI_URI = 16; // 0x10 field public static final int METADATA_HARDWARE_VERSION = 3; // 0x3 Loading
core/java/android/bluetooth/BluetoothDevice.java +86 −0 Original line number Diff line number Diff line Loading @@ -531,6 +531,28 @@ public final class BluetoothDevice implements Parcelable { public static final String ACTION_CONNECTION_ACCESS_CANCEL = "android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL"; /** * Intent to broadcast silence mode changed. * Alway contains the extra field {@link #EXTRA_DEVICE} * Alway contains the extra field {@link #EXTRA_SILENCE_ENABLED} * * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) @SystemApi public static final String ACTION_SILENCE_MODE_CHANGED = "android.bluetooth.device.action.SILENCE_MODE_CHANGED"; /** * Used as an extra field in {@link #ACTION_SILENCE_MODE_CHANGED} intent, * contains whether device is in silence mode as boolean. * * @hide */ @SystemApi public static final String EXTRA_SILENCE_ENABLED = "android.bluetooth.device.extra.SILENCE_ENABLED"; /** * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST} intent. * Loading Loading @@ -1591,6 +1613,70 @@ public final class BluetoothDevice implements Parcelable { return ACCESS_UNKNOWN; } /** * Set the Bluetooth device silence mode. * * When the {@link BluetoothDevice} enters silence mode, and the {@link BluetoothDevice} * is an active device (for A2DP or HFP), the active device for that profile * will be set to null. * If the {@link BluetoothDevice} exits silence mode while the A2DP or HFP * active device is null, the {@link BluetoothDevice} will be set as the * active device for that profile. * If the {@link BluetoothDevice} is disconnected, it exits silence mode. * If the {@link BluetoothDevice} is set as the active device for A2DP or * HFP, while silence mode is enabled, then the device will exit silence mode. * If the {@link BluetoothDevice} is in silence mode, AVRCP position change * event and HFP AG indicators will be disabled. * If the {@link BluetoothDevice} is not connected with A2DP or HFP, it cannot * enter silence mode. * * <p> Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. * * @param silence true to enter silence mode, false to exit * @return true on success, false on error. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setSilenceMode(boolean silence) { final IBluetooth service = sService; if (service == null) { return false; } try { if (getSilenceMode() == silence) { return true; } return service.setSilenceMode(this, silence); } catch (RemoteException e) { Log.e(TAG, "setSilenceMode fail", e); return false; } } /** * Get the device silence mode status * * <p> Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. * * @return true on device in silence mode, otherwise false. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean getSilenceMode() { final IBluetooth service = sService; if (service == null) { return false; } try { return service.getSilenceMode(this); } catch (RemoteException e) { Log.e(TAG, "getSilenceMode fail", e); return false; } } /** * Sets whether the phonebook access is allowed to this device. * <p>Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. Loading