googlecodelabs / android-perf-testing

Automated Performance Testing on Android
https://codelabs.developers.google.com/codelabs/android-perf-testing/
Apache License 2.0
93 stars 39 forks source link

EnablePostTestDumpsys rule not working #27

Open marcosholgado opened 7 years ago

marcosholgado commented 7 years ago

I have completed the codelab and everything is fine except from the EnablePostTestDumpsys rule. Every time it gets executed the output is a blank file. I have tried with different phones (Nexus 5X, Samsung S7...) using Android N and HTC using Marshmallow but I haven't been able to get anything different.

Running the command line is fine (adb shell dumpsys gfxinfo com.google.android.perftesting framestat) but it doesn't work when running the LocalPerfTests tasks.

However if I use an emulator everything works fine and I get some data.

Any ideas?

argo49 commented 7 years ago

I also get a blank file and noticed this error:

Permission Denial: can't dump gfxinfo from from pid=20594, uid=10086 without permission android.permission.DUMP

When trying to add the DUMP permission to the android manifest, I found this:

"Permissions with the protection level signature or signatureOrSystem are only granted to system app. If an app is a regular non-system app, it will never be able to use these permissions."

+1 for a solution to this that doesn't require rooting the phone and installing the app as a system app

arsent commented 5 years ago

There is no solution to this with the current architecture, as Android doesn't allow access to DUMP permission for third-party apps. There is an alternative though - FrameMetrics