简体   繁体   中英

Check that homescreen is in foreground using shell or/and uiautomator

Maybe some value in dumpsys (had no success to find such)?

Or as kind of partial workaround check default launcher and then check that it's in foreground? But how to check what app is default launcher then?

Thanks

dumpsys activity activities or dumpsys activity recents will give you the recent activities, and if the home screen is in the foreground, then its associated launcher would show up under the entries in Recent #0 .

As for finding out the default launcher, you would need root access since the default app information is stored under /data/system/users/0/package-restrictions.xml ( source ), and the command would be:

cat package-restrictions.xml | grep -B6 "android.intent.category.HOME"

You have to look for the value:

<item name="ginlemon.flowerpro/ginlemon.flower.HomeScreen" match="100000" set="3">

Change B6 to a bigger value if you don't see <item name= .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM