MediaMetadataCompat.java
16.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
package android.support.v4.media;
import android.graphics.Bitmap;
import android.media.MediaMetadata;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.support.annotation.RestrictTo;
import android.support.v4.util.ArrayMap;
import android.text.TextUtils;
import android.util.Log;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Iterator;
import java.util.Set;
public final class MediaMetadataCompat
implements Parcelable
{
public static final Parcelable.Creator<MediaMetadataCompat> CREATOR = new Parcelable.Creator() {};
public static final String METADATA_KEY_ALBUM = "android.media.metadata.ALBUM";
public static final String METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART";
public static final String METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
public static final String METADATA_KEY_ALBUM_ART_URI = "android.media.metadata.ALBUM_ART_URI";
public static final String METADATA_KEY_ART = "android.media.metadata.ART";
public static final String METADATA_KEY_ARTIST = "android.media.metadata.ARTIST";
public static final String METADATA_KEY_ART_URI = "android.media.metadata.ART_URI";
public static final String METADATA_KEY_AUTHOR = "android.media.metadata.AUTHOR";
public static final String METADATA_KEY_BT_FOLDER_TYPE = "android.media.metadata.BT_FOLDER_TYPE";
public static final String METADATA_KEY_COMPILATION = "android.media.metadata.COMPILATION";
public static final String METADATA_KEY_COMPOSER = "android.media.metadata.COMPOSER";
public static final String METADATA_KEY_DATE = "android.media.metadata.DATE";
public static final String METADATA_KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER";
public static final String METADATA_KEY_DISPLAY_DESCRIPTION = "android.media.metadata.DISPLAY_DESCRIPTION";
public static final String METADATA_KEY_DISPLAY_ICON = "android.media.metadata.DISPLAY_ICON";
public static final String METADATA_KEY_DISPLAY_ICON_URI = "android.media.metadata.DISPLAY_ICON_URI";
public static final String METADATA_KEY_DISPLAY_SUBTITLE = "android.media.metadata.DISPLAY_SUBTITLE";
public static final String METADATA_KEY_DISPLAY_TITLE = "android.media.metadata.DISPLAY_TITLE";
public static final String METADATA_KEY_DURATION = "android.media.metadata.DURATION";
public static final String METADATA_KEY_GENRE = "android.media.metadata.GENRE";
public static final String METADATA_KEY_MEDIA_ID = "android.media.metadata.MEDIA_ID";
public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI";
public static final String METADATA_KEY_NUM_TRACKS = "android.media.metadata.NUM_TRACKS";
public static final String METADATA_KEY_RATING = "android.media.metadata.RATING";
public static final String METADATA_KEY_TITLE = "android.media.metadata.TITLE";
public static final String METADATA_KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER";
public static final String METADATA_KEY_USER_RATING = "android.media.metadata.USER_RATING";
public static final String METADATA_KEY_WRITER = "android.media.metadata.WRITER";
public static final String METADATA_KEY_YEAR = "android.media.metadata.YEAR";
static final ArrayMap<String, Integer> a;
private static final String[] c;
private static final String[] d;
private static final String[] e;
final Bundle b;
private Object f;
private MediaDescriptionCompat g;
static
{
ArrayMap localArrayMap = new ArrayMap();
a = localArrayMap;
localArrayMap.put("android.media.metadata.TITLE", Integer.valueOf(1));
a.put("android.media.metadata.ARTIST", Integer.valueOf(1));
a.put("android.media.metadata.DURATION", Integer.valueOf(0));
a.put("android.media.metadata.ALBUM", Integer.valueOf(1));
a.put("android.media.metadata.AUTHOR", Integer.valueOf(1));
a.put("android.media.metadata.WRITER", Integer.valueOf(1));
a.put("android.media.metadata.COMPOSER", Integer.valueOf(1));
a.put("android.media.metadata.COMPILATION", Integer.valueOf(1));
a.put("android.media.metadata.DATE", Integer.valueOf(1));
a.put("android.media.metadata.YEAR", Integer.valueOf(0));
a.put("android.media.metadata.GENRE", Integer.valueOf(1));
a.put("android.media.metadata.TRACK_NUMBER", Integer.valueOf(0));
a.put("android.media.metadata.NUM_TRACKS", Integer.valueOf(0));
a.put("android.media.metadata.DISC_NUMBER", Integer.valueOf(0));
a.put("android.media.metadata.ALBUM_ARTIST", Integer.valueOf(1));
a.put("android.media.metadata.ART", Integer.valueOf(2));
a.put("android.media.metadata.ART_URI", Integer.valueOf(1));
a.put("android.media.metadata.ALBUM_ART", Integer.valueOf(2));
a.put("android.media.metadata.ALBUM_ART_URI", Integer.valueOf(1));
a.put("android.media.metadata.USER_RATING", Integer.valueOf(3));
a.put("android.media.metadata.RATING", Integer.valueOf(3));
a.put("android.media.metadata.DISPLAY_TITLE", Integer.valueOf(1));
a.put("android.media.metadata.DISPLAY_SUBTITLE", Integer.valueOf(1));
a.put("android.media.metadata.DISPLAY_DESCRIPTION", Integer.valueOf(1));
a.put("android.media.metadata.DISPLAY_ICON", Integer.valueOf(2));
a.put("android.media.metadata.DISPLAY_ICON_URI", Integer.valueOf(1));
a.put("android.media.metadata.MEDIA_ID", Integer.valueOf(1));
a.put("android.media.metadata.BT_FOLDER_TYPE", Integer.valueOf(0));
a.put("android.media.metadata.MEDIA_URI", Integer.valueOf(1));
c = new String[] { "android.media.metadata.TITLE", "android.media.metadata.ARTIST", "android.media.metadata.ALBUM", "android.media.metadata.ALBUM_ARTIST", "android.media.metadata.WRITER", "android.media.metadata.AUTHOR", "android.media.metadata.COMPOSER" };
d = new String[] { "android.media.metadata.DISPLAY_ICON", "android.media.metadata.ART", "android.media.metadata.ALBUM_ART" };
e = new String[] { "android.media.metadata.DISPLAY_ICON_URI", "android.media.metadata.ART_URI", "android.media.metadata.ALBUM_ART_URI" };
}
MediaMetadataCompat(Bundle paramBundle)
{
this.b = new Bundle(paramBundle);
}
MediaMetadataCompat(Parcel paramParcel)
{
this.b = paramParcel.readBundle();
}
public static MediaMetadataCompat fromMediaMetadata(Object paramObject)
{
if ((paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
return null;
}
Parcel localParcel = Parcel.obtain();
((MediaMetadata)paramObject).writeToParcel(localParcel, 0);
localParcel.setDataPosition(0);
MediaMetadataCompat localMediaMetadataCompat = (MediaMetadataCompat)CREATOR.createFromParcel(localParcel);
localParcel.recycle();
localMediaMetadataCompat.f = paramObject;
return localMediaMetadataCompat;
}
public final boolean containsKey(String paramString)
{
return this.b.containsKey(paramString);
}
public final int describeContents()
{
return 0;
}
public final Bitmap getBitmap(String paramString)
{
try
{
paramString = (Bitmap)this.b.getParcelable(paramString);
return paramString;
}
catch (Exception paramString)
{
Log.w("MediaMetadata", "Failed to retrieve a key as Bitmap.", paramString);
}
return null;
}
public final Bundle getBundle()
{
return this.b;
}
public final MediaDescriptionCompat getDescription()
{
Uri localUri = null;
if (this.g != null) {
return this.g;
}
String str = getString("android.media.metadata.MEDIA_ID");
CharSequence[] arrayOfCharSequence = new CharSequence[3];
Object localObject1 = getText("android.media.metadata.DISPLAY_TITLE");
int i;
label73:
label97:
label99:
Object localObject2;
label133:
int j;
if (!TextUtils.isEmpty((CharSequence)localObject1))
{
arrayOfCharSequence[0] = localObject1;
arrayOfCharSequence[1] = getText("android.media.metadata.DISPLAY_SUBTITLE");
arrayOfCharSequence[2] = getText("android.media.metadata.DISPLAY_DESCRIPTION");
i = 0;
if (i >= d.length) {
break label359;
}
localObject1 = getBitmap(d[i]);
if (localObject1 != null)
{
i = 0;
if (i >= e.length) {
break label353;
}
localObject2 = getString(e[i]);
if (TextUtils.isEmpty((CharSequence)localObject2)) {
break label346;
}
localObject2 = Uri.parse((String)localObject2);
Object localObject3 = getString("android.media.metadata.MEDIA_URI");
if (!TextUtils.isEmpty((CharSequence)localObject3)) {
localUri = Uri.parse((String)localObject3);
}
localObject3 = new MediaDescriptionCompat.Builder();
((MediaDescriptionCompat.Builder)localObject3).setMediaId(str);
((MediaDescriptionCompat.Builder)localObject3).setTitle(arrayOfCharSequence[0]);
((MediaDescriptionCompat.Builder)localObject3).setSubtitle(arrayOfCharSequence[1]);
((MediaDescriptionCompat.Builder)localObject3).setDescription(arrayOfCharSequence[2]);
((MediaDescriptionCompat.Builder)localObject3).setIconBitmap((Bitmap)localObject1);
((MediaDescriptionCompat.Builder)localObject3).setIconUri((Uri)localObject2);
((MediaDescriptionCompat.Builder)localObject3).setMediaUri(localUri);
if (this.b.containsKey("android.media.metadata.BT_FOLDER_TYPE"))
{
localObject1 = new Bundle();
((Bundle)localObject1).putLong("android.media.extra.BT_FOLDER_TYPE", getLong("android.media.metadata.BT_FOLDER_TYPE"));
((MediaDescriptionCompat.Builder)localObject3).setExtras((Bundle)localObject1);
}
this.g = ((MediaDescriptionCompat.Builder)localObject3).build();
return this.g;
}
}
else
{
j = 0;
i = 0;
label288:
if ((i < 3) && (j < c.length))
{
localObject1 = getText(c[j]);
if (TextUtils.isEmpty((CharSequence)localObject1)) {
break label365;
}
int k = i + 1;
arrayOfCharSequence[i] = localObject1;
i = k;
}
}
label346:
label353:
label359:
label365:
for (;;)
{
j += 1;
break label288;
break;
i += 1;
break label73;
i += 1;
break label99;
localObject2 = null;
break label133;
localObject1 = null;
break label97;
}
}
public final long getLong(String paramString)
{
return this.b.getLong(paramString, 0L);
}
public final Object getMediaMetadata()
{
if ((this.f != null) || (Build.VERSION.SDK_INT < 21)) {
return this.f;
}
Parcel localParcel = Parcel.obtain();
writeToParcel(localParcel, 0);
localParcel.setDataPosition(0);
this.f = MediaMetadata.CREATOR.createFromParcel(localParcel);
localParcel.recycle();
return this.f;
}
public final RatingCompat getRating(String paramString)
{
try
{
if (Build.VERSION.SDK_INT >= 19) {
return RatingCompat.fromRating(this.b.getParcelable(paramString));
}
paramString = (RatingCompat)this.b.getParcelable(paramString);
return paramString;
}
catch (Exception paramString)
{
Log.w("MediaMetadata", "Failed to retrieve a key as Rating.", paramString);
}
return null;
}
public final String getString(String paramString)
{
paramString = this.b.getCharSequence(paramString);
if (paramString != null) {
return paramString.toString();
}
return null;
}
public final CharSequence getText(String paramString)
{
return this.b.getCharSequence(paramString);
}
public final Set<String> keySet()
{
return this.b.keySet();
}
public final int size()
{
return this.b.size();
}
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
paramParcel.writeBundle(this.b);
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface BitmapKey {}
public static final class Builder
{
private final Bundle a;
public Builder()
{
this.a = new Bundle();
}
public Builder(MediaMetadataCompat paramMediaMetadataCompat)
{
this.a = new Bundle(paramMediaMetadataCompat.b);
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public Builder(MediaMetadataCompat paramMediaMetadataCompat, int paramInt)
{
this(paramMediaMetadataCompat);
paramMediaMetadataCompat = this.a.keySet().iterator();
while (paramMediaMetadataCompat.hasNext())
{
String str = (String)paramMediaMetadataCompat.next();
Object localObject = this.a.get(str);
if ((localObject != null) && ((localObject instanceof Bitmap)))
{
localObject = (Bitmap)localObject;
if ((((Bitmap)localObject).getHeight() > paramInt) || (((Bitmap)localObject).getWidth() > paramInt))
{
float f = paramInt;
f = Math.min(f / ((Bitmap)localObject).getWidth(), f / ((Bitmap)localObject).getHeight());
int i = (int)(((Bitmap)localObject).getHeight() * f);
putBitmap(str, Bitmap.createScaledBitmap((Bitmap)localObject, (int)(f * ((Bitmap)localObject).getWidth()), i, true));
}
else if ((Build.VERSION.SDK_INT >= 14) && ((str.equals("android.media.metadata.ART")) || (str.equals("android.media.metadata.ALBUM_ART"))))
{
putBitmap(str, ((Bitmap)localObject).copy(((Bitmap)localObject).getConfig(), false));
}
}
}
}
public final MediaMetadataCompat build()
{
return new MediaMetadataCompat(this.a);
}
public final Builder putBitmap(String paramString, Bitmap paramBitmap)
{
if ((MediaMetadataCompat.a.containsKey(paramString)) && (((Integer)MediaMetadataCompat.a.get(paramString)).intValue() != 2)) {
throw new IllegalArgumentException("The " + paramString + " key cannot be used to put a Bitmap");
}
this.a.putParcelable(paramString, paramBitmap);
return this;
}
public final Builder putLong(String paramString, long paramLong)
{
if ((MediaMetadataCompat.a.containsKey(paramString)) && (((Integer)MediaMetadataCompat.a.get(paramString)).intValue() != 0)) {
throw new IllegalArgumentException("The " + paramString + " key cannot be used to put a long");
}
this.a.putLong(paramString, paramLong);
return this;
}
public final Builder putRating(String paramString, RatingCompat paramRatingCompat)
{
if ((MediaMetadataCompat.a.containsKey(paramString)) && (((Integer)MediaMetadataCompat.a.get(paramString)).intValue() != 3)) {
throw new IllegalArgumentException("The " + paramString + " key cannot be used to put a Rating");
}
if (Build.VERSION.SDK_INT >= 19)
{
this.a.putParcelable(paramString, (Parcelable)paramRatingCompat.getRating());
return this;
}
this.a.putParcelable(paramString, paramRatingCompat);
return this;
}
public final Builder putString(String paramString1, String paramString2)
{
if ((MediaMetadataCompat.a.containsKey(paramString1)) && (((Integer)MediaMetadataCompat.a.get(paramString1)).intValue() != 1)) {
throw new IllegalArgumentException("The " + paramString1 + " key cannot be used to put a String");
}
this.a.putCharSequence(paramString1, paramString2);
return this;
}
public final Builder putText(String paramString, CharSequence paramCharSequence)
{
if ((MediaMetadataCompat.a.containsKey(paramString)) && (((Integer)MediaMetadataCompat.a.get(paramString)).intValue() != 1)) {
throw new IllegalArgumentException("The " + paramString + " key cannot be used to put a CharSequence");
}
this.a.putCharSequence(paramString, paramCharSequence);
return this;
}
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface LongKey {}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface RatingKey {}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface TextKey {}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/media/MediaMetadataCompat.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/