From 9d4abb5631c7719de8d919e0c37c9aee54354266 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Fri, 28 Apr 2017 04:11:26 -0700 Subject: [PATCH] Bluetooth: bluetooth.le API fixes Fix minor spelling problems. Throw IllegalStateException instead of IllegalArgumentException in build(). Bug: 37532634 Test: none Change-Id: I73b6f04aec98f5baffb06a363e2a3f71e8cec3c4 --- api/current.txt | 2 +- api/system-current.txt | 2 +- api/test-current.txt | 2 +- core/java/android/bluetooth/le/AdvertisingSet.java | 2 +- .../bluetooth/le/AdvertisingSetCallback.java | 2 +- .../bluetooth/le/AdvertisingSetParameters.java | 13 +++++++------ 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/api/current.txt b/api/current.txt index b20fe8fe07f5f..79141f6565ea5 100644 --- a/api/current.txt +++ b/api/current.txt @@ -7503,7 +7503,7 @@ package android.bluetooth.le { method public void setAdvertisingData(android.bluetooth.le.AdvertiseData); method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData); - method public void setPeriodicAdvertisingEnable(boolean); + method public void setPeriodicAdvertisingEnabled(boolean); method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters); method public void setScanResponseData(android.bluetooth.le.AdvertiseData); } diff --git a/api/system-current.txt b/api/system-current.txt index 6ee54cae8e029..e4f3f6d3848ab 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7808,7 +7808,7 @@ package android.bluetooth.le { method public void setAdvertisingData(android.bluetooth.le.AdvertiseData); method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData); - method public void setPeriodicAdvertisingEnable(boolean); + method public void setPeriodicAdvertisingEnabled(boolean); method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters); method public void setScanResponseData(android.bluetooth.le.AdvertiseData); } diff --git a/api/test-current.txt b/api/test-current.txt index 1c4db6cab1dff..d27aaacd74e6a 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -7512,7 +7512,7 @@ package android.bluetooth.le { method public void setAdvertisingData(android.bluetooth.le.AdvertiseData); method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters); method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData); - method public void setPeriodicAdvertisingEnable(boolean); + method public void setPeriodicAdvertisingEnabled(boolean); method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters); method public void setScanResponseData(android.bluetooth.le.AdvertiseData); } diff --git a/core/java/android/bluetooth/le/AdvertisingSet.java b/core/java/android/bluetooth/le/AdvertisingSet.java index 3021be1f8c023..1bc211cb83a2c 100644 --- a/core/java/android/bluetooth/le/AdvertisingSet.java +++ b/core/java/android/bluetooth/le/AdvertisingSet.java @@ -172,7 +172,7 @@ public final class AdvertisingSet { * * @param enable whether the periodic advertising should be enabled (true), or disabled (false). */ - public void setPeriodicAdvertisingEnable(boolean enable) { + public void setPeriodicAdvertisingEnabled(boolean enable) { try { gatt.setPeriodicAdvertisingEnable(this.advertiserId, enable); } catch (RemoteException e) { diff --git a/core/java/android/bluetooth/le/AdvertisingSetCallback.java b/core/java/android/bluetooth/le/AdvertisingSetCallback.java index 2c46e856db4a9..c3c16a479e718 100644 --- a/core/java/android/bluetooth/le/AdvertisingSetCallback.java +++ b/core/java/android/bluetooth/le/AdvertisingSetCallback.java @@ -135,7 +135,7 @@ public abstract class AdvertisingSetCallback { int status) {} /** - * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnable} + * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnabled} * indicating result of the operation. * * @param advertisingSet The advertising set. diff --git a/core/java/android/bluetooth/le/AdvertisingSetParameters.java b/core/java/android/bluetooth/le/AdvertisingSetParameters.java index 31d8f482090db..71c4484a94748 100644 --- a/core/java/android/bluetooth/le/AdvertisingSetParameters.java +++ b/core/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"); } }