MediaSession2: Move binder interfaces into the updatable
Test: Run all MediaComponents tests once Change-Id: I29a7aa9d649ea212ad4728ebabff40ec0d47ecb1
This commit is contained in:
@@ -429,8 +429,6 @@ java_library {
|
||||
"media/java/android/media/IMediaRouterService.aidl",
|
||||
"media/java/android/media/IMediaScannerListener.aidl",
|
||||
"media/java/android/media/IMediaScannerService.aidl",
|
||||
"media/java/android/media/IMediaSession2.aidl",
|
||||
"media/java/android/media/IMediaSession2Callback.aidl",
|
||||
"media/java/android/media/IPlaybackConfigDispatcher.aidl",
|
||||
"media/java/android/media/ISessionTokensListener.aidl",
|
||||
":libaudioclient_aidl",
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 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.IMediaSession2Callback;
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
|
||||
/**
|
||||
* Interface to MediaSession2. Framework MUST only call oneway APIs.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
oneway interface IMediaSession2 {
|
||||
// TODO(jaewan): add onCommand() to send private command
|
||||
// TODO(jaewan): Due to the nature of oneway calls, APIs can be called in out of order
|
||||
// Add id for individual calls to address this.
|
||||
|
||||
// TODO(jaewan): We may consider to add another binder just for the connection
|
||||
// not to expose other methods to the controller whose connection wasn't accepted.
|
||||
// But this would be enough for now because it's the same as existing
|
||||
// MediaBrowser and MediaBrowserService.
|
||||
void connect(String callingPackage, IMediaSession2Callback callback);
|
||||
void release(IMediaSession2Callback caller);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// send command
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void sendCommand(IMediaSession2Callback caller, in Bundle command, in Bundle args);
|
||||
void sendTransportControlCommand(IMediaSession2Callback caller,
|
||||
int commandCode, in Bundle args);
|
||||
void sendCustomCommand(IMediaSession2Callback caller, in Bundle command, in Bundle args,
|
||||
in ResultReceiver receiver);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Get library service specific
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void getBrowserRoot(IMediaSession2Callback callback, in Bundle rootHints);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 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.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
import android.media.session.PlaybackState;
|
||||
import android.media.IMediaSession2;
|
||||
|
||||
/**
|
||||
* Interface from MediaSession2 to MediaSession2Record.
|
||||
* <p>
|
||||
* Keep this interface oneway. Otherwise a malicious app may implement fake version of this,
|
||||
* and holds calls from session to make session owner(s) frozen.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
oneway interface IMediaSession2Callback {
|
||||
void onPlaybackStateChanged(in Bundle state);
|
||||
void onPlaylistParamsChanged(in Bundle params);
|
||||
|
||||
/**
|
||||
* Called only when the controller is created with service's token.
|
||||
*
|
||||
* @param sessionBinder {@code null} if the connect is rejected or is disconnected. a session
|
||||
* binder if the connect is accepted.
|
||||
* @param commands initially allowed commands.
|
||||
*/
|
||||
// TODO(jaewan): Also need to pass flags for allowed actions for permission check.
|
||||
// For example, a media can allow setRating only for whitelisted apps
|
||||
// it's better for controller to know such information in advance.
|
||||
// Follow-up TODO: Add similar functions to the session.
|
||||
// TODO(jaewan): Is term 'accepted/rejected' correct? For permission, 'grant' is used.
|
||||
void onConnectionChanged(IMediaSession2 sessionBinder, in Bundle commandGroup);
|
||||
|
||||
void onCustomLayoutChanged(in List<Bundle> commandButtonlist);
|
||||
|
||||
void sendCustomCommand(in Bundle command, in Bundle args, in ResultReceiver receiver);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Browser sepcific
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void onGetRootResult(in Bundle rootHints, String rootMediaId, in Bundle rootExtra);
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import android.media.update.MediaSession2Provider.ControllerInfoProvider;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IInterface;
|
||||
import android.os.Parcelable;
|
||||
import android.os.ResultReceiver;
|
||||
import android.text.TextUtils;
|
||||
@@ -630,7 +631,7 @@ public class MediaSession2 implements AutoCloseable {
|
||||
// TODO(jaewan): SystemApi
|
||||
// TODO(jaewan): Also accept componentName to check notificaiton listener.
|
||||
public ControllerInfo(Context context, int uid, int pid, String packageName,
|
||||
IMediaSession2Callback callback) {
|
||||
IInterface callback) {
|
||||
mProvider = ApiLoader.getProvider(context)
|
||||
.createMediaSession2ControllerInfoProvider(
|
||||
context, this, uid, pid, packageName, callback);
|
||||
|
||||
@@ -17,7 +17,6 @@ package android.media.session;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.media.IRemoteVolumeController;
|
||||
import android.media.IMediaSession2;
|
||||
import android.media.ISessionTokensListener;
|
||||
import android.media.session.IActiveSessionsListener;
|
||||
import android.media.session.ICallback;
|
||||
|
||||
@@ -16,19 +16,13 @@
|
||||
|
||||
package com.android.server.media;
|
||||
|
||||
import android.annotation.CallSuper;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.media.IMediaSession2;
|
||||
import android.media.MediaController2;
|
||||
import android.media.MediaSession2;
|
||||
import android.media.SessionToken2;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Records a {@link MediaSession2} and holds {@link MediaController2}.
|
||||
|
||||
@@ -39,7 +39,6 @@ import android.media.AudioManager;
|
||||
import android.media.AudioPlaybackConfiguration;
|
||||
import android.media.AudioSystem;
|
||||
import android.media.IAudioService;
|
||||
import android.media.IMediaSession2;
|
||||
import android.media.IRemoteVolumeController;
|
||||
import android.media.ISessionTokensListener;
|
||||
import android.media.MediaLibraryService2;
|
||||
|
||||
Reference in New Issue
Block a user