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

Commit 97359c0d authored by William Escande's avatar William Escande
Browse files

ERROR_PRONE: enforce AlreadyChecked and fix it

This is a no-op change

Bug: 280890575
Test: atest ServiceBluetoothTests
Test: m RUN_ERROR_PRONE=true service-bluetooth
Change-Id: Ie5e0886576583f67b93cb6e2da8c0128e141048c
parent 648d7dff
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ java_defaults {
    defaults: ["bluetooth-module-sdk-version-defaults"],
    errorprone: {
        javacflags: [
            "-Xep:AlreadyChecked:ERROR",
            "-Xep:CheckReturnValue:ERROR",
            "-Xep:ClassCanBeStatic:ERROR",
            "-Xep:EqualsIncompatibleType:ERROR",
+20 −23
Original line number Diff line number Diff line
@@ -2624,9 +2624,6 @@ class BluetoothManagerService {
            return;
        }
        // Notify all proxy objects first of adapter state change
        if (newState == STATE_BLE_ON || newState == STATE_OFF) {
            boolean intermediate_off = (prevState == STATE_TURNING_OFF && newState == STATE_BLE_ON);

        if (newState == STATE_OFF) {
            // If Bluetooth is off, send service down event to proxy objects, and unbind
            if (DBG) {
@@ -2645,7 +2642,8 @@ class BluetoothManagerService {
             * passing through BLE_ON. We should broadcast the OFF intent in this case. */
            isStandardBroadcast = !isBleState(prevState);

            } else if (!intermediate_off) {
        } else if (newState == STATE_BLE_ON) {
            if (prevState != STATE_TURNING_OFF) {
                // connect to GattService
                if (DBG) {
                    Log.d(TAG, "Bluetooth is in LE only mode");
@@ -2668,10 +2666,9 @@ class BluetoothManagerService {
                sendBleStateChanged(prevState, newState);
                // Don't broadcase this as std intent
                isStandardBroadcast = false;

            } else if (intermediate_off) {
            } else {
                if (DBG) {
                    Log.d(TAG, "Intermediate off, back to LE only mode");
                    Log.d(TAG, " Back to LE only mode");
                }
                // For LE only mode, broadcast as is
                sendBleStateChanged(prevState, newState);