I wanted to look for methods how users can compare subjective “slowness” and benchmark their experience for others.
Android documentation has some acronyms for performance “vitals”, like “time to initial display” (TTID) for App startup, “time to full display” (TTFD) interaction time and “jank” for visible lag when rendering as in scrolling, see these two links:
- App startup time | Android Developers
- Slow rendering | Android Developers and “How Long does it take?” Just Systrace and Perfetto it
I created a list from the apps (and resolved the main activitiy where necessary) present on the default install launcher screen of /e/ upper left to bottom right. You can either grep logcat for the “Displayed” string to get timings, or provide activitymanager (am
) with the -W flag to get it in the loop. Get the appid via adb shell pm list packages
or by checking logcat while starting it via touch.
adb shell am start -W <appid/app-main-activity>
Script
The script puts screen lock time to a few minutes for the time of the test. It’s best to run it after a reboot for a baseline to compare to. If the Android Runtime / jvm already has lots of Apps running in the background and not yet evicted timings can differ.
#!/usr/bin/env bash
echo "# set screen power and screen lock times to 10 minutes #"
adb shell settings put secure lock_screen_lock_after_timeout 600000
adb shell settings put global screen_off_timeout 600000
activities='foundation.e.apps/foundation.e.apps.MainActivity
foundation.e.tasks/org.dmfs.tasks.TaskListActivity
com.android.documentsui/.files.FilesActivity
foundation.e.mail
com.android.settings
com.android.gallery3d
foundation.e.calendar
com.android.contacts
com.generalmagic.magicearth/com.generalmagic.android.map.MapActivity
org.lineageos.eleven
foundation.e.notes/.android.activity.NotesListViewActivity
com.android.calculator2/.Calculator
org.lineageos.recorder
com.android.deskclock
com.android.dialer
foundation.e.message/com.moez.QKSMS.feature.main.MainActivity
foundation.e.browser
foundation.e.camera'
for activity in $activities
do
echo "# $activity #"
adb shell am start -W "$activity" | tee -a benchmark.log
sleep 3
done
echo "# reset screen power and screen lock times #"
adb shell settings put secure lock_screen_lock_after_timeout 30000
adb shell settings put global screen_off_timeout 15000
Sample Ouput
LaunchState: COLD
Activity: foundation.e.browser/com.google.android.apps.chrome.Main
TotalTime: 690
WaitTime: 693
How to read results?
If it is a complex app that needs the network to update, look for TotalTime, as it outputs the TTFD moment after the initial display that also can just be a loading symbol. The TTFD is when the network info for a UI listing is complete and a user can really start to interact. That is the TotalTime or in logcat “Fully drawn” for the main activity.
Android vitals considers your app’s startup times excessive when the app’s:
- Cold startup takes 5 seconds or longer.
- Warm startup takes 2 seconds or longer.
- Hot startup takes 1.5 seconds or longer.