From android guide Tasks and Back Stack:
Clearing the back stack
If the user leaves a task for a long time, the system clears the task of all activities except the root activity. When the user returns to the task again, only the root activity is restored.
how can I simulate this with adb
command?
I guess it is not exactly as killing the app (like calling: adb shell am kill < package name >
)
Thanks.
If the user leaves a task for a long time, the system clears the task of all activities except the root activity.
So, this is exact same behavior, when system needs to allocate resources but it has no free RAM, and therefore it starts killing processes for gaining memory. To simulate that you can perform this command:
adb shell am send-trim-memory com.your.package MODERATE