I figured out how to do this.
I wrote a task to run the following command via "Run Shell" (assumes busybox has installed links to all its apps in /system/xbin) ...
/system/bin/dumpsys activity activities | /system/xbin/egrep mFocusedActivity | /system/xbin/tail -1 | /system/xbin/awk '{ print $4 }'
Its output is the id for the activity which is currently visible in the foreground. I store this in a variable called
%curractivityI then invoke "Launch App" to launch each app that I want to put into the background.
After this, I invoke "Go Home". This makes sure that all those launched apps go into the background.
Then, I invoke the following command via "Run Shell". This brings the originally visible activity back to the foreground.
/system/bin/am start -n %curractivity
There are some edge cases that need to be dealt with, but that's the general procedure.
.