• 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 androidx.media.MediaBrowserServiceCompat;
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     /**
28      * Integer extra indicating the recommended size (in pixels) for media art bitmaps. The value
29      * is passed in the rootHints Bundle of {@link MediaBrowserServiceCompat#onGetRoot} and can be
30      * retrieved with: rootHints.getInt("android.media.extras.MEDIA_ART_SIZE_HINT_PIXELS", 0).
31      */
32     public static final String EXTRA_MEDIA_ART_SIZE_HINT_PIXELS =
33             "android.media.extras.MEDIA_ART_SIZE_HINT_PIXELS";
34 
35     /**
36      * Bundle extra holding the Pending Intent to launch to let users resolve the current error.
37      * See {@link #ERROR_RESOLUTION_ACTION_LABEL} for more details.
38      */
39     public static final String ERROR_RESOLUTION_ACTION_INTENT =
40             "android.media.extras.ERROR_RESOLUTION_ACTION_INTENT";
41 
42     /**
43      * Bundle extra indicating the messaged displayed to users describing an error state.
44      * Used to provide more information for {@link #ERROR_RESOLUTION_ACTION_LABEL}.
45      */
46     public static final String ERROR_RESOLUTION_ACTION_MESSAGE =
47             "android.media.extras.ERROR_RESOLUTION_ACTION_MESSAGE";
48 
49     /**
50      * Bundle extra indicating the label of the button users can tap to resolve an error state.
51      * A more detailed explanation should be provided to the user via
52      * {@link PlaybackStateCompat.Builder#setErrorMessage}.
53      */
54     public static final String ERROR_RESOLUTION_ACTION_LABEL =
55             "android.media.extras.ERROR_RESOLUTION_ACTION_LABEL";
56 
57     /**
58      * Bundle extra indicating the presentation hint for playable media items. See {@link
59      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
60      */
61     public static final String CONTENT_STYLE_PLAYABLE_HINT =
62             "android.media.browse.CONTENT_STYLE_PLAYABLE_HINT";
63 
64     /**
65      * Bundle extra indicating the presentation hint for playable media items. See {@link
66      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
67      *
68      * @deprecated this flag has been replaced by {@link #CONTENT_STYLE_PLAYABLE_HINT}
69      */
70     @Deprecated
71     public static final String CONTENT_STYLE_PLAYABLE_HINT_PRERELEASE =
72             "android.auto.media.CONTENT_STYLE_PLAYABLE_HINT";
73 
74     /**
75      * Bundle extra indicating the presentation hint for browsable media items. See {@link
76      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
77      */
78     public static final String CONTENT_STYLE_BROWSABLE_HINT =
79             "android.media.browse.CONTENT_STYLE_BROWSABLE_HINT";
80 
81     /**
82      * Bundle extra indicating the presentation hint for browsable media items. See {@link
83      * #CONTENT_STYLE_LIST_ITEM_HINT_VALUE} or {@link #CONTENT_STYLE_GRID_ITEM_HINT_VALUE}
84      *
85      * @deprecated this flag has been replaced by {@link #CONTENT_STYLE_BROWSABLE_HINT}
86      */
87     @Deprecated
88     public static final String CONTENT_STYLE_BROWSABLE_HINT_PRERELEASE =
89             "android.auto.media.CONTENT_STYLE_BROWSABLE_HINT";
90 
91     /**
92      * Bundle extra indicating that media app supports MediaBrowserCompat.onSearch
93      */
94     public static final String MEDIA_SEARCH_SUPPORTED = "android.media.browse.SEARCH_SUPPORTED";
95 
96     /**
97      * Bundle extra indicating that media app supports MediaBrowserCompat.onSearch for pre-release
98      * versions.
99      *
100      * @deprecated this flag has been replaced by {@link #MEDIA_SEARCH_SUPPORTED}
101      */
102     @Deprecated
103     public static final String MEDIA_SEARCH_SUPPORTED_PRERELEASE =
104             "android.auto.media.SEARCH_SUPPORTED";
105 
106     /** Bundle extra indicating the media item belongs to a group with the given title. */
107     public static final String CONTENT_STYLE_GROUP_TITLE_HINT =
108             "android.media.browse.CONTENT_STYLE_GROUP_TITLE_HINT";
109 
110     /**
111      * Bundle extra indicating the media item belongs to a group with the given title.
112      *
113      * @deprecated this flag has been replaced by {@link #CONTENT_STYLE_GROUP_TITLE_HINT}
114      */
115     @Deprecated
116     public static final String CONTENT_STYLE_GROUP_TITLE_HINT_PRERELEASE =
117             "android.auto.media.CONTENT_STYLE_GROUP_TITLE_HINT";
118 
119     /**
120      * Value for {@link #CONTENT_STYLE_PLAYABLE_HINT} and {@link #CONTENT_STYLE_BROWSABLE_HINT} that
121      * hints the corresponding items should be presented as lists.
122      */
123     public static final int CONTENT_STYLE_LIST_ITEM_HINT_VALUE = 1;
124 
125     /**
126      * Value for {@link #CONTENT_STYLE_PLAYABLE_HINT} and {@link #CONTENT_STYLE_BROWSABLE_HINT} that
127      * hints the corresponding items should be presented as grids.
128      */
129     public static final int CONTENT_STYLE_GRID_ITEM_HINT_VALUE = 2;
130 
131     /**
132      * Value for {@link #CONTENT_STYLE_BROWSABLE_HINT} that hints the corresponding items should be
133      * presented as a "category" list, where media items are browsable and represented by a
134      * meaningful icon.
135      */
136     public static final int CONTENT_STYLE_CATEGORY_LIST_ITEM_HINT_VALUE = 3;
137 
138     /**
139      * Value for {@link #CONTENT_STYLE_BROWSABLE_HINT} that hints the corresponding items should be
140      * presented as a "category" grid, where media items are browsable and represented by a
141      * meaningful icon.
142      */
143     public static final int CONTENT_STYLE_CATEGORY_GRID_ITEM_HINT_VALUE = 4;
144 
145     /**
146      * These constants are from
147      * @see <a href=https://developer.android.com/training/auto/audio/#required-actions></a>
148      *
149      * @deprecated this flag has been replaced by {@link #PLAYBACK_SLOT_RESERVATION_SKIP_TO_NEXT}
150      */
151     @Deprecated
152     public static final String SLOT_RESERVATION_SKIP_TO_NEXT =
153             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT";
154     /**
155      * @deprecated this flag has been replaced by {@link #PLAYBACK_SLOT_RESERVATION_SKIP_TO_NEXT}
156      */
157     @Deprecated
158     public static final String SLOT_RESERVATION_SKIP_TO_PREV =
159             "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS";
160 
161     /**
162      * These constants are from
163      * @see <a href=https://developer.android.com/training/auto/audio/#required-actions></a>
164      */
165     public static final String PLAYBACK_SLOT_RESERVATION_SKIP_TO_NEXT =
166             "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT";
167     public static final String PLAYBACK_SLOT_RESERVATION_SKIP_TO_PREV =
168             "android.media.playback.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS";
169 
170     /**
171      * Bundle extra of type 'boolean' indicating that an item should show the 'explicit' symbol.
172      */
173     public static final String EXTRA_IS_EXPLICIT = "android.media.IS_EXPLICIT";
174 
175     /** Bundle extra value indicating that an item should show the corresponding metadata */
176     public static long EXTRA_METADATA_ENABLED_VALUE = 1;
177 
178     /**
179      * Bundle extra of type 'boolean' indicating than an item should show the 'downloaded' symbol.
180      */
181     public static final String EXTRA_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS";
182 }
183