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

Commit f846f215 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add getMediaDeviceById() method"

parents 21ffe60b 0487263c
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -188,6 +188,23 @@ public class LocalMediaManager implements BluetoothCallback {
        mInfoMediaManager.stopScan();
    }

    /**
     * Find the MediaDevice through id.
     *
     * @param devices the list of MediaDevice
     * @param id the unique id of MediaDevice
     * @return MediaDevice
     */
    public MediaDevice getMediaDeviceById(List<MediaDevice> devices, String id) {
        for (MediaDevice mediaDevice : devices) {
            if (mediaDevice.getId().equals(id)) {
                return mediaDevice;
            }
        }
        Log.i(TAG, "getMediaDeviceById() can't found device");
        return null;
    }

    class MediaDeviceCallback implements MediaManager.MediaDeviceCallback {
        @Override
        public void onDeviceAdded(MediaDevice device) {