{ "id": "63622", "key": "TIMOB-2990", "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": "11241", "name": "Release 1.6.0 M08", "archived": true, "released": true, "releaseDate": "2011-02-07" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:00:37.000+0000", "created": "2011-04-15T03:34:15.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "activity", "android", "defect", "lifecycle", "release-1.6.0", "reported-1.6.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T02:00:37.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": "{html}

Our current activity lifecycle events aren't being fired for\nactivities created from a heavy weight Ti.UI.Window. JS Activities\nseem to work because their lifecycle seems to be the right order,\nspecifically:

\n
\n\n// pseudo code\npublic void onCreate() {\n  createLayout();\n  initCurrentActivity(this);\n  runScript();\n  fireEvent(\"create\");\n}\n
\n

The heavy weight window lifecycle however looks more like:

\n
\n\n// pseudo code\npublic TiUIWindow() {\n  startActivity();\n}\npublic void onActivityCreated() {\n  // script isn't even executed until after onCreate()\n  initCurrentActivity(this);\n  runScript();\n}\n
\n

This is affecting a lot of our new sensor and sound API\nrefactors that depend on pause/resume to work for correct\nadd/remove event listener behavior.

{html}", "attachment": [], "flagged": false, "summary": "Android: Window / Activity lifecycle events don't fire", "creator": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "129808", "author": { "name": "martijn189", "key": "martijn189", "displayName": "martijn189", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Is this really fixed?, i downloaded the Continuous Build of Feb\n2 2011 15:24 ra02f7db3 but i still have this issue. what does\n\"Release 1.6.0 M08\" mean?

{html}", "updateAuthor": { "name": "martijn189", "key": "martijn189", "displayName": "martijn189", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:16.000+0000", "updated": "2011-04-15T03:34:16.000+0000" }, { "id": "129809", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [43ae52cacc38f22b4efa292d5ef27272560125ad])\ninitial refactor of TiRootActivity as a TiBaseActivity, implement\nbetter activity lifecycle support for all TiBaseActivities\n[#2990]
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/43ae52cacc38...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:16.000+0000", "updated": "2011-04-15T03:34:16.000+0000" }, { "id": "129810", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [89ac3987ed38a4896f6147f4f416ccb4632f8332])\nTiJSActivity and TiRootActivity now subclass a common\nTiLaunchActivity. \"launch\" activities have the distinction of being\nentry points into the application either via standard user launch,\nor from some other Intent. implemented a small internal message\nqueue for launch activities so window.open() doesn't block the\nactivity. Activities event listeners should now always receive\ntheir lifecycle events synchronously: create, restart, start,\nresume, pause, stop, destroy. [#2990\nstate:fixed-in-qa] \nhttps://github.com/appcelerator/titanium_mobile/commit/89ac3987ed38...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:16.000+0000", "updated": "2011-04-15T03:34:16.000+0000" }, { "id": "129811", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [76647275afd7304f48ea8535b55a3db9e1e1f666])\nmoved all async / blocking callbacks to a new message queue\nimplementation that allows single loop iteration and provides\nbetter \"dispatch while blocking\" behavior, fixing the vast majority\nof our deadlock issues. Kitchensink is now running mostly well on\ntop of these changes. Changed setTimeout/setInterval to use handler\nmessages instead of timer threads for better consistency. Added an\nintermediary TiActivityWindows class between launched internal\nactivities and TiUIWindow for better inline notification and\nreaction to Activity onCreate(). fixed the weird activity indicator\nas widget code in kitchensink for Android. [#2990]\n[#2924] \nhttps://github.com/appcelerator/titanium_mobile/commit/76647275afd7...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:17.000+0000", "updated": "2011-04-15T03:34:17.000+0000" }, { "id": "129812", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [7996c46a2312321e35135cdc403e0ff87eafb62a])\nseveral fixes for the new lifecycle support / message queue: async\nevents are now fired only using Handler, as it's safe (and\nexpected) for them to fire after the script is finished loading.\nTiVideoActivity now uses one less thread and doesn't block when\nit's handling creation arguments. new Handler based timers are now\ncancelling correctly, and activity indicators no longer use two\nseparate async messages for displaying (only one is needed to sync\nw/ main thread). fixed a bug where changing the title of a\nTiUIWindow always changed it for the previous window. [#2990]\n\nhttps://github.com/appcelerator/titanium_mobile/commit/7996c46a2312...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:17.000+0000", "updated": "2011-04-15T03:34:17.000+0000" }, { "id": "129813", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [2649bb83a437f122f97c4e96671ece9b04abfae0])\nretrieve the activity's current proxy if it was already created\nbefore querying a non-Activity window. [#2990]\n\nhttps://github.com/appcelerator/titanium_mobile/commit/2649bb83a437...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:18.000+0000", "updated": "2011-04-15T03:34:18.000+0000" }, { "id": "129814", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This was my test case, it has instructions in the label

\n
\n\nvar win = Ti.UI.createWindow({\n    backgroundColor: \"white\",\n    layout: \"vertical\"\n});\nvar activity = Ti.Android.currentActivity;\n\nvar instructions = Ti.UI.createLabel({\n    text: \"initial launch should fire create, start, resume\\npressing \\\"home\\\" should fire pause, stop\\nrelaunching should fire restart, start, resume. pressing \\\"back\\\" should fire pause, stop, destroy\\ncheck log for destroy event\"\n});\nwin.add(instructions);\n\nvar events = [\"create\", \"restart\", \"start\", \"resume\", \"pause\", \"stop\", \"destroy\"];\nvar rows = {};\nvar data = [];\nevents.forEach(function(event) {\n    if (event != \"destroy\") {\n        // we won't be able to see destroy events in UI, check the log\n        rows[event] = Ti.UI.createTableViewRow({\n            title: event + \" fired : false\",\n            color: \"red\",\n            font: { fontSize: 16 }\n        });\n        data.push(rows[event]);\n    }\n    Ti.API.debug(\"adding activity \" + event + \" listener\");\n    activity.addEventListener(event, function(e) {\n        Ti.API.debug(\"[LH-2990] event fired: \" + event);\n        if (event != \"destroy\") {\n            rows[event].color = \"green\";\n            rows[event].title = event + \" fired: true\"\n        }\n    });\n});\n\nvar table = Ti.UI.createTableView({\n    data: data,\n    top: 5, bottom: 0, left: 0, right: 0\n});\nwin.add(table);\n\nwin.open();\n
{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:18.000+0000", "updated": "2011-04-15T03:34:18.000+0000" }, { "id": "129815", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

[INFO] Titanium SDK version: 1.6.0 (02/08/11\n20:55 bd9d124...) galaxy tab (2.2.2) G1 (1.6) Nexus S (2.3) sim\n2.1

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:34:18.000+0000", "updated": "2011-04-15T03:34:18.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }