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/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index c58eaa1..7d6879d 100644
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -42,7 +42,7 @@
* This class provides the public APIs to control the Bluetooth A2DP
* profile.
*
- *<p>BluetoothA2dp is a proxy object for controlling the Bluetooth A2DP
+ * <p>BluetoothA2dp is a proxy object for controlling the Bluetooth A2DP
* Service via IPC. Use {@link BluetoothAdapter#getProfileProxy} to get
* the BluetoothA2dp proxy object.
*
@@ -60,9 +60,9 @@
*
* <p>This intent will have 3 extras:
* <ul>
- * <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
- * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.</li>
- * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
+ * <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
+ * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.</li>
+ * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
* </ul>
*
* <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of
@@ -74,7 +74,7 @@
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONNECTION_STATE_CHANGED =
- "android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED";
+ "android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED";
/**
* Intent used to broadcast the change in the Playing state of the A2DP
@@ -82,9 +82,9 @@
*
* <p>This intent will have 3 extras:
* <ul>
- * <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
- * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile. </li>
- * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
+ * <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
+ * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile. </li>
+ * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
* </ul>
*
* <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of
@@ -95,12 +95,12 @@
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PLAYING_STATE_CHANGED =
- "android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED";
+ "android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED";
/** @hide */
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_AVRCP_CONNECTION_STATE_CHANGED =
- "android.bluetooth.a2dp.profile.action.AVRCP_CONNECTION_STATE_CHANGED";
+ "android.bluetooth.a2dp.profile.action.AVRCP_CONNECTION_STATE_CHANGED";
/**
* Intent used to broadcast the change in the Audio Codec state of the
@@ -108,9 +108,9 @@
*
* <p>This intent will have 2 extras:
* <ul>
- * <li> {@link BluetoothCodecStatus#EXTRA_CODEC_STATUS} - The codec status. </li>
- * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device if the device is currently
- * connected, otherwise it is not included.</li>
+ * <li> {@link BluetoothCodecStatus#EXTRA_CODEC_STATUS} - The codec status. </li>
+ * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device if the device is currently
+ * connected, otherwise it is not included.</li>
* </ul>
*
* <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission to
@@ -120,58 +120,71 @@
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CODEC_CONFIG_CHANGED =
- "android.bluetooth.a2dp.profile.action.CODEC_CONFIG_CHANGED";
+ "android.bluetooth.a2dp.profile.action.CODEC_CONFIG_CHANGED";
/**
* A2DP sink device is streaming music. This state can be one of
* {@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} of
* {@link #ACTION_PLAYING_STATE_CHANGED} intent.
*/
- public static final int STATE_PLAYING = 10;
+ public static final int STATE_PLAYING = 10;
/**
* A2DP sink device is NOT streaming music. This state can be one of
* {@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} of
* {@link #ACTION_PLAYING_STATE_CHANGED} intent.
*/
- public static final int STATE_NOT_PLAYING = 11;
+ public static final int STATE_NOT_PLAYING = 11;
/**
* We don't have a stored preference for whether or not the given A2DP sink device supports
* optional codecs.
- * @hide */
+ *
+ * @hide
+ */
public static final int OPTIONAL_CODECS_SUPPORT_UNKNOWN = -1;
/**
* The given A2DP sink device does not support optional codecs.
- * @hide */
+ *
+ * @hide
+ */
public static final int OPTIONAL_CODECS_NOT_SUPPORTED = 0;
/**
* The given A2DP sink device does support optional codecs.
- * @hide */
+ *
+ * @hide
+ */
public static final int OPTIONAL_CODECS_SUPPORTED = 1;
/**
* We don't have a stored preference for whether optional codecs should be enabled or disabled
* for the given A2DP device.
- * @hide */
+ *
+ * @hide
+ */
public static final int OPTIONAL_CODECS_PREF_UNKNOWN = -1;
/**
* Optional codecs should be disabled for the given A2DP device.
- * @hide */
+ *
+ * @hide
+ */
public static final int OPTIONAL_CODECS_PREF_DISABLED = 0;
/**
- * Optional codecs should be enabled for the given A2DP device.
- * @hide */
+ * Optional codecs should be enabled for the given A2DP device.
+ *
+ * @hide
+ */
public static final int OPTIONAL_CODECS_PREF_ENABLED = 1;
private Context mContext;
private ServiceListener mServiceListener;
private final ReentrantReadWriteLock mServiceLock = new ReentrantReadWriteLock();
- @GuardedBy("mServiceLock") private IBluetoothA2dp mService;
+ @GuardedBy("mServiceLock")
+ private IBluetoothA2dp mService;
private BluetoothAdapter mAdapter;
final private IBluetoothStateChangeCallback mBluetoothStateChangeCallback =
@@ -193,21 +206,21 @@
try {
mServiceLock.readLock().lock();
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);
} finally {
mServiceLock.readLock().unlock();
}
}
}
- };
+ };
+
/**
* Create a BluetoothA2dp proxy object for interacting with the local
* Bluetooth A2DP service.
- *
*/
/*package*/ BluetoothA2dp(Context context, ServiceListener l) {
mContext = context;
@@ -218,7 +231,7 @@
try {
mgr.registerStateChangeCallback(mBluetoothStateChangeCallback);
} catch (RemoteException e) {
- Log.e(TAG,"",e);
+ Log.e(TAG, "", e);
}
}
@@ -244,7 +257,7 @@
try {
mgr.unregisterStateChangeCallback(mBluetoothStateChangeCallback);
} catch (Exception e) {
- Log.e(TAG,"",e);
+ Log.e(TAG, "", e);
}
}
@@ -265,6 +278,7 @@
// The empty finalize needs to be kept or the
// cts signature tests would fail.
}
+
/**
* Initiate connection to a profile of the remote bluetooth device.
*
@@ -283,8 +297,7 @@
* permission.
*
* @param device Remote Bluetooth Device
- * @return false on immediate error,
- * true otherwise
+ * @return false on immediate error, true otherwise
* @hide
*/
public boolean connect(BluetoothDevice device) {
@@ -292,7 +305,7 @@
try {
mServiceLock.readLock().lock();
if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ isValidDevice(device)) {
return mService.connect(device);
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -327,8 +340,7 @@
* permission.
*
* @param device Remote Bluetooth Device
- * @return false on immediate error,
- * true otherwise
+ * @return false on immediate error, true otherwise
* @hide
*/
public boolean disconnect(BluetoothDevice device) {
@@ -336,7 +348,7 @@
try {
mServiceLock.readLock().lock();
if (mService != null && isEnabled() &&
- isValidDevice(device)) {
+ isValidDevice(device)) {
return mService.disconnect(device);
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -397,7 +409,7 @@
try {
mServiceLock.readLock().lock();
if (mService != null && isEnabled()
- && isValidDevice(device)) {
+ && isValidDevice(device)) {
return mService.getConnectionState(device);
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -414,7 +426,7 @@
* Set priority of the profile
*
* <p> The device should already be paired.
- * Priority can be one of {@link #PRIORITY_ON} orgetBluetoothManager
+ * Priority can be one of {@link #PRIORITY_ON} orgetBluetoothManager
* {@link #PRIORITY_OFF},
*
* <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}
@@ -430,9 +442,9 @@
try {
mServiceLock.readLock().lock();
if (mService != null && isEnabled()
- && isValidDevice(device)) {
+ && isValidDevice(device)) {
if (priority != BluetoothProfile.PRIORITY_OFF &&
- priority != BluetoothProfile.PRIORITY_ON) {
+ priority != BluetoothProfile.PRIORITY_ON) {
return false;
}
return mService.setPriority(device, priority);
@@ -464,7 +476,7 @@
try {
mServiceLock.readLock().lock();
if (mService != null && isEnabled()
- && isValidDevice(device)) {
+ && isValidDevice(device)) {
return mService.getPriority(device);
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -560,7 +572,7 @@
try {
mServiceLock.readLock().lock();
if (mService != null && isEnabled()
- && isValidDevice(device)) {
+ && isValidDevice(device)) {
return mService.isA2dpPlaying(device);
}
if (mService == null) Log.w(TAG, "Proxy not attached to service");
@@ -577,6 +589,7 @@
* This function checks if the remote device is an AVCRP
* target and thus whether we should send volume keys
* changes or not.
+ *
* @hide
*/
public boolean shouldSendVolumeKeys(BluetoothDevice device) {
@@ -584,7 +597,7 @@
ParcelUuid[] uuids = device.getUuids();
if (uuids == null) return false;
- for (ParcelUuid uuid: uuids) {
+ for (ParcelUuid uuid : uuids) {
if (BluetoothUuid.isAvrcpTarget(uuid)) {
return true;
}
@@ -691,8 +704,7 @@
*
* @param device The device to check
* @return one of OPTIONAL_CODECS_SUPPORT_UNKNOWN, OPTIONAL_CODECS_NOT_SUPPORTED, or
- * OPTIONAL_CODECS_SUPPORTED.
- *
+ * OPTIONAL_CODECS_SUPPORTED.
* @hide
*/
public int supportsOptionalCodecs(BluetoothDevice device) {
@@ -716,8 +728,7 @@
*
* @param device The device in question.
* @return one of OPTIONAL_CODECS_PREF_UNKNOWN, OPTIONAL_CODECS_PREF_ENABLED, or
- * OPTIONAL_CODECS_PREF_DISABLED.
- *
+ * OPTIONAL_CODECS_PREF_DISABLED.
* @hide
*/
public int getOptionalCodecsEnabled(BluetoothDevice device) {
@@ -741,8 +752,8 @@
*
* @param device The device to set this preference for.
* @param value Whether the optional codecs should be enabled for this device. This should be
- * one of OPTIONAL_CODECS_PREF_UNKNOWN, OPTIONAL_CODECS_PREF_ENABLED, or
- * OPTIONAL_CODECS_PREF_DISABLED.
+ * one of OPTIONAL_CODECS_PREF_UNKNOWN, OPTIONAL_CODECS_PREF_ENABLED, or
+ * OPTIONAL_CODECS_PREF_DISABLED.
* @hide
*/
public void setOptionalCodecsEnabled(BluetoothDevice device, int value) {
@@ -772,24 +783,25 @@
* Helper for converting a state to a string.
*
* For debug use only - strings are not internationalized.
+ *
* @hide
*/
public static String stateToString(int state) {
switch (state) {
- case STATE_DISCONNECTED:
- return "disconnected";
- case STATE_CONNECTING:
- return "connecting";
- case STATE_CONNECTED:
- return "connected";
- case STATE_DISCONNECTING:
- return "disconnecting";
- case STATE_PLAYING:
- return "playing";
- case STATE_NOT_PLAYING:
- return "not playing";
- default:
- return "<unknown state " + state + ">";
+ case STATE_DISCONNECTED:
+ return "disconnected";
+ case STATE_CONNECTING:
+ return "connecting";
+ case STATE_CONNECTED:
+ return "connected";
+ case STATE_DISCONNECTING:
+ return "disconnecting";
+ case STATE_PLAYING:
+ return "playing";
+ case STATE_NOT_PLAYING:
+ return "not playing";
+ default:
+ return "<unknown state " + state + ">";
}
}
@@ -807,6 +819,7 @@
mServiceListener.onServiceConnected(BluetoothProfile.A2DP, BluetoothA2dp.this);
}
}
+
public void onServiceDisconnected(ComponentName className) {
if (DBG) Log.d(TAG, "Proxy object disconnected");
try {
@@ -822,18 +835,18 @@
};
private boolean isEnabled() {
- if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true;
- return false;
+ if (mAdapter.getState() == BluetoothAdapter.STATE_ON) return true;
+ return false;
}
private boolean isValidDevice(BluetoothDevice device) {
- if (device == null) return false;
+ if (device == null) return false;
- if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
- return false;
+ if (BluetoothAdapter.checkBluetoothAddress(device.getAddress())) return true;
+ return false;
}
private static void log(String msg) {
- Log.d(TAG, msg);
+ Log.d(TAG, msg);
}
}