Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27177] Android: Closing root window from child causes app exit issues as of 8.0.1

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2019-08-22T14:26:56.000+0000
Affected Version/sRelease 8.0.1
Fix Version/sRelease 8.1.1
ComponentsAndroid
Labelsandroid, close, engSchedule, exitonclose, regression, window
ReporterJoshua Quick
AssigneeJoshua Quick
Created2019-06-21T01:25:14.000+0000
Updated2019-08-22T14:26:56.000+0000

Description

*Summary:* As of Titanium 8.0.1, there is a regression where the app exit behavior has changed after closing the root window from a child window. After closing the root window... * Closing the immediate child window will home-out instead of exiting the app. * Opening another child window and then closing it will cause an app exit instead of displaying the parent window. *Steps to reproduce:*

Build and run the below code on Android.

Tap on the "Open" button in Window 1. _(Will close Window 1 after opening Window 2.)_

Tap on the "Open" button in Window 2.

Tap on the "Close" button in Window 3.

Notice the app exits. _(This is a bug. Should close Window 3 and display Window 2.)_

Relaunch the app.

Tap on the "Open" button in Window 1.

Tap on Android's Back button in Window 2.

Relaunch the app.

Notice the splash screen was *NOT* shown. _(This is a bug. App did not exit when pressing back button when it should have.)_

var window1 = Ti.UI.createWindow({
	title: "Window 1",
	backgroundColor: "white",
});
var openButton = Ti.UI.createButton({
	title: "Open",
});
openButton.addEventListener("click", function() {
	var window2 = Ti.UI.createWindow({
		title: "Window 2",
		backgroundColor: "white",
	});
	var openButton = Ti.UI.createButton({
		title: "Open",
	});
	openButton.addEventListener("click", function() {
		var window3 = Ti.UI.createWindow({
			title: "Window 3",
			backgroundColor: "white",
		});
		var closeButton = Ti.UI.createButton({
			title: "Close",
		});
		closeButton.addEventListener("click", function() {
			window3.close();
		});
		window3.add(closeButton);
		window3.open();
	});
	window2.add(openButton);
	window2.open();
	window1.close();
});
window1.add(openButton);
window1.open();
*Work-around:* Do not close the root window immediately after opening the child window. Instead, close the root window via the child window's "close" listener.

Comments

  1. Joshua Quick 2019-06-21

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10988
  2. Joshua Quick 2019-07-30

    PR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/11093
  3. Keerthi Mahalingam 2019-07-30

    FR passed. Waiting for for 8.1.0.GA release to merge PR
  4. Joshua Quick 2019-08-14

    PR (8.3.x): https://github.com/appcelerator/titanium_mobile/pull/11144
  5. Christopher Williams 2019-08-20

    Merged to master, 8_3_X and 8_1_X.
  6. Samir Mohammed 2019-08-22

    *Closing ticket* fix verified in SDK version 8.2.0.v20190820104021, 8.1.1.v20190820143437 and 8.3.0.v20190820103430. Test and other information can be found at: PR (master): https://github.com/appcelerator/titanium_mobile/pull/10988 PR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/11093 PR (8.3.x): https://github.com/appcelerator/titanium_mobile/pull/11144

JSON Source