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