In my current android application, there are two activities.Parent activity launches the child activity.In this application, the child activity can also be run as standalone but it doesn't include the complete feature set. I am currently developing for AndroidTV. I verified by using adb shell dumpsys activity activities that when I run the standalone child activity application, then: 1.While in Non Restricted Profile/Normal Mode : Stack trace shows the child activity as top most activity on launch, as expected. 2.When I enter Restricted Profile Mode : Stack trace shows another instance of the child activity as top most activity and the older child activity is present but has moved below in the stack, as expected. 3.On Exiting Restricted Profile Mode and relaunching app, it launches back the older instance of child activity as expected. I verified in DDMS that it shows both the processes once I have entered Restricted profile i.e it doesn't kill the older child activity.
The issue is when I run the complete application consisting of the parent(P) and child(C) application. 1.When I run the application in Non Restricted/Normal Mode : Stack Trace shows C at top, followed by P which is as expected. 2.But when I enter Restricted Profile Mode, instead of moving the older activities below in the back stack, it removes them from the stack completely! I understand that this is possible as Android OS can remove processes from stack in case of memory issues.But shouldn't also bring them back on stack when required ? Because of this, whenever I exit Restricted Profile and relaunch again, it somehow manages to get the older child activity but the older parent activity is not present and this leads to a blank screen.