You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we configure androidTest to not keep activities and background/resume?
Note, this may not be possible / technically feasible. A quick exploratory attempt to configure an emulator programmatically (via adb?) to not keep activities is a first step. Then a load of one activity and background / resume cycle of that activity is a second step to see if it is even possible.
Would be an interesting way to surface these sorts of errors that happen semi-frequently where assumptions are made about activity (and now fragment) lifecycle in the face of need to re-construct activity
We have an "all activity load" type test that was meant to check for layout inflation issues, maybe that could be extended to not just load+inflate but also background the app while don't-keep-activities was set then foreground it again
@lukstbit there is a way to do this programmatically, and it works on a real device apparently, but there is an upstream bug blocking it from taking effect (despite UI changing...) if you do it via adb:
adb shell settings put global always_finish_activities 1
So it appears the only way to do this currently is to have a pre-test routine that opens settings and toggles it
adb shell settings put global development_settings_enabled 1
search for list item Don't Keep Activities and toggle it on
It does seem possible, and while it would be nice if these sorts of Activity lifecycle problems became fewer over the time, that hasn't been my experience. It seems that nearly every release turns some up
4+ years with that bug open doesn't sound too good...
We could use the UIAutomator to get around the bug and implement this. I played around a bit and did a test where DeckPicker is started put in the background and then again brought back. I made a gist for anyone interested. These tests would take quite some time to run from what I saw.
Can we configure androidTest to not keep activities and background/resume?
Note, this may not be possible / technically feasible. A quick exploratory attempt to configure an emulator programmatically (via adb?) to not keep activities is a first step. Then a load of one activity and background / resume cycle of that activity is a second step to see if it is even possible.
Would be an interesting way to surface these sorts of errors that happen semi-frequently where assumptions are made about activity (and now fragment) lifecycle in the face of need to re-construct activity
We have an "all activity load" type test that was meant to check for layout inflation issues, maybe that could be extended to not just load+inflate but also background the app while don't-keep-activities was set then foreground it again
Originally posted by @mikehardy in #17407 (comment)
The text was updated successfully, but these errors were encountered: