I'm trying to write a UI Automation test and I'm trying to speed it up. At one point of the test, I need to close all recent apps on a device. I can do this via UiAutomator (currently doing it that way) but this isnt the part of the test I'm focusing on so I was wondering if this is doable via an intent call?
Based on the file structure, I would prefer not to add new classes, change activity code (b/c only needed for testing), or change permissions too badly.
I want to doing something along the line of:
Intent closeIntent = new Intent(context, null);
closeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(closeIntent);
Android isnt okay with the null class parameter.
I've looked at the following but none of them are what I really want:
Finish all activities at a time
Intent data not clearing when user presses back button then recent apps button
https://gist.github.com/anonymous/9884978
Thanks in advance!