summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/le/AdvertisingSetParameters.java
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2017-04-28 04:11:26 -0700
committerJakub Pawlowski <jpawlowski@google.com>2017-04-28 21:35:53 +0000
commit7a5b0a7efab9e41113a4527c3f8f61d20ff955ec (patch)
treec4c27ec0c40324f2601beaaeb02711a7a66585f0 /framework/java/android/bluetooth/le/AdvertisingSetParameters.java
parent631b07ec127d1dc659a86512364daf3740079980 (diff)
Bluetooth: bluetooth.le API fixes
Fix minor spelling problems. Throw IllegalStateException instead of IllegalArgumentException in build(). Bug: 37532634 Test: none Change-Id: I73b6f04aec98f5baffb06a363e2a3f71e8cec3c4
Diffstat (limited to 'framework/java/android/bluetooth/le/AdvertisingSetParameters.java')
-rw-r--r--framework/java/android/bluetooth/le/AdvertisingSetParameters.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/framework/java/android/bluetooth/le/AdvertisingSetParameters.java b/framework/java/android/bluetooth/le/AdvertisingSetParameters.java
index 31d8f48209..71c4484a94 100644
--- a/framework/java/android/bluetooth/le/AdvertisingSetParameters.java
+++ b/framework/java/android/bluetooth/le/AdvertisingSetParameters.java
@@ -242,7 +242,7 @@ public final class AdvertisingSetParameters implements Parcelable {
* non-connectable.
* Legacy advertisements can be both connectable and scannable. Non-legacy
* advertisements can be only scannable or only connectable.
- * @param connectable Controls whether the advertisment type will be
+ * @param connectable Controls whether the advertisement type will be
* connectable (true) or non-connectable (false).
*/
public Builder setConnectable(boolean connectable) {
@@ -254,7 +254,7 @@ public final class AdvertisingSetParameters implements Parcelable {
* Set whether the advertisement type should be scannable.
* Legacy advertisements can be both connectable and scannable. Non-legacy
* advertisements can be only scannable or only connectable.
- * @param scannable Controls whether the advertisment type will be
+ * @param scannable Controls whether the advertisement type will be
* scannable (true) or non-scannable (false).
*/
public Builder setScannable(boolean scannable) {
@@ -386,6 +386,7 @@ public final class AdvertisingSetParameters implements Parcelable {
/**
* Build the {@link AdvertisingSetParameters} object.
+ * @throws IllegalStateException if invalid combination of parameters is used.
*/
public AdvertisingSetParameters build() {
if (isLegacy) {
@@ -394,22 +395,22 @@ public final class AdvertisingSetParameters implements Parcelable {
}
if (connectable == true && scannable == false) {
- throw new IllegalArgumentException(
+ throw new IllegalStateException(
"Legacy advertisement can't be connectable and non-scannable");
}
if (includeTxPower) {
- throw new IllegalArgumentException(
+ throw new IllegalStateException(
"Legacy advertising can't include TX power level in header");
}
} else {
if (connectable && scannable) {
- throw new IllegalArgumentException(
+ throw new IllegalStateException(
"Advertising can't be both connectable and scannable");
}
if (isAnonymous && connectable) {
- throw new IllegalArgumentException(
+ throw new IllegalStateException(
"Advertising can't be both connectable and anonymous");
}
}