[TIMOB-24527] Android: Intents using FLAG_ACTIVITY_NEW_DOCUMENT can cause issues with KrollRuntime
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-04-21T22:36:26.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.0.4 |
Components | Android |
Labels | n/a |
Reporter | Gary Mathews |
Assignee | Gary Mathews |
Created | 2017-03-23T14:35:48.000+0000 |
Updated | 2017-04-21T23:46:23.000+0000 |
Description
Some applications specify the
FLAG_ACTIVITY_NEW_DOCUMENT
flag when launching applications (Gmail). This can cause event listeners to be overridden and fired in the incorrect activity instance.
*TEST CASE*
*tiapp.xml*
<android ...>
...
<manifest ...>
...
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="www.android.com" />
</intent-filter>
...
</manifest>
</android>
*app.js*
var win = Ti.UI.createWindow({
layout: 'vertical'
}),
bar = Ti.UI.createView({
layout: 'horizontal',
width: Ti.UI.FILL,
height: Ti.UI.SIZE
})
currentData = Ti.UI.createButton({
title: 'CURRENT DATA',
left: 0
}),
clear = Ti.UI.createButton({
title: 'CLEAR',
right: 0
}),
scrollView = Ti.UI.createScrollView({
layout: 'vertical',
height: Ti.UI.FILL,
backgroundColor: 'white'
});
// show current data
currentData.addEventListener('click', function (e) {
alert(Ti.Android.currentActivity.getIntent().data);
});
// clear intent log
clear.addEventListener('click', function (e) {
scrollView.removeAllChildren();
});
// launch intent
scrollView.add(Ti.UI.createLabel({
top: 10,
color: 'black',
text: 'LAUNCH INTENT ' + JSON.stringify(Ti.Android.currentActivity.getIntent()) + ' WITH DATA: ' + Ti.Android.currentActivity.getIntent().data
}));
bar.add(currentData);
bar.add(clear);
win.add(bar);
win.add(scrollView);
win.open();
1. Launch app via a link in Gmail: www.android.com/0
2. Press 'CURRENT DATA', should display www.android.com/0
3. Open recent apps menu and resume Gmail
4. Launch app via link in Gmail: www.android.com/1
5. Press 'CURRENT DATA', should display www.android.com/1
6. Open recent apps menu and resume Gmail
7. Launch app via a link in Gmail: www.android.com/0
8. Press 'CURRENT DATA', should display www.android.com/0
but does not
master: https://github.com/appcelerator/titanium_mobile/pull/8908
6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8910
FR Done. Merged 6.0.4 PR waiting for build from CI to close.
Verified the fix in 6.0.4.v20170421153428. Closing.