1#!/usr/bin/env bash 2 3set -ex 4 5# Build, push and run layertracegenerator 6$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode layertracegenerator 7adb wait-for-device && adb push $OUT/system/bin/layertracegenerator /data/layertracegenerator 8 9if [ -z "$1" ] 10 then 11 echo "Writing transaction trace to file" 12 adb shell service call SurfaceFlinger 1041 i32 0 13 adb shell /data/layertracegenerator 14 else 15 echo "Pushing transaction trace to device" 16 adb push $1 /data/transaction_trace.winscope 17 adb shell /data/layertracegenerator /data/transaction_trace.winscope 18fi 19adb pull /data/misc/wmtrace/layers_trace.winscope