applications
Returns all applications and their foreground state using the am stack list command.
am: The activity manager stack: The application stack list: List of all applications in the stack
Key = Package (String) Value = Foreground (Boolean)
Return
Map of all packages and their foreground state
Parameters
ui Automation
The automation instance used for automated testing