Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[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 Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2019-04-29T14:30:52.000+0000
Affected Version/sRelease 7.2.1
Fix Version/sRelease 8.0.1
ComponentsAndroid
Labelsandroid, back, engSchedule, regression, window
ReporterJoshua Quick
AssigneeJoshua Quick
Created2019-04-06T05:05:18.000+0000
Updated2019-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();

Comments

  1. Joshua Quick 2019-04-12

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10829
  2. Lokesh Choudhary 2019-04-26

    FR Passed for master.
  3. Joshua Quick 2019-04-26

    PR (8.0.x): https://github.com/appcelerator/titanium_mobile/pull/10868
  4. Lokesh Choudhary 2019-04-26

    FR passed PR merged.
  5. Samir Mohammed 2019-04-29

    *Closing ticket*, fix verified in SDK version 8.0.1.v20190426162041 and SDK version 8.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

JSON Source