| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.content.pm; |
| 18 |
|
| 19 |
import android.annotation.FloatRange; |
| 20 |
import android.annotation.IntDef; |
| 21 |
import android.annotation.NonNull; |
| 22 |
import android.annotation.Nullable; |
| 23 |
import android.annotation.TestApi; |
| 24 |
import android.app.Activity; |
| 25 |
import android.app.compat.CompatChanges; |
| 26 |
import android.compat.annotation.ChangeId; |
| 27 |
import android.compat.annotation.Disabled; |
| 28 |
import android.compat.annotation.EnabledSince; |
| 29 |
import android.compat.annotation.Overridable; |
| 30 |
import android.compat.annotation.UnsupportedAppUsage; |
| 31 |
import android.content.ComponentName; |
| 32 |
import android.content.Intent; |
| 33 |
import android.content.res.Configuration; |
| 34 |
import android.content.res.Configuration.NativeConfig; |
| 35 |
import android.content.res.TypedArray; |
| 36 |
import android.os.Build; |
| 37 |
import android.os.Parcel; |
| 38 |
import android.os.Parcelable; |
| 39 |
import android.os.UserHandle; |
| 40 |
import android.util.ArraySet; |
| 41 |
import android.util.Printer; |
| 42 |
|
| 43 |
import com.android.internal.util.Parcelling; |
| 44 |
|
| 45 |
import java.lang.annotation.Retention; |
| 46 |
import java.lang.annotation.RetentionPolicy; |
| 47 |
import java.util.Collections; |
| 48 |
import java.util.Locale; |
| 49 |
import java.util.Set; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public class ActivityInfo extends ComponentInfo implements Parcelable { |
| 58 |
|
| 59 |
private static final Parcelling.BuiltIn.ForStringSet sForStringSet = |
| 60 |
Parcelling.Cache.getOrCreate(Parcelling.BuiltIn.ForStringSet.class); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
public int theme; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public static final int LAUNCH_MULTIPLE = 0; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
public static final int LAUNCH_SINGLE_TOP = 1; |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
public static final int LAUNCH_SINGLE_TASK = 2; |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
public static final int LAUNCH_SINGLE_INSTANCE = 3; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
public static final int LAUNCH_SINGLE_INSTANCE_PER_TASK = 4; |
| 96 |
|
| 97 |
|
| 98 |
@IntDef(prefix = "LAUNCH_", value = { |
| 99 |
LAUNCH_MULTIPLE, |
| 100 |
LAUNCH_SINGLE_TOP, |
| 101 |
LAUNCH_SINGLE_TASK, |
| 102 |
LAUNCH_SINGLE_INSTANCE, |
| 103 |
LAUNCH_SINGLE_INSTANCE_PER_TASK |
| 104 |
}) |
| 105 |
@Retention(RetentionPolicy.SOURCE) |
| 106 |
public @interface LaunchMode { |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
public static String launchModeToString(@LaunchMode int launchMode) { |
| 111 |
switch(launchMode) { |
| 112 |
case LAUNCH_MULTIPLE: |
| 113 |
return "LAUNCH_MULTIPLE"; |
| 114 |
case LAUNCH_SINGLE_TOP: |
| 115 |
return "LAUNCH_SINGLE_TOP"; |
| 116 |
case LAUNCH_SINGLE_TASK: |
| 117 |
return "LAUNCH_SINGLE_TASK"; |
| 118 |
case LAUNCH_SINGLE_INSTANCE: |
| 119 |
return "LAUNCH_SINGLE_INSTANCE"; |
| 120 |
case LAUNCH_SINGLE_INSTANCE_PER_TASK: |
| 121 |
return "LAUNCH_SINGLE_INSTANCE_PER_TASK"; |
| 122 |
default: |
| 123 |
return "unknown=" + launchMode; |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
@LaunchMode |
| 132 |
public int launchMode; |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
public static final int DOCUMENT_LAUNCH_NONE = 0; |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
public static final int DOCUMENT_LAUNCH_ALWAYS = 2; |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
public static final int DOCUMENT_LAUNCH_NEVER = 3; |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
public int documentLaunchMode; |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
public static final int PERSIST_ROOT_ONLY = 0; |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
public static final int PERSIST_NEVER = 1; |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
public static final int PERSIST_ACROSS_REBOOTS = 2; |
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
public int persistableMode; |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
public int maxRecents; |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
public String permission; |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
public String taskAffinity; |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
public String targetActivity; |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
public String launchToken; |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
public static final int RESIZE_MODE_UNRESIZEABLE = 0; |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
public static final int RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION = 1; |
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
@TestApi |
| 241 |
public static final int RESIZE_MODE_RESIZEABLE = 2; |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3; |
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
public static final int RESIZE_MODE_FORCE_RESIZEABLE = 4; |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
public static final int RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY = 5; |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
public static final int RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY = 6; |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
public static final int RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION = 7; |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
@UnsupportedAppUsage |
| 281 |
public int resizeMode = RESIZE_MODE_RESIZEABLE; |
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
private float mMaxAspectRatio; |
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
private float mMinAspectRatio; |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
public boolean supportsSizeChanges; |
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
public String requestedVrComponent; |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
public static final int COLOR_MODE_DEFAULT = 0; |
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
public static final int COLOR_MODE_WIDE_COLOR_GAMUT = 1; |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
public static final int COLOR_MODE_HDR = 2; |
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
public static final int COLOR_MODE_A8 = 4; |
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
@IntDef(prefix = { "COLOR_MODE_" }, value = { |
| 349 |
COLOR_MODE_DEFAULT, |
| 350 |
COLOR_MODE_WIDE_COLOR_GAMUT, |
| 351 |
COLOR_MODE_HDR, |
| 352 |
COLOR_MODE_A8, |
| 353 |
}) |
| 354 |
@Retention(RetentionPolicy.SOURCE) |
| 355 |
public @interface ColorMode {} |
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
@ColorMode |
| 362 |
public int colorMode = COLOR_MODE_DEFAULT; |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
public static final int FLAG_MULTIPROCESS = 0x0001; |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002; |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004; |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008; |
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
public static final int FLAG_STATE_NOT_NEEDED = 0x0010; |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020; |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040; |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
public static final int FLAG_NO_HISTORY = 0x0080; |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100; |
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
public static final int FLAG_HARDWARE_ACCELERATED = 0x0200; |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 442 |
public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400; |
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
public static final int FLAG_IMMERSIVE = 0x0800; |
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000; |
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000; |
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
public static final int FLAG_RESUME_WHILE_PAUSING = 0x4000; |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
public static final int FLAG_ENABLE_VR_MODE = 0x8000; |
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
public static final int FLAG_CAN_DISPLAY_ON_REMOTE_DEVICES = 0x10000; |
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000; |
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
public static final int FLAG_VISIBLE_TO_INSTANT_APP = 0x100000; |
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
public static final int FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP = 0x200000; |
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x400000; |
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
public static final int FLAG_SHOW_WHEN_LOCKED = 0x800000; |
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
public static final int FLAG_TURN_SCREEN_ON = 0x1000000; |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
public static final int FLAG_PREFER_MINIMAL_POST_PROCESSING = 0x2000000; |
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
public static final int FLAG_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING = 0x10000000; |
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
public static final int FLAG_SYSTEM_USER_ONLY = 0x20000000; |
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
public static final int FLAG_SINGLE_USER = 0x40000000; |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 587 |
@Deprecated |
| 588 |
public static final int FLAG_ALLOW_EMBEDDED = 0x80000000; |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
public int flags; |
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 0x1; |
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
public static final int PRIVATE_FLAG_HOME_TRANSITION_SOUND = 0x2; |
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
public int privateFlags; |
| 629 |
|
| 630 |
|
| 631 |
@IntDef(prefix = { "SCREEN_ORIENTATION_" }, value = { |
| 632 |
SCREEN_ORIENTATION_UNSET, |
| 633 |
SCREEN_ORIENTATION_UNSPECIFIED, |
| 634 |
SCREEN_ORIENTATION_LANDSCAPE, |
| 635 |
SCREEN_ORIENTATION_PORTRAIT, |
| 636 |
SCREEN_ORIENTATION_USER, |
| 637 |
SCREEN_ORIENTATION_BEHIND, |
| 638 |
SCREEN_ORIENTATION_SENSOR, |
| 639 |
SCREEN_ORIENTATION_NOSENSOR, |
| 640 |
SCREEN_ORIENTATION_SENSOR_LANDSCAPE, |
| 641 |
SCREEN_ORIENTATION_SENSOR_PORTRAIT, |
| 642 |
SCREEN_ORIENTATION_REVERSE_LANDSCAPE, |
| 643 |
SCREEN_ORIENTATION_REVERSE_PORTRAIT, |
| 644 |
SCREEN_ORIENTATION_FULL_SENSOR, |
| 645 |
SCREEN_ORIENTATION_USER_LANDSCAPE, |
| 646 |
SCREEN_ORIENTATION_USER_PORTRAIT, |
| 647 |
SCREEN_ORIENTATION_FULL_USER, |
| 648 |
SCREEN_ORIENTATION_LOCKED |
| 649 |
}) |
| 650 |
@Retention(RetentionPolicy.SOURCE) |
| 651 |
public @interface ScreenOrientation {} |
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
public static final int SCREEN_ORIENTATION_UNSET = -2; |
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1; |
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
public static final int SCREEN_ORIENTATION_LANDSCAPE = 0; |
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
public static final int SCREEN_ORIENTATION_PORTRAIT = 1; |
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
public static final int SCREEN_ORIENTATION_USER = 2; |
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
public static final int SCREEN_ORIENTATION_BEHIND = 3; |
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
public static final int SCREEN_ORIENTATION_SENSOR = 4; |
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
public static final int SCREEN_ORIENTATION_NOSENSOR = 5; |
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6; |
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7; |
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8; |
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9; |
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; |
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11; |
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12; |
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
public static final int SCREEN_ORIENTATION_FULL_USER = 13; |
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
public static final int SCREEN_ORIENTATION_LOCKED = 14; |
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
@ScreenOrientation |
| 774 |
public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED; |
| 775 |
|
| 776 |
|
| 777 |
@IntDef(flag = true, prefix = { "CONFIG_" }, value = { |
| 778 |
CONFIG_MCC, |
| 779 |
CONFIG_MNC, |
| 780 |
CONFIG_LOCALE, |
| 781 |
CONFIG_TOUCHSCREEN, |
| 782 |
CONFIG_KEYBOARD, |
| 783 |
CONFIG_KEYBOARD_HIDDEN, |
| 784 |
CONFIG_NAVIGATION, |
| 785 |
CONFIG_ORIENTATION, |
| 786 |
CONFIG_SCREEN_LAYOUT, |
| 787 |
CONFIG_UI_MODE, |
| 788 |
CONFIG_SCREEN_SIZE, |
| 789 |
CONFIG_SMALLEST_SCREEN_SIZE, |
| 790 |
CONFIG_DENSITY, |
| 791 |
CONFIG_LAYOUT_DIRECTION, |
| 792 |
CONFIG_COLOR_MODE, |
| 793 |
CONFIG_FONT_SCALE, |
| 794 |
}) |
| 795 |
@Retention(RetentionPolicy.SOURCE) |
| 796 |
public @interface Config {} |
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
public static final int CONFIG_MCC = 0x0001; |
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
public static final int CONFIG_MNC = 0x0002; |
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
public static final int CONFIG_LOCALE = 0x0004; |
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
public static final int CONFIG_TOUCHSCREEN = 0x0008; |
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
public static final int CONFIG_KEYBOARD = 0x0010; |
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020; |
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
public static final int CONFIG_NAVIGATION = 0x0040; |
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
|
| 847 |
public static final int CONFIG_ORIENTATION = 0x0080; |
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
public static final int CONFIG_SCREEN_LAYOUT = 0x0100; |
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
public static final int CONFIG_UI_MODE = 0x0200; |
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
public static final int CONFIG_SCREEN_SIZE = 0x0400; |
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800; |
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
public static final int CONFIG_DENSITY = 0x1000; |
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
public static final int CONFIG_LAYOUT_DIRECTION = 0x2000; |
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
public static final int CONFIG_COLOR_MODE = 0x4000; |
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
public static final int CONFIG_ASSETS_PATHS = 0x80000000; |
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
public static final int CONFIG_FONT_SCALE = 0x40000000; |
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
public static final int CONFIG_WINDOW_CONFIGURATION = 0x20000000; |
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
|
| 934 |
public static final int CONFIG_FONT_WEIGHT_ADJUSTMENT = 0x10000000; |
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
|
| 941 |
public static int[] CONFIG_NATIVE_BITS = new int[] { |
| 942 |
Configuration.NATIVE_CONFIG_MNC, |
| 943 |
Configuration.NATIVE_CONFIG_MCC, |
| 944 |
Configuration.NATIVE_CONFIG_LOCALE, |
| 945 |
Configuration.NATIVE_CONFIG_TOUCHSCREEN, |
| 946 |
Configuration.NATIVE_CONFIG_KEYBOARD, |
| 947 |
Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN, |
| 948 |
Configuration.NATIVE_CONFIG_NAVIGATION, |
| 949 |
Configuration.NATIVE_CONFIG_ORIENTATION, |
| 950 |
Configuration.NATIVE_CONFIG_SCREEN_LAYOUT, |
| 951 |
Configuration.NATIVE_CONFIG_UI_MODE, |
| 952 |
Configuration.NATIVE_CONFIG_SCREEN_SIZE, |
| 953 |
Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE, |
| 954 |
Configuration.NATIVE_CONFIG_DENSITY, |
| 955 |
Configuration.NATIVE_CONFIG_LAYOUTDIR, |
| 956 |
Configuration.NATIVE_CONFIG_COLOR_MODE, |
| 957 |
}; |
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
@ChangeId |
| 966 |
@Overridable |
| 967 |
@Disabled |
| 968 |
@TestApi |
| 969 |
public static final long FORCE_RESIZE_APP = 174042936L; |
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
@ChangeId |
| 976 |
@Overridable |
| 977 |
@Disabled |
| 978 |
@TestApi |
| 979 |
public static final long FORCE_NON_RESIZE_APP = 181136395L; |
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
public static final int SIZE_CHANGES_UNSUPPORTED_METADATA = 0; |
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
public static final int SIZE_CHANGES_UNSUPPORTED_OVERRIDE = 1; |
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
public static final int SIZE_CHANGES_SUPPORTED_METADATA = 2; |
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
public static final int SIZE_CHANGES_SUPPORTED_OVERRIDE = 3; |
| 1013 |
|
| 1014 |
|
| 1015 |
@IntDef(prefix = { "SIZE_CHANGES_" }, value = { |
| 1016 |
SIZE_CHANGES_UNSUPPORTED_METADATA, |
| 1017 |
SIZE_CHANGES_UNSUPPORTED_OVERRIDE, |
| 1018 |
SIZE_CHANGES_SUPPORTED_METADATA, |
| 1019 |
SIZE_CHANGES_SUPPORTED_OVERRIDE, |
| 1020 |
}) |
| 1021 |
@Retention(RetentionPolicy.SOURCE) |
| 1022 |
public @interface SizeChangesSupportMode {} |
| 1023 |
|
| 1024 |
|
| 1025 |
|
| 1026 |
|
| 1027 |
|
| 1028 |
|
| 1029 |
|
| 1030 |
|
| 1031 |
@ChangeId |
| 1032 |
@Overridable |
| 1033 |
@Disabled |
| 1034 |
public static final long OVERRIDE_ENABLE_COMPAT_IGNORE_REQUESTED_ORIENTATION = |
| 1035 |
254631730L; |
| 1036 |
|
| 1037 |
|
| 1038 |
|
| 1039 |
|
| 1040 |
|
| 1041 |
|
| 1042 |
|
| 1043 |
@ChangeId |
| 1044 |
@Overridable |
| 1045 |
@Disabled |
| 1046 |
@TestApi |
| 1047 |
public static final long NEVER_SANDBOX_DISPLAY_APIS = 184838306L; |
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
@ChangeId |
| 1055 |
@Overridable |
| 1056 |
@Disabled |
| 1057 |
@TestApi |
| 1058 |
public static final long ALWAYS_SANDBOX_DISPLAY_APIS = 185004937L; |
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
|
| 1071 |
@ChangeId |
| 1072 |
@Overridable |
| 1073 |
@Disabled |
| 1074 |
@TestApi |
| 1075 |
public static final long OVERRIDE_MIN_ASPECT_RATIO = 174042980L; |
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
@ChangeId |
| 1086 |
@Overridable |
| 1087 |
@TestApi |
| 1088 |
public static final long OVERRIDE_MIN_ASPECT_RATIO_PORTRAIT_ONLY = 203647190L; |
| 1089 |
|
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
@ChangeId |
| 1098 |
@Overridable |
| 1099 |
@Disabled |
| 1100 |
@TestApi |
| 1101 |
public static final long OVERRIDE_MIN_ASPECT_RATIO_MEDIUM = 180326845L; |
| 1102 |
|
| 1103 |
|
| 1104 |
@TestApi |
| 1105 |
public static final float OVERRIDE_MIN_ASPECT_RATIO_MEDIUM_VALUE = 3 / 2f; |
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
@ChangeId |
| 1115 |
@Overridable |
| 1116 |
@Disabled |
| 1117 |
@TestApi |
| 1118 |
public static final long OVERRIDE_MIN_ASPECT_RATIO_LARGE = 180326787L; |
| 1119 |
|
| 1120 |
|
| 1121 |
@TestApi |
| 1122 |
public static final float OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE = 16 / 9f; |
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
|
| 1127 |
|
| 1128 |
|
| 1129 |
@ChangeId |
| 1130 |
@Disabled |
| 1131 |
@Overridable |
| 1132 |
public static final long OVERRIDE_MIN_ASPECT_RATIO_TO_ALIGN_WITH_SPLIT_SCREEN = 208648326L; |
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
|
| 1139 |
@ChangeId |
| 1140 |
@Disabled |
| 1141 |
@Overridable |
| 1142 |
public static final long OVERRIDE_MIN_ASPECT_RATIO_EXCLUDE_PORTRAIT_FULLSCREEN = 218959984L; |
| 1143 |
|
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
|
| 1149 |
|
| 1150 |
@ChangeId |
| 1151 |
@Disabled |
| 1152 |
@Overridable |
| 1153 |
public static final long OVERRIDE_ENABLE_COMPAT_FAKE_FOCUS = 263259275L; |
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
@ChangeId |
| 1160 |
@EnabledSince(targetSdkVersion = Build.VERSION_CODES.S) |
| 1161 |
private static final long CHECK_MIN_WIDTH_HEIGHT_FOR_MULTI_WINDOW = 197654537L; |
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
@Nullable |
| 1168 |
private Set<String> mKnownActivityEmbeddingCerts; |
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 1176 |
public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) { |
| 1177 |
int output = 0; |
| 1178 |
for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) { |
| 1179 |
if ((input & (1 << i)) != 0) { |
| 1180 |
output |= CONFIG_NATIVE_BITS[i]; |
| 1181 |
} |
| 1182 |
} |
| 1183 |
return output; |
| 1184 |
} |
| 1185 |
|
| 1186 |
|
| 1187 |
|
| 1188 |
|
| 1189 |
|
| 1190 |
|
| 1191 |
public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) { |
| 1192 |
int output = 0; |
| 1193 |
for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) { |
| 1194 |
if ((input & CONFIG_NATIVE_BITS[i]) != 0) { |
| 1195 |
output |= (1 << i); |
| 1196 |
} |
| 1197 |
} |
| 1198 |
return output; |
| 1199 |
} |
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
|
| 1204 |
|
| 1205 |
|
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 |
public int getRealConfigChanged() { |
| 1210 |
return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2 |
| 1211 |
? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE |
| 1212 |
| ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) |
| 1213 |
: configChanges; |
| 1214 |
} |
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
|
| 1221 |
|
| 1222 |
|
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
|
| 1227 |
|
| 1228 |
public int configChanges; |
| 1229 |
|
| 1230 |
|
| 1231 |
|
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
@android.view.WindowManager.LayoutParams.SoftInputModeFlags |
| 1239 |
public int softInputMode; |
| 1240 |
|
| 1241 |
|
| 1242 |
|
| 1243 |
|
| 1244 |
|
| 1245 |
|
| 1246 |
public int uiOptions = 0; |
| 1247 |
|
| 1248 |
|
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
|
| 1253 |
|
| 1254 |
|
| 1255 |
public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; |
| 1256 |
|
| 1257 |
|
| 1258 |
|
| 1259 |
|
| 1260 |
public String parentActivityName; |
| 1261 |
|
| 1262 |
|
| 1263 |
|
| 1264 |
|
| 1265 |
|
| 1266 |
|
| 1267 |
|
| 1268 |
|
| 1269 |
|
| 1270 |
public int rotationAnimation = -1; |
| 1271 |
|
| 1272 |
|
| 1273 |
public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0; |
| 1274 |
|
| 1275 |
public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1; |
| 1276 |
|
| 1277 |
public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2; |
| 1278 |
|
| 1279 |
public static final int LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED = 3; |
| 1280 |
|
| 1281 |
|
| 1282 |
public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) { |
| 1283 |
switch (lockTaskLaunchMode) { |
| 1284 |
case LOCK_TASK_LAUNCH_MODE_DEFAULT: |
| 1285 |
return "LOCK_TASK_LAUNCH_MODE_DEFAULT"; |
| 1286 |
case LOCK_TASK_LAUNCH_MODE_NEVER: |
| 1287 |
return "LOCK_TASK_LAUNCH_MODE_NEVER"; |
| 1288 |
case LOCK_TASK_LAUNCH_MODE_ALWAYS: |
| 1289 |
return "LOCK_TASK_LAUNCH_MODE_ALWAYS"; |
| 1290 |
case LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED: |
| 1291 |
return "LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED"; |
| 1292 |
default: |
| 1293 |
return "unknown=" + lockTaskLaunchMode; |
| 1294 |
} |
| 1295 |
} |
| 1296 |
|
| 1297 |
|
| 1298 |
|
| 1299 |
|
| 1300 |
|
| 1301 |
public int lockTaskLaunchMode; |
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
public WindowLayout windowLayout; |
| 1308 |
|
| 1309 |
public ActivityInfo() { |
| 1310 |
} |
| 1311 |
|
| 1312 |
public ActivityInfo(ActivityInfo orig) { |
| 1313 |
super(orig); |
| 1314 |
theme = orig.theme; |
| 1315 |
launchMode = orig.launchMode; |
| 1316 |
documentLaunchMode = orig.documentLaunchMode; |
| 1317 |
permission = orig.permission; |
| 1318 |
mKnownActivityEmbeddingCerts = orig.mKnownActivityEmbeddingCerts; |
| 1319 |
taskAffinity = orig.taskAffinity; |
| 1320 |
targetActivity = orig.targetActivity; |
| 1321 |
flags = orig.flags; |
| 1322 |
privateFlags = orig.privateFlags; |
| 1323 |
screenOrientation = orig.screenOrientation; |
| 1324 |
configChanges = orig.configChanges; |
| 1325 |
softInputMode = orig.softInputMode; |
| 1326 |
uiOptions = orig.uiOptions; |
| 1327 |
parentActivityName = orig.parentActivityName; |
| 1328 |
maxRecents = orig.maxRecents; |
| 1329 |
lockTaskLaunchMode = orig.lockTaskLaunchMode; |
| 1330 |
windowLayout = orig.windowLayout; |
| 1331 |
resizeMode = orig.resizeMode; |
| 1332 |
requestedVrComponent = orig.requestedVrComponent; |
| 1333 |
rotationAnimation = orig.rotationAnimation; |
| 1334 |
colorMode = orig.colorMode; |
| 1335 |
mMaxAspectRatio = orig.mMaxAspectRatio; |
| 1336 |
mMinAspectRatio = orig.mMinAspectRatio; |
| 1337 |
supportsSizeChanges = orig.supportsSizeChanges; |
| 1338 |
} |
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
|
| 1347 |
public final int getThemeResource() { |
| 1348 |
return theme != 0 ? theme : applicationInfo.theme; |
| 1349 |
} |
| 1350 |
|
| 1351 |
private String persistableModeToString() { |
| 1352 |
switch(persistableMode) { |
| 1353 |
case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY"; |
| 1354 |
case PERSIST_NEVER: return "PERSIST_NEVER"; |
| 1355 |
case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS"; |
| 1356 |
default: return "UNKNOWN=" + persistableMode; |
| 1357 |
} |
| 1358 |
} |
| 1359 |
|
| 1360 |
|
| 1361 |
|
| 1362 |
|
| 1363 |
|
| 1364 |
public boolean hasFixedAspectRatio() { |
| 1365 |
return getMaxAspectRatio() != 0 || getMinAspectRatio() != 0; |
| 1366 |
} |
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
|
| 1371 |
|
| 1372 |
public boolean isFixedOrientation() { |
| 1373 |
return isFixedOrientationLandscape() || isFixedOrientationPortrait() |
| 1374 |
|| screenOrientation == SCREEN_ORIENTATION_LOCKED; |
| 1375 |
} |
| 1376 |
|
| 1377 |
|
| 1378 |
|
| 1379 |
|
| 1380 |
|
| 1381 |
boolean isFixedOrientationLandscape() { |
| 1382 |
return isFixedOrientationLandscape(screenOrientation); |
| 1383 |
} |
| 1384 |
|
| 1385 |
|
| 1386 |
|
| 1387 |
|
| 1388 |
|
| 1389 |
public static boolean isFixedOrientationLandscape(@ScreenOrientation int orientation) { |
| 1390 |
return orientation == SCREEN_ORIENTATION_LANDSCAPE |
| 1391 |
|| orientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE |
| 1392 |
|| orientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE |
| 1393 |
|| orientation == SCREEN_ORIENTATION_USER_LANDSCAPE; |
| 1394 |
} |
| 1395 |
|
| 1396 |
|
| 1397 |
|
| 1398 |
|
| 1399 |
|
| 1400 |
boolean isFixedOrientationPortrait() { |
| 1401 |
return isFixedOrientationPortrait(screenOrientation); |
| 1402 |
} |
| 1403 |
|
| 1404 |
|
| 1405 |
|
| 1406 |
|
| 1407 |
|
| 1408 |
public static boolean isFixedOrientationPortrait(@ScreenOrientation int orientation) { |
| 1409 |
return orientation == SCREEN_ORIENTATION_PORTRAIT |
| 1410 |
|| orientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT |
| 1411 |
|| orientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT |
| 1412 |
|| orientation == SCREEN_ORIENTATION_USER_PORTRAIT; |
| 1413 |
} |
| 1414 |
|
| 1415 |
|
| 1416 |
|
| 1417 |
|
| 1418 |
|
| 1419 |
@ActivityInfo.ScreenOrientation |
| 1420 |
public static int reverseOrientation(@ActivityInfo.ScreenOrientation int orientation) { |
| 1421 |
switch (orientation) { |
| 1422 |
case SCREEN_ORIENTATION_LANDSCAPE: |
| 1423 |
return SCREEN_ORIENTATION_PORTRAIT; |
| 1424 |
case SCREEN_ORIENTATION_PORTRAIT: |
| 1425 |
return SCREEN_ORIENTATION_LANDSCAPE; |
| 1426 |
case SCREEN_ORIENTATION_SENSOR_LANDSCAPE: |
| 1427 |
return SCREEN_ORIENTATION_SENSOR_PORTRAIT; |
| 1428 |
case SCREEN_ORIENTATION_SENSOR_PORTRAIT: |
| 1429 |
return SCREEN_ORIENTATION_SENSOR_LANDSCAPE; |
| 1430 |
case SCREEN_ORIENTATION_REVERSE_LANDSCAPE: |
| 1431 |
return SCREEN_ORIENTATION_REVERSE_PORTRAIT; |
| 1432 |
case SCREEN_ORIENTATION_REVERSE_PORTRAIT: |
| 1433 |
return SCREEN_ORIENTATION_REVERSE_LANDSCAPE; |
| 1434 |
case SCREEN_ORIENTATION_USER_LANDSCAPE: |
| 1435 |
return SCREEN_ORIENTATION_USER_PORTRAIT; |
| 1436 |
case SCREEN_ORIENTATION_USER_PORTRAIT: |
| 1437 |
return SCREEN_ORIENTATION_USER_LANDSCAPE; |
| 1438 |
default: |
| 1439 |
return orientation; |
| 1440 |
} |
| 1441 |
} |
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
|
| 1446 |
|
| 1447 |
@UnsupportedAppUsage |
| 1448 |
public boolean supportsPictureInPicture() { |
| 1449 |
return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0; |
| 1450 |
} |
| 1451 |
|
| 1452 |
|
| 1453 |
|
| 1454 |
|
| 1455 |
|
| 1456 |
@SizeChangesSupportMode |
| 1457 |
public int supportsSizeChanges() { |
| 1458 |
if (isChangeEnabled(FORCE_NON_RESIZE_APP)) { |
| 1459 |
return SIZE_CHANGES_UNSUPPORTED_OVERRIDE; |
| 1460 |
} |
| 1461 |
|
| 1462 |
if (supportsSizeChanges) { |
| 1463 |
return SIZE_CHANGES_SUPPORTED_METADATA; |
| 1464 |
} |
| 1465 |
|
| 1466 |
if (isChangeEnabled(FORCE_RESIZE_APP)) { |
| 1467 |
return SIZE_CHANGES_SUPPORTED_OVERRIDE; |
| 1468 |
} |
| 1469 |
|
| 1470 |
return SIZE_CHANGES_UNSUPPORTED_METADATA; |
| 1471 |
} |
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
public boolean neverSandboxDisplayApis(ConstrainDisplayApisConfig constrainDisplayApisConfig) { |
| 1478 |
return isChangeEnabled(NEVER_SANDBOX_DISPLAY_APIS) |
| 1479 |
|| constrainDisplayApisConfig.getNeverConstrainDisplayApis(applicationInfo); |
| 1480 |
} |
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
|
| 1485 |
|
| 1486 |
public boolean alwaysSandboxDisplayApis(ConstrainDisplayApisConfig constrainDisplayApisConfig) { |
| 1487 |
return isChangeEnabled(ALWAYS_SANDBOX_DISPLAY_APIS) |
| 1488 |
|| constrainDisplayApisConfig.getAlwaysConstrainDisplayApis(applicationInfo); |
| 1489 |
} |
| 1490 |
|
| 1491 |
|
| 1492 |
public void setMaxAspectRatio(@FloatRange(from = 0f) float maxAspectRatio) { |
| 1493 |
this.mMaxAspectRatio = maxAspectRatio >= 0f ? maxAspectRatio : 0f; |
| 1494 |
} |
| 1495 |
|
| 1496 |
|
| 1497 |
public float getMaxAspectRatio() { |
| 1498 |
return mMaxAspectRatio; |
| 1499 |
} |
| 1500 |
|
| 1501 |
|
| 1502 |
public void setMinAspectRatio(@FloatRange(from = 0f) float minAspectRatio) { |
| 1503 |
this.mMinAspectRatio = minAspectRatio >= 0f ? minAspectRatio : 0f; |
| 1504 |
} |
| 1505 |
|
| 1506 |
|
| 1507 |
|
| 1508 |
|
| 1509 |
|
| 1510 |
public float getMinAspectRatio() { |
| 1511 |
return mMinAspectRatio; |
| 1512 |
} |
| 1513 |
|
| 1514 |
|
| 1515 |
|
| 1516 |
|
| 1517 |
|
| 1518 |
|
| 1519 |
@NonNull |
| 1520 |
public Set<String> getKnownActivityEmbeddingCerts() { |
| 1521 |
return mKnownActivityEmbeddingCerts == null ? Collections.emptySet() |
| 1522 |
: mKnownActivityEmbeddingCerts; |
| 1523 |
} |
| 1524 |
|
| 1525 |
|
| 1526 |
|
| 1527 |
|
| 1528 |
|
| 1529 |
|
| 1530 |
public void setKnownActivityEmbeddingCerts(@NonNull Set<String> knownActivityEmbeddingCerts) { |
| 1531 |
|
| 1532 |
|
| 1533 |
mKnownActivityEmbeddingCerts = new ArraySet<>(); |
| 1534 |
for (String knownCert : knownActivityEmbeddingCerts) { |
| 1535 |
mKnownActivityEmbeddingCerts.add(knownCert.toUpperCase(Locale.US)); |
| 1536 |
} |
| 1537 |
} |
| 1538 |
|
| 1539 |
|
| 1540 |
|
| 1541 |
|
| 1542 |
|
| 1543 |
|
| 1544 |
|
| 1545 |
public boolean isChangeEnabled(long changeId) { |
| 1546 |
return CompatChanges.isChangeEnabled(changeId, applicationInfo.packageName, |
| 1547 |
UserHandle.getUserHandleForUid(applicationInfo.uid)); |
| 1548 |
} |
| 1549 |
|
| 1550 |
|
| 1551 |
public float getManifestMinAspectRatio() { |
| 1552 |
return mMinAspectRatio; |
| 1553 |
} |
| 1554 |
|
| 1555 |
|
| 1556 |
@UnsupportedAppUsage |
| 1557 |
public static boolean isResizeableMode(int mode) { |
| 1558 |
return mode == RESIZE_MODE_RESIZEABLE |
| 1559 |
|| mode == RESIZE_MODE_FORCE_RESIZEABLE |
| 1560 |
|| mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY |
| 1561 |
|| mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY |
| 1562 |
|| mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION |
| 1563 |
|| mode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION; |
| 1564 |
} |
| 1565 |
|
| 1566 |
|
| 1567 |
public static boolean isPreserveOrientationMode(int mode) { |
| 1568 |
return mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY |
| 1569 |
|| mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY |
| 1570 |
|| mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION; |
| 1571 |
} |
| 1572 |
|
| 1573 |
|
| 1574 |
public static String resizeModeToString(int mode) { |
| 1575 |
switch (mode) { |
| 1576 |
case RESIZE_MODE_UNRESIZEABLE: |
| 1577 |
return "RESIZE_MODE_UNRESIZEABLE"; |
| 1578 |
case RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION: |
| 1579 |
return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION"; |
| 1580 |
case RESIZE_MODE_RESIZEABLE: |
| 1581 |
return "RESIZE_MODE_RESIZEABLE"; |
| 1582 |
case RESIZE_MODE_FORCE_RESIZEABLE: |
| 1583 |
return "RESIZE_MODE_FORCE_RESIZEABLE"; |
| 1584 |
case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY: |
| 1585 |
return "RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY"; |
| 1586 |
case RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY: |
| 1587 |
return "RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY"; |
| 1588 |
case RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION: |
| 1589 |
return "RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION"; |
| 1590 |
default: |
| 1591 |
return "unknown=" + mode; |
| 1592 |
} |
| 1593 |
} |
| 1594 |
|
| 1595 |
|
| 1596 |
public static String sizeChangesSupportModeToString(@SizeChangesSupportMode int mode) { |
| 1597 |
switch (mode) { |
| 1598 |
case SIZE_CHANGES_UNSUPPORTED_METADATA: |
| 1599 |
return "SIZE_CHANGES_UNSUPPORTED_METADATA"; |
| 1600 |
case SIZE_CHANGES_UNSUPPORTED_OVERRIDE: |
| 1601 |
return "SIZE_CHANGES_UNSUPPORTED_OVERRIDE"; |
| 1602 |
case SIZE_CHANGES_SUPPORTED_METADATA: |
| 1603 |
return "SIZE_CHANGES_SUPPORTED_METADATA"; |
| 1604 |
case SIZE_CHANGES_SUPPORTED_OVERRIDE: |
| 1605 |
return "SIZE_CHANGES_SUPPORTED_OVERRIDE"; |
| 1606 |
default: |
| 1607 |
return "unknown=" + mode; |
| 1608 |
} |
| 1609 |
} |
| 1610 |
|
| 1611 |
|
| 1612 |
|
| 1613 |
|
| 1614 |
|
| 1615 |
|
| 1616 |
public boolean shouldCheckMinWidthHeightForMultiWindow() { |
| 1617 |
return isChangeEnabled(CHECK_MIN_WIDTH_HEIGHT_FOR_MULTI_WINDOW); |
| 1618 |
} |
| 1619 |
|
| 1620 |
public void dump(Printer pw, String prefix) { |
| 1621 |
dump(pw, prefix, DUMP_FLAG_ALL); |
| 1622 |
} |
| 1623 |
|
| 1624 |
|
| 1625 |
public void dump(Printer pw, String prefix, int dumpFlags) { |
| 1626 |
super.dumpFront(pw, prefix); |
| 1627 |
if (permission != null) { |
| 1628 |
pw.println(prefix + "permission=" + permission); |
| 1629 |
} |
| 1630 |
if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) { |
| 1631 |
pw.println(prefix + "taskAffinity=" + taskAffinity |
| 1632 |
+ " targetActivity=" + targetActivity |
| 1633 |
+ " persistableMode=" + persistableModeToString()); |
| 1634 |
} |
| 1635 |
if (launchMode != 0 || flags != 0 || privateFlags != 0 || theme != 0) { |
| 1636 |
pw.println(prefix + "launchMode=" + launchModeToString(launchMode) |
| 1637 |
+ " flags=0x" + Integer.toHexString(flags) |
| 1638 |
+ " privateFlags=0x" + Integer.toHexString(privateFlags) |
| 1639 |
+ " theme=0x" + Integer.toHexString(theme)); |
| 1640 |
} |
| 1641 |
if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED |
| 1642 |
|| configChanges != 0 || softInputMode != 0) { |
| 1643 |
pw.println(prefix + "screenOrientation=" + screenOrientation |
| 1644 |
+ " configChanges=0x" + Integer.toHexString(configChanges) |
| 1645 |
+ " softInputMode=0x" + Integer.toHexString(softInputMode)); |
| 1646 |
} |
| 1647 |
if (uiOptions != 0) { |
| 1648 |
pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions)); |
| 1649 |
} |
| 1650 |
if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) { |
| 1651 |
pw.println(prefix + "lockTaskLaunchMode=" |
| 1652 |
+ lockTaskLaunchModeToString(lockTaskLaunchMode)); |
| 1653 |
} |
| 1654 |
if (windowLayout != null) { |
| 1655 |
pw.println(prefix + "windowLayout=" + windowLayout.width + "|" |
| 1656 |
+ windowLayout.widthFraction + ", " + windowLayout.height + "|" |
| 1657 |
+ windowLayout.heightFraction + ", " + windowLayout.gravity); |
| 1658 |
} |
| 1659 |
pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode)); |
| 1660 |
if (requestedVrComponent != null) { |
| 1661 |
pw.println(prefix + "requestedVrComponent=" + requestedVrComponent); |
| 1662 |
} |
| 1663 |
if (getMaxAspectRatio() != 0) { |
| 1664 |
pw.println(prefix + "maxAspectRatio=" + getMaxAspectRatio()); |
| 1665 |
} |
| 1666 |
final float minAspectRatio = getMinAspectRatio(); |
| 1667 |
if (minAspectRatio != 0) { |
| 1668 |
pw.println(prefix + "minAspectRatio=" + minAspectRatio); |
| 1669 |
} |
| 1670 |
if (supportsSizeChanges) { |
| 1671 |
pw.println(prefix + "supportsSizeChanges=true"); |
| 1672 |
} |
| 1673 |
if (mKnownActivityEmbeddingCerts != null) { |
| 1674 |
pw.println(prefix + "knownActivityEmbeddingCerts=" + mKnownActivityEmbeddingCerts); |
| 1675 |
} |
| 1676 |
super.dumpBack(pw, prefix, dumpFlags); |
| 1677 |
} |
| 1678 |
|
| 1679 |
public String toString() { |
| 1680 |
return "ActivityInfo{" |
| 1681 |
+ Integer.toHexString(System.identityHashCode(this)) |
| 1682 |
+ " " + name + "}"; |
| 1683 |
} |
| 1684 |
|
| 1685 |
public int describeContents() { |
| 1686 |
return 0; |
| 1687 |
} |
| 1688 |
|
| 1689 |
public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 1690 |
super.writeToParcel(dest, parcelableFlags); |
| 1691 |
dest.writeInt(theme); |
| 1692 |
dest.writeInt(launchMode); |
| 1693 |
dest.writeInt(documentLaunchMode); |
| 1694 |
dest.writeString8(permission); |
| 1695 |
dest.writeString8(taskAffinity); |
| 1696 |
dest.writeString8(targetActivity); |
| 1697 |
dest.writeString8(launchToken); |
| 1698 |
dest.writeInt(flags); |
| 1699 |
dest.writeInt(privateFlags); |
| 1700 |
dest.writeInt(screenOrientation); |
| 1701 |
dest.writeInt(configChanges); |
| 1702 |
dest.writeInt(softInputMode); |
| 1703 |
dest.writeInt(uiOptions); |
| 1704 |
dest.writeString8(parentActivityName); |
| 1705 |
dest.writeInt(persistableMode); |
| 1706 |
dest.writeInt(maxRecents); |
| 1707 |
dest.writeInt(lockTaskLaunchMode); |
| 1708 |
if (windowLayout != null) { |
| 1709 |
dest.writeInt(1); |
| 1710 |
windowLayout.writeToParcel(dest); |
| 1711 |
} else { |
| 1712 |
dest.writeInt(0); |
| 1713 |
} |
| 1714 |
dest.writeInt(resizeMode); |
| 1715 |
dest.writeString8(requestedVrComponent); |
| 1716 |
dest.writeInt(rotationAnimation); |
| 1717 |
dest.writeInt(colorMode); |
| 1718 |
dest.writeFloat(mMaxAspectRatio); |
| 1719 |
dest.writeFloat(mMinAspectRatio); |
| 1720 |
dest.writeBoolean(supportsSizeChanges); |
| 1721 |
sForStringSet.parcel(mKnownActivityEmbeddingCerts, dest, flags); |
| 1722 |
} |
| 1723 |
|
| 1724 |
|
| 1725 |
|
| 1726 |
|
| 1727 |
|
| 1728 |
@UnsupportedAppUsage |
| 1729 |
@TestApi |
| 1730 |
public static boolean isTranslucentOrFloating(TypedArray attributes) { |
| 1731 |
final boolean isTranslucent = |
| 1732 |
attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent, |
| 1733 |
false); |
| 1734 |
final boolean isFloating = |
| 1735 |
attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating, |
| 1736 |
false); |
| 1737 |
|
| 1738 |
return isFloating || isTranslucent; |
| 1739 |
} |
| 1740 |
|
| 1741 |
|
| 1742 |
|
| 1743 |
|
| 1744 |
|
| 1745 |
public static String screenOrientationToString(int orientation) { |
| 1746 |
switch (orientation) { |
| 1747 |
case SCREEN_ORIENTATION_UNSET: |
| 1748 |
return "SCREEN_ORIENTATION_UNSET"; |
| 1749 |
case SCREEN_ORIENTATION_UNSPECIFIED: |
| 1750 |
return "SCREEN_ORIENTATION_UNSPECIFIED"; |
| 1751 |
case SCREEN_ORIENTATION_LANDSCAPE: |
| 1752 |
return "SCREEN_ORIENTATION_LANDSCAPE"; |
| 1753 |
case SCREEN_ORIENTATION_PORTRAIT: |
| 1754 |
return "SCREEN_ORIENTATION_PORTRAIT"; |
| 1755 |
case SCREEN_ORIENTATION_USER: |
| 1756 |
return "SCREEN_ORIENTATION_USER"; |
| 1757 |
case SCREEN_ORIENTATION_BEHIND: |
| 1758 |
return "SCREEN_ORIENTATION_BEHIND"; |
| 1759 |
case SCREEN_ORIENTATION_SENSOR: |
| 1760 |
return "SCREEN_ORIENTATION_SENSOR"; |
| 1761 |
case SCREEN_ORIENTATION_NOSENSOR: |
| 1762 |
return "SCREEN_ORIENTATION_NOSENSOR"; |
| 1763 |
case SCREEN_ORIENTATION_SENSOR_LANDSCAPE: |
| 1764 |
return "SCREEN_ORIENTATION_SENSOR_LANDSCAPE"; |
| 1765 |
case SCREEN_ORIENTATION_SENSOR_PORTRAIT: |
| 1766 |
return "SCREEN_ORIENTATION_SENSOR_PORTRAIT"; |
| 1767 |
case SCREEN_ORIENTATION_REVERSE_LANDSCAPE: |
| 1768 |
return "SCREEN_ORIENTATION_REVERSE_LANDSCAPE"; |
| 1769 |
case SCREEN_ORIENTATION_REVERSE_PORTRAIT: |
| 1770 |
return "SCREEN_ORIENTATION_REVERSE_PORTRAIT"; |
| 1771 |
case SCREEN_ORIENTATION_FULL_SENSOR: |
| 1772 |
return "SCREEN_ORIENTATION_FULL_SENSOR"; |
| 1773 |
case SCREEN_ORIENTATION_USER_LANDSCAPE: |
| 1774 |
return "SCREEN_ORIENTATION_USER_LANDSCAPE"; |
| 1775 |
case SCREEN_ORIENTATION_USER_PORTRAIT: |
| 1776 |
return "SCREEN_ORIENTATION_USER_PORTRAIT"; |
| 1777 |
case SCREEN_ORIENTATION_FULL_USER: |
| 1778 |
return "SCREEN_ORIENTATION_FULL_USER"; |
| 1779 |
case SCREEN_ORIENTATION_LOCKED: |
| 1780 |
return "SCREEN_ORIENTATION_LOCKED"; |
| 1781 |
default: |
| 1782 |
return Integer.toString(orientation); |
| 1783 |
} |
| 1784 |
} |
| 1785 |
|
| 1786 |
|
| 1787 |
|
| 1788 |
|
| 1789 |
public static String colorModeToString(@ColorMode int colorMode) { |
| 1790 |
switch (colorMode) { |
| 1791 |
case COLOR_MODE_DEFAULT: |
| 1792 |
return "COLOR_MODE_DEFAULT"; |
| 1793 |
case COLOR_MODE_WIDE_COLOR_GAMUT: |
| 1794 |
return "COLOR_MODE_WIDE_COLOR_GAMUT"; |
| 1795 |
case COLOR_MODE_HDR: |
| 1796 |
return "COLOR_MODE_HDR"; |
| 1797 |
case COLOR_MODE_A8: |
| 1798 |
return "COLOR_MODE_A8"; |
| 1799 |
default: |
| 1800 |
return Integer.toString(colorMode); |
| 1801 |
} |
| 1802 |
} |
| 1803 |
|
| 1804 |
public static final @android.annotation.NonNull Parcelable.Creator<ActivityInfo> CREATOR |
| 1805 |
= new Parcelable.Creator<ActivityInfo>() { |
| 1806 |
public ActivityInfo createFromParcel(Parcel source) { |
| 1807 |
return new ActivityInfo(source); |
| 1808 |
} |
| 1809 |
public ActivityInfo[] newArray(int size) { |
| 1810 |
return new ActivityInfo[size]; |
| 1811 |
} |
| 1812 |
}; |
| 1813 |
|
| 1814 |
private ActivityInfo(Parcel source) { |
| 1815 |
super(source); |
| 1816 |
theme = source.readInt(); |
| 1817 |
launchMode = source.readInt(); |
| 1818 |
documentLaunchMode = source.readInt(); |
| 1819 |
permission = source.readString8(); |
| 1820 |
taskAffinity = source.readString8(); |
| 1821 |
targetActivity = source.readString8(); |
| 1822 |
launchToken = source.readString8(); |
| 1823 |
flags = source.readInt(); |
| 1824 |
privateFlags = source.readInt(); |
| 1825 |
screenOrientation = source.readInt(); |
| 1826 |
configChanges = source.readInt(); |
| 1827 |
softInputMode = source.readInt(); |
| 1828 |
uiOptions = source.readInt(); |
| 1829 |
parentActivityName = source.readString8(); |
| 1830 |
persistableMode = source.readInt(); |
| 1831 |
maxRecents = source.readInt(); |
| 1832 |
lockTaskLaunchMode = source.readInt(); |
| 1833 |
if (source.readInt() == 1) { |
| 1834 |
windowLayout = new WindowLayout(source); |
| 1835 |
} |
| 1836 |
resizeMode = source.readInt(); |
| 1837 |
requestedVrComponent = source.readString8(); |
| 1838 |
rotationAnimation = source.readInt(); |
| 1839 |
colorMode = source.readInt(); |
| 1840 |
mMaxAspectRatio = source.readFloat(); |
| 1841 |
mMinAspectRatio = source.readFloat(); |
| 1842 |
supportsSizeChanges = source.readBoolean(); |
| 1843 |
mKnownActivityEmbeddingCerts = sForStringSet.unparcel(source); |
| 1844 |
if (mKnownActivityEmbeddingCerts.isEmpty()) { |
| 1845 |
mKnownActivityEmbeddingCerts = null; |
| 1846 |
} |
| 1847 |
} |
| 1848 |
|
| 1849 |
|
| 1850 |
|
| 1851 |
|
| 1852 |
|
| 1853 |
|
| 1854 |
|
| 1855 |
|
| 1856 |
|
| 1857 |
|
| 1858 |
|
| 1859 |
|
| 1860 |
|
| 1861 |
|
| 1862 |
public static final class WindowLayout { |
| 1863 |
public WindowLayout(int width, float widthFraction, int height, float heightFraction, |
| 1864 |
int gravity, int minWidth, int minHeight) { |
| 1865 |
this(width, widthFraction, height, heightFraction, gravity, minWidth, minHeight, |
| 1866 |
null ); |
| 1867 |
} |
| 1868 |
|
| 1869 |
|
| 1870 |
public WindowLayout(int width, float widthFraction, int height, float heightFraction, |
| 1871 |
int gravity, int minWidth, int minHeight, String windowLayoutAffinity) { |
| 1872 |
this.width = width; |
| 1873 |
this.widthFraction = widthFraction; |
| 1874 |
this.height = height; |
| 1875 |
this.heightFraction = heightFraction; |
| 1876 |
this.gravity = gravity; |
| 1877 |
this.minWidth = minWidth; |
| 1878 |
this.minHeight = minHeight; |
| 1879 |
this.windowLayoutAffinity = windowLayoutAffinity; |
| 1880 |
} |
| 1881 |
|
| 1882 |
|
| 1883 |
public WindowLayout(Parcel source) { |
| 1884 |
width = source.readInt(); |
| 1885 |
widthFraction = source.readFloat(); |
| 1886 |
height = source.readInt(); |
| 1887 |
heightFraction = source.readFloat(); |
| 1888 |
gravity = source.readInt(); |
| 1889 |
minWidth = source.readInt(); |
| 1890 |
minHeight = source.readInt(); |
| 1891 |
windowLayoutAffinity = source.readString8(); |
| 1892 |
} |
| 1893 |
|
| 1894 |
|
| 1895 |
|
| 1896 |
|
| 1897 |
|
| 1898 |
|
| 1899 |
public final int width; |
| 1900 |
|
| 1901 |
|
| 1902 |
|
| 1903 |
|
| 1904 |
|
| 1905 |
|
| 1906 |
|
| 1907 |
public final float widthFraction; |
| 1908 |
|
| 1909 |
|
| 1910 |
|
| 1911 |
|
| 1912 |
|
| 1913 |
|
| 1914 |
public final int height; |
| 1915 |
|
| 1916 |
|
| 1917 |
|
| 1918 |
|
| 1919 |
|
| 1920 |
|
| 1921 |
|
| 1922 |
public final float heightFraction; |
| 1923 |
|
| 1924 |
|
| 1925 |
|
| 1926 |
|
| 1927 |
|
| 1928 |
|
| 1929 |
|
| 1930 |
|
| 1931 |
public final int gravity; |
| 1932 |
|
| 1933 |
|
| 1934 |
|
| 1935 |
|
| 1936 |
|
| 1937 |
|
| 1938 |
|
| 1939 |
|
| 1940 |
|
| 1941 |
|
| 1942 |
|
| 1943 |
public final int minWidth; |
| 1944 |
|
| 1945 |
|
| 1946 |
|
| 1947 |
|
| 1948 |
|
| 1949 |
|
| 1950 |
|
| 1951 |
|
| 1952 |
|
| 1953 |
|
| 1954 |
|
| 1955 |
public final int minHeight; |
| 1956 |
|
| 1957 |
|
| 1958 |
|
| 1959 |
|
| 1960 |
|
| 1961 |
|
| 1962 |
|
| 1963 |
|
| 1964 |
public String windowLayoutAffinity; |
| 1965 |
|
| 1966 |
|
| 1967 |
|
| 1968 |
|
| 1969 |
|
| 1970 |
public boolean hasSpecifiedSize() { |
| 1971 |
return width >= 0 || height >= 0 || widthFraction >= 0 || heightFraction >= 0; |
| 1972 |
} |
| 1973 |
|
| 1974 |
|
| 1975 |
public void writeToParcel(Parcel dest) { |
| 1976 |
dest.writeInt(width); |
| 1977 |
dest.writeFloat(widthFraction); |
| 1978 |
dest.writeInt(height); |
| 1979 |
dest.writeFloat(heightFraction); |
| 1980 |
dest.writeInt(gravity); |
| 1981 |
dest.writeInt(minWidth); |
| 1982 |
dest.writeInt(minHeight); |
| 1983 |
dest.writeString8(windowLayoutAffinity); |
| 1984 |
} |
| 1985 |
} |
| 1986 |
} |