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-26099] Android: Modified "appc run" to launch app with same intent as Android OS when tapping app #30

Merged
merged 1 commit into from Jun 6, 2018

Conversation

jquick-axway
Copy link
Contributor

JIRA:

Summary:

  • Modified appc run to use same intent settings the Android OS uses when tapping on an app.
  • We were missing intent action "MAIN and category "LAUNCHER".
  • Fixes issue where pressing "Home" button after appc run app launch and then tapping on the app onscreen would not resume the app. Would launch a new splash-screen, but not run the app.
  • Fixed regression caused by TIMOB-25867 where "Restart Required" dialog would be displayed infinitely on app launch on Pixel XL.

Test:
Run the below test on a Pixel XL, Android 4.1 device, and in the Android emulator.

  1. Build and run the below code via Appcelerator Studio or via appc run.
  2. Verify that the app's splash screen is not launched twice. (This ensures that TIMOB-25867 is still fixed.)
  3. Once launched, press the "Home" button to suspend the app. (Do NOT press "Back".)
  4. Go to the main app list screen. (Do NOT press the "Square" button.)
  5. Tap on the app from the list screen.
  6. Verify that the app resumes and it is not stuck at the splash screen.
var window = Ti.UI.createWindow();
window.add(Ti.UI.createLabel({ text: 'Test' }));
window.open();

…tent settings as Android OS does when tapping app.

- Avoids new activity instance from being created when suspending out of launched app and then tapping on app in home screen.
 * Android resumes apps when invoking an intent with same settings used to launch a pre-existing activity.
- Fixed regression caused by fix for TIMOB-25867 by adding "-n" intent component name parameter back in.
 * App launch was getting stuck in infinite loop with "App needs to be restarted" dialog on Pixel XL device.
Copy link
Contributor

@ypbnv ypbnv left a comment

Choose a reason for hiding this comment

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

LGTM

@jquick-axway
Copy link
Contributor Author

@ypbnv, for your info, the regression I mentioned only happened to me on 1st generation Pixel phones. I couldn't reproduce the issue on other devices. It wasn't an issue on a Pixel 2 either. Strange... but the intent generated on the Pixel was definitely different than the rest and I decided it was better to provide an explicit intent instead... which also solved the other ticket's issue. Thanks.

Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

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

Tested it and while I couldn't reproduce the issue, this PR doesn't appear to break anything. APPROVED

@hansemannn hansemannn merged commit e4b23cf into tidev:master Jun 6, 2018
@jquick-axway
Copy link
Contributor Author

I've tested this change on the following:

  • Pixel XL (Android 8.0)
  • Galaxy Nexus (Android 4.1)
  • Amazon Fire HD 8 Tablet
  • Android 6.0 Emulator
  • Android 4.4 Emulator

@ypbnv
Copy link
Contributor

ypbnv commented Jun 7, 2018

@jquick-axway I have a Pixel (first gen) at hand and I was not able to reproduce the described regression. But I won't be surprised if it happens on XL only. Another thing I noticed is that when you start an application without the -n option the intent is automatically given the category and action that match the launch from clicking the icon (the same we add with this PR). If I add the -n option the intent does not have them. I tried it on real devices with APIs 23/24/26. We are ensuring we get the same result every time so that would cover exceptions of this behavior.

@jquick-axway
Copy link
Contributor Author

@ypbnv, thanks for testing it out. Weird that my Pixel XL is the only device so far that doesn't follow the rules. Well, Android is the wild-west of operating systems. Unfortunately, these things happen.

The "real" solution is to refactor our intent handling on app startup/resume. This is the source of our problems. I plan on doing so for Titanium 8.0.
https://jira.appcelerator.org/browse/TIMOB-26075

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants