Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-24527] Android: Intents using FLAG_ACTIVITY_NEW_DOCUMENT can cause issues with KrollRuntime #8908

Merged
merged 2 commits into from May 1, 2017

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Mar 24, 2017

WARNING: #8897 must be merged first!

  • New activity instances created using FLAG_ACTIVITY_NEW_DOCUMENT (e.g: when launched from Gmail) can cause issues with KrollRuntime and override the event listeners.
  • Prevent FLAG_ACTIVITY_NEW_DOCUMENT from taking effect
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', () => {
    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

JIRA Ticket

Copy link
Contributor

@maggieaxway maggieaxway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR FT PASS

@lokeshchdhry
Copy link
Contributor

FR done in backport PR #8910.
Merging.

@lokeshchdhry lokeshchdhry merged commit 38fe20c into tidev:master May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants