diff options
author | Ivan Podogov <ginkage@google.com> | 2018-02-27 17:58:16 +0000 |
---|---|---|
committer | Hansong Zhang <hsz@google.com> | 2018-03-22 16:29:54 -0700 |
commit | 690633fc66ed83b20c75b7e116123ff3e078099f (patch) | |
tree | 703b36029bd014bf00952cde331c75cf5b7629b8 /framework/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java | |
parent | a70a16b3e9d2433b7517e679f630d9dab33eea8a (diff) |
HIDD: Address API Review concerns
* Replace bare field usage with getter methods;
* Remove Builder;
* Move BluetoothHidDeviceCallback to inner class;
* Remove toArray() and equals();
* Throw IllegalArgumentException where applicable;
* Add an Executor parameter before Callback;
Bug: 72168436, 72168126
Test: make update-api, make, make sl4a.Common
Change-Id: I13095458bf3ded7a376e8d20fd13df12ef426693
(cherry picked from commit f2f5dc355fa9a962ded0d29368535796aa4116d8)
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java b/framework/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java index 562c559edd..237082e4cb 100644 --- a/framework/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java +++ b/framework/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java @@ -19,7 +19,6 @@ package android.bluetooth; import android.os.Parcel; import android.os.Parcelable; -import java.util.Arrays; /** * Represents the Service Discovery Protocol (SDP) settings for a Bluetooth HID Device application. @@ -31,11 +30,11 @@ import java.util.Arrays; */ public final class BluetoothHidDeviceAppSdpSettings implements Parcelable { - public final String name; - public final String description; - public final String provider; - public final byte subclass; - public final byte[] descriptors; + private final String mName; + private final String mDescription; + private final String mProvider; + private final byte mSubclass; + private final byte[] mDescriptors; /** * Create a BluetoothHidDeviceAppSdpSettings object for the Bluetooth SDP record. @@ -52,24 +51,31 @@ public final class BluetoothHidDeviceAppSdpSettings implements Parcelable { */ public BluetoothHidDeviceAppSdpSettings( String name, String description, String provider, byte subclass, byte[] descriptors) { - this.name = name; - this.description = description; - this.provider = provider; - this.subclass = subclass; - this.descriptors = descriptors.clone(); + mName = name; + mDescription = description; + mProvider = provider; + mSubclass = subclass; + mDescriptors = descriptors.clone(); } - @Override - public boolean equals(Object o) { - if (o instanceof BluetoothHidDeviceAppSdpSettings) { - BluetoothHidDeviceAppSdpSettings sdp = (BluetoothHidDeviceAppSdpSettings) o; - return this.name.equals(sdp.name) - && this.description.equals(sdp.description) - && this.provider.equals(sdp.provider) - && this.subclass == sdp.subclass - && Arrays.equals(this.descriptors, sdp.descriptors); - } - return false; + public String getName() { + return mName; + } + + public String getDescription() { + return mDescription; + } + + public String getProvider() { + return mProvider; + } + + public byte getSubclass() { + return mSubclass; + } + + public byte[] getDescriptors() { + return mDescriptors; } @Override @@ -99,10 +105,10 @@ public final class BluetoothHidDeviceAppSdpSettings implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { - out.writeString(name); - out.writeString(description); - out.writeString(provider); - out.writeByte(subclass); - out.writeByteArray(descriptors); + out.writeString(mName); + out.writeString(mDescription); + out.writeString(mProvider); + out.writeByte(mSubclass); + out.writeByteArray(mDescriptors); } } |