Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2992cd08 authored by Jack He's avatar Jack He
Browse files

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
parent a355e5ef
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
    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 @@ public final class BluetoothA2dp implements BluetoothProfile {
        }
    }

    @Override
    public void finalize() {
        // The empty finalize needs to be kept or the
        // cts signature tests would fail.
@@ -304,8 +305,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        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 @@ public final class BluetoothA2dp implements BluetoothProfile {
        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 @@ public final class BluetoothA2dp implements BluetoothProfile {
    /**
     * {@inheritDoc}
     */
    @Override
    public List<BluetoothDevice> getConnectedDevices() {
        if (VDBG) log("getConnectedDevices()");
        try {
@@ -384,6 +384,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
    /**
     * {@inheritDoc}
     */
    @Override
    public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
        if (VDBG) log("getDevicesMatchingStates()");
        try {
@@ -404,6 +405,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
    /**
     * {@inheritDoc}
     */
    @Override
    public int getConnectionState(BluetoothDevice device) {
        if (VDBG) log("getState(" + device + ")");
        try {
@@ -443,8 +445,8 @@ public final class BluetoothA2dp implements BluetoothProfile {
            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 final class BluetoothA2dp implements BluetoothProfile {
     */
    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;
            }
+11 −9
Original line number Diff line number Diff line
@@ -120,15 +120,15 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * 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 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
        }
    }

    @Override
    public void finalize() {
        close();
    }
@@ -239,8 +240,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     */
    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 final class BluetoothA2dpSink implements BluetoothProfile {
     */
    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 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
     * {@inheritDoc}
     */
    @Override
    public List<BluetoothDevice> getConnectedDevices() {
        if (VDBG) log("getConnectedDevices()");
        if (mService != null && isEnabled()) {
@@ -312,6 +312,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
     * {@inheritDoc}
     */
    @Override
    public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
        if (VDBG) log("getDevicesMatchingStates()");
        if (mService != null && isEnabled()) {
@@ -329,6 +330,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
     * {@inheritDoc}
     */
    @Override
    public int getConnectionState(BluetoothDevice device) {
        if (VDBG) log("getState(" + device + ")");
        if (mService != null && isEnabled()
@@ -389,8 +391,8 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
        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 {
+5 −3
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ public final class BluetoothActivityEnergyInfo implements Parcelable {
                }
            };


    @Override
    @SuppressWarnings("unchecked")
    public void writeToParcel(Parcel out, int flags) {
        out.writeLong(mTimestamp);
@@ -98,6 +100,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable {
        out.writeTypedArray(mUidTraffic, flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }
@@ -158,8 +161,7 @@ public final class BluetoothActivityEnergyInfo implements Parcelable {
     * @return if the record is valid
     */
    public boolean isValid() {
        return ((mControllerTxTimeMs >= 0) &&
                (mControllerRxTimeMs >= 0) &&
                (mControllerIdleTimeMs >= 0));
        return ((mControllerTxTimeMs >= 0) && (mControllerRxTimeMs >= 0)
                && (mControllerIdleTimeMs >= 0));
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -2191,7 +2191,7 @@ public final class BluetoothAdapter {
        }
    }

    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 @@ public final class BluetoothAdapter {
     * @hide
     */
    public boolean enableNoAutoConnect() {
        if (isEnabled() == true) {
        if (isEnabled()) {
            if (DBG) Log.d(TAG, "enableNoAutoConnect(): BT already enabled!");
            return true;
        }
@@ -2376,7 +2376,7 @@ public final class BluetoothAdapter {
        return mManagerService;
    }

    final private ArrayList<IBluetoothManagerCallback> mProxyServiceStateCallbacks =
    private final ArrayList<IBluetoothManagerCallback> mProxyServiceStateCallbacks =
            new ArrayList<IBluetoothManagerCallback>();

    /*package*/ IBluetooth getBluetoothService(IBluetoothManagerCallback cb) {
+4 −3
Original line number Diff line number Diff line
@@ -42,9 +42,8 @@ public final class BluetoothAudioConfig implements Parcelable {
    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 @@ public final class BluetoothAudioConfig implements Parcelable {
                + ",mAudioFormat:" + mAudioFormat + "}";
    }

    @Override
    public int describeContents() {
        return 0;
    }
@@ -78,6 +78,7 @@ public final class BluetoothAudioConfig implements Parcelable {
                }
            };

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(mSampleRate);
        out.writeInt(mChannelConfig);
Loading