1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
|
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.view.contentcapture;
import static android.view.contentcapture.ContentCaptureHelper.getSanitizedString;
import static android.view.contentcapture.ContentCaptureManager.DEBUG;
import static android.view.contentcapture.ContentCaptureManager.NO_SESSION_ID;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.graphics.Insets;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.Selection;
import android.text.Spannable;
import android.text.SpannableString;
import android.util.Log;
import android.view.autofill.AutofillId;
import android.view.inputmethod.BaseInputConnection;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/** @hide */
@SystemApi
public final class ContentCaptureEvent implements Parcelable {
private static final String TAG = ContentCaptureEvent.class.getSimpleName();
/** @hide */
public static final int TYPE_SESSION_FINISHED = -2;
/** @hide */
public static final int TYPE_SESSION_STARTED = -1;
/**
* Called when a node has been added to the screen and is visible to the user.
*
* On API level 33, this event may be re-sent with additional information if a view's children
* have changed, e.g. scrolling Views inside of a ListView. This information will be stored in
* the extras Bundle associated with the event's ViewNode. Within the Bundle, the
* "android.view.ViewStructure.extra.ACTIVE_CHILDREN_IDS" key may be used to get a list of
* Autofill IDs of active child views, and the
* "android.view.ViewStructure.extra.FIRST_ACTIVE_POSITION" key may be used to get the 0-based
* position of the first active child view in the list relative to the positions of child views
* in the container View's dataset.
*
* <p>The metadata of the node is available through {@link #getViewNode()}.
*/
public static final int TYPE_VIEW_APPEARED = 1;
/**
* Called when one or more nodes have been removed from the screen and is not visible to the
* user anymore.
*
* <p>To get the id(s), first call {@link #getIds()} - if it returns {@code null}, then call
* {@link #getId()}.
*/
public static final int TYPE_VIEW_DISAPPEARED = 2;
/**
* Called when the text of a node has been changed.
*
* <p>The id of the node is available through {@link #getId()}, and the new text is
* available through {@link #getText()}.
*/
public static final int TYPE_VIEW_TEXT_CHANGED = 3;
/**
* Called before events (such as {@link #TYPE_VIEW_APPEARED} and/or
* {@link #TYPE_VIEW_DISAPPEARED}) representing a view hierarchy are sent.
*
* <p><b>NOTE</b>: there is no guarantee this event will be sent. For example, it's not sent
* if the initial view hierarchy doesn't initially have any view that's important for content
* capture.
*/
public static final int TYPE_VIEW_TREE_APPEARING = 4;
/**
* Called after events (such as {@link #TYPE_VIEW_APPEARED} and/or
* {@link #TYPE_VIEW_DISAPPEARED}) representing a view hierarchy were sent.
*
* <p><b>NOTE</b>: there is no guarantee this event will be sent. For example, it's not sent
* if the initial view hierarchy doesn't initially have any view that's important for content
* capture.
*/
public static final int TYPE_VIEW_TREE_APPEARED = 5;
/**
* Called after a call to
* {@link ContentCaptureSession#setContentCaptureContext(ContentCaptureContext)}.
*
* <p>The passed context is available through {@link #getContentCaptureContext()}.
*/
public static final int TYPE_CONTEXT_UPDATED = 6;
/**
* Called after the session is ready, typically after the activity resumed and the
* initial views appeared
*/
public static final int TYPE_SESSION_RESUMED = 7;
/**
* Called after the session is paused, typically after the activity paused and the
* views disappeared.
*/
public static final int TYPE_SESSION_PAUSED = 8;
/**
* Called when the view's insets are changed. The new insets associated with the
* event may then be retrieved by calling {@link #getInsets()}
*/
public static final int TYPE_VIEW_INSETS_CHANGED = 9;
/**
* Called before {@link #TYPE_VIEW_TREE_APPEARING}, or after the size of the window containing
* the views changed.
*/
public static final int TYPE_WINDOW_BOUNDS_CHANGED = 10;
/** @hide */
@IntDef(prefix = { "TYPE_" }, value = {
TYPE_VIEW_APPEARED,
TYPE_VIEW_DISAPPEARED,
TYPE_VIEW_TEXT_CHANGED,
TYPE_VIEW_TREE_APPEARING,
TYPE_VIEW_TREE_APPEARED,
TYPE_CONTEXT_UPDATED,
TYPE_SESSION_PAUSED,
TYPE_SESSION_RESUMED,
TYPE_VIEW_INSETS_CHANGED,
TYPE_WINDOW_BOUNDS_CHANGED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface EventType{}
/** @hide */
public static final int MAX_INVALID_VALUE = -1;
private final int mSessionId;
private final int mType;
private final long mEventTime;
private @Nullable AutofillId mId;
private @Nullable ArrayList<AutofillId> mIds;
private @Nullable ViewNode mNode;
private @Nullable CharSequence mText;
private int mParentSessionId = NO_SESSION_ID;
private @Nullable ContentCaptureContext mClientContext;
private @Nullable Insets mInsets;
private @Nullable Rect mBounds;
private int mComposingStart = MAX_INVALID_VALUE;
private int mComposingEnd = MAX_INVALID_VALUE;
private int mSelectionStartIndex = MAX_INVALID_VALUE;
private int mSelectionEndIndex = MAX_INVALID_VALUE;
/** Only used in the main Content Capture session, no need to parcel */
private boolean mTextHasComposingSpan;
/** @hide */
public ContentCaptureEvent(int sessionId, int type, long eventTime) {
mSessionId = sessionId;
mType = type;
mEventTime = eventTime;
}
/** @hide */
public ContentCaptureEvent(int sessionId, int type) {
this(sessionId, type, System.currentTimeMillis());
}
/** @hide */
public ContentCaptureEvent setAutofillId(@NonNull AutofillId id) {
mId = Objects.requireNonNull(id);
return this;
}
/** @hide */
public ContentCaptureEvent setAutofillIds(@NonNull ArrayList<AutofillId> ids) {
mIds = Objects.requireNonNull(ids);
return this;
}
/**
* Adds an autofill id to the this event, merging the single id into a list if necessary.
*
* @hide
*/
public ContentCaptureEvent addAutofillId(@NonNull AutofillId id) {
Objects.requireNonNull(id);
if (mIds == null) {
mIds = new ArrayList<>();
if (mId == null) {
Log.w(TAG, "addAutofillId(" + id + ") called without an initial id");
} else {
mIds.add(mId);
mId = null;
}
}
mIds.add(id);
return this;
}
/**
* Used by {@link #TYPE_SESSION_STARTED} and {@link #TYPE_SESSION_FINISHED}.
*
* @hide
*/
public ContentCaptureEvent setParentSessionId(int parentSessionId) {
mParentSessionId = parentSessionId;
return this;
}
/**
* Used by {@link #TYPE_SESSION_STARTED} and {@link #TYPE_SESSION_FINISHED}.
*
* @hide
*/
public ContentCaptureEvent setClientContext(@NonNull ContentCaptureContext clientContext) {
mClientContext = clientContext;
return this;
}
/** @hide */
@NonNull
public int getSessionId() {
return mSessionId;
}
/**
* Used by {@link #TYPE_SESSION_STARTED} and {@link #TYPE_SESSION_FINISHED}.
*
* @hide
*/
@Nullable
public int getParentSessionId() {
return mParentSessionId;
}
/**
* Gets the {@link ContentCaptureContext} set calls to
* {@link ContentCaptureSession#setContentCaptureContext(ContentCaptureContext)}.
*
* <p>Only set on {@link #TYPE_CONTEXT_UPDATED} events.
*/
@Nullable
public ContentCaptureContext getContentCaptureContext() {
return mClientContext;
}
/** @hide */
@NonNull
public ContentCaptureEvent setViewNode(@NonNull ViewNode node) {
mNode = Objects.requireNonNull(node);
return this;
}
/** @hide */
@NonNull
public ContentCaptureEvent setText(@Nullable CharSequence text) {
mText = text;
return this;
}
/** @hide */
@NonNull
public ContentCaptureEvent setComposingIndex(int start, int end) {
mComposingStart = start;
mComposingEnd = end;
return this;
}
/** @hide */
@NonNull
public boolean hasComposingSpan() {
return mComposingStart > MAX_INVALID_VALUE;
}
/** @hide */
@NonNull
public ContentCaptureEvent setSelectionIndex(int start, int end) {
mSelectionStartIndex = start;
mSelectionEndIndex = end;
return this;
}
boolean hasSameComposingSpan(@NonNull ContentCaptureEvent other) {
return mComposingStart == other.mComposingStart && mComposingEnd == other.mComposingEnd;
}
boolean hasSameSelectionSpan(@NonNull ContentCaptureEvent other) {
return mSelectionStartIndex == other.mSelectionStartIndex
&& mSelectionEndIndex == other.mSelectionEndIndex;
}
private int getComposingStart() {
return mComposingStart;
}
private int getComposingEnd() {
return mComposingEnd;
}
private int getSelectionStart() {
return mSelectionStartIndex;
}
private int getSelectionEnd() {
return mSelectionEndIndex;
}
private void restoreComposingSpan() {
if (mComposingStart <= MAX_INVALID_VALUE
|| mComposingEnd <= MAX_INVALID_VALUE) {
return;
}
if (mText instanceof Spannable) {
BaseInputConnection.setComposingSpans((Spannable) mText, mComposingStart,
mComposingEnd);
} else {
Log.w(TAG, "Text is not a Spannable.");
}
}
private void restoreSelectionSpans() {
if (mSelectionStartIndex <= MAX_INVALID_VALUE
|| mSelectionEndIndex <= MAX_INVALID_VALUE) {
return;
}
if (mText instanceof SpannableString) {
SpannableString ss = (SpannableString) mText;
ss.setSpan(Selection.SELECTION_START, mSelectionStartIndex, mSelectionStartIndex, 0);
ss.setSpan(Selection.SELECTION_END, mSelectionEndIndex, mSelectionEndIndex, 0);
} else {
Log.w(TAG, "Text is not a SpannableString.");
}
}
/** @hide */
@NonNull
public ContentCaptureEvent setInsets(@NonNull Insets insets) {
mInsets = insets;
return this;
}
/** @hide */
@NonNull
public ContentCaptureEvent setBounds(@NonNull Rect bounds) {
mBounds = bounds;
return this;
}
/**
* Gets the type of the event.
*
* @return one of {@link #TYPE_VIEW_APPEARED}, {@link #TYPE_VIEW_DISAPPEARED},
* {@link #TYPE_VIEW_TEXT_CHANGED}, {@link #TYPE_VIEW_TREE_APPEARING},
* {@link #TYPE_VIEW_TREE_APPEARED}, {@link #TYPE_CONTEXT_UPDATED},
* {@link #TYPE_SESSION_RESUMED}, or {@link #TYPE_SESSION_PAUSED}.
*/
public @EventType int getType() {
return mType;
}
/**
* Gets when the event was generated, in millis since epoch.
*/
public long getEventTime() {
return mEventTime;
}
/**
* Gets the whole metadata of the node associated with the event.
*
* <p>Only set on {@link #TYPE_VIEW_APPEARED} events.
*/
@Nullable
public ViewNode getViewNode() {
return mNode;
}
/**
* Gets the {@link AutofillId} of the node associated with the event.
*
* <p>Only set on {@link #TYPE_VIEW_DISAPPEARED} (when the event contains just one node - if
* it contains more than one, this method returns {@code null} and the actual ids should be
* retrived by {@link #getIds()}) and {@link #TYPE_VIEW_TEXT_CHANGED} events.
*/
@Nullable
public AutofillId getId() {
return mId;
}
/**
* Gets the {@link AutofillId AutofillIds} of the nodes associated with the event.
*
* <p>Only set on {@link #TYPE_VIEW_DISAPPEARED}, when the event contains more than one node
* (if it contains just one node, it's returned by {@link #getId()} instead.
*/
@Nullable
public List<AutofillId> getIds() {
return mIds;
}
/**
* Gets the current text of the node associated with the event.
*
* <p>Only set on {@link #TYPE_VIEW_TEXT_CHANGED} events.
*/
@Nullable
public CharSequence getText() {
return mText;
}
/**
* Gets the rectangle of the insets associated with the event. Valid insets will only be
* returned if the type of the event is {@link #TYPE_VIEW_INSETS_CHANGED}, otherwise they
* will be null.
*/
@Nullable
public Insets getInsets() {
return mInsets;
}
/**
* Gets the {@link Rect} bounds of the window associated with the event. Valid bounds will only
* be returned if the type of the event is {@link #TYPE_WINDOW_BOUNDS_CHANGED}, otherwise they
* will be null.
*/
@Nullable
public Rect getBounds() {
return mBounds;
}
/**
* Merges event of the same type, either {@link #TYPE_VIEW_TEXT_CHANGED}
* or {@link #TYPE_VIEW_DISAPPEARED}.
*
* @hide
*/
public void mergeEvent(@NonNull ContentCaptureEvent event) {
Objects.requireNonNull(event);
final int eventType = event.getType();
if (mType != eventType) {
Log.e(TAG, "mergeEvent(" + getTypeAsString(eventType) + ") cannot be merged "
+ "with different eventType=" + getTypeAsString(mType));
return;
}
if (eventType == TYPE_VIEW_DISAPPEARED) {
final List<AutofillId> ids = event.getIds();
final AutofillId id = event.getId();
if (ids != null) {
if (id != null) {
Log.w(TAG, "got TYPE_VIEW_DISAPPEARED event with both id and ids: " + event);
}
for (int i = 0; i < ids.size(); i++) {
addAutofillId(ids.get(i));
}
return;
}
if (id != null) {
addAutofillId(id);
return;
}
throw new IllegalArgumentException("mergeEvent(): got "
+ "TYPE_VIEW_DISAPPEARED event with neither id or ids: " + event);
} else if (eventType == TYPE_VIEW_TEXT_CHANGED) {
setText(event.getText());
setComposingIndex(event.getComposingStart(), event.getComposingEnd());
setSelectionIndex(event.getSelectionStart(), event.getSelectionEnd());
} else {
Log.e(TAG, "mergeEvent(" + getTypeAsString(eventType)
+ ") does not support this event type.");
}
}
/** @hide */
public void dump(@NonNull PrintWriter pw) {
pw.print("type="); pw.print(getTypeAsString(mType));
pw.print(", time="); pw.print(mEventTime);
if (mId != null) {
pw.print(", id="); pw.print(mId);
}
if (mIds != null) {
pw.print(", ids="); pw.print(mIds);
}
if (mNode != null) {
pw.print(", mNode.id="); pw.print(mNode.getAutofillId());
}
if (mSessionId != NO_SESSION_ID) {
pw.print(", sessionId="); pw.print(mSessionId);
}
if (mParentSessionId != NO_SESSION_ID) {
pw.print(", parentSessionId="); pw.print(mParentSessionId);
}
if (mText != null) {
pw.print(", text="); pw.println(getSanitizedString(mText));
}
if (mClientContext != null) {
pw.print(", context="); mClientContext.dump(pw); pw.println();
}
if (mInsets != null) {
pw.print(", insets="); pw.println(mInsets);
}
if (mBounds != null) {
pw.print(", bounds="); pw.println(mBounds);
}
if (mComposingStart > MAX_INVALID_VALUE) {
pw.print(", composing("); pw.print(mComposingStart);
pw.print(", "); pw.print(mComposingEnd); pw.print(")");
}
if (mSelectionStartIndex > MAX_INVALID_VALUE) {
pw.print(", selection("); pw.print(mSelectionStartIndex);
pw.print(", "); pw.print(mSelectionEndIndex); pw.print(")");
}
}
@NonNull
@Override
public String toString() {
final StringBuilder string = new StringBuilder("ContentCaptureEvent[type=")
.append(getTypeAsString(mType));
string.append(", session=").append(mSessionId);
if (mType == TYPE_SESSION_STARTED && mParentSessionId != NO_SESSION_ID) {
string.append(", parent=").append(mParentSessionId);
}
if (mId != null) {
string.append(", id=").append(mId);
}
if (mIds != null) {
string.append(", ids=").append(mIds);
}
if (mNode != null) {
final String className = mNode.getClassName();
string.append(", class=").append(className);
string.append(", id=").append(mNode.getAutofillId());
if (mNode.getText() != null) {
string.append(", text=")
.append(DEBUG ? mNode.getText() : getSanitizedString(mNode.getText()));
}
}
if (mText != null) {
string.append(", text=")
.append(DEBUG ? mText : getSanitizedString(mText));
}
if (mClientContext != null) {
string.append(", context=").append(mClientContext);
}
if (mInsets != null) {
string.append(", insets=").append(mInsets);
}
if (mBounds != null) {
string.append(", bounds=").append(mBounds);
}
if (mComposingStart > MAX_INVALID_VALUE) {
string.append(", composing=[")
.append(mComposingStart).append(",").append(mComposingEnd).append("]");
}
if (mSelectionStartIndex > MAX_INVALID_VALUE) {
string.append(", selection=[")
.append(mSelectionStartIndex).append(",")
.append(mSelectionEndIndex).append("]");
}
return string.append(']').toString();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeInt(mSessionId);
parcel.writeInt(mType);
parcel.writeLong(mEventTime);
parcel.writeParcelable(mId, flags);
parcel.writeTypedList(mIds);
ViewNode.writeToParcel(parcel, mNode, flags);
parcel.writeCharSequence(mText);
if (mType == TYPE_SESSION_STARTED || mType == TYPE_SESSION_FINISHED) {
parcel.writeInt(mParentSessionId);
}
if (mType == TYPE_SESSION_STARTED || mType == TYPE_CONTEXT_UPDATED) {
parcel.writeParcelable(mClientContext, flags);
}
if (mType == TYPE_VIEW_INSETS_CHANGED) {
parcel.writeParcelable(mInsets, flags);
}
if (mType == TYPE_WINDOW_BOUNDS_CHANGED) {
parcel.writeParcelable(mBounds, flags);
}
if (mType == TYPE_VIEW_TEXT_CHANGED) {
parcel.writeInt(mComposingStart);
parcel.writeInt(mComposingEnd);
parcel.writeInt(mSelectionStartIndex);
parcel.writeInt(mSelectionEndIndex);
}
}
public static final @android.annotation.NonNull Parcelable.Creator<ContentCaptureEvent> CREATOR =
new Parcelable.Creator<ContentCaptureEvent>() {
@Override
@NonNull
public ContentCaptureEvent createFromParcel(Parcel parcel) {
final int sessionId = parcel.readInt();
final int type = parcel.readInt();
final long eventTime = parcel.readLong();
final ContentCaptureEvent event = new ContentCaptureEvent(sessionId, type, eventTime);
final AutofillId id = parcel.readParcelable(null, android.view.autofill.AutofillId.class);
if (id != null) {
event.setAutofillId(id);
}
final ArrayList<AutofillId> ids = parcel.createTypedArrayList(AutofillId.CREATOR);
if (ids != null) {
event.setAutofillIds(ids);
}
final ViewNode node = ViewNode.readFromParcel(parcel);
if (node != null) {
event.setViewNode(node);
}
event.setText(parcel.readCharSequence());
if (type == TYPE_SESSION_STARTED || type == TYPE_SESSION_FINISHED) {
event.setParentSessionId(parcel.readInt());
}
if (type == TYPE_SESSION_STARTED || type == TYPE_CONTEXT_UPDATED) {
event.setClientContext(parcel.readParcelable(null, android.view.contentcapture.ContentCaptureContext.class));
}
if (type == TYPE_VIEW_INSETS_CHANGED) {
event.setInsets(parcel.readParcelable(null, android.graphics.Insets.class));
}
if (type == TYPE_WINDOW_BOUNDS_CHANGED) {
event.setBounds(parcel.readParcelable(null, android.graphics.Rect.class));
}
if (type == TYPE_VIEW_TEXT_CHANGED) {
event.setComposingIndex(parcel.readInt(), parcel.readInt());
event.restoreComposingSpan();
event.setSelectionIndex(parcel.readInt(), parcel.readInt());
event.restoreSelectionSpans();
}
return event;
}
@Override
@NonNull
public ContentCaptureEvent[] newArray(int size) {
return new ContentCaptureEvent[size];
}
};
/** @hide */
public static String getTypeAsString(@EventType int type) {
switch (type) {
case TYPE_SESSION_STARTED:
return "SESSION_STARTED";
case TYPE_SESSION_FINISHED:
return "SESSION_FINISHED";
case TYPE_SESSION_RESUMED:
return "SESSION_RESUMED";
case TYPE_SESSION_PAUSED:
return "SESSION_PAUSED";
case TYPE_VIEW_APPEARED:
return "VIEW_APPEARED";
case TYPE_VIEW_DISAPPEARED:
return "VIEW_DISAPPEARED";
case TYPE_VIEW_TEXT_CHANGED:
return "VIEW_TEXT_CHANGED";
case TYPE_VIEW_TREE_APPEARING:
return "VIEW_TREE_APPEARING";
case TYPE_VIEW_TREE_APPEARED:
return "VIEW_TREE_APPEARED";
case TYPE_CONTEXT_UPDATED:
return "CONTEXT_UPDATED";
case TYPE_VIEW_INSETS_CHANGED:
return "VIEW_INSETS_CHANGED";
case TYPE_WINDOW_BOUNDS_CHANGED:
return "TYPE_WINDOW_BOUNDS_CHANGED";
default:
return "UKNOWN_TYPE: " + type;
}
}
}
|