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

Commit 27c98fd7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Ie4273ac9,Ic1635200,Ibaecef12,Ib1228c74,I6000e7a3, ... into main

* changes:
  ErrorProne: Enforce & fix CatchFail
  ErrorProne: Enforce & fix NonApiType
  ErrorProne: Enforce & fix UnnecessaryAssignment
  ErrorProne: Enforce & fix EmptyCatch
  ErrorProne: Enforce & fix UnnecessaryAsync
  ErrorProne: Enforce & fix InvalidInlineTag
  Enable error prone at build
parents 35f08674 c10230bd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -315,6 +315,7 @@ android_app {
        "com.android.btservices",
    ],
    errorprone: {
        enabled: true,
        javacflags: [
            // "-Xep:AndroidFrameworkRequiresPermission:ERROR",
            "-Xep:AlmostJavadoc:ERROR",
+14 −0
Original line number Diff line number Diff line
@@ -54,6 +54,20 @@ java_defaults {
        "mts-bluetooth",
    ],

    errorprone: {
        enabled: true,
        javacflags: [
            "-Xep:AlmostJavadoc:ERROR",
            "-Xep:CatchFail:ERROR",
            "-Xep:EmptyCatch:ERROR",
            "-Xep:InvalidInlineTag:ERROR",
            "-Xep:NonApiType:ERROR",
            "-Xep:UnnecessaryAssignment:ERROR",
            "-Xep:UnnecessaryAsync:ERROR",
            "-Xep:UnusedMethod:ERROR",
        ],
    },

    instrumentation_for: "Bluetooth",
}

+5 −2
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
@@ -256,6 +257,7 @@ public class TestUtils {
                    try {
                        wait();
                    } catch (InterruptedException e) {
                        Log.w(TAG, "waitForIdle got interrupted", e);
                    }
                }
            }
@@ -303,8 +305,8 @@ public class TestUtils {
     * @return A {@link HashMap} of Bluetooth configs in the format: section -> key1 -> value1 ->
     *     key2 -> value2 Assume no empty section name, no duplicate keys in the same section
     */
    public static HashMap<String, HashMap<String, String>> readAdapterConfig() {
        HashMap<String, HashMap<String, String>> adapterConfig = new HashMap<>();
    public static Map<String, Map<String, String>> readAdapterConfig() {
        Map<String, Map<String, String>> adapterConfig = new HashMap<>();
        try (BufferedReader reader =
                new BufferedReader(new FileReader("/data/misc/bluedroid/bt_config.conf"))) {
            String section = "";
@@ -454,6 +456,7 @@ public class TestUtils {
                    try {
                        wait();
                    } catch (InterruptedException e) {
                        Log.w(TAG, "waitForComplete got interrupted", e);
                    }
                }
            }
+0 −7
Original line number Diff line number Diff line
@@ -81,13 +81,6 @@ public class CoverArtTest {
        return BitmapFactory.decodeStream(imageInputStream);
    }

    private InputStream toInputSteam(Bitmap bitmap) {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.PNG, 0, outputStream);
        byte[] imageBytes = outputStream.toByteArray();
        return new ByteArrayInputStream(imageBytes);
    }

    private Bitmap toBitmap(byte[] imageBytes) {
        ByteArrayInputStream inputStream = new ByteArrayInputStream(imageBytes);
        return BitmapFactory.decodeStream(inputStream);
+1 −6
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.after;
@@ -297,11 +296,7 @@ public class BatteryStateMachineTest {
        allowConnection(true);
        allowConnectGatt(true);

        try {
        mBatteryStateMachine.updateBatteryLevel(new byte[0]);
        } catch (Exception ex) {
            fail();
        }

        verify(mBatteryService, after(WAIT_MS).never())
                .handleBatteryChanged(any(BluetoothDevice.class), anyInt());
Loading