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

Commit 850a6b2b authored by Chung Tang's avatar Chung Tang Committed by Android (Google) Code Review
Browse files

Merge "[OutputSwitcher] Refactor DeviceRouteController to bring in select,...

Merge "[OutputSwitcher] Refactor DeviceRouteController to bring in select, deselect and routes related function for supporting Le Audio sharing." into main
parents 49dbd164 c4dfdfb5
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -262,6 +262,20 @@ import java.util.concurrent.CopyOnWriteArrayList;
        return mSelectedRoutes;
    }

    @Override
    @NonNull
    public List<MediaRoute2Info> getSelectableRoutes() {
        // TODO(b/421884879): Implement the select / deselect function
        return Collections.emptyList();
    }

    @Override
    @NonNull
    public List<MediaRoute2Info> getDeselectableRoutes() {
        // TODO(b/421884879): Implement the select / deselect function
        return Collections.emptyList();
    }

    @Override
    @NonNull
    public synchronized List<MediaRoute2Info> getAvailableRoutes() {
@@ -312,6 +326,16 @@ import java.util.concurrent.CopyOnWriteArrayList;
        mHandler.post(guardedTransferAction);
    }

    @Override
    public synchronized void selectRoute(long requestId, @NonNull String routeId) {
        // TODO(b/421884879): Implement the select / deselect function
    }

    @Override
    public synchronized void deselectRoute(long requestId, @NonNull String routeId) {
        // TODO(b/421884879): Implement the select / deselect function
    }

    @RequiresPermission(
            anyOf = {
                Manifest.permission.MODIFY_AUDIO_ROUTING,
+32 −0
Original line number Diff line number Diff line
@@ -117,6 +117,22 @@ import java.util.List;
     */
    List<MediaRoute2Info> getAvailableRoutes();

    /**
     * Returns a list of currently selectable routes.
     *
     * <p>For example, BLE devices can be grouped and will show up here.
     */
    @NonNull
    List<MediaRoute2Info> getSelectableRoutes();

    /**
     * Returns a list of currently deselectable routes.
     *
     * <p>For example, selected BLE devices in a broadcast session.
     */
    @NonNull
    List<MediaRoute2Info> getDeselectableRoutes();

    /**
     * Transfers device output to the given route.
     *
@@ -127,6 +143,22 @@ import java.util.List;
     */
    void transferTo(long requestId, @Nullable String routeId);

    /**
     * Adds the route with the given id to the current selected routes, making playback occur on all
     * selected routes simultaneously.
     *
     * @param routeId route that audio would be playing on.
     */
    void selectRoute(long requestId, @NonNull String routeId);

    /**
     * Removes the route with the given id from the current selected routes, playback will be
     * stopped for the related device.
     *
     * @param routeId route that audio would be stopped playing on.
     */
    void deselectRoute(long requestId, @NonNull String routeId);

    /**
     * Updates device route volume.
     *
+25 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.util.Slog;

import com.android.internal.R;

import java.util.Collections;
import java.util.List;
import java.util.Objects;

@@ -131,6 +132,20 @@ import java.util.Objects;
        return List.of(mDeviceRoute);
    }

    @Override
    @NonNull
    public List<MediaRoute2Info> getSelectableRoutes() {
        // Unsupported.
        return Collections.emptyList();
    }

    @Override
    @NonNull
    public List<MediaRoute2Info> getDeselectableRoutes() {
        // Unsupported.
        return Collections.emptyList();
    }

    @Override
    public synchronized List<MediaRoute2Info> getAvailableRoutes() {
        return List.of(mDeviceRoute);
@@ -142,6 +157,16 @@ import java.util.Objects;
        // single non-bluetooth route).
    }

    @Override
    public synchronized void selectRoute(long requestId, @NonNull String routeId) {
        // Unsupported.
    }

    @Override
    public synchronized void deselectRoute(long requestId, @NonNull String routeId) {
        // Unsupported.
    }

    @Override
    public synchronized boolean updateVolume(int volume) {
        if (mDeviceVolume == volume) {