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

Commit 1c8188f2 authored by Kyunglyul Hyun's avatar Kyunglyul Hyun
Browse files

Media: Add MediaRouterManager to control media route of other apps

This CL is a draft for supporting seamless transfer

MediaRouterManager is added to notify providers seamless transfer request.

It also adds MediaRouter.setControlCategories() to let application notify
their control categories and filter out irrelevant routes.

Test: atest mediaroutertest after installing mediarouteprovider.apk

Change-Id: I7446855271d27ffaad2e82dda133bed80b9f9630
parent a47b222a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -474,7 +474,10 @@ java_defaults {
        "media/java/android/media/IMediaHTTPConnection.aidl",
        "media/java/android/media/IMediaHTTPService.aidl",
        "media/java/android/media/IMediaResourceMonitor.aidl",
        "media/java/android/media/IMediaRoute2Callback.aidl",
        "media/java/android/media/IMediaRoute2Provider.aidl",
        "media/java/android/media/IMediaRouterClient.aidl",
        "media/java/android/media/IMediaRouter2ManagerClient.aidl",
        "media/java/android/media/IMediaRouterService.aidl",
        "media/java/android/media/IMediaScannerListener.aidl",
        "media/java/android/media/IMediaScannerService.aidl",
+24 −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 IMediaRoute2Callback {
    void onRouteSelected(int uid, String routeId);
}
+27 −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;

import android.media.IMediaRoute2Callback;

/**
 * {@hide}
 */
oneway interface IMediaRoute2Provider {
    void setCallback(IMediaRoute2Callback callback);
    void selectRoute(int uid, String id);
}
+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 IMediaRouter2ManagerClient {
    void onRouteSelected(int uid, String routeId);
    void onControlCategoriesChanged(int uid, in List<String> categories);
}
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media;

import android.media.IMediaRouterClient;
import android.media.IMediaRouter2ManagerClient;
import android.media.MediaRouterClientState;

/**
@@ -29,8 +30,15 @@ interface IMediaRouterService {
    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);

    void registerManagerAsUser(IMediaRouter2ManagerClient callback,
            String packageName, int userId);
    void unregisterManager(IMediaRouter2ManagerClient callback);
    void setRemoteRoute(IMediaRouter2ManagerClient callback,
            int uid, String routeId, boolean explicit);
}
Loading