mozilla / web-ext

A command line tool to help build, run, and test web extensions
Mozilla Public License 2.0
2.62k stars 335 forks source link

Wrong activity being started for Fenix #2206

Open palant opened 3 years ago

palant commented 3 years ago

Is this a feature request or a bug?

Bug

What is the current behavior?

The following command fails:

web-ext run --target=firefox-android --android-device=id

Error message:

Error: Activity class {org.mozilla.fenix.debug/org.mozilla.fenix.App} does not exist.

This works correctly with an explicit --firefox-apk-component '.HomeActivity' parameter.

What is the expected or desired behavior?

This should launch Fenix using the correct activity class.

Version information (for bug reports)

node --version && npm --version && web-ext --version

v15.11.0 7.6.0 6.0.0

palant commented 3 years ago

Actually, an explicit --firefox-apk-component org.mozilla.fenix.debug.App works as well. This only fails when Fenix is compiled from source, not with the official Nightly.

Rob--W commented 3 years ago

@jonalmeida The current logic for determining the "APK component" (activity identifier) is based on the discussion starting from your comment at https://github.com/mozilla/web-ext/pull/1871#issuecomment-605400070 :

What it's sending: org.mozilla.reference.browser.debug/org.mozilla.reference.browser.debug.BrowserActivity What it should be sending: org.mozilla.reference.browser.debug/org.mozilla.reference.browser.BrowserActivity

The logic was implemented at https://github.com/mozilla/web-ext/pull/1941

In this bug report, it is apparent that org.mozilla.fenix.debug.App should be used instead of org.mozilla.fenix.App, which is in contradiction with the previously described logic.

I guess that we can avoid prepending a fixed package identifier when .App is used, i.e. changing the condition from if (apkComponent.startsWith('.')) { to if (apkComponent !== ".App" && apkComponent.startsWith('.')) { at https://github.com/mozilla/web-ext/blame/ac207c6fdca5c806949adcaa7c54105ce278f606/src/util/adb.js#L328

@jonalmeida What do you suggest to resolve this bug? Does my suggestion make sense?

jonalmeida commented 3 years ago

Maybe there is some inconsistency within the two mobile apps, there were some variant changes that could have affected this?