fix(android): prevent BaseActivity to stay with exitOnClose:false #14159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #13889
A better attempt to fix the isse where the splashscreens stays open when you close two windows quickly and the root window has
exitOnClose:false
.The
TiActivityWindows.getWindowCount()
check is already used in TiBaseActivity to check if the app should be put into the background (search foronBackPressed: suspend to background
). In this case we actually need to finish it otherwise it will be in a non resumable state.12.6.0
Bildschirmaufnahme_20241219_095358.webm
this PR
Bildschirmaufnahme_20241219_095239.webm
Different approach:
The Back button event is already fired before the first "remove from stack" is finished and that is why it still has 2 windows instead of 1 and runs another "remove from stack" instead of putting it to the background.
I can also block the "back event" until https://github.com/tidev/titanium-sdk/blob/master/android/titanium/src/java/org/appcelerator/titanium/TiBaseActivity.java#L1662 is done and then enable it again. This will stay at the green window when you close both quickly.
Bildschirmaufnahme_20241218_221941.webm
But to me it looks more like a bug if I want to close two windows quickly I want to be closed and not stop at the parent window.
@prashantsaini1: would love to get your feedback on this approach