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 com.android.car.media.common.playback;
18 
19 import android.annotation.IntDef;
20 import android.annotation.LongDef;
21 import android.media.session.PlaybackState;
22 
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 
26 /**
27  * Contains annotations for {@link PlaybackState PlaybackState's} constants.
28  */
29 public class PlaybackStateAnnotations {
30 
31     /**
32      * Indicates that a {@code long} is one of the commands defined in {@link PlaybackState}
33      */
34     @LongDef(flag = true, value = {PlaybackState.ACTION_STOP, PlaybackState.ACTION_PAUSE,
35             PlaybackState.ACTION_PLAY, PlaybackState.ACTION_REWIND,
36             PlaybackState.ACTION_SKIP_TO_PREVIOUS, PlaybackState.ACTION_SKIP_TO_NEXT,
37             PlaybackState.ACTION_FAST_FORWARD, PlaybackState.ACTION_SET_RATING,
38             PlaybackState.ACTION_SEEK_TO, PlaybackState.ACTION_PLAY_PAUSE,
39             PlaybackState.ACTION_PLAY_FROM_MEDIA_ID, PlaybackState.ACTION_PLAY_FROM_SEARCH,
40             PlaybackState.ACTION_SKIP_TO_QUEUE_ITEM, PlaybackState.ACTION_PLAY_FROM_URI,
41             PlaybackState.ACTION_PREPARE, PlaybackState.ACTION_PREPARE_FROM_MEDIA_ID,
42             PlaybackState.ACTION_PREPARE_FROM_SEARCH, PlaybackState.ACTION_PREPARE_FROM_URI})
43     @Retention(RetentionPolicy.SOURCE)
44     public @interface Actions {
45     }
46 
47 
48     /**
49      * Indicates that a {@code int} is one of the states defined in {@link PlaybackState}
50      */
51     @IntDef({PlaybackState.STATE_NONE, PlaybackState.STATE_STOPPED, PlaybackState.STATE_PAUSED,
52             PlaybackState.STATE_PLAYING, PlaybackState.STATE_FAST_FORWARDING,
53             PlaybackState.STATE_REWINDING, PlaybackState.STATE_BUFFERING, PlaybackState.STATE_ERROR,
54             PlaybackState.STATE_CONNECTING, PlaybackState.STATE_SKIPPING_TO_PREVIOUS,
55             PlaybackState.STATE_SKIPPING_TO_NEXT, PlaybackState.STATE_SKIPPING_TO_QUEUE_ITEM})
56     @Retention(RetentionPolicy.SOURCE)
57     public @interface State {
58     }
59 }
60