{ "id": "100905", "key": "TIMOB-10863", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "14137", "description": "Release 2.1.3", "name": "Release 2.1.3", "archived": true, "released": true, "releaseDate": "2012-10-03" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" }, { "id": "14126", "description": "Sprint 2012-19 Core", "name": "Sprint 2012-19 Core", "archived": true, "released": true, "releaseDate": "2012-09-24" }, { "id": "14271", "description": "2012 Sprint 19", "name": "2012 Sprint 19", "archived": true, "released": true, "releaseDate": "2012-09-24" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-08-06T19:01:40.000+0000", "created": "2012-09-12T03:17:46.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "core", "module_orientation", "qe-testadded", "triage" ], "versions": [ { "id": "14096", "description": "Release 2.1.2", "name": "Release 2.1.2", "archived": true, "released": true, "releaseDate": "2012-08-31" } ], "issuelinks": [ { "id": "29284", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "115434", "key": "TIMOB-14110", "fields": { "summary": "Android: Application restarts when orientation changes and targetSdkVersion is 16 or higher", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "31323", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "118903", "key": "TIMOB-14935", "fields": { "summary": "Android: Application restarts on 'orientationChange' when applied holo theme on Modal windows", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "21785", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "102779", "key": "TIMOB-11284", "fields": { "summary": " iOS: Orientation - An 'undefined' exception during an application launch on iOS", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T23:52:36.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "If an app targets Android api level 13 (Honeycomb MR2, aka Android 3.2) or higher, the {{screenSize}} config change (which occurs when the orientation changes, for example) is not handled automatically by Android, and thus causes (by default) an activity restart (cf http://developer.android.com/reference/android/R.attr.html#configChanges). We don't accept activity restarts in Titanium and instead just restart the app (i.e., close all activities and restart the root activity). Traditionally we overcome the problem with orientation changes using the {{configChanges}} attribute's {{orientation}} value in our Activity entries in AndroidManifest.xml. But now {{screenSize}} also needs to be handled.\r\n\r\nSo if an app developer changes their tiapp.xml to add {{android:targetApiLevel=\"13\"}} (or higher) -- which is something they would do to get an ICS look-and-feel, for example, and will therefore occur more and more -- their app will restart (on 3.2 or higher devices) when the orientation changes because of the unhandled screenSize. So we need to add {{screenSize}} to the {{configChanges}} in AndroidManifest.xml Activity entries. However, it's not that easy: to do that, we need be sure to also build against api 13 or higher, since building against an older version will cause aapt to fail if {{screenSize}} is in there; this fails the application build. So a somewhat clever solution is required.\r\n\r\nh3. Fail Case / Test Case\r\n\r\n\r\n* Create a Titanium mobile app.\r\n\r\n* Change its tiapp.xml so that the section looks like this:\r\n\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n* Replace the app.js with this:\r\n\r\n{code:title=\"app.js\"}\r\nvar win = Titanium.UI.createWindow({ \r\n title:'Root Window',\r\n backgroundColor:'#fff',\r\n\texitOnClose: true\r\n}),\r\nbtn = Ti.UI.createButton({\r\n\ttitle: \"Open Heavyweight Window\",\r\n\tleft: \"16dp\", right: \"16dp\", height: \"48dp\",\r\n\tbottom: \"16dp\"\r\n});\r\n\r\nwin.add(Ti.UI.createLabel({\r\n\ttext: \"This is the root window\",\r\n\tcolor: \"#000\",\r\n\theight: \"48dp\"\r\n}));\r\n\r\nwin.add(btn);\r\n\r\nbtn.on(\"click\", function() {\r\n\tvar w = Ti.UI.createWindow({\r\n\t\tbackgroundColor: \"#f00\",\r\n\t\ttitle: \"New Activity\",\r\n\t\tfullscreen: false\r\n\t});\r\n\tw.add(Ti.UI.createLabel({\r\n\t\ttext: \"This is a new Activity\",\r\n\t\theight: \"48dp\",\r\n\t\tcolor: \"#fff\"\r\n\t}));\r\n\tw.open();\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\n* Run the app on 3.2 or higher device.\r\n\r\n* After the app loads, click the \"Open Heavyweight Window\" button.\r\n\r\n* After the red window opens, turn the device to a different orientation (i.e., from portrait to landscape or vice-versa).\r\n\r\n* In the fail case, the app will actually close completely and re-open back at the first (white, not red) window. When testing the fix, the app should not close and the red window should still be showing.\r\n\r\n* Also build and run the app on a pre-3.2 device (a 2.3 phone, for example) to be sure nothing is broken for older versions of android.", "attachment": [], "flagged": false, "summary": "Android: Application restarts when orientation changes and targetSdkVersion is 13 or higher", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium 2.1.2, Titanium Studio version is irrelevant, Desktop OS is irrelevant, Android device/emulator with Android 3.2 or higher.", "comment": { "comments": [ { "id": "219097", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Backport PR https://github.com/appcelerator/titanium_mobile/pull/2960", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-14T15:58:13.000+0000", "updated": "2012-09-14T15:58:13.000+0000" }, { "id": "219225", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Application does not close on orientation change\r\nVerified on:\r\nTitanium Studio: 2.1.2.201208301612\r\nTitanium SDK: 2.1.3.v20120915120319\r\nAndroid Device: LGP970 (v2.2.2), Samsung Note (v2.3.6), Samsung Galaxy Tab (v3.2), Galaxy Nexus (v4.0.2)", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-17T02:12:35.000+0000", "updated": "2012-09-17T02:12:35.000+0000" }, { "id": "255753", "author": { "name": "mano.mykingdom", "key": "mano.mykingdom", "displayName": "Manoj Kumar", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I'm facing same issue with Titanium SDK 3.1.0 GA with following on tiapp.xml. Target SDK version on 16 - application restarts on orientation changed.\r\n\r\n\r\n\r\n 8\r\n \r\n \r\n \r\n \r\n ", "updateAuthor": { "name": "mano.mykingdom", "key": "mano.mykingdom", "displayName": "Manoj Kumar", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-06-04T05:36:44.000+0000", "updated": "2013-06-04T05:36:44.000+0000" }, { "id": "255754", "author": { "name": "mano.mykingdom", "key": "mano.mykingdom", "displayName": "Manoj Kumar", "active": true, "timeZone": "Asia/Kolkata" }, "body": "The above issue i mentioned is tested with HTC ONE S - Android 4.1.1", "updateAuthor": { "name": "mano.mykingdom", "key": "mano.mykingdom", "displayName": "Manoj Kumar", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-06-04T05:39:00.000+0000", "updated": "2013-06-04T05:39:00.000+0000" }, { "id": "258565", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "11\r\n\r\n\r\n\r\nSDK 3.1.1, Application is restarting, too", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-06-19T17:49:23.000+0000", "updated": "2013-06-19T17:49:23.000+0000" }, { "id": "264892", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Still restarts in 3.1.2 RC1\r\n\r\ntiapp.xml\r\n{noformat} \r\n\r\n 8\r\n \r\n \r\n \r\n \r\n\r\n{noformat} \r\n\r\nand\r\n\r\n{noformat}\r\n\r\n 11\r\n \r\n \r\n \r\n \r\n{noformat}\r\n\r\nwill show the white window again after rotating the example app in the description", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-08-03T13:36:01.000+0000", "updated": "2013-08-05T17:12:43.000+0000" }, { "id": "265165", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-08-06T19:00:18.000+0000", "updated": "2013-08-06T19:01:07.000+0000" }, { "id": "265169", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "nice, thank you! That worked", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-08-06T19:31:47.000+0000", "updated": "2013-08-06T19:31:47.000+0000" }, { "id": "414685", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T23:52:36.000+0000", "updated": "2017-03-21T23:52:36.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }