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

Commit d5e42c20 authored by William Escande's avatar William Escande
Browse files

Enforce lint UseSparseArrays and fix usages

Bug: 289445022
Test: m Bluetooth
Change-Id: I61296722e4c6ca522124fa0fe1de9d29928f5b84
parent 5431f6b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ android_app {
            "NewApi",
            "ObsoleteSdkInt",
            "Recycle",
            "UseSparseArrays",
        ],
        strict_updatability_linting: true,
    },
+0 −8
Original line number Diff line number Diff line
@@ -5679,14 +5679,6 @@
            line="506"/>
    </issue>

    <issue
        id="UseSparseArrays"
        message="Use `new SparseIntArray(...)` instead for better performance">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/avrcpcontroller/PlayerApplicationSettings.java"
            line="70"/>
    </issue>

    <issue
        id="UseValueOf"
        message="Use `Integer.valueOf(arg)` instead">
+3 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.bluetooth.avrcpcontroller;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseIntArray;

import com.android.internal.annotations.VisibleForTesting;

@@ -67,7 +68,7 @@ class PlayerApplicationSettings {
    /*
     * Hash map of current settings.
     */
    private SparseArray<Integer> mSettings = new SparseArray<>();
    private SparseIntArray mSettings = new SparseIntArray();

    /*
     * Hash map of supported values, a setting should be supported by the remote in order to enable
@@ -128,8 +129,7 @@ class PlayerApplicationSettings {
    }

    public int getSetting(int settingType) {
        if (null == mSettings.get(settingType)) return -1;
        return mSettings.get(settingType);
        return mSettings.get(settingType, -1);
    }

    // Convert a native Attribute Id/Value pair into the AVRCP equivalent value.