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

Commit caae8dc8 authored by Kyunglyul Hyun's avatar Kyunglyul Hyun
Browse files

Media: Introduce MediaRouter2

Instead of extending MediaRouter, this CL introduce MediaRouter2 class.
This will prevent regression from chaing MediaRouter and we can easily
modify and test `new' features.
For MediaRouter2, IMediaRouter2Client is also added to differentiate the
previous router and the new one in MediaRouterService.

This CL also contains MediaRouter2.sendControlRequest which can be used
to manipulate media routes.
(It is temporarily being used to test MediaRouter2Manager callbacks.)

Bug: 132138073
Test: atest mediaroutertest (w/ mediarouteprovider installed)

Change-Id: I895fe456e38d437cec8e3ca9501cd7f105c5f4d6
parent 50a006d7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -483,8 +483,9 @@ java_defaults {
        "media/java/android/media/IMediaResourceMonitor.aidl",
        "media/java/android/media/IMediaRoute2Provider.aidl",
        "media/java/android/media/IMediaRoute2ProviderClient.aidl",
        "media/java/android/media/IMediaRouterClient.aidl",
        "media/java/android/media/IMediaRouter2Client.aidl",
        "media/java/android/media/IMediaRouter2Manager.aidl",
        "media/java/android/media/IMediaRouterClient.aidl",
        "media/java/android/media/IMediaRouterService.aidl",
        "media/java/android/media/IMediaScannerListener.aidl",
        "media/java/android/media/IMediaScannerService.aidl",
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.media;

import android.content.Intent;
import android.media.IMediaRoute2ProviderClient;

/**
@@ -23,5 +24,6 @@ import android.media.IMediaRoute2ProviderClient;
 */
oneway interface IMediaRoute2Provider {
    void registerClient(IMediaRoute2ProviderClient client);
    void selectRoute(int uid, String id);
    void selectRoute(IMediaRoute2ProviderClient client, int uid, String id);
    void notifyControlRequestSent(IMediaRoute2ProviderClient client, String id, in Intent request);
}
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.media;

/**
 * @hide
 */
oneway interface IMediaRouter2Client {
    void notifyStateChanged();
    void notifyRestoreRoute();
}
+11 −2
Original line number Diff line number Diff line
@@ -16,26 +16,35 @@

package android.media;

import android.media.IMediaRouterClient;
import android.content.Intent;
import android.media.IMediaRouter2Client;
import android.media.IMediaRouter2Manager;
import android.media.IMediaRouterClient;
import android.media.MediaRoute2Info;
import android.media.MediaRouterClientState;

/**
 * {@hide}
 */
interface IMediaRouterService {
    //TODO: Merge or remove methods when media router 2 is done.
    void registerClientAsUser(IMediaRouterClient client, String packageName, int userId);
    void unregisterClient(IMediaRouterClient client);

    MediaRouterClientState getState(IMediaRouterClient client);
    boolean isPlaybackActive(IMediaRouterClient client);

    void setControlCategories(IMediaRouterClient client, in List<String> categories);
    void setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan);
    void setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit);
    void requestSetVolume(IMediaRouterClient client, String routeId, int volume);
    void requestUpdateVolume(IMediaRouterClient client, String routeId, int direction);

    // Methods for media router 2
    void registerClient2AsUser(IMediaRouter2Client client, String packageName, int userId);
    void unregisterClient2(IMediaRouter2Client client);
    void sendControlRequest(IMediaRouter2Client client, in MediaRoute2Info route, in Intent request);
    void setControlCategories(IMediaRouter2Client client, in List<String> categories);

    void registerManagerAsUser(IMediaRouter2Manager manager,
            String packageName, int userId);
    void unregisterManager(IMediaRouter2Manager manager);
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.media;

parcelable MediaRoute2Info;
Loading