Skip to content
Commit 96a51f99 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Add "cmd window trace save-for-bugreport"

This CL reworks our previous CL [1], which enabled "adb bugreport" to
include wintrace tracing files into bugreport.

In the previous CL there was a side-effect that wintrace tracing files
are saved not only when "adb bugreport" is executed but also when the
following command is manually executed.

  adb shell dumpsys window --dump-priority CRITICAL --proto

This is because we used the combination of
  --dump-priority CRITICAL
and
  --proto
as a signal that it's coming from "adb bugreport", but strictly
speaking it's not necessarily true.

Instead of relying on such a heuristic, this CL introduces a claer and
dedicated command as follows.

  adb shell cmd window tracing save-for-bugreport

With this, we can let "adb bugreport" trigger the above command to
make the behavior more understandable and maintainable.  Note that
this command is no-op when winscope is not running.

See the corresponding CL for frameworks/native [2] about how it's
triggered from "adb bugreport".

Our main motivation of this consolidation is to use the same pattern
for IME tracing, where we accidentally introduced Bug 177462676 while
attempting to save IME tracing data while running "adb bugreport" [3].

 [1]: I102bc4afab5efff361633d75c09af1df4a11812e
      9e260468
 [2]: I8be9dee9aa36c2b085596d58e418f8613d874500
      95305b3ba7bf18bc7ed3a07c67f84b1c2f4586f4
 [3]: Ie87eb8423e2bb70f28c330983d45b95e2e07062d
      ac24994a

Bug: 177462676
Test: Manually done as follows.
  1. adb shell cmd window tracing start
  2. adb logcat -d -s WindowTracing:*
       Make sure wintrace is not yet running
  3. adb shell dumpsys window \
         --dump-priority CRITICAL --proto > /dev/null
  4. adb logcat -d -s WindowTracing:*
       Make sure wintrace has not been stopped.
  5. adb shell cmd window tracing save-for-bugreport
  6. adb logcat -d -s WindowTracing:*
       Make sure wintrace was stopped then restarted.
  7. adb root && adb shell ls /data/misc/wmtrace/ -al
       Make sure wintrace files are saved.
Test: Manually done as follows.
  1. adb logcat -d -s WindowTracing:*
       Make sure wintrace is not yet running
  2. adb logcat -d -s WindowTracing:*
       Make sure there is no additional message
  3. adb shell cmd window tracing start
  4. adb logcat -d -s WindowTracing:*
       Make sure wintrace is running
  5. adb bugreport bugreport.zip
  6. adb logcat -d -s WindowTracing:*
       Make sure wintrace stopped then restarted.
  7. unzip -v bugreport.zip | grep wm_trace.pb
       Make sure "wm_trace.pb" is included.
  8. unzip -v bugreport.zip | grep wm_log.pb
       Make sure "wm_log.pb" is included.
Change-Id: I887ae6941b4844a606675b447f67ecee88d7f192
parent 167dea12
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment