Fix checkstyle errors (2/2)
* Manual style corrections with IDE assistance
* Variable name refactors are done through IDE
* Corrected general style errors such as:
- "final private var" -> "private final var"
- "&&", "+", "||" should not be at the end of line
- Non-static private variable should be like "mVar"
- Private static variable should be like "sVar"
- Code file should always end with newline
- Inherited methods should be annotated with @Override
and no @hide tags
- Public methods should always have a JavaDoc entry
- "int[] array" is preferred over "int array[]"
- private methods should be accessed without "this."
when there is no name collisions.
- "boolean ? true : false" -> boolean
- "boolean ? false : true" -> !boolean
- "boolean == true" OR "boolean != false" -> boolean
- "boolean != true" OR "boolean == false" -> !boolean
Bug: 63596319
Test: make checkbuild, no functional changes
Change-Id: Iabdc2be912a32dd63a53213d175cf1bfef268ccd
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index 7d6879d..7841b83 100644
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -187,7 +187,7 @@
private IBluetoothA2dp mService;
private BluetoothAdapter mAdapter;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -274,6 +274,7 @@
}
}
+ @Override
public void finalize() {
// The empty finalize needs to be kept or the
// cts signature tests would fail.
@@ -304,8 +305,7 @@
if (DBG) log("connect(" + device + ")");
try {
mServiceLock.readLock().lock();
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
return mService.connect(device);
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -347,8 +347,7 @@
if (DBG) log("disconnect(" + device + ")");
try {
mServiceLock.readLock().lock();
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
return mService.disconnect(device);
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -364,6 +363,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getConnectedDevices() {
if (VDBG) log("getConnectedDevices()");
try {
@@ -384,6 +384,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
if (VDBG) log("getDevicesMatchingStates()");
try {
@@ -404,6 +405,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getConnectionState(BluetoothDevice device) {
if (VDBG) log("getState(" + device + ")");
try {
@@ -443,8 +445,8 @@
mServiceLock.readLock().lock();
if (mService != null && isEnabled()
&& isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
return mService.setPriority(device, priority);
@@ -758,9 +760,9 @@
*/
public void setOptionalCodecsEnabled(BluetoothDevice device, int value) {
try {
- if (value != BluetoothA2dp.OPTIONAL_CODECS_PREF_UNKNOWN &&
- value != BluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED &&
- value != BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED) {
+ if (value != BluetoothA2dp.OPTIONAL_CODECS_PREF_UNKNOWN
+ && value != BluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED
+ && value != BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED) {
Log.e(TAG, "Invalid value passed to setOptionalCodecsEnabled: " + value);
return;
}
diff --git a/core/java/android/bluetooth/BluetoothA2dpSink.java b/core/java/android/bluetooth/BluetoothA2dpSink.java
index 78dab1b..611531c 100755
--- a/core/java/android/bluetooth/BluetoothA2dpSink.java
+++ b/core/java/android/bluetooth/BluetoothA2dpSink.java
@@ -120,15 +120,15 @@
* This extra represents the current audio configuration of the A2DP source device.
* {@see BluetoothAudioConfig}
*/
- public static final String EXTRA_AUDIO_CONFIG
- = "android.bluetooth.a2dp-sink.profile.extra.AUDIO_CONFIG";
+ public static final String EXTRA_AUDIO_CONFIG =
+ "android.bluetooth.a2dp-sink.profile.extra.AUDIO_CONFIG";
private Context mContext;
private ServiceListener mServiceListener;
private IBluetoothA2dpSink mService;
private BluetoothAdapter mAdapter;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -212,6 +212,7 @@
}
}
+ @Override
public void finalize() {
close();
}
@@ -239,8 +240,7 @@
*/
public boolean connect(BluetoothDevice device) {
if (DBG) log("connect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.connect(device);
} catch (RemoteException e) {
@@ -279,8 +279,7 @@
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) log("disconnect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.disconnect(device);
} catch (RemoteException e) {
@@ -295,6 +294,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getConnectedDevices() {
if (VDBG) log("getConnectedDevices()");
if (mService != null && isEnabled()) {
@@ -312,6 +312,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
if (VDBG) log("getDevicesMatchingStates()");
if (mService != null && isEnabled()) {
@@ -329,6 +330,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getConnectionState(BluetoothDevice device) {
if (VDBG) log("getState(" + device + ")");
if (mService != null && isEnabled()
@@ -389,8 +391,8 @@
if (DBG) log("setPriority(" + device + ", " + priority + ")");
if (mService != null && isEnabled()
&& isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
diff --git a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
index da2aba7..43b79db 100644
--- a/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
+++ b/core/java/android/bluetooth/BluetoothActivityEnergyInfo.java
@@ -87,6 +87,8 @@
}
};
+
+ @Override
@SuppressWarnings("unchecked")
public void writeToParcel(Parcel out, int flags) {
out.writeLong(mTimestamp);
@@ -98,6 +100,7 @@
out.writeTypedArray(mUidTraffic, flags);
}
+ @Override
public int describeContents() {
return 0;
}
@@ -158,8 +161,7 @@
* @return if the record is valid
*/
public boolean isValid() {
- return ((mControllerTxTimeMs >= 0) &&
- (mControllerRxTimeMs >= 0) &&
- (mControllerIdleTimeMs >= 0));
+ return ((mControllerTxTimeMs >= 0) && (mControllerRxTimeMs >= 0)
+ && (mControllerIdleTimeMs >= 0));
}
}
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 1b9ce88..70591d4 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -2191,7 +2191,7 @@
}
}
- final private IBluetoothManagerCallback mManagerCallback =
+ private final IBluetoothManagerCallback mManagerCallback =
new IBluetoothManagerCallback.Stub() {
public void onBluetoothServiceUp(IBluetooth bluetoothService) {
if (DBG) Log.d(TAG, "onBluetoothServiceUp: " + bluetoothService);
@@ -2255,7 +2255,7 @@
* @hide
*/
public boolean enableNoAutoConnect() {
- if (isEnabled() == true) {
+ if (isEnabled()) {
if (DBG) Log.d(TAG, "enableNoAutoConnect(): BT already enabled!");
return true;
}
@@ -2376,7 +2376,7 @@
return mManagerService;
}
- final private ArrayList<IBluetoothManagerCallback> mProxyServiceStateCallbacks =
+ private final ArrayList<IBluetoothManagerCallback> mProxyServiceStateCallbacks =
new ArrayList<IBluetoothManagerCallback>();
/*package*/ IBluetooth getBluetoothService(IBluetoothManagerCallback cb) {
diff --git a/core/java/android/bluetooth/BluetoothAudioConfig.java b/core/java/android/bluetooth/BluetoothAudioConfig.java
index 238bf84..a441056 100644
--- a/core/java/android/bluetooth/BluetoothAudioConfig.java
+++ b/core/java/android/bluetooth/BluetoothAudioConfig.java
@@ -42,9 +42,8 @@
public boolean equals(Object o) {
if (o instanceof BluetoothAudioConfig) {
BluetoothAudioConfig bac = (BluetoothAudioConfig) o;
- return (bac.mSampleRate == mSampleRate &&
- bac.mChannelConfig == mChannelConfig &&
- bac.mAudioFormat == mAudioFormat);
+ return (bac.mSampleRate == mSampleRate && bac.mChannelConfig == mChannelConfig
+ && bac.mAudioFormat == mAudioFormat);
}
return false;
}
@@ -60,6 +59,7 @@
+ ",mAudioFormat:" + mAudioFormat + "}";
}
+ @Override
public int describeContents() {
return 0;
}
@@ -78,6 +78,7 @@
}
};
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mSampleRate);
out.writeInt(mChannelConfig);
diff --git a/core/java/android/bluetooth/BluetoothAvrcpController.java b/core/java/android/bluetooth/BluetoothAvrcpController.java
index 1a0ae14..7528aa9 100644
--- a/core/java/android/bluetooth/BluetoothAvrcpController.java
+++ b/core/java/android/bluetooth/BluetoothAvrcpController.java
@@ -84,7 +84,7 @@
private IBluetoothAvrcpController mService;
private BluetoothAdapter mAdapter;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -168,6 +168,7 @@
}
}
+ @Override
public void finalize() {
close();
}
@@ -175,6 +176,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getConnectedDevices() {
if (VDBG) log("getConnectedDevices()");
if (mService != null && isEnabled()) {
@@ -192,6 +194,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
if (VDBG) log("getDevicesMatchingStates()");
if (mService != null && isEnabled()) {
@@ -209,6 +212,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getConnectionState(BluetoothDevice device) {
if (VDBG) log("getState(" + device + ")");
if (mService != null && isEnabled()
@@ -261,7 +265,7 @@
return false;
}
- /*
+ /**
* Send Group Navigation Command to Remote.
* possible keycode values: next_grp, previous_grp defined above
*/
diff --git a/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java b/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
index 036d36d..3d3d80e 100644
--- a/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
+++ b/core/java/android/bluetooth/BluetoothAvrcpPlayerSettings.java
@@ -82,14 +82,14 @@
/**
* All track repeat/shuffle.
*
- * Applies to {@link SETTING_REPEAT}, {@link SETTING_SHUFFLE} and {@link SETTING_SCAN}.
+ * Applies to {@link #SETTING_REPEAT}, {@link #SETTING_SHUFFLE} and {@link #SETTING_SCAN}.
*/
public static final int STATE_ALL_TRACK = 0x03;
/**
* Group repeat/shuffle.
*
- * Applies to {@link SETTING_REPEAT}, {@link SETTING_SHUFFLE} and {@link SETTING_SCAN}.
+ * Applies to {@link #SETTING_REPEAT}, {@link #SETTING_SHUFFLE} and {@link #SETTING_SCAN}.
*/
public static final int STATE_GROUP = 0x04;
@@ -103,10 +103,12 @@
*/
private Map<Integer, Integer> mSettingsValue = new HashMap<Integer, Integer>();
+ @Override
public int describeContents() {
return 0;
}
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mSettings);
out.writeInt(mSettingsValue.size());
@@ -116,8 +118,8 @@
}
}
- public static final Parcelable.Creator<BluetoothAvrcpPlayerSettings> CREATOR
- = new Parcelable.Creator<BluetoothAvrcpPlayerSettings>() {
+ public static final Parcelable.Creator<BluetoothAvrcpPlayerSettings> CREATOR =
+ new Parcelable.Creator<BluetoothAvrcpPlayerSettings>() {
public BluetoothAvrcpPlayerSettings createFromParcel(Parcel in) {
return new BluetoothAvrcpPlayerSettings(in);
}
diff --git a/core/java/android/bluetooth/BluetoothClass.java b/core/java/android/bluetooth/BluetoothClass.java
index 2f6a793..57e4abb 100755
--- a/core/java/android/bluetooth/BluetoothClass.java
+++ b/core/java/android/bluetooth/BluetoothClass.java
@@ -81,6 +81,7 @@
return Integer.toHexString(mClass);
}
+ @Override
public int describeContents() {
return 0;
}
@@ -96,6 +97,7 @@
}
};
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mClass);
}
diff --git a/core/java/android/bluetooth/BluetoothCodecConfig.java b/core/java/android/bluetooth/BluetoothCodecConfig.java
index 1e463f7..e3a6e06 100644
--- a/core/java/android/bluetooth/BluetoothCodecConfig.java
+++ b/core/java/android/bluetooth/BluetoothCodecConfig.java
@@ -92,15 +92,15 @@
public boolean equals(Object o) {
if (o instanceof BluetoothCodecConfig) {
BluetoothCodecConfig other = (BluetoothCodecConfig) o;
- return (other.mCodecType == mCodecType &&
- other.mCodecPriority == mCodecPriority &&
- other.mSampleRate == mSampleRate &&
- other.mBitsPerSample == mBitsPerSample &&
- other.mChannelMode == mChannelMode &&
- other.mCodecSpecific1 == mCodecSpecific1 &&
- other.mCodecSpecific2 == mCodecSpecific2 &&
- other.mCodecSpecific3 == mCodecSpecific3 &&
- other.mCodecSpecific4 == mCodecSpecific4);
+ return (other.mCodecType == mCodecType
+ && other.mCodecPriority == mCodecPriority
+ && other.mSampleRate == mSampleRate
+ && other.mBitsPerSample == mBitsPerSample
+ && other.mChannelMode == mChannelMode
+ && other.mCodecSpecific1 == mCodecSpecific1
+ && other.mCodecSpecific2 == mCodecSpecific2
+ && other.mCodecSpecific3 == mCodecSpecific3
+ && other.mCodecSpecific4 == mCodecSpecific4);
}
return false;
}
@@ -118,9 +118,9 @@
* @return true if the object contains valid codec configuration, otherwise false.
*/
public boolean isValid() {
- return (mSampleRate != SAMPLE_RATE_NONE) &&
- (mBitsPerSample != BITS_PER_SAMPLE_NONE) &&
- (mChannelMode != CHANNEL_MODE_NONE);
+ return (mSampleRate != SAMPLE_RATE_NONE)
+ && (mBitsPerSample != BITS_PER_SAMPLE_NONE)
+ && (mChannelMode != CHANNEL_MODE_NONE);
}
/**
@@ -188,21 +188,22 @@
channelModeStr = appendCapabilityToString(channelModeStr, "STEREO");
}
- return "{codecName:" + getCodecName() +
- ",mCodecType:" + mCodecType +
- ",mCodecPriority:" + mCodecPriority +
- ",mSampleRate:" + String.format("0x%x", mSampleRate) +
- "(" + sampleRateStr + ")" +
- ",mBitsPerSample:" + String.format("0x%x", mBitsPerSample) +
- "(" + bitsPerSampleStr + ")" +
- ",mChannelMode:" + String.format("0x%x", mChannelMode) +
- "(" + channelModeStr + ")" +
- ",mCodecSpecific1:" + mCodecSpecific1 +
- ",mCodecSpecific2:" + mCodecSpecific2 +
- ",mCodecSpecific3:" + mCodecSpecific3 +
- ",mCodecSpecific4:" + mCodecSpecific4 + "}";
+ return "{codecName:" + getCodecName()
+ + ",mCodecType:" + mCodecType
+ + ",mCodecPriority:" + mCodecPriority
+ + ",mSampleRate:" + String.format("0x%x", mSampleRate)
+ + "(" + sampleRateStr + ")"
+ + ",mBitsPerSample:" + String.format("0x%x", mBitsPerSample)
+ + "(" + bitsPerSampleStr + ")"
+ + ",mChannelMode:" + String.format("0x%x", mChannelMode)
+ + "(" + channelModeStr + ")"
+ + ",mCodecSpecific1:" + mCodecSpecific1
+ + ",mCodecSpecific2:" + mCodecSpecific2
+ + ",mCodecSpecific3:" + mCodecSpecific3
+ + ",mCodecSpecific4:" + mCodecSpecific4 + "}";
}
+ @Override
public int describeContents() {
return 0;
}
@@ -231,6 +232,7 @@
}
};
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mCodecType);
out.writeInt(mCodecPriority);
@@ -396,8 +398,8 @@
* @return true if the audio feeding parameters are same, otherwise false
*/
public boolean sameAudioFeedingParameters(BluetoothCodecConfig other) {
- return (other != null && other.mSampleRate == mSampleRate &&
- other.mBitsPerSample == mBitsPerSample &&
- other.mChannelMode == mChannelMode);
+ return (other != null && other.mSampleRate == mSampleRate
+ && other.mBitsPerSample == mBitsPerSample
+ && other.mChannelMode == mChannelMode);
}
}
diff --git a/core/java/android/bluetooth/BluetoothCodecStatus.java b/core/java/android/bluetooth/BluetoothCodecStatus.java
index 61e2941..7ae4cb7 100644
--- a/core/java/android/bluetooth/BluetoothCodecStatus.java
+++ b/core/java/android/bluetooth/BluetoothCodecStatus.java
@@ -56,11 +56,10 @@
public boolean equals(Object o) {
if (o instanceof BluetoothCodecStatus) {
BluetoothCodecStatus other = (BluetoothCodecStatus) o;
- return (Objects.equals(other.mCodecConfig, mCodecConfig) &&
- Objects.equals(other.mCodecsLocalCapabilities,
- mCodecsLocalCapabilities) &&
- Objects.equals(other.mCodecsSelectableCapabilities,
- mCodecsSelectableCapabilities));
+ return (Objects.equals(other.mCodecConfig, mCodecConfig)
+ && Objects.equals(other.mCodecsLocalCapabilities, mCodecsLocalCapabilities)
+ && Objects.equals(other.mCodecsSelectableCapabilities,
+ mCodecsSelectableCapabilities));
}
return false;
}
@@ -73,12 +72,13 @@
@Override
public String toString() {
- return "{mCodecConfig:" + mCodecConfig +
- ",mCodecsLocalCapabilities:" + Arrays.toString(mCodecsLocalCapabilities) +
- ",mCodecsSelectableCapabilities:" + Arrays.toString(mCodecsSelectableCapabilities) +
- "}";
+ return "{mCodecConfig:" + mCodecConfig
+ + ",mCodecsLocalCapabilities:" + Arrays.toString(mCodecsLocalCapabilities)
+ + ",mCodecsSelectableCapabilities:" + Arrays.toString(mCodecsSelectableCapabilities)
+ + "}";
}
+ @Override
public int describeContents() {
return 0;
}
@@ -103,6 +103,7 @@
}
};
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeTypedObject(mCodecConfig, 0);
out.writeTypedArray(mCodecsLocalCapabilities, 0);
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 537d913..3ab2c4a 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -721,13 +721,13 @@
synchronized (BluetoothDevice.class) {
if (sService == null) {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- sService = adapter.getBluetoothService(mStateChangeCallback);
+ sService = adapter.getBluetoothService(sStateChangeCallback);
}
}
return sService;
}
- static IBluetoothManagerCallback mStateChangeCallback = new IBluetoothManagerCallback.Stub() {
+ static IBluetoothManagerCallback sStateChangeCallback = new IBluetoothManagerCallback.Stub() {
public void onBluetoothServiceUp(IBluetooth bluetoothService)
throws RemoteException {
@@ -796,6 +796,7 @@
return mAddress;
}
+ @Override
public int describeContents() {
return 0;
}
@@ -811,6 +812,7 @@
}
};
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(mAddress);
}
@@ -969,9 +971,9 @@
return false;
}
try {
- Log.i(TAG, "createBond() for device " + getAddress() +
- " called by pid: " + Process.myPid() +
- " tid: " + Process.myTid());
+ Log.i(TAG, "createBond() for device " + getAddress()
+ + " called by pid: " + Process.myPid()
+ + " tid: " + Process.myTid());
return sService.createBond(this, TRANSPORT_AUTO);
} catch (RemoteException e) {
Log.e(TAG, "", e);
@@ -1004,9 +1006,9 @@
throw new IllegalArgumentException(transport + " is not a valid Bluetooth transport");
}
try {
- Log.i(TAG, "createBond() for device " + getAddress() +
- " called by pid: " + Process.myPid() +
- " tid: " + Process.myTid());
+ Log.i(TAG, "createBond() for device " + getAddress()
+ + " called by pid: " + Process.myPid()
+ + " tid: " + Process.myTid());
return sService.createBond(this, transport);
} catch (RemoteException e) {
Log.e(TAG, "", e);
@@ -1085,9 +1087,9 @@
return false;
}
try {
- Log.i(TAG, "cancelBondProcess() for device " + getAddress() +
- " called by pid: " + Process.myPid() +
- " tid: " + Process.myTid());
+ Log.i(TAG, "cancelBondProcess() for device " + getAddress()
+ + " called by pid: " + Process.myPid()
+ + " tid: " + Process.myTid());
return sService.cancelBondProcess(this);
} catch (RemoteException e) {
Log.e(TAG, "", e);
@@ -1111,9 +1113,9 @@
return false;
}
try {
- Log.i(TAG, "removeBond() for device " + getAddress() +
- " called by pid: " + Process.myPid() +
- " tid: " + Process.myTid());
+ Log.i(TAG, "removeBond() for device " + getAddress()
+ + " called by pid: " + Process.myPid()
+ + " tid: " + Process.myTid());
return sService.removeBond(this);
} catch (RemoteException e) {
Log.e(TAG, "", e);
@@ -1143,8 +1145,8 @@
} catch (NullPointerException npe) {
// Handle case where bluetooth service proxy
// is already null.
- Log.e(TAG, "NullPointerException for getBondState() of device (" +
- getAddress() + ")", npe);
+ Log.e(TAG, "NullPointerException for getBondState() of device ("
+ + getAddress() + ")", npe);
}
return BOND_NONE;
}
@@ -1225,7 +1227,7 @@
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
public ParcelUuid[] getUuids() {
- if (sService == null || isBluetoothEnabled() == false) {
+ if (sService == null || !isBluetoothEnabled()) {
Log.e(TAG, "BT not enabled. Cannot get remote device Uuids");
return null;
}
@@ -1253,7 +1255,7 @@
@RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean fetchUuidsWithSdp() {
IBluetooth service = sService;
- if (service == null || isBluetoothEnabled() == false) {
+ if (service == null || !isBluetoothEnabled()) {
Log.e(TAG, "BT not enabled. Cannot fetchUuidsWithSdp");
return false;
}
@@ -1384,7 +1386,7 @@
boolean isBluetoothEnabled() {
boolean ret = false;
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- if (adapter != null && adapter.isEnabled() == true) {
+ if (adapter != null && adapter.isEnabled()) {
ret = true;
}
return ret;
@@ -1536,7 +1538,7 @@
* @hide
*/
public BluetoothSocket createRfcommSocket(int channel) throws IOException {
- if (isBluetoothEnabled() == false) {
+ if (!isBluetoothEnabled()) {
Log.e(TAG, "Bluetooth is not enabled");
throw new IOException();
}
@@ -1627,7 +1629,7 @@
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
public BluetoothSocket createRfcommSocketToServiceRecord(UUID uuid) throws IOException {
- if (isBluetoothEnabled() == false) {
+ if (!isBluetoothEnabled()) {
Log.e(TAG, "Bluetooth is not enabled");
throw new IOException();
}
@@ -1665,7 +1667,7 @@
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
public BluetoothSocket createInsecureRfcommSocketToServiceRecord(UUID uuid) throws IOException {
- if (isBluetoothEnabled() == false) {
+ if (!isBluetoothEnabled()) {
Log.e(TAG, "Bluetooth is not enabled");
throw new IOException();
}
@@ -1688,8 +1690,7 @@
* @hide
*/
public BluetoothSocket createInsecureRfcommSocket(int port) throws IOException {
-
- if (isBluetoothEnabled() == false) {
+ if (!isBluetoothEnabled()) {
Log.e(TAG, "Bluetooth is not enabled");
throw new IOException();
}
@@ -1708,8 +1709,7 @@
* @hide
*/
public BluetoothSocket createScoSocket() throws IOException {
-
- if (isBluetoothEnabled() == false) {
+ if (!isBluetoothEnabled()) {
Log.e(TAG, "Bluetooth is not enabled");
throw new IOException();
}
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java
index 8a3650c..759d772 100644
--- a/core/java/android/bluetooth/BluetoothGatt.java
+++ b/core/java/android/bluetooth/BluetoothGatt.java
@@ -352,8 +352,8 @@
|| status == GATT_INSUFFICIENT_ENCRYPTION)
&& (mAuthRetryState != AUTH_RETRY_STATE_MITM)) {
try {
- final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ?
- AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
+ final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE)
+ ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
mService.readCharacteristic(mClientIf, address, handle, authReq);
mAuthRetryState++;
return;
@@ -412,8 +412,8 @@
|| status == GATT_INSUFFICIENT_ENCRYPTION)
&& (mAuthRetryState != AUTH_RETRY_STATE_MITM)) {
try {
- final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ?
- AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
+ final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE)
+ ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
mService.writeCharacteristic(mClientIf, address, handle,
characteristic.getWriteType(), authReq,
characteristic.getValue());
@@ -495,8 +495,8 @@
|| status == GATT_INSUFFICIENT_ENCRYPTION)
&& (mAuthRetryState != AUTH_RETRY_STATE_MITM)) {
try {
- final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ?
- AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
+ final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE)
+ ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
mService.readDescriptor(mClientIf, address, handle, authReq);
mAuthRetryState++;
return;
@@ -543,8 +543,8 @@
|| status == GATT_INSUFFICIENT_ENCRYPTION)
&& (mAuthRetryState != AUTH_RETRY_STATE_MITM)) {
try {
- final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ?
- AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
+ final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE)
+ ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM;
mService.writeDescriptor(mClientIf, address, handle,
authReq, descriptor.getValue());
mAuthRetryState++;
@@ -601,8 +601,8 @@
@Override
public void onReadRemoteRssi(String address, int rssi, int status) {
if (VDBG) {
- Log.d(TAG, "onReadRemoteRssi() - Device=" + address +
- " rssi=" + rssi + " status=" + status);
+ Log.d(TAG, "onReadRemoteRssi() - Device=" + address
+ + " rssi=" + rssi + " status=" + status);
}
if (!address.equals(mDevice.getAddress())) {
return;
@@ -624,8 +624,8 @@
@Override
public void onConfigureMTU(String address, int mtu, int status) {
if (DBG) {
- Log.d(TAG, "onConfigureMTU() - Device=" + address +
- " mtu=" + mtu + " status=" + status);
+ Log.d(TAG, "onConfigureMTU() - Device=" + address
+ + " mtu=" + mtu + " status=" + status);
}
if (!address.equals(mDevice.getAddress())) {
return;
@@ -649,9 +649,9 @@
public void onConnectionUpdated(String address, int interval, int latency,
int timeout, int status) {
if (DBG) {
- Log.d(TAG, "onConnectionUpdated() - Device=" + address +
- " interval=" + interval + " latency=" + latency +
- " timeout=" + timeout + " status=" + status);
+ Log.d(TAG, "onConnectionUpdated() - Device=" + address
+ + " interval=" + interval + " latency=" + latency
+ + " timeout=" + timeout + " status=" + status);
}
if (!address.equals(mDevice.getAddress())) {
return;
@@ -704,10 +704,10 @@
/*package*/ BluetoothGattService getService(BluetoothDevice device, UUID uuid,
int instanceId, int type) {
for (BluetoothGattService svc : mServices) {
- if (svc.getDevice().equals(device) &&
- svc.getType() == type &&
- svc.getInstanceId() == instanceId &&
- svc.getUuid().equals(uuid)) {
+ if (svc.getDevice().equals(device)
+ && svc.getType() == type
+ && svc.getInstanceId() == instanceId
+ && svc.getUuid().equals(uuid)) {
return svc;
}
}
@@ -1043,8 +1043,7 @@
*/
public BluetoothGattService getService(UUID uuid) {
for (BluetoothGattService service : mServices) {
- if (service.getDevice().equals(mDevice) &&
- service.getUuid().equals(uuid)) {
+ if (service.getDevice().equals(mDevice) && service.getUuid().equals(uuid)) {
return service;
}
}
@@ -1065,8 +1064,7 @@
* @return true, if the read operation was initiated successfully
*/
public boolean readCharacteristic(BluetoothGattCharacteristic characteristic) {
- if ((characteristic.getProperties() &
- BluetoothGattCharacteristic.PROPERTY_READ) == 0) {
+ if ((characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_READ) == 0) {
return false;
}
@@ -1145,8 +1143,8 @@
*/
public boolean writeCharacteristic(BluetoothGattCharacteristic characteristic) {
if ((characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_WRITE) == 0
- && (characteristic.getProperties() &
- BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) == 0) {
+ && (characteristic.getProperties()
+ & BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) == 0) {
return false;
}
@@ -1480,8 +1478,8 @@
* @throws IllegalArgumentException If the parameters are outside of their specified range.
*/
public boolean requestConnectionPriority(int connectionPriority) {
- if (connectionPriority < CONNECTION_PRIORITY_BALANCED ||
- connectionPriority > CONNECTION_PRIORITY_LOW_POWER) {
+ if (connectionPriority < CONNECTION_PRIORITY_BALANCED
+ || connectionPriority > CONNECTION_PRIORITY_LOW_POWER) {
throw new IllegalArgumentException("connectionPriority not within valid range");
}
@@ -1517,8 +1515,8 @@
*/
@Override
public List<BluetoothDevice> getConnectedDevices() {
- throw new UnsupportedOperationException
- ("Use BluetoothManager#getConnectedDevices instead.");
+ throw new UnsupportedOperationException(
+ "Use BluetoothManager#getConnectedDevices instead.");
}
/**
@@ -1530,7 +1528,7 @@
*/
@Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
- throw new UnsupportedOperationException
- ("Use BluetoothManager#getDevicesMatchingConnectionStates instead.");
+ throw new UnsupportedOperationException(
+ "Use BluetoothManager#getDevicesMatchingConnectionStates instead.");
}
}
diff --git a/core/java/android/bluetooth/BluetoothGattCharacteristic.java b/core/java/android/bluetooth/BluetoothGattCharacteristic.java
index 4816804..2c12403 100644
--- a/core/java/android/bluetooth/BluetoothGattCharacteristic.java
+++ b/core/java/android/bluetooth/BluetoothGattCharacteristic.java
@@ -283,13 +283,12 @@
}
}
- /**
- * @hide
- */
+ @Override
public int describeContents() {
return 0;
}
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(new ParcelUuid(mUuid), 0);
out.writeInt(mInstance);
@@ -300,8 +299,8 @@
out.writeTypedList(mDescriptors);
}
- public static final Parcelable.Creator<BluetoothGattCharacteristic> CREATOR
- = new Parcelable.Creator<BluetoothGattCharacteristic>() {
+ public static final Parcelable.Creator<BluetoothGattCharacteristic> CREATOR =
+ new Parcelable.Creator<BluetoothGattCharacteristic>() {
public BluetoothGattCharacteristic createFromParcel(Parcel in) {
return new BluetoothGattCharacteristic(in);
}
diff --git a/core/java/android/bluetooth/BluetoothGattDescriptor.java b/core/java/android/bluetooth/BluetoothGattDescriptor.java
index 8f6eb68..217a5ab 100644
--- a/core/java/android/bluetooth/BluetoothGattDescriptor.java
+++ b/core/java/android/bluetooth/BluetoothGattDescriptor.java
@@ -162,21 +162,20 @@
mPermissions = permissions;
}
- /**
- * @hide
- */
+ @Override
public int describeContents() {
return 0;
}
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(new ParcelUuid(mUuid), 0);
out.writeInt(mInstance);
out.writeInt(mPermissions);
}
- public static final Parcelable.Creator<BluetoothGattDescriptor> CREATOR
- = new Parcelable.Creator<BluetoothGattDescriptor>() {
+ public static final Parcelable.Creator<BluetoothGattDescriptor> CREATOR =
+ new Parcelable.Creator<BluetoothGattDescriptor>() {
public BluetoothGattDescriptor createFromParcel(Parcel in) {
return new BluetoothGattDescriptor(in);
}
diff --git a/core/java/android/bluetooth/BluetoothGattIncludedService.java b/core/java/android/bluetooth/BluetoothGattIncludedService.java
index 2a42a78..bccf20e 100644
--- a/core/java/android/bluetooth/BluetoothGattIncludedService.java
+++ b/core/java/android/bluetooth/BluetoothGattIncludedService.java
@@ -52,18 +52,20 @@
mServiceType = serviceType;
}
+ @Override
public int describeContents() {
return 0;
}
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(new ParcelUuid(mUuid), 0);
out.writeInt(mInstanceId);
out.writeInt(mServiceType);
}
- public static final Parcelable.Creator<BluetoothGattIncludedService> CREATOR
- = new Parcelable.Creator<BluetoothGattIncludedService>() {
+ public static final Parcelable.Creator<BluetoothGattIncludedService> CREATOR =
+ new Parcelable.Creator<BluetoothGattIncludedService>() {
public BluetoothGattIncludedService createFromParcel(Parcel in) {
return new BluetoothGattIncludedService(in);
}
diff --git a/core/java/android/bluetooth/BluetoothGattServer.java b/core/java/android/bluetooth/BluetoothGattServer.java
index 7b86a17..4ed2500 100644
--- a/core/java/android/bluetooth/BluetoothGattServer.java
+++ b/core/java/android/bluetooth/BluetoothGattServer.java
@@ -356,9 +356,9 @@
public void onConnectionUpdated(String address, int interval, int latency,
int timeout, int status) {
if (DBG) {
- Log.d(TAG, "onConnectionUpdated() - Device=" + address +
- " interval=" + interval + " latency=" + latency +
- " timeout=" + timeout + " status=" + status);
+ Log.d(TAG, "onConnectionUpdated() - Device=" + address
+ + " interval=" + interval + " latency=" + latency
+ + " timeout=" + timeout + " status=" + status);
}
BluetoothDevice device = mAdapter.getRemoteDevice(address);
if (device == null) return;
@@ -505,9 +505,9 @@
*/
/*package*/ BluetoothGattService getService(UUID uuid, int instanceId, int type) {
for (BluetoothGattService svc : mServices) {
- if (svc.getType() == type &&
- svc.getInstanceId() == instanceId &&
- svc.getUuid().equals(uuid)) {
+ if (svc.getType() == type
+ && svc.getInstanceId() == instanceId
+ && svc.getUuid().equals(uuid)) {
return svc;
}
}
@@ -543,8 +543,8 @@
if (mService == null || mServerIf == 0) return false;
try {
- mService.serverConnect(mServerIf, device.getAddress(),
- autoConnect ? false : true, mTransport); // autoConnect is inverse of "isDirect"
+ // autoConnect is inverse of "isDirect"
+ mService.serverConnect(mServerIf, device.getAddress(), !autoConnect, mTransport);
} catch (RemoteException e) {
Log.e(TAG, "", e);
return false;
@@ -822,8 +822,8 @@
*/
@Override
public List<BluetoothDevice> getConnectedDevices() {
- throw new UnsupportedOperationException
- ("Use BluetoothManager#getConnectedDevices instead.");
+ throw new UnsupportedOperationException(
+ "Use BluetoothManager#getConnectedDevices instead.");
}
/**
@@ -835,7 +835,7 @@
*/
@Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
- throw new UnsupportedOperationException
- ("Use BluetoothManager#getDevicesMatchingConnectionStates instead.");
+ throw new UnsupportedOperationException(
+ "Use BluetoothManager#getDevicesMatchingConnectionStates instead.");
}
}
diff --git a/core/java/android/bluetooth/BluetoothGattServerCallback.java b/core/java/android/bluetooth/BluetoothGattServerCallback.java
index e72577d..22eba35 100644
--- a/core/java/android/bluetooth/BluetoothGattServerCallback.java
+++ b/core/java/android/bluetooth/BluetoothGattServerCallback.java
@@ -184,7 +184,7 @@
/**
* Callback indicating the connection parameters were updated.
*
- * @param device The remote device involved
+ * @param gatt The remote device involved
* @param interval Connection interval used on this connection, 1.25ms unit. Valid range is from
* 6 (7.5ms) to 3200 (4000ms).
* @param latency Slave latency for the connection in number of connection events. Valid range
diff --git a/core/java/android/bluetooth/BluetoothGattService.java b/core/java/android/bluetooth/BluetoothGattService.java
index db820d8..ce1dc1c 100644
--- a/core/java/android/bluetooth/BluetoothGattService.java
+++ b/core/java/android/bluetooth/BluetoothGattService.java
@@ -163,8 +163,8 @@
out.writeTypedList(includedServices);
}
- public static final Parcelable.Creator<BluetoothGattService> CREATOR
- = new Parcelable.Creator<BluetoothGattService>() {
+ public static final Parcelable.Creator<BluetoothGattService> CREATOR =
+ new Parcelable.Creator<BluetoothGattService>() {
public BluetoothGattService createFromParcel(Parcel in) {
return new BluetoothGattService(in);
}
@@ -217,7 +217,7 @@
* @hide
*/
/*package*/ void setDevice(BluetoothDevice device) {
- this.mDevice = device;
+ mDevice = device;
}
/**
@@ -383,6 +383,6 @@
* @hide
*/
public void setAdvertisePreferred(boolean advertisePreferred) {
- this.mAdvertisePreferred = advertisePreferred;
+ mAdvertisePreferred = advertisePreferred;
}
}
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 132f383..be1ce63 100644
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -309,7 +309,7 @@
private IBluetoothHeadset mService;
private BluetoothAdapter mAdapter;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -418,8 +418,7 @@
*/
public boolean connect(BluetoothDevice device) {
if (DBG) log("connect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.connect(device);
} catch (RemoteException e) {
@@ -458,8 +457,7 @@
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) log("disconnect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.disconnect(device);
} catch (RemoteException e) {
@@ -474,6 +472,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getConnectedDevices() {
if (VDBG) log("getConnectedDevices()");
if (mService != null && isEnabled()) {
@@ -491,6 +490,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
if (VDBG) log("getDevicesMatchingStates()");
if (mService != null && isEnabled()) {
@@ -508,10 +508,10 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getConnectionState(BluetoothDevice device) {
if (VDBG) log("getConnectionState(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getConnectionState(device);
} catch (RemoteException e) {
@@ -540,10 +540,9 @@
*/
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
@@ -572,8 +571,7 @@
*/
public int getPriority(BluetoothDevice device) {
if (VDBG) log("getPriority(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getPriority(device);
} catch (RemoteException e) {
@@ -607,8 +605,7 @@
*/
public boolean startVoiceRecognition(BluetoothDevice device) {
if (DBG) log("startVoiceRecognition()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.startVoiceRecognition(device);
} catch (RemoteException e) {
@@ -630,8 +627,7 @@
*/
public boolean stopVoiceRecognition(BluetoothDevice device) {
if (DBG) log("stopVoiceRecognition()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.stopVoiceRecognition(device);
} catch (RemoteException e) {
@@ -652,8 +648,7 @@
*/
public boolean isAudioConnected(BluetoothDevice device) {
if (VDBG) log("isAudioConnected()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.isAudioConnected(device);
} catch (RemoteException e) {
@@ -679,8 +674,7 @@
*/
public int getBatteryUsageHint(BluetoothDevice device) {
if (VDBG) log("getBatteryUsageHint()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getBatteryUsageHint(device);
} catch (RemoteException e) {
@@ -1012,8 +1006,7 @@
if (command == null) {
throw new IllegalArgumentException("command is null");
}
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.sendVendorSpecificResultCode(device, command, arg);
} catch (RemoteException e) {
@@ -1083,16 +1076,16 @@
* Send Headset the BIND response from AG to report change in the status of the
* HF indicators to the headset
*
- * @param ind_id Assigned Number of the indicator (defined by SIG)
- * @param ind_status possible values- false-Indicator is disabled, no value changes shall be
+ * @param indId Assigned Number of the indicator (defined by SIG)
+ * @param indStatus possible values- false-Indicator is disabled, no value changes shall be
* sent for this indicator true-Indicator is enabled, value changes may be sent for this
* indicator
* @hide
*/
- public void bindResponse(int ind_id, boolean ind_status) {
+ public void bindResponse(int indId, boolean indStatus) {
if (mService != null && isEnabled()) {
try {
- mService.bindResponse(ind_id, ind_status);
+ mService.bindResponse(indId, indStatus);
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
@@ -1102,8 +1095,8 @@
}
}
- private final IBluetoothProfileServiceConnection mConnection
- = new IBluetoothProfileServiceConnection.Stub() {
+ private final IBluetoothProfileServiceConnection mConnection =
+ new IBluetoothProfileServiceConnection.Stub() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
if (DBG) Log.d(TAG, "Proxy object connected");
diff --git a/core/java/android/bluetooth/BluetoothHeadsetClient.java b/core/java/android/bluetooth/BluetoothHeadsetClient.java
index c775cd7..7ed2d2e 100644
--- a/core/java/android/bluetooth/BluetoothHeadsetClient.java
+++ b/core/java/android/bluetooth/BluetoothHeadsetClient.java
@@ -250,53 +250,53 @@
/**
* AG feature: three way calling.
*/
- public final static String EXTRA_AG_FEATURE_3WAY_CALLING =
+ public static final String EXTRA_AG_FEATURE_3WAY_CALLING =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_3WAY_CALLING";
/**
* AG feature: voice recognition.
*/
- public final static String EXTRA_AG_FEATURE_VOICE_RECOGNITION =
+ public static final String EXTRA_AG_FEATURE_VOICE_RECOGNITION =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_VOICE_RECOGNITION";
/**
* AG feature: fetching phone number for voice tagging procedure.
*/
- public final static String EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT =
+ public static final String EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ATTACH_NUMBER_TO_VT";
/**
* AG feature: ability to reject incoming call.
*/
- public final static String EXTRA_AG_FEATURE_REJECT_CALL =
+ public static final String EXTRA_AG_FEATURE_REJECT_CALL =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_REJECT_CALL";
/**
* AG feature: enhanced call handling (terminate specific call, private consultation).
*/
- public final static String EXTRA_AG_FEATURE_ECC =
+ public static final String EXTRA_AG_FEATURE_ECC =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ECC";
/**
* AG feature: response and hold.
*/
- public final static String EXTRA_AG_FEATURE_RESPONSE_AND_HOLD =
+ public static final String EXTRA_AG_FEATURE_RESPONSE_AND_HOLD =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RESPONSE_AND_HOLD";
/**
* AG call handling feature: accept held or waiting call in three way calling scenarios.
*/
- public final static String EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL =
+ public static final String EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL";
/**
* AG call handling feature: release held or waiting call in three way calling scenarios.
*/
- public final static String EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL =
+ public static final String EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL";
/**
* AG call handling feature: release active call and accept held or waiting call in three way
* calling scenarios.
*/
- public final static String EXTRA_AG_FEATURE_RELEASE_AND_ACCEPT =
+ public static final String EXTRA_AG_FEATURE_RELEASE_AND_ACCEPT =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_RELEASE_AND_ACCEPT";
/**
* AG call handling feature: merge two calls, held and active - multi party conference mode.
*/
- public final static String EXTRA_AG_FEATURE_MERGE =
+ public static final String EXTRA_AG_FEATURE_MERGE =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_MERGE";
/**
* AG call handling feature: merge calls and disconnect from multi party
@@ -304,61 +304,61 @@
* Note that this feature needs to be supported by mobile network operator
* as it requires connection and billing transfer.
*/
- public final static String EXTRA_AG_FEATURE_MERGE_AND_DETACH =
+ public static final String EXTRA_AG_FEATURE_MERGE_AND_DETACH =
"android.bluetooth.headsetclient.extra.EXTRA_AG_FEATURE_MERGE_AND_DETACH";
/* Action result codes */
- public final static int ACTION_RESULT_OK = 0;
- public final static int ACTION_RESULT_ERROR = 1;
- public final static int ACTION_RESULT_ERROR_NO_CARRIER = 2;
- public final static int ACTION_RESULT_ERROR_BUSY = 3;
- public final static int ACTION_RESULT_ERROR_NO_ANSWER = 4;
- public final static int ACTION_RESULT_ERROR_DELAYED = 5;
- public final static int ACTION_RESULT_ERROR_BLACKLISTED = 6;
- public final static int ACTION_RESULT_ERROR_CME = 7;
+ public static final int ACTION_RESULT_OK = 0;
+ public static final int ACTION_RESULT_ERROR = 1;
+ public static final int ACTION_RESULT_ERROR_NO_CARRIER = 2;
+ public static final int ACTION_RESULT_ERROR_BUSY = 3;
+ public static final int ACTION_RESULT_ERROR_NO_ANSWER = 4;
+ public static final int ACTION_RESULT_ERROR_DELAYED = 5;
+ public static final int ACTION_RESULT_ERROR_BLACKLISTED = 6;
+ public static final int ACTION_RESULT_ERROR_CME = 7;
/* Detailed CME error codes */
- public final static int CME_PHONE_FAILURE = 0;
- public final static int CME_NO_CONNECTION_TO_PHONE = 1;
- public final static int CME_OPERATION_NOT_ALLOWED = 3;
- public final static int CME_OPERATION_NOT_SUPPORTED = 4;
- public final static int CME_PHSIM_PIN_REQUIRED = 5;
- public final static int CME_PHFSIM_PIN_REQUIRED = 6;
- public final static int CME_PHFSIM_PUK_REQUIRED = 7;
- public final static int CME_SIM_NOT_INSERTED = 10;
- public final static int CME_SIM_PIN_REQUIRED = 11;
- public final static int CME_SIM_PUK_REQUIRED = 12;
- public final static int CME_SIM_FAILURE = 13;
- public final static int CME_SIM_BUSY = 14;
- public final static int CME_SIM_WRONG = 15;
- public final static int CME_INCORRECT_PASSWORD = 16;
- public final static int CME_SIM_PIN2_REQUIRED = 17;
- public final static int CME_SIM_PUK2_REQUIRED = 18;
- public final static int CME_MEMORY_FULL = 20;
- public final static int CME_INVALID_INDEX = 21;
- public final static int CME_NOT_FOUND = 22;
- public final static int CME_MEMORY_FAILURE = 23;
- public final static int CME_TEXT_STRING_TOO_LONG = 24;
- public final static int CME_INVALID_CHARACTER_IN_TEXT_STRING = 25;
- public final static int CME_DIAL_STRING_TOO_LONG = 26;
- public final static int CME_INVALID_CHARACTER_IN_DIAL_STRING = 27;
- public final static int CME_NO_NETWORK_SERVICE = 30;
- public final static int CME_NETWORK_TIMEOUT = 31;
- public final static int CME_EMERGENCY_SERVICE_ONLY = 32;
- public final static int CME_NO_SIMULTANOUS_VOIP_CS_CALLS = 33;
- public final static int CME_NOT_SUPPORTED_FOR_VOIP = 34;
- public final static int CME_SIP_RESPONSE_CODE = 35;
- public final static int CME_NETWORK_PERSONALIZATION_PIN_REQUIRED = 40;
- public final static int CME_NETWORK_PERSONALIZATION_PUK_REQUIRED = 41;
- public final static int CME_NETWORK_SUBSET_PERSONALIZATION_PIN_REQUIRED = 42;
- public final static int CME_NETWORK_SUBSET_PERSONALIZATION_PUK_REQUIRED = 43;
- public final static int CME_SERVICE_PROVIDER_PERSONALIZATION_PIN_REQUIRED = 44;
- public final static int CME_SERVICE_PROVIDER_PERSONALIZATION_PUK_REQUIRED = 45;
- public final static int CME_CORPORATE_PERSONALIZATION_PIN_REQUIRED = 46;
- public final static int CME_CORPORATE_PERSONALIZATION_PUK_REQUIRED = 47;
- public final static int CME_HIDDEN_KEY_REQUIRED = 48;
- public final static int CME_EAP_NOT_SUPPORTED = 49;
- public final static int CME_INCORRECT_PARAMETERS = 50;
+ public static final int CME_PHONE_FAILURE = 0;
+ public static final int CME_NO_CONNECTION_TO_PHONE = 1;
+ public static final int CME_OPERATION_NOT_ALLOWED = 3;
+ public static final int CME_OPERATION_NOT_SUPPORTED = 4;
+ public static final int CME_PHSIM_PIN_REQUIRED = 5;
+ public static final int CME_PHFSIM_PIN_REQUIRED = 6;
+ public static final int CME_PHFSIM_PUK_REQUIRED = 7;
+ public static final int CME_SIM_NOT_INSERTED = 10;
+ public static final int CME_SIM_PIN_REQUIRED = 11;
+ public static final int CME_SIM_PUK_REQUIRED = 12;
+ public static final int CME_SIM_FAILURE = 13;
+ public static final int CME_SIM_BUSY = 14;
+ public static final int CME_SIM_WRONG = 15;
+ public static final int CME_INCORRECT_PASSWORD = 16;
+ public static final int CME_SIM_PIN2_REQUIRED = 17;
+ public static final int CME_SIM_PUK2_REQUIRED = 18;
+ public static final int CME_MEMORY_FULL = 20;
+ public static final int CME_INVALID_INDEX = 21;
+ public static final int CME_NOT_FOUND = 22;
+ public static final int CME_MEMORY_FAILURE = 23;
+ public static final int CME_TEXT_STRING_TOO_LONG = 24;
+ public static final int CME_INVALID_CHARACTER_IN_TEXT_STRING = 25;
+ public static final int CME_DIAL_STRING_TOO_LONG = 26;
+ public static final int CME_INVALID_CHARACTER_IN_DIAL_STRING = 27;
+ public static final int CME_NO_NETWORK_SERVICE = 30;
+ public static final int CME_NETWORK_TIMEOUT = 31;
+ public static final int CME_EMERGENCY_SERVICE_ONLY = 32;
+ public static final int CME_NO_SIMULTANOUS_VOIP_CS_CALLS = 33;
+ public static final int CME_NOT_SUPPORTED_FOR_VOIP = 34;
+ public static final int CME_SIP_RESPONSE_CODE = 35;
+ public static final int CME_NETWORK_PERSONALIZATION_PIN_REQUIRED = 40;
+ public static final int CME_NETWORK_PERSONALIZATION_PUK_REQUIRED = 41;
+ public static final int CME_NETWORK_SUBSET_PERSONALIZATION_PIN_REQUIRED = 42;
+ public static final int CME_NETWORK_SUBSET_PERSONALIZATION_PUK_REQUIRED = 43;
+ public static final int CME_SERVICE_PROVIDER_PERSONALIZATION_PIN_REQUIRED = 44;
+ public static final int CME_SERVICE_PROVIDER_PERSONALIZATION_PUK_REQUIRED = 45;
+ public static final int CME_CORPORATE_PERSONALIZATION_PIN_REQUIRED = 46;
+ public static final int CME_CORPORATE_PERSONALIZATION_PUK_REQUIRED = 47;
+ public static final int CME_HIDDEN_KEY_REQUIRED = 48;
+ public static final int CME_EAP_NOT_SUPPORTED = 49;
+ public static final int CME_INCORRECT_PARAMETERS = 50;
/* Action policy for other calls when accepting call */
public static final int CALL_ACCEPT_NONE = 0;
@@ -370,7 +370,7 @@
private IBluetoothHeadsetClient mService;
private BluetoothAdapter mAdapter;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
@Override
public void onBluetoothStateChange(boolean up) {
@@ -478,8 +478,7 @@
*/
public boolean connect(BluetoothDevice device) {
if (DBG) log("connect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.connect(device);
} catch (RemoteException e) {
@@ -500,8 +499,7 @@
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) log("disconnect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.disconnect(device);
} catch (RemoteException e) {
@@ -564,8 +562,7 @@
@Override
public int getConnectionState(BluetoothDevice device) {
if (VDBG) log("getConnectionState(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getConnectionState(device);
} catch (RemoteException e) {
@@ -584,10 +581,9 @@
*/
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
@@ -606,8 +602,7 @@
*/
public int getPriority(BluetoothDevice device) {
if (VDBG) log("getPriority(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getPriority(device);
} catch (RemoteException e) {
@@ -632,8 +627,7 @@
*/
public boolean startVoiceRecognition(BluetoothDevice device) {
if (DBG) log("startVoiceRecognition()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.startVoiceRecognition(device);
} catch (RemoteException e) {
@@ -657,8 +651,7 @@
*/
public boolean stopVoiceRecognition(BluetoothDevice device) {
if (DBG) log("stopVoiceRecognition()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.stopVoiceRecognition(device);
} catch (RemoteException e) {
@@ -677,8 +670,7 @@
*/
public List<BluetoothHeadsetClientCall> getCurrentCalls(BluetoothDevice device) {
if (DBG) log("getCurrentCalls()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getCurrentCalls(device);
} catch (RemoteException e) {
@@ -697,8 +689,7 @@
*/
public Bundle getCurrentAgEvents(BluetoothDevice device) {
if (DBG) log("getCurrentCalls()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getCurrentAgEvents(device);
} catch (RemoteException e) {
@@ -720,8 +711,7 @@
*/
public boolean acceptCall(BluetoothDevice device, int flag) {
if (DBG) log("acceptCall()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.acceptCall(device, flag);
} catch (RemoteException e) {
@@ -741,8 +731,7 @@
*/
public boolean holdCall(BluetoothDevice device) {
if (DBG) log("holdCall()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.holdCall(device);
} catch (RemoteException e) {
@@ -766,8 +755,7 @@
*/
public boolean rejectCall(BluetoothDevice device) {
if (DBG) log("rejectCall()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.rejectCall(device);
} catch (RemoteException e) {
@@ -784,8 +772,8 @@
* Works only when Extended Call Control is supported by Audio Gateway.
*
* @param device remote device
- * @param call Handle of call obtained in {@link dial()} or obtained via {@link
- * ACTION_CALL_CHANGED}. {@code call} may be null in which case we will hangup all active
+ * @param call Handle of call obtained in {@link #dial(BluetoothDevice, String)} or obtained via
+ * {@link #ACTION_CALL_CHANGED}. {@code call} may be null in which case we will hangup all active
* calls.
* @return <code>true</code> if command has been issued successfully; <code>false</code>
* otherwise; upon completion HFP sends {@link #ACTION_CALL_CHANGED} intent.
@@ -796,8 +784,7 @@
*/
public boolean terminateCall(BluetoothDevice device, BluetoothHeadsetClientCall call) {
if (DBG) log("terminateCall()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.terminateCall(device, call);
} catch (RemoteException e) {
@@ -824,8 +811,7 @@
*/
public boolean enterPrivateMode(BluetoothDevice device, int index) {
if (DBG) log("enterPrivateMode()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.enterPrivateMode(device, index);
} catch (RemoteException e) {
@@ -851,8 +837,7 @@
*/
public boolean explicitCallTransfer(BluetoothDevice device) {
if (DBG) log("explicitCallTransfer()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.explicitCallTransfer(device);
} catch (RemoteException e) {
@@ -874,8 +859,7 @@
*/
public BluetoothHeadsetClientCall dial(BluetoothDevice device, String number) {
if (DBG) log("dial()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.dial(device, number);
} catch (RemoteException e) {
@@ -898,8 +882,7 @@
*/
public boolean sendDTMF(BluetoothDevice device, byte code) {
if (DBG) log("sendDTMF()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.sendDTMF(device, code);
} catch (RemoteException e) {
@@ -924,8 +907,7 @@
*/
public boolean getLastVoiceTagNumber(BluetoothDevice device) {
if (DBG) log("getLastVoiceTagNumber()");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getLastVoiceTagNumber(device);
} catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/BluetoothHeadsetClientCall.java b/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
index 949cda0..dc00d63 100644
--- a/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
+++ b/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
@@ -200,10 +200,16 @@
return mOutgoing;
}
+ @Override
public String toString() {
return toString(false);
}
+ /**
+ * Generate a log string for this call
+ * @param loggable whether device address should be logged
+ * @return log string
+ */
public String toString(boolean loggable) {
StringBuilder builder = new StringBuilder("BluetoothHeadsetClientCall{mDevice: ");
builder.append(loggable ? mDevice : mDevice.hashCode());
diff --git a/core/java/android/bluetooth/BluetoothHealth.java b/core/java/android/bluetooth/BluetoothHealth.java
index fa75906..dc5f381 100644
--- a/core/java/android/bluetooth/BluetoothHealth.java
+++ b/core/java/android/bluetooth/BluetoothHealth.java
@@ -97,7 +97,7 @@
/** @hide */
public static final int HEALTH_OPERATION_NOT_ALLOWED = 6005;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -228,8 +228,7 @@
*/
public boolean connectChannelToSource(BluetoothDevice device,
BluetoothHealthAppConfiguration config) {
- if (mService != null && isEnabled() && isValidDevice(device) &&
- config != null) {
+ if (mService != null && isEnabled() && isValidDevice(device) && config != null) {
try {
return mService.connectChannelToSource(device, config);
} catch (RemoteException e) {
@@ -257,8 +256,7 @@
*/
public boolean connectChannelToSink(BluetoothDevice device,
BluetoothHealthAppConfiguration config, int channelType) {
- if (mService != null && isEnabled() && isValidDevice(device) &&
- config != null) {
+ if (mService != null && isEnabled() && isValidDevice(device) && config != null) {
try {
return mService.connectChannelToSink(device, config, channelType);
} catch (RemoteException e) {
@@ -286,8 +284,7 @@
*/
public boolean disconnectChannel(BluetoothDevice device,
BluetoothHealthAppConfiguration config, int channelId) {
- if (mService != null && isEnabled() && isValidDevice(device) &&
- config != null) {
+ if (mService != null && isEnabled() && isValidDevice(device) && config != null) {
try {
return mService.disconnectChannel(device, config, channelId);
} catch (RemoteException e) {
@@ -315,8 +312,7 @@
*/
public ParcelFileDescriptor getMainChannelFd(BluetoothDevice device,
BluetoothHealthAppConfiguration config) {
- if (mService != null && isEnabled() && isValidDevice(device) &&
- config != null) {
+ if (mService != null && isEnabled() && isValidDevice(device) && config != null) {
try {
return mService.getMainChannelFd(device, config);
} catch (RemoteException e) {
@@ -553,10 +549,10 @@
private boolean checkAppParam(String name, int role, int channelType,
BluetoothHealthCallback callback) {
- if (name == null || (role != SOURCE_ROLE && role != SINK_ROLE) ||
- (channelType != CHANNEL_TYPE_RELIABLE &&
- channelType != CHANNEL_TYPE_STREAMING &&
- channelType != CHANNEL_TYPE_ANY) || callback == null) {
+ if (name == null || (role != SOURCE_ROLE && role != SINK_ROLE)
+ || (channelType != CHANNEL_TYPE_RELIABLE && channelType != CHANNEL_TYPE_STREAMING
+ && channelType != CHANNEL_TYPE_ANY)
+ || callback == null) {
return false;
}
if (role == SOURCE_ROLE && channelType == CHANNEL_TYPE_ANY) return false;
diff --git a/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java b/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java
index d406ac2..7c9db6f 100644
--- a/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java
+++ b/core/java/android/bluetooth/BluetoothHealthAppConfiguration.java
@@ -69,10 +69,8 @@
if (mName == null) return false;
- return mName.equals(config.getName()) &&
- mDataType == config.getDataType() &&
- mRole == config.getRole() &&
- mChannelType == config.getChannelType();
+ return mName.equals(config.getName()) && mDataType == config.getDataType()
+ && mRole == config.getRole() && mChannelType == config.getChannelType();
}
return false;
}
@@ -89,11 +87,11 @@
@Override
public String toString() {
- return "BluetoothHealthAppConfiguration [mName = " + mName +
- ",mDataType = " + mDataType + ", mRole = " + mRole + ",mChannelType = " +
- mChannelType + "]";
+ return "BluetoothHealthAppConfiguration [mName = " + mName + ",mDataType = " + mDataType
+ + ", mRole = " + mRole + ",mChannelType = " + mChannelType + "]";
}
+ @Override
public int describeContents() {
return 0;
}
@@ -154,6 +152,7 @@
}
};
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(mName);
out.writeInt(mDataType);
diff --git a/core/java/android/bluetooth/BluetoothHealthCallback.java b/core/java/android/bluetooth/BluetoothHealthCallback.java
index 198d06a8..4023485 100644
--- a/core/java/android/bluetooth/BluetoothHealthCallback.java
+++ b/core/java/android/bluetooth/BluetoothHealthCallback.java
@@ -63,8 +63,8 @@
public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config,
BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd,
int channelId) {
- Log.d(TAG, "onHealthChannelStateChange: " + config + "Device: " + device +
- "prevState:" + prevState + "newState:" + newState + "ParcelFd:" + fd +
- "ChannelId:" + channelId);
+ Log.d(TAG, "onHealthChannelStateChange: " + config + "Device: " + device
+ + "prevState:" + prevState + "newState:" + newState + "ParcelFd:" + fd
+ + "ChannelId:" + channelId);
}
}
diff --git a/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java b/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java
index d8880a2..1f80ed7 100644
--- a/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java
+++ b/core/java/android/bluetooth/BluetoothHidDeviceAppQosSettings.java
@@ -22,18 +22,18 @@
/** @hide */
public final class BluetoothHidDeviceAppQosSettings implements Parcelable {
- final public int serviceType;
- final public int tokenRate;
- final public int tokenBucketSize;
- final public int peakBandwidth;
- final public int latency;
- final public int delayVariation;
+ public final int serviceType;
+ public final int tokenRate;
+ public final int tokenBucketSize;
+ public final int peakBandwidth;
+ public final int latency;
+ public final int delayVariation;
- final static public int SERVICE_NO_TRAFFIC = 0x00;
- final static public int SERVICE_BEST_EFFORT = 0x01;
- final static public int SERVICE_GUARANTEED = 0x02;
+ public static final int SERVICE_NO_TRAFFIC = 0x00;
+ public static final int SERVICE_BEST_EFFORT = 0x01;
+ public static final int SERVICE_GUARANTEED = 0x02;
- final static public int MAX = (int) 0xffffffff;
+ public static final int MAX = (int) 0xffffffff;
public BluetoothHidDeviceAppQosSettings(int serviceType, int tokenRate, int tokenBucketSize,
int peakBandwidth,
@@ -88,6 +88,7 @@
out.writeInt(delayVariation);
}
+ /** @return an int array representation of this instance */
public int[] toArray() {
return new int[]{
serviceType, tokenRate, tokenBucketSize, peakBandwidth, latency, delayVariation
diff --git a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
index e17e785..d21d506 100644
--- a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
+++ b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
@@ -22,11 +22,11 @@
/** @hide */
public final class BluetoothHidDeviceAppSdpSettings implements Parcelable {
- final public String name;
- final public String description;
- final public String provider;
- final public byte subclass;
- final public byte[] descriptors;
+ public final String name;
+ public final String description;
+ public final String provider;
+ public final byte subclass;
+ public final byte[] descriptors;
public BluetoothHidDeviceAppSdpSettings(String name, String description, String provider,
byte subclass, byte[] descriptors) {
diff --git a/core/java/android/bluetooth/BluetoothHidDeviceCallback.java b/core/java/android/bluetooth/BluetoothHidDeviceCallback.java
index d50505c..3d407a6 100644
--- a/core/java/android/bluetooth/BluetoothHidDeviceCallback.java
+++ b/core/java/android/bluetooth/BluetoothHidDeviceCallback.java
@@ -35,11 +35,10 @@
*
* @param pluggedDevice {@link BluetoothDevice} object which represents host that currently has
* Virtual Cable established with device. Only valid when application is registered, can be
- * <code>null</code> .
+ * <code>null</code>.
* @param config {@link BluetoothHidDeviceAppConfiguration} object which represents token
* required to unregister application using
- * {@link BluetoothHidDevice#unregisterApp(BluetoothHidDeviceAppConfiguration)}
- * .
+ * {@link BluetoothHidDevice#unregisterApp(BluetoothHidDeviceAppConfiguration)}.
* @param registered <code>true</code> if application is registered, <code>false</code>
* otherwise.
*/
diff --git a/core/java/android/bluetooth/BluetoothInputDevice.java b/core/java/android/bluetooth/BluetoothInputDevice.java
index a9b2e56..a9a9010 100644
--- a/core/java/android/bluetooth/BluetoothInputDevice.java
+++ b/core/java/android/bluetooth/BluetoothInputDevice.java
@@ -224,7 +224,7 @@
private BluetoothAdapter mAdapter;
private IBluetoothInputDevice mService;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -385,6 +385,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getConnectedDevices() {
if (VDBG) log("getConnectedDevices()");
if (mService != null && isEnabled()) {
@@ -402,6 +403,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
if (VDBG) log("getDevicesMatchingStates()");
if (mService != null && isEnabled()) {
@@ -419,6 +421,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getConnectionState(BluetoothDevice device) {
if (VDBG) log("getState(" + device + ")");
if (mService != null && isEnabled() && isValidDevice(device)) {
@@ -451,8 +454,8 @@
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
if (mService != null && isEnabled() && isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
diff --git a/core/java/android/bluetooth/BluetoothInputHost.java b/core/java/android/bluetooth/BluetoothInputHost.java
index 0cdcd57..15303dc 100644
--- a/core/java/android/bluetooth/BluetoothInputHost.java
+++ b/core/java/android/bluetooth/BluetoothInputHost.java
@@ -163,7 +163,7 @@
}
}
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
@@ -287,6 +287,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getConnectedDevices() {
Log.v(TAG, "getConnectedDevices()");
@@ -306,6 +307,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
Log.v(TAG, "getDevicesMatchingConnectionStates(): states=" + Arrays.toString(states));
@@ -325,6 +327,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getConnectionState(BluetoothDevice device) {
Log.v(TAG, "getConnectionState(): device=" + device);
diff --git a/core/java/android/bluetooth/BluetoothInputStream.java b/core/java/android/bluetooth/BluetoothInputStream.java
index 062e4de..8eb79b2 100644
--- a/core/java/android/bluetooth/BluetoothInputStream.java
+++ b/core/java/android/bluetooth/BluetoothInputStream.java
@@ -55,7 +55,7 @@
* @since Android 1.5
*/
public int read() throws IOException {
- byte b[] = new byte[1];
+ byte[] b = new byte[1];
int ret = mSocket.read(b, 0, 1);
if (ret == 1) {
return (int) b[0] & 0xff;
diff --git a/core/java/android/bluetooth/BluetoothMap.java b/core/java/android/bluetooth/BluetoothMap.java
index 30c0d3c..26a9106 100644
--- a/core/java/android/bluetooth/BluetoothMap.java
+++ b/core/java/android/bluetooth/BluetoothMap.java
@@ -56,7 +56,7 @@
/** Connection canceled before completion. */
public static final int RESULT_CANCELED = 2;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -232,8 +232,7 @@
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) log("disconnect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.disconnect(device);
} catch (RemoteException e) {
@@ -311,8 +310,7 @@
*/
public int getConnectionState(BluetoothDevice device) {
if (DBG) log("getConnectionState(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getConnectionState(device);
} catch (RemoteException e) {
@@ -337,10 +335,9 @@
*/
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
@@ -366,8 +363,7 @@
*/
public int getPriority(BluetoothDevice device) {
if (VDBG) log("getPriority(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getPriority(device);
} catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/BluetoothMapClient.java b/core/java/android/bluetooth/BluetoothMapClient.java
index 09dd5ad..3e0c365 100644
--- a/core/java/android/bluetooth/BluetoothMapClient.java
+++ b/core/java/android/bluetooth/BluetoothMapClient.java
@@ -72,7 +72,7 @@
/** Connection canceled before completion. */
public static final int RESULT_CANCELED = 2;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -216,8 +216,7 @@
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) Log.d(TAG, "disconnect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.disconnect(device);
} catch (RemoteException e) {
@@ -276,8 +275,7 @@
@Override
public int getConnectionState(BluetoothDevice device) {
if (DBG) Log.d(TAG, "getConnectionState(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getConnectionState(device);
} catch (RemoteException e) {
@@ -300,10 +298,9 @@
*/
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) Log.d(TAG, "setPriority(" + device + ", " + priority + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
@@ -329,8 +326,7 @@
*/
public int getPriority(BluetoothDevice device) {
if (VDBG) Log.d(TAG, "getPriority(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getPriority(device);
} catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/BluetoothMasInstance.java b/core/java/android/bluetooth/BluetoothMasInstance.java
index 8447282..7a31328 100644
--- a/core/java/android/bluetooth/BluetoothMasInstance.java
+++ b/core/java/android/bluetooth/BluetoothMasInstance.java
@@ -48,10 +48,11 @@
@Override
public String toString() {
- return Integer.toString(mId) + ":" + mName + ":" + mChannel + ":" +
- Integer.toHexString(mMsgTypes);
+ return Integer.toString(mId) + ":" + mName + ":" + mChannel + ":"
+ + Integer.toHexString(mMsgTypes);
}
+ @Override
public int describeContents() {
return 0;
}
@@ -68,6 +69,7 @@
}
};
+ @Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mId);
out.writeString(mName);
diff --git a/core/java/android/bluetooth/BluetoothOutputStream.java b/core/java/android/bluetooth/BluetoothOutputStream.java
index cecd3db..dfec4e1 100644
--- a/core/java/android/bluetooth/BluetoothOutputStream.java
+++ b/core/java/android/bluetooth/BluetoothOutputStream.java
@@ -49,7 +49,7 @@
* @since Android 1.0
*/
public void write(int oneByte) throws IOException {
- byte b[] = new byte[1];
+ byte[] b = new byte[1];
b[0] = (byte) oneByte;
mSocket.write(b, 0, 1);
}
diff --git a/core/java/android/bluetooth/BluetoothPan.java b/core/java/android/bluetooth/BluetoothPan.java
index 4c00649..63e83d2 100644
--- a/core/java/android/bluetooth/BluetoothPan.java
+++ b/core/java/android/bluetooth/BluetoothPan.java
@@ -183,7 +183,7 @@
close();
}
- final private IBluetoothStateChangeCallback mStateChangeCallback =
+ private final IBluetoothStateChangeCallback mStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
@Override
@@ -238,8 +238,7 @@
*/
public boolean connect(BluetoothDevice device) {
if (DBG) log("connect(" + device + ")");
- if (mPanService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mPanService != null && isEnabled() && isValidDevice(device)) {
try {
return mPanService.connect(device);
} catch (RemoteException e) {
@@ -278,8 +277,7 @@
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) log("disconnect(" + device + ")");
- if (mPanService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mPanService != null && isEnabled() && isValidDevice(device)) {
try {
return mPanService.disconnect(device);
} catch (RemoteException e) {
@@ -294,6 +292,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getConnectedDevices() {
if (VDBG) log("getConnectedDevices()");
if (mPanService != null && isEnabled()) {
@@ -311,6 +310,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
if (VDBG) log("getDevicesMatchingStates()");
if (mPanService != null && isEnabled()) {
@@ -328,6 +328,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getConnectionState(BluetoothDevice device) {
if (VDBG) log("getState(" + device + ")");
if (mPanService != null && isEnabled()
diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java
index fe7ce1d..78b7c7b 100644
--- a/core/java/android/bluetooth/BluetoothPbap.java
+++ b/core/java/android/bluetooth/BluetoothPbap.java
@@ -110,7 +110,7 @@
public void onServiceDisconnected();
}
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
diff --git a/core/java/android/bluetooth/BluetoothPbapClient.java b/core/java/android/bluetooth/BluetoothPbapClient.java
index 3d6d002..b9b372c 100644
--- a/core/java/android/bluetooth/BluetoothPbapClient.java
+++ b/core/java/android/bluetooth/BluetoothPbapClient.java
@@ -55,7 +55,7 @@
/** Connection canceled before completion. */
public static final int RESULT_CANCELED = 2;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) {
@@ -346,10 +346,9 @@
if (DBG) {
log("setPriority(" + device + ", " + priority + ")");
}
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java
index 9192ec4..bc8fa84 100644
--- a/core/java/android/bluetooth/BluetoothProfile.java
+++ b/core/java/android/bluetooth/BluetoothProfile.java
@@ -96,12 +96,12 @@
/**
* GATT
*/
- static public final int GATT = 7;
+ public static final int GATT = 7;
/**
* GATT_SERVER
*/
- static public final int GATT_SERVER = 8;
+ public static final int GATT_SERVER = 8;
/**
* MAP Profile
@@ -156,7 +156,7 @@
*
* @hide
*/
- static public final int INPUT_HOST = 19;
+ public static final int INPUT_HOST = 19;
/**
* Max profile ID. This value should be updated whenever a new profile is added to match
diff --git a/core/java/android/bluetooth/BluetoothSap.java b/core/java/android/bluetooth/BluetoothSap.java
index ea635b2..bcdf493 100644
--- a/core/java/android/bluetooth/BluetoothSap.java
+++ b/core/java/android/bluetooth/BluetoothSap.java
@@ -94,7 +94,7 @@
*/
public static final int RESULT_CANCELED = 2;
- final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
+ private final IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
new IBluetoothStateChangeCallback.Stub() {
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
@@ -279,8 +279,7 @@
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) log("disconnect(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.disconnect(device);
} catch (RemoteException e) {
@@ -340,8 +339,7 @@
*/
public int getConnectionState(BluetoothDevice device) {
if (DBG) log("getConnectionState(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getConnectionState(device);
} catch (RemoteException e) {
@@ -365,10 +363,9 @@
*/
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
- if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
+ if (priority != BluetoothProfile.PRIORITY_OFF
+ && priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
try {
@@ -391,8 +388,7 @@
*/
public int getPriority(BluetoothDevice device) {
if (VDBG) log("getPriority(" + device + ")");
- if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ if (mService != null && isEnabled() && isValidDevice(device)) {
try {
return mService.getPriority(device);
} catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java
index 7b438bd..58d090d 100644
--- a/core/java/android/bluetooth/BluetoothServerSocket.java
+++ b/core/java/android/bluetooth/BluetoothServerSocket.java
@@ -183,8 +183,8 @@
mMessage = message;
}
- /*package*/ void setServiceName(String ServiceName) {
- mSocket.setServiceName(ServiceName);
+ /*package*/ void setServiceName(String serviceName) {
+ mSocket.setServiceName(serviceName);
}
/**
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index a90dd82..4035ee1 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -126,9 +126,9 @@
private int mPort; /* RFCOMM channel or L2CAP psm */
private int mFd;
private String mServiceName;
- private static int PROXY_CONNECTION_TIMEOUT = 5000;
+ private static final int PROXY_CONNECTION_TIMEOUT = 5000;
- private static int SOCK_SIGNAL_SIZE = 20;
+ private static final int SOCK_SIGNAL_SIZE = 20;
private ByteBuffer mL2capBuffer = null;
private int mMaxTxPacketSize = 0; // The l2cap maximum packet size supported by the peer.
@@ -235,7 +235,7 @@
mMin16DigitPin = s.mMin16DigitPin;
}
- private BluetoothSocket acceptSocket(String RemoteAddr) throws IOException {
+ private BluetoothSocket acceptSocket(String remoteAddr) throws IOException {
BluetoothSocket as = new BluetoothSocket(this);
as.mSocketState = SocketState.CONNECTED;
FileDescriptor[] fds = mSocket.getAncillaryFileDescriptors();
@@ -250,8 +250,8 @@
as.mSocket = LocalSocket.createConnectedLocalSocket(fds[0]);
as.mSocketIS = as.mSocket.getInputStream();
as.mSocketOS = as.mSocket.getOutputStream();
- as.mAddress = RemoteAddr;
- as.mDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(RemoteAddr);
+ as.mAddress = remoteAddr;
+ as.mDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(remoteAddr);
return as;
}
@@ -428,8 +428,7 @@
try {
synchronized (this) {
if (DBG) {
- Log.d(TAG, "bindListen(), SocketState: " + mSocketState + ", mPfd: " +
- mPfd);
+ Log.d(TAG, "bindListen(), SocketState: " + mSocketState + ", mPfd: " + mPfd);
}
if (mSocketState != SocketState.INIT) return EBADFD;
if (mPfd == null) return -1;
@@ -589,9 +588,9 @@
@Override
public void close() throws IOException {
- Log.d(TAG, "close() this: " + this + ", channel: " + mPort +
- ", mSocketIS: " + mSocketIS + ", mSocketOS: " + mSocketOS +
- "mSocket: " + mSocket + ", mSocketState: " + mSocketState);
+ Log.d(TAG, "close() this: " + this + ", channel: " + mPort + ", mSocketIS: " + mSocketIS
+ + ", mSocketOS: " + mSocketOS + "mSocket: " + mSocket + ", mSocketState: "
+ + mSocketState);
if (mSocketState == SocketState.CLOSED) {
return;
} else {
@@ -658,12 +657,12 @@
* Change if a SDP entry should be automatically created.
* Must be called before calling .bind, for the call to have any effect.
*
- * @param mExcludeSdp <li>TRUE - do not auto generate SDP record. <li>FALSE - default - auto
+ * @param excludeSdp <li>TRUE - do not auto generate SDP record. <li>FALSE - default - auto
* generate SPP SDP record.
* @hide
*/
public void setExcludeSdp(boolean excludeSdp) {
- this.mExcludeSdp = excludeSdp;
+ mExcludeSdp = excludeSdp;
}
private String convertAddr(final byte[] addr) {
@@ -675,8 +674,7 @@
byte[] sig = new byte[SOCK_SIGNAL_SIZE];
int ret = readAll(is, sig);
if (VDBG) {
- Log.d(TAG, "waitSocketSignal read " + SOCK_SIGNAL_SIZE +
- " bytes signal ret: " + ret);
+ Log.d(TAG, "waitSocketSignal read " + SOCK_SIGNAL_SIZE + " bytes signal ret: " + ret);
}
ByteBuffer bb = ByteBuffer.wrap(sig);
/* the struct in native is decorated with __attribute__((packed)), hence this is possible */
@@ -711,8 +709,7 @@
if (VDBG) Log.v(TAG, "mL2capBuffer.remaining()" + mL2capBuffer.remaining());
mL2capBuffer.limit(0); // Ensure we do a real read at the first read-request
if (VDBG) {
- Log.v(TAG, "mL2capBuffer.remaining() after limit(0):" +
- mL2capBuffer.remaining());
+ Log.v(TAG, "mL2capBuffer.remaining() after limit(0):" + mL2capBuffer.remaining());
}
}
}
@@ -727,8 +724,8 @@
}
left -= ret;
if (left != 0) {
- Log.w(TAG, "readAll() looping, read partial size: " + (b.length - left) +
- ", expect size: " + b.length);
+ Log.w(TAG, "readAll() looping, read partial size: " + (b.length - left)
+ + ", expect size: " + b.length);
}
}
return b.length;
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java
index 3b49abd..5bfc54d 100644
--- a/core/java/android/bluetooth/BluetoothUuid.java
+++ b/core/java/android/bluetooth/BluetoothUuid.java
@@ -185,11 +185,11 @@
if (uuidA == null && uuidB == null) return true;
if (uuidA == null) {
- return uuidB.length == 0 ? true : false;
+ return uuidB.length == 0;
}
if (uuidB == null) {
- return uuidA.length == 0 ? true : false;
+ return uuidA.length == 0;
}
HashSet<ParcelUuid> uuidSet = new HashSet<ParcelUuid>(Arrays.asList(uuidA));
@@ -210,7 +210,7 @@
if (uuidA == null && uuidB == null) return true;
if (uuidA == null) {
- return uuidB.length == 0 ? true : false;
+ return uuidB.length == 0;
}
if (uuidB == null) return true;
@@ -250,8 +250,8 @@
throw new IllegalArgumentException("uuidBytes cannot be null");
}
int length = uuidBytes.length;
- if (length != UUID_BYTES_16_BIT && length != UUID_BYTES_32_BIT &&
- length != UUID_BYTES_128_BIT) {
+ if (length != UUID_BYTES_16_BIT && length != UUID_BYTES_32_BIT
+ && length != UUID_BYTES_128_BIT) {
throw new IllegalArgumentException("uuidBytes length invalid - " + length);
}
diff --git a/core/java/android/bluetooth/OobData.java b/core/java/android/bluetooth/OobData.java
index 505cc56..d632572 100644
--- a/core/java/android/bluetooth/OobData.java
+++ b/core/java/android/bluetooth/OobData.java
@@ -28,13 +28,13 @@
* @hide
*/
public class OobData implements Parcelable {
- private byte[] leBluetoothDeviceAddress;
- private byte[] securityManagerTk;
- private byte[] leSecureConnectionsConfirmation;
- private byte[] leSecureConnectionsRandom;
+ private byte[] mLeBluetoothDeviceAddress;
+ private byte[] mSecurityManagerTk;
+ private byte[] mLeSecureConnectionsConfirmation;
+ private byte[] mLeSecureConnectionsRandom;
public byte[] getLeBluetoothDeviceAddress() {
- return leBluetoothDeviceAddress;
+ return mLeBluetoothDeviceAddress;
}
/**
@@ -43,11 +43,11 @@
* a detailed description.
*/
public void setLeBluetoothDeviceAddress(byte[] leBluetoothDeviceAddress) {
- this.leBluetoothDeviceAddress = leBluetoothDeviceAddress;
+ mLeBluetoothDeviceAddress = leBluetoothDeviceAddress;
}
public byte[] getSecurityManagerTk() {
- return securityManagerTk;
+ return mSecurityManagerTk;
}
/**
@@ -56,49 +56,50 @@
* Part A 1.8 for a detailed description.
*/
public void setSecurityManagerTk(byte[] securityManagerTk) {
- this.securityManagerTk = securityManagerTk;
+ mSecurityManagerTk = securityManagerTk;
}
public byte[] getLeSecureConnectionsConfirmation() {
- return leSecureConnectionsConfirmation;
+ return mLeSecureConnectionsConfirmation;
}
public void setLeSecureConnectionsConfirmation(byte[] leSecureConnectionsConfirmation) {
- this.leSecureConnectionsConfirmation = leSecureConnectionsConfirmation;
+ mLeSecureConnectionsConfirmation = leSecureConnectionsConfirmation;
}
public byte[] getLeSecureConnectionsRandom() {
- return leSecureConnectionsRandom;
+ return mLeSecureConnectionsRandom;
}
public void setLeSecureConnectionsRandom(byte[] leSecureConnectionsRandom) {
- this.leSecureConnectionsRandom = leSecureConnectionsRandom;
+ mLeSecureConnectionsRandom = leSecureConnectionsRandom;
}
public OobData() {
}
private OobData(Parcel in) {
- leBluetoothDeviceAddress = in.createByteArray();
- securityManagerTk = in.createByteArray();
- leSecureConnectionsConfirmation = in.createByteArray();
- leSecureConnectionsRandom = in.createByteArray();
+ mLeBluetoothDeviceAddress = in.createByteArray();
+ mSecurityManagerTk = in.createByteArray();
+ mLeSecureConnectionsConfirmation = in.createByteArray();
+ mLeSecureConnectionsRandom = in.createByteArray();
}
+ @Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
- out.writeByteArray(leBluetoothDeviceAddress);
- out.writeByteArray(securityManagerTk);
- out.writeByteArray(leSecureConnectionsConfirmation);
- out.writeByteArray(leSecureConnectionsRandom);
+ out.writeByteArray(mLeBluetoothDeviceAddress);
+ out.writeByteArray(mSecurityManagerTk);
+ out.writeByteArray(mLeSecureConnectionsConfirmation);
+ out.writeByteArray(mLeSecureConnectionsRandom);
}
- public static final Parcelable.Creator<OobData> CREATOR
- = new Parcelable.Creator<OobData>() {
+ public static final Parcelable.Creator<OobData> CREATOR =
+ new Parcelable.Creator<OobData>() {
public OobData createFromParcel(Parcel in) {
return new OobData(in);
}
@@ -107,4 +108,4 @@
return new OobData[size];
}
};
-}
\ No newline at end of file
+}
diff --git a/core/java/android/bluetooth/SdpMasRecord.java b/core/java/android/bluetooth/SdpMasRecord.java
index b202e53..72d4938 100644
--- a/core/java/android/bluetooth/SdpMasRecord.java
+++ b/core/java/android/bluetooth/SdpMasRecord.java
@@ -27,6 +27,7 @@
private final int mSupportedMessageTypes;
private final String mServiceName;
+ /** Message type */
public static final class MessageType {
public static final int EMAIL = 0x01;
public static final int SMS_GSM = 0x02;
@@ -34,30 +35,30 @@
public static final int MMS = 0x08;
}
- public SdpMasRecord(int mas_instance_id,
- int l2cap_psm,
- int rfcomm_channel_number,
- int profile_version,
- int supported_features,
- int supported_message_types,
- String service_name) {
- this.mMasInstanceId = mas_instance_id;
- this.mL2capPsm = l2cap_psm;
- this.mRfcommChannelNumber = rfcomm_channel_number;
- this.mProfileVersion = profile_version;
- this.mSupportedFeatures = supported_features;
- this.mSupportedMessageTypes = supported_message_types;
- this.mServiceName = service_name;
+ public SdpMasRecord(int masInstanceId,
+ int l2capPsm,
+ int rfcommChannelNumber,
+ int profileVersion,
+ int supportedFeatures,
+ int supportedMessageTypes,
+ String serviceName) {
+ mMasInstanceId = masInstanceId;
+ mL2capPsm = l2capPsm;
+ mRfcommChannelNumber = rfcommChannelNumber;
+ mProfileVersion = profileVersion;
+ mSupportedFeatures = supportedFeatures;
+ mSupportedMessageTypes = supportedMessageTypes;
+ mServiceName = serviceName;
}
public SdpMasRecord(Parcel in) {
- this.mMasInstanceId = in.readInt();
- this.mL2capPsm = in.readInt();
- this.mRfcommChannelNumber = in.readInt();
- this.mProfileVersion = in.readInt();
- this.mSupportedFeatures = in.readInt();
- this.mSupportedMessageTypes = in.readInt();
- this.mServiceName = in.readString();
+ mMasInstanceId = in.readInt();
+ mL2capPsm = in.readInt();
+ mRfcommChannelNumber = in.readInt();
+ mProfileVersion = in.readInt();
+ mSupportedFeatures = in.readInt();
+ mSupportedMessageTypes = in.readInt();
+ mServiceName = in.readString();
}
@Override
@@ -100,15 +101,13 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
-
- dest.writeInt(this.mMasInstanceId);
- dest.writeInt(this.mL2capPsm);
- dest.writeInt(this.mRfcommChannelNumber);
- dest.writeInt(this.mProfileVersion);
- dest.writeInt(this.mSupportedFeatures);
- dest.writeInt(this.mSupportedMessageTypes);
- dest.writeString(this.mServiceName);
-
+ dest.writeInt(mMasInstanceId);
+ dest.writeInt(mL2capPsm);
+ dest.writeInt(mRfcommChannelNumber);
+ dest.writeInt(mProfileVersion);
+ dest.writeInt(mSupportedFeatures);
+ dest.writeInt(mSupportedMessageTypes);
+ dest.writeString(mServiceName);
}
@Override
diff --git a/core/java/android/bluetooth/SdpMnsRecord.java b/core/java/android/bluetooth/SdpMnsRecord.java
index 94ae635..a781d5d 100644
--- a/core/java/android/bluetooth/SdpMnsRecord.java
+++ b/core/java/android/bluetooth/SdpMnsRecord.java
@@ -25,24 +25,24 @@
private final int mProfileVersion;
private final String mServiceName;
- public SdpMnsRecord(int l2cap_psm,
- int rfcomm_channel_number,
- int profile_version,
- int supported_features,
- String service_name) {
- this.mL2capPsm = l2cap_psm;
- this.mRfcommChannelNumber = rfcomm_channel_number;
- this.mSupportedFeatures = supported_features;
- this.mServiceName = service_name;
- this.mProfileVersion = profile_version;
+ public SdpMnsRecord(int l2capPsm,
+ int rfcommChannelNumber,
+ int profileVersion,
+ int supportedFeatures,
+ String serviceName) {
+ mL2capPsm = l2capPsm;
+ mRfcommChannelNumber = rfcommChannelNumber;
+ mSupportedFeatures = supportedFeatures;
+ mServiceName = serviceName;
+ mProfileVersion = profileVersion;
}
public SdpMnsRecord(Parcel in) {
- this.mRfcommChannelNumber = in.readInt();
- this.mL2capPsm = in.readInt();
- this.mServiceName = in.readString();
- this.mSupportedFeatures = in.readInt();
- this.mProfileVersion = in.readInt();
+ mRfcommChannelNumber = in.readInt();
+ mL2capPsm = in.readInt();
+ mServiceName = in.readString();
+ mSupportedFeatures = in.readInt();
+ mProfileVersion = in.readInt();
}
@Override
diff --git a/core/java/android/bluetooth/SdpOppOpsRecord.java b/core/java/android/bluetooth/SdpOppOpsRecord.java
index 23e301c..e30745b8 100644
--- a/core/java/android/bluetooth/SdpOppOpsRecord.java
+++ b/core/java/android/bluetooth/SdpOppOpsRecord.java
@@ -35,11 +35,11 @@
public SdpOppOpsRecord(String serviceName, int rfcommChannel,
int l2capPsm, int version, byte[] formatsList) {
super();
- this.mServiceName = serviceName;
- this.mRfcommChannel = rfcommChannel;
- this.mL2capPsm = l2capPsm;
- this.mProfileVersion = version;
- this.mFormatsList = formatsList;
+ mServiceName = serviceName;
+ mRfcommChannel = rfcommChannel;
+ mL2capPsm = l2capPsm;
+ mProfileVersion = version;
+ mFormatsList = formatsList;
}
public String getServiceName() {
@@ -69,17 +69,17 @@
}
public SdpOppOpsRecord(Parcel in) {
- this.mRfcommChannel = in.readInt();
- this.mL2capPsm = in.readInt();
- this.mProfileVersion = in.readInt();
- this.mServiceName = in.readString();
+ mRfcommChannel = in.readInt();
+ mL2capPsm = in.readInt();
+ mProfileVersion = in.readInt();
+ mServiceName = in.readString();
int arrayLength = in.readInt();
if (arrayLength > 0) {
byte[] bytes = new byte[arrayLength];
in.readByteArray(bytes);
- this.mFormatsList = bytes;
+ mFormatsList = bytes;
} else {
- this.mFormatsList = null;
+ mFormatsList = null;
}
}
@@ -97,6 +97,7 @@
}
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("Bluetooth OPP Server SDP Record:\n");
sb.append(" RFCOMM Chan Number: ").append(mRfcommChannel);
diff --git a/core/java/android/bluetooth/SdpPseRecord.java b/core/java/android/bluetooth/SdpPseRecord.java
index 5885f17..72249d0 100644
--- a/core/java/android/bluetooth/SdpPseRecord.java
+++ b/core/java/android/bluetooth/SdpPseRecord.java
@@ -27,27 +27,27 @@
private final int mSupportedRepositories;
private final String mServiceName;
- public SdpPseRecord(int l2cap_psm,
- int rfcomm_channel_number,
- int profile_version,
- int supported_features,
- int supported_repositories,
- String service_name) {
- this.mL2capPsm = l2cap_psm;
- this.mRfcommChannelNumber = rfcomm_channel_number;
- this.mProfileVersion = profile_version;
- this.mSupportedFeatures = supported_features;
- this.mSupportedRepositories = supported_repositories;
- this.mServiceName = service_name;
+ public SdpPseRecord(int l2capPsm,
+ int rfcommChannelNumber,
+ int profileVersion,
+ int supportedFeatures,
+ int supportedRepositories,
+ String serviceName) {
+ mL2capPsm = l2capPsm;
+ mRfcommChannelNumber = rfcommChannelNumber;
+ mProfileVersion = profileVersion;
+ mSupportedFeatures = supportedFeatures;
+ mSupportedRepositories = supportedRepositories;
+ mServiceName = serviceName;
}
public SdpPseRecord(Parcel in) {
- this.mRfcommChannelNumber = in.readInt();
- this.mL2capPsm = in.readInt();
- this.mProfileVersion = in.readInt();
- this.mSupportedFeatures = in.readInt();
- this.mSupportedRepositories = in.readInt();
- this.mServiceName = in.readString();
+ mRfcommChannelNumber = in.readInt();
+ mL2capPsm = in.readInt();
+ mProfileVersion = in.readInt();
+ mSupportedFeatures = in.readInt();
+ mSupportedRepositories = in.readInt();
+ mServiceName = in.readString();
}
@Override
@@ -91,6 +91,7 @@
}
+ @Override
public String toString() {
String ret = "Bluetooth MNS SDP Record:\n";
diff --git a/core/java/android/bluetooth/SdpRecord.java b/core/java/android/bluetooth/SdpRecord.java
index 714ecd8..730862e 100644
--- a/core/java/android/bluetooth/SdpRecord.java
+++ b/core/java/android/bluetooth/SdpRecord.java
@@ -32,15 +32,15 @@
+ ", rawSize=" + mRawSize + "]";
}
- public SdpRecord(int size_record, byte[] record) {
- this.mRawData = record;
- this.mRawSize = size_record;
+ public SdpRecord(int sizeRecord, byte[] record) {
+ mRawData = record;
+ mRawSize = sizeRecord;
}
public SdpRecord(Parcel in) {
- this.mRawSize = in.readInt();
- this.mRawData = new byte[mRawSize];
- in.readByteArray(this.mRawData);
+ mRawSize = in.readInt();
+ mRawData = new byte[mRawSize];
+ in.readByteArray(mRawData);
}
@@ -51,8 +51,8 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(this.mRawSize);
- dest.writeByteArray(this.mRawData);
+ dest.writeInt(mRawSize);
+ dest.writeByteArray(mRawData);
}
diff --git a/core/java/android/bluetooth/SdpSapsRecord.java b/core/java/android/bluetooth/SdpSapsRecord.java
index 1904118..a1e2f7b 100644
--- a/core/java/android/bluetooth/SdpSapsRecord.java
+++ b/core/java/android/bluetooth/SdpSapsRecord.java
@@ -25,18 +25,16 @@
private final int mProfileVersion;
private final String mServiceName;
- public SdpSapsRecord(int rfcomm_channel_number,
- int profile_version,
- String service_name) {
- this.mRfcommChannelNumber = rfcomm_channel_number;
- this.mProfileVersion = profile_version;
- this.mServiceName = service_name;
+ public SdpSapsRecord(int rfcommChannelNumber, int profileVersion, String serviceName) {
+ mRfcommChannelNumber = rfcommChannelNumber;
+ mProfileVersion = profileVersion;
+ mServiceName = serviceName;
}
public SdpSapsRecord(Parcel in) {
- this.mRfcommChannelNumber = in.readInt();
- this.mProfileVersion = in.readInt();
- this.mServiceName = in.readString();
+ mRfcommChannelNumber = in.readInt();
+ mProfileVersion = in.readInt();
+ mServiceName = in.readString();
}
@Override
@@ -58,9 +56,9 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(this.mRfcommChannelNumber);
- dest.writeInt(this.mProfileVersion);
- dest.writeString(this.mServiceName);
+ dest.writeInt(mRfcommChannelNumber);
+ dest.writeInt(mProfileVersion);
+ dest.writeString(mServiceName);
}
diff --git a/core/java/android/bluetooth/UidTraffic.java b/core/java/android/bluetooth/UidTraffic.java
index f74ac75..cef362b 100644
--- a/core/java/android/bluetooth/UidTraffic.java
+++ b/core/java/android/bluetooth/UidTraffic.java
@@ -91,11 +91,8 @@
@Override
public String toString() {
- return "UidTraffic{" +
- "mAppUid=" + mAppUid +
- ", mRxBytes=" + mRxBytes +
- ", mTxBytes=" + mTxBytes +
- '}';
+ return "UidTraffic{mAppUid=" + mAppUid + ", mRxBytes=" + mRxBytes + ", mTxBytes="
+ + mTxBytes + '}';
}
public static final Creator<UidTraffic> CREATOR = new Creator<UidTraffic>() {
diff --git a/core/java/android/bluetooth/le/AdvertiseData.java b/core/java/android/bluetooth/le/AdvertiseData.java
index 7c506db..b65c31d1d 100644
--- a/core/java/android/bluetooth/le/AdvertiseData.java
+++ b/core/java/android/bluetooth/le/AdvertiseData.java
@@ -118,12 +118,12 @@
return false;
}
AdvertiseData other = (AdvertiseData) obj;
- return Objects.equals(mServiceUuids, other.mServiceUuids) &&
- BluetoothLeUtils.equals(mManufacturerSpecificData, other.mManufacturerSpecificData)
- &&
- BluetoothLeUtils.equals(mServiceData, other.mServiceData) &&
- mIncludeDeviceName == other.mIncludeDeviceName &&
- mIncludeTxPowerLevel == other.mIncludeTxPowerLevel;
+ return Objects.equals(mServiceUuids, other.mServiceUuids)
+ && BluetoothLeUtils.equals(mManufacturerSpecificData,
+ other.mManufacturerSpecificData)
+ && BluetoothLeUtils.equals(mServiceData, other.mServiceData)
+ && mIncludeDeviceName == other.mIncludeDeviceName
+ && mIncludeTxPowerLevel == other.mIncludeTxPowerLevel;
}
@Override
diff --git a/core/java/android/bluetooth/le/AdvertiseSettings.java b/core/java/android/bluetooth/le/AdvertiseSettings.java
index 430f9bd..35e232c7 100644
--- a/core/java/android/bluetooth/le/AdvertiseSettings.java
+++ b/core/java/android/bluetooth/le/AdvertiseSettings.java
@@ -86,7 +86,7 @@
private AdvertiseSettings(Parcel in) {
mAdvertiseMode = in.readInt();
mAdvertiseTxPowerLevel = in.readInt();
- mAdvertiseConnectable = in.readInt() != 0 ? true : false;
+ mAdvertiseConnectable = in.readInt() != 0;
mAdvertiseTimeoutMillis = in.readInt();
}
diff --git a/core/java/android/bluetooth/le/AdvertisingSet.java b/core/java/android/bluetooth/le/AdvertisingSet.java
index b1c122c..1df35e1 100644
--- a/core/java/android/bluetooth/le/AdvertisingSet.java
+++ b/core/java/android/bluetooth/le/AdvertisingSet.java
@@ -36,15 +36,15 @@
public final class AdvertisingSet {
private static final String TAG = "AdvertisingSet";
- private final IBluetoothGatt gatt;
- private int advertiserId;
+ private final IBluetoothGatt mGatt;
+ private int mAdvertiserId;
/* package */ AdvertisingSet(int advertiserId,
IBluetoothManager bluetoothManager) {
- this.advertiserId = advertiserId;
+ mAdvertiserId = advertiserId;
try {
- this.gatt = bluetoothManager.getBluetoothGatt();
+ mGatt = bluetoothManager.getBluetoothGatt();
} catch (RemoteException e) {
Log.e(TAG, "Failed to get Bluetooth gatt - ", e);
throw new IllegalStateException("Failed to get Bluetooth");
@@ -52,7 +52,7 @@
}
/* package */ void setAdvertiserId(int advertiserId) {
- this.advertiserId = advertiserId;
+ mAdvertiserId = advertiserId;
}
/**
@@ -71,7 +71,7 @@
public void enableAdvertising(boolean enable, int duration,
int maxExtendedAdvertisingEvents) {
try {
- gatt.enableAdvertisingSet(this.advertiserId, enable, duration,
+ mGatt.enableAdvertisingSet(mAdvertiserId, enable, duration,
maxExtendedAdvertisingEvents);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
@@ -92,7 +92,7 @@
*/
public void setAdvertisingData(AdvertiseData advertiseData) {
try {
- gatt.setAdvertisingData(this.advertiserId, advertiseData);
+ mGatt.setAdvertisingData(mAdvertiserId, advertiseData);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -109,7 +109,7 @@
*/
public void setScanResponseData(AdvertiseData scanResponse) {
try {
- gatt.setScanResponseData(this.advertiserId, scanResponse);
+ mGatt.setScanResponseData(mAdvertiserId, scanResponse);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -124,7 +124,7 @@
*/
public void setAdvertisingParameters(AdvertisingSetParameters parameters) {
try {
- gatt.setAdvertisingParameters(this.advertiserId, parameters);
+ mGatt.setAdvertisingParameters(mAdvertiserId, parameters);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -137,7 +137,7 @@
*/
public void setPeriodicAdvertisingParameters(PeriodicAdvertisingParameters parameters) {
try {
- gatt.setPeriodicAdvertisingParameters(this.advertiserId, parameters);
+ mGatt.setPeriodicAdvertisingParameters(mAdvertiserId, parameters);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -155,7 +155,7 @@
*/
public void setPeriodicAdvertisingData(AdvertiseData periodicData) {
try {
- gatt.setPeriodicAdvertisingData(this.advertiserId, periodicData);
+ mGatt.setPeriodicAdvertisingData(mAdvertiserId, periodicData);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -170,7 +170,7 @@
*/
public void setPeriodicAdvertisingEnabled(boolean enable) {
try {
- gatt.setPeriodicAdvertisingEnable(this.advertiserId, enable);
+ mGatt.setPeriodicAdvertisingEnable(mAdvertiserId, enable);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -187,7 +187,7 @@
*/
public void getOwnAddress() {
try {
- gatt.getOwnAddress(this.advertiserId);
+ mGatt.getOwnAddress(mAdvertiserId);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -199,6 +199,6 @@
* @hide
*/
public int getAdvertiserId() {
- return advertiserId;
+ return mAdvertiserId;
}
-}
\ No newline at end of file
+}
diff --git a/core/java/android/bluetooth/le/AdvertisingSetCallback.java b/core/java/android/bluetooth/le/AdvertisingSetCallback.java
index fa502d3..58a3696 100644
--- a/core/java/android/bluetooth/le/AdvertisingSetCallback.java
+++ b/core/java/android/bluetooth/le/AdvertisingSetCallback.java
@@ -125,9 +125,7 @@
* @param advertisingSet The advertising set.
* @param status Status of the operation.
*/
- public void
- onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
- int status) {
+ public void onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet, int status) {
}
/**
@@ -163,4 +161,4 @@
*/
public void onOwnAddressRead(AdvertisingSet advertisingSet, int addressType, String address) {
}
-}
\ No newline at end of file
+}
diff --git a/core/java/android/bluetooth/le/AdvertisingSetParameters.java b/core/java/android/bluetooth/le/AdvertisingSetParameters.java
index f795861..0c0291eb 100644
--- a/core/java/android/bluetooth/le/AdvertisingSetParameters.java
+++ b/core/java/android/bluetooth/le/AdvertisingSetParameters.java
@@ -97,116 +97,116 @@
*/
private static final int LIMITED_ADVERTISING_MAX_MILLIS = 180 * 1000;
- private final boolean isLegacy;
- private final boolean isAnonymous;
- private final boolean includeTxPower;
- private final int primaryPhy;
- private final int secondaryPhy;
- private final boolean connectable;
- private final boolean scannable;
- private final int interval;
- private final int txPowerLevel;
+ private final boolean mIsLegacy;
+ private final boolean mIsAnonymous;
+ private final boolean mIncludeTxPower;
+ private final int mPrimaryPhy;
+ private final int mSecondaryPhy;
+ private final boolean mConnectable;
+ private final boolean mScannable;
+ private final int mInterval;
+ private final int mTxPowerLevel;
private AdvertisingSetParameters(boolean connectable, boolean scannable, boolean isLegacy,
boolean isAnonymous, boolean includeTxPower,
int primaryPhy, int secondaryPhy,
int interval, int txPowerLevel) {
- this.connectable = connectable;
- this.scannable = scannable;
- this.isLegacy = isLegacy;
- this.isAnonymous = isAnonymous;
- this.includeTxPower = includeTxPower;
- this.primaryPhy = primaryPhy;
- this.secondaryPhy = secondaryPhy;
- this.interval = interval;
- this.txPowerLevel = txPowerLevel;
+ mConnectable = connectable;
+ mScannable = scannable;
+ mIsLegacy = isLegacy;
+ mIsAnonymous = isAnonymous;
+ mIncludeTxPower = includeTxPower;
+ mPrimaryPhy = primaryPhy;
+ mSecondaryPhy = secondaryPhy;
+ mInterval = interval;
+ mTxPowerLevel = txPowerLevel;
}
private AdvertisingSetParameters(Parcel in) {
- connectable = in.readInt() != 0 ? true : false;
- scannable = in.readInt() != 0 ? true : false;
- isLegacy = in.readInt() != 0 ? true : false;
- isAnonymous = in.readInt() != 0 ? true : false;
- includeTxPower = in.readInt() != 0 ? true : false;
- primaryPhy = in.readInt();
- secondaryPhy = in.readInt();
- interval = in.readInt();
- txPowerLevel = in.readInt();
+ mConnectable = in.readInt() != 0;
+ mScannable = in.readInt() != 0;
+ mIsLegacy = in.readInt() != 0;
+ mIsAnonymous = in.readInt() != 0;
+ mIncludeTxPower = in.readInt() != 0;
+ mPrimaryPhy = in.readInt();
+ mSecondaryPhy = in.readInt();
+ mInterval = in.readInt();
+ mTxPowerLevel = in.readInt();
}
/**
* Returns whether the advertisement will be connectable.
*/
public boolean isConnectable() {
- return connectable;
+ return mConnectable;
}
/**
* Returns whether the advertisement will be scannable.
*/
public boolean isScannable() {
- return scannable;
+ return mScannable;
}
/**
* Returns whether the legacy advertisement will be used.
*/
public boolean isLegacy() {
- return isLegacy;
+ return mIsLegacy;
}
/**
* Returns whether the advertisement will be anonymous.
*/
public boolean isAnonymous() {
- return isAnonymous;
+ return mIsAnonymous;
}
/**
* Returns whether the TX Power will be included.
*/
public boolean includeTxPower() {
- return includeTxPower;
+ return mIncludeTxPower;
}
/**
* Returns the primary advertising phy.
*/
public int getPrimaryPhy() {
- return primaryPhy;
+ return mPrimaryPhy;
}
/**
* Returns the secondary advertising phy.
*/
public int getSecondaryPhy() {
- return secondaryPhy;
+ return mSecondaryPhy;
}
/**
* Returns the advertising interval.
*/
public int getInterval() {
- return interval;
+ return mInterval;
}
/**
* Returns the TX power level for advertising.
*/
public int getTxPowerLevel() {
- return txPowerLevel;
+ return mTxPowerLevel;
}
@Override
public String toString() {
- return "AdvertisingSetParameters [connectable=" + connectable
- + ", isLegacy=" + isLegacy
- + ", isAnonymous=" + isAnonymous
- + ", includeTxPower=" + includeTxPower
- + ", primaryPhy=" + primaryPhy
- + ", secondaryPhy=" + secondaryPhy
- + ", interval=" + interval
- + ", txPowerLevel=" + txPowerLevel + "]";
+ return "AdvertisingSetParameters [connectable=" + mConnectable
+ + ", isLegacy=" + mIsLegacy
+ + ", isAnonymous=" + mIsAnonymous
+ + ", includeTxPower=" + mIncludeTxPower
+ + ", primaryPhy=" + mPrimaryPhy
+ + ", secondaryPhy=" + mSecondaryPhy
+ + ", interval=" + mInterval
+ + ", txPowerLevel=" + mTxPowerLevel + "]";
}
@Override
@@ -216,15 +216,15 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(connectable ? 1 : 0);
- dest.writeInt(scannable ? 1 : 0);
- dest.writeInt(isLegacy ? 1 : 0);
- dest.writeInt(isAnonymous ? 1 : 0);
- dest.writeInt(includeTxPower ? 1 : 0);
- dest.writeInt(primaryPhy);
- dest.writeInt(secondaryPhy);
- dest.writeInt(interval);
- dest.writeInt(txPowerLevel);
+ dest.writeInt(mConnectable ? 1 : 0);
+ dest.writeInt(mScannable ? 1 : 0);
+ dest.writeInt(mIsLegacy ? 1 : 0);
+ dest.writeInt(mIsAnonymous ? 1 : 0);
+ dest.writeInt(mIncludeTxPower ? 1 : 0);
+ dest.writeInt(mPrimaryPhy);
+ dest.writeInt(mSecondaryPhy);
+ dest.writeInt(mInterval);
+ dest.writeInt(mTxPowerLevel);
}
public static final Parcelable.Creator<AdvertisingSetParameters> CREATOR =
@@ -244,16 +244,15 @@
* Builder class for {@link AdvertisingSetParameters}.
*/
public static final class Builder {
-
- private boolean connectable = false;
- private boolean scannable = false;
- private boolean isLegacy = false;
- private boolean isAnonymous = false;
- private boolean includeTxPower = false;
- private int primaryPhy = BluetoothDevice.PHY_LE_1M;
- private int secondaryPhy = BluetoothDevice.PHY_LE_1M;
- private int interval = INTERVAL_LOW;
- private int txPowerLevel = TX_POWER_MEDIUM;
+ private boolean mConnectable = false;
+ private boolean mScannable = false;
+ private boolean mIsLegacy = false;
+ private boolean mIsAnonymous = false;
+ private boolean mIncludeTxPower = false;
+ private int mPrimaryPhy = BluetoothDevice.PHY_LE_1M;
+ private int mSecondaryPhy = BluetoothDevice.PHY_LE_1M;
+ private int mInterval = INTERVAL_LOW;
+ private int mTxPowerLevel = TX_POWER_MEDIUM;
/**
* Set whether the advertisement type should be connectable or
@@ -265,7 +264,7 @@
* non-connectable (false).
*/
public Builder setConnectable(boolean connectable) {
- this.connectable = connectable;
+ mConnectable = connectable;
return this;
}
@@ -278,7 +277,7 @@
* non-scannable (false).
*/
public Builder setScannable(boolean scannable) {
- this.scannable = scannable;
+ mScannable = scannable;
return this;
}
@@ -289,7 +288,7 @@
* @param isLegacy whether legacy advertising mode should be used.
*/
public Builder setLegacyMode(boolean isLegacy) {
- this.isLegacy = isLegacy;
+ mIsLegacy = isLegacy;
return this;
}
@@ -302,7 +301,7 @@
* @param isAnonymous whether anonymous advertising should be used.
*/
public Builder setAnonymous(boolean isAnonymous) {
- this.isAnonymous = isAnonymous;
+ mIsAnonymous = isAnonymous;
return this;
}
@@ -314,7 +313,7 @@
* @param includeTxPower whether TX power should be included in extended header
*/
public Builder setIncludeTxPower(boolean includeTxPower) {
- this.includeTxPower = includeTxPower;
+ mIncludeTxPower = includeTxPower;
return this;
}
@@ -331,11 +330,11 @@
* @throws IllegalArgumentException If the primaryPhy is invalid.
*/
public Builder setPrimaryPhy(int primaryPhy) {
- if (primaryPhy != BluetoothDevice.PHY_LE_1M &&
- primaryPhy != BluetoothDevice.PHY_LE_CODED) {
+ if (primaryPhy != BluetoothDevice.PHY_LE_1M
+ && primaryPhy != BluetoothDevice.PHY_LE_CODED) {
throw new IllegalArgumentException("bad primaryPhy " + primaryPhy);
}
- this.primaryPhy = primaryPhy;
+ mPrimaryPhy = primaryPhy;
return this;
}
@@ -354,12 +353,12 @@
* @throws IllegalArgumentException If the secondaryPhy is invalid.
*/
public Builder setSecondaryPhy(int secondaryPhy) {
- if (secondaryPhy != BluetoothDevice.PHY_LE_1M &&
- secondaryPhy != BluetoothDevice.PHY_LE_2M &&
- secondaryPhy != BluetoothDevice.PHY_LE_CODED) {
+ if (secondaryPhy != BluetoothDevice.PHY_LE_1M
+ && secondaryPhy != BluetoothDevice.PHY_LE_2M
+ && secondaryPhy != BluetoothDevice.PHY_LE_CODED) {
throw new IllegalArgumentException("bad secondaryPhy " + secondaryPhy);
}
- this.secondaryPhy = secondaryPhy;
+ mSecondaryPhy = secondaryPhy;
return this;
}
@@ -376,7 +375,7 @@
if (interval < INTERVAL_MIN || interval > INTERVAL_MAX) {
throw new IllegalArgumentException("unknown interval " + interval);
}
- this.interval = interval;
+ mInterval = interval;
return this;
}
@@ -393,10 +392,9 @@
*/
public Builder setTxPowerLevel(int txPowerLevel) {
if (txPowerLevel < TX_POWER_MIN || txPowerLevel > TX_POWER_MAX) {
- throw new IllegalArgumentException("unknown txPowerLevel " +
- txPowerLevel);
+ throw new IllegalArgumentException("unknown txPowerLevel " + txPowerLevel);
}
- this.txPowerLevel = txPowerLevel;
+ mTxPowerLevel = txPowerLevel;
return this;
}
@@ -406,35 +404,34 @@
* @throws IllegalStateException if invalid combination of parameters is used.
*/
public AdvertisingSetParameters build() {
- if (isLegacy) {
- if (isAnonymous) {
+ if (mIsLegacy) {
+ if (mIsAnonymous) {
throw new IllegalArgumentException("Legacy advertising can't be anonymous");
}
- if (connectable == true && scannable == false) {
+ if (mConnectable && !mScannable) {
throw new IllegalStateException(
"Legacy advertisement can't be connectable and non-scannable");
}
- if (includeTxPower) {
+ if (mIncludeTxPower) {
throw new IllegalStateException(
"Legacy advertising can't include TX power level in header");
}
} else {
- if (connectable && scannable) {
+ if (mConnectable && mScannable) {
throw new IllegalStateException(
"Advertising can't be both connectable and scannable");
}
- if (isAnonymous && connectable) {
+ if (mIsAnonymous && mConnectable) {
throw new IllegalStateException(
"Advertising can't be both connectable and anonymous");
}
}
- return new AdvertisingSetParameters(connectable, scannable, isLegacy, isAnonymous,
- includeTxPower, primaryPhy,
- secondaryPhy, interval, txPowerLevel);
+ return new AdvertisingSetParameters(mConnectable, mScannable, mIsLegacy, mIsAnonymous,
+ mIncludeTxPower, mPrimaryPhy, mSecondaryPhy, mInterval, mTxPowerLevel);
}
}
-}
\ No newline at end of file
+}
diff --git a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
index 08128de..0fb4ba1 100644
--- a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
+++ b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
@@ -115,8 +115,8 @@
throw new IllegalArgumentException("callback cannot be null");
}
boolean isConnectable = settings.isConnectable();
- if (totalBytes(advertiseData, isConnectable) > MAX_LEGACY_ADVERTISING_DATA_BYTES ||
- totalBytes(scanResponse, false) > MAX_LEGACY_ADVERTISING_DATA_BYTES) {
+ if (totalBytes(advertiseData, isConnectable) > MAX_LEGACY_ADVERTISING_DATA_BYTES
+ || totalBytes(scanResponse, false) > MAX_LEGACY_ADVERTISING_DATA_BYTES) {
postStartFailure(callback, AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE);
return;
}
@@ -177,9 +177,9 @@
@Override
public void onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enabled,
int status) {
- if (enabled == true) {
- Log.e(TAG, "Legacy advertiser should be only disabled on timeout," +
- " but was enabled!");
+ if (enabled) {
+ Log.e(TAG, "Legacy advertiser should be only disabled on timeout,"
+ + " but was enabled!");
return;
}
@@ -396,11 +396,11 @@
"maxExtendedAdvertisingEvents out of range: " + maxExtendedAdvertisingEvents);
}
- if (maxExtendedAdvertisingEvents != 0 &&
- !mBluetoothAdapter.isLePeriodicAdvertisingSupported()) {
+ if (maxExtendedAdvertisingEvents != 0
+ && !mBluetoothAdapter.isLePeriodicAdvertisingSupported()) {
throw new IllegalArgumentException(
- "Can't use maxExtendedAdvertisingEvents with controller that don't support " +
- "LE Extended Advertising");
+ "Can't use maxExtendedAdvertisingEvents with controller that don't support "
+ + "LE Extended Advertising");
}
if (duration < 0 || duration > 65535) {
@@ -488,18 +488,16 @@
}
// 16 bit service uuids are grouped into one field when doing advertising.
if (num16BitUuids != 0) {
- size += OVERHEAD_BYTES_PER_FIELD +
- num16BitUuids * BluetoothUuid.UUID_BYTES_16_BIT;
+ size += OVERHEAD_BYTES_PER_FIELD + num16BitUuids * BluetoothUuid.UUID_BYTES_16_BIT;
}
// 32 bit service uuids are grouped into one field when doing advertising.
if (num32BitUuids != 0) {
- size += OVERHEAD_BYTES_PER_FIELD +
- num32BitUuids * BluetoothUuid.UUID_BYTES_32_BIT;
+ size += OVERHEAD_BYTES_PER_FIELD + num32BitUuids * BluetoothUuid.UUID_BYTES_32_BIT;
}
// 128 bit service uuids are grouped into one field when doing advertising.
if (num128BitUuids != 0) {
- size += OVERHEAD_BYTES_PER_FIELD +
- num128BitUuids * BluetoothUuid.UUID_BYTES_128_BIT;
+ size += OVERHEAD_BYTES_PER_FIELD
+ + num128BitUuids * BluetoothUuid.UUID_BYTES_128_BIT;
}
}
for (ParcelUuid uuid : data.getServiceData().keySet()) {
@@ -508,8 +506,8 @@
+ byteLength(data.getServiceData().get(uuid));
}
for (int i = 0; i < data.getManufacturerSpecificData().size(); ++i) {
- size += OVERHEAD_BYTES_PER_FIELD + MANUFACTURER_SPECIFIC_DATA_LENGTH +
- byteLength(data.getManufacturerSpecificData().valueAt(i));
+ size += OVERHEAD_BYTES_PER_FIELD + MANUFACTURER_SPECIFIC_DATA_LENGTH
+ + byteLength(data.getManufacturerSpecificData().valueAt(i));
}
if (data.getIncludeTxPowerLevel()) {
size += OVERHEAD_BYTES_PER_FIELD + 1; // tx power level value is one byte.
diff --git a/core/java/android/bluetooth/le/BluetoothLeScanner.java b/core/java/android/bluetooth/le/BluetoothLeScanner.java
index 41c4f5a..19fab37 100644
--- a/core/java/android/bluetooth/le/BluetoothLeScanner.java
+++ b/core/java/android/bluetooth/le/BluetoothLeScanner.java
@@ -62,8 +62,8 @@
* error. In case of error, {@link #EXTRA_ERROR_CODE} will contain the error code and this
* extra will not be available.
*/
- public static final String EXTRA_LIST_SCAN_RESULT
- = "android.bluetooth.le.extra.LIST_SCAN_RESULT";
+ public static final String EXTRA_LIST_SCAN_RESULT =
+ "android.bluetooth.le.extra.LIST_SCAN_RESULT";
/**
* Optional extra indicating the error code, if any. The error code will be one of the
@@ -419,8 +419,8 @@
*/
@Override
public void onScannerRegistered(int status, int scannerId) {
- Log.d(TAG, "onScannerRegistered() - status=" + status +
- " scannerId=" + scannerId + " mScannerId=" + mScannerId);
+ Log.d(TAG, "onScannerRegistered() - status=" + status
+ + " scannerId=" + scannerId + " mScannerId=" + mScannerId);
synchronized (this) {
if (status == BluetoothGatt.GATT_SUCCESS) {
try {
@@ -481,8 +481,7 @@
@Override
public void onFoundOrLost(final boolean onFound, final ScanResult scanResult) {
if (VDBG) {
- Log.d(TAG, "onFoundOrLost() - onFound = " + onFound +
- " " + scanResult.toString());
+ Log.d(TAG, "onFoundOrLost() - onFound = " + onFound + " " + scanResult.toString());
}
// Check null in case the scan has been stopped
@@ -574,8 +573,8 @@
if ((callbackType & ScanSettings.CALLBACK_TYPE_FIRST_MATCH) != 0
|| (callbackType & ScanSettings.CALLBACK_TYPE_MATCH_LOST) != 0) {
// For onlost/onfound, we required hw support be available
- return (mBluetoothAdapter.isOffloadedFilteringSupported() &&
- mBluetoothAdapter.isHardwareTrackingFiltersAvailable());
+ return (mBluetoothAdapter.isOffloadedFilteringSupported()
+ && mBluetoothAdapter.isHardwareTrackingFiltersAvailable());
}
return true;
}
diff --git a/core/java/android/bluetooth/le/BluetoothLeUtils.java b/core/java/android/bluetooth/le/BluetoothLeUtils.java
index afec72b..6381f55 100644
--- a/core/java/android/bluetooth/le/BluetoothLeUtils.java
+++ b/core/java/android/bluetooth/le/BluetoothLeUtils.java
@@ -92,8 +92,8 @@
// Keys are guaranteed in ascending order when indices are in ascending order.
for (int i = 0; i < array.size(); ++i) {
- if (array.keyAt(i) != otherArray.keyAt(i) ||
- !Arrays.equals(array.valueAt(i), otherArray.valueAt(i))) {
+ if (array.keyAt(i) != otherArray.keyAt(i)
+ || !Arrays.equals(array.valueAt(i), otherArray.valueAt(i))) {
return false;
}
}
@@ -132,8 +132,7 @@
* BluetoothAdapter#STATE_ON}.
*/
static void checkAdapterStateOn(BluetoothAdapter adapter) {
- if (adapter == null
- || !adapter.isLeEnabled()) {//adapter.getState() != BluetoothAdapter.STATE_ON) {
+ if (adapter == null || !adapter.isLeEnabled()) {
throw new IllegalStateException("BT Adapter is not turned ON");
}
}
diff --git a/core/java/android/bluetooth/le/PeriodicAdvertisingManager.java b/core/java/android/bluetooth/le/PeriodicAdvertisingManager.java
index 5e7f4c0..0f1a8e9 100644
--- a/core/java/android/bluetooth/le/PeriodicAdvertisingManager.java
+++ b/core/java/android/bluetooth/le/PeriodicAdvertisingManager.java
@@ -57,7 +57,7 @@
/* maps callback, to callback wrapper and sync handle */
Map<PeriodicAdvertisingCallback,
- IPeriodicAdvertisingCallback /* callbackWrapper */> callbackWrappers;
+ IPeriodicAdvertisingCallback /* callbackWrapper */> mCallbackWrappers;
/**
* Use {@link BluetoothAdapter#getBluetoothLeScanner()} instead.
@@ -68,7 +68,7 @@
public PeriodicAdvertisingManager(IBluetoothManager bluetoothManager) {
mBluetoothManager = bluetoothManager;
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
- callbackWrappers = new IdentityHashMap<>();
+ mCallbackWrappers = new IdentityHashMap<>();
}
/**
@@ -153,7 +153,7 @@
}
IPeriodicAdvertisingCallback wrapped = wrap(callback, handler);
- callbackWrappers.put(callback, wrapped);
+ mCallbackWrappers.put(callback, wrapped);
try {
gatt.registerSync(scanResult, skip, timeout, wrapped);
@@ -183,7 +183,7 @@
return;
}
- IPeriodicAdvertisingCallback wrapper = callbackWrappers.remove(callback);
+ IPeriodicAdvertisingCallback wrapper = mCallbackWrappers.remove(callback);
if (wrapper == null) {
throw new IllegalArgumentException("callback was not properly registered");
}
@@ -213,7 +213,7 @@
// App can still unregister the sync until notified it failed. Remove
// callback
// after app was notifed.
- callbackWrappers.remove(callback);
+ mCallbackWrappers.remove(callback);
}
}
});
@@ -233,9 +233,9 @@
@Override
public void run() {
callback.onSyncLost(syncHandle);
- // App can still unregister the sync until notified it's lost. Remove callback after
- // app was notifed.
- callbackWrappers.remove(callback);
+ // App can still unregister the sync until notified it's lost.
+ // Remove callback after app was notifed.
+ mCallbackWrappers.remove(callback);
}
});
}
diff --git a/core/java/android/bluetooth/le/PeriodicAdvertisingParameters.java b/core/java/android/bluetooth/le/PeriodicAdvertisingParameters.java
index 5bd4775..e3a130c 100644
--- a/core/java/android/bluetooth/le/PeriodicAdvertisingParameters.java
+++ b/core/java/android/bluetooth/le/PeriodicAdvertisingParameters.java
@@ -29,24 +29,24 @@
private static final int INTERVAL_MIN = 80;
private static final int INTERVAL_MAX = 65519;
- private final boolean includeTxPower;
- private final int interval;
+ private final boolean mIncludeTxPower;
+ private final int mInterval;
private PeriodicAdvertisingParameters(boolean includeTxPower, int interval) {
- this.includeTxPower = includeTxPower;
- this.interval = interval;
+ mIncludeTxPower = includeTxPower;
+ mInterval = interval;
}
private PeriodicAdvertisingParameters(Parcel in) {
- includeTxPower = in.readInt() != 0 ? true : false;
- interval = in.readInt();
+ mIncludeTxPower = in.readInt() != 0;
+ mInterval = in.readInt();
}
/**
* Returns whether the TX Power will be included.
*/
public boolean getIncludeTxPower() {
- return includeTxPower;
+ return mIncludeTxPower;
}
/**
@@ -54,7 +54,7 @@
* Valid values are from 80 (100ms) to 65519 (81.89875s).
*/
public int getInterval() {
- return interval;
+ return mInterval;
}
@Override
@@ -64,8 +64,8 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(includeTxPower ? 1 : 0);
- dest.writeInt(interval);
+ dest.writeInt(mIncludeTxPower ? 1 : 0);
+ dest.writeInt(mInterval);
}
public static final Parcelable
@@ -83,15 +83,15 @@
};
public static final class Builder {
- private boolean includeTxPower = false;
- private int interval = INTERVAL_MAX;
+ private boolean mIncludeTxPower = false;
+ private int mInterval = INTERVAL_MAX;
/**
* Whether the transmission power level should be included in the periodic
* packet.
*/
public Builder setIncludeTxPower(boolean includeTxPower) {
- this.includeTxPower = includeTxPower;
+ mIncludeTxPower = includeTxPower;
return this;
}
@@ -104,10 +104,10 @@
*/
public Builder setInterval(int interval) {
if (interval < INTERVAL_MIN || interval > INTERVAL_MAX) {
- throw new IllegalArgumentException("Invalid interval (must be " + INTERVAL_MIN +
- "-" + INTERVAL_MAX + ")");
+ throw new IllegalArgumentException("Invalid interval (must be " + INTERVAL_MIN
+ + "-" + INTERVAL_MAX + ")");
}
- this.interval = interval;
+ mInterval = interval;
return this;
}
@@ -115,7 +115,7 @@
* Build the {@link AdvertisingSetParameters} object.
*/
public PeriodicAdvertisingParameters build() {
- return new PeriodicAdvertisingParameters(includeTxPower, interval);
+ return new PeriodicAdvertisingParameters(mIncludeTxPower, mInterval);
}
}
}
diff --git a/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java b/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java
index 9f1099b..55c3a73 100644
--- a/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java
+++ b/core/java/android/bluetooth/le/PeriodicAdvertisingReport.java
@@ -40,28 +40,28 @@
*/
public static final int DATA_INCOMPLETE_TRUNCATED = 2;
- private int syncHandle;
- private int txPower;
- private int rssi;
- private int dataStatus;
+ private int mSyncHandle;
+ private int mTxPower;
+ private int mRssi;
+ private int mDataStatus;
// periodic advertising data.
@Nullable
- private ScanRecord data;
+ private ScanRecord mData;
// Device timestamp when the result was last seen.
- private long timestampNanos;
+ private long mTimestampNanos;
/**
* Constructor of periodic advertising result.
*/
public PeriodicAdvertisingReport(int syncHandle, int txPower, int rssi,
int dataStatus, ScanRecord data) {
- this.syncHandle = syncHandle;
- this.txPower = txPower;
- this.rssi = rssi;
- this.dataStatus = dataStatus;
- this.data = data;
+ mSyncHandle = syncHandle;
+ mTxPower = txPower;
+ mRssi = rssi;
+ mDataStatus = dataStatus;
+ mData = data;
}
private PeriodicAdvertisingReport(Parcel in) {
@@ -70,25 +70,25 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(syncHandle);
- dest.writeLong(txPower);
- dest.writeInt(rssi);
- dest.writeInt(dataStatus);
- if (data != null) {
+ dest.writeInt(mSyncHandle);
+ dest.writeLong(mTxPower);
+ dest.writeInt(mRssi);
+ dest.writeInt(mDataStatus);
+ if (mData != null) {
dest.writeInt(1);
- dest.writeByteArray(data.getBytes());
+ dest.writeByteArray(mData.getBytes());
} else {
dest.writeInt(0);
}
}
private void readFromParcel(Parcel in) {
- syncHandle = in.readInt();
- txPower = in.readInt();
- rssi = in.readInt();
- dataStatus = in.readInt();
+ mSyncHandle = in.readInt();
+ mTxPower = in.readInt();
+ mRssi = in.readInt();
+ mDataStatus = in.readInt();
if (in.readInt() == 1) {
- data = ScanRecord.parseFromBytes(in.createByteArray());
+ mData = ScanRecord.parseFromBytes(in.createByteArray());
}
}
@@ -101,7 +101,7 @@
* Returns the synchronization handle.
*/
public int getSyncHandle() {
- return syncHandle;
+ return mSyncHandle;
}
/**
@@ -109,14 +109,14 @@
* of 127 means information was not available.
*/
public int getTxPower() {
- return txPower;
+ return mTxPower;
}
/**
* Returns the received signal strength in dBm. The valid range is [-127, 20].
*/
public int getRssi() {
- return rssi;
+ return mRssi;
}
/**
@@ -124,7 +124,7 @@
* or {@link PeriodicAdvertisingReport#DATA_INCOMPLETE_TRUNCATED}.
*/
public int getDataStatus() {
- return dataStatus;
+ return mDataStatus;
}
/**
@@ -132,19 +132,19 @@
*/
@Nullable
public ScanRecord getData() {
- return data;
+ return mData;
}
/**
* Returns timestamp since boot when the scan record was observed.
*/
public long getTimestampNanos() {
- return timestampNanos;
+ return mTimestampNanos;
}
@Override
public int hashCode() {
- return Objects.hash(syncHandle, txPower, rssi, dataStatus, data, timestampNanos);
+ return Objects.hash(mSyncHandle, mTxPower, mRssi, mDataStatus, mData, mTimestampNanos);
}
@Override
@@ -156,19 +156,19 @@
return false;
}
PeriodicAdvertisingReport other = (PeriodicAdvertisingReport) obj;
- return (syncHandle == other.syncHandle) &&
- (txPower == other.txPower) &&
- (rssi == other.rssi) &&
- (dataStatus == other.dataStatus) &&
- Objects.equals(data, other.data) &&
- (timestampNanos == other.timestampNanos);
+ return (mSyncHandle == other.mSyncHandle)
+ && (mTxPower == other.mTxPower)
+ && (mRssi == other.mRssi)
+ && (mDataStatus == other.mDataStatus)
+ && Objects.equals(mData, other.mData)
+ && (mTimestampNanos == other.mTimestampNanos);
}
@Override
public String toString() {
- return "PeriodicAdvertisingReport{syncHandle=" + syncHandle +
- ", txPower=" + txPower + ", rssi=" + rssi + ", dataStatus=" + dataStatus +
- ", data=" + Objects.toString(data) + ", timestampNanos=" + timestampNanos + '}';
+ return "PeriodicAdvertisingReport{syncHandle=" + mSyncHandle
+ + ", txPower=" + mTxPower + ", rssi=" + mRssi + ", dataStatus=" + mDataStatus
+ + ", data=" + Objects.toString(mData) + ", timestampNanos=" + mTimestampNanos + '}';
}
public static final Parcelable.Creator<PeriodicAdvertisingReport> CREATOR =
diff --git a/core/java/android/bluetooth/le/ResultStorageDescriptor.java b/core/java/android/bluetooth/le/ResultStorageDescriptor.java
index 75139b4..63bdf69 100644
--- a/core/java/android/bluetooth/le/ResultStorageDescriptor.java
+++ b/core/java/android/bluetooth/le/ResultStorageDescriptor.java
@@ -78,8 +78,8 @@
mLength = in.readInt();
}
- public static final Parcelable.Creator<ResultStorageDescriptor>
- CREATOR = new Creator<ResultStorageDescriptor>() {
+ public static final Parcelable.Creator<ResultStorageDescriptor> CREATOR =
+ new Creator<ResultStorageDescriptor>() {
@Override
public ResultStorageDescriptor createFromParcel(Parcel source) {
return new ResultStorageDescriptor(source);
diff --git a/core/java/android/bluetooth/le/ScanFilter.java b/core/java/android/bluetooth/le/ScanFilter.java
index f91cb75..c3fae7d 100644
--- a/core/java/android/bluetooth/le/ScanFilter.java
+++ b/core/java/android/bluetooth/le/ScanFilter.java
@@ -145,8 +145,8 @@
/**
* A {@link android.os.Parcelable.Creator} to create {@link ScanFilter} from parcel.
*/
- public static final Creator<ScanFilter>
- CREATOR = new Creator<ScanFilter>() {
+ public static final Creator<ScanFilter> CREATOR =
+ new Creator<ScanFilter>() {
@Override
public ScanFilter[] newArray(int size) {
@@ -403,16 +403,16 @@
return false;
}
ScanFilter other = (ScanFilter) obj;
- return Objects.equals(mDeviceName, other.mDeviceName) &&
- Objects.equals(mDeviceAddress, other.mDeviceAddress) &&
- mManufacturerId == other.mManufacturerId &&
- Objects.deepEquals(mManufacturerData, other.mManufacturerData) &&
- Objects.deepEquals(mManufacturerDataMask, other.mManufacturerDataMask) &&
- Objects.equals(mServiceDataUuid, other.mServiceDataUuid) &&
- Objects.deepEquals(mServiceData, other.mServiceData) &&
- Objects.deepEquals(mServiceDataMask, other.mServiceDataMask) &&
- Objects.equals(mServiceUuid, other.mServiceUuid) &&
- Objects.equals(mServiceUuidMask, other.mServiceUuidMask);
+ return Objects.equals(mDeviceName, other.mDeviceName)
+ && Objects.equals(mDeviceAddress, other.mDeviceAddress)
+ && mManufacturerId == other.mManufacturerId
+ && Objects.deepEquals(mManufacturerData, other.mManufacturerData)
+ && Objects.deepEquals(mManufacturerDataMask, other.mManufacturerDataMask)
+ && Objects.equals(mServiceDataUuid, other.mServiceDataUuid)
+ && Objects.deepEquals(mServiceData, other.mServiceData)
+ && Objects.deepEquals(mServiceDataMask, other.mServiceDataMask)
+ && Objects.equals(mServiceUuid, other.mServiceUuid)
+ && Objects.equals(mServiceUuidMask, other.mServiceUuidMask);
}
/**
diff --git a/core/java/android/bluetooth/le/ScanRecord.java b/core/java/android/bluetooth/le/ScanRecord.java
index 9e5a29a..f8aaba9 100644
--- a/core/java/android/bluetooth/le/ScanRecord.java
+++ b/core/java/android/bluetooth/le/ScanRecord.java
@@ -247,8 +247,8 @@
case DATA_TYPE_MANUFACTURER_SPECIFIC_DATA:
// The first two bytes of the manufacturer specific data are
// manufacturer ids in little endian.
- int manufacturerId = ((scanRecord[currentPos + 1] & 0xFF) << 8) +
- (scanRecord[currentPos] & 0xFF);
+ int manufacturerId = ((scanRecord[currentPos + 1] & 0xFF) << 8)
+ + (scanRecord[currentPos] & 0xFF);
byte[] manufacturerDataBytes = extractBytes(scanRecord, currentPos + 2,
dataLength - 2);
manufacturerData.put(manufacturerId, manufacturerDataBytes);
diff --git a/core/java/android/bluetooth/le/ScanResult.java b/core/java/android/bluetooth/le/ScanResult.java
index 7743822..f87a47f 100644
--- a/core/java/android/bluetooth/le/ScanResult.java
+++ b/core/java/android/bluetooth/le/ScanResult.java
@@ -101,6 +101,7 @@
* @deprecated use {@link #ScanResult(BluetoothDevice, int, int, int, int, int, int, int,
* ScanRecord, long)}
*/
+ @Deprecated
public ScanResult(BluetoothDevice device, ScanRecord scanRecord, int rssi,
long timestampNanos) {
mDevice = device;
@@ -316,25 +317,25 @@
return false;
}
ScanResult other = (ScanResult) obj;
- return Objects.equals(mDevice, other.mDevice) && (mRssi == other.mRssi) &&
- Objects.equals(mScanRecord, other.mScanRecord) &&
- (mTimestampNanos == other.mTimestampNanos) &&
- mEventType == other.mEventType &&
- mPrimaryPhy == other.mPrimaryPhy &&
- mSecondaryPhy == other.mSecondaryPhy &&
- mAdvertisingSid == other.mAdvertisingSid &&
- mTxPower == other.mTxPower &&
- mPeriodicAdvertisingInterval == other.mPeriodicAdvertisingInterval;
+ return Objects.equals(mDevice, other.mDevice) && (mRssi == other.mRssi)
+ && Objects.equals(mScanRecord, other.mScanRecord)
+ && (mTimestampNanos == other.mTimestampNanos)
+ && mEventType == other.mEventType
+ && mPrimaryPhy == other.mPrimaryPhy
+ && mSecondaryPhy == other.mSecondaryPhy
+ && mAdvertisingSid == other.mAdvertisingSid
+ && mTxPower == other.mTxPower
+ && mPeriodicAdvertisingInterval == other.mPeriodicAdvertisingInterval;
}
@Override
public String toString() {
- return "ScanResult{" + "device=" + mDevice + ", scanRecord=" +
- Objects.toString(mScanRecord) + ", rssi=" + mRssi +
- ", timestampNanos=" + mTimestampNanos + ", eventType=" + mEventType +
- ", primaryPhy=" + mPrimaryPhy + ", secondaryPhy=" + mSecondaryPhy +
- ", advertisingSid=" + mAdvertisingSid + ", txPower=" + mTxPower +
- ", periodicAdvertisingInterval=" + mPeriodicAdvertisingInterval + '}';
+ return "ScanResult{" + "device=" + mDevice + ", scanRecord="
+ + Objects.toString(mScanRecord) + ", rssi=" + mRssi
+ + ", timestampNanos=" + mTimestampNanos + ", eventType=" + mEventType
+ + ", primaryPhy=" + mPrimaryPhy + ", secondaryPhy=" + mSecondaryPhy
+ + ", advertisingSid=" + mAdvertisingSid + ", txPower=" + mTxPower
+ + ", periodicAdvertisingInterval=" + mPeriodicAdvertisingInterval + '}';
}
public static final Parcelable.Creator<ScanResult> CREATOR = new Creator<ScanResult>() {
diff --git a/core/java/android/bluetooth/le/ScanSettings.java b/core/java/android/bluetooth/le/ScanSettings.java
index d2792e0..35ed424 100644
--- a/core/java/android/bluetooth/le/ScanSettings.java
+++ b/core/java/android/bluetooth/le/ScanSettings.java
@@ -221,7 +221,7 @@
mReportDelayMillis = in.readLong();
mMatchMode = in.readInt();
mNumOfMatchesPerFilter = in.readInt();
- mLegacy = in.readInt() != 0 ? true : false;
+ mLegacy = in.readInt() != 0;
mPhy = in.readInt();
}
@@ -242,8 +242,8 @@
return 0;
}
- public static final Parcelable.Creator<ScanSettings>
- CREATOR = new Creator<ScanSettings>() {
+ public static final Parcelable.Creator<ScanSettings> CREATOR =
+ new Creator<ScanSettings>() {
@Override
public ScanSettings[] newArray(int size) {
return new ScanSettings[size];
@@ -300,9 +300,9 @@
// Returns true if the callbackType is valid.
private boolean isValidCallbackType(int callbackType) {
- if (callbackType == CALLBACK_TYPE_ALL_MATCHES ||
- callbackType == CALLBACK_TYPE_FIRST_MATCH ||
- callbackType == CALLBACK_TYPE_MATCH_LOST) {
+ if (callbackType == CALLBACK_TYPE_ALL_MATCHES
+ || callbackType == CALLBACK_TYPE_FIRST_MATCH
+ || callbackType == CALLBACK_TYPE_MATCH_LOST) {
return true;
}
return callbackType == (CALLBACK_TYPE_FIRST_MATCH | CALLBACK_TYPE_MATCH_LOST);