{
"id": "173927",
"key": "TIMOB-27271",
"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": "20845",
"name": "Release 8.1.1",
"archived": false,
"released": true,
"releaseDate": "2019-08-29"
}
],
"resolution": {
"id": "1",
"description": "A fix for this issue is checked into the tree and tested.",
"name": "Fixed"
},
"resolutiondate": "2019-08-22T14:57:46.000+0000",
"created": "2019-07-23T01:40:33.000+0000",
"priority": {
"name": "Critical",
"id": "1"
},
"labels": [
"android",
"engSchedule",
"intent",
"intent-filter",
"resume"
],
"versions": [],
"issuelinks": [],
"assignee": {
"name": "jquick",
"key": "jquick",
"displayName": "Joshua Quick",
"active": true,
"timeZone": "America/Los_Angeles"
},
"updated": "2019-08-22T14:57:46.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\nResuming an app with an intent having {{FLAG_ACTIVITY_MULTIPLE_TASK}} set causes it to hang in Titanium 8.0.0 if the app does not immediately open a window via its \"newintent\" event.\r\n\r\nTitanium 7.x.x and older isn't much better. It won't hang on startup, but will instead create a new splash screen activity instance and do nothing.\r\n\r\n*Note:*\r\nThe Android OS will automatically add the {{FLAG_ACTIVITY_MULTIPLE_TASK}} to intents assigned the {{ACTION_SEND}} action. So, apps whose intent-filter do not handle \"intent-filter\" {{ACTION_SEND}} typically don't have to worry about this issue.\r\n\r\n*Steps to reproduce:*\r\n# Create a classic Titanium app.\r\n# Set project name to \"IntentTest\". _(This is {{}} in \"tiapp.xml\".)_\r\n# Set project's \"Application Id\" to \"com.appc.intent.test\". _(This is {{}} in \"tiapp.xml\".)_\r\n# Set up the \"app.js\" with the below code.\r\n# Build and run on Android.\r\n# Open the Mac \"Terminal\".\r\n# CD (change directory) to: {{~/Library/Android/sdk/platform-tools}}\r\n# In the terminal, enter the following...\r\n\r\n{code}\r\n./adb shell am start -n com.appc.intent.test/.IntenttestActivity -a android.intent.action.VIEW -d https://www.appcelerator.com -f 0x08000000\r\n{code}\r\n\r\napp.js\r\n{code:javascript}\r\nTi.Android.rootActivity.addEventListener(\"newintent\", function(e) {\r\n\tlabel.text = \"New Intent:\\n\" + JSON.stringify(e.intent, null, 4);\r\n\tTi.API.info(\"@@@ newintent: \" + JSON.stringify(e.intent));\r\n});\r\n\r\nvar window = Ti.UI.createWindow();\r\nvar scrollView = Ti.UI.createScrollView({\r\n\tscrollType: \"vertical\",\r\n\twidth: Ti.UI.FILL,\r\n\theight: Ti.UI.FILL,\r\n});\r\nvar label = Ti.UI.createLabel({\r\n\ttext: \"Launch Intent:\\n\" + JSON.stringify(Ti.Android.rootActivity.intent, null, 4),\r\n\twidth: Ti.UI.FILL,\r\n\theight: Ti.UI.SIZE,\r\n});\r\nscrollView.add(label);\r\nwindow.add(scrollView);\r\nwindow.open();\r\n{code}\r\n\r\n*Result:*\r\nIn Titanium 8.0.0 and higher, the app hangs. Also notice in the log that the \"newintent\" is being logged non-stop, meaning the \"newintent\" event is being fired repeatedly when it should only be fired once.\r\n\r\nIn Titanium versions older than 8.0.0, a new splash screen activity window is displayed, but nothing happens. Note that the app is not hung and you can back-out of the splash window, but this is still not good behavior.\r\n\r\n*Expected Result:*\r\nThe \"newintent\" event should only be fired once and not hang the app.\r\n\r\n*Work-around:*\r\nImmediately open a window when a \"newintent\" is received set with this flag.\r\n\r\nIf you don't want to open a window immediately, then you can instead quickly open/close a temporary window when this flag is set. Note that closing a window immediately as shown below prevents it from ever being shown, because Titanium destroys it via the activity's {{onCreate()}} method.\r\n{code:javascript}\r\nTi.Android.rootActivity.addEventListener(\"newintent\", function(e) {\r\n\t// This works-around the issue.\r\n\tif (e.intent.flags & Ti.Android.FLAG_ACTIVITY_MULTIPLE_TASK) {\r\n\t\tvar window = Ti.UI.createWindow();\r\n\t\twindow.open();\r\n\t\twindow.close();\r\n\t}\r\n});\r\n{code}\r\n\r\n_(I've tested the below on Android Q while target API Level 29. It works fine.)_\r\n",
"attachment": [],
"flagged": false,
"summary": "Android: Resuming with intent using \"FLAG_ACTIVITY_MULTIPLE_TASK\" can hang the app",
"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": 1157,
"state": "closed",
"name": "2019 Sprint 16",
"startDate": "2019-07-29T15:35:47.313Z",
"endDate": "2019-08-11T15:35:00.000Z",
"completeDate": "2019-08-12T07:57:02.552Z",
"originBoardId": 114
},
{
"id": 1160,
"state": "closed",
"name": "2019 Sprint 17",
"startDate": "2019-08-12T07:59:28.950Z",
"endDate": "2019-08-25T07:59:00.000Z",
"completeDate": "2019-08-26T15:35:29.980Z",
"originBoardId": 114
}
],
"comment": {
"comments": [
{
"id": "450019",
"author": {
"name": "jquick",
"key": "jquick",
"displayName": "Joshua Quick",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "My initial thought was to set the activity's \"android:documentLaunchMode\" attribute to \"never\", which according to Google's docs would make it ignore the {{FLAG_ACTIVITY_MULTIPLE_TASK}} intent flag.\r\nhttps://developer.android.com/guide/topics/manifest/activity-element#dlmode\r\n\r\nWhile this does work and makes it re-use the existing activity (instead of creating a duplicate activity instance), the negative consequence is that the activity is put into a \"singleTask\" like mode where the Android OS will automatically destroy all child activities when it is started via an intent. This is not a viable option for us. Most app devs don't want \"singleTask\" like behavior (and they can already opt-in to this behavior if they want anyways).",
"updateAuthor": {
"name": "jquick",
"key": "jquick",
"displayName": "Joshua Quick",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2019-07-23T22:57:45.000+0000",
"updated": "2019-07-23T22:57:45.000+0000"
},
{
"id": "450072",
"author": {
"name": "jquick",
"key": "jquick",
"displayName": "Joshua Quick",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/11080\r\nPR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/11081\r\n",
"updateAuthor": {
"name": "jquick",
"key": "jquick",
"displayName": "Joshua Quick",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2019-07-26T02:40:04.000+0000",
"updated": "2019-07-26T02:40:11.000+0000"
},
{
"id": "450144",
"author": {
"name": "kmahalingam",
"key": "kmahalingam",
"displayName": "Keerthi Mahalingam",
"active": false,
"timeZone": "America/Los_Angeles"
},
"body": "FR Passed. NO hanging when resuming app with an intent having FLAG_ACTIVITY_MULTIPLE_TASK. Works as Expected. Waiting for the 8.1.0 GA release to merge this PR\r\n",
"updateAuthor": {
"name": "kmahalingam",
"key": "kmahalingam",
"displayName": "Keerthi Mahalingam",
"active": false,
"timeZone": "America/Los_Angeles"
},
"created": "2019-07-29T23:08:24.000+0000",
"updated": "2019-07-29T23:08:24.000+0000"
},
{
"id": "450469",
"author": {
"name": "jquick",
"key": "jquick",
"displayName": "Joshua Quick",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "PR (8.3.x): https://github.com/appcelerator/titanium_mobile/pull/11145",
"updateAuthor": {
"name": "jquick",
"key": "jquick",
"displayName": "Joshua Quick",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2019-08-14T01:52:07.000+0000",
"updated": "2019-08-14T01:52:07.000+0000"
},
{
"id": "450623",
"author": {
"name": "cwilliams",
"key": "cwilliams",
"displayName": "Christopher Williams",
"active": true,
"timeZone": "America/New_York"
},
"body": "Merged to master, 8_3_X and 8_1_X",
"updateAuthor": {
"name": "cwilliams",
"key": "cwilliams",
"displayName": "Christopher Williams",
"active": true,
"timeZone": "America/New_York"
},
"created": "2019-08-20T17:00:57.000+0000",
"updated": "2019-08-20T17:00:57.000+0000"
},
{
"id": "450726",
"author": {
"name": "smohammed",
"key": "smohammed",
"displayName": "Samir Mohammed",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "*Closing ticket* fix verified in SDK version {{8.2.0.v20190820104021}}, {{8.1.1.v20190820143437}} and {{8.3.0.v20190820103430}}.\r\n\r\nTest and other information can be found at:\r\nPR (master): https://github.com/appcelerator/titanium_mobile/pull/11080\r\nPR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/11081\r\nPR (8.3.x): https://github.com/appcelerator/titanium_mobile/pull/11145",
"updateAuthor": {
"name": "smohammed",
"key": "smohammed",
"displayName": "Samir Mohammed",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2019-08-22T14:57:39.000+0000",
"updated": "2019-08-22T14:57:39.000+0000"
}
],
"maxResults": 7,
"total": 7,
"startAt": 0
}
}
}