Skip to main content

Unlock the full potential of your Android TV with our comprehensive guide to essential shell commands and tips. Whether you’re a seasoned developer or a curious user, understanding the power of shell commands like ‘dumpsys’ can elevate your Android TV experience to new heights. In this series, we’ll delve into 4 tips accompanied by practical examples and insightful screenshots, providing you with the knowledge to optimize performance, troubleshoot issues, and customize your Android TV setup with confidence.

Join us as we uncover the secrets of the Android TV operating system and empower you to harness its full potential.


Monitor CPU and memory consumption (top)

There are many tools and apps to monitor CPU and memory consumption in your Android device.

✔ As a developer, Memory Profiler will be very useful to identify memory leaks in some component.
(https://bit.ly/3H7ibVs)

✔ As a tester, and in order to further triage an issue to better support your team, most of the times a simple tool is the most balanced approach (spent time by tester vs. investigation reward) and the one I recommend for testers to give that extra support.

So for a quick system activity analysis, you can use top command.
(https://bit.ly/3rRfQj6)

#adb #top #AndroidTV #STB #debugTips #imarote

📌 Example:
adb connect device_IP
adb shell
sabrina:/sdcard $ top -m 10 -d 30

Persistent processes

❓ Do you need to keep running all the time a dedicated process in your Android system?
If this is your case, check the next suggestion!

✔ There are key processes like the Bluetooth module, CAS plugins or a DRM component for the player, which needs to be alive always while your device is up.

✔ For these scenarios, you can’t just rely on the ActivityManager way of work (kill/restart processes depending on the system needs).
So, an option is to set to “true” the persistent flag in the declaration of your application.

android:persistent=["true" | "false"]
(https://bit.ly/3GRQ6p1)

🔔 Use this flag in a short number of processes and only if it is strictly necessary.
The less you alter the ActivityManager way of work, the better for the OS schedule.  

#adb #persistent #AndroidTV #STB #debugTips #imarote

📍 PS: this pic and the one used for previous example are taken from the console of a Chromecast Google TV 4K device.
Any curiosity or question, just leave your comment!


Dumpsys meminfo

In previous tips we showed a screenshot with the persistent processes running on the device.

❓Do you know which command was used to take it?

✔ “dumpsys meminfo” lists the memory distribution for all the apps.

#adb #dumpsys #meminfo #AndroidTV #STB #debugTips #imarote


📌 Example:
adb connect device_IP
adb shell
sabrina:/sdcard $ dumpsys meminfo


Secure Logcat acquisition

❓ How to secure the logs acquisition phase in your Android TV device?

✔ For developers and testers, we strongly recommend to run the logcat command inside the device console.
That way you will benefit of a stable acquisition during all your testing since the process is independent of the network connection (as difference if you run adb logcat from your PC console)

#adb #logcat #AndroidTV #STB #debugTips #imarote

📌 Example: use a writable path accessible as user, like /sdcard
1. Connect to the device and access to its shell
2. Move to /sdcard, prepare buffer and launch the logcat command
3. Do your testing (with "ls -la" you can track the evolution of the filesize)
4. Once finish the testing, stop the logcat process (check the PID) and pull the log file to your computer.

Leave a Reply