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

Commit 9852a94e authored by William Escande's avatar William Escande
Browse files

ErrorProne: Enforce & fix NonApiType

See https://errorprone.info/bugpattern/NonApiType

Bug: 344658662
Test: m BluetoothInstrumentationTests
Flag: Exempt Build and test only
Change-Id: Ibf6b02e1ca0e8446013e388c03c305e25eac4d8d
parent 422c21c5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -329,6 +329,7 @@ android_app {
            "-Xep:InvalidBlockTag:ERROR",
            "-Xep:InvalidParam:ERROR",
            "-Xep:MockNotUsedInProduction:ERROR",
            "-Xep:NonApiType:ERROR",
            "-Xep:NonCanonicalType:ERROR",
            "-Xep:ReturnAtTheEndOfVoidFunction:ERROR",
            "-Xep:UnusedMethod:ERROR",
+1 −1
Original line number Diff line number Diff line
@@ -2882,7 +2882,7 @@ static int register_com_android_bluetooth_gatt_(JNIEnv* env) {
      {"onClientCongestion", "(IZ)V", &method_onClientCongestion},
      {"getSampleGattDbElement", "()Lcom/android/bluetooth/gatt/GattDbElement;",
       &method_getSampleGattDbElement},
      {"onGetGattDb", "(ILjava/util/ArrayList;)V", &method_onGetGattDb},
      {"onGetGattDb", "(ILjava/util/List;)V", &method_onGetGattDb},
      {"onClientPhyRead", "(ILjava/lang/String;III)V", &method_onClientPhyRead},
      {"onClientPhyUpdate", "(IIII)V", &method_onClientPhyUpdate},
      {"onClientConnUpdate", "(IIIII)V", &method_onClientConnUpdate},
+4 −6
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Handles API calls to a MediaBrowser.
@@ -41,7 +42,6 @@ import java.util.List;
 * callback when it gets the answer from MediaBrowser.
 */
class MediaBrowserWrapper {

    private static final String TAG = MediaBrowserWrapper.class.getSimpleName();

    /**
@@ -86,8 +86,7 @@ class MediaBrowserWrapper {

    // GetFolderItems also works with a callback, so we need to store all requests made before we
    // got the results and prevent new subscriptions.
    private final HashMap<String, ArrayList<GetFolderItemsCallback>> mSubscribedIds =
            new HashMap<>();
    private final Map<String, List<GetFolderItemsCallback>> mSubscribedIds = new HashMap<>();

    private final Runnable mDisconnectRunnable = () -> _disconnect();

@@ -328,7 +327,7 @@ class MediaBrowserWrapper {
            mRunHandler.postDelayed(mTimeoutRunnable, BROWSER_DISCONNECT_TIMEOUT.toMillis());
        }

        private void executeCallbacks(String parentId, ArrayList<ListItem> browsableContent) {
        private void executeCallbacks(String parentId, List<ListItem> browsableContent) {
            if (mCallbacksExecuted) {
                return;
            }
@@ -353,8 +352,7 @@ class MediaBrowserWrapper {

        @Override
        public void onChildrenLoaded(String parentId, List<MediaItem> children) {

            ArrayList<ListItem> browsableContent = new ArrayList<>();
            List<ListItem> browsableContent = new ArrayList<>();

            for (MediaItem item : children) {
                if (item.isBrowsable()) {
+7 −6
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import java.io.InputStream;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
@@ -142,10 +143,10 @@ public class BipImageProperties {
    private boolean mHasThumbnailFormat = false;

    /** The various sets of available formats. */
    private ArrayList<BipImageFormat> mNativeFormats;
    private List<BipImageFormat> mNativeFormats;

    private ArrayList<BipImageFormat> mVariantFormats;
    private ArrayList<BipAttachmentFormat> mAttachments;
    private List<BipImageFormat> mVariantFormats;
    private List<BipAttachmentFormat> mAttachments;

    private BipImageProperties() {
        mVersion = sVersion;
@@ -226,15 +227,15 @@ public class BipImageProperties {
        return mFriendlyName;
    }

    public ArrayList<BipImageFormat> getNativeFormats() {
    public List<BipImageFormat> getNativeFormats() {
        return mNativeFormats;
    }

    public ArrayList<BipImageFormat> getVariantFormats() {
    public List<BipImageFormat> getVariantFormats() {
        return mVariantFormats;
    }

    public ArrayList<BipAttachmentFormat> getAttachments() {
    public List<BipAttachmentFormat> getAttachments() {
        return mAttachments;
    }

+13 −12
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
@@ -57,8 +58,8 @@ class BaseData {
    private static final int CODEC_AUDIO_FRAME_DURATION_10MS = 0x01;

    private final BaseInformation mLevelOne;
    private final ArrayList<BaseInformation> mLevelTwo;
    private final ArrayList<BaseInformation> mLevelThree;
    private final List<BaseInformation> mLevelTwo;
    private final List<BaseInformation> mLevelThree;

    private int mNumBISIndices = 0;

@@ -185,8 +186,8 @@ class BaseData {

    BaseData(
            BaseInformation levelOne,
            ArrayList<BaseInformation> levelTwo,
            ArrayList<BaseInformation> levelThree,
            List<BaseInformation> levelTwo,
            List<BaseInformation> levelThree,
            int numOfBISIndices) {
        mLevelOne = levelOne;
        mLevelTwo = levelTwo;
@@ -200,8 +201,8 @@ class BaseData {
            throw new IllegalArgumentException("Basedata: serviceData is null");
        }
        BaseInformation levelOne = new BaseInformation();
        ArrayList<BaseInformation> levelTwo = new ArrayList<BaseInformation>();
        ArrayList<BaseInformation> levelThree = new ArrayList<BaseInformation>();
        List<BaseInformation> levelTwo = new ArrayList<>();
        List<BaseInformation> levelThree = new ArrayList<>();
        int numOfBISIndices = 0;
        log("BASE input" + Arrays.toString(serviceData));

@@ -291,7 +292,7 @@ class BaseData {
    }

    static void consolidateBaseofLevelTwo(
            ArrayList<BaseInformation> levelTwo, ArrayList<BaseInformation> levelThree) {
            List<BaseInformation> levelTwo, List<BaseInformation> levelThree) {
        int startIdx = 0;
        int children = 0;
        for (int i = 0; i < levelTwo.size(); i++) {
@@ -350,8 +351,8 @@ class BaseData {
    }

    static void consolidateBaseofLevelThree(
            ArrayList<BaseInformation> levelTwo,
            ArrayList<BaseInformation> levelThree,
            List<BaseInformation> levelTwo,
            List<BaseInformation> levelThree,
            int parentSubgroup,
            int startIdx,
            int numNodes) {
@@ -387,11 +388,11 @@ class BaseData {
        return mLevelOne;
    }

    public ArrayList<BaseInformation> getLevelTwo() {
    public List<BaseInformation> getLevelTwo() {
        return mLevelTwo;
    }

    public ArrayList<BaseInformation> getLevelThree() {
    public List<BaseInformation> getLevelThree() {
        return mLevelThree;
    }

@@ -403,7 +404,7 @@ class BaseData {
        return ret;
    }

    public ArrayList<BaseInformation> getBISIndexInfos() {
    public List<BaseInformation> getBISIndexInfos() {
        return mLevelThree;
    }

Loading