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/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.");
}
}