fix(android): record simpleperf by package on user builds
Summary
Fixes #5156
On Android user builds, perf cpu profile start --kind simpleperf ran simpleperf record -p <pid>, which shell is not permitted to do for an app process. It now reads ro.build.type: user builds record with --app <package>; other builds keep -p <pid>. The profiling docs note that the app must be debuggable or profileable from shell.
Before / after
perf cpu profile start --kind simpleperf on a user build, device command:
- Before:
simpleperf record -e cpu-clock:u -p <pid> ...(the issue reportsPermission denied) - After:
simpleperf record -e cpu-clock:u --app <package> ...
Validation
Tested at b78a2c4b1:
vitest runonplatform-androidperf.test.tsandperf/runtime.test.ts: 22 passed. The newuserbuild case fails without the fix.oxlint,oxfmt --checkandtsc --noEmit: clean.
Unresolved risk: no live-device run. Start, stop, pull and report with a debuggable app on a user build are not verified. In AOSP simpleperf, --app mode opens the output file from the shell process and forwards SIGINT/SIGTERM to the in-app recorder, so the stop and pull steps are left unchanged.
AI assistance was used to prepare this change.
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.