diff options
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java index 1810818c98..2e748b9619 100644 --- a/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java +++ b/framework/java/android/bluetooth/BluetoothLeBroadcastMetadata.java @@ -478,6 +478,15 @@ public final class BluetoothLeBroadcastMetadata implements Parcelable { */ @SystemApi public @NonNull BluetoothLeBroadcastMetadata build() { + if (mSourceAddressType == BluetoothDevice.ADDRESS_TYPE_UNKNOWN) { + throw new IllegalArgumentException("SourceAddressTyp cannot be unknown"); + } + if (mSourceDevice == null) { + throw new IllegalArgumentException("SourceDevice cannot be null"); + } + if (mSubgroups.isEmpty()) { + throw new IllegalArgumentException("Must contain at least one subgroup"); + } return new BluetoothLeBroadcastMetadata(mSourceAddressType, mSourceDevice, mSourceAdvertisingSid, mBroadcastId, mPaSyncInterval, mIsEncrypted, mBroadcastCode, mPresentationDelayMicros, mSubgroups); |