OSDN Git Service

Make MediaSession2.CommandGroup updatable
[android-x86/frameworks-base.git] / media / java / android / media / update / MediaSession2Provider.java
1 /*
2  * Copyright 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package android.media.update;
18
19 import android.media.MediaItem2;
20 import android.media.MediaPlayerInterface;
21 import android.media.MediaPlayerInterface.PlaybackListener;
22 import android.media.MediaSession2.Command;
23 import android.media.MediaSession2.CommandButton;
24 import android.media.MediaSession2.CommandGroup;
25 import android.media.MediaSession2.ControllerInfo;
26 import android.media.MediaSession2.PlaylistParams;
27 import android.media.SessionToken2;
28 import android.media.VolumeProvider;
29 import android.os.Bundle;
30 import android.os.ResultReceiver;
31
32 import java.util.List;
33 import java.util.concurrent.Executor;
34
35 /**
36  * @hide
37  */
38 // TODO: @SystemApi
39 public interface MediaSession2Provider extends TransportControlProvider {
40     void initialize();
41
42     void close_impl();
43     void setPlayer_impl(MediaPlayerInterface player);
44     void setPlayer_impl(MediaPlayerInterface player, VolumeProvider volumeProvider);
45     MediaPlayerInterface getPlayer_impl();
46     SessionToken2 getToken_impl();
47     List<ControllerInfo> getConnectedControllers_impl();
48     void setCustomLayout_impl(ControllerInfo controller, List<CommandButton> layout);
49     void setAudioFocusRequest_impl(int focusGain);
50
51     void setAllowedCommands_impl(ControllerInfo controller, CommandGroup commands);
52     void notifyMetadataChanged_impl();
53     void sendCustomCommand_impl(ControllerInfo controller, Command command, Bundle args,
54             ResultReceiver receiver);
55     void sendCustomCommand_impl(Command command, Bundle args);
56     void setPlaylist_impl(List<MediaItem2> playlist);
57     List<MediaItem2> getPlaylist_impl();
58     void setPlaylistParams_impl(PlaylistParams params);
59     PlaylistParams getPlaylistParams_impl();
60
61     void addPlaybackListener_impl(Executor executor, PlaybackListener listener);
62     void removePlaybackListener_impl(PlaybackListener listener);
63
64     interface CommandProvider {
65         int getCommandCode_impl();
66         String getCustomCommand_impl();
67         Bundle getExtra_impl();
68         Bundle toBundle_impl();
69
70         boolean equals_impl(Object ob);
71         int hashCode_impl();
72     }
73
74     interface CommandGroupProvider {
75         void addCommand_impl(Command command);
76         void addAllPredefinedCommands_impl();
77         void removeCommand_impl(Command command);
78         boolean hasCommand_impl(Command command);
79         boolean hasCommand_impl(int code);
80         Bundle toBundle_impl();
81     }
82
83     interface ControllerInfoProvider {
84         String getPackageName_impl();
85         int getUid_impl();
86         boolean isTrusted_impl();
87         int hashCode_impl();
88         boolean equals_impl(ControllerInfoProvider obj);
89     }
90 }