{ "id": "172930", "key": "TIMOB-26778", "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": "20791", "name": "Release 8.0.2", "archived": false, "released": true, "releaseDate": "2019-06-18" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-05-23T20:14:30.000+0000", "created": "2019-01-29T23:57:50.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "activity", "android", "engSchedule", "manifest", "tiapp.xml" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-05-23T20:14:30.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": "*Summary:*\r\nTitanium generates an \"AndroidManifest.xml\" when building an Android app. By default, the root activity will be assigned the following \"android:configChanges\" settings:\r\n* keyboardHidden\r\n* orientation\r\n* fontScale\r\n* screenSize\r\n* smallestScreenSize\r\n* screenLayout\r\n* density\r\n\r\nBut if you override the root activity in the \"tiapp.xml\" without setting the \"android:configChanges\" yourself, then most of the above settings will be lost in the generated \"AndroidManifest.xml\". Only the below will be remaining.\r\n* screenSize\r\n* density\r\n\r\n*Why is this a problem:*\r\nBy default, the Android OS will destroy and recreate the window activity when a system event such as an \"orientation\" change occurs. Since \"android:configChanges\" such as \"orientation\" is lost in this case, rotating the app while its loading at the splash screen will cause the app to reload every time you change orientation.\r\n\r\nAlso note that app developers often do override the root activity in the \"tiapp.xml\" in order to set up their own custom intent-filters or to apply their own theme to the splash screen (such as a translucent status bar). So, this is a commonly done.\r\n\r\n*Steps to reproduce:*\r\n1. Create a Titanium app with project name \"MyApp\".\r\n2. Insert the below XML into your \"tiapp.xml\".\r\n3. Set up the \"app.js\" as shown below. It should be blank.\r\n4. Build and run the app.\r\n5. Verify the following gets logged on startup: {{MyApp 1.0 (Powered By Titanium ...)}}\r\n6. Rotate the app from portrait to landscape or vice-versa.\r\n7. Notice the {{MyApp 1.0 (Powered By Titanium ...)}} gets logged again. _(This means the app restarted. This is bad.)_\r\n8. Go to app project folder: {{./build/android}}\r\n9. Open the \"AndroidManifest.xml\" file.\r\n10. Look for an XML {{}} element with name \".MyappActivity\".\r\n11. Notice that the \"android:configChanges\" attribute only has settings {{\"screenSize|density\"}} defined. _(This is the issue.)_\r\n\r\napp.js\r\n{code:javascript}\r\n// Keep this file blank.\r\n{code}\r\n\r\ntiapp.xml\r\n{code:xml}\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n*Expected Result:*\r\nTitanium's default \"android:configChanges\" listed up above should always be included when overriding the root activity... *unless* the app developer sets the \"android:configChanges\" themselves, in which case we should honor the developer's settings.\r\n\r\n*Note:*\r\nThis used to be a bigger issue in Titanium 7.4.1 and below since the \"app.js\" would have been re-executed every time you change orientation on startup.\r\n\r\nIn 7.5.0 and above, Titanium loads \"ti.main.js\" instead which is lighter-weight and its call to {{require(\"app.js\")}} would have no-op'ed upon re-execution of \"ti.main.js\" since the \"app.js\" was already cached.\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: Default \"configChanges\" settings are lost when overriding root activity in \"tiapp.xml\"", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1136, "state": "closed", "name": "2019 Sprint 11", "startDate": "2019-05-18T17:39:52.830Z", "endDate": "2019-05-31T17:39:00.000Z", "completeDate": "2019-06-04T21:37:11.485Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "448315", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10884", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-05-11T04:52:28.000+0000", "updated": "2019-05-11T04:52:28.000+0000" }, { "id": "448496", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (8.0.x): https://github.com/appcelerator/titanium_mobile/pull/10900", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-05-18T00:15:52.000+0000", "updated": "2019-05-18T00:15:52.000+0000" }, { "id": "448566", "author": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "body": "FR passed. jenkin is failing test. waiting for resolving jenkin failure to merge", "updateAuthor": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-05-21T18:44:14.000+0000", "updated": "2019-05-21T18:44:14.000+0000" }, { "id": "448627", "author": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix on SDK 8.1.0.v20190523084559 and 8.0.2.v20190522031334. Works as expected.\r\n{code}\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.6\r\n Architecture = 64bit\r\n # CPUs = 8\r\n Memory = 17179869184\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 8.1.0.v20190523084559 and 8.0.2.v20190522031334\r\nCli =7.0.11\r\nStudio =5.1.2.201903111843\r\n{code}", "updateAuthor": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-05-23T20:14:20.000+0000", "updated": "2019-05-23T20:14:20.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }