🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.mobile.android
Article #546

Re: How can we accurately easily ID the most recent package that was run?

#546
From: Maria Sophia
Date: Sat, 07 Nov 2026 18:26
35 lines
3996 bytes
Maria Sophia wrote:
> Q: What's an easy yet accurate way to determine the most recent package?
> A: ?

Woo hoo. 

I found a great way to find the last program run.
 adb shell dumpsys usagestats | grep "ACTIVITY_RESUMED" | grep -vE "dreams\.basic|launcher|systemui|launcher3|wallpaper" | tail -1 | grep -oE "package=[^ ]+"
  => package=org.schabi.newpipe

Note: 
 where grep
  => C:\Program Files\coreutils\bin\grep.exe

 where tail
  => C:\Program Files\coreutils\bin\tail.exe

Changing that only a teeny tiny bit, nets us the last Activity run!
 adb shell dumpsys usagestats | grep "ACTIVITY_RESUMED" | grep -vE "dreams\.basic|launcher|systemui|launcher3|wallpaper" | tail -1 | grep -oE "class=[^ ]+"
  => class=org.schabi.newpipe.MainActivity

Note that I had to filter out sleep screens & launcher stuff
as this gets the last activity run, but since it's a sleep screen, 
we need to filter out common stuff we're not interested in.

adb shell dumpsys usagestats | grep "ACTIVITY_RESUMED" | tail -1
    time="2026-11-07 10:00:07" type=ACTIVITY_RESUMED package=com.android.dreams.basic class=android.service.dreams.DreamActivity instanceId=113775963 taskRootPackage=com.android.dreams.basic taskRootClass=android.service.dreams.DreamActivity flags=0x0

Diving down into the previous five activities, we find NewPipe was run.
adb shell dumpsys usagestats | grep "ACTIVITY_RESUMED" | tail -5
    time="2026-11-07 10:00:07" type=ACTIVITY_RESUMED package=com.android.dreams.basic class=android.service.dreams.DreamActivity instanceId=113775963 taskRootPackage=com.android.dreams.basic taskRootClass=android.service.dreams.DreamActivity flags=0x0
    time="2026-11-07 10:00:07" type=ACTIVITY_RESUMED package=com.android.dreams.basic class=android.service.dreams.DreamActivity instanceId=113775963 taskRootPackage=com.android.dreams.basic taskRootClass=android.service.dreams.DreamActivity flags=0x0
    time="2026-11-07 10:13:03" type=ACTIVITY_RESUMED package=com.teslacoilsw.launcher class=com.teslacoilsw.launcher.NovaLauncher instanceId=22358917 taskRootPackage=com.teslacoilsw.launcher taskRootClass=com.teslacoilsw.launcher.NovaLauncher flags=0x0
    time="2026-11-07 10:13:04" type=ACTIVITY_RESUMED package=com.teslacoilsw.launcher class=com.teslacoilsw.launcher.NovaLauncher instanceId=22358917 taskRootPackage=com.teslacoilsw.launcher taskRootClass=com.teslacoilsw.launcher.NovaLauncher flags=0x0
    time="2026-11-07 10:13:09" type=ACTIVITY_RESUMED package=org.schabi.newpipe class=org.schabi.newpipe.MainActivity instanceId=1104153 taskRootPackage=org.schabi.newpipe taskRootClass=org.schabi.newpipe.MainActivity flags=0x0
Technical Details
Message-ID: <11cnqh3$c97$1@nnrp.usenet.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED.public-nat-02.vpngate.v4.open.ad.jp!not-for-mail
References: <11ce4h3$2lve$1@nnrp.usenet.blueworldhosting.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED.public-nat-02.vpngate.v4.open.ad.jp!not-for-mail
From: Maria Sophia <mariasophia@comprehension.com>
Newsgroups: comp.mobile.android
Subject: Re: How can we accurately easily ID the most recent package that was run?
Date: Sat, 7 Nov 2026 14:26:44 -0400
Organization: BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID: <11cnqh3$c97$1@nnrp.usenet.blueworldhosting.com>
References: <11ce4h3$2lve$1@nnrp.usenet.blueworldhosting.com>
Reply-To: pusvul@getTjewytR4so+mqe2.invalid
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 7 Nov 2026 18:26:44 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com; posting-account="l//KxG3Ge2LojWvwJg0Igv8F0ChK8RUC9RtOxMPUo3U"; posting-host="IfCZz72xNNlHXBkfV9B6WJEa9xVhaehMJfhAC6fCwnM";
	logging-data="12583"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Mojibake 1p3
Cancel-Lock: sha1:o/w1CvJa1MSnFcdmfA740DBebf8= sha256:N8+PS5woafw+JtzKc01A/2WQXkXUFnpkVjCIoOr47HM=
	sha1:PysSnIItCan9ffNGp3L4uNIDw1s= sha256:PaXuAxj2wZcsH0GWRsx7kYa66AHv5dSuW7lSJcNUX40=
Content-Language: en-GB