| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.view.accessibility; |
| 18 |
|
| 19 |
import static com.android.internal.util.BitUtils.bitAt; |
| 20 |
import static com.android.internal.util.BitUtils.isBitSet; |
| 21 |
|
| 22 |
import static java.util.Collections.EMPTY_LIST; |
| 23 |
|
| 24 |
import android.accessibilityservice.AccessibilityService; |
| 25 |
import android.accessibilityservice.AccessibilityServiceInfo; |
| 26 |
import android.annotation.IntDef; |
| 27 |
import android.annotation.NonNull; |
| 28 |
import android.annotation.Nullable; |
| 29 |
import android.annotation.SuppressLint; |
| 30 |
import android.annotation.TestApi; |
| 31 |
import android.compat.annotation.UnsupportedAppUsage; |
| 32 |
import android.content.ClipData; |
| 33 |
import android.graphics.Rect; |
| 34 |
import android.graphics.Region; |
| 35 |
import android.os.Build; |
| 36 |
import android.os.Bundle; |
| 37 |
import android.os.IBinder; |
| 38 |
import android.os.Parcel; |
| 39 |
import android.os.Parcelable; |
| 40 |
import android.text.InputType; |
| 41 |
import android.text.Spannable; |
| 42 |
import android.text.SpannableStringBuilder; |
| 43 |
import android.text.Spanned; |
| 44 |
import android.text.TextUtils; |
| 45 |
import android.text.style.AccessibilityClickableSpan; |
| 46 |
import android.text.style.AccessibilityReplacementSpan; |
| 47 |
import android.text.style.AccessibilityURLSpan; |
| 48 |
import android.text.style.ClickableSpan; |
| 49 |
import android.text.style.ReplacementSpan; |
| 50 |
import android.text.style.URLSpan; |
| 51 |
import android.util.ArrayMap; |
| 52 |
import android.util.ArraySet; |
| 53 |
import android.util.Log; |
| 54 |
import android.util.LongArray; |
| 55 |
import android.util.Size; |
| 56 |
import android.util.TypedValue; |
| 57 |
import android.view.SurfaceView; |
| 58 |
import android.view.TouchDelegate; |
| 59 |
import android.view.View; |
| 60 |
import android.view.ViewGroup; |
| 61 |
import android.widget.TextView; |
| 62 |
|
| 63 |
import com.android.internal.R; |
| 64 |
import com.android.internal.util.CollectionUtils; |
| 65 |
import com.android.internal.util.Preconditions; |
| 66 |
|
| 67 |
import java.lang.annotation.Retention; |
| 68 |
import java.lang.annotation.RetentionPolicy; |
| 69 |
import java.util.ArrayList; |
| 70 |
import java.util.Collections; |
| 71 |
import java.util.List; |
| 72 |
import java.util.Map; |
| 73 |
import java.util.Objects; |
| 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 |
public class AccessibilityNodeInfo implements Parcelable { |
| 104 |
|
| 105 |
private static final String TAG = "AccessibilityNodeInfo"; |
| 106 |
|
| 107 |
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG) && Build.IS_DEBUGGABLE; |
| 108 |
|
| 109 |
|
| 110 |
public static final int UNDEFINED_CONNECTION_ID = -1; |
| 111 |
|
| 112 |
|
| 113 |
public static final int UNDEFINED_SELECTION_INDEX = -1; |
| 114 |
|
| 115 |
|
| 116 |
public static final int UNDEFINED_ITEM_ID = Integer.MAX_VALUE; |
| 117 |
|
| 118 |
|
| 119 |
public static final int ROOT_ITEM_ID = Integer.MAX_VALUE - 1; |
| 120 |
|
| 121 |
|
| 122 |
public static final int LEASHED_ITEM_ID = Integer.MAX_VALUE - 2; |
| 123 |
|
| 124 |
|
| 125 |
public static final long UNDEFINED_NODE_ID = makeNodeId(UNDEFINED_ITEM_ID, UNDEFINED_ITEM_ID); |
| 126 |
|
| 127 |
|
| 128 |
public static final long ROOT_NODE_ID = makeNodeId(ROOT_ITEM_ID, |
| 129 |
AccessibilityNodeProvider.HOST_VIEW_ID); |
| 130 |
|
| 131 |
|
| 132 |
public static final long LEASHED_NODE_ID = makeNodeId(LEASHED_ITEM_ID, |
| 133 |
AccessibilityNodeProvider.HOST_VIEW_ID); |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
public static final int FLAG_PREFETCH_ANCESTORS = 0x00000001; |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
public static final int FLAG_PREFETCH_SIBLINGS = 0x00000002; |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
public static final int FLAG_PREFETCH_DESCENDANTS_HYBRID = 0x00000004; |
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
public static final int FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST = 0x00000008; |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
public static final int FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST = 0x00000010; |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
public static final int FLAG_PREFETCH_UNINTERRUPTIBLE = 0x00000020; |
| 195 |
|
| 196 |
|
| 197 |
public static final int FLAG_PREFETCH_MASK = 0x0000003f; |
| 198 |
|
| 199 |
|
| 200 |
public static final int FLAG_PREFETCH_DESCENDANTS_MASK = 0x0000001C; |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
@SuppressLint("MinMaxConstant") |
| 206 |
public static final int MAX_NUMBER_OF_PREFETCHED_NODES = 50; |
| 207 |
|
| 208 |
|
| 209 |
@IntDef(flag = true, prefix = { "FLAG_PREFETCH" }, value = { |
| 210 |
FLAG_PREFETCH_ANCESTORS, |
| 211 |
FLAG_PREFETCH_SIBLINGS, |
| 212 |
FLAG_PREFETCH_DESCENDANTS_HYBRID, |
| 213 |
FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST, |
| 214 |
FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST, |
| 215 |
FLAG_PREFETCH_UNINTERRUPTIBLE |
| 216 |
}) |
| 217 |
@Retention(RetentionPolicy.SOURCE) |
| 218 |
public @interface PrefetchingStrategy {} |
| 219 |
|
| 220 |
|
| 221 |
public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 0x00000080; |
| 222 |
|
| 223 |
|
| 224 |
public static final int FLAG_REPORT_VIEW_IDS = 0x00000100; |
| 225 |
|
| 226 |
|
| 227 |
public static final int FLAG_REPORT_MASK = 0x00000180; |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
public static final int ACTION_FOCUS = 0x00000001; |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
public static final int ACTION_CLEAR_FOCUS = 0x00000002; |
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
public static final int ACTION_SELECT = 0x00000004; |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
public static final int ACTION_CLEAR_SELECTION = 0x00000008; |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
public static final int ACTION_CLICK = 0x00000010; |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
public static final int ACTION_LONG_CLICK = 0x00000020; |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
public static final int ACTION_ACCESSIBILITY_FOCUS = 0x00000040; |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
public static final int ACTION_CLEAR_ACCESSIBILITY_FOCUS = 0x00000080; |
| 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 |
public static final int ACTION_NEXT_AT_MOVEMENT_GRANULARITY = 0x00000100; |
| 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 |
public static final int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY = 0x00000200; |
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
public static final int ACTION_NEXT_HTML_ELEMENT = 0x00000400; |
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
public static final int ACTION_PREVIOUS_HTML_ELEMENT = 0x00000800; |
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
public static final int ACTION_SCROLL_FORWARD = 0x00001000; |
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
public static final int ACTION_SCROLL_BACKWARD = 0x00002000; |
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
public static final int ACTION_COPY = 0x00004000; |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
public static final int ACTION_PASTE = 0x00008000; |
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
public static final int ACTION_CUT = 0x00010000; |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
public static final int ACTION_SET_SELECTION = 0x00020000; |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
public static final int ACTION_EXPAND = 0x00040000; |
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
public static final int ACTION_COLLAPSE = 0x00080000; |
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
public static final int ACTION_DISMISS = 0x00100000; |
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
public static final int ACTION_SET_TEXT = 0x00200000; |
| 447 |
|
| 448 |
|
| 449 |
public static final int LAST_LEGACY_STANDARD_ACTION = ACTION_SET_TEXT; |
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
private static final int ACTION_TYPE_MASK = 0xFF000000; |
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
public static final String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = |
| 473 |
"ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"; |
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
public static final String ACTION_ARGUMENT_HTML_ELEMENT_STRING = |
| 490 |
"ACTION_ARGUMENT_HTML_ELEMENT_STRING"; |
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
public static final String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = |
| 507 |
"ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN"; |
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
public static final String ACTION_ARGUMENT_SELECTION_START_INT = |
| 521 |
"ACTION_ARGUMENT_SELECTION_START_INT"; |
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
public static final String ACTION_ARGUMENT_SELECTION_END_INT = |
| 535 |
"ACTION_ARGUMENT_SELECTION_END_INT"; |
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
public static final String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE = |
| 549 |
"ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE"; |
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
public static final String ACTION_ARGUMENT_ROW_INT = |
| 563 |
"android.view.accessibility.action.ARGUMENT_ROW_INT"; |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
public static final String ACTION_ARGUMENT_COLUMN_INT = |
| 577 |
"android.view.accessibility.action.ARGUMENT_COLUMN_INT"; |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
public static final String ACTION_ARGUMENT_PROGRESS_VALUE = |
| 591 |
"android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE"; |
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
public static final String ACTION_ARGUMENT_MOVE_WINDOW_X = |
| 605 |
"ACTION_ARGUMENT_MOVE_WINDOW_X"; |
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
public static final String ACTION_ARGUMENT_MOVE_WINDOW_Y = |
| 619 |
"ACTION_ARGUMENT_MOVE_WINDOW_Y"; |
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
public static final String ACTION_ARGUMENT_ACCESSIBLE_CLICKABLE_SPAN = |
| 627 |
"android.view.accessibility.action.ACTION_ARGUMENT_ACCESSIBLE_CLICKABLE_SPAN"; |
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
public static final String ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT = |
| 641 |
"android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT"; |
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
public static final int FOCUS_INPUT = 1; |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
public static final int FOCUS_ACCESSIBILITY = 2; |
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
public static final int MOVEMENT_GRANULARITY_CHARACTER = 0x00000001; |
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
public static final int MOVEMENT_GRANULARITY_WORD = 0x00000002; |
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
public static final int MOVEMENT_GRANULARITY_LINE = 0x00000004; |
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
public static final int MOVEMENT_GRANULARITY_PARAGRAPH = 0x00000008; |
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
public static final int MOVEMENT_GRANULARITY_PAGE = 0x00000010; |
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY = |
| 698 |
"android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY"; |
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX = |
| 707 |
"android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX"; |
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH = |
| 716 |
"android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH"; |
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
public static final int EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH = 20000; |
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
public static final String EXTRA_DATA_RENDERING_INFO_KEY = |
| 739 |
"android.view.accessibility.extra.DATA_RENDERING_INFO_KEY"; |
| 740 |
|
| 741 |
|
| 742 |
public static final String EXTRA_DATA_REQUESTED_KEY = |
| 743 |
"android.view.accessibility.AccessibilityNodeInfo.extra_data_requested"; |
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
private static final int BOOLEAN_PROPERTY_CHECKABLE = 0x00000001; |
| 748 |
|
| 749 |
private static final int BOOLEAN_PROPERTY_CHECKED = 0x00000002; |
| 750 |
|
| 751 |
private static final int BOOLEAN_PROPERTY_FOCUSABLE = 0x00000004; |
| 752 |
|
| 753 |
private static final int BOOLEAN_PROPERTY_FOCUSED = 0x00000008; |
| 754 |
|
| 755 |
private static final int BOOLEAN_PROPERTY_SELECTED = 0x00000010; |
| 756 |
|
| 757 |
private static final int BOOLEAN_PROPERTY_CLICKABLE = 0x00000020; |
| 758 |
|
| 759 |
private static final int BOOLEAN_PROPERTY_LONG_CLICKABLE = 0x00000040; |
| 760 |
|
| 761 |
private static final int BOOLEAN_PROPERTY_ENABLED = 0x00000080; |
| 762 |
|
| 763 |
private static final int BOOLEAN_PROPERTY_PASSWORD = 0x00000100; |
| 764 |
|
| 765 |
private static final int BOOLEAN_PROPERTY_SCROLLABLE = 0x00000200; |
| 766 |
|
| 767 |
private static final int BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED = 0x00000400; |
| 768 |
|
| 769 |
private static final int BOOLEAN_PROPERTY_VISIBLE_TO_USER = 0x00000800; |
| 770 |
|
| 771 |
private static final int BOOLEAN_PROPERTY_EDITABLE = 0x00001000; |
| 772 |
|
| 773 |
private static final int BOOLEAN_PROPERTY_OPENS_POPUP = 0x00002000; |
| 774 |
|
| 775 |
private static final int BOOLEAN_PROPERTY_DISMISSABLE = 0x00004000; |
| 776 |
|
| 777 |
private static final int BOOLEAN_PROPERTY_MULTI_LINE = 0x00008000; |
| 778 |
|
| 779 |
private static final int BOOLEAN_PROPERTY_CONTENT_INVALID = 0x00010000; |
| 780 |
|
| 781 |
private static final int BOOLEAN_PROPERTY_CONTEXT_CLICKABLE = 0x00020000; |
| 782 |
|
| 783 |
private static final int BOOLEAN_PROPERTY_IMPORTANCE = 0x0040000; |
| 784 |
|
| 785 |
private static final int BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE = 0x0080000; |
| 786 |
|
| 787 |
private static final int BOOLEAN_PROPERTY_IS_SHOWING_HINT = 0x0100000; |
| 788 |
|
| 789 |
private static final int BOOLEAN_PROPERTY_IS_HEADING = 0x0200000; |
| 790 |
|
| 791 |
private static final int BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY = 0x0400000; |
| 792 |
|
| 793 |
private static final int BOOLEAN_PROPERTY_IS_TEXT_SELECTABLE = 0x0800000; |
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
private static final long VIRTUAL_DESCENDANT_ID_MASK = 0xffffffff00000000L; |
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
private static final int VIRTUAL_DESCENDANT_ID_SHIFT = 32; |
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 815 |
public static int getAccessibilityViewId(long accessibilityNodeId) { |
| 816 |
return (int) accessibilityNodeId; |
| 817 |
} |
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 829 |
public static int getVirtualDescendantId(long accessibilityNodeId) { |
| 830 |
return (int) ((accessibilityNodeId & VIRTUAL_DESCENDANT_ID_MASK) |
| 831 |
>> VIRTUAL_DESCENDANT_ID_SHIFT); |
| 832 |
} |
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
public static long makeNodeId(int accessibilityViewId, int virtualDescendantId) { |
| 846 |
return (((long) virtualDescendantId) << VIRTUAL_DESCENDANT_ID_SHIFT) | accessibilityViewId; |
| 847 |
} |
| 848 |
|
| 849 |
private static final AccessibilityNodeInfo DEFAULT = new AccessibilityNodeInfo(); |
| 850 |
|
| 851 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 852 |
private boolean mSealed; |
| 853 |
|
| 854 |
|
| 855 |
private int mWindowId = AccessibilityWindowInfo.UNDEFINED_WINDOW_ID; |
| 856 |
@UnsupportedAppUsage |
| 857 |
private long mSourceNodeId = UNDEFINED_NODE_ID; |
| 858 |
private long mParentNodeId = UNDEFINED_NODE_ID; |
| 859 |
private long mLabelForId = UNDEFINED_NODE_ID; |
| 860 |
private long mLabeledById = UNDEFINED_NODE_ID; |
| 861 |
private long mTraversalBefore = UNDEFINED_NODE_ID; |
| 862 |
private long mTraversalAfter = UNDEFINED_NODE_ID; |
| 863 |
|
| 864 |
private int mBooleanProperties; |
| 865 |
private final Rect mBoundsInParent = new Rect(); |
| 866 |
private final Rect mBoundsInScreen = new Rect(); |
| 867 |
private int mDrawingOrderInParent; |
| 868 |
|
| 869 |
private CharSequence mPackageName; |
| 870 |
private CharSequence mClassName; |
| 871 |
|
| 872 |
private CharSequence mOriginalText; |
| 873 |
private CharSequence mText; |
| 874 |
private CharSequence mHintText; |
| 875 |
private CharSequence mError; |
| 876 |
private CharSequence mPaneTitle; |
| 877 |
private CharSequence mStateDescription; |
| 878 |
private CharSequence mContentDescription; |
| 879 |
private CharSequence mTooltipText; |
| 880 |
private String mViewIdResourceName; |
| 881 |
private String mUniqueId; |
| 882 |
private ArrayList<String> mExtraDataKeys; |
| 883 |
|
| 884 |
@UnsupportedAppUsage |
| 885 |
private LongArray mChildNodeIds; |
| 886 |
private ArrayList<AccessibilityAction> mActions; |
| 887 |
|
| 888 |
private int mMaxTextLength = -1; |
| 889 |
private int mMovementGranularities; |
| 890 |
|
| 891 |
private int mTextSelectionStart = UNDEFINED_SELECTION_INDEX; |
| 892 |
private int mTextSelectionEnd = UNDEFINED_SELECTION_INDEX; |
| 893 |
private int mInputType = InputType.TYPE_NULL; |
| 894 |
private int mLiveRegion = View.ACCESSIBILITY_LIVE_REGION_NONE; |
| 895 |
|
| 896 |
private Bundle mExtras; |
| 897 |
|
| 898 |
private int mConnectionId = UNDEFINED_CONNECTION_ID; |
| 899 |
|
| 900 |
private RangeInfo mRangeInfo; |
| 901 |
private CollectionInfo mCollectionInfo; |
| 902 |
private CollectionItemInfo mCollectionItemInfo; |
| 903 |
|
| 904 |
private TouchDelegateInfo mTouchDelegateInfo; |
| 905 |
|
| 906 |
private ExtraRenderingInfo mExtraRenderingInfo; |
| 907 |
|
| 908 |
private IBinder mLeashedChild; |
| 909 |
private IBinder mLeashedParent; |
| 910 |
private long mLeashedParentNodeId = UNDEFINED_NODE_ID; |
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
public AccessibilityNodeInfo() { |
| 916 |
} |
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
public AccessibilityNodeInfo(@NonNull View source) { |
| 924 |
setSource(source); |
| 925 |
} |
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
public AccessibilityNodeInfo(@NonNull View root, int virtualDescendantId) { |
| 934 |
setSource(root, virtualDescendantId); |
| 935 |
} |
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
public AccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) { |
| 944 |
init(info); |
| 945 |
} |
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
|
| 957 |
public void setSource(View source) { |
| 958 |
setSource(source, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 959 |
} |
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
public void setSource(View root, int virtualDescendantId) { |
| 981 |
enforceNotSealed(); |
| 982 |
mWindowId = (root != null) ? root.getAccessibilityWindowId() : UNDEFINED_ITEM_ID; |
| 983 |
final int rootAccessibilityViewId = |
| 984 |
(root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 985 |
mSourceNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 986 |
} |
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
|
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
public AccessibilityNodeInfo findFocus(int focus) { |
| 1009 |
enforceSealed(); |
| 1010 |
enforceValidFocusType(focus); |
| 1011 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1012 |
return null; |
| 1013 |
} |
| 1014 |
return AccessibilityInteractionClient.getInstance().findFocus(mConnectionId, mWindowId, |
| 1015 |
mSourceNodeId, focus); |
| 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 |
public AccessibilityNodeInfo focusSearch(int direction) { |
| 1041 |
enforceSealed(); |
| 1042 |
enforceValidFocusDirection(direction); |
| 1043 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1044 |
return null; |
| 1045 |
} |
| 1046 |
return AccessibilityInteractionClient.getInstance().focusSearch(mConnectionId, mWindowId, |
| 1047 |
mSourceNodeId, direction); |
| 1048 |
} |
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
public int getWindowId() { |
| 1056 |
return mWindowId; |
| 1057 |
} |
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 1068 |
public boolean refresh(Bundle arguments, boolean bypassCache) { |
| 1069 |
enforceSealed(); |
| 1070 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1071 |
return false; |
| 1072 |
} |
| 1073 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 1074 |
AccessibilityNodeInfo refreshedInfo = client.findAccessibilityNodeInfoByAccessibilityId( |
| 1075 |
mConnectionId, mWindowId, mSourceNodeId, bypassCache, 0, arguments); |
| 1076 |
if (refreshedInfo == null) { |
| 1077 |
return false; |
| 1078 |
} |
| 1079 |
init(refreshedInfo); |
| 1080 |
return true; |
| 1081 |
} |
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
|
| 1088 |
|
| 1089 |
public boolean refresh() { |
| 1090 |
return refresh(null, true); |
| 1091 |
} |
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
public boolean refreshWithExtraData(String extraDataKey, Bundle args) { |
| 1109 |
|
| 1110 |
|
| 1111 |
if (args.getInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH, -1) |
| 1112 |
> EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH) { |
| 1113 |
args.putInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH, |
| 1114 |
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH); |
| 1115 |
} |
| 1116 |
|
| 1117 |
args.putString(EXTRA_DATA_REQUESTED_KEY, extraDataKey); |
| 1118 |
return refresh(args, true); |
| 1119 |
} |
| 1120 |
|
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
public LongArray getChildNodeIds() { |
| 1127 |
return mChildNodeIds; |
| 1128 |
} |
| 1129 |
|
| 1130 |
|
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
public long getChildId(int index) { |
| 1138 |
if (mChildNodeIds == null) { |
| 1139 |
throw new IndexOutOfBoundsException(); |
| 1140 |
} |
| 1141 |
return mChildNodeIds.get(index); |
| 1142 |
} |
| 1143 |
|
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
|
| 1149 |
public int getChildCount() { |
| 1150 |
return mChildNodeIds == null ? 0 : mChildNodeIds.size(); |
| 1151 |
} |
| 1152 |
|
| 1153 |
|
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
|
| 1161 |
|
| 1162 |
public AccessibilityNodeInfo getChild(int index) { |
| 1163 |
return getChild(index, FLAG_PREFETCH_DESCENDANTS_HYBRID); |
| 1164 |
} |
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
@Nullable |
| 1179 |
public AccessibilityNodeInfo getChild(int index, @PrefetchingStrategy int prefetchingStrategy) { |
| 1180 |
enforceSealed(); |
| 1181 |
if (mChildNodeIds == null) { |
| 1182 |
return null; |
| 1183 |
} |
| 1184 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1185 |
return null; |
| 1186 |
} |
| 1187 |
final long childId = mChildNodeIds.get(index); |
| 1188 |
final AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 1189 |
if (mLeashedChild != null && childId == LEASHED_NODE_ID) { |
| 1190 |
return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, mLeashedChild, |
| 1191 |
ROOT_NODE_ID, false, prefetchingStrategy, null); |
| 1192 |
} |
| 1193 |
|
| 1194 |
return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, mWindowId, |
| 1195 |
childId, false, prefetchingStrategy, null); |
| 1196 |
} |
| 1197 |
|
| 1198 |
|
| 1199 |
|
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
|
| 1204 |
|
| 1205 |
|
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 |
|
| 1210 |
|
| 1211 |
public void addChild(View child) { |
| 1212 |
addChildInternal(child, AccessibilityNodeProvider.HOST_VIEW_ID, true); |
| 1213 |
} |
| 1214 |
|
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
|
| 1221 |
|
| 1222 |
|
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
|
| 1230 |
|
| 1231 |
|
| 1232 |
|
| 1233 |
@TestApi |
| 1234 |
public void addChild(@NonNull IBinder token) { |
| 1235 |
enforceNotSealed(); |
| 1236 |
if (token == null) { |
| 1237 |
return; |
| 1238 |
} |
| 1239 |
if (mChildNodeIds == null) { |
| 1240 |
mChildNodeIds = new LongArray(); |
| 1241 |
} |
| 1242 |
|
| 1243 |
mLeashedChild = token; |
| 1244 |
|
| 1245 |
|
| 1246 |
if (mChildNodeIds.indexOf(LEASHED_NODE_ID) >= 0) { |
| 1247 |
return; |
| 1248 |
} |
| 1249 |
mChildNodeIds.add(LEASHED_NODE_ID); |
| 1250 |
} |
| 1251 |
|
| 1252 |
|
| 1253 |
|
| 1254 |
|
| 1255 |
|
| 1256 |
|
| 1257 |
|
| 1258 |
public void addChildUnchecked(View child) { |
| 1259 |
addChildInternal(child, AccessibilityNodeProvider.HOST_VIEW_ID, false); |
| 1260 |
} |
| 1261 |
|
| 1262 |
|
| 1263 |
|
| 1264 |
|
| 1265 |
|
| 1266 |
|
| 1267 |
|
| 1268 |
|
| 1269 |
|
| 1270 |
|
| 1271 |
|
| 1272 |
|
| 1273 |
|
| 1274 |
|
| 1275 |
|
| 1276 |
public boolean removeChild(View child) { |
| 1277 |
return removeChild(child, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 1278 |
} |
| 1279 |
|
| 1280 |
|
| 1281 |
|
| 1282 |
|
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
public boolean removeChild(IBinder token) { |
| 1296 |
enforceNotSealed(); |
| 1297 |
if (mChildNodeIds == null || mLeashedChild == null) { |
| 1298 |
return false; |
| 1299 |
} |
| 1300 |
if (!mLeashedChild.equals(token)) { |
| 1301 |
return false; |
| 1302 |
} |
| 1303 |
final int index = mChildNodeIds.indexOf(LEASHED_NODE_ID); |
| 1304 |
mLeashedChild = null; |
| 1305 |
if (index < 0) { |
| 1306 |
return false; |
| 1307 |
} |
| 1308 |
mChildNodeIds.remove(index); |
| 1309 |
return true; |
| 1310 |
} |
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
public void addChild(View root, int virtualDescendantId) { |
| 1328 |
addChildInternal(root, virtualDescendantId, true); |
| 1329 |
} |
| 1330 |
|
| 1331 |
private void addChildInternal(View root, int virtualDescendantId, boolean checked) { |
| 1332 |
enforceNotSealed(); |
| 1333 |
if (mChildNodeIds == null) { |
| 1334 |
mChildNodeIds = new LongArray(); |
| 1335 |
} |
| 1336 |
final int rootAccessibilityViewId = |
| 1337 |
(root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 1338 |
final long childNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 1339 |
if (childNodeId == mSourceNodeId) { |
| 1340 |
Log.e(TAG, "Rejecting attempt to make a View its own child"); |
| 1341 |
return; |
| 1342 |
} |
| 1343 |
|
| 1344 |
|
| 1345 |
if (checked && mChildNodeIds.indexOf(childNodeId) >= 0) { |
| 1346 |
return; |
| 1347 |
} |
| 1348 |
mChildNodeIds.add(childNodeId); |
| 1349 |
} |
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
|
| 1354 |
|
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
|
| 1359 |
|
| 1360 |
|
| 1361 |
public boolean removeChild(View root, int virtualDescendantId) { |
| 1362 |
enforceNotSealed(); |
| 1363 |
final LongArray childIds = mChildNodeIds; |
| 1364 |
if (childIds == null) { |
| 1365 |
return false; |
| 1366 |
} |
| 1367 |
final int rootAccessibilityViewId = |
| 1368 |
(root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 1369 |
final long childNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 1370 |
final int index = childIds.indexOf(childNodeId); |
| 1371 |
if (index < 0) { |
| 1372 |
return false; |
| 1373 |
} |
| 1374 |
childIds.remove(index); |
| 1375 |
return true; |
| 1376 |
} |
| 1377 |
|
| 1378 |
|
| 1379 |
|
| 1380 |
|
| 1381 |
public List<AccessibilityAction> getActionList() { |
| 1382 |
return CollectionUtils.emptyIfNull(mActions); |
| 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 |
@Deprecated |
| 1408 |
public int getActions() { |
| 1409 |
int returnValue = 0; |
| 1410 |
|
| 1411 |
if (mActions == null) { |
| 1412 |
return returnValue; |
| 1413 |
} |
| 1414 |
|
| 1415 |
final int actionSize = mActions.size(); |
| 1416 |
for (int i = 0; i < actionSize; i++) { |
| 1417 |
int actionId = mActions.get(i).getId(); |
| 1418 |
if (actionId <= LAST_LEGACY_STANDARD_ACTION) { |
| 1419 |
returnValue |= actionId; |
| 1420 |
} |
| 1421 |
} |
| 1422 |
|
| 1423 |
return returnValue; |
| 1424 |
} |
| 1425 |
|
| 1426 |
|
| 1427 |
|
| 1428 |
|
| 1429 |
|
| 1430 |
|
| 1431 |
|
| 1432 |
|
| 1433 |
|
| 1434 |
|
| 1435 |
|
| 1436 |
|
| 1437 |
|
| 1438 |
|
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
|
| 1446 |
public void addAction(AccessibilityAction action) { |
| 1447 |
enforceNotSealed(); |
| 1448 |
|
| 1449 |
addActionUnchecked(action); |
| 1450 |
} |
| 1451 |
|
| 1452 |
private void addActionUnchecked(AccessibilityAction action) { |
| 1453 |
if (action == null) { |
| 1454 |
return; |
| 1455 |
} |
| 1456 |
|
| 1457 |
if (mActions == null) { |
| 1458 |
mActions = new ArrayList<>(); |
| 1459 |
} |
| 1460 |
|
| 1461 |
mActions.remove(action); |
| 1462 |
mActions.add(action); |
| 1463 |
} |
| 1464 |
|
| 1465 |
|
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
|
| 1478 |
|
| 1479 |
|
| 1480 |
@Deprecated |
| 1481 |
public void addAction(int action) { |
| 1482 |
enforceNotSealed(); |
| 1483 |
|
| 1484 |
if ((action & ACTION_TYPE_MASK) != 0) { |
| 1485 |
throw new IllegalArgumentException("Action is not a combination of the standard " + |
| 1486 |
"actions: " + action); |
| 1487 |
} |
| 1488 |
|
| 1489 |
addStandardActions(action); |
| 1490 |
} |
| 1491 |
|
| 1492 |
|
| 1493 |
|
| 1494 |
|
| 1495 |
|
| 1496 |
|
| 1497 |
|
| 1498 |
|
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
|
| 1503 |
|
| 1504 |
|
| 1505 |
|
| 1506 |
@Deprecated |
| 1507 |
public void removeAction(int action) { |
| 1508 |
enforceNotSealed(); |
| 1509 |
|
| 1510 |
removeAction(getActionSingleton(action)); |
| 1511 |
} |
| 1512 |
|
| 1513 |
|
| 1514 |
|
| 1515 |
|
| 1516 |
|
| 1517 |
|
| 1518 |
|
| 1519 |
|
| 1520 |
|
| 1521 |
|
| 1522 |
|
| 1523 |
|
| 1524 |
|
| 1525 |
|
| 1526 |
|
| 1527 |
public boolean removeAction(AccessibilityAction action) { |
| 1528 |
enforceNotSealed(); |
| 1529 |
|
| 1530 |
if (mActions == null || action == null) { |
| 1531 |
return false; |
| 1532 |
} |
| 1533 |
|
| 1534 |
return mActions.remove(action); |
| 1535 |
} |
| 1536 |
|
| 1537 |
|
| 1538 |
|
| 1539 |
|
| 1540 |
|
| 1541 |
|
| 1542 |
public void removeAllActions() { |
| 1543 |
if (mActions != null) { |
| 1544 |
mActions.clear(); |
| 1545 |
} |
| 1546 |
} |
| 1547 |
|
| 1548 |
|
| 1549 |
|
| 1550 |
|
| 1551 |
|
| 1552 |
|
| 1553 |
|
| 1554 |
|
| 1555 |
|
| 1556 |
|
| 1557 |
public AccessibilityNodeInfo getTraversalBefore() { |
| 1558 |
enforceSealed(); |
| 1559 |
return getNodeForAccessibilityId(mConnectionId, mWindowId, mTraversalBefore); |
| 1560 |
} |
| 1561 |
|
| 1562 |
|
| 1563 |
|
| 1564 |
|
| 1565 |
|
| 1566 |
|
| 1567 |
|
| 1568 |
|
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 1574 |
|
| 1575 |
|
| 1576 |
public void setTraversalBefore(View view) { |
| 1577 |
setTraversalBefore(view, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 1578 |
} |
| 1579 |
|
| 1580 |
|
| 1581 |
|
| 1582 |
|
| 1583 |
|
| 1584 |
|
| 1585 |
|
| 1586 |
|
| 1587 |
|
| 1588 |
|
| 1589 |
|
| 1590 |
|
| 1591 |
|
| 1592 |
|
| 1593 |
|
| 1594 |
|
| 1595 |
|
| 1596 |
|
| 1597 |
|
| 1598 |
|
| 1599 |
|
| 1600 |
|
| 1601 |
public void setTraversalBefore(View root, int virtualDescendantId) { |
| 1602 |
enforceNotSealed(); |
| 1603 |
final int rootAccessibilityViewId = (root != null) |
| 1604 |
? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 1605 |
mTraversalBefore = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 1606 |
} |
| 1607 |
|
| 1608 |
|
| 1609 |
|
| 1610 |
|
| 1611 |
|
| 1612 |
|
| 1613 |
|
| 1614 |
|
| 1615 |
|
| 1616 |
|
| 1617 |
|
| 1618 |
public AccessibilityNodeInfo getTraversalAfter() { |
| 1619 |
enforceSealed(); |
| 1620 |
return getNodeForAccessibilityId(mConnectionId, mWindowId, mTraversalAfter); |
| 1621 |
} |
| 1622 |
|
| 1623 |
|
| 1624 |
|
| 1625 |
|
| 1626 |
|
| 1627 |
|
| 1628 |
|
| 1629 |
|
| 1630 |
|
| 1631 |
|
| 1632 |
|
| 1633 |
|
| 1634 |
|
| 1635 |
|
| 1636 |
|
| 1637 |
public void setTraversalAfter(View view) { |
| 1638 |
setTraversalAfter(view, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 1639 |
} |
| 1640 |
|
| 1641 |
|
| 1642 |
|
| 1643 |
|
| 1644 |
|
| 1645 |
|
| 1646 |
|
| 1647 |
|
| 1648 |
|
| 1649 |
|
| 1650 |
|
| 1651 |
|
| 1652 |
|
| 1653 |
|
| 1654 |
|
| 1655 |
|
| 1656 |
|
| 1657 |
|
| 1658 |
|
| 1659 |
|
| 1660 |
|
| 1661 |
public void setTraversalAfter(View root, int virtualDescendantId) { |
| 1662 |
enforceNotSealed(); |
| 1663 |
final int rootAccessibilityViewId = (root != null) |
| 1664 |
? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 1665 |
mTraversalAfter = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 1666 |
} |
| 1667 |
|
| 1668 |
|
| 1669 |
|
| 1670 |
|
| 1671 |
|
| 1672 |
|
| 1673 |
|
| 1674 |
|
| 1675 |
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
public List<String> getAvailableExtraData() { |
| 1680 |
if (mExtraDataKeys != null) { |
| 1681 |
return Collections.unmodifiableList(mExtraDataKeys); |
| 1682 |
} else { |
| 1683 |
return EMPTY_LIST; |
| 1684 |
} |
| 1685 |
} |
| 1686 |
|
| 1687 |
|
| 1688 |
|
| 1689 |
|
| 1690 |
|
| 1691 |
|
| 1692 |
|
| 1693 |
|
| 1694 |
|
| 1695 |
|
| 1696 |
|
| 1697 |
|
| 1698 |
|
| 1699 |
|
| 1700 |
|
| 1701 |
|
| 1702 |
|
| 1703 |
public void setAvailableExtraData(List<String> extraDataKeys) { |
| 1704 |
enforceNotSealed(); |
| 1705 |
mExtraDataKeys = new ArrayList<>(extraDataKeys); |
| 1706 |
} |
| 1707 |
|
| 1708 |
|
| 1709 |
|
| 1710 |
|
| 1711 |
|
| 1712 |
|
| 1713 |
|
| 1714 |
|
| 1715 |
|
| 1716 |
|
| 1717 |
|
| 1718 |
|
| 1719 |
|
| 1720 |
|
| 1721 |
|
| 1722 |
|
| 1723 |
public void setMaxTextLength(int max) { |
| 1724 |
enforceNotSealed(); |
| 1725 |
mMaxTextLength = max; |
| 1726 |
} |
| 1727 |
|
| 1728 |
|
| 1729 |
|
| 1730 |
|
| 1731 |
|
| 1732 |
|
| 1733 |
|
| 1734 |
public int getMaxTextLength() { |
| 1735 |
return mMaxTextLength; |
| 1736 |
} |
| 1737 |
|
| 1738 |
|
| 1739 |
|
| 1740 |
|
| 1741 |
|
| 1742 |
|
| 1743 |
|
| 1744 |
|
| 1745 |
|
| 1746 |
|
| 1747 |
|
| 1748 |
|
| 1749 |
|
| 1750 |
public void setMovementGranularities(int granularities) { |
| 1751 |
enforceNotSealed(); |
| 1752 |
mMovementGranularities = granularities; |
| 1753 |
} |
| 1754 |
|
| 1755 |
|
| 1756 |
|
| 1757 |
|
| 1758 |
|
| 1759 |
|
| 1760 |
public int getMovementGranularities() { |
| 1761 |
return mMovementGranularities; |
| 1762 |
} |
| 1763 |
|
| 1764 |
|
| 1765 |
|
| 1766 |
|
| 1767 |
|
| 1768 |
|
| 1769 |
|
| 1770 |
|
| 1771 |
|
| 1772 |
|
| 1773 |
|
| 1774 |
|
| 1775 |
|
| 1776 |
public boolean performAction(int action) { |
| 1777 |
enforceSealed(); |
| 1778 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1779 |
return false; |
| 1780 |
} |
| 1781 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 1782 |
Bundle arguments = null; |
| 1783 |
if (mExtras != null) { |
| 1784 |
arguments = mExtras; |
| 1785 |
} |
| 1786 |
return client.performAccessibilityAction(mConnectionId, mWindowId, mSourceNodeId, |
| 1787 |
action, arguments); |
| 1788 |
} |
| 1789 |
|
| 1790 |
|
| 1791 |
|
| 1792 |
|
| 1793 |
|
| 1794 |
|
| 1795 |
|
| 1796 |
|
| 1797 |
|
| 1798 |
|
| 1799 |
|
| 1800 |
|
| 1801 |
|
| 1802 |
|
| 1803 |
public boolean performAction(int action, Bundle arguments) { |
| 1804 |
enforceSealed(); |
| 1805 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1806 |
return false; |
| 1807 |
} |
| 1808 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 1809 |
return client.performAccessibilityAction(mConnectionId, mWindowId, mSourceNodeId, |
| 1810 |
action, arguments); |
| 1811 |
} |
| 1812 |
|
| 1813 |
|
| 1814 |
|
| 1815 |
|
| 1816 |
|
| 1817 |
|
| 1818 |
|
| 1819 |
|
| 1820 |
|
| 1821 |
|
| 1822 |
|
| 1823 |
|
| 1824 |
|
| 1825 |
|
| 1826 |
|
| 1827 |
|
| 1828 |
|
| 1829 |
public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String text) { |
| 1830 |
enforceSealed(); |
| 1831 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1832 |
return Collections.emptyList(); |
| 1833 |
} |
| 1834 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 1835 |
return client.findAccessibilityNodeInfosByText(mConnectionId, mWindowId, mSourceNodeId, |
| 1836 |
text); |
| 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 |
public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByViewId(@NonNull String viewId) { |
| 1863 |
enforceSealed(); |
| 1864 |
if (viewId == null) { |
| 1865 |
Log.e(TAG, "returns empty list due to null viewId."); |
| 1866 |
return Collections.emptyList(); |
| 1867 |
} |
| 1868 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1869 |
return Collections.emptyList(); |
| 1870 |
} |
| 1871 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 1872 |
return client.findAccessibilityNodeInfosByViewId(mConnectionId, mWindowId, mSourceNodeId, |
| 1873 |
viewId); |
| 1874 |
} |
| 1875 |
|
| 1876 |
|
| 1877 |
|
| 1878 |
|
| 1879 |
|
| 1880 |
|
| 1881 |
|
| 1882 |
|
| 1883 |
public AccessibilityWindowInfo getWindow() { |
| 1884 |
enforceSealed(); |
| 1885 |
if (!canPerformRequestOverConnection(mConnectionId, mWindowId, mSourceNodeId)) { |
| 1886 |
return null; |
| 1887 |
} |
| 1888 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 1889 |
return client.getWindow(mConnectionId, mWindowId); |
| 1890 |
} |
| 1891 |
|
| 1892 |
|
| 1893 |
|
| 1894 |
|
| 1895 |
|
| 1896 |
|
| 1897 |
public AccessibilityNodeInfo getParent() { |
| 1898 |
enforceSealed(); |
| 1899 |
if (mLeashedParent != null && mLeashedParentNodeId != UNDEFINED_NODE_ID) { |
| 1900 |
return getNodeForAccessibilityId(mConnectionId, mLeashedParent, mLeashedParentNodeId, |
| 1901 |
FLAG_PREFETCH_ANCESTORS | FLAG_PREFETCH_SIBLINGS); |
| 1902 |
} |
| 1903 |
return getNodeForAccessibilityId(mConnectionId, mWindowId, mParentNodeId); |
| 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 |
@Nullable |
| 1933 |
public AccessibilityNodeInfo getParent(@PrefetchingStrategy int prefetchingStrategy) { |
| 1934 |
enforceSealed(); |
| 1935 |
if (mLeashedParent != null && mLeashedParentNodeId != UNDEFINED_NODE_ID) { |
| 1936 |
return getNodeForAccessibilityId(mConnectionId, mLeashedParent, mLeashedParentNodeId, |
| 1937 |
prefetchingStrategy); |
| 1938 |
} |
| 1939 |
return getNodeForAccessibilityId(mConnectionId, mWindowId, mParentNodeId, |
| 1940 |
prefetchingStrategy); |
| 1941 |
} |
| 1942 |
|
| 1943 |
|
| 1944 |
|
| 1945 |
|
| 1946 |
|
| 1947 |
|
| 1948 |
public long getParentNodeId() { |
| 1949 |
return mParentNodeId; |
| 1950 |
} |
| 1951 |
|
| 1952 |
|
| 1953 |
|
| 1954 |
|
| 1955 |
|
| 1956 |
|
| 1957 |
|
| 1958 |
|
| 1959 |
|
| 1960 |
|
| 1961 |
|
| 1962 |
|
| 1963 |
|
| 1964 |
public void setParent(View parent) { |
| 1965 |
setParent(parent, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 1966 |
} |
| 1967 |
|
| 1968 |
|
| 1969 |
|
| 1970 |
|
| 1971 |
|
| 1972 |
|
| 1973 |
|
| 1974 |
|
| 1975 |
|
| 1976 |
|
| 1977 |
|
| 1978 |
|
| 1979 |
|
| 1980 |
|
| 1981 |
|
| 1982 |
|
| 1983 |
|
| 1984 |
|
| 1985 |
|
| 1986 |
|
| 1987 |
public void setParent(View root, int virtualDescendantId) { |
| 1988 |
enforceNotSealed(); |
| 1989 |
final int rootAccessibilityViewId = |
| 1990 |
(root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 1991 |
mParentNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 1992 |
} |
| 1993 |
|
| 1994 |
|
| 1995 |
|
| 1996 |
|
| 1997 |
|
| 1998 |
|
| 1999 |
|
| 2000 |
|
| 2001 |
|
| 2002 |
|
| 2003 |
|
| 2004 |
|
| 2005 |
|
| 2006 |
|
| 2007 |
|
| 2008 |
|
| 2009 |
|
| 2010 |
@Deprecated |
| 2011 |
public void getBoundsInParent(Rect outBounds) { |
| 2012 |
outBounds.set(mBoundsInParent.left, mBoundsInParent.top, |
| 2013 |
mBoundsInParent.right, mBoundsInParent.bottom); |
| 2014 |
} |
| 2015 |
|
| 2016 |
|
| 2017 |
|
| 2018 |
|
| 2019 |
|
| 2020 |
|
| 2021 |
|
| 2022 |
|
| 2023 |
|
| 2024 |
|
| 2025 |
|
| 2026 |
|
| 2027 |
|
| 2028 |
|
| 2029 |
|
| 2030 |
|
| 2031 |
|
| 2032 |
|
| 2033 |
|
| 2034 |
@Deprecated |
| 2035 |
public void setBoundsInParent(Rect bounds) { |
| 2036 |
enforceNotSealed(); |
| 2037 |
mBoundsInParent.set(bounds.left, bounds.top, bounds.right, bounds.bottom); |
| 2038 |
} |
| 2039 |
|
| 2040 |
|
| 2041 |
|
| 2042 |
|
| 2043 |
|
| 2044 |
|
| 2045 |
|
| 2046 |
|
| 2047 |
|
| 2048 |
|
| 2049 |
|
| 2050 |
|
| 2051 |
public void getBoundsInScreen(Rect outBounds) { |
| 2052 |
outBounds.set(mBoundsInScreen.left, mBoundsInScreen.top, |
| 2053 |
mBoundsInScreen.right, mBoundsInScreen.bottom); |
| 2054 |
} |
| 2055 |
|
| 2056 |
|
| 2057 |
|
| 2058 |
|
| 2059 |
|
| 2060 |
|
| 2061 |
public Rect getBoundsInScreen() { |
| 2062 |
return mBoundsInScreen; |
| 2063 |
} |
| 2064 |
|
| 2065 |
|
| 2066 |
|
| 2067 |
|
| 2068 |
|
| 2069 |
|
| 2070 |
|
| 2071 |
|
| 2072 |
|
| 2073 |
|
| 2074 |
|
| 2075 |
|
| 2076 |
|
| 2077 |
public void setBoundsInScreen(Rect bounds) { |
| 2078 |
enforceNotSealed(); |
| 2079 |
mBoundsInScreen.set(bounds.left, bounds.top, bounds.right, bounds.bottom); |
| 2080 |
} |
| 2081 |
|
| 2082 |
|
| 2083 |
|
| 2084 |
|
| 2085 |
|
| 2086 |
|
| 2087 |
public boolean isCheckable() { |
| 2088 |
return getBooleanProperty(BOOLEAN_PROPERTY_CHECKABLE); |
| 2089 |
} |
| 2090 |
|
| 2091 |
|
| 2092 |
|
| 2093 |
|
| 2094 |
|
| 2095 |
|
| 2096 |
|
| 2097 |
|
| 2098 |
|
| 2099 |
|
| 2100 |
|
| 2101 |
|
| 2102 |
|
| 2103 |
public void setCheckable(boolean checkable) { |
| 2104 |
setBooleanProperty(BOOLEAN_PROPERTY_CHECKABLE, checkable); |
| 2105 |
} |
| 2106 |
|
| 2107 |
|
| 2108 |
|
| 2109 |
|
| 2110 |
|
| 2111 |
|
| 2112 |
public boolean isChecked() { |
| 2113 |
return getBooleanProperty(BOOLEAN_PROPERTY_CHECKED); |
| 2114 |
} |
| 2115 |
|
| 2116 |
|
| 2117 |
|
| 2118 |
|
| 2119 |
|
| 2120 |
|
| 2121 |
|
| 2122 |
|
| 2123 |
|
| 2124 |
|
| 2125 |
|
| 2126 |
|
| 2127 |
|
| 2128 |
public void setChecked(boolean checked) { |
| 2129 |
setBooleanProperty(BOOLEAN_PROPERTY_CHECKED, checked); |
| 2130 |
} |
| 2131 |
|
| 2132 |
|
| 2133 |
|
| 2134 |
|
| 2135 |
|
| 2136 |
|
| 2137 |
public boolean isFocusable() { |
| 2138 |
return getBooleanProperty(BOOLEAN_PROPERTY_FOCUSABLE); |
| 2139 |
} |
| 2140 |
|
| 2141 |
|
| 2142 |
|
| 2143 |
|
| 2144 |
|
| 2145 |
|
| 2146 |
|
| 2147 |
|
| 2148 |
|
| 2149 |
|
| 2150 |
|
| 2151 |
|
| 2152 |
|
| 2153 |
public void setFocusable(boolean focusable) { |
| 2154 |
setBooleanProperty(BOOLEAN_PROPERTY_FOCUSABLE, focusable); |
| 2155 |
} |
| 2156 |
|
| 2157 |
|
| 2158 |
|
| 2159 |
|
| 2160 |
|
| 2161 |
|
| 2162 |
public boolean isFocused() { |
| 2163 |
return getBooleanProperty(BOOLEAN_PROPERTY_FOCUSED); |
| 2164 |
} |
| 2165 |
|
| 2166 |
|
| 2167 |
|
| 2168 |
|
| 2169 |
|
| 2170 |
|
| 2171 |
|
| 2172 |
|
| 2173 |
|
| 2174 |
|
| 2175 |
|
| 2176 |
|
| 2177 |
|
| 2178 |
public void setFocused(boolean focused) { |
| 2179 |
setBooleanProperty(BOOLEAN_PROPERTY_FOCUSED, focused); |
| 2180 |
} |
| 2181 |
|
| 2182 |
|
| 2183 |
|
| 2184 |
|
| 2185 |
|
| 2186 |
|
| 2187 |
|
| 2188 |
|
| 2189 |
|
| 2190 |
|
| 2191 |
|
| 2192 |
|
| 2193 |
public boolean isVisibleToUser() { |
| 2194 |
return getBooleanProperty(BOOLEAN_PROPERTY_VISIBLE_TO_USER); |
| 2195 |
} |
| 2196 |
|
| 2197 |
|
| 2198 |
|
| 2199 |
|
| 2200 |
|
| 2201 |
|
| 2202 |
|
| 2203 |
|
| 2204 |
|
| 2205 |
|
| 2206 |
|
| 2207 |
|
| 2208 |
|
| 2209 |
public void setVisibleToUser(boolean visibleToUser) { |
| 2210 |
setBooleanProperty(BOOLEAN_PROPERTY_VISIBLE_TO_USER, visibleToUser); |
| 2211 |
} |
| 2212 |
|
| 2213 |
|
| 2214 |
|
| 2215 |
|
| 2216 |
|
| 2217 |
|
| 2218 |
public boolean isAccessibilityFocused() { |
| 2219 |
return getBooleanProperty(BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED); |
| 2220 |
} |
| 2221 |
|
| 2222 |
|
| 2223 |
|
| 2224 |
|
| 2225 |
|
| 2226 |
|
| 2227 |
|
| 2228 |
|
| 2229 |
|
| 2230 |
|
| 2231 |
|
| 2232 |
|
| 2233 |
|
| 2234 |
public void setAccessibilityFocused(boolean focused) { |
| 2235 |
setBooleanProperty(BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED, focused); |
| 2236 |
} |
| 2237 |
|
| 2238 |
|
| 2239 |
|
| 2240 |
|
| 2241 |
|
| 2242 |
|
| 2243 |
public boolean isSelected() { |
| 2244 |
return getBooleanProperty(BOOLEAN_PROPERTY_SELECTED); |
| 2245 |
} |
| 2246 |
|
| 2247 |
|
| 2248 |
|
| 2249 |
|
| 2250 |
|
| 2251 |
|
| 2252 |
|
| 2253 |
|
| 2254 |
|
| 2255 |
|
| 2256 |
|
| 2257 |
|
| 2258 |
|
| 2259 |
public void setSelected(boolean selected) { |
| 2260 |
setBooleanProperty(BOOLEAN_PROPERTY_SELECTED, selected); |
| 2261 |
} |
| 2262 |
|
| 2263 |
|
| 2264 |
|
| 2265 |
|
| 2266 |
|
| 2267 |
|
| 2268 |
public boolean isClickable() { |
| 2269 |
return getBooleanProperty(BOOLEAN_PROPERTY_CLICKABLE); |
| 2270 |
} |
| 2271 |
|
| 2272 |
|
| 2273 |
|
| 2274 |
|
| 2275 |
|
| 2276 |
|
| 2277 |
|
| 2278 |
|
| 2279 |
|
| 2280 |
|
| 2281 |
|
| 2282 |
|
| 2283 |
|
| 2284 |
public void setClickable(boolean clickable) { |
| 2285 |
setBooleanProperty(BOOLEAN_PROPERTY_CLICKABLE, clickable); |
| 2286 |
} |
| 2287 |
|
| 2288 |
|
| 2289 |
|
| 2290 |
|
| 2291 |
|
| 2292 |
|
| 2293 |
public boolean isLongClickable() { |
| 2294 |
return getBooleanProperty(BOOLEAN_PROPERTY_LONG_CLICKABLE); |
| 2295 |
} |
| 2296 |
|
| 2297 |
|
| 2298 |
|
| 2299 |
|
| 2300 |
|
| 2301 |
|
| 2302 |
|
| 2303 |
|
| 2304 |
|
| 2305 |
|
| 2306 |
|
| 2307 |
|
| 2308 |
|
| 2309 |
public void setLongClickable(boolean longClickable) { |
| 2310 |
setBooleanProperty(BOOLEAN_PROPERTY_LONG_CLICKABLE, longClickable); |
| 2311 |
} |
| 2312 |
|
| 2313 |
|
| 2314 |
|
| 2315 |
|
| 2316 |
|
| 2317 |
|
| 2318 |
public boolean isEnabled() { |
| 2319 |
return getBooleanProperty(BOOLEAN_PROPERTY_ENABLED); |
| 2320 |
} |
| 2321 |
|
| 2322 |
|
| 2323 |
|
| 2324 |
|
| 2325 |
|
| 2326 |
|
| 2327 |
|
| 2328 |
|
| 2329 |
|
| 2330 |
|
| 2331 |
|
| 2332 |
|
| 2333 |
|
| 2334 |
public void setEnabled(boolean enabled) { |
| 2335 |
setBooleanProperty(BOOLEAN_PROPERTY_ENABLED, enabled); |
| 2336 |
} |
| 2337 |
|
| 2338 |
|
| 2339 |
|
| 2340 |
|
| 2341 |
|
| 2342 |
|
| 2343 |
public boolean isPassword() { |
| 2344 |
return getBooleanProperty(BOOLEAN_PROPERTY_PASSWORD); |
| 2345 |
} |
| 2346 |
|
| 2347 |
|
| 2348 |
|
| 2349 |
|
| 2350 |
|
| 2351 |
|
| 2352 |
|
| 2353 |
|
| 2354 |
|
| 2355 |
|
| 2356 |
|
| 2357 |
|
| 2358 |
|
| 2359 |
public void setPassword(boolean password) { |
| 2360 |
setBooleanProperty(BOOLEAN_PROPERTY_PASSWORD, password); |
| 2361 |
} |
| 2362 |
|
| 2363 |
|
| 2364 |
|
| 2365 |
|
| 2366 |
|
| 2367 |
|
| 2368 |
public boolean isScrollable() { |
| 2369 |
return getBooleanProperty(BOOLEAN_PROPERTY_SCROLLABLE); |
| 2370 |
} |
| 2371 |
|
| 2372 |
|
| 2373 |
|
| 2374 |
|
| 2375 |
|
| 2376 |
|
| 2377 |
|
| 2378 |
|
| 2379 |
|
| 2380 |
|
| 2381 |
|
| 2382 |
|
| 2383 |
|
| 2384 |
public void setScrollable(boolean scrollable) { |
| 2385 |
setBooleanProperty(BOOLEAN_PROPERTY_SCROLLABLE, scrollable); |
| 2386 |
} |
| 2387 |
|
| 2388 |
|
| 2389 |
|
| 2390 |
|
| 2391 |
|
| 2392 |
|
| 2393 |
|
| 2394 |
|
| 2395 |
|
| 2396 |
|
| 2397 |
|
| 2398 |
|
| 2399 |
|
| 2400 |
public boolean isTextSelectable() { |
| 2401 |
return getBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_SELECTABLE); |
| 2402 |
} |
| 2403 |
|
| 2404 |
|
| 2405 |
|
| 2406 |
|
| 2407 |
|
| 2408 |
|
| 2409 |
|
| 2410 |
|
| 2411 |
|
| 2412 |
|
| 2413 |
|
| 2414 |
|
| 2415 |
|
| 2416 |
public void setTextSelectable(boolean selectableText) { |
| 2417 |
setBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_SELECTABLE, selectableText); |
| 2418 |
} |
| 2419 |
|
| 2420 |
|
| 2421 |
|
| 2422 |
|
| 2423 |
|
| 2424 |
|
| 2425 |
public boolean isEditable() { |
| 2426 |
return getBooleanProperty(BOOLEAN_PROPERTY_EDITABLE); |
| 2427 |
} |
| 2428 |
|
| 2429 |
|
| 2430 |
|
| 2431 |
|
| 2432 |
|
| 2433 |
|
| 2434 |
|
| 2435 |
|
| 2436 |
|
| 2437 |
|
| 2438 |
|
| 2439 |
|
| 2440 |
|
| 2441 |
public void setEditable(boolean editable) { |
| 2442 |
setBooleanProperty(BOOLEAN_PROPERTY_EDITABLE, editable); |
| 2443 |
} |
| 2444 |
|
| 2445 |
|
| 2446 |
|
| 2447 |
|
| 2448 |
|
| 2449 |
|
| 2450 |
|
| 2451 |
|
| 2452 |
|
| 2453 |
|
| 2454 |
|
| 2455 |
|
| 2456 |
public void setPaneTitle(@Nullable CharSequence paneTitle) { |
| 2457 |
enforceNotSealed(); |
| 2458 |
mPaneTitle = (paneTitle == null) |
| 2459 |
? null : paneTitle.subSequence(0, paneTitle.length()); |
| 2460 |
} |
| 2461 |
|
| 2462 |
|
| 2463 |
|
| 2464 |
|
| 2465 |
|
| 2466 |
|
| 2467 |
|
| 2468 |
public @Nullable CharSequence getPaneTitle() { |
| 2469 |
return mPaneTitle; |
| 2470 |
} |
| 2471 |
|
| 2472 |
|
| 2473 |
|
| 2474 |
|
| 2475 |
|
| 2476 |
|
| 2477 |
|
| 2478 |
|
| 2479 |
|
| 2480 |
|
| 2481 |
|
| 2482 |
|
| 2483 |
public int getDrawingOrder() { |
| 2484 |
return mDrawingOrderInParent; |
| 2485 |
} |
| 2486 |
|
| 2487 |
|
| 2488 |
|
| 2489 |
|
| 2490 |
|
| 2491 |
|
| 2492 |
|
| 2493 |
|
| 2494 |
|
| 2495 |
|
| 2496 |
|
| 2497 |
|
| 2498 |
public void setDrawingOrder(int drawingOrderInParent) { |
| 2499 |
enforceNotSealed(); |
| 2500 |
mDrawingOrderInParent = drawingOrderInParent; |
| 2501 |
} |
| 2502 |
|
| 2503 |
|
| 2504 |
|
| 2505 |
|
| 2506 |
|
| 2507 |
|
| 2508 |
|
| 2509 |
public CollectionInfo getCollectionInfo() { |
| 2510 |
return mCollectionInfo; |
| 2511 |
} |
| 2512 |
|
| 2513 |
|
| 2514 |
|
| 2515 |
|
| 2516 |
|
| 2517 |
|
| 2518 |
|
| 2519 |
|
| 2520 |
|
| 2521 |
|
| 2522 |
|
| 2523 |
|
| 2524 |
public void setCollectionInfo(CollectionInfo collectionInfo) { |
| 2525 |
enforceNotSealed(); |
| 2526 |
mCollectionInfo = collectionInfo; |
| 2527 |
} |
| 2528 |
|
| 2529 |
|
| 2530 |
|
| 2531 |
|
| 2532 |
|
| 2533 |
|
| 2534 |
|
| 2535 |
public CollectionItemInfo getCollectionItemInfo() { |
| 2536 |
return mCollectionItemInfo; |
| 2537 |
} |
| 2538 |
|
| 2539 |
|
| 2540 |
|
| 2541 |
|
| 2542 |
|
| 2543 |
|
| 2544 |
|
| 2545 |
|
| 2546 |
|
| 2547 |
|
| 2548 |
public void setCollectionItemInfo(CollectionItemInfo collectionItemInfo) { |
| 2549 |
enforceNotSealed(); |
| 2550 |
mCollectionItemInfo = collectionItemInfo; |
| 2551 |
} |
| 2552 |
|
| 2553 |
|
| 2554 |
|
| 2555 |
|
| 2556 |
|
| 2557 |
|
| 2558 |
public RangeInfo getRangeInfo() { |
| 2559 |
return mRangeInfo; |
| 2560 |
} |
| 2561 |
|
| 2562 |
|
| 2563 |
|
| 2564 |
|
| 2565 |
|
| 2566 |
|
| 2567 |
|
| 2568 |
|
| 2569 |
|
| 2570 |
|
| 2571 |
|
| 2572 |
public void setRangeInfo(RangeInfo rangeInfo) { |
| 2573 |
enforceNotSealed(); |
| 2574 |
mRangeInfo = rangeInfo; |
| 2575 |
} |
| 2576 |
|
| 2577 |
|
| 2578 |
|
| 2579 |
|
| 2580 |
|
| 2581 |
|
| 2582 |
|
| 2583 |
|
| 2584 |
|
| 2585 |
|
| 2586 |
@Nullable |
| 2587 |
public ExtraRenderingInfo getExtraRenderingInfo() { |
| 2588 |
return mExtraRenderingInfo; |
| 2589 |
} |
| 2590 |
|
| 2591 |
|
| 2592 |
|
| 2593 |
|
| 2594 |
|
| 2595 |
|
| 2596 |
|
| 2597 |
|
| 2598 |
|
| 2599 |
|
| 2600 |
|
| 2601 |
|
| 2602 |
|
| 2603 |
public void setExtraRenderingInfo(@NonNull ExtraRenderingInfo extraRenderingInfo) { |
| 2604 |
enforceNotSealed(); |
| 2605 |
mExtraRenderingInfo = extraRenderingInfo; |
| 2606 |
} |
| 2607 |
|
| 2608 |
|
| 2609 |
|
| 2610 |
|
| 2611 |
|
| 2612 |
|
| 2613 |
|
| 2614 |
public boolean isContentInvalid() { |
| 2615 |
return getBooleanProperty(BOOLEAN_PROPERTY_CONTENT_INVALID); |
| 2616 |
} |
| 2617 |
|
| 2618 |
|
| 2619 |
|
| 2620 |
|
| 2621 |
|
| 2622 |
|
| 2623 |
|
| 2624 |
|
| 2625 |
|
| 2626 |
|
| 2627 |
|
| 2628 |
|
| 2629 |
public void setContentInvalid(boolean contentInvalid) { |
| 2630 |
setBooleanProperty(BOOLEAN_PROPERTY_CONTENT_INVALID, contentInvalid); |
| 2631 |
} |
| 2632 |
|
| 2633 |
|
| 2634 |
|
| 2635 |
|
| 2636 |
|
| 2637 |
|
| 2638 |
public boolean isContextClickable() { |
| 2639 |
return getBooleanProperty(BOOLEAN_PROPERTY_CONTEXT_CLICKABLE); |
| 2640 |
} |
| 2641 |
|
| 2642 |
|
| 2643 |
|
| 2644 |
|
| 2645 |
|
| 2646 |
|
| 2647 |
|
| 2648 |
|
| 2649 |
|
| 2650 |
|
| 2651 |
|
| 2652 |
|
| 2653 |
public void setContextClickable(boolean contextClickable) { |
| 2654 |
setBooleanProperty(BOOLEAN_PROPERTY_CONTEXT_CLICKABLE, contextClickable); |
| 2655 |
} |
| 2656 |
|
| 2657 |
|
| 2658 |
|
| 2659 |
|
| 2660 |
|
| 2661 |
|
| 2662 |
|
| 2663 |
|
| 2664 |
|
| 2665 |
|
| 2666 |
|
| 2667 |
|
| 2668 |
|
| 2669 |
|
| 2670 |
|
| 2671 |
|
| 2672 |
|
| 2673 |
|
| 2674 |
|
| 2675 |
public int getLiveRegion() { |
| 2676 |
return mLiveRegion; |
| 2677 |
} |
| 2678 |
|
| 2679 |
|
| 2680 |
|
| 2681 |
|
| 2682 |
|
| 2683 |
|
| 2684 |
|
| 2685 |
|
| 2686 |
|
| 2687 |
|
| 2688 |
|
| 2689 |
|
| 2690 |
|
| 2691 |
public void setLiveRegion(int mode) { |
| 2692 |
enforceNotSealed(); |
| 2693 |
mLiveRegion = mode; |
| 2694 |
} |
| 2695 |
|
| 2696 |
|
| 2697 |
|
| 2698 |
|
| 2699 |
|
| 2700 |
|
| 2701 |
public boolean isMultiLine() { |
| 2702 |
return getBooleanProperty(BOOLEAN_PROPERTY_MULTI_LINE); |
| 2703 |
} |
| 2704 |
|
| 2705 |
|
| 2706 |
|
| 2707 |
|
| 2708 |
|
| 2709 |
|
| 2710 |
|
| 2711 |
|
| 2712 |
|
| 2713 |
|
| 2714 |
|
| 2715 |
public void setMultiLine(boolean multiLine) { |
| 2716 |
setBooleanProperty(BOOLEAN_PROPERTY_MULTI_LINE, multiLine); |
| 2717 |
} |
| 2718 |
|
| 2719 |
|
| 2720 |
|
| 2721 |
|
| 2722 |
|
| 2723 |
|
| 2724 |
public boolean canOpenPopup() { |
| 2725 |
return getBooleanProperty(BOOLEAN_PROPERTY_OPENS_POPUP); |
| 2726 |
} |
| 2727 |
|
| 2728 |
|
| 2729 |
|
| 2730 |
|
| 2731 |
|
| 2732 |
|
| 2733 |
|
| 2734 |
|
| 2735 |
|
| 2736 |
|
| 2737 |
|
| 2738 |
public void setCanOpenPopup(boolean opensPopup) { |
| 2739 |
enforceNotSealed(); |
| 2740 |
setBooleanProperty(BOOLEAN_PROPERTY_OPENS_POPUP, opensPopup); |
| 2741 |
} |
| 2742 |
|
| 2743 |
|
| 2744 |
|
| 2745 |
|
| 2746 |
|
| 2747 |
|
| 2748 |
public boolean isDismissable() { |
| 2749 |
return getBooleanProperty(BOOLEAN_PROPERTY_DISMISSABLE); |
| 2750 |
} |
| 2751 |
|
| 2752 |
|
| 2753 |
|
| 2754 |
|
| 2755 |
|
| 2756 |
|
| 2757 |
|
| 2758 |
|
| 2759 |
|
| 2760 |
|
| 2761 |
|
| 2762 |
public void setDismissable(boolean dismissable) { |
| 2763 |
setBooleanProperty(BOOLEAN_PROPERTY_DISMISSABLE, dismissable); |
| 2764 |
} |
| 2765 |
|
| 2766 |
|
| 2767 |
|
| 2768 |
|
| 2769 |
|
| 2770 |
|
| 2771 |
|
| 2772 |
|
| 2773 |
|
| 2774 |
public boolean isImportantForAccessibility() { |
| 2775 |
return getBooleanProperty(BOOLEAN_PROPERTY_IMPORTANCE); |
| 2776 |
} |
| 2777 |
|
| 2778 |
|
| 2779 |
|
| 2780 |
|
| 2781 |
|
| 2782 |
|
| 2783 |
|
| 2784 |
|
| 2785 |
|
| 2786 |
|
| 2787 |
|
| 2788 |
|
| 2789 |
public void setImportantForAccessibility(boolean important) { |
| 2790 |
setBooleanProperty(BOOLEAN_PROPERTY_IMPORTANCE, important); |
| 2791 |
} |
| 2792 |
|
| 2793 |
|
| 2794 |
|
| 2795 |
|
| 2796 |
|
| 2797 |
|
| 2798 |
|
| 2799 |
|
| 2800 |
|
| 2801 |
|
| 2802 |
|
| 2803 |
|
| 2804 |
|
| 2805 |
public boolean isScreenReaderFocusable() { |
| 2806 |
return getBooleanProperty(BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE); |
| 2807 |
} |
| 2808 |
|
| 2809 |
|
| 2810 |
|
| 2811 |
|
| 2812 |
|
| 2813 |
|
| 2814 |
|
| 2815 |
|
| 2816 |
|
| 2817 |
|
| 2818 |
|
| 2819 |
|
| 2820 |
public void setScreenReaderFocusable(boolean screenReaderFocusable) { |
| 2821 |
setBooleanProperty(BOOLEAN_PROPERTY_SCREEN_READER_FOCUSABLE, screenReaderFocusable); |
| 2822 |
} |
| 2823 |
|
| 2824 |
|
| 2825 |
|
| 2826 |
|
| 2827 |
|
| 2828 |
|
| 2829 |
|
| 2830 |
|
| 2831 |
public boolean isShowingHintText() { |
| 2832 |
return getBooleanProperty(BOOLEAN_PROPERTY_IS_SHOWING_HINT); |
| 2833 |
} |
| 2834 |
|
| 2835 |
|
| 2836 |
|
| 2837 |
|
| 2838 |
|
| 2839 |
|
| 2840 |
|
| 2841 |
|
| 2842 |
|
| 2843 |
|
| 2844 |
|
| 2845 |
|
| 2846 |
|
| 2847 |
public void setShowingHintText(boolean showingHintText) { |
| 2848 |
setBooleanProperty(BOOLEAN_PROPERTY_IS_SHOWING_HINT, showingHintText); |
| 2849 |
} |
| 2850 |
|
| 2851 |
|
| 2852 |
|
| 2853 |
|
| 2854 |
|
| 2855 |
|
| 2856 |
|
| 2857 |
|
| 2858 |
|
| 2859 |
public boolean isHeading() { |
| 2860 |
if (getBooleanProperty(BOOLEAN_PROPERTY_IS_HEADING)) return true; |
| 2861 |
CollectionItemInfo itemInfo = getCollectionItemInfo(); |
| 2862 |
return ((itemInfo != null) && itemInfo.mHeading); |
| 2863 |
} |
| 2864 |
|
| 2865 |
|
| 2866 |
|
| 2867 |
|
| 2868 |
|
| 2869 |
|
| 2870 |
|
| 2871 |
|
| 2872 |
|
| 2873 |
|
| 2874 |
|
| 2875 |
|
| 2876 |
public void setHeading(boolean isHeading) { |
| 2877 |
setBooleanProperty(BOOLEAN_PROPERTY_IS_HEADING, isHeading); |
| 2878 |
} |
| 2879 |
|
| 2880 |
|
| 2881 |
|
| 2882 |
|
| 2883 |
|
| 2884 |
|
| 2885 |
public boolean isTextEntryKey() { |
| 2886 |
return getBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY); |
| 2887 |
} |
| 2888 |
|
| 2889 |
|
| 2890 |
|
| 2891 |
|
| 2892 |
|
| 2893 |
|
| 2894 |
|
| 2895 |
|
| 2896 |
|
| 2897 |
|
| 2898 |
|
| 2899 |
|
| 2900 |
public void setTextEntryKey(boolean isTextEntryKey) { |
| 2901 |
setBooleanProperty(BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY, isTextEntryKey); |
| 2902 |
} |
| 2903 |
|
| 2904 |
|
| 2905 |
|
| 2906 |
|
| 2907 |
|
| 2908 |
|
| 2909 |
public CharSequence getPackageName() { |
| 2910 |
return mPackageName; |
| 2911 |
} |
| 2912 |
|
| 2913 |
|
| 2914 |
|
| 2915 |
|
| 2916 |
|
| 2917 |
|
| 2918 |
|
| 2919 |
|
| 2920 |
|
| 2921 |
|
| 2922 |
|
| 2923 |
|
| 2924 |
|
| 2925 |
public void setPackageName(CharSequence packageName) { |
| 2926 |
enforceNotSealed(); |
| 2927 |
mPackageName = packageName; |
| 2928 |
} |
| 2929 |
|
| 2930 |
|
| 2931 |
|
| 2932 |
|
| 2933 |
|
| 2934 |
|
| 2935 |
public CharSequence getClassName() { |
| 2936 |
return mClassName; |
| 2937 |
} |
| 2938 |
|
| 2939 |
|
| 2940 |
|
| 2941 |
|
| 2942 |
|
| 2943 |
|
| 2944 |
|
| 2945 |
|
| 2946 |
|
| 2947 |
|
| 2948 |
|
| 2949 |
|
| 2950 |
|
| 2951 |
public void setClassName(CharSequence className) { |
| 2952 |
enforceNotSealed(); |
| 2953 |
mClassName = className; |
| 2954 |
} |
| 2955 |
|
| 2956 |
|
| 2957 |
|
| 2958 |
|
| 2959 |
|
| 2960 |
|
| 2961 |
|
| 2962 |
|
| 2963 |
|
| 2964 |
|
| 2965 |
|
| 2966 |
|
| 2967 |
|
| 2968 |
|
| 2969 |
|
| 2970 |
|
| 2971 |
|
| 2972 |
|
| 2973 |
|
| 2974 |
public CharSequence getText() { |
| 2975 |
|
| 2976 |
if (mText instanceof Spanned) { |
| 2977 |
Spanned spanned = (Spanned) mText; |
| 2978 |
AccessibilityClickableSpan[] clickableSpans = |
| 2979 |
spanned.getSpans(0, mText.length(), AccessibilityClickableSpan.class); |
| 2980 |
for (int i = 0; i < clickableSpans.length; i++) { |
| 2981 |
clickableSpans[i].copyConnectionDataFrom(this); |
| 2982 |
} |
| 2983 |
AccessibilityURLSpan[] urlSpans = |
| 2984 |
spanned.getSpans(0, mText.length(), AccessibilityURLSpan.class); |
| 2985 |
for (int i = 0; i < urlSpans.length; i++) { |
| 2986 |
urlSpans[i].copyConnectionDataFrom(this); |
| 2987 |
} |
| 2988 |
} |
| 2989 |
return mText; |
| 2990 |
} |
| 2991 |
|
| 2992 |
|
| 2993 |
|
| 2994 |
|
| 2995 |
|
| 2996 |
public CharSequence getOriginalText() { |
| 2997 |
return mOriginalText; |
| 2998 |
} |
| 2999 |
|
| 3000 |
|
| 3001 |
|
| 3002 |
|
| 3003 |
|
| 3004 |
|
| 3005 |
|
| 3006 |
|
| 3007 |
|
| 3008 |
|
| 3009 |
|
| 3010 |
|
| 3011 |
|
| 3012 |
public void setText(CharSequence text) { |
| 3013 |
enforceNotSealed(); |
| 3014 |
mOriginalText = text; |
| 3015 |
if (text instanceof Spanned) { |
| 3016 |
CharSequence tmpText = text; |
| 3017 |
tmpText = replaceClickableSpan(tmpText); |
| 3018 |
tmpText = replaceReplacementSpan(tmpText); |
| 3019 |
mText = tmpText; |
| 3020 |
return; |
| 3021 |
} |
| 3022 |
mText = (text == null) ? null : text.subSequence(0, text.length()); |
| 3023 |
} |
| 3024 |
|
| 3025 |
|
| 3026 |
|
| 3027 |
|
| 3028 |
|
| 3029 |
|
| 3030 |
|
| 3031 |
|
| 3032 |
private CharSequence replaceClickableSpan(CharSequence text) { |
| 3033 |
ClickableSpan[] clickableSpans = |
| 3034 |
((Spanned) text).getSpans(0, text.length(), ClickableSpan.class); |
| 3035 |
Spannable spannable = new SpannableStringBuilder(text); |
| 3036 |
if (clickableSpans.length == 0) { |
| 3037 |
return text; |
| 3038 |
} |
| 3039 |
for (int i = 0; i < clickableSpans.length; i++) { |
| 3040 |
ClickableSpan span = clickableSpans[i]; |
| 3041 |
if ((span instanceof AccessibilityClickableSpan) |
| 3042 |
|| (span instanceof AccessibilityURLSpan)) { |
| 3043 |
|
| 3044 |
break; |
| 3045 |
} |
| 3046 |
int spanToReplaceStart = spannable.getSpanStart(span); |
| 3047 |
int spanToReplaceEnd = spannable.getSpanEnd(span); |
| 3048 |
int spanToReplaceFlags = spannable.getSpanFlags(span); |
| 3049 |
if (spanToReplaceStart < 0) { |
| 3050 |
continue; |
| 3051 |
} |
| 3052 |
spannable.removeSpan(span); |
| 3053 |
ClickableSpan replacementSpan = (span instanceof URLSpan) |
| 3054 |
? new AccessibilityURLSpan((URLSpan) span) |
| 3055 |
: new AccessibilityClickableSpan(span.getId()); |
| 3056 |
spannable.setSpan(replacementSpan, spanToReplaceStart, spanToReplaceEnd, |
| 3057 |
spanToReplaceFlags); |
| 3058 |
} |
| 3059 |
return spannable; |
| 3060 |
} |
| 3061 |
|
| 3062 |
|
| 3063 |
|
| 3064 |
|
| 3065 |
|
| 3066 |
|
| 3067 |
|
| 3068 |
|
| 3069 |
private CharSequence replaceReplacementSpan(CharSequence text) { |
| 3070 |
ReplacementSpan[] replacementSpans = |
| 3071 |
((Spanned) text).getSpans(0, text.length(), ReplacementSpan.class); |
| 3072 |
SpannableStringBuilder spannable = new SpannableStringBuilder(text); |
| 3073 |
if (replacementSpans.length == 0) { |
| 3074 |
return text; |
| 3075 |
} |
| 3076 |
for (int i = 0; i < replacementSpans.length; i++) { |
| 3077 |
ReplacementSpan span = replacementSpans[i]; |
| 3078 |
CharSequence replacementText = span.getContentDescription(); |
| 3079 |
if (span instanceof AccessibilityReplacementSpan) { |
| 3080 |
|
| 3081 |
break; |
| 3082 |
} |
| 3083 |
if (replacementText == null) { |
| 3084 |
continue; |
| 3085 |
} |
| 3086 |
int spanToReplaceStart = spannable.getSpanStart(span); |
| 3087 |
int spanToReplaceEnd = spannable.getSpanEnd(span); |
| 3088 |
int spanToReplaceFlags = spannable.getSpanFlags(span); |
| 3089 |
if (spanToReplaceStart < 0) { |
| 3090 |
continue; |
| 3091 |
} |
| 3092 |
spannable.removeSpan(span); |
| 3093 |
ReplacementSpan replacementSpan = new AccessibilityReplacementSpan(replacementText); |
| 3094 |
spannable.setSpan(replacementSpan, spanToReplaceStart, spanToReplaceEnd, |
| 3095 |
spanToReplaceFlags); |
| 3096 |
} |
| 3097 |
return spannable; |
| 3098 |
} |
| 3099 |
|
| 3100 |
|
| 3101 |
|
| 3102 |
|
| 3103 |
|
| 3104 |
|
| 3105 |
public CharSequence getHintText() { |
| 3106 |
return mHintText; |
| 3107 |
} |
| 3108 |
|
| 3109 |
|
| 3110 |
|
| 3111 |
|
| 3112 |
|
| 3113 |
|
| 3114 |
|
| 3115 |
|
| 3116 |
|
| 3117 |
|
| 3118 |
|
| 3119 |
|
| 3120 |
|
| 3121 |
public void setHintText(CharSequence hintText) { |
| 3122 |
enforceNotSealed(); |
| 3123 |
mHintText = (hintText == null) ? null : hintText.subSequence(0, hintText.length()); |
| 3124 |
} |
| 3125 |
|
| 3126 |
|
| 3127 |
|
| 3128 |
|
| 3129 |
|
| 3130 |
|
| 3131 |
|
| 3132 |
|
| 3133 |
|
| 3134 |
|
| 3135 |
|
| 3136 |
|
| 3137 |
|
| 3138 |
public void setError(CharSequence error) { |
| 3139 |
enforceNotSealed(); |
| 3140 |
mError = (error == null) ? null : error.subSequence(0, error.length()); |
| 3141 |
} |
| 3142 |
|
| 3143 |
|
| 3144 |
|
| 3145 |
|
| 3146 |
|
| 3147 |
|
| 3148 |
public CharSequence getError() { |
| 3149 |
return mError; |
| 3150 |
} |
| 3151 |
|
| 3152 |
|
| 3153 |
|
| 3154 |
|
| 3155 |
|
| 3156 |
|
| 3157 |
public @Nullable CharSequence getStateDescription() { |
| 3158 |
return mStateDescription; |
| 3159 |
} |
| 3160 |
|
| 3161 |
|
| 3162 |
|
| 3163 |
|
| 3164 |
|
| 3165 |
|
| 3166 |
public CharSequence getContentDescription() { |
| 3167 |
return mContentDescription; |
| 3168 |
} |
| 3169 |
|
| 3170 |
|
| 3171 |
|
| 3172 |
|
| 3173 |
|
| 3174 |
|
| 3175 |
|
| 3176 |
|
| 3177 |
|
| 3178 |
|
| 3179 |
|
| 3180 |
|
| 3181 |
|
| 3182 |
|
| 3183 |
public void setStateDescription(@Nullable CharSequence stateDescription) { |
| 3184 |
enforceNotSealed(); |
| 3185 |
mStateDescription = (stateDescription == null) ? null |
| 3186 |
: stateDescription.subSequence(0, stateDescription.length()); |
| 3187 |
} |
| 3188 |
|
| 3189 |
|
| 3190 |
|
| 3191 |
|
| 3192 |
|
| 3193 |
|
| 3194 |
|
| 3195 |
|
| 3196 |
|
| 3197 |
|
| 3198 |
|
| 3199 |
|
| 3200 |
|
| 3201 |
public void setContentDescription(CharSequence contentDescription) { |
| 3202 |
enforceNotSealed(); |
| 3203 |
mContentDescription = (contentDescription == null) ? null |
| 3204 |
: contentDescription.subSequence(0, contentDescription.length()); |
| 3205 |
} |
| 3206 |
|
| 3207 |
|
| 3208 |
|
| 3209 |
|
| 3210 |
|
| 3211 |
|
| 3212 |
@Nullable |
| 3213 |
public CharSequence getTooltipText() { |
| 3214 |
return mTooltipText; |
| 3215 |
} |
| 3216 |
|
| 3217 |
|
| 3218 |
|
| 3219 |
|
| 3220 |
|
| 3221 |
|
| 3222 |
|
| 3223 |
|
| 3224 |
|
| 3225 |
|
| 3226 |
|
| 3227 |
|
| 3228 |
|
| 3229 |
public void setTooltipText(@Nullable CharSequence tooltipText) { |
| 3230 |
enforceNotSealed(); |
| 3231 |
mTooltipText = (tooltipText == null) ? null |
| 3232 |
: tooltipText.subSequence(0, tooltipText.length()); |
| 3233 |
} |
| 3234 |
|
| 3235 |
|
| 3236 |
|
| 3237 |
|
| 3238 |
|
| 3239 |
|
| 3240 |
|
| 3241 |
public void setLabelFor(View labeled) { |
| 3242 |
setLabelFor(labeled, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 3243 |
} |
| 3244 |
|
| 3245 |
|
| 3246 |
|
| 3247 |
|
| 3248 |
|
| 3249 |
|
| 3250 |
|
| 3251 |
|
| 3252 |
|
| 3253 |
|
| 3254 |
|
| 3255 |
|
| 3256 |
|
| 3257 |
|
| 3258 |
|
| 3259 |
|
| 3260 |
|
| 3261 |
|
| 3262 |
|
| 3263 |
|
| 3264 |
public void setLabelFor(View root, int virtualDescendantId) { |
| 3265 |
enforceNotSealed(); |
| 3266 |
final int rootAccessibilityViewId = (root != null) |
| 3267 |
? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 3268 |
mLabelForId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 3269 |
} |
| 3270 |
|
| 3271 |
|
| 3272 |
|
| 3273 |
|
| 3274 |
|
| 3275 |
|
| 3276 |
|
| 3277 |
public AccessibilityNodeInfo getLabelFor() { |
| 3278 |
enforceSealed(); |
| 3279 |
return getNodeForAccessibilityId(mConnectionId, mWindowId, mLabelForId); |
| 3280 |
} |
| 3281 |
|
| 3282 |
|
| 3283 |
|
| 3284 |
|
| 3285 |
|
| 3286 |
|
| 3287 |
|
| 3288 |
public void setLabeledBy(View label) { |
| 3289 |
setLabeledBy(label, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 3290 |
} |
| 3291 |
|
| 3292 |
|
| 3293 |
|
| 3294 |
|
| 3295 |
|
| 3296 |
|
| 3297 |
|
| 3298 |
|
| 3299 |
|
| 3300 |
|
| 3301 |
|
| 3302 |
|
| 3303 |
|
| 3304 |
|
| 3305 |
|
| 3306 |
|
| 3307 |
|
| 3308 |
|
| 3309 |
|
| 3310 |
|
| 3311 |
public void setLabeledBy(View root, int virtualDescendantId) { |
| 3312 |
enforceNotSealed(); |
| 3313 |
final int rootAccessibilityViewId = (root != null) |
| 3314 |
? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID; |
| 3315 |
mLabeledById = makeNodeId(rootAccessibilityViewId, virtualDescendantId); |
| 3316 |
} |
| 3317 |
|
| 3318 |
|
| 3319 |
|
| 3320 |
|
| 3321 |
|
| 3322 |
|
| 3323 |
|
| 3324 |
public AccessibilityNodeInfo getLabeledBy() { |
| 3325 |
enforceSealed(); |
| 3326 |
return getNodeForAccessibilityId(mConnectionId, mWindowId, mLabeledById); |
| 3327 |
} |
| 3328 |
|
| 3329 |
|
| 3330 |
|
| 3331 |
|
| 3332 |
|
| 3333 |
|
| 3334 |
|
| 3335 |
|
| 3336 |
|
| 3337 |
|
| 3338 |
|
| 3339 |
|
| 3340 |
public void setViewIdResourceName(String viewIdResName) { |
| 3341 |
enforceNotSealed(); |
| 3342 |
mViewIdResourceName = viewIdResName; |
| 3343 |
} |
| 3344 |
|
| 3345 |
|
| 3346 |
|
| 3347 |
|
| 3348 |
|
| 3349 |
|
| 3350 |
|
| 3351 |
|
| 3352 |
|
| 3353 |
|
| 3354 |
|
| 3355 |
|
| 3356 |
|
| 3357 |
public String getViewIdResourceName() { |
| 3358 |
return mViewIdResourceName; |
| 3359 |
} |
| 3360 |
|
| 3361 |
|
| 3362 |
|
| 3363 |
|
| 3364 |
|
| 3365 |
|
| 3366 |
|
| 3367 |
|
| 3368 |
|
| 3369 |
|
| 3370 |
|
| 3371 |
|
| 3372 |
public int getTextSelectionStart() { |
| 3373 |
return mTextSelectionStart; |
| 3374 |
} |
| 3375 |
|
| 3376 |
|
| 3377 |
|
| 3378 |
|
| 3379 |
|
| 3380 |
|
| 3381 |
|
| 3382 |
|
| 3383 |
|
| 3384 |
|
| 3385 |
|
| 3386 |
|
| 3387 |
public int getTextSelectionEnd() { |
| 3388 |
return mTextSelectionEnd; |
| 3389 |
} |
| 3390 |
|
| 3391 |
|
| 3392 |
|
| 3393 |
|
| 3394 |
|
| 3395 |
|
| 3396 |
|
| 3397 |
|
| 3398 |
|
| 3399 |
|
| 3400 |
|
| 3401 |
|
| 3402 |
|
| 3403 |
|
| 3404 |
public void setTextSelection(int start, int end) { |
| 3405 |
enforceNotSealed(); |
| 3406 |
mTextSelectionStart = start; |
| 3407 |
mTextSelectionEnd = end; |
| 3408 |
} |
| 3409 |
|
| 3410 |
|
| 3411 |
|
| 3412 |
|
| 3413 |
|
| 3414 |
|
| 3415 |
public int getInputType() { |
| 3416 |
return mInputType; |
| 3417 |
} |
| 3418 |
|
| 3419 |
|
| 3420 |
|
| 3421 |
|
| 3422 |
|
| 3423 |
|
| 3424 |
|
| 3425 |
|
| 3426 |
|
| 3427 |
|
| 3428 |
|
| 3429 |
|
| 3430 |
|
| 3431 |
|
| 3432 |
public void setInputType(int inputType) { |
| 3433 |
enforceNotSealed(); |
| 3434 |
mInputType = inputType; |
| 3435 |
} |
| 3436 |
|
| 3437 |
|
| 3438 |
|
| 3439 |
|
| 3440 |
|
| 3441 |
|
| 3442 |
|
| 3443 |
|
| 3444 |
|
| 3445 |
|
| 3446 |
|
| 3447 |
|
| 3448 |
|
| 3449 |
|
| 3450 |
public Bundle getExtras() { |
| 3451 |
if (mExtras == null) { |
| 3452 |
mExtras = new Bundle(); |
| 3453 |
} |
| 3454 |
return mExtras; |
| 3455 |
} |
| 3456 |
|
| 3457 |
|
| 3458 |
|
| 3459 |
|
| 3460 |
|
| 3461 |
public boolean hasExtras() { |
| 3462 |
return mExtras != null; |
| 3463 |
} |
| 3464 |
|
| 3465 |
|
| 3466 |
|
| 3467 |
|
| 3468 |
|
| 3469 |
|
| 3470 |
|
| 3471 |
|
| 3472 |
|
| 3473 |
|
| 3474 |
@Nullable |
| 3475 |
public TouchDelegateInfo getTouchDelegateInfo() { |
| 3476 |
if (mTouchDelegateInfo != null) { |
| 3477 |
mTouchDelegateInfo.setConnectionId(mConnectionId); |
| 3478 |
mTouchDelegateInfo.setWindowId(mWindowId); |
| 3479 |
} |
| 3480 |
return mTouchDelegateInfo; |
| 3481 |
} |
| 3482 |
|
| 3483 |
|
| 3484 |
|
| 3485 |
|
| 3486 |
|
| 3487 |
|
| 3488 |
|
| 3489 |
|
| 3490 |
|
| 3491 |
|
| 3492 |
|
| 3493 |
|
| 3494 |
|
| 3495 |
|
| 3496 |
|
| 3497 |
public void setTouchDelegateInfo(@NonNull TouchDelegateInfo delegatedInfo) { |
| 3498 |
enforceNotSealed(); |
| 3499 |
mTouchDelegateInfo = delegatedInfo; |
| 3500 |
} |
| 3501 |
|
| 3502 |
|
| 3503 |
|
| 3504 |
|
| 3505 |
|
| 3506 |
|
| 3507 |
|
| 3508 |
private boolean getBooleanProperty(int property) { |
| 3509 |
return (mBooleanProperties & property) != 0; |
| 3510 |
} |
| 3511 |
|
| 3512 |
|
| 3513 |
|
| 3514 |
|
| 3515 |
|
| 3516 |
|
| 3517 |
|
| 3518 |
|
| 3519 |
|
| 3520 |
private void setBooleanProperty(int property, boolean value) { |
| 3521 |
enforceNotSealed(); |
| 3522 |
if (value) { |
| 3523 |
mBooleanProperties |= property; |
| 3524 |
} else { |
| 3525 |
mBooleanProperties &= ~property; |
| 3526 |
} |
| 3527 |
} |
| 3528 |
|
| 3529 |
|
| 3530 |
|
| 3531 |
|
| 3532 |
|
| 3533 |
|
| 3534 |
|
| 3535 |
|
| 3536 |
|
| 3537 |
public void setConnectionId(int connectionId) { |
| 3538 |
enforceNotSealed(); |
| 3539 |
mConnectionId = connectionId; |
| 3540 |
} |
| 3541 |
|
| 3542 |
|
| 3543 |
|
| 3544 |
|
| 3545 |
|
| 3546 |
|
| 3547 |
|
| 3548 |
|
| 3549 |
public int getConnectionId() { |
| 3550 |
return mConnectionId; |
| 3551 |
} |
| 3552 |
|
| 3553 |
|
| 3554 |
|
| 3555 |
|
| 3556 |
@Override |
| 3557 |
public int describeContents() { |
| 3558 |
return 0; |
| 3559 |
} |
| 3560 |
|
| 3561 |
|
| 3562 |
|
| 3563 |
|
| 3564 |
|
| 3565 |
|
| 3566 |
|
| 3567 |
|
| 3568 |
|
| 3569 |
public void setSourceNodeId(long sourceId, int windowId) { |
| 3570 |
enforceNotSealed(); |
| 3571 |
mSourceNodeId = sourceId; |
| 3572 |
mWindowId = windowId; |
| 3573 |
} |
| 3574 |
|
| 3575 |
|
| 3576 |
|
| 3577 |
|
| 3578 |
|
| 3579 |
|
| 3580 |
|
| 3581 |
|
| 3582 |
@UnsupportedAppUsage |
| 3583 |
@TestApi |
| 3584 |
public long getSourceNodeId() { |
| 3585 |
return mSourceNodeId; |
| 3586 |
} |
| 3587 |
|
| 3588 |
|
| 3589 |
|
| 3590 |
|
| 3591 |
|
| 3592 |
|
| 3593 |
|
| 3594 |
|
| 3595 |
public void setUniqueId(@Nullable String uniqueId) { |
| 3596 |
enforceNotSealed(); |
| 3597 |
mUniqueId = uniqueId; |
| 3598 |
} |
| 3599 |
|
| 3600 |
|
| 3601 |
|
| 3602 |
|
| 3603 |
|
| 3604 |
|
| 3605 |
@Nullable |
| 3606 |
public String getUniqueId() { |
| 3607 |
return mUniqueId; |
| 3608 |
} |
| 3609 |
|
| 3610 |
|
| 3611 |
|
| 3612 |
|
| 3613 |
|
| 3614 |
|
| 3615 |
|
| 3616 |
|
| 3617 |
@TestApi |
| 3618 |
public void setLeashedParent(@Nullable IBinder token, int viewId) { |
| 3619 |
enforceNotSealed(); |
| 3620 |
mLeashedParent = token; |
| 3621 |
mLeashedParentNodeId = makeNodeId(viewId, AccessibilityNodeProvider.HOST_VIEW_ID); |
| 3622 |
} |
| 3623 |
|
| 3624 |
|
| 3625 |
|
| 3626 |
|
| 3627 |
|
| 3628 |
|
| 3629 |
|
| 3630 |
public @Nullable IBinder getLeashedParent() { |
| 3631 |
return mLeashedParent; |
| 3632 |
} |
| 3633 |
|
| 3634 |
|
| 3635 |
|
| 3636 |
|
| 3637 |
|
| 3638 |
|
| 3639 |
|
| 3640 |
public long getLeashedParentNodeId() { |
| 3641 |
return mLeashedParentNodeId; |
| 3642 |
} |
| 3643 |
|
| 3644 |
|
| 3645 |
|
| 3646 |
|
| 3647 |
|
| 3648 |
|
| 3649 |
|
| 3650 |
|
| 3651 |
@UnsupportedAppUsage |
| 3652 |
public void setSealed(boolean sealed) { |
| 3653 |
mSealed = sealed; |
| 3654 |
} |
| 3655 |
|
| 3656 |
|
| 3657 |
|
| 3658 |
|
| 3659 |
|
| 3660 |
|
| 3661 |
|
| 3662 |
|
| 3663 |
@UnsupportedAppUsage |
| 3664 |
public boolean isSealed() { |
| 3665 |
return mSealed; |
| 3666 |
} |
| 3667 |
|
| 3668 |
|
| 3669 |
|
| 3670 |
|
| 3671 |
|
| 3672 |
|
| 3673 |
|
| 3674 |
|
| 3675 |
protected void enforceSealed() { |
| 3676 |
if (!isSealed()) { |
| 3677 |
throw new IllegalStateException("Cannot perform this " |
| 3678 |
+ "action on a not sealed instance."); |
| 3679 |
} |
| 3680 |
} |
| 3681 |
|
| 3682 |
private void enforceValidFocusDirection(int direction) { |
| 3683 |
switch (direction) { |
| 3684 |
case View.FOCUS_DOWN: |
| 3685 |
case View.FOCUS_UP: |
| 3686 |
case View.FOCUS_LEFT: |
| 3687 |
case View.FOCUS_RIGHT: |
| 3688 |
case View.FOCUS_FORWARD: |
| 3689 |
case View.FOCUS_BACKWARD: |
| 3690 |
return; |
| 3691 |
default: |
| 3692 |
throw new IllegalArgumentException("Unknown direction: " + direction); |
| 3693 |
} |
| 3694 |
} |
| 3695 |
|
| 3696 |
private void enforceValidFocusType(int focusType) { |
| 3697 |
switch (focusType) { |
| 3698 |
case FOCUS_INPUT: |
| 3699 |
case FOCUS_ACCESSIBILITY: |
| 3700 |
return; |
| 3701 |
default: |
| 3702 |
throw new IllegalArgumentException("Unknown focus type: " + focusType); |
| 3703 |
} |
| 3704 |
} |
| 3705 |
|
| 3706 |
|
| 3707 |
|
| 3708 |
|
| 3709 |
|
| 3710 |
|
| 3711 |
|
| 3712 |
|
| 3713 |
protected void enforceNotSealed() { |
| 3714 |
if (isSealed()) { |
| 3715 |
throw new IllegalStateException("Cannot perform this " |
| 3716 |
+ "action on a sealed instance."); |
| 3717 |
} |
| 3718 |
} |
| 3719 |
|
| 3720 |
|
| 3721 |
|
| 3722 |
|
| 3723 |
|
| 3724 |
|
| 3725 |
|
| 3726 |
|
| 3727 |
|
| 3728 |
|
| 3729 |
|
| 3730 |
|
| 3731 |
@Deprecated |
| 3732 |
public static AccessibilityNodeInfo obtain(View source) { |
| 3733 |
return new AccessibilityNodeInfo(source); |
| 3734 |
} |
| 3735 |
|
| 3736 |
|
| 3737 |
|
| 3738 |
|
| 3739 |
|
| 3740 |
|
| 3741 |
|
| 3742 |
|
| 3743 |
|
| 3744 |
|
| 3745 |
|
| 3746 |
|
| 3747 |
|
| 3748 |
|
| 3749 |
@Deprecated |
| 3750 |
public static AccessibilityNodeInfo obtain(View root, int virtualDescendantId) { |
| 3751 |
return new AccessibilityNodeInfo(root, virtualDescendantId); |
| 3752 |
} |
| 3753 |
|
| 3754 |
|
| 3755 |
|
| 3756 |
|
| 3757 |
|
| 3758 |
|
| 3759 |
|
| 3760 |
|
| 3761 |
@Deprecated |
| 3762 |
public static AccessibilityNodeInfo obtain() { |
| 3763 |
return new AccessibilityNodeInfo(); |
| 3764 |
} |
| 3765 |
|
| 3766 |
|
| 3767 |
|
| 3768 |
|
| 3769 |
|
| 3770 |
|
| 3771 |
|
| 3772 |
|
| 3773 |
|
| 3774 |
|
| 3775 |
@Deprecated |
| 3776 |
public static AccessibilityNodeInfo obtain(AccessibilityNodeInfo info) { |
| 3777 |
return new AccessibilityNodeInfo(info); |
| 3778 |
} |
| 3779 |
|
| 3780 |
|
| 3781 |
|
| 3782 |
|
| 3783 |
|
| 3784 |
|
| 3785 |
|
| 3786 |
@Deprecated |
| 3787 |
public void recycle() {} |
| 3788 |
|
| 3789 |
|
| 3790 |
|
| 3791 |
|
| 3792 |
|
| 3793 |
|
| 3794 |
|
| 3795 |
|
| 3796 |
@Override |
| 3797 |
public void writeToParcel(Parcel parcel, int flags) { |
| 3798 |
writeToParcelNoRecycle(parcel, flags); |
| 3799 |
|
| 3800 |
|
| 3801 |
} |
| 3802 |
|
| 3803 |
|
| 3804 |
@TestApi |
| 3805 |
public void writeToParcelNoRecycle(Parcel parcel, int flags) { |
| 3806 |
|
| 3807 |
long nonDefaultFields = 0; |
| 3808 |
int fieldIndex = 0; |
| 3809 |
if (isSealed() != DEFAULT.isSealed()) nonDefaultFields |= bitAt(fieldIndex); |
| 3810 |
fieldIndex++; |
| 3811 |
if (mSourceNodeId != DEFAULT.mSourceNodeId) nonDefaultFields |= bitAt(fieldIndex); |
| 3812 |
fieldIndex++; |
| 3813 |
if (mWindowId != DEFAULT.mWindowId) nonDefaultFields |= bitAt(fieldIndex); |
| 3814 |
fieldIndex++; |
| 3815 |
if (mParentNodeId != DEFAULT.mParentNodeId) nonDefaultFields |= bitAt(fieldIndex); |
| 3816 |
fieldIndex++; |
| 3817 |
if (mLabelForId != DEFAULT.mLabelForId) nonDefaultFields |= bitAt(fieldIndex); |
| 3818 |
fieldIndex++; |
| 3819 |
if (mLabeledById != DEFAULT.mLabeledById) nonDefaultFields |= bitAt(fieldIndex); |
| 3820 |
fieldIndex++; |
| 3821 |
if (mTraversalBefore != DEFAULT.mTraversalBefore) nonDefaultFields |= bitAt(fieldIndex); |
| 3822 |
fieldIndex++; |
| 3823 |
if (mTraversalAfter != DEFAULT.mTraversalAfter) nonDefaultFields |= bitAt(fieldIndex); |
| 3824 |
fieldIndex++; |
| 3825 |
if (mConnectionId != DEFAULT.mConnectionId) nonDefaultFields |= bitAt(fieldIndex); |
| 3826 |
fieldIndex++; |
| 3827 |
if (!LongArray.elementsEqual(mChildNodeIds, DEFAULT.mChildNodeIds)) { |
| 3828 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3829 |
} |
| 3830 |
fieldIndex++; |
| 3831 |
if (!Objects.equals(mBoundsInParent, DEFAULT.mBoundsInParent)) { |
| 3832 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3833 |
} |
| 3834 |
fieldIndex++; |
| 3835 |
if (!Objects.equals(mBoundsInScreen, DEFAULT.mBoundsInScreen)) { |
| 3836 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3837 |
} |
| 3838 |
fieldIndex++; |
| 3839 |
if (!Objects.equals(mActions, DEFAULT.mActions)) nonDefaultFields |= bitAt(fieldIndex); |
| 3840 |
fieldIndex++; |
| 3841 |
if (mMaxTextLength != DEFAULT.mMaxTextLength) nonDefaultFields |= bitAt(fieldIndex); |
| 3842 |
fieldIndex++; |
| 3843 |
if (mMovementGranularities != DEFAULT.mMovementGranularities) { |
| 3844 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3845 |
} |
| 3846 |
fieldIndex++; |
| 3847 |
if (mBooleanProperties != DEFAULT.mBooleanProperties) nonDefaultFields |= bitAt(fieldIndex); |
| 3848 |
fieldIndex++; |
| 3849 |
if (!Objects.equals(mPackageName, DEFAULT.mPackageName)) { |
| 3850 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3851 |
} |
| 3852 |
fieldIndex++; |
| 3853 |
if (!Objects.equals(mClassName, DEFAULT.mClassName)) nonDefaultFields |= bitAt(fieldIndex); |
| 3854 |
fieldIndex++; |
| 3855 |
if (!Objects.equals(mText, DEFAULT.mText)) nonDefaultFields |= bitAt(fieldIndex); |
| 3856 |
fieldIndex++; |
| 3857 |
if (!Objects.equals(mHintText, DEFAULT.mHintText)) { |
| 3858 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3859 |
} |
| 3860 |
fieldIndex++; |
| 3861 |
if (!Objects.equals(mError, DEFAULT.mError)) nonDefaultFields |= bitAt(fieldIndex); |
| 3862 |
fieldIndex++; |
| 3863 |
if (!Objects.equals(mStateDescription, DEFAULT.mStateDescription)) { |
| 3864 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3865 |
} |
| 3866 |
fieldIndex++; |
| 3867 |
if (!Objects.equals(mContentDescription, DEFAULT.mContentDescription)) { |
| 3868 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3869 |
} |
| 3870 |
fieldIndex++; |
| 3871 |
if (!Objects.equals(mPaneTitle, DEFAULT.mPaneTitle)) { |
| 3872 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3873 |
} |
| 3874 |
fieldIndex++; |
| 3875 |
if (!Objects.equals(mTooltipText, DEFAULT.mTooltipText)) { |
| 3876 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3877 |
} |
| 3878 |
fieldIndex++; |
| 3879 |
if (!Objects.equals(mViewIdResourceName, DEFAULT.mViewIdResourceName)) { |
| 3880 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3881 |
} |
| 3882 |
fieldIndex++; |
| 3883 |
if (!Objects.equals(mUniqueId, DEFAULT.mUniqueId)) { |
| 3884 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3885 |
} |
| 3886 |
fieldIndex++; |
| 3887 |
if (mTextSelectionStart != DEFAULT.mTextSelectionStart) { |
| 3888 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3889 |
} |
| 3890 |
fieldIndex++; |
| 3891 |
if (mTextSelectionEnd != DEFAULT.mTextSelectionEnd) { |
| 3892 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3893 |
} |
| 3894 |
fieldIndex++; |
| 3895 |
if (mInputType != DEFAULT.mInputType) nonDefaultFields |= bitAt(fieldIndex); |
| 3896 |
fieldIndex++; |
| 3897 |
if (mLiveRegion != DEFAULT.mLiveRegion) nonDefaultFields |= bitAt(fieldIndex); |
| 3898 |
fieldIndex++; |
| 3899 |
if (mDrawingOrderInParent != DEFAULT.mDrawingOrderInParent) { |
| 3900 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3901 |
} |
| 3902 |
fieldIndex++; |
| 3903 |
if (!Objects.equals(mExtraDataKeys, DEFAULT.mExtraDataKeys)) { |
| 3904 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3905 |
} |
| 3906 |
fieldIndex++; |
| 3907 |
if (!Objects.equals(mExtras, DEFAULT.mExtras)) nonDefaultFields |= bitAt(fieldIndex); |
| 3908 |
fieldIndex++; |
| 3909 |
if (!Objects.equals(mRangeInfo, DEFAULT.mRangeInfo)) nonDefaultFields |= bitAt(fieldIndex); |
| 3910 |
fieldIndex++; |
| 3911 |
if (!Objects.equals(mCollectionInfo, DEFAULT.mCollectionInfo)) { |
| 3912 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3913 |
} |
| 3914 |
fieldIndex++; |
| 3915 |
if (!Objects.equals(mCollectionItemInfo, DEFAULT.mCollectionItemInfo)) { |
| 3916 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3917 |
} |
| 3918 |
fieldIndex++; |
| 3919 |
if (!Objects.equals(mTouchDelegateInfo, DEFAULT.mTouchDelegateInfo)) { |
| 3920 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3921 |
} |
| 3922 |
fieldIndex++; |
| 3923 |
if (!Objects.equals(mExtraRenderingInfo, DEFAULT.mExtraRenderingInfo)) { |
| 3924 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3925 |
} |
| 3926 |
fieldIndex++; |
| 3927 |
if (mLeashedChild != DEFAULT.mLeashedChild) { |
| 3928 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3929 |
} |
| 3930 |
fieldIndex++; |
| 3931 |
if (mLeashedParent != DEFAULT.mLeashedParent) { |
| 3932 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3933 |
} |
| 3934 |
fieldIndex++; |
| 3935 |
if (mLeashedParentNodeId != DEFAULT.mLeashedParentNodeId) { |
| 3936 |
nonDefaultFields |= bitAt(fieldIndex); |
| 3937 |
} |
| 3938 |
int totalFields = fieldIndex; |
| 3939 |
parcel.writeLong(nonDefaultFields); |
| 3940 |
|
| 3941 |
fieldIndex = 0; |
| 3942 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(isSealed() ? 1 : 0); |
| 3943 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mSourceNodeId); |
| 3944 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mWindowId); |
| 3945 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mParentNodeId); |
| 3946 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mLabelForId); |
| 3947 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mLabeledById); |
| 3948 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mTraversalBefore); |
| 3949 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeLong(mTraversalAfter); |
| 3950 |
|
| 3951 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mConnectionId); |
| 3952 |
|
| 3953 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 3954 |
final LongArray childIds = mChildNodeIds; |
| 3955 |
if (childIds == null) { |
| 3956 |
parcel.writeInt(0); |
| 3957 |
} else { |
| 3958 |
final int childIdsSize = childIds.size(); |
| 3959 |
parcel.writeInt(childIdsSize); |
| 3960 |
for (int i = 0; i < childIdsSize; i++) { |
| 3961 |
parcel.writeLong(childIds.get(i)); |
| 3962 |
} |
| 3963 |
} |
| 3964 |
} |
| 3965 |
|
| 3966 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 3967 |
parcel.writeInt(mBoundsInParent.top); |
| 3968 |
parcel.writeInt(mBoundsInParent.bottom); |
| 3969 |
parcel.writeInt(mBoundsInParent.left); |
| 3970 |
parcel.writeInt(mBoundsInParent.right); |
| 3971 |
} |
| 3972 |
|
| 3973 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 3974 |
parcel.writeInt(mBoundsInScreen.top); |
| 3975 |
parcel.writeInt(mBoundsInScreen.bottom); |
| 3976 |
parcel.writeInt(mBoundsInScreen.left); |
| 3977 |
parcel.writeInt(mBoundsInScreen.right); |
| 3978 |
} |
| 3979 |
|
| 3980 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 3981 |
if (mActions != null && !mActions.isEmpty()) { |
| 3982 |
final int actionCount = mActions.size(); |
| 3983 |
|
| 3984 |
int nonStandardActionCount = 0; |
| 3985 |
long defaultStandardActions = 0; |
| 3986 |
for (int i = 0; i < actionCount; i++) { |
| 3987 |
AccessibilityAction action = mActions.get(i); |
| 3988 |
if (isDefaultStandardAction(action)) { |
| 3989 |
defaultStandardActions |= action.mSerializationFlag; |
| 3990 |
} else { |
| 3991 |
nonStandardActionCount++; |
| 3992 |
} |
| 3993 |
} |
| 3994 |
parcel.writeLong(defaultStandardActions); |
| 3995 |
|
| 3996 |
parcel.writeInt(nonStandardActionCount); |
| 3997 |
for (int i = 0; i < actionCount; i++) { |
| 3998 |
AccessibilityAction action = mActions.get(i); |
| 3999 |
if (!isDefaultStandardAction(action)) { |
| 4000 |
action.writeToParcel(parcel, flags); |
| 4001 |
} |
| 4002 |
} |
| 4003 |
} else { |
| 4004 |
parcel.writeLong(0); |
| 4005 |
parcel.writeInt(0); |
| 4006 |
} |
| 4007 |
} |
| 4008 |
|
| 4009 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mMaxTextLength); |
| 4010 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mMovementGranularities); |
| 4011 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mBooleanProperties); |
| 4012 |
|
| 4013 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mPackageName); |
| 4014 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mClassName); |
| 4015 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mText); |
| 4016 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mHintText); |
| 4017 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mError); |
| 4018 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mStateDescription); |
| 4019 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4020 |
parcel.writeCharSequence(mContentDescription); |
| 4021 |
} |
| 4022 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mPaneTitle); |
| 4023 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeCharSequence(mTooltipText); |
| 4024 |
|
| 4025 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeString(mViewIdResourceName); |
| 4026 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeString(mUniqueId); |
| 4027 |
|
| 4028 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mTextSelectionStart); |
| 4029 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mTextSelectionEnd); |
| 4030 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mInputType); |
| 4031 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mLiveRegion); |
| 4032 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeInt(mDrawingOrderInParent); |
| 4033 |
|
| 4034 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeStringList(mExtraDataKeys); |
| 4035 |
|
| 4036 |
if (isBitSet(nonDefaultFields, fieldIndex++)) parcel.writeBundle(mExtras); |
| 4037 |
|
| 4038 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4039 |
parcel.writeInt(mRangeInfo.getType()); |
| 4040 |
parcel.writeFloat(mRangeInfo.getMin()); |
| 4041 |
parcel.writeFloat(mRangeInfo.getMax()); |
| 4042 |
parcel.writeFloat(mRangeInfo.getCurrent()); |
| 4043 |
} |
| 4044 |
|
| 4045 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4046 |
parcel.writeInt(mCollectionInfo.getRowCount()); |
| 4047 |
parcel.writeInt(mCollectionInfo.getColumnCount()); |
| 4048 |
parcel.writeInt(mCollectionInfo.isHierarchical() ? 1 : 0); |
| 4049 |
parcel.writeInt(mCollectionInfo.getSelectionMode()); |
| 4050 |
} |
| 4051 |
|
| 4052 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4053 |
parcel.writeString(mCollectionItemInfo.getRowTitle()); |
| 4054 |
parcel.writeInt(mCollectionItemInfo.getRowIndex()); |
| 4055 |
parcel.writeInt(mCollectionItemInfo.getRowSpan()); |
| 4056 |
parcel.writeString(mCollectionItemInfo.getColumnTitle()); |
| 4057 |
parcel.writeInt(mCollectionItemInfo.getColumnIndex()); |
| 4058 |
parcel.writeInt(mCollectionItemInfo.getColumnSpan()); |
| 4059 |
parcel.writeInt(mCollectionItemInfo.isHeading() ? 1 : 0); |
| 4060 |
parcel.writeInt(mCollectionItemInfo.isSelected() ? 1 : 0); |
| 4061 |
} |
| 4062 |
|
| 4063 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4064 |
mTouchDelegateInfo.writeToParcel(parcel, flags); |
| 4065 |
} |
| 4066 |
|
| 4067 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4068 |
parcel.writeValue(mExtraRenderingInfo.getLayoutSize()); |
| 4069 |
parcel.writeFloat(mExtraRenderingInfo.getTextSizeInPx()); |
| 4070 |
parcel.writeInt(mExtraRenderingInfo.getTextSizeUnit()); |
| 4071 |
} |
| 4072 |
|
| 4073 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4074 |
parcel.writeStrongBinder(mLeashedChild); |
| 4075 |
} |
| 4076 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4077 |
parcel.writeStrongBinder(mLeashedParent); |
| 4078 |
} |
| 4079 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4080 |
parcel.writeLong(mLeashedParentNodeId); |
| 4081 |
} |
| 4082 |
|
| 4083 |
if (DEBUG) { |
| 4084 |
fieldIndex--; |
| 4085 |
if (totalFields != fieldIndex) { |
| 4086 |
throw new IllegalStateException("Number of fields mismatch: " + totalFields |
| 4087 |
+ " vs " + fieldIndex); |
| 4088 |
} |
| 4089 |
} |
| 4090 |
} |
| 4091 |
|
| 4092 |
|
| 4093 |
|
| 4094 |
|
| 4095 |
|
| 4096 |
|
| 4097 |
private void init(AccessibilityNodeInfo other) { |
| 4098 |
mSealed = other.mSealed; |
| 4099 |
mSourceNodeId = other.mSourceNodeId; |
| 4100 |
mParentNodeId = other.mParentNodeId; |
| 4101 |
mLabelForId = other.mLabelForId; |
| 4102 |
mLabeledById = other.mLabeledById; |
| 4103 |
mTraversalBefore = other.mTraversalBefore; |
| 4104 |
mTraversalAfter = other.mTraversalAfter; |
| 4105 |
mWindowId = other.mWindowId; |
| 4106 |
mConnectionId = other.mConnectionId; |
| 4107 |
mUniqueId = other.mUniqueId; |
| 4108 |
mBoundsInParent.set(other.mBoundsInParent); |
| 4109 |
mBoundsInScreen.set(other.mBoundsInScreen); |
| 4110 |
mPackageName = other.mPackageName; |
| 4111 |
mClassName = other.mClassName; |
| 4112 |
mText = other.mText; |
| 4113 |
mOriginalText = other.mOriginalText; |
| 4114 |
mHintText = other.mHintText; |
| 4115 |
mError = other.mError; |
| 4116 |
mStateDescription = other.mStateDescription; |
| 4117 |
mContentDescription = other.mContentDescription; |
| 4118 |
mPaneTitle = other.mPaneTitle; |
| 4119 |
mTooltipText = other.mTooltipText; |
| 4120 |
mViewIdResourceName = other.mViewIdResourceName; |
| 4121 |
|
| 4122 |
if (mActions != null) mActions.clear(); |
| 4123 |
final ArrayList<AccessibilityAction> otherActions = other.mActions; |
| 4124 |
if (otherActions != null && otherActions.size() > 0) { |
| 4125 |
if (mActions == null) { |
| 4126 |
mActions = new ArrayList(otherActions); |
| 4127 |
} else { |
| 4128 |
mActions.addAll(other.mActions); |
| 4129 |
} |
| 4130 |
} |
| 4131 |
|
| 4132 |
mBooleanProperties = other.mBooleanProperties; |
| 4133 |
mMaxTextLength = other.mMaxTextLength; |
| 4134 |
mMovementGranularities = other.mMovementGranularities; |
| 4135 |
|
| 4136 |
|
| 4137 |
if (mChildNodeIds != null) mChildNodeIds.clear(); |
| 4138 |
final LongArray otherChildNodeIds = other.mChildNodeIds; |
| 4139 |
if (otherChildNodeIds != null && otherChildNodeIds.size() > 0) { |
| 4140 |
if (mChildNodeIds == null) { |
| 4141 |
mChildNodeIds = otherChildNodeIds.clone(); |
| 4142 |
} else { |
| 4143 |
mChildNodeIds.addAll(otherChildNodeIds); |
| 4144 |
} |
| 4145 |
} |
| 4146 |
|
| 4147 |
mTextSelectionStart = other.mTextSelectionStart; |
| 4148 |
mTextSelectionEnd = other.mTextSelectionEnd; |
| 4149 |
mInputType = other.mInputType; |
| 4150 |
mLiveRegion = other.mLiveRegion; |
| 4151 |
mDrawingOrderInParent = other.mDrawingOrderInParent; |
| 4152 |
|
| 4153 |
mExtraDataKeys = other.mExtraDataKeys; |
| 4154 |
|
| 4155 |
mExtras = other.mExtras != null ? new Bundle(other.mExtras) : null; |
| 4156 |
|
| 4157 |
initCopyInfos(other); |
| 4158 |
|
| 4159 |
final TouchDelegateInfo otherInfo = other.mTouchDelegateInfo; |
| 4160 |
mTouchDelegateInfo = (otherInfo != null) |
| 4161 |
? new TouchDelegateInfo(otherInfo.mTargetMap, true) : null; |
| 4162 |
|
| 4163 |
mLeashedChild = other.mLeashedChild; |
| 4164 |
mLeashedParent = other.mLeashedParent; |
| 4165 |
mLeashedParentNodeId = other.mLeashedParentNodeId; |
| 4166 |
} |
| 4167 |
|
| 4168 |
private void initCopyInfos(AccessibilityNodeInfo other) { |
| 4169 |
RangeInfo ri = other.mRangeInfo; |
| 4170 |
mRangeInfo = (ri == null) ? null |
| 4171 |
: new RangeInfo(ri.mType, ri.mMin, ri.mMax, ri.mCurrent); |
| 4172 |
CollectionInfo ci = other.mCollectionInfo; |
| 4173 |
mCollectionInfo = (ci == null) ? null |
| 4174 |
: new CollectionInfo(ci.mRowCount, ci.mColumnCount, |
| 4175 |
ci.mHierarchical, ci.mSelectionMode); |
| 4176 |
CollectionItemInfo cii = other.mCollectionItemInfo; |
| 4177 |
CollectionItemInfo.Builder builder = new CollectionItemInfo.Builder(); |
| 4178 |
mCollectionItemInfo = (cii == null) ? null |
| 4179 |
: builder.setRowTitle(cii.mRowTitle).setRowIndex(cii.mRowIndex).setRowSpan( |
| 4180 |
cii.mRowSpan).setColumnTitle(cii.mColumnTitle).setColumnIndex( |
| 4181 |
cii.mColumnIndex).setColumnSpan(cii.mColumnSpan).setHeading( |
| 4182 |
cii.mHeading).setSelected(cii.mSelected).build(); |
| 4183 |
ExtraRenderingInfo ti = other.mExtraRenderingInfo; |
| 4184 |
mExtraRenderingInfo = (ti == null) ? null |
| 4185 |
: new ExtraRenderingInfo(ti); |
| 4186 |
} |
| 4187 |
|
| 4188 |
|
| 4189 |
|
| 4190 |
|
| 4191 |
|
| 4192 |
|
| 4193 |
private void initFromParcel(Parcel parcel) { |
| 4194 |
|
| 4195 |
long nonDefaultFields = parcel.readLong(); |
| 4196 |
int fieldIndex = 0; |
| 4197 |
final boolean sealed = isBitSet(nonDefaultFields, fieldIndex++) |
| 4198 |
? (parcel.readInt() == 1) |
| 4199 |
: DEFAULT.mSealed; |
| 4200 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mSourceNodeId = parcel.readLong(); |
| 4201 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mWindowId = parcel.readInt(); |
| 4202 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mParentNodeId = parcel.readLong(); |
| 4203 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mLabelForId = parcel.readLong(); |
| 4204 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mLabeledById = parcel.readLong(); |
| 4205 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mTraversalBefore = parcel.readLong(); |
| 4206 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mTraversalAfter = parcel.readLong(); |
| 4207 |
|
| 4208 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mConnectionId = parcel.readInt(); |
| 4209 |
|
| 4210 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4211 |
final int childrenSize = parcel.readInt(); |
| 4212 |
if (childrenSize <= 0) { |
| 4213 |
mChildNodeIds = null; |
| 4214 |
} else { |
| 4215 |
mChildNodeIds = new LongArray(childrenSize); |
| 4216 |
for (int i = 0; i < childrenSize; i++) { |
| 4217 |
final long childId = parcel.readLong(); |
| 4218 |
mChildNodeIds.add(childId); |
| 4219 |
} |
| 4220 |
} |
| 4221 |
} |
| 4222 |
|
| 4223 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4224 |
mBoundsInParent.top = parcel.readInt(); |
| 4225 |
mBoundsInParent.bottom = parcel.readInt(); |
| 4226 |
mBoundsInParent.left = parcel.readInt(); |
| 4227 |
mBoundsInParent.right = parcel.readInt(); |
| 4228 |
} |
| 4229 |
|
| 4230 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4231 |
mBoundsInScreen.top = parcel.readInt(); |
| 4232 |
mBoundsInScreen.bottom = parcel.readInt(); |
| 4233 |
mBoundsInScreen.left = parcel.readInt(); |
| 4234 |
mBoundsInScreen.right = parcel.readInt(); |
| 4235 |
} |
| 4236 |
|
| 4237 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4238 |
final long standardActions = parcel.readLong(); |
| 4239 |
addStandardActions(standardActions); |
| 4240 |
final int nonStandardActionCount = parcel.readInt(); |
| 4241 |
for (int i = 0; i < nonStandardActionCount; i++) { |
| 4242 |
final AccessibilityAction action = |
| 4243 |
AccessibilityAction.CREATOR.createFromParcel(parcel); |
| 4244 |
addActionUnchecked(action); |
| 4245 |
} |
| 4246 |
} |
| 4247 |
|
| 4248 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mMaxTextLength = parcel.readInt(); |
| 4249 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mMovementGranularities = parcel.readInt(); |
| 4250 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mBooleanProperties = parcel.readInt(); |
| 4251 |
|
| 4252 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mPackageName = parcel.readCharSequence(); |
| 4253 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mClassName = parcel.readCharSequence(); |
| 4254 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mText = parcel.readCharSequence(); |
| 4255 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mHintText = parcel.readCharSequence(); |
| 4256 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mError = parcel.readCharSequence(); |
| 4257 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mStateDescription = parcel.readCharSequence(); |
| 4258 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4259 |
mContentDescription = parcel.readCharSequence(); |
| 4260 |
} |
| 4261 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mPaneTitle = parcel.readCharSequence(); |
| 4262 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mTooltipText = parcel.readCharSequence(); |
| 4263 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mViewIdResourceName = parcel.readString(); |
| 4264 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mUniqueId = parcel.readString(); |
| 4265 |
|
| 4266 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mTextSelectionStart = parcel.readInt(); |
| 4267 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mTextSelectionEnd = parcel.readInt(); |
| 4268 |
|
| 4269 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mInputType = parcel.readInt(); |
| 4270 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mLiveRegion = parcel.readInt(); |
| 4271 |
if (isBitSet(nonDefaultFields, fieldIndex++)) mDrawingOrderInParent = parcel.readInt(); |
| 4272 |
|
| 4273 |
mExtraDataKeys = isBitSet(nonDefaultFields, fieldIndex++) |
| 4274 |
? parcel.createStringArrayList() |
| 4275 |
: null; |
| 4276 |
|
| 4277 |
mExtras = isBitSet(nonDefaultFields, fieldIndex++) |
| 4278 |
? parcel.readBundle() |
| 4279 |
: null; |
| 4280 |
|
| 4281 |
mRangeInfo = isBitSet(nonDefaultFields, fieldIndex++) |
| 4282 |
? new RangeInfo( |
| 4283 |
parcel.readInt(), |
| 4284 |
parcel.readFloat(), |
| 4285 |
parcel.readFloat(), |
| 4286 |
parcel.readFloat()) |
| 4287 |
: null; |
| 4288 |
|
| 4289 |
mCollectionInfo = isBitSet(nonDefaultFields, fieldIndex++) |
| 4290 |
? new CollectionInfo( |
| 4291 |
parcel.readInt(), |
| 4292 |
parcel.readInt(), |
| 4293 |
parcel.readInt() == 1, |
| 4294 |
parcel.readInt()) |
| 4295 |
: null; |
| 4296 |
|
| 4297 |
mCollectionItemInfo = isBitSet(nonDefaultFields, fieldIndex++) |
| 4298 |
? new CollectionItemInfo( |
| 4299 |
parcel.readString(), |
| 4300 |
parcel.readInt(), |
| 4301 |
parcel.readInt(), |
| 4302 |
parcel.readString(), |
| 4303 |
parcel.readInt(), |
| 4304 |
parcel.readInt(), |
| 4305 |
parcel.readInt() == 1, |
| 4306 |
parcel.readInt() == 1) |
| 4307 |
: null; |
| 4308 |
|
| 4309 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4310 |
mTouchDelegateInfo = TouchDelegateInfo.CREATOR.createFromParcel(parcel); |
| 4311 |
} |
| 4312 |
|
| 4313 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4314 |
mExtraRenderingInfo = new ExtraRenderingInfo(null); |
| 4315 |
mExtraRenderingInfo.mLayoutSize = (Size) parcel.readValue(null); |
| 4316 |
mExtraRenderingInfo.mTextSizeInPx = parcel.readFloat(); |
| 4317 |
mExtraRenderingInfo.mTextSizeUnit = parcel.readInt(); |
| 4318 |
} |
| 4319 |
|
| 4320 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4321 |
mLeashedChild = parcel.readStrongBinder(); |
| 4322 |
} |
| 4323 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4324 |
mLeashedParent = parcel.readStrongBinder(); |
| 4325 |
} |
| 4326 |
if (isBitSet(nonDefaultFields, fieldIndex++)) { |
| 4327 |
mLeashedParentNodeId = parcel.readLong(); |
| 4328 |
} |
| 4329 |
|
| 4330 |
mSealed = sealed; |
| 4331 |
} |
| 4332 |
|
| 4333 |
|
| 4334 |
|
| 4335 |
|
| 4336 |
private void clear() { |
| 4337 |
init(DEFAULT); |
| 4338 |
} |
| 4339 |
|
| 4340 |
private static boolean isDefaultStandardAction(AccessibilityAction action) { |
| 4341 |
return (action.mSerializationFlag != -1L) && TextUtils.isEmpty(action.getLabel()); |
| 4342 |
} |
| 4343 |
|
| 4344 |
private static AccessibilityAction getActionSingleton(int actionId) { |
| 4345 |
final int actions = AccessibilityAction.sStandardActions.size(); |
| 4346 |
for (int i = 0; i < actions; i++) { |
| 4347 |
AccessibilityAction currentAction = AccessibilityAction.sStandardActions.valueAt(i); |
| 4348 |
if (actionId == currentAction.getId()) { |
| 4349 |
return currentAction; |
| 4350 |
} |
| 4351 |
} |
| 4352 |
|
| 4353 |
return null; |
| 4354 |
} |
| 4355 |
|
| 4356 |
private static AccessibilityAction getActionSingletonBySerializationFlag(long flag) { |
| 4357 |
final int actions = AccessibilityAction.sStandardActions.size(); |
| 4358 |
for (int i = 0; i < actions; i++) { |
| 4359 |
AccessibilityAction currentAction = AccessibilityAction.sStandardActions.valueAt(i); |
| 4360 |
if (flag == currentAction.mSerializationFlag) { |
| 4361 |
return currentAction; |
| 4362 |
} |
| 4363 |
} |
| 4364 |
|
| 4365 |
return null; |
| 4366 |
} |
| 4367 |
|
| 4368 |
private void addStandardActions(long serializationIdMask) { |
| 4369 |
long remainingIds = serializationIdMask; |
| 4370 |
while (remainingIds > 0) { |
| 4371 |
final long id = 1L << Long.numberOfTrailingZeros(remainingIds); |
| 4372 |
remainingIds &= ~id; |
| 4373 |
AccessibilityAction action = getActionSingletonBySerializationFlag(id); |
| 4374 |
addAction(action); |
| 4375 |
} |
| 4376 |
} |
| 4377 |
|
| 4378 |
|
| 4379 |
|
| 4380 |
|
| 4381 |
|
| 4382 |
|
| 4383 |
|
| 4384 |
private static String getActionSymbolicName(int action) { |
| 4385 |
switch (action) { |
| 4386 |
case ACTION_FOCUS: |
| 4387 |
return "ACTION_FOCUS"; |
| 4388 |
case ACTION_CLEAR_FOCUS: |
| 4389 |
return "ACTION_CLEAR_FOCUS"; |
| 4390 |
case ACTION_SELECT: |
| 4391 |
return "ACTION_SELECT"; |
| 4392 |
case ACTION_CLEAR_SELECTION: |
| 4393 |
return "ACTION_CLEAR_SELECTION"; |
| 4394 |
case ACTION_CLICK: |
| 4395 |
return "ACTION_CLICK"; |
| 4396 |
case ACTION_LONG_CLICK: |
| 4397 |
return "ACTION_LONG_CLICK"; |
| 4398 |
case ACTION_ACCESSIBILITY_FOCUS: |
| 4399 |
return "ACTION_ACCESSIBILITY_FOCUS"; |
| 4400 |
case ACTION_CLEAR_ACCESSIBILITY_FOCUS: |
| 4401 |
return "ACTION_CLEAR_ACCESSIBILITY_FOCUS"; |
| 4402 |
case ACTION_NEXT_AT_MOVEMENT_GRANULARITY: |
| 4403 |
return "ACTION_NEXT_AT_MOVEMENT_GRANULARITY"; |
| 4404 |
case ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: |
| 4405 |
return "ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY"; |
| 4406 |
case ACTION_NEXT_HTML_ELEMENT: |
| 4407 |
return "ACTION_NEXT_HTML_ELEMENT"; |
| 4408 |
case ACTION_PREVIOUS_HTML_ELEMENT: |
| 4409 |
return "ACTION_PREVIOUS_HTML_ELEMENT"; |
| 4410 |
case ACTION_SCROLL_FORWARD: |
| 4411 |
return "ACTION_SCROLL_FORWARD"; |
| 4412 |
case ACTION_SCROLL_BACKWARD: |
| 4413 |
return "ACTION_SCROLL_BACKWARD"; |
| 4414 |
case ACTION_CUT: |
| 4415 |
return "ACTION_CUT"; |
| 4416 |
case ACTION_COPY: |
| 4417 |
return "ACTION_COPY"; |
| 4418 |
case ACTION_PASTE: |
| 4419 |
return "ACTION_PASTE"; |
| 4420 |
case ACTION_SET_SELECTION: |
| 4421 |
return "ACTION_SET_SELECTION"; |
| 4422 |
case ACTION_EXPAND: |
| 4423 |
return "ACTION_EXPAND"; |
| 4424 |
case ACTION_COLLAPSE: |
| 4425 |
return "ACTION_COLLAPSE"; |
| 4426 |
case ACTION_DISMISS: |
| 4427 |
return "ACTION_DISMISS"; |
| 4428 |
case ACTION_SET_TEXT: |
| 4429 |
return "ACTION_SET_TEXT"; |
| 4430 |
case R.id.accessibilityActionShowOnScreen: |
| 4431 |
return "ACTION_SHOW_ON_SCREEN"; |
| 4432 |
case R.id.accessibilityActionScrollToPosition: |
| 4433 |
return "ACTION_SCROLL_TO_POSITION"; |
| 4434 |
case R.id.accessibilityActionScrollUp: |
| 4435 |
return "ACTION_SCROLL_UP"; |
| 4436 |
case R.id.accessibilityActionScrollLeft: |
| 4437 |
return "ACTION_SCROLL_LEFT"; |
| 4438 |
case R.id.accessibilityActionScrollDown: |
| 4439 |
return "ACTION_SCROLL_DOWN"; |
| 4440 |
case R.id.accessibilityActionScrollRight: |
| 4441 |
return "ACTION_SCROLL_RIGHT"; |
| 4442 |
case R.id.accessibilityActionPageDown: |
| 4443 |
return "ACTION_PAGE_DOWN"; |
| 4444 |
case R.id.accessibilityActionPageUp: |
| 4445 |
return "ACTION_PAGE_UP"; |
| 4446 |
case R.id.accessibilityActionPageLeft: |
| 4447 |
return "ACTION_PAGE_LEFT"; |
| 4448 |
case R.id.accessibilityActionPageRight: |
| 4449 |
return "ACTION_PAGE_RIGHT"; |
| 4450 |
case R.id.accessibilityActionSetProgress: |
| 4451 |
return "ACTION_SET_PROGRESS"; |
| 4452 |
case R.id.accessibilityActionContextClick: |
| 4453 |
return "ACTION_CONTEXT_CLICK"; |
| 4454 |
case R.id.accessibilityActionShowTooltip: |
| 4455 |
return "ACTION_SHOW_TOOLTIP"; |
| 4456 |
case R.id.accessibilityActionHideTooltip: |
| 4457 |
return "ACTION_HIDE_TOOLTIP"; |
| 4458 |
case R.id.accessibilityActionPressAndHold: |
| 4459 |
return "ACTION_PRESS_AND_HOLD"; |
| 4460 |
case R.id.accessibilityActionImeEnter: |
| 4461 |
return "ACTION_IME_ENTER"; |
| 4462 |
case R.id.accessibilityActionDragStart: |
| 4463 |
return "ACTION_DRAG"; |
| 4464 |
case R.id.accessibilityActionDragCancel: |
| 4465 |
return "ACTION_CANCEL_DRAG"; |
| 4466 |
case R.id.accessibilityActionDragDrop: |
| 4467 |
return "ACTION_DROP"; |
| 4468 |
default: { |
| 4469 |
if (action == R.id.accessibilityActionShowTextSuggestions) { |
| 4470 |
return "ACTION_SHOW_TEXT_SUGGESTIONS"; |
| 4471 |
} |
| 4472 |
return "ACTION_UNKNOWN"; |
| 4473 |
} |
| 4474 |
} |
| 4475 |
} |
| 4476 |
|
| 4477 |
|
| 4478 |
|
| 4479 |
|
| 4480 |
|
| 4481 |
|
| 4482 |
|
| 4483 |
private static String getMovementGranularitySymbolicName(int granularity) { |
| 4484 |
switch (granularity) { |
| 4485 |
case MOVEMENT_GRANULARITY_CHARACTER: |
| 4486 |
return "MOVEMENT_GRANULARITY_CHARACTER"; |
| 4487 |
case MOVEMENT_GRANULARITY_WORD: |
| 4488 |
return "MOVEMENT_GRANULARITY_WORD"; |
| 4489 |
case MOVEMENT_GRANULARITY_LINE: |
| 4490 |
return "MOVEMENT_GRANULARITY_LINE"; |
| 4491 |
case MOVEMENT_GRANULARITY_PARAGRAPH: |
| 4492 |
return "MOVEMENT_GRANULARITY_PARAGRAPH"; |
| 4493 |
case MOVEMENT_GRANULARITY_PAGE: |
| 4494 |
return "MOVEMENT_GRANULARITY_PAGE"; |
| 4495 |
default: |
| 4496 |
throw new IllegalArgumentException("Unknown movement granularity: " + granularity); |
| 4497 |
} |
| 4498 |
} |
| 4499 |
|
| 4500 |
private static boolean canPerformRequestOverConnection(int connectionId, |
| 4501 |
int windowId, long accessibilityNodeId) { |
| 4502 |
return ((windowId != AccessibilityWindowInfo.UNDEFINED_WINDOW_ID) |
| 4503 |
&& (getAccessibilityViewId(accessibilityNodeId) != UNDEFINED_ITEM_ID) |
| 4504 |
&& (connectionId != UNDEFINED_CONNECTION_ID)); |
| 4505 |
} |
| 4506 |
|
| 4507 |
@Override |
| 4508 |
public boolean equals(@Nullable Object object) { |
| 4509 |
if (this == object) { |
| 4510 |
return true; |
| 4511 |
} |
| 4512 |
if (object == null) { |
| 4513 |
return false; |
| 4514 |
} |
| 4515 |
if (getClass() != object.getClass()) { |
| 4516 |
return false; |
| 4517 |
} |
| 4518 |
AccessibilityNodeInfo other = (AccessibilityNodeInfo) object; |
| 4519 |
if (mSourceNodeId != other.mSourceNodeId) { |
| 4520 |
return false; |
| 4521 |
} |
| 4522 |
if (mWindowId != other.mWindowId) { |
| 4523 |
return false; |
| 4524 |
} |
| 4525 |
return true; |
| 4526 |
} |
| 4527 |
|
| 4528 |
@Override |
| 4529 |
public int hashCode() { |
| 4530 |
final int prime = 31; |
| 4531 |
int result = 1; |
| 4532 |
result = prime * result + getAccessibilityViewId(mSourceNodeId); |
| 4533 |
result = prime * result + getVirtualDescendantId(mSourceNodeId); |
| 4534 |
result = prime * result + mWindowId; |
| 4535 |
return result; |
| 4536 |
} |
| 4537 |
|
| 4538 |
@Override |
| 4539 |
public String toString() { |
| 4540 |
StringBuilder builder = new StringBuilder(); |
| 4541 |
builder.append(super.toString()); |
| 4542 |
|
| 4543 |
if (DEBUG) { |
| 4544 |
builder.append("; sourceNodeId: 0x").append(Long.toHexString(mSourceNodeId)); |
| 4545 |
builder.append("; windowId: 0x").append(Long.toHexString(mWindowId)); |
| 4546 |
builder.append("; accessibilityViewId: 0x") |
| 4547 |
.append(Long.toHexString(getAccessibilityViewId(mSourceNodeId))); |
| 4548 |
builder.append("; virtualDescendantId: 0x") |
| 4549 |
.append(Long.toHexString(getVirtualDescendantId(mSourceNodeId))); |
| 4550 |
builder.append("; mParentNodeId: 0x").append(Long.toHexString(mParentNodeId)); |
| 4551 |
builder.append("; traversalBefore: 0x").append(Long.toHexString(mTraversalBefore)); |
| 4552 |
builder.append("; traversalAfter: 0x").append(Long.toHexString(mTraversalAfter)); |
| 4553 |
|
| 4554 |
int granularities = mMovementGranularities; |
| 4555 |
builder.append("; MovementGranularities: ["); |
| 4556 |
while (granularities != 0) { |
| 4557 |
final int granularity = 1 << Integer.numberOfTrailingZeros(granularities); |
| 4558 |
granularities &= ~granularity; |
| 4559 |
builder.append(getMovementGranularitySymbolicName(granularity)); |
| 4560 |
if (granularities != 0) { |
| 4561 |
builder.append(", "); |
| 4562 |
} |
| 4563 |
} |
| 4564 |
builder.append("]"); |
| 4565 |
|
| 4566 |
builder.append("; childAccessibilityIds: ["); |
| 4567 |
final LongArray childIds = mChildNodeIds; |
| 4568 |
if (childIds != null) { |
| 4569 |
for (int i = 0, count = childIds.size(); i < count; i++) { |
| 4570 |
builder.append("0x").append(Long.toHexString(childIds.get(i))); |
| 4571 |
if (i < count - 1) { |
| 4572 |
builder.append(", "); |
| 4573 |
} |
| 4574 |
} |
| 4575 |
} |
| 4576 |
builder.append("]"); |
| 4577 |
} |
| 4578 |
|
| 4579 |
builder.append("; boundsInParent: ").append(mBoundsInParent); |
| 4580 |
builder.append("; boundsInScreen: ").append(mBoundsInScreen); |
| 4581 |
|
| 4582 |
builder.append("; packageName: ").append(mPackageName); |
| 4583 |
builder.append("; className: ").append(mClassName); |
| 4584 |
builder.append("; text: ").append(mText); |
| 4585 |
builder.append("; error: ").append(mError); |
| 4586 |
builder.append("; maxTextLength: ").append(mMaxTextLength); |
| 4587 |
builder.append("; stateDescription: ").append(mStateDescription); |
| 4588 |
builder.append("; contentDescription: ").append(mContentDescription); |
| 4589 |
builder.append("; tooltipText: ").append(mTooltipText); |
| 4590 |
builder.append("; viewIdResName: ").append(mViewIdResourceName); |
| 4591 |
builder.append("; uniqueId: ").append(mUniqueId); |
| 4592 |
|
| 4593 |
builder.append("; checkable: ").append(isCheckable()); |
| 4594 |
builder.append("; checked: ").append(isChecked()); |
| 4595 |
builder.append("; focusable: ").append(isFocusable()); |
| 4596 |
builder.append("; focused: ").append(isFocused()); |
| 4597 |
builder.append("; selected: ").append(isSelected()); |
| 4598 |
builder.append("; clickable: ").append(isClickable()); |
| 4599 |
builder.append("; longClickable: ").append(isLongClickable()); |
| 4600 |
builder.append("; contextClickable: ").append(isContextClickable()); |
| 4601 |
builder.append("; enabled: ").append(isEnabled()); |
| 4602 |
builder.append("; password: ").append(isPassword()); |
| 4603 |
builder.append("; scrollable: ").append(isScrollable()); |
| 4604 |
builder.append("; importantForAccessibility: ").append(isImportantForAccessibility()); |
| 4605 |
builder.append("; visible: ").append(isVisibleToUser()); |
| 4606 |
builder.append("; actions: ").append(mActions); |
| 4607 |
builder.append("; isTextSelectable: ").append(isTextSelectable()); |
| 4608 |
|
| 4609 |
return builder.toString(); |
| 4610 |
} |
| 4611 |
|
| 4612 |
private static AccessibilityNodeInfo getNodeForAccessibilityId(int connectionId, |
| 4613 |
int windowId, long accessibilityId) { |
| 4614 |
return getNodeForAccessibilityId(connectionId, windowId, accessibilityId, |
| 4615 |
FLAG_PREFETCH_ANCESTORS |
| 4616 |
| FLAG_PREFETCH_DESCENDANTS_HYBRID | FLAG_PREFETCH_SIBLINGS); |
| 4617 |
} |
| 4618 |
|
| 4619 |
private static AccessibilityNodeInfo getNodeForAccessibilityId(int connectionId, |
| 4620 |
int windowId, long accessibilityId, @PrefetchingStrategy int prefetchingStrategy) { |
| 4621 |
if (!canPerformRequestOverConnection(connectionId, windowId, accessibilityId)) { |
| 4622 |
return null; |
| 4623 |
} |
| 4624 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 4625 |
return client.findAccessibilityNodeInfoByAccessibilityId(connectionId, |
| 4626 |
windowId, accessibilityId, false, prefetchingStrategy, null); |
| 4627 |
} |
| 4628 |
|
| 4629 |
private static AccessibilityNodeInfo getNodeForAccessibilityId(int connectionId, |
| 4630 |
IBinder leashToken, long accessibilityId) { |
| 4631 |
return getNodeForAccessibilityId(connectionId, leashToken, accessibilityId, |
| 4632 |
FLAG_PREFETCH_ANCESTORS |
| 4633 |
| FLAG_PREFETCH_DESCENDANTS_HYBRID | FLAG_PREFETCH_SIBLINGS); |
| 4634 |
} |
| 4635 |
|
| 4636 |
private static AccessibilityNodeInfo getNodeForAccessibilityId(int connectionId, |
| 4637 |
IBinder leashToken, long accessibilityId, |
| 4638 |
@PrefetchingStrategy int prefetchingStrategy) { |
| 4639 |
if (!((leashToken != null) |
| 4640 |
&& (getAccessibilityViewId(accessibilityId) != UNDEFINED_ITEM_ID) |
| 4641 |
&& (connectionId != UNDEFINED_CONNECTION_ID))) { |
| 4642 |
return null; |
| 4643 |
} |
| 4644 |
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); |
| 4645 |
return client.findAccessibilityNodeInfoByAccessibilityId(connectionId, |
| 4646 |
leashToken, accessibilityId, false, prefetchingStrategy, null); |
| 4647 |
} |
| 4648 |
|
| 4649 |
|
| 4650 |
public static String idToString(long accessibilityId) { |
| 4651 |
int accessibilityViewId = getAccessibilityViewId(accessibilityId); |
| 4652 |
int virtualDescendantId = getVirtualDescendantId(accessibilityId); |
| 4653 |
return virtualDescendantId == AccessibilityNodeProvider.HOST_VIEW_ID |
| 4654 |
? idItemToString(accessibilityViewId) |
| 4655 |
: idItemToString(accessibilityViewId) + ":" + idItemToString(virtualDescendantId); |
| 4656 |
} |
| 4657 |
|
| 4658 |
private static String idItemToString(int item) { |
| 4659 |
switch (item) { |
| 4660 |
case ROOT_ITEM_ID: return "ROOT"; |
| 4661 |
case UNDEFINED_ITEM_ID: return "UNDEFINED"; |
| 4662 |
case AccessibilityNodeProvider.HOST_VIEW_ID: return "HOST"; |
| 4663 |
default: return "" + item; |
| 4664 |
} |
| 4665 |
} |
| 4666 |
|
| 4667 |
|
| 4668 |
|
| 4669 |
|
| 4670 |
|
| 4671 |
|
| 4672 |
|
| 4673 |
|
| 4674 |
|
| 4675 |
|
| 4676 |
|
| 4677 |
|
| 4678 |
|
| 4679 |
|
| 4680 |
|
| 4681 |
|
| 4682 |
|
| 4683 |
|
| 4684 |
|
| 4685 |
|
| 4686 |
|
| 4687 |
|
| 4688 |
|
| 4689 |
|
| 4690 |
|
| 4691 |
|
| 4692 |
|
| 4693 |
|
| 4694 |
|
| 4695 |
|
| 4696 |
|
| 4697 |
|
| 4698 |
|
| 4699 |
|
| 4700 |
|
| 4701 |
public static final class AccessibilityAction implements Parcelable { |
| 4702 |
|
| 4703 |
|
| 4704 |
public static final ArraySet<AccessibilityAction> sStandardActions = new ArraySet<>(); |
| 4705 |
|
| 4706 |
|
| 4707 |
|
| 4708 |
|
| 4709 |
public static final AccessibilityAction ACTION_FOCUS = |
| 4710 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_FOCUS); |
| 4711 |
|
| 4712 |
|
| 4713 |
|
| 4714 |
|
| 4715 |
public static final AccessibilityAction ACTION_CLEAR_FOCUS = |
| 4716 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_CLEAR_FOCUS); |
| 4717 |
|
| 4718 |
|
| 4719 |
|
| 4720 |
|
| 4721 |
public static final AccessibilityAction ACTION_SELECT = |
| 4722 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_SELECT); |
| 4723 |
|
| 4724 |
|
| 4725 |
|
| 4726 |
|
| 4727 |
public static final AccessibilityAction ACTION_CLEAR_SELECTION = |
| 4728 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_CLEAR_SELECTION); |
| 4729 |
|
| 4730 |
|
| 4731 |
|
| 4732 |
|
| 4733 |
public static final AccessibilityAction ACTION_CLICK = |
| 4734 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK); |
| 4735 |
|
| 4736 |
|
| 4737 |
|
| 4738 |
|
| 4739 |
public static final AccessibilityAction ACTION_LONG_CLICK = |
| 4740 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK); |
| 4741 |
|
| 4742 |
|
| 4743 |
|
| 4744 |
|
| 4745 |
public static final AccessibilityAction ACTION_ACCESSIBILITY_FOCUS = |
| 4746 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); |
| 4747 |
|
| 4748 |
|
| 4749 |
|
| 4750 |
|
| 4751 |
public static final AccessibilityAction ACTION_CLEAR_ACCESSIBILITY_FOCUS = |
| 4752 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); |
| 4753 |
|
| 4754 |
|
| 4755 |
|
| 4756 |
|
| 4757 |
|
| 4758 |
|
| 4759 |
|
| 4760 |
|
| 4761 |
|
| 4762 |
|
| 4763 |
|
| 4764 |
|
| 4765 |
|
| 4766 |
|
| 4767 |
|
| 4768 |
|
| 4769 |
|
| 4770 |
|
| 4771 |
|
| 4772 |
|
| 4773 |
|
| 4774 |
|
| 4775 |
|
| 4776 |
|
| 4777 |
|
| 4778 |
|
| 4779 |
|
| 4780 |
|
| 4781 |
|
| 4782 |
|
| 4783 |
|
| 4784 |
|
| 4785 |
|
| 4786 |
|
| 4787 |
|
| 4788 |
|
| 4789 |
|
| 4790 |
|
| 4791 |
|
| 4792 |
|
| 4793 |
|
| 4794 |
|
| 4795 |
|
| 4796 |
|
| 4797 |
public static final AccessibilityAction ACTION_NEXT_AT_MOVEMENT_GRANULARITY = |
| 4798 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY); |
| 4799 |
|
| 4800 |
|
| 4801 |
|
| 4802 |
|
| 4803 |
|
| 4804 |
|
| 4805 |
|
| 4806 |
|
| 4807 |
|
| 4808 |
|
| 4809 |
|
| 4810 |
|
| 4811 |
|
| 4812 |
|
| 4813 |
|
| 4814 |
|
| 4815 |
|
| 4816 |
|
| 4817 |
|
| 4818 |
|
| 4819 |
|
| 4820 |
|
| 4821 |
|
| 4822 |
|
| 4823 |
|
| 4824 |
|
| 4825 |
|
| 4826 |
|
| 4827 |
|
| 4828 |
|
| 4829 |
|
| 4830 |
|
| 4831 |
|
| 4832 |
|
| 4833 |
|
| 4834 |
|
| 4835 |
|
| 4836 |
|
| 4837 |
|
| 4838 |
|
| 4839 |
|
| 4840 |
|
| 4841 |
|
| 4842 |
|
| 4843 |
public static final AccessibilityAction ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY = |
| 4844 |
new AccessibilityAction( |
| 4845 |
AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY); |
| 4846 |
|
| 4847 |
|
| 4848 |
|
| 4849 |
|
| 4850 |
|
| 4851 |
|
| 4852 |
|
| 4853 |
|
| 4854 |
|
| 4855 |
|
| 4856 |
|
| 4857 |
|
| 4858 |
|
| 4859 |
|
| 4860 |
|
| 4861 |
|
| 4862 |
public static final AccessibilityAction ACTION_NEXT_HTML_ELEMENT = |
| 4863 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT); |
| 4864 |
|
| 4865 |
|
| 4866 |
|
| 4867 |
|
| 4868 |
|
| 4869 |
|
| 4870 |
|
| 4871 |
|
| 4872 |
|
| 4873 |
|
| 4874 |
|
| 4875 |
|
| 4876 |
|
| 4877 |
|
| 4878 |
|
| 4879 |
|
| 4880 |
public static final AccessibilityAction ACTION_PREVIOUS_HTML_ELEMENT = |
| 4881 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT); |
| 4882 |
|
| 4883 |
|
| 4884 |
|
| 4885 |
|
| 4886 |
public static final AccessibilityAction ACTION_SCROLL_FORWARD = |
| 4887 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); |
| 4888 |
|
| 4889 |
|
| 4890 |
|
| 4891 |
|
| 4892 |
public static final AccessibilityAction ACTION_SCROLL_BACKWARD = |
| 4893 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); |
| 4894 |
|
| 4895 |
|
| 4896 |
|
| 4897 |
|
| 4898 |
public static final AccessibilityAction ACTION_COPY = |
| 4899 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_COPY); |
| 4900 |
|
| 4901 |
|
| 4902 |
|
| 4903 |
|
| 4904 |
public static final AccessibilityAction ACTION_PASTE = |
| 4905 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_PASTE); |
| 4906 |
|
| 4907 |
|
| 4908 |
|
| 4909 |
|
| 4910 |
public static final AccessibilityAction ACTION_CUT = |
| 4911 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_CUT); |
| 4912 |
|
| 4913 |
|
| 4914 |
|
| 4915 |
|
| 4916 |
|
| 4917 |
|
| 4918 |
|
| 4919 |
|
| 4920 |
|
| 4921 |
|
| 4922 |
|
| 4923 |
|
| 4924 |
|
| 4925 |
|
| 4926 |
|
| 4927 |
|
| 4928 |
|
| 4929 |
|
| 4930 |
|
| 4931 |
|
| 4932 |
|
| 4933 |
|
| 4934 |
|
| 4935 |
|
| 4936 |
public static final AccessibilityAction ACTION_SET_SELECTION = |
| 4937 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_SET_SELECTION); |
| 4938 |
|
| 4939 |
|
| 4940 |
|
| 4941 |
|
| 4942 |
public static final AccessibilityAction ACTION_EXPAND = |
| 4943 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_EXPAND); |
| 4944 |
|
| 4945 |
|
| 4946 |
|
| 4947 |
|
| 4948 |
public static final AccessibilityAction ACTION_COLLAPSE = |
| 4949 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_COLLAPSE); |
| 4950 |
|
| 4951 |
|
| 4952 |
|
| 4953 |
|
| 4954 |
public static final AccessibilityAction ACTION_DISMISS = |
| 4955 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_DISMISS); |
| 4956 |
|
| 4957 |
|
| 4958 |
|
| 4959 |
|
| 4960 |
|
| 4961 |
|
| 4962 |
|
| 4963 |
|
| 4964 |
|
| 4965 |
|
| 4966 |
|
| 4967 |
|
| 4968 |
|
| 4969 |
|
| 4970 |
|
| 4971 |
|
| 4972 |
|
| 4973 |
public static final AccessibilityAction ACTION_SET_TEXT = |
| 4974 |
new AccessibilityAction(AccessibilityNodeInfo.ACTION_SET_TEXT); |
| 4975 |
|
| 4976 |
|
| 4977 |
|
| 4978 |
|
| 4979 |
|
| 4980 |
|
| 4981 |
|
| 4982 |
public static final AccessibilityAction ACTION_SHOW_ON_SCREEN = |
| 4983 |
new AccessibilityAction(R.id.accessibilityActionShowOnScreen); |
| 4984 |
|
| 4985 |
|
| 4986 |
|
| 4987 |
|
| 4988 |
|
| 4989 |
|
| 4990 |
|
| 4991 |
|
| 4992 |
|
| 4993 |
|
| 4994 |
|
| 4995 |
|
| 4996 |
|
| 4997 |
public static final AccessibilityAction ACTION_SCROLL_TO_POSITION = |
| 4998 |
new AccessibilityAction(R.id.accessibilityActionScrollToPosition); |
| 4999 |
|
| 5000 |
|
| 5001 |
|
| 5002 |
|
| 5003 |
public static final AccessibilityAction ACTION_SCROLL_UP = |
| 5004 |
new AccessibilityAction(R.id.accessibilityActionScrollUp); |
| 5005 |
|
| 5006 |
|
| 5007 |
|
| 5008 |
|
| 5009 |
public static final AccessibilityAction ACTION_SCROLL_LEFT = |
| 5010 |
new AccessibilityAction(R.id.accessibilityActionScrollLeft); |
| 5011 |
|
| 5012 |
|
| 5013 |
|
| 5014 |
|
| 5015 |
public static final AccessibilityAction ACTION_SCROLL_DOWN = |
| 5016 |
new AccessibilityAction(R.id.accessibilityActionScrollDown); |
| 5017 |
|
| 5018 |
|
| 5019 |
|
| 5020 |
|
| 5021 |
public static final AccessibilityAction ACTION_SCROLL_RIGHT = |
| 5022 |
new AccessibilityAction(R.id.accessibilityActionScrollRight); |
| 5023 |
|
| 5024 |
|
| 5025 |
|
| 5026 |
|
| 5027 |
public static final AccessibilityAction ACTION_PAGE_UP = |
| 5028 |
new AccessibilityAction(R.id.accessibilityActionPageUp); |
| 5029 |
|
| 5030 |
|
| 5031 |
|
| 5032 |
|
| 5033 |
public static final AccessibilityAction ACTION_PAGE_DOWN = |
| 5034 |
new AccessibilityAction(R.id.accessibilityActionPageDown); |
| 5035 |
|
| 5036 |
|
| 5037 |
|
| 5038 |
|
| 5039 |
public static final AccessibilityAction ACTION_PAGE_LEFT = |
| 5040 |
new AccessibilityAction(R.id.accessibilityActionPageLeft); |
| 5041 |
|
| 5042 |
|
| 5043 |
|
| 5044 |
|
| 5045 |
public static final AccessibilityAction ACTION_PAGE_RIGHT = |
| 5046 |
new AccessibilityAction(R.id.accessibilityActionPageRight); |
| 5047 |
|
| 5048 |
|
| 5049 |
|
| 5050 |
|
| 5051 |
public static final AccessibilityAction ACTION_CONTEXT_CLICK = |
| 5052 |
new AccessibilityAction(R.id.accessibilityActionContextClick); |
| 5053 |
|
| 5054 |
|
| 5055 |
|
| 5056 |
|
| 5057 |
|
| 5058 |
|
| 5059 |
|
| 5060 |
|
| 5061 |
|
| 5062 |
|
| 5063 |
|
| 5064 |
public static final AccessibilityAction ACTION_SET_PROGRESS = |
| 5065 |
new AccessibilityAction(R.id.accessibilityActionSetProgress); |
| 5066 |
|
| 5067 |
|
| 5068 |
|
| 5069 |
|
| 5070 |
|
| 5071 |
|
| 5072 |
|
| 5073 |
|
| 5074 |
public static final AccessibilityAction ACTION_MOVE_WINDOW = |
| 5075 |
new AccessibilityAction(R.id.accessibilityActionMoveWindow); |
| 5076 |
|
| 5077 |
|
| 5078 |
|
| 5079 |
|
| 5080 |
|
| 5081 |
public static final AccessibilityAction ACTION_SHOW_TOOLTIP = |
| 5082 |
new AccessibilityAction(R.id.accessibilityActionShowTooltip); |
| 5083 |
|
| 5084 |
|
| 5085 |
|
| 5086 |
|
| 5087 |
|
| 5088 |
public static final AccessibilityAction ACTION_HIDE_TOOLTIP = |
| 5089 |
new AccessibilityAction(R.id.accessibilityActionHideTooltip); |
| 5090 |
|
| 5091 |
|
| 5092 |
|
| 5093 |
|
| 5094 |
|
| 5095 |
|
| 5096 |
|
| 5097 |
|
| 5098 |
|
| 5099 |
|
| 5100 |
|
| 5101 |
|
| 5102 |
|
| 5103 |
|
| 5104 |
|
| 5105 |
|
| 5106 |
|
| 5107 |
|
| 5108 |
|
| 5109 |
|
| 5110 |
|
| 5111 |
|
| 5112 |
|
| 5113 |
|
| 5114 |
|
| 5115 |
|
| 5116 |
@NonNull public static final AccessibilityAction ACTION_PRESS_AND_HOLD = |
| 5117 |
new AccessibilityAction(R.id.accessibilityActionPressAndHold); |
| 5118 |
|
| 5119 |
|
| 5120 |
|
| 5121 |
|
| 5122 |
|
| 5123 |
|
| 5124 |
|
| 5125 |
|
| 5126 |
|
| 5127 |
@NonNull public static final AccessibilityAction ACTION_IME_ENTER = |
| 5128 |
new AccessibilityAction(R.id.accessibilityActionImeEnter); |
| 5129 |
|
| 5130 |
|
| 5131 |
|
| 5132 |
|
| 5133 |
|
| 5134 |
|
| 5135 |
|
| 5136 |
|
| 5137 |
|
| 5138 |
|
| 5139 |
|
| 5140 |
|
| 5141 |
|
| 5142 |
@NonNull public static final AccessibilityAction ACTION_DRAG_START = |
| 5143 |
new AccessibilityAction(R.id.accessibilityActionDragStart); |
| 5144 |
|
| 5145 |
|
| 5146 |
|
| 5147 |
|
| 5148 |
|
| 5149 |
|
| 5150 |
|
| 5151 |
|
| 5152 |
|
| 5153 |
|
| 5154 |
|
| 5155 |
|
| 5156 |
@NonNull public static final AccessibilityAction ACTION_DRAG_DROP = |
| 5157 |
new AccessibilityAction(R.id.accessibilityActionDragDrop); |
| 5158 |
|
| 5159 |
|
| 5160 |
|
| 5161 |
|
| 5162 |
|
| 5163 |
|
| 5164 |
|
| 5165 |
|
| 5166 |
|
| 5167 |
@NonNull public static final AccessibilityAction ACTION_DRAG_CANCEL = |
| 5168 |
new AccessibilityAction(R.id.accessibilityActionDragCancel); |
| 5169 |
|
| 5170 |
|
| 5171 |
|
| 5172 |
|
| 5173 |
@NonNull public static final AccessibilityAction ACTION_SHOW_TEXT_SUGGESTIONS = |
| 5174 |
new AccessibilityAction(R.id.accessibilityActionShowTextSuggestions); |
| 5175 |
|
| 5176 |
private final int mActionId; |
| 5177 |
private final CharSequence mLabel; |
| 5178 |
|
| 5179 |
|
| 5180 |
public long mSerializationFlag = -1L; |
| 5181 |
|
| 5182 |
|
| 5183 |
|
| 5184 |
|
| 5185 |
|
| 5186 |
|
| 5187 |
|
| 5188 |
|
| 5189 |
|
| 5190 |
|
| 5191 |
|
| 5192 |
|
| 5193 |
|
| 5194 |
|
| 5195 |
|
| 5196 |
|
| 5197 |
|
| 5198 |
|
| 5199 |
public AccessibilityAction(int actionId, @Nullable CharSequence label) { |
| 5200 |
mActionId = actionId; |
| 5201 |
mLabel = label; |
| 5202 |
} |
| 5203 |
|
| 5204 |
|
| 5205 |
|
| 5206 |
|
| 5207 |
private AccessibilityAction(int standardActionId) { |
| 5208 |
this(standardActionId, null); |
| 5209 |
|
| 5210 |
mSerializationFlag = bitAt(sStandardActions.size()); |
| 5211 |
sStandardActions.add(this); |
| 5212 |
} |
| 5213 |
|
| 5214 |
|
| 5215 |
|
| 5216 |
|
| 5217 |
|
| 5218 |
|
| 5219 |
public int getId() { |
| 5220 |
return mActionId; |
| 5221 |
} |
| 5222 |
|
| 5223 |
|
| 5224 |
|
| 5225 |
|
| 5226 |
|
| 5227 |
|
| 5228 |
|
| 5229 |
public CharSequence getLabel() { |
| 5230 |
return mLabel; |
| 5231 |
} |
| 5232 |
|
| 5233 |
@Override |
| 5234 |
public int hashCode() { |
| 5235 |
return mActionId; |
| 5236 |
} |
| 5237 |
|
| 5238 |
@Override |
| 5239 |
public boolean equals(@Nullable Object other) { |
| 5240 |
if (other == null) { |
| 5241 |
return false; |
| 5242 |
} |
| 5243 |
|
| 5244 |
if (other == this) { |
| 5245 |
return true; |
| 5246 |
} |
| 5247 |
|
| 5248 |
if (getClass() != other.getClass()) { |
| 5249 |
return false; |
| 5250 |
} |
| 5251 |
|
| 5252 |
return mActionId == ((AccessibilityAction)other).mActionId; |
| 5253 |
} |
| 5254 |
|
| 5255 |
@Override |
| 5256 |
public String toString() { |
| 5257 |
return "AccessibilityAction: " + getActionSymbolicName(mActionId) + " - " + mLabel; |
| 5258 |
} |
| 5259 |
|
| 5260 |
|
| 5261 |
|
| 5262 |
|
| 5263 |
@Override |
| 5264 |
public int describeContents() { |
| 5265 |
return 0; |
| 5266 |
} |
| 5267 |
|
| 5268 |
|
| 5269 |
|
| 5270 |
|
| 5271 |
public void writeToParcel(@NonNull Parcel out, int flags) { |
| 5272 |
out.writeInt(mActionId); |
| 5273 |
out.writeCharSequence(mLabel); |
| 5274 |
} |
| 5275 |
|
| 5276 |
public static final @NonNull Parcelable.Creator<AccessibilityAction> CREATOR = |
| 5277 |
new Parcelable.Creator<AccessibilityAction>() { |
| 5278 |
public AccessibilityAction createFromParcel(Parcel in) { |
| 5279 |
return new AccessibilityAction(in); |
| 5280 |
} |
| 5281 |
|
| 5282 |
public AccessibilityAction[] newArray(int size) { |
| 5283 |
return new AccessibilityAction[size]; |
| 5284 |
} |
| 5285 |
}; |
| 5286 |
|
| 5287 |
private AccessibilityAction(Parcel in) { |
| 5288 |
mActionId = in.readInt(); |
| 5289 |
mLabel = in.readCharSequence(); |
| 5290 |
} |
| 5291 |
} |
| 5292 |
|
| 5293 |
|
| 5294 |
|
| 5295 |
|
| 5296 |
public static final class RangeInfo { |
| 5297 |
|
| 5298 |
|
| 5299 |
public static final int RANGE_TYPE_INT = 0; |
| 5300 |
|
| 5301 |
public static final int RANGE_TYPE_FLOAT = 1; |
| 5302 |
|
| 5303 |
public static final int RANGE_TYPE_PERCENT = 2; |
| 5304 |
|
| 5305 |
private int mType; |
| 5306 |
private float mMin; |
| 5307 |
private float mMax; |
| 5308 |
private float mCurrent; |
| 5309 |
|
| 5310 |
|
| 5311 |
|
| 5312 |
|
| 5313 |
|
| 5314 |
|
| 5315 |
|
| 5316 |
|
| 5317 |
|
| 5318 |
|
| 5319 |
|
| 5320 |
|
| 5321 |
|
| 5322 |
|
| 5323 |
@Deprecated |
| 5324 |
public static RangeInfo obtain(int type, float min, float max, float current) { |
| 5325 |
return new RangeInfo(type, min, max, current); |
| 5326 |
} |
| 5327 |
|
| 5328 |
|
| 5329 |
|
| 5330 |
|
| 5331 |
|
| 5332 |
|
| 5333 |
|
| 5334 |
|
| 5335 |
|
| 5336 |
|
| 5337 |
|
| 5338 |
public RangeInfo(int type, float min, float max, float current) { |
| 5339 |
mType = type; |
| 5340 |
mMin = min; |
| 5341 |
mMax = max; |
| 5342 |
mCurrent = current; |
| 5343 |
} |
| 5344 |
|
| 5345 |
|
| 5346 |
|
| 5347 |
|
| 5348 |
|
| 5349 |
|
| 5350 |
|
| 5351 |
|
| 5352 |
|
| 5353 |
|
| 5354 |
public int getType() { |
| 5355 |
return mType; |
| 5356 |
} |
| 5357 |
|
| 5358 |
|
| 5359 |
|
| 5360 |
|
| 5361 |
|
| 5362 |
|
| 5363 |
public float getMin() { |
| 5364 |
return mMin; |
| 5365 |
} |
| 5366 |
|
| 5367 |
|
| 5368 |
|
| 5369 |
|
| 5370 |
|
| 5371 |
|
| 5372 |
public float getMax() { |
| 5373 |
return mMax; |
| 5374 |
} |
| 5375 |
|
| 5376 |
|
| 5377 |
|
| 5378 |
|
| 5379 |
|
| 5380 |
|
| 5381 |
public float getCurrent() { |
| 5382 |
return mCurrent; |
| 5383 |
} |
| 5384 |
|
| 5385 |
|
| 5386 |
|
| 5387 |
|
| 5388 |
|
| 5389 |
|
| 5390 |
|
| 5391 |
@Deprecated |
| 5392 |
void recycle() {} |
| 5393 |
|
| 5394 |
private void clear() { |
| 5395 |
mType = 0; |
| 5396 |
mMin = 0; |
| 5397 |
mMax = 0; |
| 5398 |
mCurrent = 0; |
| 5399 |
} |
| 5400 |
} |
| 5401 |
|
| 5402 |
|
| 5403 |
|
| 5404 |
|
| 5405 |
|
| 5406 |
|
| 5407 |
|
| 5408 |
|
| 5409 |
|
| 5410 |
|
| 5411 |
|
| 5412 |
|
| 5413 |
public static final class CollectionInfo { |
| 5414 |
|
| 5415 |
public static final int SELECTION_MODE_NONE = 0; |
| 5416 |
|
| 5417 |
|
| 5418 |
public static final int SELECTION_MODE_SINGLE = 1; |
| 5419 |
|
| 5420 |
|
| 5421 |
public static final int SELECTION_MODE_MULTIPLE = 2; |
| 5422 |
|
| 5423 |
private int mRowCount; |
| 5424 |
private int mColumnCount; |
| 5425 |
private boolean mHierarchical; |
| 5426 |
private int mSelectionMode; |
| 5427 |
|
| 5428 |
|
| 5429 |
|
| 5430 |
|
| 5431 |
|
| 5432 |
|
| 5433 |
|
| 5434 |
|
| 5435 |
|
| 5436 |
|
| 5437 |
|
| 5438 |
public static CollectionInfo obtain(CollectionInfo other) { |
| 5439 |
return new CollectionInfo(other.mRowCount, other.mColumnCount, other.mHierarchical, |
| 5440 |
other.mSelectionMode); |
| 5441 |
} |
| 5442 |
|
| 5443 |
|
| 5444 |
|
| 5445 |
|
| 5446 |
|
| 5447 |
|
| 5448 |
|
| 5449 |
|
| 5450 |
|
| 5451 |
|
| 5452 |
|
| 5453 |
|
| 5454 |
|
| 5455 |
public static CollectionInfo obtain(int rowCount, int columnCount, |
| 5456 |
boolean hierarchical) { |
| 5457 |
return new CollectionInfo(rowCount, columnCount, hierarchical, SELECTION_MODE_NONE); |
| 5458 |
} |
| 5459 |
|
| 5460 |
|
| 5461 |
|
| 5462 |
|
| 5463 |
|
| 5464 |
|
| 5465 |
|
| 5466 |
|
| 5467 |
|
| 5468 |
|
| 5469 |
|
| 5470 |
|
| 5471 |
|
| 5472 |
|
| 5473 |
|
| 5474 |
|
| 5475 |
|
| 5476 |
|
| 5477 |
|
| 5478 |
public static CollectionInfo obtain(int rowCount, int columnCount, |
| 5479 |
boolean hierarchical, int selectionMode) { |
| 5480 |
return new CollectionInfo(rowCount, columnCount, hierarchical, selectionMode); |
| 5481 |
} |
| 5482 |
|
| 5483 |
|
| 5484 |
|
| 5485 |
|
| 5486 |
|
| 5487 |
|
| 5488 |
|
| 5489 |
|
| 5490 |
public CollectionInfo(int rowCount, int columnCount, boolean hierarchical) { |
| 5491 |
this(rowCount, columnCount, hierarchical, SELECTION_MODE_NONE); |
| 5492 |
} |
| 5493 |
|
| 5494 |
|
| 5495 |
|
| 5496 |
|
| 5497 |
|
| 5498 |
|
| 5499 |
|
| 5500 |
|
| 5501 |
|
| 5502 |
public CollectionInfo(int rowCount, int columnCount, boolean hierarchical, |
| 5503 |
int selectionMode) { |
| 5504 |
mRowCount = rowCount; |
| 5505 |
mColumnCount = columnCount; |
| 5506 |
mHierarchical = hierarchical; |
| 5507 |
mSelectionMode = selectionMode; |
| 5508 |
} |
| 5509 |
|
| 5510 |
|
| 5511 |
|
| 5512 |
|
| 5513 |
|
| 5514 |
|
| 5515 |
public int getRowCount() { |
| 5516 |
return mRowCount; |
| 5517 |
} |
| 5518 |
|
| 5519 |
|
| 5520 |
|
| 5521 |
|
| 5522 |
|
| 5523 |
|
| 5524 |
public int getColumnCount() { |
| 5525 |
return mColumnCount; |
| 5526 |
} |
| 5527 |
|
| 5528 |
|
| 5529 |
|
| 5530 |
|
| 5531 |
|
| 5532 |
|
| 5533 |
public boolean isHierarchical() { |
| 5534 |
return mHierarchical; |
| 5535 |
} |
| 5536 |
|
| 5537 |
|
| 5538 |
|
| 5539 |
|
| 5540 |
|
| 5541 |
|
| 5542 |
|
| 5543 |
|
| 5544 |
|
| 5545 |
|
| 5546 |
|
| 5547 |
public int getSelectionMode() { |
| 5548 |
return mSelectionMode; |
| 5549 |
} |
| 5550 |
|
| 5551 |
|
| 5552 |
|
| 5553 |
|
| 5554 |
|
| 5555 |
|
| 5556 |
|
| 5557 |
@Deprecated |
| 5558 |
void recycle() {} |
| 5559 |
|
| 5560 |
private void clear() { |
| 5561 |
mRowCount = 0; |
| 5562 |
mColumnCount = 0; |
| 5563 |
mHierarchical = false; |
| 5564 |
mSelectionMode = SELECTION_MODE_NONE; |
| 5565 |
} |
| 5566 |
} |
| 5567 |
|
| 5568 |
|
| 5569 |
|
| 5570 |
|
| 5571 |
|
| 5572 |
|
| 5573 |
|
| 5574 |
|
| 5575 |
|
| 5576 |
|
| 5577 |
|
| 5578 |
public static final class CollectionItemInfo { |
| 5579 |
|
| 5580 |
|
| 5581 |
|
| 5582 |
|
| 5583 |
|
| 5584 |
|
| 5585 |
|
| 5586 |
|
| 5587 |
|
| 5588 |
|
| 5589 |
|
| 5590 |
@Deprecated |
| 5591 |
public static CollectionItemInfo obtain(CollectionItemInfo other) { |
| 5592 |
return new CollectionItemInfo(other.mRowTitle, other.mRowIndex, other.mRowSpan, |
| 5593 |
other.mColumnTitle, other.mColumnIndex, other.mColumnSpan, other.mHeading, |
| 5594 |
other.mSelected); |
| 5595 |
} |
| 5596 |
|
| 5597 |
|
| 5598 |
|
| 5599 |
|
| 5600 |
|
| 5601 |
|
| 5602 |
|
| 5603 |
|
| 5604 |
|
| 5605 |
|
| 5606 |
|
| 5607 |
|
| 5608 |
|
| 5609 |
|
| 5610 |
|
| 5611 |
@Deprecated |
| 5612 |
public static CollectionItemInfo obtain(int rowIndex, int rowSpan, |
| 5613 |
int columnIndex, int columnSpan, boolean heading) { |
| 5614 |
return new CollectionItemInfo(rowIndex, rowSpan, columnIndex, columnSpan, heading, |
| 5615 |
false); |
| 5616 |
} |
| 5617 |
|
| 5618 |
|
| 5619 |
|
| 5620 |
|
| 5621 |
|
| 5622 |
|
| 5623 |
|
| 5624 |
|
| 5625 |
|
| 5626 |
|
| 5627 |
|
| 5628 |
|
| 5629 |
|
| 5630 |
|
| 5631 |
|
| 5632 |
|
| 5633 |
@Deprecated |
| 5634 |
public static CollectionItemInfo obtain(int rowIndex, int rowSpan, |
| 5635 |
int columnIndex, int columnSpan, boolean heading, boolean selected) { |
| 5636 |
return new CollectionItemInfo(rowIndex, rowSpan, columnIndex, columnSpan, heading, |
| 5637 |
selected); |
| 5638 |
} |
| 5639 |
|
| 5640 |
|
| 5641 |
|
| 5642 |
|
| 5643 |
|
| 5644 |
|
| 5645 |
|
| 5646 |
|
| 5647 |
|
| 5648 |
|
| 5649 |
|
| 5650 |
|
| 5651 |
|
| 5652 |
|
| 5653 |
|
| 5654 |
|
| 5655 |
|
| 5656 |
|
| 5657 |
|
| 5658 |
|
| 5659 |
@Deprecated |
| 5660 |
@NonNull |
| 5661 |
public static CollectionItemInfo obtain(@Nullable String rowTitle, int rowIndex, |
| 5662 |
int rowSpan, @Nullable String columnTitle, int columnIndex, int columnSpan, |
| 5663 |
boolean heading, boolean selected) { |
| 5664 |
return new CollectionItemInfo(rowTitle, rowIndex, rowSpan, columnTitle, columnIndex, |
| 5665 |
columnSpan, heading, selected); |
| 5666 |
} |
| 5667 |
|
| 5668 |
private boolean mHeading; |
| 5669 |
private int mColumnIndex; |
| 5670 |
private int mRowIndex; |
| 5671 |
private int mColumnSpan; |
| 5672 |
private int mRowSpan; |
| 5673 |
private boolean mSelected; |
| 5674 |
private String mRowTitle; |
| 5675 |
private String mColumnTitle; |
| 5676 |
|
| 5677 |
private CollectionItemInfo() { |
| 5678 |
|
| 5679 |
} |
| 5680 |
|
| 5681 |
|
| 5682 |
|
| 5683 |
|
| 5684 |
|
| 5685 |
|
| 5686 |
|
| 5687 |
|
| 5688 |
|
| 5689 |
|
| 5690 |
public CollectionItemInfo(int rowIndex, int rowSpan, int columnIndex, int columnSpan, |
| 5691 |
boolean heading) { |
| 5692 |
this(rowIndex, rowSpan, columnIndex, columnSpan, heading, false); |
| 5693 |
} |
| 5694 |
|
| 5695 |
|
| 5696 |
|
| 5697 |
|
| 5698 |
|
| 5699 |
|
| 5700 |
|
| 5701 |
|
| 5702 |
|
| 5703 |
|
| 5704 |
|
| 5705 |
public CollectionItemInfo(int rowIndex, int rowSpan, int columnIndex, int columnSpan, |
| 5706 |
boolean heading, boolean selected) { |
| 5707 |
this(null, rowIndex, rowSpan, null, columnIndex, columnSpan, |
| 5708 |
heading, selected); |
| 5709 |
} |
| 5710 |
|
| 5711 |
|
| 5712 |
|
| 5713 |
|
| 5714 |
|
| 5715 |
|
| 5716 |
|
| 5717 |
|
| 5718 |
|
| 5719 |
|
| 5720 |
|
| 5721 |
|
| 5722 |
|
| 5723 |
|
| 5724 |
public CollectionItemInfo(@Nullable String rowTitle, int rowIndex, int rowSpan, |
| 5725 |
@Nullable String columnTitle, int columnIndex, int columnSpan, boolean heading, |
| 5726 |
boolean selected) { |
| 5727 |
mRowIndex = rowIndex; |
| 5728 |
mRowSpan = rowSpan; |
| 5729 |
mColumnIndex = columnIndex; |
| 5730 |
mColumnSpan = columnSpan; |
| 5731 |
mHeading = heading; |
| 5732 |
mSelected = selected; |
| 5733 |
mRowTitle = rowTitle; |
| 5734 |
mColumnTitle = columnTitle; |
| 5735 |
} |
| 5736 |
|
| 5737 |
|
| 5738 |
|
| 5739 |
|
| 5740 |
|
| 5741 |
|
| 5742 |
public int getColumnIndex() { |
| 5743 |
return mColumnIndex; |
| 5744 |
} |
| 5745 |
|
| 5746 |
|
| 5747 |
|
| 5748 |
|
| 5749 |
|
| 5750 |
|
| 5751 |
public int getRowIndex() { |
| 5752 |
return mRowIndex; |
| 5753 |
} |
| 5754 |
|
| 5755 |
|
| 5756 |
|
| 5757 |
|
| 5758 |
|
| 5759 |
|
| 5760 |
public int getColumnSpan() { |
| 5761 |
return mColumnSpan; |
| 5762 |
} |
| 5763 |
|
| 5764 |
|
| 5765 |
|
| 5766 |
|
| 5767 |
|
| 5768 |
|
| 5769 |
public int getRowSpan() { |
| 5770 |
return mRowSpan; |
| 5771 |
} |
| 5772 |
|
| 5773 |
|
| 5774 |
|
| 5775 |
|
| 5776 |
|
| 5777 |
|
| 5778 |
|
| 5779 |
|
| 5780 |
public boolean isHeading() { |
| 5781 |
return mHeading; |
| 5782 |
} |
| 5783 |
|
| 5784 |
|
| 5785 |
|
| 5786 |
|
| 5787 |
|
| 5788 |
|
| 5789 |
public boolean isSelected() { |
| 5790 |
return mSelected; |
| 5791 |
} |
| 5792 |
|
| 5793 |
|
| 5794 |
|
| 5795 |
|
| 5796 |
|
| 5797 |
|
| 5798 |
@Nullable |
| 5799 |
public String getRowTitle() { |
| 5800 |
return mRowTitle; |
| 5801 |
} |
| 5802 |
|
| 5803 |
|
| 5804 |
|
| 5805 |
|
| 5806 |
|
| 5807 |
|
| 5808 |
@Nullable |
| 5809 |
public String getColumnTitle() { |
| 5810 |
return mColumnTitle; |
| 5811 |
} |
| 5812 |
|
| 5813 |
|
| 5814 |
|
| 5815 |
|
| 5816 |
|
| 5817 |
|
| 5818 |
|
| 5819 |
@Deprecated |
| 5820 |
void recycle() {} |
| 5821 |
|
| 5822 |
private void clear() { |
| 5823 |
mColumnIndex = 0; |
| 5824 |
mColumnSpan = 0; |
| 5825 |
mRowIndex = 0; |
| 5826 |
mRowSpan = 0; |
| 5827 |
mHeading = false; |
| 5828 |
mSelected = false; |
| 5829 |
mRowTitle = null; |
| 5830 |
mColumnTitle = null; |
| 5831 |
} |
| 5832 |
|
| 5833 |
|
| 5834 |
|
| 5835 |
|
| 5836 |
public static final class Builder { |
| 5837 |
private boolean mHeading; |
| 5838 |
private int mColumnIndex; |
| 5839 |
private int mRowIndex; |
| 5840 |
private int mColumnSpan; |
| 5841 |
private int mRowSpan; |
| 5842 |
private boolean mSelected; |
| 5843 |
private String mRowTitle; |
| 5844 |
private String mColumnTitle; |
| 5845 |
|
| 5846 |
|
| 5847 |
|
| 5848 |
|
| 5849 |
public Builder() { |
| 5850 |
} |
| 5851 |
|
| 5852 |
|
| 5853 |
|
| 5854 |
|
| 5855 |
|
| 5856 |
|
| 5857 |
|
| 5858 |
@NonNull |
| 5859 |
public CollectionItemInfo.Builder setHeading(boolean heading) { |
| 5860 |
mHeading = heading; |
| 5861 |
return this; |
| 5862 |
} |
| 5863 |
|
| 5864 |
|
| 5865 |
|
| 5866 |
|
| 5867 |
|
| 5868 |
|
| 5869 |
|
| 5870 |
@NonNull |
| 5871 |
public CollectionItemInfo.Builder setColumnIndex(int columnIndex) { |
| 5872 |
mColumnIndex = columnIndex; |
| 5873 |
return this; |
| 5874 |
} |
| 5875 |
|
| 5876 |
|
| 5877 |
|
| 5878 |
|
| 5879 |
|
| 5880 |
|
| 5881 |
|
| 5882 |
@NonNull |
| 5883 |
public CollectionItemInfo.Builder setRowIndex(int rowIndex) { |
| 5884 |
mRowIndex = rowIndex; |
| 5885 |
return this; |
| 5886 |
} |
| 5887 |
|
| 5888 |
|
| 5889 |
|
| 5890 |
|
| 5891 |
|
| 5892 |
|
| 5893 |
|
| 5894 |
@NonNull |
| 5895 |
public CollectionItemInfo.Builder setColumnSpan(int columnSpan) { |
| 5896 |
mColumnSpan = columnSpan; |
| 5897 |
return this; |
| 5898 |
} |
| 5899 |
|
| 5900 |
|
| 5901 |
|
| 5902 |
|
| 5903 |
|
| 5904 |
|
| 5905 |
|
| 5906 |
@NonNull |
| 5907 |
public CollectionItemInfo.Builder setRowSpan(int rowSpan) { |
| 5908 |
mRowSpan = rowSpan; |
| 5909 |
return this; |
| 5910 |
} |
| 5911 |
|
| 5912 |
|
| 5913 |
|
| 5914 |
|
| 5915 |
|
| 5916 |
|
| 5917 |
|
| 5918 |
@NonNull |
| 5919 |
public CollectionItemInfo.Builder setSelected(boolean selected) { |
| 5920 |
mSelected = selected; |
| 5921 |
return this; |
| 5922 |
} |
| 5923 |
|
| 5924 |
|
| 5925 |
|
| 5926 |
|
| 5927 |
|
| 5928 |
|
| 5929 |
|
| 5930 |
@NonNull |
| 5931 |
public CollectionItemInfo.Builder setRowTitle(@Nullable String rowTitle) { |
| 5932 |
mRowTitle = rowTitle; |
| 5933 |
return this; |
| 5934 |
} |
| 5935 |
|
| 5936 |
|
| 5937 |
|
| 5938 |
|
| 5939 |
|
| 5940 |
|
| 5941 |
|
| 5942 |
@NonNull |
| 5943 |
public CollectionItemInfo.Builder setColumnTitle(@Nullable String columnTitle) { |
| 5944 |
mColumnTitle = columnTitle; |
| 5945 |
return this; |
| 5946 |
} |
| 5947 |
|
| 5948 |
|
| 5949 |
|
| 5950 |
|
| 5951 |
@NonNull |
| 5952 |
public CollectionItemInfo build() { |
| 5953 |
CollectionItemInfo collectionItemInfo = new CollectionItemInfo(); |
| 5954 |
collectionItemInfo.mHeading = mHeading; |
| 5955 |
collectionItemInfo.mColumnIndex = mColumnIndex; |
| 5956 |
collectionItemInfo.mRowIndex = mRowIndex; |
| 5957 |
collectionItemInfo.mColumnSpan = mColumnSpan; |
| 5958 |
collectionItemInfo.mRowSpan = mRowSpan; |
| 5959 |
collectionItemInfo.mSelected = mSelected; |
| 5960 |
collectionItemInfo.mRowTitle = mRowTitle; |
| 5961 |
collectionItemInfo.mColumnTitle = mColumnTitle; |
| 5962 |
|
| 5963 |
return collectionItemInfo; |
| 5964 |
} |
| 5965 |
} |
| 5966 |
} |
| 5967 |
|
| 5968 |
|
| 5969 |
|
| 5970 |
|
| 5971 |
|
| 5972 |
|
| 5973 |
|
| 5974 |
public static final class TouchDelegateInfo implements Parcelable { |
| 5975 |
private ArrayMap<Region, Long> mTargetMap; |
| 5976 |
|
| 5977 |
private int mConnectionId; |
| 5978 |
private int mWindowId; |
| 5979 |
|
| 5980 |
|
| 5981 |
|
| 5982 |
|
| 5983 |
|
| 5984 |
|
| 5985 |
|
| 5986 |
|
| 5987 |
public TouchDelegateInfo(@NonNull Map<Region, View> targetMap) { |
| 5988 |
Preconditions.checkArgument(!targetMap.isEmpty() |
| 5989 |
&& !targetMap.containsKey(null) && !targetMap.containsValue(null)); |
| 5990 |
mTargetMap = new ArrayMap<>(targetMap.size()); |
| 5991 |
for (final Region region : targetMap.keySet()) { |
| 5992 |
final View view = targetMap.get(region); |
| 5993 |
mTargetMap.put(region, (long) view.getAccessibilityViewId()); |
| 5994 |
} |
| 5995 |
} |
| 5996 |
|
| 5997 |
|
| 5998 |
|
| 5999 |
|
| 6000 |
|
| 6001 |
|
| 6002 |
|
| 6003 |
|
| 6004 |
|
| 6005 |
|
| 6006 |
TouchDelegateInfo(@NonNull ArrayMap<Region, Long> targetMap, boolean doCopy) { |
| 6007 |
Preconditions.checkArgument(!targetMap.isEmpty() |
| 6008 |
&& !targetMap.containsKey(null) && !targetMap.containsValue(null)); |
| 6009 |
if (doCopy) { |
| 6010 |
mTargetMap = new ArrayMap<>(targetMap.size()); |
| 6011 |
mTargetMap.putAll(targetMap); |
| 6012 |
} else { |
| 6013 |
mTargetMap = targetMap; |
| 6014 |
} |
| 6015 |
} |
| 6016 |
|
| 6017 |
|
| 6018 |
|
| 6019 |
|
| 6020 |
|
| 6021 |
|
| 6022 |
private void setConnectionId(int connectionId) { |
| 6023 |
mConnectionId = connectionId; |
| 6024 |
} |
| 6025 |
|
| 6026 |
|
| 6027 |
|
| 6028 |
|
| 6029 |
|
| 6030 |
|
| 6031 |
private void setWindowId(int windowId) { |
| 6032 |
mWindowId = windowId; |
| 6033 |
} |
| 6034 |
|
| 6035 |
|
| 6036 |
|
| 6037 |
|
| 6038 |
|
| 6039 |
|
| 6040 |
public int getRegionCount() { |
| 6041 |
return mTargetMap.size(); |
| 6042 |
} |
| 6043 |
|
| 6044 |
|
| 6045 |
|
| 6046 |
|
| 6047 |
|
| 6048 |
|
| 6049 |
|
| 6050 |
@NonNull |
| 6051 |
public Region getRegionAt(int index) { |
| 6052 |
return mTargetMap.keyAt(index); |
| 6053 |
} |
| 6054 |
|
| 6055 |
|
| 6056 |
|
| 6057 |
|
| 6058 |
|
| 6059 |
|
| 6060 |
|
| 6061 |
|
| 6062 |
|
| 6063 |
|
| 6064 |
@Nullable |
| 6065 |
public AccessibilityNodeInfo getTargetForRegion(@NonNull Region region) { |
| 6066 |
return getNodeForAccessibilityId(mConnectionId, mWindowId, mTargetMap.get(region)); |
| 6067 |
} |
| 6068 |
|
| 6069 |
|
| 6070 |
|
| 6071 |
|
| 6072 |
|
| 6073 |
|
| 6074 |
|
| 6075 |
|
| 6076 |
|
| 6077 |
@TestApi |
| 6078 |
public long getAccessibilityIdForRegion(@NonNull Region region) { |
| 6079 |
return mTargetMap.get(region); |
| 6080 |
} |
| 6081 |
|
| 6082 |
|
| 6083 |
|
| 6084 |
|
| 6085 |
@Override |
| 6086 |
public int describeContents() { |
| 6087 |
return 0; |
| 6088 |
} |
| 6089 |
|
| 6090 |
|
| 6091 |
|
| 6092 |
|
| 6093 |
@Override |
| 6094 |
public void writeToParcel(Parcel dest, int flags) { |
| 6095 |
dest.writeInt(mTargetMap.size()); |
| 6096 |
for (int i = 0; i < mTargetMap.size(); i++) { |
| 6097 |
final Region region = mTargetMap.keyAt(i); |
| 6098 |
final Long accessibilityId = mTargetMap.valueAt(i); |
| 6099 |
region.writeToParcel(dest, flags); |
| 6100 |
dest.writeLong(accessibilityId); |
| 6101 |
} |
| 6102 |
} |
| 6103 |
|
| 6104 |
|
| 6105 |
|
| 6106 |
|
| 6107 |
public static final @android.annotation.NonNull Parcelable.Creator<TouchDelegateInfo> CREATOR = |
| 6108 |
new Parcelable.Creator<TouchDelegateInfo>() { |
| 6109 |
@Override |
| 6110 |
public TouchDelegateInfo createFromParcel(Parcel parcel) { |
| 6111 |
final int size = parcel.readInt(); |
| 6112 |
if (size == 0) { |
| 6113 |
return null; |
| 6114 |
} |
| 6115 |
final ArrayMap<Region, Long> targetMap = new ArrayMap<>(size); |
| 6116 |
for (int i = 0; i < size; i++) { |
| 6117 |
final Region region = Region.CREATOR.createFromParcel(parcel); |
| 6118 |
final long accessibilityId = parcel.readLong(); |
| 6119 |
targetMap.put(region, accessibilityId); |
| 6120 |
} |
| 6121 |
final TouchDelegateInfo touchDelegateInfo = new TouchDelegateInfo( |
| 6122 |
targetMap, false); |
| 6123 |
return touchDelegateInfo; |
| 6124 |
} |
| 6125 |
|
| 6126 |
@Override |
| 6127 |
public TouchDelegateInfo[] newArray(int size) { |
| 6128 |
return new TouchDelegateInfo[size]; |
| 6129 |
} |
| 6130 |
}; |
| 6131 |
} |
| 6132 |
|
| 6133 |
|
| 6134 |
|
| 6135 |
|
| 6136 |
|
| 6137 |
|
| 6138 |
|
| 6139 |
|
| 6140 |
|
| 6141 |
|
| 6142 |
public static final class ExtraRenderingInfo { |
| 6143 |
private static final int UNDEFINED_VALUE = -1; |
| 6144 |
|
| 6145 |
private Size mLayoutSize; |
| 6146 |
private float mTextSizeInPx = UNDEFINED_VALUE; |
| 6147 |
private int mTextSizeUnit = UNDEFINED_VALUE; |
| 6148 |
|
| 6149 |
|
| 6150 |
|
| 6151 |
|
| 6152 |
|
| 6153 |
|
| 6154 |
|
| 6155 |
|
| 6156 |
@Deprecated |
| 6157 |
@NonNull |
| 6158 |
public static ExtraRenderingInfo obtain() { |
| 6159 |
return new ExtraRenderingInfo(null); |
| 6160 |
} |
| 6161 |
|
| 6162 |
|
| 6163 |
|
| 6164 |
|
| 6165 |
|
| 6166 |
|
| 6167 |
|
| 6168 |
|
| 6169 |
@Deprecated |
| 6170 |
private static ExtraRenderingInfo obtain(ExtraRenderingInfo other) { |
| 6171 |
return new ExtraRenderingInfo(other); |
| 6172 |
} |
| 6173 |
|
| 6174 |
|
| 6175 |
|
| 6176 |
|
| 6177 |
|
| 6178 |
|
| 6179 |
|
| 6180 |
private ExtraRenderingInfo(@Nullable ExtraRenderingInfo other) { |
| 6181 |
if (other != null) { |
| 6182 |
mLayoutSize = other.mLayoutSize; |
| 6183 |
mTextSizeInPx = other.mTextSizeInPx; |
| 6184 |
mTextSizeUnit = other.mTextSizeUnit; |
| 6185 |
} |
| 6186 |
} |
| 6187 |
|
| 6188 |
|
| 6189 |
|
| 6190 |
|
| 6191 |
|
| 6192 |
|
| 6193 |
|
| 6194 |
|
| 6195 |
|
| 6196 |
|
| 6197 |
|
| 6198 |
|
| 6199 |
public @Nullable Size getLayoutSize() { |
| 6200 |
return mLayoutSize; |
| 6201 |
} |
| 6202 |
|
| 6203 |
|
| 6204 |
|
| 6205 |
|
| 6206 |
|
| 6207 |
|
| 6208 |
|
| 6209 |
|
| 6210 |
public void setLayoutSize(int width, int height) { |
| 6211 |
mLayoutSize = new Size(width, height); |
| 6212 |
} |
| 6213 |
|
| 6214 |
|
| 6215 |
|
| 6216 |
|
| 6217 |
|
| 6218 |
|
| 6219 |
|
| 6220 |
|
| 6221 |
public float getTextSizeInPx() { |
| 6222 |
return mTextSizeInPx; |
| 6223 |
} |
| 6224 |
|
| 6225 |
|
| 6226 |
|
| 6227 |
|
| 6228 |
|
| 6229 |
|
| 6230 |
|
| 6231 |
public void setTextSizeInPx(float textSizeInPx) { |
| 6232 |
mTextSizeInPx = textSizeInPx; |
| 6233 |
} |
| 6234 |
|
| 6235 |
|
| 6236 |
|
| 6237 |
|
| 6238 |
|
| 6239 |
|
| 6240 |
|
| 6241 |
|
| 6242 |
|
| 6243 |
|
| 6244 |
|
| 6245 |
|
| 6246 |
public int getTextSizeUnit() { |
| 6247 |
return mTextSizeUnit; |
| 6248 |
} |
| 6249 |
|
| 6250 |
|
| 6251 |
|
| 6252 |
|
| 6253 |
|
| 6254 |
|
| 6255 |
|
| 6256 |
public void setTextSizeUnit(int textSizeUnit) { |
| 6257 |
mTextSizeUnit = textSizeUnit; |
| 6258 |
} |
| 6259 |
|
| 6260 |
|
| 6261 |
|
| 6262 |
|
| 6263 |
|
| 6264 |
|
| 6265 |
|
| 6266 |
@Deprecated |
| 6267 |
void recycle() {} |
| 6268 |
|
| 6269 |
private void clear() { |
| 6270 |
mLayoutSize = null; |
| 6271 |
mTextSizeInPx = UNDEFINED_VALUE; |
| 6272 |
mTextSizeUnit = UNDEFINED_VALUE; |
| 6273 |
} |
| 6274 |
} |
| 6275 |
|
| 6276 |
|
| 6277 |
|
| 6278 |
|
| 6279 |
public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityNodeInfo> CREATOR = |
| 6280 |
new Parcelable.Creator<AccessibilityNodeInfo>() { |
| 6281 |
@Override |
| 6282 |
public AccessibilityNodeInfo createFromParcel(Parcel parcel) { |
| 6283 |
AccessibilityNodeInfo info = new AccessibilityNodeInfo(); |
| 6284 |
info.initFromParcel(parcel); |
| 6285 |
return info; |
| 6286 |
} |
| 6287 |
|
| 6288 |
@Override |
| 6289 |
public AccessibilityNodeInfo[] newArray(int size) { |
| 6290 |
return new AccessibilityNodeInfo[size]; |
| 6291 |
} |
| 6292 |
}; |
| 6293 |
} |