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

Commit 11caa367 authored by David Duarte's avatar David Duarte
Browse files

BluetoothHearingAid: Use Collections.emptyList()

Replace all new ArrayList by Collections.emptyList().
Collections.emptyList gives an imutable list.

Bug: 311713922
Test: m com.android.btservices
Change-Id: I6d5368f6ad831fb4b13bbf024f984df84eb8f8ba
parent 43e97ead
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ import com.android.modules.utils.SynchronousResultReceiver;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeoutException;

@@ -471,7 +471,7 @@ public final class BluetoothHearingAid implements BluetoothProfile {
    public @NonNull List<BluetoothDevice> getConnectedDevices() {
        if (VDBG) Log.v(TAG, "getConnectedDevices()");
        final IBluetoothHearingAid service = getService();
        final List<BluetoothDevice> defaultValue = new ArrayList<BluetoothDevice>();
        final List<BluetoothDevice> defaultValue = Collections.emptyList();
        if (service == null) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
@@ -500,7 +500,7 @@ public final class BluetoothHearingAid implements BluetoothProfile {
    public List<BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[] states) {
        if (VDBG) Log.v(TAG, "getDevicesMatchingStates()");
        final IBluetoothHearingAid service = getService();
        final List<BluetoothDevice> defaultValue = new ArrayList<BluetoothDevice>();
        final List<BluetoothDevice> defaultValue = Collections.emptyList();
        if (service == null) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
@@ -602,7 +602,7 @@ public final class BluetoothHearingAid implements BluetoothProfile {
    public @NonNull List<BluetoothDevice> getActiveDevices() {
        if (VDBG) Log.v(TAG, "getActiveDevices()");
        final IBluetoothHearingAid service = getService();
        final List<BluetoothDevice> defaultValue = new ArrayList<>();
        final List<BluetoothDevice> defaultValue = Collections.emptyList();
        if (service == null) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));