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

    From Maria Sophia@mariasophia@comprehension.com to comp.mobile.android on Tue Nov 3 22:16:04 2026
    From Newsgroup: comp.mobile.android

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

    In a recent thread, someone asked for a feature that is common with most,
    but not with all software information device checkers, but since all the
    device checkers are infrequently run and they are all very similar in look
    and feel (even down to the names and launch icons), the question arose what
    the actual unique package name of the app that was just run, happens to be.

    1. Test a series of package managers (most with similar icons & names)
    2. When one has a successful run (e.g., saves the file)... then...
    3. Instantly capture the unique name of that last package that was run

    But how?

    Q: What's an easy yet accurate way to determine the most recent package?
    A: ?
    --
    We should strive to ask questions whose answers add to our knowledge.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Maria Sophia@mariasophia@comprehension.com to comp.mobile.android on Sat Nov 7 14:26:44 2026
    From Newsgroup: comp.mobile.android

    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
    --- Synchronet 3.22a-Linux NewsLink 1.2