• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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;
18 
19 import android.net.Uri;
20 
21 /**
22  * Holds constants used when dealing with MediaBrowserServices that support the
23  * content style API for media.
24  */
25 public final class MediaConstants {
26     /**
27      * Bundle extra holding the Pending Intent to launch to let users resolve the current error.
28      * See {@link #ERROR_RESOLUTION_ACTION_LABEL} for more details.
29      */
30     public static final String ERROR_RESOLUTION_ACTION_INTENT =
31             "android.media.extras.ERROR_RESOLUTION_ACTION_INTENT";
32 
33     /**
34      * Bundle extra indicating the messaged displayed to users describing an error state.
35      * Used to provide more information for {@link #ERROR_RESOLUTION_ACTION_LABEL}.
36      */
37     public static final String ERROR_RESOLUTION_ACTION_MESSAGE =
38             "android.media.extras.ERROR_RESOLUTION_ACTION_MESSAGE";
39 
40     /**
41      * Bundle extra indicating the label of the button users can tap to resolve an error state.
42      * A more detailed explanation should be provided to the user via
43      * {@link PlaybackStateCompat.Builder#setErrorMessage}.
44      */
45     public static final String ERROR_RESOLUTION_ACTION_LABEL =
46             "android.media.extras.ERROR_RESOLUTION_ACTION_LABEL";
47 
48     /**
49      * Bundle extra indicating the presentation hint for playable media items. See {@link
50      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
51      */
52     public static final String CONTENT_STYLE_PLAYABLE_HINT =
53             "android.media.browse.CONTENT_STYLE_PLAYABLE_HINT";
54 
55     /**
56      * Bundle extra indicating the presentation hint for playable media items. See {@link
57      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
58      *
59      * @deprecated this flag has been replaced by {@link #CONTENT_STYLE_PLAYABLE_HINT}
60      */
61     @Deprecated
62     public static final String CONTENT_STYLE_PLAYABLE_HINT_PRERELEASE =
63             "android.auto.media.CONTENT_STYLE_PLAYABLE_HINT";
64 
65     /**
66      * Bundle extra indicating the presentation hint for browsable media items. See {@link
67      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
68      */
69     public static final String CONTENT_STYLE_BROWSABLE_HINT =
70             "android.media.browse.CONTENT_STYLE_BROWSABLE_HINT";
71 
72     /**
73      * Bundle extra indicating the presentation hint for browsable media items. See {@link
74      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
75      *
76      * @deprecated this flag has been replaced by {@link #CONTENT_STYLE_BROWSABLE_HINT}
77      */
78     @Deprecated
79     public static final String CONTENT_STYLE_BROWSABLE_HINT_PRERELEASE =
80             "android.auto.media.CONTENT_STYLE_BROWSABLE_HINT";
81 
82     /**
83      * Bundle extra indicating that media app supports MediaBrowserCompat.onSearch
84      */
85     public static final String MEDIA_SEARCH_SUPPORTED = "android.media.browse.SEARCH_SUPPORTED";
86 
87     /**
88      * Bundle extra indicating that media app supports MediaBrowserCompat.onSearch for pre-release
89      * versions.
90      *
91      * @deprecated this flag has been replaced by {@link #MEDIA_SEARCH_SUPPORTED}
92      */
93     @Deprecated
94     public static final String MEDIA_SEARCH_SUPPORTED_PRERELEASE =
95             "android.auto.media.SEARCH_SUPPORTED";
96 
97     /** Bundle extra indicating the media item belongs to a group with the given title. */
98     public static final String CONTENT_STYLE_GROUP_TITLE_HINT =
99             "android.media.browse.CONTENT_STYLE_GROUP_TITLE_HINT";
100 
101     /**
102      * Bundle extra indicating the media item belongs to a group with the given title.
103      *
104      * @deprecated this flag has been replaced by {@link #CONTENT_STYLE_GROUP_TITLE_HINT}
105      */
106     @Deprecated
107     public static final String CONTENT_STYLE_GROUP_TITLE_HINT_PRERELEASE =
108             "android.auto.media.CONTENT_STYLE_GROUP_TITLE_HINT";
109 
110     /**
111      * Value for {@link #CONTENT_STYLE_PLAYABLE_HINT} and {@link #CONTENT_STYLE_BROWSABLE_HINT} that
112      * hints the corresponding items should be presented as lists.
113      */
114     public static final int CONTENT_STYLE_LIST_ITEM_HINT_VALUE = 1;
115 
116     /**
117      * Value for {@link #CONTENT_STYLE_PLAYABLE_HINT} and {@link #CONTENT_STYLE_BROWSABLE_HINT} that
118      * hints the corresponding items should be presented as grids.
119      */
120     public static final int CONTENT_STYLE_GRID_ITEM_HINT_VALUE = 2;
121 
122     /**
123      * These constants are from
124      * @see <a href=https://developer.android.com/training/auto/audio/#required-actions></a>
125      */
126     public static final String SLOT_RESERVATION_SKIP_TO_NEXT =
127             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT";
128     public static final String SLOT_RESERVATION_SKIP_TO_PREV =
129             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS";
130     public static final String SLOT_RESERVATION_QUEUE =
131             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_QUEUE";
132 
133     /**
134      * Constants for MediaSourceContentProvider
135      */
136     public static final String AUTHORITY_MEDIA_SOURCE = "com.android.car.media.provider";
137     public static final Uri URI_MEDIA_SOURCE =
138             Uri.parse("content://com.android.car.media.provider/media_source");
139     public static final String KEY_PACKAGE_NAME = "package_name";
140 
141     /**
142      * Constants for playable status
143      */
144 
145     /**
146      * Bundle extra of type 'boolean' indicating that an item should show the 'explicit' symbol.
147      */
148     public static final String EXTRA_IS_EXPLICIT = "android.media.IS_EXPLICIT";
149 
150     /** Bundle extra value indicating that an item should show the corresponding metadata */
151     public static long EXTRA_METADATA_ENABLED_VALUE = 1;
152 
153     /**
154      * Bundle extra of type 'boolean' indicating than an item should show the 'downloaded' symbol.
155      */
156     public static final String EXTRA_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS";
157 }
158