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

Commit 02a62a39 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "Use Collections for empty list return" into main

parents 1445664f 37f9af07
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
@@ -1364,7 +1365,7 @@ public class A2dpService extends ProfileService {
        public List<BluetoothDevice> getConnectedDevices(AttributionSource source) {
            A2dpService service = getService(source);
            if (service == null) {
                return new ArrayList<>();
                return Collections.emptyList();
            }

            return service.getConnectedDevices();
@@ -1375,7 +1376,7 @@ public class A2dpService extends ProfileService {
                int[] states, AttributionSource source) {
            A2dpService service = getService(source);
            if (service == null) {
                return new ArrayList<>();
                return Collections.emptyList();
            }

            return service.getDevicesMatchingConnectionStates(states);
@@ -1467,7 +1468,7 @@ public class A2dpService extends ProfileService {
        public List<BluetoothCodecType> getSupportedCodecTypes(AttributionSource source) {
            A2dpService service = getService(source);
            if (service == null) {
                return new ArrayList<>();
                return Collections.emptyList();
            }

            enforceBluetoothPrivilegedPermission(service);
+3 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -248,7 +249,7 @@ public class A2dpSinkService extends ProfileService {
        public List<BluetoothDevice> getConnectedDevices(AttributionSource source) {
            A2dpSinkService service = getService(source);
            if (service == null) {
                return new ArrayList<BluetoothDevice>(0);
                return Collections.emptyList();
            }
            return service.getConnectedDevices();
        }
@@ -258,7 +259,7 @@ public class A2dpSinkService extends ProfileService {
                int[] states, AttributionSource source) {
            A2dpSinkService service = getService(source);
            if (service == null) {
                return new ArrayList<BluetoothDevice>(0);
                return Collections.emptyList();
            }
            return service.getDevicesMatchingConnectionStates(states);
        }
+4 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.util.Log;
import com.android.bluetooth.R;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

class Util {
@@ -117,15 +118,15 @@ class Util {
     */
    public static List<Metadata> toMetadataList(Context context,
            List<MediaSession.QueueItem> items) {
        ArrayList<Metadata> list = new ArrayList<Metadata>();

        if (items == null) return list;
        if (items == null) return Collections.emptyList();

        ArrayList<Metadata> list = new ArrayList<Metadata>();
        for (int i = 0; i < items.size(); i++) {
            Metadata data = toMetadata(context, items.get(i));
            if (isEmptyData(data)) {
                Log.e(TAG, "Received an empty Metadata item in list. Returning an empty queue");
                return new ArrayList<Metadata>();
                return Collections.emptyList();
            }
            data.trackNum = "" + (i + 1);
            data.numTracks = "" + items.size();
+3 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -382,7 +383,7 @@ public class AvrcpControllerService extends ProfileService {
        public List<BluetoothDevice> getConnectedDevices(AttributionSource source) {
            AvrcpControllerService service = getService(source);
            if (service == null) {
                return new ArrayList<BluetoothDevice>(0);
                return Collections.emptyList();
            }
            return service.getConnectedDevices();
        }
@@ -392,7 +393,7 @@ public class AvrcpControllerService extends ProfileService {
                int[] states, AttributionSource source) {
            AvrcpControllerService service = getService(source);
            if (service == null) {
                return new ArrayList<BluetoothDevice>(0);
                return Collections.emptyList();
            }
            return service.getDevicesMatchingConnectionStates(states);
        }
+1 −1
Original line number Diff line number Diff line
@@ -371,7 +371,7 @@ class AvrcpControllerStateMachine extends StateMachine {
        if (mCoverArtManager == null) return;
        AvrcpItem currentTrack = getCurrentTrack();
        String currentTrackUuid = currentTrack != null ? currentTrack.getCoverArtUuid() : null;
        ArrayList<String> unusedArtwork = mBrowseTree.getAndClearUnusedCoverArt();
        List<String> unusedArtwork = mBrowseTree.getAndClearUnusedCoverArt();
        for (String uuid : unusedArtwork) {
            if (!uuid.equals(currentTrackUuid)) {
                mCoverArtManager.removeImage(mDevice, uuid);
Loading