• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
18 
19 import android.annotation.StringDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * Constants shared by SDK and 3rd party media apps to extend the media APIs in order to accommodate
26  * car-specific requirements.
27  * These constants are also shared with Android Auto Projected. They will be moved to the Car
28  * Support Library on b/76108793.
29  * Please refer to <a href="https://developer.android.com/training/auto/audio/index.html">Providing
30  * Audio Playback for Auto</a> for a detailed explanation.
31  */
32 public class MediaConstants {
33     /**
34      * Action along with the media connection broadcast, which contains the current media
35      * connection status.
36      */
37     public static final String ACTION_MEDIA_STATUS = "com.google.android.gms.car.media.STATUS";
38 
39     /**
40      * Key for media connection status in extra.
41      */
42     public static final String MEDIA_CONNECTION_STATUS = "media_connection_status";
43 
44     @Retention(RetentionPolicy.SOURCE)
45     @StringDef({MEDIA_CONNECTED, MEDIA_DISCONNECTED})
46     public @interface ConnectionType {}
47 
48     /**
49      * Type of connection status: current media is connected.
50      */
51     public static final String MEDIA_CONNECTED = "media_connected";
52 
53     /**
54      * Type of connection status: current media is disconnected.
55      */
56     public static final String MEDIA_DISCONNECTED = "media_disconnected";
57 
58     /**
59      * Key for extra feedback message in extra.
60      */
61     public static final String EXTRA_CUSTOM_ACTION_STATUS = "media_custom_action_status";
62 
63     /**
64      * Extra along with the Media Session, which contains if the slot of the action should be
65      * always reserved for the queue action.
66      */
67     public static final String EXTRA_RESERVED_SLOT_QUEUE =
68             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_QUEUE";
69 
70     /**
71      * Extra along with the Media Session, which contains if the slot of the action should be
72      * always reserved for the skip to previous action.
73      */
74     public static final String EXTRA_RESERVED_SLOT_SKIP_TO_PREVIOUS =
75             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS";
76 
77     /**
78      * Extra along with the Media Session, which contains if the slot of the action should be
79      * always reserved for the skip to next action.
80      */
81     public static final String EXTRA_RESERVED_SLOT_SKIP_TO_NEXT =
82             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT";
83 
84     /**
85      * Extra along with custom action playback state to indicate a repeated action.
86      */
87     public static final String EXTRA_REPEATED_CUSTOM_ACTION_BUTTON =
88             "com.google.android.gms.car.media.CUSTOM_ACTION.REPEATED_ACTIONS";
89 
90     /**
91      * Extra along with custom action playback state to indicate a repeated custom action button
92      * state.
93      */
94     public static final String EXTRA_REPEATED_CUSTOM_ACTION_BUTTON_ON_DOWN =
95             "com.google.android.gms.car.media.CUSTOM_ACTION.ON_DOWN_EVENT";
96 
97     /**
98      * Extra along with metadata to indicate whether this audio is advertisement.
99      */
100     public static final String EXTRA_METADATA_ADVERTISEMENT =
101             "android.media.metadata.ADVERTISEMENT";
102 }
103