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.annotation.SystemApi;
20 import android.media.AudioAttributes;
21 import android.media.DataSourceDesc;
22 import android.media.MediaItem2;
23 import android.media.MediaMetadata2;
24 import android.media.MediaPlayerBase;
25 import android.media.SessionToken2;
26 import android.media.session.MediaController;
27 import android.media.session.PlaybackState;
28 import android.media.session.MediaSession;
29 import android.net.Uri;
30 import android.util.AttributeSet;
31 import android.widget.MediaControlView2;
32 import android.widget.VideoView2;
33 
34 import com.android.internal.annotations.VisibleForTesting;
35 
36 import java.util.List;
37 import java.util.Map;
38 import java.util.concurrent.Executor;
39 
40 /**
41  * Interface for connecting the public API to an updatable implementation.
42  *
43  * Each instance object is connected to one corresponding updatable object which implements the
44  * runtime behavior of that class. There should a corresponding provider method for all public
45  * methods.
46  *
47  * All methods behave as per their namesake in the public API.
48  *
49  * @see android.widget.VideoView2
50  *
51  * @hide
52  */
53 // TODO @SystemApi
54 public interface VideoView2Provider extends ViewGroupProvider {
initialize(AttributeSet attrs, int defStyleAttr, int defStyleRes)55     void initialize(AttributeSet attrs, int defStyleAttr, int defStyleRes);
56 
setMediaControlView2_impl(MediaControlView2 mediaControlView, long intervalMs)57     void setMediaControlView2_impl(MediaControlView2 mediaControlView, long intervalMs);
setMediaMetadata_impl(MediaMetadata2 metadata)58     void setMediaMetadata_impl(MediaMetadata2 metadata);
59     /**
60      * @hide TODO: remove
61      */
getMediaController_impl()62     MediaController getMediaController_impl();
getMediaSessionToken_impl()63     SessionToken2 getMediaSessionToken_impl();
getMediaControlView2_impl()64     MediaControlView2 getMediaControlView2_impl();
getMediaMetadata_impl()65     MediaMetadata2 getMediaMetadata_impl();
setSubtitleEnabled_impl(boolean enable)66     void setSubtitleEnabled_impl(boolean enable);
isSubtitleEnabled_impl()67     boolean isSubtitleEnabled_impl();
68     // TODO: remove setSpeed_impl once MediaController2 is ready.
setSpeed_impl(float speed)69     void setSpeed_impl(float speed);
setAudioFocusRequest_impl(int focusGain)70     void setAudioFocusRequest_impl(int focusGain);
setAudioAttributes_impl(AudioAttributes attributes)71     void setAudioAttributes_impl(AudioAttributes attributes);
setVideoPath_impl(String path)72     void setVideoPath_impl(String path);
73     /**
74      * @hide TODO: remove
75      */
setVideoUri_impl(Uri uri)76     void setVideoUri_impl(Uri uri);
77     /**
78      * @hide TODO: remove
79      */
setVideoUri_impl(Uri uri, Map<String, String> headers)80     void setVideoUri_impl(Uri uri, Map<String, String> headers);
setMediaItem_impl(MediaItem2 mediaItem)81     void setMediaItem_impl(MediaItem2 mediaItem);
setDataSource_impl(DataSourceDesc dsd)82     void setDataSource_impl(DataSourceDesc dsd);
setViewType_impl(int viewType)83     void setViewType_impl(int viewType);
getViewType_impl()84     int getViewType_impl();
85     /**
86      * @hide TODO: remove
87      */
setCustomActions_impl(List<PlaybackState.CustomAction> actionList, Executor executor, VideoView2.OnCustomActionListener listener)88     void setCustomActions_impl(List<PlaybackState.CustomAction> actionList,
89             Executor executor, VideoView2.OnCustomActionListener listener);
90     /**
91      * @hide
92      */
93     @VisibleForTesting
setOnViewTypeChangedListener_impl(VideoView2.OnViewTypeChangedListener l)94     void setOnViewTypeChangedListener_impl(VideoView2.OnViewTypeChangedListener l);
95     /**
96      * @hide TODO: remove
97      */
setFullScreenRequestListener_impl(VideoView2.OnFullScreenRequestListener l)98     void setFullScreenRequestListener_impl(VideoView2.OnFullScreenRequestListener l);
99 }
100