Fix checkstyle errors (1/2)
* Automatic style corrections through IDE
Bug: 63596319
Test: make checkbuild, no manual changes, no functional changes
Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
diff --git a/core/java/android/bluetooth/BluetoothMap.java b/core/java/android/bluetooth/BluetoothMap.java
index 2e73051..30c0d3c 100644
--- a/core/java/android/bluetooth/BluetoothMap.java
+++ b/core/java/android/bluetooth/BluetoothMap.java
@@ -16,19 +16,23 @@
package android.bluetooth;
-import java.util.List;
-import java.util.ArrayList;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
-import android.os.*;
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.RemoteException;
import android.util.Log;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* This class provides the APIs to control the Bluetooth MAP
* Profile.
- *@hide
+ *
+ * @hide
*/
public final class BluetoothMap implements BluetoothProfile {
@@ -37,7 +41,7 @@
private static final boolean VDBG = false;
public static final String ACTION_CONNECTION_STATE_CHANGED =
- "android.bluetooth.map.profile.action.CONNECTION_STATE_CHANGED";
+ "android.bluetooth.map.profile.action.CONNECTION_STATE_CHANGED";
private IBluetoothMap mService;
private final Context mContext;
@@ -45,7 +49,7 @@
private BluetoothAdapter mAdapter;
/** There was an error trying to obtain the state */
- public static final int STATE_ERROR = -1;
+ public static final int STATE_ERROR = -1;
public static final int RESULT_FAILURE = 0;
public static final int RESULT_SUCCESS = 1;
@@ -57,29 +61,29 @@
public void onBluetoothStateChange(boolean up) {
if (DBG) Log.d(TAG, "onBluetoothStateChange: up=" + up);
if (!up) {
- if (VDBG) Log.d(TAG,"Unbinding service...");
+ if (VDBG) Log.d(TAG, "Unbinding service...");
synchronized (mConnection) {
try {
mService = null;
mContext.unbindService(mConnection);
} catch (Exception re) {
- Log.e(TAG,"",re);
+ Log.e(TAG, "", re);
}
}
} else {
synchronized (mConnection) {
try {
if (mService == null) {
- if (VDBG) Log.d(TAG,"Binding service...");
+ if (VDBG) Log.d(TAG, "Binding service...");
doBind();
}
} catch (Exception re) {
- Log.e(TAG,"",re);
+ Log.e(TAG, "", re);
}
}
}
}
- };
+ };
/**
* Create a BluetoothMap proxy object.
@@ -94,7 +98,7 @@
try {
mgr.registerStateChangeCallback(mBluetoothStateChangeCallback);
} catch (RemoteException e) {
- Log.e(TAG,"",e);
+ Log.e(TAG, "", e);
}
}
doBind();
@@ -132,7 +136,7 @@
try {
mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback);
} catch (Exception e) {
- Log.e(TAG,"",e);
+ Log.e(TAG, "", e);
}
}
@@ -142,7 +146,7 @@
mService = null;
mContext.unbindService(mConnection);
} catch (Exception re) {
- Log.e(TAG,"",re);
+ Log.e(TAG, "", re);
}
}
}
@@ -151,15 +155,18 @@
/**
* Get the current state of the BluetoothMap service.
- * @return One of the STATE_ return codes, or STATE_ERROR if this proxy
- * object is currently not connected to the Map service.
+ *
+ * @return One of the STATE_ return codes, or STATE_ERROR if this proxy object is currently not
+ * connected to the Map service.
*/
public int getState() {
if (VDBG) log("getState()");
if (mService != null) {
try {
return mService.getState();
- } catch (RemoteException e) {Log.e(TAG, e.toString());}
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString());
+ }
} else {
Log.w(TAG, "Proxy not attached to service");
if (DBG) log(Log.getStackTraceString(new Throwable()));
@@ -169,16 +176,18 @@
/**
* Get the currently connected remote Bluetooth device (PCE).
- * @return The remote Bluetooth device, or null if not in connected or
- * connecting state, or if this proxy object is not connected to
- * the Map service.
+ *
+ * @return The remote Bluetooth device, or null if not in connected or connecting state, or if
+ * this proxy object is not connected to the Map service.
*/
public BluetoothDevice getClient() {
if (VDBG) log("getClient()");
if (mService != null) {
try {
return mService.getClient();
- } catch (RemoteException e) {Log.e(TAG, e.toString());}
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString());
+ }
} else {
Log.w(TAG, "Proxy not attached to service");
if (DBG) log(Log.getStackTraceString(new Throwable()));
@@ -196,7 +205,9 @@
if (mService != null) {
try {
return mService.isConnected(device);
- } catch (RemoteException e) {Log.e(TAG, e.toString());}
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString());
+ }
} else {
Log.w(TAG, "Proxy not attached to service");
if (DBG) log(Log.getStackTraceString(new Throwable()));
@@ -217,18 +228,17 @@
* Initiate disconnect.
*
* @param device Remote Bluetooth Device
- * @return false on error,
- * true otherwise
+ * @return false on error, true otherwise
*/
public boolean disconnect(BluetoothDevice device) {
if (DBG) log("disconnect(" + device + ")");
if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ isValidDevice(device)) {
try {
return mService.disconnect(device);
} catch (RemoteException e) {
- Log.e(TAG, Log.getStackTraceString(new Throwable()));
- return false;
+ Log.e(TAG, Log.getStackTraceString(new Throwable()));
+ return false;
}
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -240,18 +250,19 @@
* This is a simple heuristic that tries to guess if a device with the
* given class bits might support Map. It is not accurate for all
* devices. It tries to err on the side of false positives.
+ *
* @return True if this device might support Map.
*/
public static boolean doesClassMatchSink(BluetoothClass btClass) {
// TODO optimize the rule
switch (btClass.getDeviceClass()) {
- case BluetoothClass.Device.COMPUTER_DESKTOP:
- case BluetoothClass.Device.COMPUTER_LAPTOP:
- case BluetoothClass.Device.COMPUTER_SERVER:
- case BluetoothClass.Device.COMPUTER_UNCATEGORIZED:
- return true;
- default:
- return false;
+ case BluetoothClass.Device.COMPUTER_DESKTOP:
+ case BluetoothClass.Device.COMPUTER_LAPTOP:
+ case BluetoothClass.Device.COMPUTER_SERVER:
+ case BluetoothClass.Device.COMPUTER_UNCATEGORIZED:
+ return true;
+ default:
+ return false;
}
}
@@ -301,7 +312,7 @@
public int getConnectionState(BluetoothDevice device) {
if (DBG) log("getConnectionState(" + device + ")");
if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ isValidDevice(device)) {
try {
return mService.getConnectionState(device);
} catch (RemoteException e) {
@@ -317,7 +328,7 @@
* Set priority of the profile
*
* <p> The device should already be paired.
- * Priority can be one of {@link #PRIORITY_ON} or
+ * Priority can be one of {@link #PRIORITY_ON} or
* {@link #PRIORITY_OFF},
*
* @param device Paired bluetooth device
@@ -327,10 +338,10 @@
public boolean setPriority(BluetoothDevice device, int priority) {
if (DBG) log("setPriority(" + device + ", " + priority + ")");
if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ isValidDevice(device)) {
if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
- return false;
+ priority != BluetoothProfile.PRIORITY_ON) {
+ return false;
}
try {
return mService.setPriority(device, priority);
@@ -356,7 +367,7 @@
public int getPriority(BluetoothDevice device) {
if (VDBG) log("getPriority(" + device + ")");
if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ isValidDevice(device)) {
try {
return mService.getPriority(device);
} catch (RemoteException e) {
@@ -376,6 +387,7 @@
mServiceListener.onServiceConnected(BluetoothProfile.MAP, BluetoothMap.this);
}
}
+
public void onServiceDisconnected(ComponentName className) {
if (DBG) log("Proxy object disconnected");
mService = null;
@@ -389,17 +401,18 @@
Log.d(TAG, msg);
}
- private boolean isEnabled() {
+ private boolean isEnabled() {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if (adapter != null && adapter.getState() == BluetoothAdapter.STATE_ON) return true;
log("Bluetooth is Not enabled");
return false;
}
- private boolean isValidDevice(BluetoothDevice device) {
- if (device == null) return false;
- if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
- return false;
+ private boolean isValidDevice(BluetoothDevice device) {
+ if (device == null) return false;
+
+ if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
+ return false;
}