Closed Bug 1237755 Opened 9 years ago Closed 6 years ago

adb shell am start ... no longer actually opens links if Fennec is already running

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(fennec-)

RESOLVED WORKSFORME
Tracking Status
fennec - ---

People

(Reporter: nalexander, Unassigned)

References

Details

Attachments

(6 files, 3 obsolete files)

I see: $ adb shell am start -a android.activity.MAIN -n org.mozilla.fennec_nalexander/org.mozilla.gecko.BrowserApp -d 'http://people.mozilla.org/~ewong2/push-notification-test/' Starting: Intent { act=android.activity.MAIN dat=http://people.mozilla.org/~ewong2/push-notification-test/ cmp=org.mozilla.fennec_nalexander/org.mozilla.gecko.BrowserApp } Warning: Activity not started, its current task has been brought to the front But nothing happens. Something in the Intent handling code? The Tab Queuing code? If Fennec isn't running, this works. It's just when Fennec is already running that this is ignored. I've just tested with a fresh install before I've seen the Tab Queuing prompt, and it's busted.
mcomella: you know the most about Intent handling. Can you investigate or re-direct?
Flags: needinfo?(michael.l.comella)
Shouldn't the action be android.intent.action.VIEW (instead of android.activity.MAIN)?
(In reply to Sebastian Kaspari (:sebastian) from comment #2) > Shouldn't the action be android.intent.action.VIEW (instead of > android.activity.MAIN)? Sounds feasible. Margaret, I'd like to focus on telemetry – do you have time to look into this further?
Flags: needinfo?(margaret.leibovic)
Nick, did you just accidentally specify action.MAIN instead of action.VIEW? Or is there something more we need to look into here?
Flags: needinfo?(nalexander)
Flags: needinfo?(michael.l.comella)
Flags: needinfo?(margaret.leibovic)
(In reply to :Margaret Leibovic from comment #4) > Nick, did you just accidentally specify action.MAIN instead of action.VIEW? Accidentally, in the sense that I don't really care -- I've done this for years, following http://wrla.ch/blog/2012/05/launching-random-web-browsers-on-android-via-adb/?utm_source=rss&utm_medium=rss&utm_campaign=launching-random-web-browsers-on-android-via-adb > Or is there something more we need to look into here? adb shell am start -a android.activity.VIEW -n org.mozilla.fennec_nalexander/org.mozilla.gecko.BrowserApp -d 'http://people.mozilla.org/~ewong2/push-notification-test/' Starting: Intent { act=android.activity.VIEW dat=http://people.mozilla.org/~ewong2/push-notification-test/ cmp=org.mozilla.fennec_nalexander/org.mozilla.gecko.BrowserApp } Warning: Activity not started, its current task has been brought to the front and adb shell am start -a android.activity.VIEW -n org.mozilla.fennec_nalexander/.App -d 'http://people.mozilla.org/~ewong2/push-notification-test/' both behave the same for me: Fennec focused, no tab opened. (Including when there are no tabs open -- i.e., we're not just focusing an existing tab in some instances.)
Flags: needinfo?(nalexander)
Is this a recent regression for you? This was working for me just earlier today.
tracking-fennec: --- → ?
(In reply to :Margaret Leibovic from comment #6) > Is this a recent regression for you? This was working for me just earlier > today. No, months, across several devices (I think). What was your exact command line?
Flags: needinfo?(margaret.leibovic)
I haven't a clue why my old approach stopped working, but it appears the following works. Observe the different action, and the less specific package name. adb shell am start -a android.intent.action.VIEW -d 'http://people.mozilla.org/~ewong2/push-notification-test/' org.mozilla.fennec_nalexander
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(margaret.leibovic)
Resolution: --- → WORKSFORME
tracking-fennec: ? → -
I actually think there are some issues in the existing code, and I want to change how this works as part of Bug 1242213, so I'm re-opening it.
Assignee: nobody → nalexander
Blocks: 1242213
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
The motivation is to remove the hard-coded ".App" that we were using: there's no reason to not use the intent filters in the same manner that Android itself will. Along the way, I replaced "android.activity.MAIN" because I don't really understand how that worked at any point: I can't find any documentation referencing it! Review commit: https://reviewboard.mozilla.org/r/32217/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/32217/
Attachment #8711502 - Flags: review?(gbrown)
gbrown: this is motivated by Bug 1242213, which gets rid of .App entirely. There's something very fishy with this code, since there appears to be a near-complete duplicate of the launching code in mozdevice. In any case, could you take a look, and could you suggest any places automation might be launching with an explicit .App in non-tree code? (I hope there are none.)
Flags: needinfo?(gbrown)
(In reply to Nick Alexander :nalexander from comment #14) > could you take a look, and could you suggest any places automation might be > launching with an explicit .App in non-tree code? (I hope there are none.) There's probably an .App or two in autophone?
Flags: needinfo?(bob)
Comment on attachment 8711502 [details] MozReview Request: Bug 1237755 - Part 1: Use android.intent.action.{MAIN,VIEW} in |mach run|. r?gbrown Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32217/diff/1-2/
Comment on attachment 8711503 [details] MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32219/diff/1-2/
Comment on attachment 8711504 [details] MozReview Request: Bug 1237755 - Part 3: Update mozdevice tests. r?gbrown Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32221/diff/1-2/
Attachment #8711502 - Flags: review?(gbrown) → review+
Comment on attachment 8711502 [details] MozReview Request: Bug 1237755 - Part 1: Use android.intent.action.{MAIN,VIEW} in |mach run|. r?gbrown https://reviewboard.mozilla.org/r/32217/#review28949 Works great for me.
Autophone uses a forked copy of adb.py, adb_android.py and as such will be affected when I merge the two. Note: I noticed two trailing whitespace issues in a quick look at the adb_android.py patch. Question: Will these changes work with older versions of Fennec? If not, then we will need a fallback.
Flags: needinfo?(bob) → needinfo?(nalexander)
(In reply to Bob Clary [:bc:] from comment #22) > Autophone uses a forked copy of adb.py, adb_android.py and as such will be > affected when I merge the two. > > Note: I noticed two trailing whitespace issues in a quick look at the > adb_android.py patch. Oh! Thanks! I will take a look at clean whitespace. > Question: Will these changes work with older versions of Fennec? If not, > then we will need a fallback. This is a fine question. It's my belief that this will work without change with older versions of Fennec, since the mechanism is strictly more general. If there's a way to verify this short of landing, I'd appreciate to know.
Flags: needinfo?(nalexander)
Comment on attachment 8711503 [details] MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc https://reviewboard.mozilla.org/r/32219/#review28955 ::: testing/mozbase/mozdevice/mozdevice/adb_android.py:347 (Diff revision 2) > + Extra whitespace ::: testing/mozbase/mozdevice/mozdevice/droid.py:67 (Diff revision 2) > + Extra whitespace
Attachment #8711503 - Flags: review?(gbrown) → review+
Comment on attachment 8711504 [details] MozReview Request: Bug 1237755 - Part 3: Update mozdevice tests. r?gbrown https://reviewboard.mozilla.org/r/32221/#review28957 You can run these tests right from the directory with (hopefully!) no setup: python droidsut_launch.py (It's not passing for me.) ::: testing/mozbase/mozdevice/tests/droidsut_launch.py:14 (Diff revision 2) > - "org.mozilla.fennec/.App -a " > + "-a android.intent.action.MAIN" missing ' ' after .MAIN here (string concatenation) ::: testing/mozbase/mozdevice/tests/droidsut_launch.py:27 (Diff revision 2) > - "org.mozilla.fennec/.App -a " > + "-a android.intent.action.MAIN" another missing ' '
Attachment #8711504 - Flags: review?(gbrown)
fyi, I'm running a test on autophone with the changes to adb_android.py using Nexus One CyanogenMod 2.3.6, Samsung Galaxy S III Android 4.0.4 and Nexus 6P Android 6.0.1. I'll let you know how it goes.
Note in part 2 for adb_android.py: if activityName: acmd.extend(["-n", "%s/%s" % (appName, activityName)]) else: acmd.extend([appName]) should use activity_name instead of activityName
(In reply to Nick Alexander :nalexander from comment #14) > There's something very fishy with this code, since there appears to be a > near-complete duplicate of the launching code in mozdevice. There is lots of overlap between devicemanagerADB.py (older, used in traditional automated unit tests) and {adb.py, adb_android.py} (newer, out-of-tree copy of these used in autophone): they serve similar purposes in different projects. It looks to me like you (almost, modulo :bc's comments!) made the right changes in both places. Thanks!
Flags: needinfo?(gbrown)
ditto appName vs app_name. Even with this change, it doesn't appear that this launches current mozilla-inbound fennec builds in autophone.
Comment on attachment 8711503 [details] MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32219/diff/2-3/
Comment on attachment 8711504 [details] MozReview Request: Bug 1237755 - Part 3: Update mozdevice tests. r?gbrown Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32221/diff/2-3/
Attachment #8711504 - Flags: review?(gbrown)
Attachment #8711504 - Flags: review?(gbrown) → review+
Comment on attachment 8711504 [details] MozReview Request: Bug 1237755 - Part 3: Update mozdevice tests. r?gbrown https://reviewboard.mozilla.org/r/32221/#review29065 droidsut_launch.py passes for me now - thanks.
Comment on attachment 8711503 [details] MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc https://reviewboard.mozilla.org/r/32219/#review29069 I am troubled by https://bugzilla.mozilla.org/show_bug.cgi?id=1237755#c29. We need to make sure that your adb_android.py changes do not break autophone. I'll investigate tomorrow, unless :bc beats me to it! ;) ::: testing/mozbase/mozdevice/mozdevice/adb_android.py:356 (Diff revision 3) > + acmd.extend(["-n", "%s/%s" % (appName, activity_name)]) appName -> app_name ::: testing/mozbase/mozdevice/mozdevice/adb_android.py:358 (Diff revision 3) > + acmd.extend([appName]) appName -> app_name
Attachment #8711503 - Flags: review+
Attached file foo.py
This is a rough test showing the problem. This fails to load urls from the local file system but does load remote urls such as http://cnn.com/. It uses the serial number for my gs3 and paths specific to autophone but should be easily modifiable.
Comment on attachment 8711502 [details] MozReview Request: Bug 1237755 - Part 1: Use android.intent.action.{MAIN,VIEW} in |mach run|. r?gbrown Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32217/diff/2-3/
Attachment #8711503 - Attachment description: MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown → MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc
Attachment #8711503 - Flags: review?(gbrown)
Attachment #8711503 - Flags: review?(bob)
Comment on attachment 8711503 [details] MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32219/diff/3-4/
Comment on attachment 8711504 [details] MozReview Request: Bug 1237755 - Part 3: Update mozdevice tests. r?gbrown Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32221/diff/3-4/
Attached patch bug-1237755-autophone.patch (obsolete) — Splinter Review
jmaher, this works well with nalexander's changes for s1s2, but fails for talos. I also tried the original -tp file:/sdcard/... in addition to -tp file:///sdcard/... but neither works. Thoughts?
Attachment #8713271 - Flags: feedback?(jmaher)
gbrown: bc: here's where this is at. Lots of try pushes have finished all green M or R. The try push at https://treeherder.mozilla.org/#/jobs?repo=try&revision=c2f31253bcfa has a green tpn run, but trychooser lies about what the syntax for "the other talos test" is and I'm done fighting this. (I already discovered that -t all is broken.) Let's assume the other talos test doesn't do wildly different things, since we're confident it's all the same pageloader extension, which needs no changes. To the best of my knowledge, the patch is working in bc's autophone tests after removing an explicit "intent=...VIEW" line. So, back to you for final review.
Comment on attachment 8711503 [details] MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc https://reviewboard.mozilla.org/r/32219/#review28951 ::: testing/mozbase/mozdevice/mozdevice/adb_android.py:347 (Diff revision 2) > + whitespace ::: testing/mozbase/mozdevice/mozdevice/droid.py:67 (Diff revision 2) > + whitepace ::: testing/mozbase/mozdevice/mozdevice/adb_android.py:357 (Diff revision 4) > + acmd.extend(["-t", "text/html"]) Since we only care about file: urls specifically here, we should limit this mimetype override to that case. Otherwise this will prevent loading of about: type urls. See the attached patch which makes this work for about:fennec urls.
Attachment #8711503 - Flags: review?(bob)
Attached patch bug-1237755-no-intent-v1.patch (obsolete) — Splinter Review
Attachment #8713515 - Flags: review?(gbrown)
(In reply to Bob Clary [:bc:] from comment #46) > Comment on attachment 8711503 [details] > MozReview Request: Bug 1237755 - Part 2: Use > android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc > > https://reviewboard.mozilla.org/r/32219/#review28951 > > ::: testing/mozbase/mozdevice/mozdevice/adb_android.py:347 > (Diff revision 2) > > + > > whitespace > > ::: testing/mozbase/mozdevice/mozdevice/droid.py:67 > (Diff revision 2) > > + > > whitepace > > ::: testing/mozbase/mozdevice/mozdevice/adb_android.py:357 > (Diff revision 4) > > + acmd.extend(["-t", "text/html"]) > > Since we only care about file: urls specifically here, we should limit this > mimetype override to that case. Otherwise this will prevent loading of > about: type urls. See the attached patch which makes this work for > about:fennec urls. This is fine by me. To be clear, we're pushing http/https/about/javascript URLs to https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/mobile/android/base/AndroidManifest.xml.in#251 and file URLs to https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/mobile/android/base/AndroidManifest.xml.in#258. The second filter has a mimeType, hence needs the -t.
Flags: needinfo?(nalexander)
Attachment #8713515 - Flags: review?(gbrown) → review+
Attachment #8713516 - Flags: review?(gbrown) → review+
Attachment #8711503 - Flags: review?(gbrown) → review+
Comment on attachment 8711503 [details] MozReview Request: Bug 1237755 - Part 2: Use android.intent.action.{MAIN,VIEW} in mozdevice. r?gbrown,bc https://reviewboard.mozilla.org/r/32219/#review29699
Comment on attachment 8713271 [details] [diff] [review] bug-1237755-autophone.patch Review of attachment 8713271 [details] [diff] [review]: ----------------------------------------------------------------- we chatted in irc, in the past there have been issues with -tp file:<path> to pageloader, but those issues could have been os version specific. If this works, I don't see any other big issues with it.
Attachment #8713271 - Flags: feedback?(jmaher) → feedback+
I ran some tests with this patch using one of my older Nexus One running CyanogenMod and found that it doesn't launch the browser but instead launches a chooser between Browser or Nightly with the option to make it the default action. adb -s HT09AP802284 wait-for-device shell am start -a android.intent.action.VIEW --es env3 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 --es env2 NO_EM_RESTART=1 --es env1 MOZ_CRASHREPORTER_NO_REPORT=1 --es env0 MOZ_CRASHREPORTER=1 --es env4 MOZ_CRASHREPORTER_SHUTDOWN=1 -d file:///sdcard/tests/autophone/S1S2Test/files/s1s2/blank.html -t text/html org.mozilla.fennec Starting: Intent { act=android.intent.action.VIEW dat=file:///sdcard/tests/autophone/S1S2Test/files/s1s2/blank.html typ=text/html } Gives a choice between HTMLViewer and Nightly while adb -s HT09AP802284 wait-for-device shell am start -a android.intent.action.VIEW --es env3 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 --es env2 NO_EM_RESTART=1 --es env1 MOZ_CRASHREPORTER_NO_REPORT=1 --es env0 MOZ_CRASHREPORTER=1 --es env4 MOZ_CRASHREPORTER_SHUTDOWN=1 -d http://cnn.com -t text/html org.mozilla.fennec Starting: Intent { act=android.intent.action.VIEW dat=http://cnn.com typ=text/html } gives a choice between Browser and Nightly. I'll run additional tests with other Nexus One devices I have to make sure it is a common behavior. nalexander: Does the new am start syntax work with Android 2.3?
Flags: needinfo?(nalexander)
(In reply to Bob Clary [:bc:] from comment #52) > I ran some tests with this patch using one of my older Nexus One running > CyanogenMod and found that it doesn't launch the browser but instead > launches a chooser between Browser or Nightly with the option to make it the > default action. > > adb -s HT09AP802284 wait-for-device shell am start -a > android.intent.action.VIEW --es env3 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 --es > env2 NO_EM_RESTART=1 --es env1 MOZ_CRASHREPORTER_NO_REPORT=1 --es env0 > MOZ_CRASHREPORTER=1 --es env4 MOZ_CRASHREPORTER_SHUTDOWN=1 -d > file:///sdcard/tests/autophone/S1S2Test/files/s1s2/blank.html -t text/html > org.mozilla.fennec > Starting: Intent { act=android.intent.action.VIEW > dat=file:///sdcard/tests/autophone/S1S2Test/files/s1s2/blank.html > typ=text/html } > > Gives a choice between HTMLViewer and Nightly while > > adb -s HT09AP802284 wait-for-device shell am start -a > android.intent.action.VIEW --es env3 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 --es > env2 NO_EM_RESTART=1 --es env1 MOZ_CRASHREPORTER_NO_REPORT=1 --es env0 > MOZ_CRASHREPORTER=1 --es env4 MOZ_CRASHREPORTER_SHUTDOWN=1 -d http://cnn.com > -t text/html org.mozilla.fennec > Starting: Intent { act=android.intent.action.VIEW dat=http://cnn.com > typ=text/html } > > gives a choice between Browser and Nightly. > > I'll run additional tests with other Nexus One devices I have to make sure > it is a common behavior. > > nalexander: Does the new am start syntax work with Android 2.3? Apparently not: 2.3.7 doesn't accept bare package names: http://androidxref.com/2.3.7/xref/frameworks/base/core/java/android/content/ComponentName.java#159. Good grief. OK, I'll just s/.App/org.mozilla.gecko.BrowserApp/ and give up trying to make this better. Thanks for testing, bc!
Flags: needinfo?(nalexander)
We change launch_fennec to make activity_name an optional keyword argument. It would be up to the caller to decide if to pass it and we could still use your new syntax for Android 4.0.3+. After all, 2.3 support is going to die sometime in the relative near future. One thing though, is with your changes, *one* of my Nexus 6Ps fails the smoke test. Using the original approach it does not fail. It appears to have a permissions problem with the profile on the sdcard. The other 5 6Ps I have here locally don't have that problem and I don't understand what is different between the two sets of devices. I tried working around that by using /data/local instead of /sdcard and it resolved the smoketest issue, but caused the unit tests to fail. :-( I was planning on investigating that next. If s/.App/org.mozilla.gecko.BrowserApp/ gives you want you need, lets go with that. I'll test your patch when you have it ready. We can revisit this when we drop support for 2.3 on release. Thanks for your patience.
I tested this in autophone along with the previous autophone patches to use file: urls on the smoketest, talos, s1s2test and webappstartup tests on Android 2.3, Android 4.0.3 and Android 6.0.1 and got full green on all including the one 6P which had the orange on the smoketest: https://treeherder.allizom.org/#/jobs?repo=mozilla-inbound&revision=62d300c9c733&exclusion_profile=false&filter-tier=1&filter-tier=2&filter-tier=3&filter-searchStr=autophone nalexander: You'll need to do a patch for mozdevice's adb_android.py and probably should do a try run on the unit tests. I think this will be sufficient: try: -b o -p android-api-9,android-api-15 -u plain-reftest-1,jsreftest-1,mochitest-1 -t remote-tsvg,remote-tp4m_nochrome
Attachment #8714991 - Flags: review?(nalexander)
Comment on attachment 8714991 [details] [diff] [review] launch_application.patch Review of attachment 8714991 [details] [diff] [review]: ----------------------------------------------------------------- lgtm. Ta. This will work with everything right now -- you can land independent of anything else in the tree. (And it is the "new normal", so we're unlikely to need to roll back.)
Attachment #8714991 - Flags: review?(nalexander) → review+
Attachment #8713271 - Attachment is obsolete: true
Attachment #8713461 - Attachment is obsolete: true
Attachment #8713515 - Attachment is obsolete: true
I commit the following to Autophone, but haven't made any changes to mozbase/mozdevice or any test runners. https://github.com/mozilla/autophone/commit/656627556c82e76fb6e16374b7ea31775734e17f Bug 1237755 - Autophone - adb_android.py - use activity name org.mozilla.gecko.BrowserApp when launching Fennec, r=nalexander. https://github.com/mozilla/autophone/commit/af4126e14578f0ce52e9324234a7990b7fdd2279 Bug 1237755 - Autophone - use explicit file: scheme for local paths, r=gbrown I'll deploy these to autophone production later. nalexander: I'm not sure what other changes you will still be making to mozbase/mozdevice as part of this bug, but you'll need to work up an equivalent patch for https://github.com/mozilla/autophone/commit/656627556c82e76fb6e16374b7ea31775734e17f to apply to mozdevice's version of adb_android.py.
Assignee: nalexander → nobody
Assignee: nobody → nalexander
QA Contact: sdaswani
Whatever is going on here is no longer relevant.
Status: REOPENED → RESOLVED
Closed: 9 years ago6 years ago
Resolution: --- → WORKSFORME
Assignee: nalexander → nobody
QA Contact: sdaswani
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: