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
|
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.view;
import android.annotation.SystemApi;
import android.app.Presentation;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.Insets;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
/**
* The interface that apps use to talk to the window manager.
* <p>
* Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
* </p><p>
* Each window manager instance is bound to a particular {@link Display}.
* To obtain a {@link WindowManager} for a different display, use
* {@link Context#createDisplayContext} to obtain a {@link Context} for that
* display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
* to get the WindowManager.
* </p><p>
* The simplest way to show a window on another display is to create a
* {@link Presentation}. The presentation will automatically obtain a
* {@link WindowManager} and {@link Context} for that display.
* </p>
*
* @see android.content.Context#getSystemService
* @see android.content.Context#WINDOW_SERVICE
*/
public interface WindowManager extends ViewManager {
/**
* Exception that is thrown when trying to add view whose
* {@link LayoutParams} {@link LayoutParams#token}
* is invalid.
*/
public static class BadTokenException extends RuntimeException {
public BadTokenException() {
}
public BadTokenException(String name) {
super(name);
}
}
/**
* Exception that is thrown when calling {@link #addView} to a secondary display that cannot
* be found. See {@link android.app.Presentation} for more information on secondary displays.
*/
public static class InvalidDisplayException extends RuntimeException {
public InvalidDisplayException() {
}
public InvalidDisplayException(String name) {
super(name);
}
}
/**
* Returns the {@link Display} upon which this {@link WindowManager} instance
* will create new windows.
* <p>
* Despite the name of this method, the display that is returned is not
* necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
* The returned display could instead be a secondary display that this
* window manager instance is managing. Think of it as the display that
* this {@link WindowManager} instance uses by default.
* </p><p>
* To create windows on a different display, you need to obtain a
* {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
* class documentation for more information.)
* </p>
*
* @return The display that this window manager is managing.
*/
public Display getDefaultDisplay();
/**
* Special variation of {@link #removeView} that immediately invokes
* the given view hierarchy's {@link View#onDetachedFromWindow()
* View.onDetachedFromWindow()} methods before returning. This is not
* for normal applications; using it correctly requires great care.
*
* @param view The view to be removed.
*/
public void removeViewImmediate(View view);
public static class LayoutParams extends ViewGroup.LayoutParams
implements Parcelable {
/**
* X position for this window. With the default gravity it is ignored.
* When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
* {@link Gravity#END} it provides an offset from the given edge.
*/
@ViewDebug.ExportedProperty
public int x;
/**
* Y position for this window. With the default gravity it is ignored.
* When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
* an offset from the given edge.
*/
@ViewDebug.ExportedProperty
public int y;
/**
* Indicates how much of the extra space will be allocated horizontally
* to the view associated with these LayoutParams. Specify 0 if the view
* should not be stretched. Otherwise the extra pixels will be pro-rated
* among all views whose weight is greater than 0.
*/
@ViewDebug.ExportedProperty
public float horizontalWeight;
/**
* Indicates how much of the extra space will be allocated vertically
* to the view associated with these LayoutParams. Specify 0 if the view
* should not be stretched. Otherwise the extra pixels will be pro-rated
* among all views whose weight is greater than 0.
*/
@ViewDebug.ExportedProperty
public float verticalWeight;
/**
* The general type of window. There are three main classes of
* window types:
* <ul>
* <li> <strong>Application windows</strong> (ranging from
* {@link #FIRST_APPLICATION_WINDOW} to
* {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
* windows. For these types of windows, the {@link #token} must be
* set to the token of the activity they are a part of (this will
* normally be done for you if {@link #token} is null).
* <li> <strong>Sub-windows</strong> (ranging from
* {@link #FIRST_SUB_WINDOW} to
* {@link #LAST_SUB_WINDOW}) are associated with another top-level
* window. For these types of windows, the {@link #token} must be
* the token of the window it is attached to.
* <li> <strong>System windows</strong> (ranging from
* {@link #FIRST_SYSTEM_WINDOW} to
* {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
* use by the system for specific purposes. They should not normally
* be used by applications, and a special permission is required
* to use them.
* </ul>
*
* @see #TYPE_BASE_APPLICATION
* @see #TYPE_APPLICATION
* @see #TYPE_APPLICATION_STARTING
* @see #TYPE_APPLICATION_PANEL
* @see #TYPE_APPLICATION_MEDIA
* @see #TYPE_APPLICATION_SUB_PANEL
* @see #TYPE_APPLICATION_ATTACHED_DIALOG
* @see #TYPE_STATUS_BAR
* @see #TYPE_SEARCH_BAR
* @see #TYPE_PHONE
* @see #TYPE_SYSTEM_ALERT
* @see #TYPE_TOAST
* @see #TYPE_SYSTEM_OVERLAY
* @see #TYPE_PRIORITY_PHONE
* @see #TYPE_STATUS_BAR_PANEL
* @see #TYPE_SYSTEM_DIALOG
* @see #TYPE_KEYGUARD_DIALOG
* @see #TYPE_SYSTEM_ERROR
* @see #TYPE_INPUT_METHOD
* @see #TYPE_INPUT_METHOD_DIALOG
*/
@ViewDebug.ExportedProperty(mapping = {
@ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
@ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
@ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
@ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
@ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
@ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
@ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
@ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
@ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
@ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
@ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
@ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
@ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
@ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
@ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
@ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
@ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
@ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
@ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
@ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
@ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
@ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
@ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
@ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
@ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
@ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
@ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
@ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
@ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
@ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
@ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
@ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
@ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
@ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
@ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
@ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
@ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
})
public int type;
/**
* Start of window types that represent normal application windows.
*/
public static final int FIRST_APPLICATION_WINDOW = 1;
/**
* Window type: an application window that serves as the "base" window
* of the overall application; all other application windows will
* appear on top of it.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_BASE_APPLICATION = 1;
/**
* Window type: a normal application window. The {@link #token} must be
* an Activity token identifying who the window belongs to.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_APPLICATION = 2;
/**
* Window type: special application window that is displayed while the
* application is starting. Not for use by applications themselves;
* this is used by the system to display something until the
* application can show its own windows.
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_APPLICATION_STARTING = 3;
/**
* End of types of application windows.
*/
public static final int LAST_APPLICATION_WINDOW = 99;
/**
* Start of types of sub-windows. The {@link #token} of these windows
* must be set to the window they are attached to. These types of
* windows are kept next to their attached window in Z-order, and their
* coordinate space is relative to their attached window.
*/
public static final int FIRST_SUB_WINDOW = 1000;
/**
* Window type: a panel on top of an application window. These windows
* appear on top of their attached window.
*/
public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
/**
* Window type: window for showing media (such as video). These windows
* are displayed behind their attached window.
*/
public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1;
/**
* Window type: a sub-panel on top of an application window. These
* windows are displayed on top their attached window and any
* {@link #TYPE_APPLICATION_PANEL} panels.
*/
public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2;
/** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
* of the window happens as that of a top-level window, <em>not</em>
* as a child of its container.
*/
public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3;
/**
* Window type: window for showing overlays on top of media windows.
* These windows are displayed between TYPE_APPLICATION_MEDIA and the
* application window. They should be translucent to be useful. This
* is a big ugly hack so:
* @hide
*/
public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4;
/**
* End of types of sub-windows.
*/
public static final int LAST_SUB_WINDOW = 1999;
/**
* Start of system-specific window types. These are not normally
* created by applications.
*/
public static final int FIRST_SYSTEM_WINDOW = 2000;
/**
* Window type: the status bar. There can be only one status bar
* window; it is placed at the top of the screen, and all other
* windows are shifted down so they are below it.
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
/**
* Window type: the search bar. There can be only one search bar
* window; it is placed at the top of the screen.
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
/**
* Window type: phone. These are non-application windows providing
* user interaction with the phone (in particular incoming calls).
* These windows are normally placed above all applications, but behind
* the status bar.
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
/**
* Window type: system window, such as low power alert. These windows
* are always on top of application windows.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
/**
* Window type: keyguard window.
* In multiuser systems shows on all users' windows.
* @removed
*/
public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
/**
* Window type: transient notifications.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
/**
* Window type: system overlay windows, which need to be displayed
* on top of everything else. These windows must not take input
* focus, or they will interfere with the keyguard.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
/**
* Window type: priority phone UI, which needs to be displayed even if
* the keyguard is active. These windows must not take input
* focus, or they will interfere with the keyguard.
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
/**
* Window type: panel that slides out from the status bar
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
/**
* Window type: dialogs that the keyguard shows
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
/**
* Window type: internal system error windows, appear on top of
* everything they can.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
/**
* Window type: internal input methods windows, which appear above
* the normal UI. Application windows may be resized or panned to keep
* the input focus visible while this window is displayed.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
/**
* Window type: internal input methods dialog windows, which appear above
* the current input method window.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
/**
* Window type: wallpaper window, placed behind any window that wants
* to sit on top of the wallpaper.
* In multiuser systems shows only on the owning user's window.
*/
public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
/**
* Window type: panel that slides out from over the status bar
* In multiuser systems shows on all users' windows.
*/
public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
/**
* Window type: secure system overlay windows, which need to be displayed
* on top of everything else. These windows must not take input
* focus, or they will interfere with the keyguard.
*
* This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
* system itself is allowed to create these overlays. Applications cannot
* obtain permission to create secure system overlays.
*
* In multiuser systems shows only on the owning user's window.
* @hide
*/
public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
/**
* Window type: the drag-and-drop pseudowindow. There is only one
* drag layer (at most), and it is placed on top of all other windows.
* In multiuser systems shows only on the owning user's window.
* @hide
*/
public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
/**
* Window type: panel that slides out from under the status bar
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
/**
* Window type: (mouse) pointer
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
/**
* Window type: Navigation bar (when distinct from status bar)
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
/**
* Window type: The volume level overlay/dialog shown when the user
* changes the system volume.
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
/**
* Window type: The boot progress dialog, goes on top of everything
* in the world.
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
/**
* Window type: Fake window to consume touch events when the navigation
* bar is hidden.
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
/**
* Window type: Dreams (screen saver) window, just above keyguard.
* In multiuser systems shows only on the owning user's window.
* @hide
*/
public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
/**
* Window type: Navigation bar panel (when navigation bar is distinct from status bar)
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
/**
* Window type: Display overlay window. Used to simulate secondary display devices.
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
/**
* Window type: Magnification overlay window. Used to highlight the magnified
* portion of a display when accessibility magnification is enabled.
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
/**
* Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
* In multiuser systems shows on all users' windows.
* @hide
*/
public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
/**
* Window type: Window for Presentation on top of private
* virtual display.
*/
public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
/**
* Window type: Windows in the voice interaction layer.
* @hide
*/
public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
/**
* Window type: Windows that are overlaid <em>only</em> by an {@link
* android.accessibilityservice.AccessibilityService} for interception of
* user interactions without changing the windows an accessibility service
* can introspect. In particular, an accessibility service can introspect
* only windows that a sighted user can interact with which is they can touch
* these windows or can type into these windows. For example, if there
* is a full screen accessibility overlay that is touchable, the windows
* below it will be introspectable by an accessibility service regardless
* they are covered by a touchable window.
*/
public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
/**
* Window type: Starting window for voice interaction layer.
* @hide
*/
public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
/**
* End of types of system windows.
*/
public static final int LAST_SYSTEM_WINDOW = 2999;
/** @deprecated this is ignored, this value is set automatically when needed. */
@Deprecated
public static final int MEMORY_TYPE_NORMAL = 0;
/** @deprecated this is ignored, this value is set automatically when needed. */
@Deprecated
public static final int MEMORY_TYPE_HARDWARE = 1;
/** @deprecated this is ignored, this value is set automatically when needed. */
@Deprecated
public static final int MEMORY_TYPE_GPU = 2;
/** @deprecated this is ignored, this value is set automatically when needed. */
@Deprecated
public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
/**
* @deprecated this is ignored
*/
@Deprecated
public int memoryType;
/** Window flag: as long as this window is visible to the user, allow
* the lock screen to activate while the screen is on.
* This can be used independently, or in combination with
* {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
/** Window flag: everything behind this window will be dimmed.
* Use {@link #dimAmount} to control the amount of dim. */
public static final int FLAG_DIM_BEHIND = 0x00000002;
/** Window flag: blur everything behind this window.
* @deprecated Blurring is no longer supported. */
@Deprecated
public static final int FLAG_BLUR_BEHIND = 0x00000004;
/** Window flag: this window won't ever get key input focus, so the
* user can not send key or other button events to it. Those will
* instead go to whatever focusable window is behind it. This flag
* will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
* is explicitly set.
*
* <p>Setting this flag also implies that the window will not need to
* interact with
* a soft input method, so it will be Z-ordered and positioned
* independently of any active input method (typically this means it
* gets Z-ordered on top of the input method, so it can use the full
* screen for its content and cover the input method if needed. You
* can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
/** Window flag: this window can never receive touch events. */
public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
/** Window flag: even when this window is focusable (its
* {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
* outside of the window to be sent to the windows behind it. Otherwise
* it will consume all pointer events itself, regardless of whether they
* are inside of the window. */
public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
/** Window flag: when set, if the device is asleep when the touch
* screen is pressed, you will receive this first touch event. Usually
* the first touch event is consumed by the system since the user can
* not see what they are pressing on.
*
* @deprecated This flag has no effect.
*/
@Deprecated
public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
/** Window flag: as long as this window is visible to the user, keep
* the device's screen turned on and bright. */
public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
/** Window flag: place the window within the entire screen, ignoring
* decorations around the border (such as the status bar). The
* window must correctly position its contents to take the screen
* decoration into account. This flag is normally set for you
* by Window as described in {@link Window#setFlags}. */
public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
/** Window flag: allow window to extend outside of the screen. */
public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
/**
* Window flag: hide all screen decorations (such as the status bar) while
* this window is displayed. This allows the window to use the entire
* display space for itself -- the status bar will be hidden when
* an app window with this flag set is on the top layer. A fullscreen window
* will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
* {@link #softInputMode} field; the window will stay fullscreen
* and will not resize.
*
* <p>This flag can be controlled in your theme through the
* {@link android.R.attr#windowFullscreen} attribute; this attribute
* is automatically set for you in the standard fullscreen themes
* such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
* {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
* {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
* {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
* {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
* {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
* {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
*/
public static final int FLAG_FULLSCREEN = 0x00000400;
/** Window flag: override {@link #FLAG_FULLSCREEN} and force the
* screen decorations (such as the status bar) to be shown. */
public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
/** Window flag: turn on dithering when compositing this window to
* the screen.
* @deprecated This flag is no longer used. */
@Deprecated
public static final int FLAG_DITHER = 0x00001000;
/** Window flag: treat the content of the window as secure, preventing
* it from appearing in screenshots or from being viewed on non-secure
* displays.
*
* <p>See {@link android.view.Display#FLAG_SECURE} for more details about
* secure surfaces and secure displays.
*/
public static final int FLAG_SECURE = 0x00002000;
/** Window flag: a special mode where the layout parameters are used
* to perform scaling of the surface when it is composited to the
* screen. */
public static final int FLAG_SCALED = 0x00004000;
/** Window flag: intended for windows that will often be used when the user is
* holding the screen against their face, it will aggressively filter the event
* stream to prevent unintended presses in this situation that may not be
* desired for a particular window, when such an event stream is detected, the
* application will receive a CANCEL motion event to indicate this so applications
* can handle this accordingly by taking no action on the event
* until the finger is released. */
public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
/** Window flag: a special option only for use in combination with
* {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
* screen your window may appear on top of or behind screen decorations
* such as the status bar. By also including this flag, the window
* manager will report the inset rectangle needed to ensure your
* content is not covered by screen decorations. This flag is normally
* set for you by Window as described in {@link Window#setFlags}.*/
public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
/** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
* respect to how this window interacts with the current method. That
* is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
* window will behave as if it needs to interact with the input method
* and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
* not set and this flag is set, then the window will behave as if it
* doesn't need to interact with the input method and can be placed
* to use more space and cover the input method.
*/
public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
/** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
* can set this flag to receive a single special MotionEvent with
* the action
* {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
* touches that occur outside of your window. Note that you will not
* receive the full down/move/up gesture, only the location of the
* first down as an ACTION_OUTSIDE.
*/
public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
/** Window flag: special flag to let windows be shown when the screen
* is locked. This will let application windows take precedence over
* key guard or any other lock screens. Can be used with
* {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
* directly before showing the key guard window. Can be used with
* {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
* non-secure keyguards. This flag only applies to the top-most
* full-screen window.
*/
public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
/** Window flag: ask that the system wallpaper be shown behind
* your window. The window surface must be translucent to be able
* to actually see the wallpaper behind it; this flag just ensures
* that the wallpaper surface will be there if this window actually
* has translucent regions.
*
* <p>This flag can be controlled in your theme through the
* {@link android.R.attr#windowShowWallpaper} attribute; this attribute
* is automatically set for you in the standard wallpaper themes
* such as {@link android.R.style#Theme_Wallpaper},
* {@link android.R.style#Theme_Wallpaper_NoTitleBar},
* {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
* {@link android.R.style#Theme_Holo_Wallpaper},
* {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
* {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
* {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
*/
public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
/** Window flag: when set as a window is being added or made
* visible, once the window has been shown then the system will
* poke the power manager's user activity (as if the user had woken
* up the device) to turn the screen on. */
public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
/** Window flag: when set the window will cause the keyguard to
* be dismissed, only if it is not a secure lock keyguard. Because such
* a keyguard is not needed for security, it will never re-appear if
* the user navigates to another window (in contrast to
* {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
* hide both secure and non-secure keyguards but ensure they reappear
* when the user moves to another UI that doesn't hide them).
* If the keyguard is currently active and is secure (requires an
* unlock pattern) than the user will still need to confirm it before
* seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
* also been set.
*/
public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
/** Window flag: when set the window will accept for touch events
* outside of its bounds to be sent to other windows that also
* support split touch. When this flag is not set, the first pointer
* that goes down determines the window to which all subsequent touches
* go until all pointers go up. When this flag is set, each pointer
* (not necessarily the first) that goes down determines the window
* to which all subsequent touches of that pointer will go until that
* pointer goes up thereby enabling touches with multiple pointers
* to be split across multiple windows.
*/
public static final int FLAG_SPLIT_TOUCH = 0x00800000;
/**
* <p>Indicates whether this window should be hardware accelerated.
* Requesting hardware acceleration does not guarantee it will happen.</p>
*
* <p>This flag can be controlled programmatically <em>only</em> to enable
* hardware acceleration. To enable hardware acceleration for a given
* window programmatically, do the following:</p>
*
* <pre>
* Window w = activity.getWindow(); // in Activity's onCreate() for instance
* w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
* WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
* </pre>
*
* <p>It is important to remember that this flag <strong>must</strong>
* be set before setting the content view of your activity or dialog.</p>
*
* <p>This flag cannot be used to disable hardware acceleration after it
* was enabled in your manifest using
* {@link android.R.attr#hardwareAccelerated}. If you need to selectively
* and programmatically disable hardware acceleration (for automated testing
* for instance), make sure it is turned off in your manifest and enable it
* on your activity or dialog when you need it instead, using the method
* described above.</p>
*
* <p>This flag is automatically set by the system if the
* {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
* XML attribute is set to true on an activity or on the application.</p>
*/
public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
/**
* Window flag: allow window contents to extend in to the screen's
* overscan area, if there is one. The window should still correctly
* position its contents to take the overscan area into account.
*
* <p>This flag can be controlled in your theme through the
* {@link android.R.attr#windowOverscan} attribute; this attribute
* is automatically set for you in the standard overscan themes
* such as
* {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
* {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
* {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
* {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
*
* <p>When this flag is enabled for a window, its normal content may be obscured
* to some degree by the overscan region of the display. To ensure key parts of
* that content are visible to the user, you can use
* {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
* to set the point in the view hierarchy where the appropriate offsets should
* be applied. (This can be done either by directly calling this function, using
* the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
* or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
* View.fitSystemWindows(Rect)} method).</p>
*
* <p>This mechanism for positioning content elements is identical to its equivalent
* use with layout and {@link View#setSystemUiVisibility(int)
* View.setSystemUiVisibility(int)}; here is an example layout that will correctly
* position its UI elements with this overscan flag is set:</p>
*
* {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
*/
public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
/**
* Window flag: request a translucent status bar with minimal system-provided
* background protection.
*
* <p>This flag can be controlled in your theme through the
* {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
* is automatically set for you in the standard translucent decor themes
* such as
* {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
* {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
* {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
* {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
*
* <p>When this flag is enabled for a window, it automatically sets
* the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
* {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
*/
public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
/**
* Window flag: request a translucent navigation bar with minimal system-provided
* background protection.
*
* <p>This flag can be controlled in your theme through the
* {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
* is automatically set for you in the standard translucent decor themes
* such as
* {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
* {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
* {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
* {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
*
* <p>When this flag is enabled for a window, it automatically sets
* the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
* {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
*/
public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
/**
* Flag for a window in local focus mode.
* Window in local focus mode can control focus independent of window manager using
* {@link Window#setLocalFocus(boolean, boolean)}.
* Usually window in this mode will not get touch/key events from window manager, but will
* get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
*/
public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
/** Window flag: Enable touches to slide out of a window into neighboring
* windows in mid-gesture instead of being captured for the duration of
* the gesture.
*
* This flag changes the behavior of touch focus for this window only.
* Touches can slide out of the window but they cannot necessarily slide
* back in (unless the other window with touch focus permits it).
*
* {@hide}
*/
public static final int FLAG_SLIPPERY = 0x20000000;
/**
* Window flag: When requesting layout with an attached window, the attached window may
* overlap with the screen decorations of the parent window such as the navigation bar. By
* including this flag, the window manager will layout the attached window within the decor
* frame of the parent window such that it doesn't overlap with screen decorations.
*/
public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
/**
* Flag indicating that this Window is responsible for drawing the background for the
* system bars. If set, the system bars are drawn with a transparent background and the
* corresponding areas in this window are filled with the colors specified in
* {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
*/
public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
/**
* Various behavioral options/flags. Default is none.
*
* @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
* @see #FLAG_DIM_BEHIND
* @see #FLAG_NOT_FOCUSABLE
* @see #FLAG_NOT_TOUCHABLE
* @see #FLAG_NOT_TOUCH_MODAL
* @see #FLAG_TOUCHABLE_WHEN_WAKING
* @see #FLAG_KEEP_SCREEN_ON
* @see #FLAG_LAYOUT_IN_SCREEN
* @see #FLAG_LAYOUT_NO_LIMITS
* @see #FLAG_FULLSCREEN
* @see #FLAG_FORCE_NOT_FULLSCREEN
* @see #FLAG_SECURE
* @see #FLAG_SCALED
* @see #FLAG_IGNORE_CHEEK_PRESSES
* @see #FLAG_LAYOUT_INSET_DECOR
* @see #FLAG_ALT_FOCUSABLE_IM
* @see #FLAG_WATCH_OUTSIDE_TOUCH
* @see #FLAG_SHOW_WHEN_LOCKED
* @see #FLAG_SHOW_WALLPAPER
* @see #FLAG_TURN_SCREEN_ON
* @see #FLAG_DISMISS_KEYGUARD
* @see #FLAG_SPLIT_TOUCH
* @see #FLAG_HARDWARE_ACCELERATED
* @see #FLAG_LOCAL_FOCUS_MODE
* @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
*/
@ViewDebug.ExportedProperty(flagMapping = {
@ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
@ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
name = "FLAG_DIM_BEHIND"),
@ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
name = "FLAG_BLUR_BEHIND"),
@ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
name = "FLAG_NOT_FOCUSABLE"),
@ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
name = "FLAG_NOT_TOUCHABLE"),
@ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
name = "FLAG_NOT_TOUCH_MODAL"),
@ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
name = "FLAG_TOUCHABLE_WHEN_WAKING"),
@ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
name = "FLAG_KEEP_SCREEN_ON"),
@ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
name = "FLAG_LAYOUT_IN_SCREEN"),
@ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
name = "FLAG_LAYOUT_NO_LIMITS"),
@ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
name = "FLAG_FULLSCREEN"),
@ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
name = "FLAG_FORCE_NOT_FULLSCREEN"),
@ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
name = "FLAG_DITHER"),
@ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
name = "FLAG_SECURE"),
@ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
name = "FLAG_SCALED"),
@ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
name = "FLAG_IGNORE_CHEEK_PRESSES"),
@ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
name = "FLAG_LAYOUT_INSET_DECOR"),
@ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
name = "FLAG_ALT_FOCUSABLE_IM"),
@ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
name = "FLAG_WATCH_OUTSIDE_TOUCH"),
@ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
name = "FLAG_SHOW_WHEN_LOCKED"),
@ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
name = "FLAG_SHOW_WALLPAPER"),
@ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
name = "FLAG_TURN_SCREEN_ON"),
@ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
name = "FLAG_DISMISS_KEYGUARD"),
@ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
name = "FLAG_SPLIT_TOUCH"),
@ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
name = "FLAG_HARDWARE_ACCELERATED"),
@ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
name = "FLAG_LOCAL_FOCUS_MODE"),
@ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
name = "FLAG_TRANSLUCENT_STATUS"),
@ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
name = "FLAG_TRANSLUCENT_NAVIGATION"),
@ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
}, formatToHexString = true)
public int flags;
/**
* If the window has requested hardware acceleration, but this is not
* allowed in the process it is in, then still render it as if it is
* hardware accelerated. This is used for the starting preview windows
* in the system process, which don't need to have the overhead of
* hardware acceleration (they are just a static rendering), but should
* be rendered as such to match the actual window of the app even if it
* is hardware accelerated.
* Even if the window isn't hardware accelerated, still do its rendering
* as if it was.
* Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
* that need hardware acceleration (e.g. LockScreen), where hardware acceleration
* is generally disabled. This flag must be specified in addition to
* {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
* windows.
*
* @hide
*/
public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
/**
* In the system process, we globally do not use hardware acceleration
* because there are many threads doing UI there and they conflict.
* If certain parts of the UI that really do want to use hardware
* acceleration, this flag can be set to force it. This is basically
* for the lock screen. Anyone else using it, you are probably wrong.
*
* @hide
*/
public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
/**
* By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
* may elect to skip these notifications if they are not doing anything productive with
* them (they do not affect the wallpaper scrolling operation) by calling
* {@link
* android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
*
* @hide
*/
public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
/** In a multiuser system if this flag is set and the owner is a system process then this
* window will appear on all user screens. This overrides the default behavior of window
* types that normally only appear on the owning user's screen. Refer to each window type
* to determine its default behavior.
*
* {@hide} */
public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
/**
* Never animate position changes of the window.
*
* {@hide} */
public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
/** Window flag: special flag to limit the size of the window to be
* original size ([320x480] x density). Used to create window for applications
* running under compatibility mode.
*
* {@hide} */
public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
/** Window flag: a special option intended for system dialogs. When
* this flag is set, the window will demand focus unconditionally when
* it is created.
* {@hide} */
public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
/** Window flag: maintain the previous translucent decor state when this window
* becomes top-most.
* {@hide} */
public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
/**
* Flag whether the current window is a keyguard window, meaning that it will hide all other
* windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
* Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
* {@hide}
*/
public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
/**
* Flag that prevents the wallpaper behind the current window from receiving touch events.
*
* {@hide}
*/
public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
/**
* Control flags that are private to the platform.
* @hide
*/
public int privateFlags;
/**
* Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
* needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
* key. For this case, we should look at windows behind it to determine the appropriate
* value.
*
* @hide
*/
public static final int NEEDS_MENU_UNSET = 0;
/**
* Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
* menu key.
*
* @hide
*/
public static final int NEEDS_MENU_SET_TRUE = 1;
/**
* Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
* needs a menu key.
*
* @hide
*/
public static final int NEEDS_MENU_SET_FALSE = 2;
/**
* State variable for a window belonging to an activity that responds to
* {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
* physical button this variable is ignored, but on devices where the Menu key is drawn in
* software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
*
* (Note that Action Bars, when available, are the preferred way to offer additional
* functions otherwise accessed via an options menu.)
*
* {@hide}
*/
public int needsMenuKey = NEEDS_MENU_UNSET;
/**
* Given a particular set of window manager flags, determine whether
* such a window may be a target for an input method when it has
* focus. In particular, this checks the
* {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
* flags and returns true if the combination of the two corresponds
* to a window that needs to be behind the input method so that the
* user can type into it.
*
* @param flags The current window manager flags.
*
* @return Returns true if such a window should be behind/interact
* with an input method, false if not.
*/
public static boolean mayUseInputMethod(int flags) {
switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
case 0:
case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
return true;
}
return false;
}
/**
* Mask for {@link #softInputMode} of the bits that determine the
* desired visibility state of the soft input area for this window.
*/
public static final int SOFT_INPUT_MASK_STATE = 0x0f;
/**
* Visibility state for {@link #softInputMode}: no state has been specified.
*/
public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
/**
* Visibility state for {@link #softInputMode}: please don't change the state of
* the soft input area.
*/
public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
/**
* Visibility state for {@link #softInputMode}: please hide any soft input
* area when normally appropriate (when the user is navigating
* forward to your window).
*/
public static final int SOFT_INPUT_STATE_HIDDEN = 2;
/**
* Visibility state for {@link #softInputMode}: please always hide any
* soft input area when this window receives focus.
*/
public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
/**
* Visibility state for {@link #softInputMode}: please show the soft
* input area when normally appropriate (when the user is navigating
* forward to your window).
*/
public static final int SOFT_INPUT_STATE_VISIBLE = 4;
/**
* Visibility state for {@link #softInputMode}: please always make the
* soft input area visible when this window receives input focus.
*/
public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
/**
* Mask for {@link #softInputMode} of the bits that determine the
* way that the window should be adjusted to accommodate the soft
* input window.
*/
public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
/** Adjustment option for {@link #softInputMode}: nothing specified.
* The system will try to pick one or
* the other depending on the contents of the window.
*/
public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
/** Adjustment option for {@link #softInputMode}: set to allow the
* window to be resized when an input
* method is shown, so that its contents are not covered by the input
* method. This can <em>not</em> be combined with
* {@link #SOFT_INPUT_ADJUST_PAN}; if
* neither of these are set, then the system will try to pick one or
* the other depending on the contents of the window. If the window's
* layout parameter flags include {@link #FLAG_FULLSCREEN}, this
* value for {@link #softInputMode} will be ignored; the window will
* not resize, but will stay fullscreen.
*/
public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
/** Adjustment option for {@link #softInputMode}: set to have a window
* pan when an input method is
* shown, so it doesn't need to deal with resizing but just panned
* by the framework to ensure the current input focus is visible. This
* can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
* neither of these are set, then the system will try to pick one or
* the other depending on the contents of the window.
*/
public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
/** Adjustment option for {@link #softInputMode}: set to have a window
* not adjust for a shown input method. The window will not be resized,
* and it will not be panned to make its focus visible.
*/
public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
/**
* Bit for {@link #softInputMode}: set when the user has navigated
* forward to the window. This is normally set automatically for
* you by the system, though you may want to set it in certain cases
* when you are displaying a window yourself. This flag will always
* be cleared automatically after the window is displayed.
*/
public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
/**
* Desired operating mode for any soft input area. May be any combination
* of:
*
* <ul>
* <li> One of the visibility states
* {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
* {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
* {@link #SOFT_INPUT_STATE_VISIBLE}.
* <li> One of the adjustment options
* {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
* {@link #SOFT_INPUT_ADJUST_RESIZE}, or
* {@link #SOFT_INPUT_ADJUST_PAN}.
* </ul>
*
*
* <p>This flag can be controlled in your theme through the
* {@link android.R.attr#windowSoftInputMode} attribute.</p>
*/
public int softInputMode;
/**
* Placement of window within the screen as per {@link Gravity}. Both
* {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
* android.graphics.Rect) Gravity.apply} and
* {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
* Gravity.applyDisplay} are used during window layout, with this value
* given as the desired gravity. For example you can specify
* {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
* {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
* to control the behavior of
* {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
* Gravity.applyDisplay}.
*
* @see Gravity
*/
public int gravity;
/**
* The horizontal margin, as a percentage of the container's width,
* between the container and the widget. See
* {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
* android.graphics.Rect) Gravity.apply} for how this is used. This
* field is added with {@link #x} to supply the <var>xAdj</var> parameter.
*/
public float horizontalMargin;
/**
* The vertical margin, as a percentage of the container's height,
* between the container and the widget. See
* {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
* android.graphics.Rect) Gravity.apply} for how this is used. This
* field is added with {@link #y} to supply the <var>yAdj</var> parameter.
*/
public float verticalMargin;
/**
* Positive insets between the drawing surface and window content.
*
* @hide
*/
public final Rect surfaceInsets = new Rect();
/**
* Whether the surface insets have been manually set. When set to
* {@code false}, the view root will automatically determine the
* appropriate surface insets.
*
* @see #surfaceInsets
* @hide
*/
public boolean hasManualSurfaceInsets;
/**
* The desired bitmap format. May be one of the constants in
* {@link android.graphics.PixelFormat}. Default is OPAQUE.
*/
public int format;
/**
* A style resource defining the animations to use for this window.
* This must be a system resource; it can not be an application resource
* because the window manager does not have access to applications.
*/
public int windowAnimations;
/**
* An alpha value to apply to this entire window.
* An alpha of 1.0 means fully opaque and 0.0 means fully transparent
*/
public float alpha = 1.0f;
/**
* When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
* to apply. Range is from 1.0 for completely opaque to 0.0 for no
* dim.
*/
public float dimAmount = 1.0f;
/**
* Default value for {@link #screenBrightness} and {@link #buttonBrightness}
* indicating that the brightness value is not overridden for this window
* and normal brightness policy should be used.
*/
public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
/**
* Value for {@link #screenBrightness} and {@link #buttonBrightness}
* indicating that the screen or button backlight brightness should be set
* to the lowest value when this window is in front.
*/
public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
/**
* Value for {@link #screenBrightness} and {@link #buttonBrightness}
* indicating that the screen or button backlight brightness should be set
* to the hightest value when this window is in front.
*/
public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
/**
* This can be used to override the user's preferred brightness of
* the screen. A value of less than 0, the default, means to use the
* preferred screen brightness. 0 to 1 adjusts the brightness from
* dark to full bright.
*/
public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
/**
* This can be used to override the standard behavior of the button and
* keyboard backlights. A value of less than 0, the default, means to
* use the standard backlight behavior. 0 to 1 adjusts the brightness
* from dark to full bright.
*/
public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
/**
* Value for {@link #rotationAnimation} to define the animation used to
* specify that this window will rotate in or out following a rotation.
*/
public static final int ROTATION_ANIMATION_ROTATE = 0;
/**
* Value for {@link #rotationAnimation} to define the animation used to
* specify that this window will fade in or out following a rotation.
*/
public static final int ROTATION_ANIMATION_CROSSFADE = 1;
/**
* Value for {@link #rotationAnimation} to define the animation used to
* specify that this window will immediately disappear or appear following
* a rotation.
*/
public static final int ROTATION_ANIMATION_JUMPCUT = 2;
/**
* Define the exit and entry animations used on this window when the device is rotated.
* This only has an affect if the incoming and outgoing topmost
* opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
* by other windows. All other situations default to the
* {@link #ROTATION_ANIMATION_ROTATE} behavior.
*
* @see #ROTATION_ANIMATION_ROTATE
* @see #ROTATION_ANIMATION_CROSSFADE
* @see #ROTATION_ANIMATION_JUMPCUT
*/
public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
/**
* Identifier for this window. This will usually be filled in for
* you.
*/
public IBinder token = null;
/**
* Name of the package owning this window.
*/
public String packageName = null;
/**
* Specific orientation value for a window.
* May be any of the same values allowed
* for {@link android.content.pm.ActivityInfo#screenOrientation}.
* If not set, a default value of
* {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
* will be used.
*/
public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
/**
* The preferred refresh rate for the window.
*
* This must be one of the supported refresh rates obtained for the display(s) the window
* is on.
*
* @see Display#getSupportedRefreshRates()
*/
public float preferredRefreshRate;
/**
* Control the visibility of the status bar.
*
* @see View#STATUS_BAR_VISIBLE
* @see View#STATUS_BAR_HIDDEN
*/
public int systemUiVisibility;
/**
* @hide
* The ui visibility as requested by the views in this hierarchy.
* the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
*/
public int subtreeSystemUiVisibility;
/**
* Get callbacks about the system ui visibility changing.
*
* TODO: Maybe there should be a bitfield of optional callbacks that we need.
*
* @hide
*/
public boolean hasSystemUiListeners;
/**
* When this window has focus, disable touch pad pointer gesture processing.
* The window will receive raw position updates from the touch pad instead
* of pointer movements and synthetic touch events.
*
* @hide
*/
public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
/**
* Does not construct an input channel for this window. The channel will therefore
* be incapable of receiving input.
*
* @hide
*/
public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
/**
* When this window has focus, does not call user activity for all input events so
* the application will have to do it itself. Should only be used by
* the keyguard and phone app.
* <p>
* Should only be used by the keyguard and phone app.
* </p>
*
* @hide
*/
public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
/**
* Control special features of the input subsystem.
*
* @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
* @see #INPUT_FEATURE_NO_INPUT_CHANNEL
* @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
* @hide
*/
public int inputFeatures;
/**
* Sets the number of milliseconds before the user activity timeout occurs
* when this window has focus. A value of -1 uses the standard timeout.
* A value of 0 uses the minimum support display timeout.
* <p>
* This property can only be used to reduce the user specified display timeout;
* it can never make the timeout longer than it normally would be.
* </p><p>
* Should only be used by the keyguard and phone app.
* </p>
*
* @hide
*/
public long userActivityTimeout = -1;
public LayoutParams() {
super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
type = TYPE_APPLICATION;
format = PixelFormat.OPAQUE;
}
public LayoutParams(int _type) {
super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
type = _type;
format = PixelFormat.OPAQUE;
}
public LayoutParams(int _type, int _flags) {
super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
type = _type;
flags = _flags;
format = PixelFormat.OPAQUE;
}
public LayoutParams(int _type, int _flags, int _format) {
super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
type = _type;
flags = _flags;
format = _format;
}
public LayoutParams(int w, int h, int _type, int _flags, int _format) {
super(w, h);
type = _type;
flags = _flags;
format = _format;
}
public LayoutParams(int w, int h, int xpos, int ypos, int _type,
int _flags, int _format) {
super(w, h);
x = xpos;
y = ypos;
type = _type;
flags = _flags;
format = _format;
}
public final void setTitle(CharSequence title) {
if (null == title)
title = "";
mTitle = TextUtils.stringOrSpannedString(title);
}
public final CharSequence getTitle() {
return mTitle;
}
/** @hide */
@SystemApi
public final void setUserActivityTimeout(long timeout) {
userActivityTimeout = timeout;
}
/** @hide */
@SystemApi
public final long getUserActivityTimeout() {
return userActivityTimeout;
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel out, int parcelableFlags) {
out.writeInt(width);
out.writeInt(height);
out.writeInt(x);
out.writeInt(y);
out.writeInt(type);
out.writeInt(flags);
out.writeInt(privateFlags);
out.writeInt(softInputMode);
out.writeInt(gravity);
out.writeFloat(horizontalMargin);
out.writeFloat(verticalMargin);
out.writeInt(format);
out.writeInt(windowAnimations);
out.writeFloat(alpha);
out.writeFloat(dimAmount);
out.writeFloat(screenBrightness);
out.writeFloat(buttonBrightness);
out.writeInt(rotationAnimation);
out.writeStrongBinder(token);
out.writeString(packageName);
TextUtils.writeToParcel(mTitle, out, parcelableFlags);
out.writeInt(screenOrientation);
out.writeFloat(preferredRefreshRate);
out.writeInt(systemUiVisibility);
out.writeInt(subtreeSystemUiVisibility);
out.writeInt(hasSystemUiListeners ? 1 : 0);
out.writeInt(inputFeatures);
out.writeLong(userActivityTimeout);
out.writeInt(surfaceInsets.left);
out.writeInt(surfaceInsets.top);
out.writeInt(surfaceInsets.right);
out.writeInt(surfaceInsets.bottom);
out.writeInt(hasManualSurfaceInsets ? 1 : 0);
out.writeInt(needsMenuKey);
}
public static final Parcelable.Creator<LayoutParams> CREATOR
= new Parcelable.Creator<LayoutParams>() {
public LayoutParams createFromParcel(Parcel in) {
return new LayoutParams(in);
}
public LayoutParams[] newArray(int size) {
return new LayoutParams[size];
}
};
public LayoutParams(Parcel in) {
width = in.readInt();
height = in.readInt();
x = in.readInt();
y = in.readInt();
type = in.readInt();
flags = in.readInt();
privateFlags = in.readInt();
softInputMode = in.readInt();
gravity = in.readInt();
horizontalMargin = in.readFloat();
verticalMargin = in.readFloat();
format = in.readInt();
windowAnimations = in.readInt();
alpha = in.readFloat();
dimAmount = in.readFloat();
screenBrightness = in.readFloat();
buttonBrightness = in.readFloat();
rotationAnimation = in.readInt();
token = in.readStrongBinder();
packageName = in.readString();
mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
screenOrientation = in.readInt();
preferredRefreshRate = in.readFloat();
systemUiVisibility = in.readInt();
subtreeSystemUiVisibility = in.readInt();
hasSystemUiListeners = in.readInt() != 0;
inputFeatures = in.readInt();
userActivityTimeout = in.readLong();
surfaceInsets.left = in.readInt();
surfaceInsets.top = in.readInt();
surfaceInsets.right = in.readInt();
surfaceInsets.bottom = in.readInt();
hasManualSurfaceInsets = in.readInt() != 0;
needsMenuKey = in.readInt();
}
@SuppressWarnings({"PointlessBitwiseExpression"})
public static final int LAYOUT_CHANGED = 1<<0;
public static final int TYPE_CHANGED = 1<<1;
public static final int FLAGS_CHANGED = 1<<2;
public static final int FORMAT_CHANGED = 1<<3;
public static final int ANIMATION_CHANGED = 1<<4;
public static final int DIM_AMOUNT_CHANGED = 1<<5;
public static final int TITLE_CHANGED = 1<<6;
public static final int ALPHA_CHANGED = 1<<7;
public static final int MEMORY_TYPE_CHANGED = 1<<8;
public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
/** {@hide} */
public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
/** {@hide} */
public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
/** {@hide} */
public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
/** {@hide} */
public static final int INPUT_FEATURES_CHANGED = 1<<16;
/** {@hide} */
public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
/** {@hide} */
public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
/** {@hide} */
public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
/** {@hide} */
public static final int SURFACE_INSETS_CHANGED = 1<<20;
/** {@hide} */
public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
/** {@hide} */
public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
/** {@hide} */
public static final int EVERYTHING_CHANGED = 0xffffffff;
// internal buffer to backup/restore parameters under compatibility mode.
private int[] mCompatibilityParamsBackup = null;
public final int copyFrom(LayoutParams o) {
int changes = 0;
if (width != o.width) {
width = o.width;
changes |= LAYOUT_CHANGED;
}
if (height != o.height) {
height = o.height;
changes |= LAYOUT_CHANGED;
}
if (x != o.x) {
x = o.x;
changes |= LAYOUT_CHANGED;
}
if (y != o.y) {
y = o.y;
changes |= LAYOUT_CHANGED;
}
if (horizontalWeight != o.horizontalWeight) {
horizontalWeight = o.horizontalWeight;
changes |= LAYOUT_CHANGED;
}
if (verticalWeight != o.verticalWeight) {
verticalWeight = o.verticalWeight;
changes |= LAYOUT_CHANGED;
}
if (horizontalMargin != o.horizontalMargin) {
horizontalMargin = o.horizontalMargin;
changes |= LAYOUT_CHANGED;
}
if (verticalMargin != o.verticalMargin) {
verticalMargin = o.verticalMargin;
changes |= LAYOUT_CHANGED;
}
if (type != o.type) {
type = o.type;
changes |= TYPE_CHANGED;
}
if (flags != o.flags) {
final int diff = flags ^ o.flags;
if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
changes |= TRANSLUCENT_FLAGS_CHANGED;
}
flags = o.flags;
changes |= FLAGS_CHANGED;
}
if (privateFlags != o.privateFlags) {
privateFlags = o.privateFlags;
changes |= PRIVATE_FLAGS_CHANGED;
}
if (softInputMode != o.softInputMode) {
softInputMode = o.softInputMode;
changes |= SOFT_INPUT_MODE_CHANGED;
}
if (gravity != o.gravity) {
gravity = o.gravity;
changes |= LAYOUT_CHANGED;
}
if (format != o.format) {
format = o.format;
changes |= FORMAT_CHANGED;
}
if (windowAnimations != o.windowAnimations) {
windowAnimations = o.windowAnimations;
changes |= ANIMATION_CHANGED;
}
if (token == null) {
// NOTE: token only copied if the recipient doesn't
// already have one.
token = o.token;
}
if (packageName == null) {
// NOTE: packageName only copied if the recipient doesn't
// already have one.
packageName = o.packageName;
}
if (!mTitle.equals(o.mTitle)) {
mTitle = o.mTitle;
changes |= TITLE_CHANGED;
}
if (alpha != o.alpha) {
alpha = o.alpha;
changes |= ALPHA_CHANGED;
}
if (dimAmount != o.dimAmount) {
dimAmount = o.dimAmount;
changes |= DIM_AMOUNT_CHANGED;
}
if (screenBrightness != o.screenBrightness) {
screenBrightness = o.screenBrightness;
changes |= SCREEN_BRIGHTNESS_CHANGED;
}
if (buttonBrightness != o.buttonBrightness) {
buttonBrightness = o.buttonBrightness;
changes |= BUTTON_BRIGHTNESS_CHANGED;
}
if (rotationAnimation != o.rotationAnimation) {
rotationAnimation = o.rotationAnimation;
changes |= ROTATION_ANIMATION_CHANGED;
}
if (screenOrientation != o.screenOrientation) {
screenOrientation = o.screenOrientation;
changes |= SCREEN_ORIENTATION_CHANGED;
}
if (preferredRefreshRate != o.preferredRefreshRate) {
preferredRefreshRate = o.preferredRefreshRate;
changes |= PREFERRED_REFRESH_RATE_CHANGED;
}
if (systemUiVisibility != o.systemUiVisibility
|| subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
systemUiVisibility = o.systemUiVisibility;
subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
changes |= SYSTEM_UI_VISIBILITY_CHANGED;
}
if (hasSystemUiListeners != o.hasSystemUiListeners) {
hasSystemUiListeners = o.hasSystemUiListeners;
changes |= SYSTEM_UI_LISTENER_CHANGED;
}
if (inputFeatures != o.inputFeatures) {
inputFeatures = o.inputFeatures;
changes |= INPUT_FEATURES_CHANGED;
}
if (userActivityTimeout != o.userActivityTimeout) {
userActivityTimeout = o.userActivityTimeout;
changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
}
if (!surfaceInsets.equals(o.surfaceInsets)) {
surfaceInsets.set(o.surfaceInsets);
changes |= SURFACE_INSETS_CHANGED;
}
if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
hasManualSurfaceInsets = o.hasManualSurfaceInsets;
changes |= SURFACE_INSETS_CHANGED;
}
if (needsMenuKey != o.needsMenuKey) {
needsMenuKey = o.needsMenuKey;
changes |= NEEDS_MENU_KEY_CHANGED;
}
return changes;
}
@Override
public String debug(String output) {
output += "Contents of " + this + ":";
Log.d("Debug", output);
output = super.debug("");
Log.d("Debug", output);
Log.d("Debug", "");
Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
return "";
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(256);
sb.append("WM.LayoutParams{");
sb.append("(");
sb.append(x);
sb.append(',');
sb.append(y);
sb.append(")(");
sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
sb.append('x');
sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
sb.append(")");
if (horizontalMargin != 0) {
sb.append(" hm=");
sb.append(horizontalMargin);
}
if (verticalMargin != 0) {
sb.append(" vm=");
sb.append(verticalMargin);
}
if (gravity != 0) {
sb.append(" gr=#");
sb.append(Integer.toHexString(gravity));
}
if (softInputMode != 0) {
sb.append(" sim=#");
sb.append(Integer.toHexString(softInputMode));
}
sb.append(" ty=");
sb.append(type);
sb.append(" fl=#");
sb.append(Integer.toHexString(flags));
if (privateFlags != 0) {
if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
sb.append(" compatible=true");
}
sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
}
if (format != PixelFormat.OPAQUE) {
sb.append(" fmt=");
sb.append(format);
}
if (windowAnimations != 0) {
sb.append(" wanim=0x");
sb.append(Integer.toHexString(windowAnimations));
}
if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
sb.append(" or=");
sb.append(screenOrientation);
}
if (alpha != 1.0f) {
sb.append(" alpha=");
sb.append(alpha);
}
if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
sb.append(" sbrt=");
sb.append(screenBrightness);
}
if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
sb.append(" bbrt=");
sb.append(buttonBrightness);
}
if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
sb.append(" rotAnim=");
sb.append(rotationAnimation);
}
if (preferredRefreshRate != 0) {
sb.append(" preferredRefreshRate=");
sb.append(preferredRefreshRate);
}
if (systemUiVisibility != 0) {
sb.append(" sysui=0x");
sb.append(Integer.toHexString(systemUiVisibility));
}
if (subtreeSystemUiVisibility != 0) {
sb.append(" vsysui=0x");
sb.append(Integer.toHexString(subtreeSystemUiVisibility));
}
if (hasSystemUiListeners) {
sb.append(" sysuil=");
sb.append(hasSystemUiListeners);
}
if (inputFeatures != 0) {
sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
}
if (userActivityTimeout >= 0) {
sb.append(" userActivityTimeout=").append(userActivityTimeout);
}
if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
surfaceInsets.bottom != 0 || hasManualSurfaceInsets) {
sb.append(" surfaceInsets=").append(surfaceInsets);
if (hasManualSurfaceInsets) {
sb.append(" (manual)");
}
}
if (needsMenuKey != NEEDS_MENU_UNSET) {
sb.append(" needsMenuKey=");
sb.append(needsMenuKey);
}
sb.append('}');
return sb.toString();
}
/**
* Scale the layout params' coordinates and size.
* @hide
*/
public void scale(float scale) {
x = (int) (x * scale + 0.5f);
y = (int) (y * scale + 0.5f);
if (width > 0) {
width = (int) (width * scale + 0.5f);
}
if (height > 0) {
height = (int) (height * scale + 0.5f);
}
}
/**
* Backup the layout parameters used in compatibility mode.
* @see LayoutParams#restore()
*/
void backup() {
int[] backup = mCompatibilityParamsBackup;
if (backup == null) {
// we backup 4 elements, x, y, width, height
backup = mCompatibilityParamsBackup = new int[4];
}
backup[0] = x;
backup[1] = y;
backup[2] = width;
backup[3] = height;
}
/**
* Restore the layout params' coordinates, size and gravity
* @see LayoutParams#backup()
*/
void restore() {
int[] backup = mCompatibilityParamsBackup;
if (backup != null) {
x = backup[0];
y = backup[1];
width = backup[2];
height = backup[3];
}
}
private CharSequence mTitle = "";
}
}
|