MediaSessionCompat.java
64.3 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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
package android.support.v4.media.session;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.media.AudioAttributes.Builder;
import android.media.AudioManager;
import android.media.MediaDescription;
import android.media.MediaMetadata;
import android.media.RemoteControlClient;
import android.media.RemoteControlClient.MetadataEditor;
import android.media.VolumeProvider;
import android.media.session.MediaSession;
import android.media.session.MediaSession.Callback;
import android.media.session.MediaSession.QueueItem;
import android.media.session.MediaSession.Token;
import android.media.session.PlaybackState;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.SystemClock;
import android.support.annotation.RestrictTo;
import android.support.v4.app.BundleCompat;
import android.support.v4.media.MediaDescriptionCompat;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.MediaMetadataCompat.Builder;
import android.support.v4.media.RatingCompat;
import android.support.v4.media.VolumeProviderCompat;
import android.support.v4.media.VolumeProviderCompat.Callback;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.KeyEvent;
import dk;
import dl;
import dm;
import dm.a;
import dm.b;
import dn;
import dn.a;
import dn.b;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MediaSessionCompat
{
public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1;
public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2;
static int a;
private final a b;
private final MediaControllerCompat c;
private final ArrayList<OnActiveChangeListener> d = new ArrayList();
private MediaSessionCompat(Context paramContext, a parama)
{
this.b = parama;
if (Build.VERSION.SDK_INT >= 21) {
setCallback(new Callback() {});
}
this.c = new MediaControllerCompat(paramContext, this);
}
public MediaSessionCompat(Context paramContext, String paramString)
{
this(paramContext, paramString, null, null);
}
public MediaSessionCompat(Context paramContext, String paramString, ComponentName paramComponentName, PendingIntent paramPendingIntent)
{
if (paramContext == null) {
throw new IllegalArgumentException("context must not be null");
}
if (TextUtils.isEmpty(paramString)) {
throw new IllegalArgumentException("tag must not be null or empty");
}
if (Build.VERSION.SDK_INT >= 21) {}
for (this.b = new b(paramContext, paramString);; this.b = new c(paramContext, paramString, paramComponentName, paramPendingIntent))
{
this.c = new MediaControllerCompat(paramContext, this);
if (a == 0) {
a = (int)TypedValue.applyDimension(1, 320.0F, paramContext.getResources().getDisplayMetrics());
}
return;
}
}
public static MediaSessionCompat fromMediaSession(Context paramContext, Object paramObject)
{
if ((paramContext == null) || (paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
return null;
}
return new MediaSessionCompat(paramContext, new b(paramObject));
}
@Deprecated
public static MediaSessionCompat obtain(Context paramContext, Object paramObject)
{
return fromMediaSession(paramContext, paramObject);
}
public void addOnActiveChangeListener(OnActiveChangeListener paramOnActiveChangeListener)
{
if (paramOnActiveChangeListener == null) {
throw new IllegalArgumentException("Listener may not be null");
}
this.d.add(paramOnActiveChangeListener);
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public String getCallingPackage()
{
return this.b.f();
}
public MediaControllerCompat getController()
{
return this.c;
}
public Object getMediaSession()
{
return this.b.d();
}
public Object getRemoteControlClient()
{
return this.b.e();
}
public Token getSessionToken()
{
return this.b.c();
}
public boolean isActive()
{
return this.b.a();
}
public void release()
{
this.b.b();
}
public void removeOnActiveChangeListener(OnActiveChangeListener paramOnActiveChangeListener)
{
if (paramOnActiveChangeListener == null) {
throw new IllegalArgumentException("Listener may not be null");
}
this.d.remove(paramOnActiveChangeListener);
}
public void sendSessionEvent(String paramString, Bundle paramBundle)
{
if (TextUtils.isEmpty(paramString)) {
throw new IllegalArgumentException("event cannot be null or empty");
}
this.b.a(paramString, paramBundle);
}
public void setActive(boolean paramBoolean)
{
this.b.a(paramBoolean);
Iterator localIterator = this.d.iterator();
while (localIterator.hasNext()) {
((OnActiveChangeListener)localIterator.next()).onActiveChanged();
}
}
public void setCallback(Callback paramCallback)
{
setCallback(paramCallback, null);
}
public void setCallback(Callback paramCallback, Handler paramHandler)
{
a locala = this.b;
if (paramHandler != null) {}
for (;;)
{
locala.a(paramCallback, paramHandler);
return;
paramHandler = new Handler();
}
}
public void setExtras(Bundle paramBundle)
{
this.b.a(paramBundle);
}
public void setFlags(int paramInt)
{
this.b.a(paramInt);
}
public void setMediaButtonReceiver(PendingIntent paramPendingIntent)
{
this.b.b(paramPendingIntent);
}
public void setMetadata(MediaMetadataCompat paramMediaMetadataCompat)
{
this.b.a(paramMediaMetadataCompat);
}
public void setPlaybackState(PlaybackStateCompat paramPlaybackStateCompat)
{
this.b.a(paramPlaybackStateCompat);
}
public void setPlaybackToLocal(int paramInt)
{
this.b.b(paramInt);
}
public void setPlaybackToRemote(VolumeProviderCompat paramVolumeProviderCompat)
{
if (paramVolumeProviderCompat == null) {
throw new IllegalArgumentException("volumeProvider may not be null!");
}
this.b.a(paramVolumeProviderCompat);
}
public void setQueue(List<QueueItem> paramList)
{
this.b.a(paramList);
}
public void setQueueTitle(CharSequence paramCharSequence)
{
this.b.a(paramCharSequence);
}
public void setRatingType(int paramInt)
{
this.b.c(paramInt);
}
public void setSessionActivity(PendingIntent paramPendingIntent)
{
this.b.a(paramPendingIntent);
}
public static abstract class Callback
{
final Object b;
WeakReference<MediaSessionCompat.a> c;
public Callback()
{
if (Build.VERSION.SDK_INT >= 24)
{
this.b = new MediaSessionCompatApi24.a(new c());
return;
}
if (Build.VERSION.SDK_INT >= 23)
{
this.b = new MediaSessionCompatApi23.a(new b());
return;
}
if (Build.VERSION.SDK_INT >= 21)
{
this.b = new dn.b(new a());
return;
}
this.b = null;
}
public void onCommand(String paramString, Bundle paramBundle, ResultReceiver paramResultReceiver) {}
public void onCustomAction(String paramString, Bundle paramBundle) {}
public void onFastForward() {}
public boolean onMediaButtonEvent(Intent paramIntent)
{
return false;
}
public void onPause() {}
public void onPlay() {}
public void onPlayFromMediaId(String paramString, Bundle paramBundle) {}
public void onPlayFromSearch(String paramString, Bundle paramBundle) {}
public void onPlayFromUri(Uri paramUri, Bundle paramBundle) {}
public void onPrepare() {}
public void onPrepareFromMediaId(String paramString, Bundle paramBundle) {}
public void onPrepareFromSearch(String paramString, Bundle paramBundle) {}
public void onPrepareFromUri(Uri paramUri, Bundle paramBundle) {}
public void onRewind() {}
public void onSeekTo(long paramLong) {}
public void onSetRating(RatingCompat paramRatingCompat) {}
public void onSkipToNext() {}
public void onSkipToPrevious() {}
public void onSkipToQueueItem(long paramLong) {}
public void onStop() {}
class a
implements dn.a
{
a() {}
public final void a()
{
MediaSessionCompat.Callback.this.onPlay();
}
public final void a(long paramLong)
{
MediaSessionCompat.Callback.this.onSkipToQueueItem(paramLong);
}
public final void a(Object paramObject)
{
MediaSessionCompat.Callback.this.onSetRating(RatingCompat.fromRating(paramObject));
}
public final void a(String paramString, Bundle paramBundle)
{
MediaSessionCompat.Callback.this.onPlayFromMediaId(paramString, paramBundle);
}
public final void a(String paramString, Bundle paramBundle, ResultReceiver paramResultReceiver)
{
if (paramString.equals("android.support.v4.media.session.command.GET_EXTRA_BINDER"))
{
paramString = (MediaSessionCompat.b)MediaSessionCompat.Callback.this.c.get();
if (paramString != null)
{
paramBundle = new Bundle();
if (paramString.b == null) {
paramString.b = new MediaSessionCompat.b.a(paramString);
}
BundleCompat.putBinder(paramBundle, "android.support.v4.media.session.EXTRA_BINDER", paramString.b);
paramResultReceiver.send(0, paramBundle);
}
return;
}
MediaSessionCompat.Callback.this.onCommand(paramString, paramBundle, paramResultReceiver);
}
public final boolean a(Intent paramIntent)
{
return MediaSessionCompat.Callback.this.onMediaButtonEvent(paramIntent);
}
public final void b()
{
MediaSessionCompat.Callback.this.onPause();
}
public final void b(long paramLong)
{
MediaSessionCompat.Callback.this.onSeekTo(paramLong);
}
public final void b(String paramString, Bundle paramBundle)
{
MediaSessionCompat.Callback.this.onPlayFromSearch(paramString, paramBundle);
}
public final void c()
{
MediaSessionCompat.Callback.this.onSkipToNext();
}
public final void c(String paramString, Bundle paramBundle)
{
if (paramString.equals("android.support.v4.media.session.action.PLAY_FROM_URI"))
{
paramString = (Uri)paramBundle.getParcelable("android.support.v4.media.session.action.ARGUMENT_URI");
paramBundle = (Bundle)paramBundle.getParcelable("android.support.v4.media.session.action.ARGUMENT_EXTRAS");
MediaSessionCompat.Callback.this.onPlayFromUri(paramString, paramBundle);
return;
}
if (paramString.equals("android.support.v4.media.session.action.PREPARE"))
{
MediaSessionCompat.Callback.this.onPrepare();
return;
}
if (paramString.equals("android.support.v4.media.session.action.PREPARE_FROM_MEDIA_ID"))
{
paramString = paramBundle.getString("android.support.v4.media.session.action.ARGUMENT_MEDIA_ID");
paramBundle = paramBundle.getBundle("android.support.v4.media.session.action.ARGUMENT_EXTRAS");
MediaSessionCompat.Callback.this.onPrepareFromMediaId(paramString, paramBundle);
return;
}
if (paramString.equals("android.support.v4.media.session.action.PREPARE_FROM_SEARCH"))
{
paramString = paramBundle.getString("android.support.v4.media.session.action.ARGUMENT_QUERY");
paramBundle = paramBundle.getBundle("android.support.v4.media.session.action.ARGUMENT_EXTRAS");
MediaSessionCompat.Callback.this.onPrepareFromSearch(paramString, paramBundle);
return;
}
if (paramString.equals("android.support.v4.media.session.action.PREPARE_FROM_URI"))
{
paramString = (Uri)paramBundle.getParcelable("android.support.v4.media.session.action.ARGUMENT_URI");
paramBundle = paramBundle.getBundle("android.support.v4.media.session.action.ARGUMENT_EXTRAS");
MediaSessionCompat.Callback.this.onPrepareFromUri(paramString, paramBundle);
return;
}
MediaSessionCompat.Callback.this.onCustomAction(paramString, paramBundle);
}
public final void d()
{
MediaSessionCompat.Callback.this.onSkipToPrevious();
}
public final void e()
{
MediaSessionCompat.Callback.this.onFastForward();
}
public final void f()
{
MediaSessionCompat.Callback.this.onRewind();
}
public final void g()
{
MediaSessionCompat.Callback.this.onStop();
}
}
class b
extends MediaSessionCompat.Callback.a
implements MediaSessionCompatApi23.Callback
{
b()
{
super();
}
public void onPlayFromUri(Uri paramUri, Bundle paramBundle)
{
MediaSessionCompat.Callback.this.onPlayFromUri(paramUri, paramBundle);
}
}
final class c
extends MediaSessionCompat.Callback.b
implements MediaSessionCompatApi24.Callback
{
c()
{
super();
}
public final void onPrepare()
{
MediaSessionCompat.Callback.this.onPrepare();
}
public final void onPrepareFromMediaId(String paramString, Bundle paramBundle)
{
MediaSessionCompat.Callback.this.onPrepareFromMediaId(paramString, paramBundle);
}
public final void onPrepareFromSearch(String paramString, Bundle paramBundle)
{
MediaSessionCompat.Callback.this.onPrepareFromSearch(paramString, paramBundle);
}
public final void onPrepareFromUri(Uri paramUri, Bundle paramBundle)
{
MediaSessionCompat.Callback.this.onPrepareFromUri(paramUri, paramBundle);
}
}
}
public static abstract interface OnActiveChangeListener
{
public abstract void onActiveChanged();
}
public static final class QueueItem
implements Parcelable
{
public static final Parcelable.Creator<QueueItem> CREATOR = new Parcelable.Creator() {};
public static final int UNKNOWN_ID = -1;
private final MediaDescriptionCompat a;
private final long b;
private Object c;
QueueItem(Parcel paramParcel)
{
this.a = ((MediaDescriptionCompat)MediaDescriptionCompat.CREATOR.createFromParcel(paramParcel));
this.b = paramParcel.readLong();
}
public QueueItem(MediaDescriptionCompat paramMediaDescriptionCompat, long paramLong)
{
this(null, paramMediaDescriptionCompat, paramLong);
}
private QueueItem(Object paramObject, MediaDescriptionCompat paramMediaDescriptionCompat, long paramLong)
{
if (paramMediaDescriptionCompat == null) {
throw new IllegalArgumentException("Description cannot be null.");
}
if (paramLong == -1L) {
throw new IllegalArgumentException("Id cannot be QueueItem.UNKNOWN_ID");
}
this.a = paramMediaDescriptionCompat;
this.b = paramLong;
this.c = paramObject;
}
public static QueueItem fromQueueItem(Object paramObject)
{
if ((paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
return null;
}
return new QueueItem(paramObject, MediaDescriptionCompat.fromMediaDescription(((MediaSession.QueueItem)paramObject).getDescription()), ((MediaSession.QueueItem)paramObject).getQueueId());
}
public static List<QueueItem> fromQueueItemList(List<?> paramList)
{
if ((paramList == null) || (Build.VERSION.SDK_INT < 21))
{
paramList = null;
return paramList;
}
ArrayList localArrayList = new ArrayList();
Iterator localIterator = paramList.iterator();
for (;;)
{
paramList = localArrayList;
if (!localIterator.hasNext()) {
break;
}
localArrayList.add(fromQueueItem(localIterator.next()));
}
}
@Deprecated
public static QueueItem obtain(Object paramObject)
{
return fromQueueItem(paramObject);
}
public final int describeContents()
{
return 0;
}
public final MediaDescriptionCompat getDescription()
{
return this.a;
}
public final long getQueueId()
{
return this.b;
}
public final Object getQueueItem()
{
if ((this.c != null) || (Build.VERSION.SDK_INT < 21)) {
return this.c;
}
Object localObject = this.a.getMediaDescription();
long l = this.b;
this.c = new MediaSession.QueueItem((MediaDescription)localObject, l);
return this.c;
}
public final String toString()
{
return "MediaSession.QueueItem {Description=" + this.a + ", Id=" + this.b + " }";
}
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
this.a.writeToParcel(paramParcel, paramInt);
paramParcel.writeLong(this.b);
}
}
static final class ResultReceiverWrapper
implements Parcelable
{
public static final Parcelable.Creator<ResultReceiverWrapper> CREATOR = new Parcelable.Creator() {};
private ResultReceiver a;
ResultReceiverWrapper(Parcel paramParcel)
{
this.a = ((ResultReceiver)ResultReceiver.CREATOR.createFromParcel(paramParcel));
}
public ResultReceiverWrapper(ResultReceiver paramResultReceiver)
{
this.a = paramResultReceiver;
}
public final int describeContents()
{
return 0;
}
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
this.a.writeToParcel(paramParcel, paramInt);
}
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface SessionFlags {}
public static final class Token
implements Parcelable
{
public static final Parcelable.Creator<Token> CREATOR = new Parcelable.Creator() {};
private final Object a;
Token(Object paramObject)
{
this.a = paramObject;
}
public static Token fromToken(Object paramObject)
{
if ((paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
return null;
}
if ((paramObject instanceof MediaSession.Token)) {
return new Token(paramObject);
}
throw new IllegalArgumentException("token is not a valid MediaSession.Token object");
}
public final int describeContents()
{
return 0;
}
public final boolean equals(Object paramObject)
{
if (this == paramObject) {}
do
{
return true;
if (!(paramObject instanceof Token)) {
return false;
}
paramObject = (Token)paramObject;
if (this.a != null) {
break;
}
} while (((Token)paramObject).a == null);
return false;
if (((Token)paramObject).a == null) {
return false;
}
return this.a.equals(((Token)paramObject).a);
}
public final Object getToken()
{
return this.a;
}
public final int hashCode()
{
if (this.a == null) {
return 0;
}
return this.a.hashCode();
}
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
if (Build.VERSION.SDK_INT >= 21)
{
paramParcel.writeParcelable((Parcelable)this.a, paramInt);
return;
}
paramParcel.writeStrongBinder((IBinder)this.a);
}
}
static abstract interface a
{
public abstract void a(int paramInt);
public abstract void a(PendingIntent paramPendingIntent);
public abstract void a(Bundle paramBundle);
public abstract void a(MediaMetadataCompat paramMediaMetadataCompat);
public abstract void a(VolumeProviderCompat paramVolumeProviderCompat);
public abstract void a(MediaSessionCompat.Callback paramCallback, Handler paramHandler);
public abstract void a(PlaybackStateCompat paramPlaybackStateCompat);
public abstract void a(CharSequence paramCharSequence);
public abstract void a(String paramString, Bundle paramBundle);
public abstract void a(List<MediaSessionCompat.QueueItem> paramList);
public abstract void a(boolean paramBoolean);
public abstract boolean a();
public abstract void b();
public abstract void b(int paramInt);
public abstract void b(PendingIntent paramPendingIntent);
public abstract MediaSessionCompat.Token c();
public abstract void c(int paramInt);
public abstract Object d();
public abstract Object e();
public abstract String f();
}
static final class b
implements MediaSessionCompat.a
{
boolean a = false;
a b;
final RemoteCallbackList<IMediaControllerCallback> c = new RemoteCallbackList();
PlaybackStateCompat d;
int e;
private final Object f;
private final MediaSessionCompat.Token g;
public b(Context paramContext, String paramString)
{
this.f = new MediaSession(paramContext, paramString);
this.g = new MediaSessionCompat.Token(((MediaSession)this.f).getSessionToken());
}
public b(Object paramObject)
{
if ((paramObject instanceof MediaSession))
{
this.f = paramObject;
this.g = new MediaSessionCompat.Token(((MediaSession)this.f).getSessionToken());
return;
}
throw new IllegalArgumentException("mediaSession is not a valid MediaSession object");
}
public final void a(int paramInt)
{
((MediaSession)this.f).setFlags(paramInt);
}
public final void a(PendingIntent paramPendingIntent)
{
((MediaSession)this.f).setSessionActivity(paramPendingIntent);
}
public final void a(Bundle paramBundle)
{
((MediaSession)this.f).setExtras(paramBundle);
}
public final void a(MediaMetadataCompat paramMediaMetadataCompat)
{
Object localObject = this.f;
if (paramMediaMetadataCompat == null) {}
for (paramMediaMetadataCompat = null;; paramMediaMetadataCompat = paramMediaMetadataCompat.getMediaMetadata())
{
((MediaSession)localObject).setMetadata((MediaMetadata)paramMediaMetadataCompat);
return;
}
}
public final void a(VolumeProviderCompat paramVolumeProviderCompat)
{
Object localObject = this.f;
paramVolumeProviderCompat = paramVolumeProviderCompat.getVolumeProvider();
((MediaSession)localObject).setPlaybackToRemote((VolumeProvider)paramVolumeProviderCompat);
}
public final void a(MediaSessionCompat.Callback paramCallback, Handler paramHandler)
{
Object localObject2 = this.f;
if (paramCallback == null) {}
for (Object localObject1 = null;; localObject1 = paramCallback.b)
{
((MediaSession)localObject2).setCallback((MediaSession.Callback)localObject1, paramHandler);
if (paramCallback != null) {
paramCallback.c = new WeakReference(this);
}
return;
}
}
public final void a(PlaybackStateCompat paramPlaybackStateCompat)
{
int i;
if (Build.VERSION.SDK_INT < 22)
{
this.d = paramPlaybackStateCompat;
i = this.c.beginBroadcast() - 1;
}
for (;;)
{
Object localObject;
if (i >= 0) {
localObject = (IMediaControllerCallback)this.c.getBroadcastItem(i);
}
try
{
((IMediaControllerCallback)localObject).onPlaybackStateChanged(paramPlaybackStateCompat);
i -= 1;
continue;
this.c.finishBroadcast();
localObject = this.f;
if (paramPlaybackStateCompat == null) {}
for (paramPlaybackStateCompat = null;; paramPlaybackStateCompat = paramPlaybackStateCompat.getPlaybackState())
{
((MediaSession)localObject).setPlaybackState((PlaybackState)paramPlaybackStateCompat);
return;
}
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(CharSequence paramCharSequence)
{
((MediaSession)this.f).setQueueTitle(paramCharSequence);
}
public final void a(String paramString, Bundle paramBundle)
{
int i;
if (Build.VERSION.SDK_INT < 23) {
i = this.c.beginBroadcast() - 1;
}
for (;;)
{
IMediaControllerCallback localIMediaControllerCallback;
if (i >= 0) {
localIMediaControllerCallback = (IMediaControllerCallback)this.c.getBroadcastItem(i);
}
try
{
localIMediaControllerCallback.onEvent(paramString, paramBundle);
i -= 1;
continue;
this.c.finishBroadcast();
((MediaSession)this.f).sendSessionEvent(paramString, paramBundle);
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(List<MediaSessionCompat.QueueItem> paramList)
{
ArrayList localArrayList = null;
if (paramList != null)
{
localArrayList = new ArrayList();
paramList = paramList.iterator();
while (paramList.hasNext()) {
localArrayList.add(((MediaSessionCompat.QueueItem)paramList.next()).getQueueItem());
}
}
dn.a(this.f, localArrayList);
}
public final void a(boolean paramBoolean)
{
((MediaSession)this.f).setActive(paramBoolean);
}
public final boolean a()
{
return ((MediaSession)this.f).isActive();
}
public final void b()
{
this.a = true;
((MediaSession)this.f).release();
}
public final void b(int paramInt)
{
Object localObject = this.f;
AudioAttributes.Builder localBuilder = new AudioAttributes.Builder();
localBuilder.setLegacyStreamType(paramInt);
((MediaSession)localObject).setPlaybackToLocal(localBuilder.build());
}
public final void b(PendingIntent paramPendingIntent)
{
((MediaSession)this.f).setMediaButtonReceiver(paramPendingIntent);
}
public final MediaSessionCompat.Token c()
{
return this.g;
}
public final void c(int paramInt)
{
if (Build.VERSION.SDK_INT < 22)
{
this.e = paramInt;
return;
}
((MediaSession)this.f).setRatingType(paramInt);
}
public final Object d()
{
return this.f;
}
public final Object e()
{
return null;
}
public final String f()
{
if (Build.VERSION.SDK_INT < 24) {
return null;
}
return MediaSessionCompatApi24.a(this.f);
}
final class a
extends IMediaSession.Stub
{
a() {}
public final void adjustVolume(int paramInt1, int paramInt2, String paramString)
{
throw new AssertionError();
}
public final void fastForward()
throws RemoteException
{
throw new AssertionError();
}
public final Bundle getExtras()
{
throw new AssertionError();
}
public final long getFlags()
{
throw new AssertionError();
}
public final PendingIntent getLaunchPendingIntent()
{
throw new AssertionError();
}
public final MediaMetadataCompat getMetadata()
{
throw new AssertionError();
}
public final String getPackageName()
{
throw new AssertionError();
}
public final PlaybackStateCompat getPlaybackState()
{
return MediaSessionCompat.b.this.d;
}
public final List<MediaSessionCompat.QueueItem> getQueue()
{
return null;
}
public final CharSequence getQueueTitle()
{
throw new AssertionError();
}
public final int getRatingType()
{
return MediaSessionCompat.b.this.e;
}
public final String getTag()
{
throw new AssertionError();
}
public final ParcelableVolumeInfo getVolumeAttributes()
{
throw new AssertionError();
}
public final boolean isTransportControlEnabled()
{
throw new AssertionError();
}
public final void next()
throws RemoteException
{
throw new AssertionError();
}
public final void pause()
throws RemoteException
{
throw new AssertionError();
}
public final void play()
throws RemoteException
{
throw new AssertionError();
}
public final void playFromMediaId(String paramString, Bundle paramBundle)
throws RemoteException
{
throw new AssertionError();
}
public final void playFromSearch(String paramString, Bundle paramBundle)
throws RemoteException
{
throw new AssertionError();
}
public final void playFromUri(Uri paramUri, Bundle paramBundle)
throws RemoteException
{
throw new AssertionError();
}
public final void prepare()
throws RemoteException
{
throw new AssertionError();
}
public final void prepareFromMediaId(String paramString, Bundle paramBundle)
throws RemoteException
{
throw new AssertionError();
}
public final void prepareFromSearch(String paramString, Bundle paramBundle)
throws RemoteException
{
throw new AssertionError();
}
public final void prepareFromUri(Uri paramUri, Bundle paramBundle)
throws RemoteException
{
throw new AssertionError();
}
public final void previous()
throws RemoteException
{
throw new AssertionError();
}
public final void rate(RatingCompat paramRatingCompat)
throws RemoteException
{
throw new AssertionError();
}
public final void registerCallbackListener(IMediaControllerCallback paramIMediaControllerCallback)
{
if (!MediaSessionCompat.b.this.a) {
MediaSessionCompat.b.this.c.register(paramIMediaControllerCallback);
}
}
public final void rewind()
throws RemoteException
{
throw new AssertionError();
}
public final void seekTo(long paramLong)
throws RemoteException
{
throw new AssertionError();
}
public final void sendCommand(String paramString, Bundle paramBundle, MediaSessionCompat.ResultReceiverWrapper paramResultReceiverWrapper)
{
throw new AssertionError();
}
public final void sendCustomAction(String paramString, Bundle paramBundle)
throws RemoteException
{
throw new AssertionError();
}
public final boolean sendMediaButton(KeyEvent paramKeyEvent)
{
throw new AssertionError();
}
public final void setVolumeTo(int paramInt1, int paramInt2, String paramString)
{
throw new AssertionError();
}
public final void skipToQueueItem(long paramLong)
{
throw new AssertionError();
}
public final void stop()
throws RemoteException
{
throw new AssertionError();
}
public final void unregisterCallbackListener(IMediaControllerCallback paramIMediaControllerCallback)
{
MediaSessionCompat.b.this.c.unregister(paramIMediaControllerCallback);
}
}
}
static final class c
implements MediaSessionCompat.a
{
private boolean A = false;
private boolean B = false;
private VolumeProviderCompat.Callback C = new VolumeProviderCompat.Callback()
{
public final void onVolumeChanged(VolumeProviderCompat paramAnonymousVolumeProviderCompat)
{
if (MediaSessionCompat.c.this.r != paramAnonymousVolumeProviderCompat) {
return;
}
paramAnonymousVolumeProviderCompat = new ParcelableVolumeInfo(MediaSessionCompat.c.this.p, MediaSessionCompat.c.this.q, paramAnonymousVolumeProviderCompat.getVolumeControl(), paramAnonymousVolumeProviderCompat.getMaxVolume(), paramAnonymousVolumeProviderCompat.getCurrentVolume());
MediaSessionCompat.c.this.a(paramAnonymousVolumeProviderCompat);
}
};
final String a;
final String b;
final AudioManager c;
final Object d = new Object();
final RemoteCallbackList<IMediaControllerCallback> e = new RemoteCallbackList();
boolean f = false;
volatile MediaSessionCompat.Callback g;
int h;
MediaMetadataCompat i;
PlaybackStateCompat j;
PendingIntent k;
List<MediaSessionCompat.QueueItem> l;
CharSequence m;
int n;
Bundle o;
int p;
int q;
VolumeProviderCompat r;
private final Context s;
private final ComponentName t;
private final PendingIntent u;
private final Object v;
private final b w;
private final MediaSessionCompat.Token x;
private c y;
private boolean z = false;
public c(Context paramContext, String paramString, ComponentName paramComponentName, PendingIntent paramPendingIntent)
{
ComponentName localComponentName = paramComponentName;
if (paramComponentName == null)
{
paramComponentName = MediaButtonReceiver.a(paramContext);
localComponentName = paramComponentName;
if (paramComponentName == null)
{
Log.w("MediaSessionCompat", "Couldn't find a unique registered media button receiver in the given context.");
localComponentName = paramComponentName;
}
}
paramComponentName = paramPendingIntent;
if (localComponentName != null)
{
paramComponentName = paramPendingIntent;
if (paramPendingIntent == null)
{
paramComponentName = new Intent("android.intent.action.MEDIA_BUTTON");
paramComponentName.setComponent(localComponentName);
paramComponentName = PendingIntent.getBroadcast(paramContext, 0, paramComponentName, 0);
}
}
if (localComponentName == null) {
throw new IllegalArgumentException("MediaButtonReceiver component may not be null.");
}
this.s = paramContext;
this.a = paramContext.getPackageName();
this.c = ((AudioManager)paramContext.getSystemService("audio"));
this.b = paramString;
this.t = localComponentName;
this.u = paramComponentName;
this.w = new b();
this.x = new MediaSessionCompat.Token(this.w);
this.n = 0;
this.p = 1;
this.q = 3;
if (Build.VERSION.SDK_INT >= 14)
{
this.v = new RemoteControlClient(paramComponentName);
return;
}
this.v = null;
}
private boolean h()
{
if (this.z)
{
if ((!this.B) && ((this.h & 0x1) != 0)) {
if (Build.VERSION.SDK_INT >= 18)
{
dl.a(this.s, this.u, this.t);
this.B = true;
}
}
while ((!this.B) || ((this.h & 0x1) != 0)) {
for (;;)
{
if (Build.VERSION.SDK_INT < 14) {
break label307;
}
if ((this.A) || ((this.h & 0x2) == 0)) {
break;
}
Context localContext = this.s;
Object localObject = this.v;
((AudioManager)localContext.getSystemService("audio")).registerRemoteControlClient((RemoteControlClient)localObject);
this.A = true;
return true;
((AudioManager)this.s.getSystemService("audio")).registerMediaButtonEventReceiver(this.t);
}
}
if (Build.VERSION.SDK_INT >= 18) {
dl.b(this.s, this.u, this.t);
}
for (;;)
{
this.B = false;
break;
((AudioManager)this.s.getSystemService("audio")).unregisterMediaButtonEventReceiver(this.t);
}
if ((this.A) && ((this.h & 0x2) == 0))
{
dk.a(this.v, 0);
dk.a(this.s, this.v);
this.A = false;
return false;
}
}
else if (this.B)
{
if (Build.VERSION.SDK_INT < 18) {
break label309;
}
dl.b(this.s, this.u, this.t);
}
for (;;)
{
this.B = false;
if (this.A)
{
dk.a(this.v, 0);
dk.a(this.s, this.v);
this.A = false;
}
label307:
return false;
label309:
((AudioManager)this.s.getSystemService("audio")).unregisterMediaButtonEventReceiver(this.t);
}
}
public final void a(int paramInt)
{
synchronized (this.d)
{
this.h = paramInt;
h();
return;
}
}
final void a(int paramInt1, int paramInt2)
{
if (this.p == 2)
{
if (this.r != null) {
this.r.onAdjustVolume(paramInt1);
}
return;
}
this.c.adjustStreamVolume(this.q, paramInt1, paramInt2);
}
final void a(int paramInt, Object paramObject, Bundle paramBundle)
{
synchronized (this.d)
{
if (this.y != null)
{
paramObject = this.y.obtainMessage(paramInt, paramObject);
((Message)paramObject).setData(paramBundle);
((Message)paramObject).sendToTarget();
}
return;
}
}
public final void a(PendingIntent paramPendingIntent)
{
synchronized (this.d)
{
this.k = paramPendingIntent;
return;
}
}
public final void a(Bundle paramBundle)
{
this.o = paramBundle;
int i1 = this.e.beginBroadcast() - 1;
for (;;)
{
IMediaControllerCallback localIMediaControllerCallback;
if (i1 >= 0) {
localIMediaControllerCallback = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
try
{
localIMediaControllerCallback.onExtrasChanged(paramBundle);
i1 -= 1;
continue;
this.e.finishBroadcast();
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(MediaMetadataCompat arg1)
{
Object localObject3 = null;
Object localObject2 = null;
MediaMetadataCompat localMediaMetadataCompat = ???;
if (??? != null) {
localMediaMetadataCompat = new MediaMetadataCompat.Builder(???, MediaSessionCompat.a).build();
}
for (;;)
{
int i1;
synchronized (this.d)
{
this.i = localMediaMetadataCompat;
i1 = this.e.beginBroadcast() - 1;
if (i1 >= 0) {
??? = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
}
try
{
???.onMetadataChanged(localMediaMetadataCompat);
i1 -= 1;
continue;
localObject1 = finally;
throw ((Throwable)localObject1);
this.e.finishBroadcast();
if (!this.z) {}
RemoteControlClient.MetadataEditor localMetadataEditor;
label268:
do
{
return;
if (Build.VERSION.SDK_INT >= 19)
{
localObject3 = this.v;
if (localObject1 == null)
{
??? = (MediaMetadataCompat)localObject2;
if (this.j != null) {
break label268;
}
}
for (long l1 = 0L;; l1 = this.j.getActions())
{
localMetadataEditor = ((RemoteControlClient)localObject3).editMetadata(true);
dk.a(???, localMetadataEditor);
if (??? != null)
{
if (???.containsKey("android.media.metadata.YEAR")) {
localMetadataEditor.putLong(8, ???.getLong("android.media.metadata.YEAR"));
}
if (???.containsKey("android.media.metadata.RATING")) {
localMetadataEditor.putObject(101, ???.getParcelable("android.media.metadata.RATING"));
}
if (???.containsKey("android.media.metadata.USER_RATING")) {
localMetadataEditor.putObject(268435457, ???.getParcelable("android.media.metadata.USER_RATING"));
}
}
if ((l1 & 0x80) != 0L) {
localMetadataEditor.addEditableKey(268435457);
}
localMetadataEditor.apply();
return;
??? = localMetadataEditor.getBundle();
break;
}
}
} while (Build.VERSION.SDK_INT < 14);
localObject2 = this.v;
if (localMetadataEditor == null) {}
for (??? = (MediaMetadataCompat)localObject3;; ??? = localMetadataEditor.getBundle())
{
localMetadataEditor = ((RemoteControlClient)localObject2).editMetadata(true);
dk.a(???, localMetadataEditor);
localMetadataEditor.apply();
return;
}
}
catch (RemoteException ???)
{
for (;;) {}
}
}
}
public final void a(VolumeProviderCompat paramVolumeProviderCompat)
{
if (paramVolumeProviderCompat == null) {
throw new IllegalArgumentException("volumeProvider may not be null");
}
if (this.r != null) {
this.r.setCallback(null);
}
this.p = 2;
this.r = paramVolumeProviderCompat;
a(new ParcelableVolumeInfo(this.p, this.q, this.r.getVolumeControl(), this.r.getMaxVolume(), this.r.getCurrentVolume()));
paramVolumeProviderCompat.setCallback(this.C);
}
public final void a(MediaSessionCompat.Callback paramCallback, Handler arg2)
{
this.g = paramCallback;
if (paramCallback == null)
{
if (Build.VERSION.SDK_INT >= 18) {
dl.a(this.v, null);
}
if (Build.VERSION.SDK_INT >= 19) {
dm.a(this.v, null);
}
}
for (;;)
{
return;
paramCallback = ???;
if (??? == null) {
paramCallback = new Handler();
}
synchronized (this.d)
{
this.y = new c(paramCallback.getLooper());
paramCallback = new dm.a()
{
public final void a(Object paramAnonymousObject)
{
MediaSessionCompat.c.this.a(19, RatingCompat.fromRating(paramAnonymousObject), null);
}
public final void b(long paramAnonymousLong)
{
MediaSessionCompat.c.this.a(18, Long.valueOf(paramAnonymousLong), null);
}
};
if (Build.VERSION.SDK_INT >= 18)
{
??? = dl.a(paramCallback);
dl.a(this.v, ???);
}
if (Build.VERSION.SDK_INT < 19) {
continue;
}
paramCallback = new dm.b(paramCallback);
dm.a(this.v, paramCallback);
return;
}
}
}
final void a(ParcelableVolumeInfo paramParcelableVolumeInfo)
{
int i1 = this.e.beginBroadcast() - 1;
for (;;)
{
IMediaControllerCallback localIMediaControllerCallback;
if (i1 >= 0) {
localIMediaControllerCallback = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
try
{
localIMediaControllerCallback.onVolumeInfoChanged(paramParcelableVolumeInfo);
i1 -= 1;
continue;
this.e.finishBroadcast();
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(PlaybackStateCompat paramPlaybackStateCompat)
{
for (;;)
{
int i1;
synchronized (this.d)
{
this.j = paramPlaybackStateCompat;
i1 = this.e.beginBroadcast() - 1;
if (i1 >= 0) {
??? = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
}
try
{
((IMediaControllerCallback)???).onPlaybackStateChanged(paramPlaybackStateCompat);
i1 -= 1;
continue;
paramPlaybackStateCompat = finally;
throw paramPlaybackStateCompat;
this.e.finishBroadcast();
if (!this.z) {}
do
{
do
{
return;
if (paramPlaybackStateCompat != null) {
break;
}
} while (Build.VERSION.SDK_INT < 14);
dk.a(this.v, 0);
dk.a(this.v, 0L);
return;
if (Build.VERSION.SDK_INT >= 18) {
dl.a(this.v, paramPlaybackStateCompat.getState(), paramPlaybackStateCompat.getPosition(), paramPlaybackStateCompat.getPlaybackSpeed(), paramPlaybackStateCompat.getLastPositionUpdateTime());
}
while (Build.VERSION.SDK_INT >= 19)
{
??? = this.v;
long l1 = paramPlaybackStateCompat.getActions();
paramPlaybackStateCompat = (RemoteControlClient)???;
int i2 = dl.a(l1);
i1 = i2;
if ((l1 & 0x80) != 0L) {
i1 = i2 | 0x200;
}
paramPlaybackStateCompat.setTransportControlFlags(i1);
return;
if (Build.VERSION.SDK_INT >= 14) {
dk.a(this.v, paramPlaybackStateCompat.getState());
}
}
if (Build.VERSION.SDK_INT >= 18)
{
dl.a(this.v, paramPlaybackStateCompat.getActions());
return;
}
} while (Build.VERSION.SDK_INT < 14);
dk.a(this.v, paramPlaybackStateCompat.getActions());
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(CharSequence paramCharSequence)
{
this.m = paramCharSequence;
int i1 = this.e.beginBroadcast() - 1;
for (;;)
{
IMediaControllerCallback localIMediaControllerCallback;
if (i1 >= 0) {
localIMediaControllerCallback = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
try
{
localIMediaControllerCallback.onQueueTitleChanged(paramCharSequence);
i1 -= 1;
continue;
this.e.finishBroadcast();
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(String paramString, Bundle paramBundle)
{
int i1 = this.e.beginBroadcast() - 1;
for (;;)
{
IMediaControllerCallback localIMediaControllerCallback;
if (i1 >= 0) {
localIMediaControllerCallback = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
try
{
localIMediaControllerCallback.onEvent(paramString, paramBundle);
i1 -= 1;
continue;
this.e.finishBroadcast();
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(List<MediaSessionCompat.QueueItem> paramList)
{
this.l = paramList;
int i1 = this.e.beginBroadcast() - 1;
for (;;)
{
IMediaControllerCallback localIMediaControllerCallback;
if (i1 >= 0) {
localIMediaControllerCallback = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
try
{
localIMediaControllerCallback.onQueueChanged(paramList);
i1 -= 1;
continue;
this.e.finishBroadcast();
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void a(boolean paramBoolean)
{
if (paramBoolean == this.z) {}
do
{
return;
this.z = paramBoolean;
} while (!h());
a(this.i);
a(this.j);
}
public final boolean a()
{
return this.z;
}
public final void b()
{
this.z = false;
this.f = true;
h();
int i1 = this.e.beginBroadcast() - 1;
for (;;)
{
IMediaControllerCallback localIMediaControllerCallback;
if (i1 >= 0) {
localIMediaControllerCallback = (IMediaControllerCallback)this.e.getBroadcastItem(i1);
}
try
{
localIMediaControllerCallback.onSessionDestroyed();
i1 -= 1;
continue;
this.e.finishBroadcast();
this.e.kill();
return;
}
catch (RemoteException localRemoteException)
{
for (;;) {}
}
}
}
public final void b(int paramInt)
{
if (this.r != null) {
this.r.setCallback(null);
}
this.p = 1;
a(new ParcelableVolumeInfo(this.p, this.q, 2, this.c.getStreamMaxVolume(this.q), this.c.getStreamVolume(this.q)));
}
final void b(int paramInt1, int paramInt2)
{
if (this.p == 2)
{
if (this.r != null) {
this.r.onSetVolumeTo(paramInt1);
}
return;
}
this.c.setStreamVolume(this.q, paramInt1, paramInt2);
}
public final void b(PendingIntent paramPendingIntent) {}
public final MediaSessionCompat.Token c()
{
return this.x;
}
public final void c(int paramInt)
{
this.n = paramInt;
}
public final Object d()
{
return null;
}
public final Object e()
{
return this.v;
}
public final String f()
{
return null;
}
final PlaybackStateCompat g()
{
long l2 = -1L;
for (;;)
{
long l1;
synchronized (this.d)
{
PlaybackStateCompat localPlaybackStateCompat = this.j;
l1 = l2;
if (this.i != null)
{
l1 = l2;
if (this.i.containsKey("android.media.metadata.DURATION")) {
l1 = this.i.getLong("android.media.metadata.DURATION");
}
}
if ((localPlaybackStateCompat == null) || ((localPlaybackStateCompat.getState() != 3) && (localPlaybackStateCompat.getState() != 4) && (localPlaybackStateCompat.getState() != 5))) {
break label214;
}
l2 = localPlaybackStateCompat.getLastPositionUpdateTime();
long l3 = SystemClock.elapsedRealtime();
if (l2 <= 0L) {
break label214;
}
l2 = (localPlaybackStateCompat.getPlaybackSpeed() * (float)(l3 - l2)) + localPlaybackStateCompat.getPosition();
if ((l1 >= 0L) && (l2 > l1))
{
??? = new PlaybackStateCompat.Builder(localPlaybackStateCompat);
((PlaybackStateCompat.Builder)???).setState(localPlaybackStateCompat.getState(), l1, localPlaybackStateCompat.getPlaybackSpeed(), l3);
??? = ((PlaybackStateCompat.Builder)???).build();
Object localObject2 = ???;
if (??? == null) {
localObject2 = localPlaybackStateCompat;
}
return (PlaybackStateCompat)localObject2;
}
}
if (l2 < 0L)
{
l1 = 0L;
}
else
{
l1 = l2;
continue;
label214:
??? = null;
}
}
}
static final class a
{
public final String a;
public final Bundle b;
public final ResultReceiver c;
public a(String paramString, Bundle paramBundle, ResultReceiver paramResultReceiver)
{
this.a = paramString;
this.b = paramBundle;
this.c = paramResultReceiver;
}
}
final class b
extends IMediaSession.Stub
{
b() {}
public final void adjustVolume(int paramInt1, int paramInt2, String paramString)
{
MediaSessionCompat.c.this.a(paramInt1, paramInt2);
}
public final void fastForward()
throws RemoteException
{
MediaSessionCompat.c.this.a(16, null, null);
}
public final Bundle getExtras()
{
synchronized (MediaSessionCompat.c.this.d)
{
Bundle localBundle = MediaSessionCompat.c.this.o;
return localBundle;
}
}
public final long getFlags()
{
synchronized (MediaSessionCompat.c.this.d)
{
long l = MediaSessionCompat.c.this.h;
return l;
}
}
public final PendingIntent getLaunchPendingIntent()
{
synchronized (MediaSessionCompat.c.this.d)
{
PendingIntent localPendingIntent = MediaSessionCompat.c.this.k;
return localPendingIntent;
}
}
public final MediaMetadataCompat getMetadata()
{
return MediaSessionCompat.c.this.i;
}
public final String getPackageName()
{
return MediaSessionCompat.c.this.a;
}
public final PlaybackStateCompat getPlaybackState()
{
return MediaSessionCompat.c.this.g();
}
public final List<MediaSessionCompat.QueueItem> getQueue()
{
synchronized (MediaSessionCompat.c.this.d)
{
List localList = MediaSessionCompat.c.this.l;
return localList;
}
}
public final CharSequence getQueueTitle()
{
return MediaSessionCompat.c.this.m;
}
public final int getRatingType()
{
return MediaSessionCompat.c.this.n;
}
public final String getTag()
{
return MediaSessionCompat.c.this.b;
}
public final ParcelableVolumeInfo getVolumeAttributes()
{
int i = 2;
synchronized (MediaSessionCompat.c.this.d)
{
int m = MediaSessionCompat.c.this.p;
int n = MediaSessionCompat.c.this.q;
VolumeProviderCompat localVolumeProviderCompat = MediaSessionCompat.c.this.r;
if (m == 2)
{
i = localVolumeProviderCompat.getVolumeControl();
j = localVolumeProviderCompat.getMaxVolume();
k = localVolumeProviderCompat.getCurrentVolume();
return new ParcelableVolumeInfo(m, n, i, j, k);
}
int j = MediaSessionCompat.c.this.c.getStreamMaxVolume(n);
int k = MediaSessionCompat.c.this.c.getStreamVolume(n);
}
}
public final boolean isTransportControlEnabled()
{
return (MediaSessionCompat.c.this.h & 0x2) != 0;
}
public final void next()
throws RemoteException
{
MediaSessionCompat.c.this.a(14, null, null);
}
public final void pause()
throws RemoteException
{
MediaSessionCompat.c.this.a(12, null, null);
}
public final void play()
throws RemoteException
{
MediaSessionCompat.c.this.a(7, null, null);
}
public final void playFromMediaId(String paramString, Bundle paramBundle)
throws RemoteException
{
MediaSessionCompat.c.this.a(8, paramString, paramBundle);
}
public final void playFromSearch(String paramString, Bundle paramBundle)
throws RemoteException
{
MediaSessionCompat.c.this.a(9, paramString, paramBundle);
}
public final void playFromUri(Uri paramUri, Bundle paramBundle)
throws RemoteException
{
MediaSessionCompat.c.this.a(10, paramUri, paramBundle);
}
public final void prepare()
throws RemoteException
{
MediaSessionCompat.c.this.a(3, null, null);
}
public final void prepareFromMediaId(String paramString, Bundle paramBundle)
throws RemoteException
{
MediaSessionCompat.c.this.a(4, paramString, paramBundle);
}
public final void prepareFromSearch(String paramString, Bundle paramBundle)
throws RemoteException
{
MediaSessionCompat.c.this.a(5, paramString, paramBundle);
}
public final void prepareFromUri(Uri paramUri, Bundle paramBundle)
throws RemoteException
{
MediaSessionCompat.c.this.a(6, paramUri, paramBundle);
}
public final void previous()
throws RemoteException
{
MediaSessionCompat.c.this.a(15, null, null);
}
public final void rate(RatingCompat paramRatingCompat)
throws RemoteException
{
MediaSessionCompat.c.this.a(19, paramRatingCompat, null);
}
public final void registerCallbackListener(IMediaControllerCallback paramIMediaControllerCallback)
{
if (MediaSessionCompat.c.this.f) {}
try
{
paramIMediaControllerCallback.onSessionDestroyed();
return;
}
catch (Exception paramIMediaControllerCallback) {}
MediaSessionCompat.c.this.e.register(paramIMediaControllerCallback);
return;
}
public final void rewind()
throws RemoteException
{
MediaSessionCompat.c.this.a(17, null, null);
}
public final void seekTo(long paramLong)
throws RemoteException
{
MediaSessionCompat.c.this.a(18, Long.valueOf(paramLong), null);
}
public final void sendCommand(String paramString, Bundle paramBundle, MediaSessionCompat.ResultReceiverWrapper paramResultReceiverWrapper)
{
MediaSessionCompat.c.this.a(1, new MediaSessionCompat.c.a(paramString, paramBundle, MediaSessionCompat.ResultReceiverWrapper.a(paramResultReceiverWrapper)), null);
}
public final void sendCustomAction(String paramString, Bundle paramBundle)
throws RemoteException
{
MediaSessionCompat.c.this.a(20, paramString, paramBundle);
}
public final boolean sendMediaButton(KeyEvent paramKeyEvent)
{
if ((MediaSessionCompat.c.this.h & 0x1) != 0) {}
for (boolean bool = true;; bool = false)
{
if (bool) {
MediaSessionCompat.c.this.a(21, paramKeyEvent, null);
}
return bool;
}
}
public final void setVolumeTo(int paramInt1, int paramInt2, String paramString)
{
MediaSessionCompat.c.this.b(paramInt1, paramInt2);
}
public final void skipToQueueItem(long paramLong)
{
MediaSessionCompat.c.this.a(11, Long.valueOf(paramLong), null);
}
public final void stop()
throws RemoteException
{
MediaSessionCompat.c.this.a(13, null, null);
}
public final void unregisterCallbackListener(IMediaControllerCallback paramIMediaControllerCallback)
{
MediaSessionCompat.c.this.e.unregister(paramIMediaControllerCallback);
}
}
final class c
extends Handler
{
public c(Looper paramLooper)
{
super();
}
public final void handleMessage(Message paramMessage)
{
MediaSessionCompat.Callback localCallback = MediaSessionCompat.c.this.g;
if (localCallback == null) {}
label209:
int i;
label323:
int j;
label336:
label502:
label507:
label513:
do
{
Intent localIntent;
do
{
return;
switch (paramMessage.what)
{
default:
return;
case 1:
paramMessage = (MediaSessionCompat.c.a)paramMessage.obj;
localCallback.onCommand(paramMessage.a, paramMessage.b, paramMessage.c);
return;
case 21:
paramMessage = (KeyEvent)paramMessage.obj;
localIntent = new Intent("android.intent.action.MEDIA_BUTTON");
localIntent.putExtra("android.intent.extra.KEY_EVENT", paramMessage);
}
} while ((localCallback.onMediaButtonEvent(localIntent)) || (paramMessage == null) || (paramMessage.getAction() != 0));
long l;
if (MediaSessionCompat.c.this.j == null)
{
l = 0L;
switch (paramMessage.getKeyCode())
{
default:
return;
case 79:
case 85:
if ((MediaSessionCompat.c.this.j != null) && (MediaSessionCompat.c.this.j.getState() == 3))
{
i = 1;
if ((0x204 & l) == 0L) {
break label502;
}
j = 1;
if ((l & 0x202) == 0L) {
break label507;
}
}
break;
}
}
for (int k = 1;; k = 0)
{
if ((i == 0) || (k == 0)) {
break label513;
}
localCallback.onPause();
return;
l = MediaSessionCompat.c.this.j.getActions();
break label209;
if ((0x4 & l) == 0L) {
break;
}
localCallback.onPlay();
return;
if ((0x2 & l) == 0L) {
break;
}
localCallback.onPause();
return;
if ((0x20 & l) == 0L) {
break;
}
localCallback.onSkipToNext();
return;
if ((0x10 & l) == 0L) {
break;
}
localCallback.onSkipToPrevious();
return;
if ((1L & l) == 0L) {
break;
}
localCallback.onStop();
return;
if ((0x40 & l) == 0L) {
break;
}
localCallback.onFastForward();
return;
if ((0x8 & l) == 0L) {
break;
}
localCallback.onRewind();
return;
i = 0;
break label323;
j = 0;
break label336;
}
} while ((i != 0) || (j == 0));
localCallback.onPlay();
return;
localCallback.onPrepare();
return;
localCallback.onPrepareFromMediaId((String)paramMessage.obj, paramMessage.getData());
return;
localCallback.onPrepareFromSearch((String)paramMessage.obj, paramMessage.getData());
return;
localCallback.onPrepareFromUri((Uri)paramMessage.obj, paramMessage.getData());
return;
localCallback.onPlay();
return;
localCallback.onPlayFromMediaId((String)paramMessage.obj, paramMessage.getData());
return;
localCallback.onPlayFromSearch((String)paramMessage.obj, paramMessage.getData());
return;
localCallback.onPlayFromUri((Uri)paramMessage.obj, paramMessage.getData());
return;
localCallback.onSkipToQueueItem(((Long)paramMessage.obj).longValue());
return;
localCallback.onPause();
return;
localCallback.onStop();
return;
localCallback.onSkipToNext();
return;
localCallback.onSkipToPrevious();
return;
localCallback.onFastForward();
return;
localCallback.onRewind();
return;
localCallback.onSeekTo(((Long)paramMessage.obj).longValue());
return;
localCallback.onSetRating((RatingCompat)paramMessage.obj);
return;
localCallback.onCustomAction((String)paramMessage.obj, paramMessage.getData());
return;
MediaSessionCompat.c.this.a(((Integer)paramMessage.obj).intValue(), 0);
return;
MediaSessionCompat.c.this.b(((Integer)paramMessage.obj).intValue(), 0);
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/media/session/MediaSessionCompat.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/