| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app; |
| 18 |
|
| 19 |
import android.annotation.CurrentTimeMillisLong; |
| 20 |
import android.annotation.IntDef; |
| 21 |
import android.annotation.NonNull; |
| 22 |
import android.annotation.Nullable; |
| 23 |
import android.app.ActivityManager.RunningAppProcessInfo.Importance; |
| 24 |
import android.icu.text.SimpleDateFormat; |
| 25 |
import android.os.Parcel; |
| 26 |
import android.os.ParcelFileDescriptor; |
| 27 |
import android.os.Parcelable; |
| 28 |
import android.os.RemoteException; |
| 29 |
import android.os.UserHandle; |
| 30 |
import android.text.TextUtils; |
| 31 |
import android.util.DebugUtils; |
| 32 |
import android.util.proto.ProtoInputStream; |
| 33 |
import android.util.proto.ProtoOutputStream; |
| 34 |
import android.util.proto.WireTypeMismatchException; |
| 35 |
|
| 36 |
import com.android.internal.util.ArrayUtils; |
| 37 |
|
| 38 |
import java.io.File; |
| 39 |
import java.io.IOException; |
| 40 |
import java.io.InputStream; |
| 41 |
import java.io.PrintWriter; |
| 42 |
import java.lang.annotation.Retention; |
| 43 |
import java.lang.annotation.RetentionPolicy; |
| 44 |
import java.util.Date; |
| 45 |
import java.util.Objects; |
| 46 |
import java.util.zip.GZIPInputStream; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
public final class ApplicationExitInfo implements Parcelable { |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public static final int REASON_UNKNOWN = 0; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
public static final int REASON_EXIT_SELF = 1; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public static final int REASON_SIGNALED = 2; |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
public static final int REASON_LOW_MEMORY = 3; |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
public static final int REASON_CRASH = 4; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
public static final int REASON_CRASH_NATIVE = 5; |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
public static final int REASON_ANR = 6; |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
public static final int REASON_INITIALIZATION_FAILURE = 7; |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
public static final int REASON_PERMISSION_CHANGE = 8; |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
public static final int REASON_EXCESSIVE_RESOURCE_USAGE = 9; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
public static final int REASON_USER_REQUESTED = 10; |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
public static final int REASON_USER_STOPPED = 11; |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
public static final int REASON_DEPENDENCY_DIED = 12; |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
public static final int REASON_OTHER = 13; |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
public static final int REASON_FREEZER = 14; |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
public static final int SUBREASON_UNKNOWN = 0; |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
public static final int SUBREASON_WAIT_FOR_DEBUGGER = 1; |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
public static final int SUBREASON_TOO_MANY_CACHED = 2; |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
public static final int SUBREASON_TOO_MANY_EMPTY = 3; |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
public static final int SUBREASON_TRIM_EMPTY = 4; |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
public static final int SUBREASON_LARGE_CACHED = 5; |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
public static final int SUBREASON_MEMORY_PRESSURE = 6; |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
public static final int SUBREASON_EXCESSIVE_CPU = 7; |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
public static final int SUBREASON_SYSTEM_UPDATE_DONE = 8; |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
public static final int SUBREASON_KILL_ALL_FG = 9; |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
public static final int SUBREASON_KILL_ALL_BG_EXCEPT = 10; |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
public static final int SUBREASON_KILL_UID = 11; |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
public static final int SUBREASON_KILL_PID = 12; |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
public static final int SUBREASON_INVALID_START = 13; |
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
public static final int SUBREASON_INVALID_STATE = 14; |
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
public static final int SUBREASON_IMPERCEPTIBLE = 15; |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
public static final int SUBREASON_REMOVE_LRU = 16; |
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
public static final int SUBREASON_ISOLATED_NOT_NEEDED = 17; |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
public static final int SUBREASON_CACHED_IDLE_FORCED_APP_STANDBY = 18; |
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
public static final int SUBREASON_FREEZER_BINDER_IOCTL = 19; |
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
public static final int SUBREASON_FREEZER_BINDER_TRANSACTION = 20; |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
public static final int SUBREASON_FORCE_STOP = 21; |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
public static final int SUBREASON_REMOVE_TASK = 22; |
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
public static final int SUBREASON_STOP_APP = 23; |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
public static final int SUBREASON_KILL_BACKGROUND = 24; |
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
public static final int SUBREASON_PACKAGE_UPDATE = 25; |
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
public static final int SUBREASON_UNDELIVERED_BROADCAST = 26; |
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
private int mPid; |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
private int mRealUid; |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
private int mPackageUid; |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
private int mDefiningUid; |
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
private String mProcessName; |
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
private @Reason int mReason; |
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
private int mStatus; |
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
private @Importance int mImportance; |
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
private long mPss; |
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
private long mRss; |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
private @CurrentTimeMillisLong long mTimestamp; |
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
private @Nullable String mDescription; |
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
private @SubReason int mSubReason; |
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
private int mConnectionGroup; |
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
private String mPackageName; |
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
private String[] mPackageList; |
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
private byte[] mState; |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
private File mTraceFile; |
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
private IAppTraceRetriever mAppTraceRetriever; |
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
private IParcelFileDescriptorRetriever mNativeTombstoneRetriever; |
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
private boolean mLoggedInStatsd; |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
private boolean mHasForegroundServices; |
| 542 |
|
| 543 |
|
| 544 |
@IntDef(prefix = { "REASON_" }, value = { |
| 545 |
REASON_UNKNOWN, |
| 546 |
REASON_EXIT_SELF, |
| 547 |
REASON_SIGNALED, |
| 548 |
REASON_LOW_MEMORY, |
| 549 |
REASON_CRASH, |
| 550 |
REASON_CRASH_NATIVE, |
| 551 |
REASON_ANR, |
| 552 |
REASON_INITIALIZATION_FAILURE, |
| 553 |
REASON_PERMISSION_CHANGE, |
| 554 |
REASON_EXCESSIVE_RESOURCE_USAGE, |
| 555 |
REASON_USER_REQUESTED, |
| 556 |
REASON_USER_STOPPED, |
| 557 |
REASON_DEPENDENCY_DIED, |
| 558 |
REASON_OTHER, |
| 559 |
REASON_FREEZER, |
| 560 |
}) |
| 561 |
@Retention(RetentionPolicy.SOURCE) |
| 562 |
public @interface Reason {} |
| 563 |
|
| 564 |
|
| 565 |
@IntDef(prefix = { "SUBREASON_" }, value = { |
| 566 |
SUBREASON_UNKNOWN, |
| 567 |
SUBREASON_WAIT_FOR_DEBUGGER, |
| 568 |
SUBREASON_TOO_MANY_CACHED, |
| 569 |
SUBREASON_TOO_MANY_EMPTY, |
| 570 |
SUBREASON_TRIM_EMPTY, |
| 571 |
SUBREASON_LARGE_CACHED, |
| 572 |
SUBREASON_MEMORY_PRESSURE, |
| 573 |
SUBREASON_EXCESSIVE_CPU, |
| 574 |
SUBREASON_SYSTEM_UPDATE_DONE, |
| 575 |
SUBREASON_KILL_ALL_FG, |
| 576 |
SUBREASON_KILL_ALL_BG_EXCEPT, |
| 577 |
SUBREASON_KILL_UID, |
| 578 |
SUBREASON_KILL_PID, |
| 579 |
SUBREASON_INVALID_START, |
| 580 |
SUBREASON_INVALID_STATE, |
| 581 |
SUBREASON_IMPERCEPTIBLE, |
| 582 |
SUBREASON_REMOVE_LRU, |
| 583 |
SUBREASON_ISOLATED_NOT_NEEDED, |
| 584 |
SUBREASON_FREEZER_BINDER_IOCTL, |
| 585 |
SUBREASON_FREEZER_BINDER_TRANSACTION, |
| 586 |
SUBREASON_FORCE_STOP, |
| 587 |
SUBREASON_REMOVE_TASK, |
| 588 |
SUBREASON_STOP_APP, |
| 589 |
SUBREASON_KILL_BACKGROUND, |
| 590 |
SUBREASON_PACKAGE_UPDATE, |
| 591 |
SUBREASON_UNDELIVERED_BROADCAST, |
| 592 |
}) |
| 593 |
@Retention(RetentionPolicy.SOURCE) |
| 594 |
public @interface SubReason {} |
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
public int getPid() { |
| 600 |
return mPid; |
| 601 |
} |
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
public int getRealUid() { |
| 611 |
return mRealUid; |
| 612 |
} |
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
public int getPackageUid() { |
| 619 |
return mPackageUid; |
| 620 |
} |
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
public int getDefiningUid() { |
| 631 |
return mDefiningUid; |
| 632 |
} |
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
public @NonNull String getProcessName() { |
| 638 |
return mProcessName; |
| 639 |
} |
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
public @Reason int getReason() { |
| 645 |
return mReason; |
| 646 |
} |
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
public int getStatus() { |
| 653 |
return mStatus; |
| 654 |
} |
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
public @Importance int getImportance() { |
| 660 |
return mImportance; |
| 661 |
} |
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
public long getPss() { |
| 671 |
return mPss; |
| 672 |
} |
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
public long getRss() { |
| 682 |
return mRss; |
| 683 |
} |
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
public @CurrentTimeMillisLong long getTimestamp() { |
| 690 |
return mTimestamp; |
| 691 |
} |
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
public @Nullable String getDescription() { |
| 700 |
return mDescription; |
| 701 |
} |
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
public @NonNull UserHandle getUserHandle() { |
| 707 |
return UserHandle.of(UserHandle.getUserId(mRealUid)); |
| 708 |
} |
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
public @Nullable byte[] getProcessStateSummary() { |
| 719 |
return mState; |
| 720 |
} |
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
public @Nullable InputStream getTraceInputStream() throws IOException { |
| 739 |
if (mAppTraceRetriever == null && mNativeTombstoneRetriever == null) { |
| 740 |
return null; |
| 741 |
} |
| 742 |
|
| 743 |
try { |
| 744 |
if (mNativeTombstoneRetriever != null) { |
| 745 |
final ParcelFileDescriptor pfd = mNativeTombstoneRetriever.getPfd(); |
| 746 |
if (pfd == null) { |
| 747 |
return null; |
| 748 |
} |
| 749 |
|
| 750 |
return new ParcelFileDescriptor.AutoCloseInputStream(pfd); |
| 751 |
} else { |
| 752 |
final ParcelFileDescriptor fd = mAppTraceRetriever.getTraceFileDescriptor( |
| 753 |
mPackageName, mPackageUid, mPid); |
| 754 |
if (fd == null) { |
| 755 |
return null; |
| 756 |
} |
| 757 |
return new GZIPInputStream(new ParcelFileDescriptor.AutoCloseInputStream(fd)); |
| 758 |
} |
| 759 |
} catch (RemoteException e) { |
| 760 |
return null; |
| 761 |
} |
| 762 |
} |
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
public @Nullable File getTraceFile() { |
| 772 |
return mTraceFile; |
| 773 |
} |
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
public @SubReason int getSubReason() { |
| 783 |
return mSubReason; |
| 784 |
} |
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
public int getConnectionGroup() { |
| 795 |
return mConnectionGroup; |
| 796 |
} |
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
public String getPackageName() { |
| 804 |
return mPackageName; |
| 805 |
} |
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
public String[] getPackageList() { |
| 815 |
return mPackageList; |
| 816 |
} |
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
public void setPid(final int pid) { |
| 824 |
mPid = pid; |
| 825 |
} |
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
public void setRealUid(final int uid) { |
| 833 |
mRealUid = uid; |
| 834 |
} |
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
public void setPackageUid(final int uid) { |
| 842 |
mPackageUid = uid; |
| 843 |
} |
| 844 |
|
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
public void setDefiningUid(final int uid) { |
| 851 |
mDefiningUid = uid; |
| 852 |
} |
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
public void setProcessName(final String processName) { |
| 860 |
mProcessName = intern(processName); |
| 861 |
} |
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
public void setReason(final @Reason int reason) { |
| 869 |
mReason = reason; |
| 870 |
} |
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
public void setStatus(final int status) { |
| 878 |
mStatus = status; |
| 879 |
} |
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
public void setImportance(final @Importance int importance) { |
| 887 |
mImportance = importance; |
| 888 |
} |
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
public void setPss(final long pss) { |
| 896 |
mPss = pss; |
| 897 |
} |
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
public void setRss(final long rss) { |
| 905 |
mRss = rss; |
| 906 |
} |
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
public void setTimestamp(final @CurrentTimeMillisLong long timestamp) { |
| 914 |
mTimestamp = timestamp; |
| 915 |
} |
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
public void setDescription(final String description) { |
| 923 |
mDescription = intern(description); |
| 924 |
} |
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
|
| 931 |
public void setSubReason(final @SubReason int subReason) { |
| 932 |
mSubReason = subReason; |
| 933 |
} |
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
public void setConnectionGroup(final int connectionGroup) { |
| 941 |
mConnectionGroup = connectionGroup; |
| 942 |
} |
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
public void setPackageName(final String packageName) { |
| 950 |
mPackageName = intern(packageName); |
| 951 |
} |
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
|
| 957 |
|
| 958 |
public void setPackageList(final String[] packageList) { |
| 959 |
mPackageList = packageList; |
| 960 |
} |
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
public void setProcessStateSummary(final byte[] state) { |
| 968 |
mState = state; |
| 969 |
} |
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
public void setTraceFile(final File traceFile) { |
| 977 |
mTraceFile = traceFile; |
| 978 |
} |
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
public void setAppTraceRetriever(final IAppTraceRetriever retriever) { |
| 986 |
mAppTraceRetriever = retriever; |
| 987 |
} |
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
public void setNativeTombstoneRetriever(final IParcelFileDescriptorRetriever retriever) { |
| 995 |
mNativeTombstoneRetriever = retriever; |
| 996 |
} |
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
public boolean isLoggedInStatsd() { |
| 1004 |
return mLoggedInStatsd; |
| 1005 |
} |
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
public void setLoggedInStatsd(boolean loggedInStatsd) { |
| 1013 |
mLoggedInStatsd = loggedInStatsd; |
| 1014 |
} |
| 1015 |
|
| 1016 |
|
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
|
| 1021 |
public boolean hasForegroundServices() { |
| 1022 |
return mHasForegroundServices; |
| 1023 |
} |
| 1024 |
|
| 1025 |
|
| 1026 |
|
| 1027 |
|
| 1028 |
|
| 1029 |
|
| 1030 |
public void setHasForegroundServices(boolean hasForegroundServices) { |
| 1031 |
mHasForegroundServices = hasForegroundServices; |
| 1032 |
} |
| 1033 |
|
| 1034 |
@Override |
| 1035 |
public int describeContents() { |
| 1036 |
return 0; |
| 1037 |
} |
| 1038 |
|
| 1039 |
@Override |
| 1040 |
public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 1041 |
dest.writeInt(mPid); |
| 1042 |
dest.writeInt(mRealUid); |
| 1043 |
dest.writeInt(mPackageUid); |
| 1044 |
dest.writeInt(mDefiningUid); |
| 1045 |
dest.writeString(mProcessName); |
| 1046 |
dest.writeString(mPackageName); |
| 1047 |
dest.writeInt(mConnectionGroup); |
| 1048 |
dest.writeInt(mReason); |
| 1049 |
dest.writeInt(mSubReason); |
| 1050 |
dest.writeInt(mStatus); |
| 1051 |
dest.writeInt(mImportance); |
| 1052 |
dest.writeLong(mPss); |
| 1053 |
dest.writeLong(mRss); |
| 1054 |
dest.writeLong(mTimestamp); |
| 1055 |
dest.writeString(mDescription); |
| 1056 |
dest.writeByteArray(mState); |
| 1057 |
if (mAppTraceRetriever != null) { |
| 1058 |
dest.writeInt(1); |
| 1059 |
dest.writeStrongBinder(mAppTraceRetriever.asBinder()); |
| 1060 |
} else { |
| 1061 |
dest.writeInt(0); |
| 1062 |
} |
| 1063 |
if (mNativeTombstoneRetriever != null) { |
| 1064 |
dest.writeInt(1); |
| 1065 |
dest.writeStrongBinder(mNativeTombstoneRetriever.asBinder()); |
| 1066 |
} else { |
| 1067 |
dest.writeInt(0); |
| 1068 |
} |
| 1069 |
} |
| 1070 |
|
| 1071 |
|
| 1072 |
public ApplicationExitInfo() { |
| 1073 |
} |
| 1074 |
|
| 1075 |
|
| 1076 |
public ApplicationExitInfo(ApplicationExitInfo other) { |
| 1077 |
mPid = other.mPid; |
| 1078 |
mRealUid = other.mRealUid; |
| 1079 |
mPackageUid = other.mPackageUid; |
| 1080 |
mDefiningUid = other.mDefiningUid; |
| 1081 |
mProcessName = other.mProcessName; |
| 1082 |
mPackageName = other.mPackageName; |
| 1083 |
mConnectionGroup = other.mConnectionGroup; |
| 1084 |
mReason = other.mReason; |
| 1085 |
mStatus = other.mStatus; |
| 1086 |
mSubReason = other.mSubReason; |
| 1087 |
mImportance = other.mImportance; |
| 1088 |
mPss = other.mPss; |
| 1089 |
mRss = other.mRss; |
| 1090 |
mTimestamp = other.mTimestamp; |
| 1091 |
mDescription = other.mDescription; |
| 1092 |
mPackageName = other.mPackageName; |
| 1093 |
mPackageList = other.mPackageList; |
| 1094 |
mState = other.mState; |
| 1095 |
mTraceFile = other.mTraceFile; |
| 1096 |
mAppTraceRetriever = other.mAppTraceRetriever; |
| 1097 |
mNativeTombstoneRetriever = other.mNativeTombstoneRetriever; |
| 1098 |
mLoggedInStatsd = other.mLoggedInStatsd; |
| 1099 |
mHasForegroundServices = other.mHasForegroundServices; |
| 1100 |
} |
| 1101 |
|
| 1102 |
private ApplicationExitInfo(@NonNull Parcel in) { |
| 1103 |
mPid = in.readInt(); |
| 1104 |
mRealUid = in.readInt(); |
| 1105 |
mPackageUid = in.readInt(); |
| 1106 |
mDefiningUid = in.readInt(); |
| 1107 |
mProcessName = intern(in.readString()); |
| 1108 |
mPackageName = intern(in.readString()); |
| 1109 |
mConnectionGroup = in.readInt(); |
| 1110 |
mReason = in.readInt(); |
| 1111 |
mSubReason = in.readInt(); |
| 1112 |
mStatus = in.readInt(); |
| 1113 |
mImportance = in.readInt(); |
| 1114 |
mPss = in.readLong(); |
| 1115 |
mRss = in.readLong(); |
| 1116 |
mTimestamp = in.readLong(); |
| 1117 |
mDescription = intern(in.readString()); |
| 1118 |
mState = in.createByteArray(); |
| 1119 |
if (in.readInt() == 1) { |
| 1120 |
mAppTraceRetriever = IAppTraceRetriever.Stub.asInterface(in.readStrongBinder()); |
| 1121 |
} |
| 1122 |
if (in.readInt() == 1) { |
| 1123 |
mNativeTombstoneRetriever = IParcelFileDescriptorRetriever.Stub.asInterface( |
| 1124 |
in.readStrongBinder()); |
| 1125 |
} |
| 1126 |
} |
| 1127 |
|
| 1128 |
private static String intern(@Nullable String source) { |
| 1129 |
return source != null ? source.intern() : null; |
| 1130 |
} |
| 1131 |
|
| 1132 |
public @NonNull static final Creator<ApplicationExitInfo> CREATOR = |
| 1133 |
new Creator<ApplicationExitInfo>() { |
| 1134 |
@Override |
| 1135 |
public ApplicationExitInfo createFromParcel(Parcel in) { |
| 1136 |
return new ApplicationExitInfo(in); |
| 1137 |
} |
| 1138 |
|
| 1139 |
@Override |
| 1140 |
public ApplicationExitInfo[] newArray(int size) { |
| 1141 |
return new ApplicationExitInfo[size]; |
| 1142 |
} |
| 1143 |
}; |
| 1144 |
|
| 1145 |
|
| 1146 |
public void dump(@NonNull PrintWriter pw, @Nullable String prefix, @Nullable String seqSuffix, |
| 1147 |
@NonNull SimpleDateFormat sdf) { |
| 1148 |
StringBuilder sb = new StringBuilder(); |
| 1149 |
sb.append(prefix) |
| 1150 |
.append("ApplicationExitInfo ").append(seqSuffix).append(':') |
| 1151 |
.append('\n'); |
| 1152 |
sb.append(prefix).append(' ') |
| 1153 |
.append(" timestamp=").append(sdf.format(new Date(mTimestamp))) |
| 1154 |
.append(" pid=").append(mPid) |
| 1155 |
.append(" realUid=").append(mRealUid) |
| 1156 |
.append(" packageUid=").append(mPackageUid) |
| 1157 |
.append(" definingUid=").append(mDefiningUid) |
| 1158 |
.append(" user=").append(UserHandle.getUserId(mPackageUid)) |
| 1159 |
.append('\n'); |
| 1160 |
sb.append(prefix).append(' ') |
| 1161 |
.append(" process=").append(mProcessName) |
| 1162 |
.append(" reason=").append(mReason) |
| 1163 |
.append(" (").append(reasonCodeToString(mReason)).append(")") |
| 1164 |
.append(" subreason=").append(mSubReason) |
| 1165 |
.append(" (").append(subreasonToString(mSubReason)).append(")") |
| 1166 |
.append(" status=").append(mStatus) |
| 1167 |
.append('\n'); |
| 1168 |
sb.append(prefix).append(' ') |
| 1169 |
.append(" importance=").append(mImportance) |
| 1170 |
.append(" pss="); |
| 1171 |
DebugUtils.sizeValueToString(mPss << 10, sb); |
| 1172 |
sb.append(" rss="); |
| 1173 |
DebugUtils.sizeValueToString(mRss << 10, sb); |
| 1174 |
sb.append(" description=").append(mDescription) |
| 1175 |
.append(" state=").append((ArrayUtils.isEmpty(mState) |
| 1176 |
? "empty" : Integer.toString(mState.length) + " bytes")) |
| 1177 |
.append(" trace=").append(mTraceFile) |
| 1178 |
.append('\n'); |
| 1179 |
pw.print(sb.toString()); |
| 1180 |
} |
| 1181 |
|
| 1182 |
@Override |
| 1183 |
public String toString() { |
| 1184 |
StringBuilder sb = new StringBuilder(); |
| 1185 |
sb.append("ApplicationExitInfo(timestamp="); |
| 1186 |
sb.append(new SimpleDateFormat().format(new Date(mTimestamp))); |
| 1187 |
sb.append(" pid=").append(mPid); |
| 1188 |
sb.append(" realUid=").append(mRealUid); |
| 1189 |
sb.append(" packageUid=").append(mPackageUid); |
| 1190 |
sb.append(" definingUid=").append(mDefiningUid); |
| 1191 |
sb.append(" user=").append(UserHandle.getUserId(mPackageUid)); |
| 1192 |
sb.append(" process=").append(mProcessName); |
| 1193 |
sb.append(" reason=").append(mReason).append(" (") |
| 1194 |
.append(reasonCodeToString(mReason)).append(")"); |
| 1195 |
sb.append(" subreason=").append(mSubReason).append(" (") |
| 1196 |
.append(subreasonToString(mSubReason)).append(")"); |
| 1197 |
sb.append(" status=").append(mStatus); |
| 1198 |
sb.append(" importance=").append(mImportance); |
| 1199 |
sb.append(" pss="); DebugUtils.sizeValueToString(mPss << 10, sb); |
| 1200 |
sb.append(" rss="); DebugUtils.sizeValueToString(mRss << 10, sb); |
| 1201 |
sb.append(" description=").append(mDescription); |
| 1202 |
sb.append(" state=").append(ArrayUtils.isEmpty(mState) |
| 1203 |
? "empty" : Integer.toString(mState.length) + " bytes"); |
| 1204 |
sb.append(" trace=").append(mTraceFile); |
| 1205 |
|
| 1206 |
return sb.toString(); |
| 1207 |
} |
| 1208 |
|
| 1209 |
|
| 1210 |
public static String reasonCodeToString(@Reason int reason) { |
| 1211 |
switch (reason) { |
| 1212 |
case REASON_EXIT_SELF: |
| 1213 |
return "EXIT_SELF"; |
| 1214 |
case REASON_SIGNALED: |
| 1215 |
return "SIGNALED"; |
| 1216 |
case REASON_LOW_MEMORY: |
| 1217 |
return "LOW_MEMORY"; |
| 1218 |
case REASON_CRASH: |
| 1219 |
return "APP CRASH(EXCEPTION)"; |
| 1220 |
case REASON_CRASH_NATIVE: |
| 1221 |
return "APP CRASH(NATIVE)"; |
| 1222 |
case REASON_ANR: |
| 1223 |
return "ANR"; |
| 1224 |
case REASON_INITIALIZATION_FAILURE: |
| 1225 |
return "INITIALIZATION FAILURE"; |
| 1226 |
case REASON_PERMISSION_CHANGE: |
| 1227 |
return "PERMISSION CHANGE"; |
| 1228 |
case REASON_EXCESSIVE_RESOURCE_USAGE: |
| 1229 |
return "EXCESSIVE RESOURCE USAGE"; |
| 1230 |
case REASON_USER_REQUESTED: |
| 1231 |
return "USER REQUESTED"; |
| 1232 |
case REASON_USER_STOPPED: |
| 1233 |
return "USER STOPPED"; |
| 1234 |
case REASON_DEPENDENCY_DIED: |
| 1235 |
return "DEPENDENCY DIED"; |
| 1236 |
case REASON_OTHER: |
| 1237 |
return "OTHER KILLS BY SYSTEM"; |
| 1238 |
case REASON_FREEZER: |
| 1239 |
return "FREEZER"; |
| 1240 |
default: |
| 1241 |
return "UNKNOWN"; |
| 1242 |
} |
| 1243 |
} |
| 1244 |
|
| 1245 |
|
| 1246 |
public static String subreasonToString(@SubReason int subreason) { |
| 1247 |
switch (subreason) { |
| 1248 |
case SUBREASON_WAIT_FOR_DEBUGGER: |
| 1249 |
return "WAIT FOR DEBUGGER"; |
| 1250 |
case SUBREASON_TOO_MANY_CACHED: |
| 1251 |
return "TOO MANY CACHED PROCS"; |
| 1252 |
case SUBREASON_TOO_MANY_EMPTY: |
| 1253 |
return "TOO MANY EMPTY PROCS"; |
| 1254 |
case SUBREASON_TRIM_EMPTY: |
| 1255 |
return "TRIM EMPTY"; |
| 1256 |
case SUBREASON_LARGE_CACHED: |
| 1257 |
return "LARGE CACHED"; |
| 1258 |
case SUBREASON_MEMORY_PRESSURE: |
| 1259 |
return "MEMORY PRESSURE"; |
| 1260 |
case SUBREASON_EXCESSIVE_CPU: |
| 1261 |
return "EXCESSIVE CPU USAGE"; |
| 1262 |
case SUBREASON_SYSTEM_UPDATE_DONE: |
| 1263 |
return "SYSTEM UPDATE_DONE"; |
| 1264 |
case SUBREASON_KILL_ALL_FG: |
| 1265 |
return "KILL ALL FG"; |
| 1266 |
case SUBREASON_KILL_ALL_BG_EXCEPT: |
| 1267 |
return "KILL ALL BG EXCEPT"; |
| 1268 |
case SUBREASON_KILL_UID: |
| 1269 |
return "KILL UID"; |
| 1270 |
case SUBREASON_KILL_PID: |
| 1271 |
return "KILL PID"; |
| 1272 |
case SUBREASON_INVALID_START: |
| 1273 |
return "INVALID START"; |
| 1274 |
case SUBREASON_INVALID_STATE: |
| 1275 |
return "INVALID STATE"; |
| 1276 |
case SUBREASON_IMPERCEPTIBLE: |
| 1277 |
return "IMPERCEPTIBLE"; |
| 1278 |
case SUBREASON_REMOVE_LRU: |
| 1279 |
return "REMOVE LRU"; |
| 1280 |
case SUBREASON_ISOLATED_NOT_NEEDED: |
| 1281 |
return "ISOLATED NOT NEEDED"; |
| 1282 |
case SUBREASON_FREEZER_BINDER_IOCTL: |
| 1283 |
return "FREEZER BINDER IOCTL"; |
| 1284 |
case SUBREASON_FREEZER_BINDER_TRANSACTION: |
| 1285 |
return "FREEZER BINDER TRANSACTION"; |
| 1286 |
case SUBREASON_FORCE_STOP: |
| 1287 |
return "FORCE STOP"; |
| 1288 |
case SUBREASON_REMOVE_TASK: |
| 1289 |
return "REMOVE TASK"; |
| 1290 |
case SUBREASON_STOP_APP: |
| 1291 |
return "STOP APP"; |
| 1292 |
case SUBREASON_KILL_BACKGROUND: |
| 1293 |
return "KILL BACKGROUND"; |
| 1294 |
case SUBREASON_PACKAGE_UPDATE: |
| 1295 |
return "PACKAGE UPDATE"; |
| 1296 |
case SUBREASON_UNDELIVERED_BROADCAST: |
| 1297 |
return "UNDELIVERED BROADCAST"; |
| 1298 |
default: |
| 1299 |
return "UNKNOWN"; |
| 1300 |
} |
| 1301 |
} |
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
public void writeToProto(ProtoOutputStream proto, long fieldId) { |
| 1312 |
final long token = proto.start(fieldId); |
| 1313 |
proto.write(ApplicationExitInfoProto.PID, mPid); |
| 1314 |
proto.write(ApplicationExitInfoProto.REAL_UID, mRealUid); |
| 1315 |
proto.write(ApplicationExitInfoProto.PACKAGE_UID, mPackageUid); |
| 1316 |
proto.write(ApplicationExitInfoProto.DEFINING_UID, mDefiningUid); |
| 1317 |
proto.write(ApplicationExitInfoProto.PROCESS_NAME, mProcessName); |
| 1318 |
proto.write(ApplicationExitInfoProto.CONNECTION_GROUP, mConnectionGroup); |
| 1319 |
proto.write(ApplicationExitInfoProto.REASON, mReason); |
| 1320 |
proto.write(ApplicationExitInfoProto.SUB_REASON, mSubReason); |
| 1321 |
proto.write(ApplicationExitInfoProto.STATUS, mStatus); |
| 1322 |
proto.write(ApplicationExitInfoProto.IMPORTANCE, mImportance); |
| 1323 |
proto.write(ApplicationExitInfoProto.PSS, mPss); |
| 1324 |
proto.write(ApplicationExitInfoProto.RSS, mRss); |
| 1325 |
proto.write(ApplicationExitInfoProto.TIMESTAMP, mTimestamp); |
| 1326 |
proto.write(ApplicationExitInfoProto.DESCRIPTION, mDescription); |
| 1327 |
proto.write(ApplicationExitInfoProto.STATE, mState); |
| 1328 |
proto.write(ApplicationExitInfoProto.TRACE_FILE, |
| 1329 |
mTraceFile == null ? null : mTraceFile.getAbsolutePath()); |
| 1330 |
proto.end(token); |
| 1331 |
} |
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
public void readFromProto(ProtoInputStream proto, long fieldId) |
| 1342 |
throws IOException, WireTypeMismatchException { |
| 1343 |
final long token = proto.start(fieldId); |
| 1344 |
while (proto.nextField() != ProtoInputStream.NO_MORE_FIELDS) { |
| 1345 |
switch (proto.getFieldNumber()) { |
| 1346 |
case (int) ApplicationExitInfoProto.PID: |
| 1347 |
mPid = proto.readInt(ApplicationExitInfoProto.PID); |
| 1348 |
break; |
| 1349 |
case (int) ApplicationExitInfoProto.REAL_UID: |
| 1350 |
mRealUid = proto.readInt(ApplicationExitInfoProto.REAL_UID); |
| 1351 |
break; |
| 1352 |
case (int) ApplicationExitInfoProto.PACKAGE_UID: |
| 1353 |
mPackageUid = proto.readInt(ApplicationExitInfoProto.PACKAGE_UID); |
| 1354 |
break; |
| 1355 |
case (int) ApplicationExitInfoProto.DEFINING_UID: |
| 1356 |
mDefiningUid = proto.readInt(ApplicationExitInfoProto.DEFINING_UID); |
| 1357 |
break; |
| 1358 |
case (int) ApplicationExitInfoProto.PROCESS_NAME: |
| 1359 |
mProcessName = intern(proto.readString(ApplicationExitInfoProto.PROCESS_NAME)); |
| 1360 |
break; |
| 1361 |
case (int) ApplicationExitInfoProto.CONNECTION_GROUP: |
| 1362 |
mConnectionGroup = proto.readInt(ApplicationExitInfoProto.CONNECTION_GROUP); |
| 1363 |
break; |
| 1364 |
case (int) ApplicationExitInfoProto.REASON: |
| 1365 |
mReason = proto.readInt(ApplicationExitInfoProto.REASON); |
| 1366 |
break; |
| 1367 |
case (int) ApplicationExitInfoProto.SUB_REASON: |
| 1368 |
mSubReason = proto.readInt(ApplicationExitInfoProto.SUB_REASON); |
| 1369 |
break; |
| 1370 |
case (int) ApplicationExitInfoProto.STATUS: |
| 1371 |
mStatus = proto.readInt(ApplicationExitInfoProto.STATUS); |
| 1372 |
break; |
| 1373 |
case (int) ApplicationExitInfoProto.IMPORTANCE: |
| 1374 |
mImportance = proto.readInt(ApplicationExitInfoProto.IMPORTANCE); |
| 1375 |
break; |
| 1376 |
case (int) ApplicationExitInfoProto.PSS: |
| 1377 |
mPss = proto.readLong(ApplicationExitInfoProto.PSS); |
| 1378 |
break; |
| 1379 |
case (int) ApplicationExitInfoProto.RSS: |
| 1380 |
mRss = proto.readLong(ApplicationExitInfoProto.RSS); |
| 1381 |
break; |
| 1382 |
case (int) ApplicationExitInfoProto.TIMESTAMP: |
| 1383 |
mTimestamp = proto.readLong(ApplicationExitInfoProto.TIMESTAMP); |
| 1384 |
break; |
| 1385 |
case (int) ApplicationExitInfoProto.DESCRIPTION: |
| 1386 |
mDescription = intern(proto.readString(ApplicationExitInfoProto.DESCRIPTION)); |
| 1387 |
break; |
| 1388 |
case (int) ApplicationExitInfoProto.STATE: |
| 1389 |
mState = proto.readBytes(ApplicationExitInfoProto.STATE); |
| 1390 |
break; |
| 1391 |
case (int) ApplicationExitInfoProto.TRACE_FILE: |
| 1392 |
final String path = proto.readString(ApplicationExitInfoProto.TRACE_FILE); |
| 1393 |
if (!TextUtils.isEmpty(path)) { |
| 1394 |
mTraceFile = new File(path); |
| 1395 |
} |
| 1396 |
break; |
| 1397 |
} |
| 1398 |
} |
| 1399 |
proto.end(token); |
| 1400 |
} |
| 1401 |
|
| 1402 |
@Override |
| 1403 |
public boolean equals(@Nullable Object other) { |
| 1404 |
if (other == null || !(other instanceof ApplicationExitInfo)) { |
| 1405 |
return false; |
| 1406 |
} |
| 1407 |
ApplicationExitInfo o = (ApplicationExitInfo) other; |
| 1408 |
return mPid == o.mPid && mRealUid == o.mRealUid && mPackageUid == o.mPackageUid |
| 1409 |
&& mDefiningUid == o.mDefiningUid |
| 1410 |
&& mConnectionGroup == o.mConnectionGroup && mReason == o.mReason |
| 1411 |
&& mSubReason == o.mSubReason && mImportance == o.mImportance |
| 1412 |
&& mStatus == o.mStatus && mTimestamp == o.mTimestamp |
| 1413 |
&& mPss == o.mPss && mRss == o.mRss |
| 1414 |
&& TextUtils.equals(mProcessName, o.mProcessName) |
| 1415 |
&& TextUtils.equals(mDescription, o.mDescription); |
| 1416 |
} |
| 1417 |
|
| 1418 |
@Override |
| 1419 |
public int hashCode() { |
| 1420 |
int result = mPid; |
| 1421 |
result = 31 * result + mRealUid; |
| 1422 |
result = 31 * result + mPackageUid; |
| 1423 |
result = 31 * result + mDefiningUid; |
| 1424 |
result = 31 * result + mConnectionGroup; |
| 1425 |
result = 31 * result + mReason; |
| 1426 |
result = 31 * result + mSubReason; |
| 1427 |
result = 31 * result + mImportance; |
| 1428 |
result = 31 * result + mStatus; |
| 1429 |
result = 31 * result + (int) mPss; |
| 1430 |
result = 31 * result + (int) mRss; |
| 1431 |
result = 31 * result + Long.hashCode(mTimestamp); |
| 1432 |
result = 31 * result + Objects.hashCode(mProcessName); |
| 1433 |
result = 31 * result + Objects.hashCode(mDescription); |
| 1434 |
return result; |
| 1435 |
} |
| 1436 |
} |