• Peter Kotwicz's avatar
    Android: Include os.Handler stack for StrictMode violations · 13257563
    Peter Kotwicz authored
    If a strict mode violation occurs in an android.app.Service, the stack
    sent to StrictMode.OnThreadViolationListener#onThreadViolation() only
    includes stack frames which occurred in android.app.Service. Stack frames
    for the call into the android.app.Service are truncated.
    
    This is problematic when ignoring strict mode violations such as those
    from android.content.ContentResolver#setSyncAutomatically where the
    strict mode violation occurs inside the service called by
    ContentResolver#setSyncAutomatically().
    
    This CL switches to using Thread.currentThread().getStackTrace() to
    obtain the non-truncated stack trace on Android P+. The CL also switches
    to using reflection in order to get a callback for the strict mode
    violation on the thread which triggered the strict mode violation.
    
    BUG=1166997
    
    Change-Id: Iab68f1e849b59725082122f93a8a877c27a89717
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2637267
    Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
    Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
    Reviewed-by: default avatarHaiyang Pan <hypan@google.com>
    Cr-Commit-Position: refs/heads/master@{#845076}
    13257563
BUILD.gn 1.29 KB