[TIMOB-26966] Android: Back navigating from child window causes app to exit when "Don't keep activities" is enabled as of 7.2.1
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-04-29T14:30:52.000+0000 |
Affected Version/s | Release 7.2.1 |
Fix Version/s | Release 8.0.1 |
Components | Android |
Labels | android, back, engSchedule, regression, window |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2019-04-06T05:05:18.000+0000 |
Updated | 2019-04-29T14:30:52.000+0000 |
Description
*Summary:*
If Android "Developer Options" setting "Don't keep activities" is enabled, then tapping the Android "Back" button on a child window exits the app instead of back navigating to the parent window.
This regression was introduced as of 7.2.1 due to our memory leak fixes.
*Steps to reproduce:*
Go to the Android device's main "Settings" screen.
Tap on "System" under "Settings.
Tap on "Developer options" under "System" settings.
Enable "Don't keep activities", which should be near the bottom of the list.
Build and run the below code on the above Android device.
Tap on the "Open Child Window" button.
Tap on the Android "Back" button.
Notice the app exits instead of showing the parent window.
function addActivityListenersTo(activity, name) {
if (!activity) {
return;
}
if (!name) {
name = "Activity";
}
activity.onCreate = function() {
Ti.API.info("@@@ " + name + ".onCreate() called.");
};
activity.onRestart = function() {
Ti.API.info("@@@ " + name + ".onRestart() called.");
};
activity.onStart = function() {
Ti.API.info("@@@ " + name + ".onStart() called.");
};
activity.onResume = function() {
Ti.API.info("@@@ " + name + ".onResume() called.");
};
activity.onPause = function() {
Ti.API.info("@@@ " + name + ".onPause() called.");
};
activity.onStop = function() {
Ti.API.info("@@@ " + name + ".onStop() called.");
};
activity.onDestroy = function() {
Ti.API.info("@@@ " + name + ".onDestroy() called.");
};
}
addActivityListenersTo(Ti.Android.currentActivity, "SplashActivity");
var window = Ti.UI.createWindow();
window.add(Ti.UI.createLabel({ text: "Activity Callback Test" }));
var openButton = Ti.UI.createButton({
title: "Open Child",
bottom: "20%",
});
openButton.addEventListener("click", function() {
var childWindow = Ti.UI.createWindow();
childWindow.add(Ti.UI.createLabel({ text: "Child Window" }));
addActivityListenersTo(childWindow.activity, "ChildActivity");
childWindow.addEventListener("open", function() {
Ti.API.info("@@@ Child window 'open' event fired.");
});
childWindow.open();
});
window.add(openButton);
window.addEventListener("open", function(e) {
Ti.API.info("@@@ Window 'open' event fired.");
});
addActivityListenersTo(window.activity, "ParentActivity");
window.open();
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10829
FR Passed for master.
PR (8.0.x): https://github.com/appcelerator/titanium_mobile/pull/10868
FR passed PR merged.
*Closing ticket*, fix verified in SDK version
8.0.1.v20190426162041
and SDK version8.1.0.v20190426222341
Test and other information can be found at: Master : https://github.com/appcelerator/titanium_mobile/pull/10829 8_0_X: https://github.com/appcelerator/titanium_mobile/pull/10868