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

fix: Support Android 11 #2200

Merged
merged 1 commit into from
Mar 18, 2021
Merged

Conversation

danielzgtg
Copy link
Contributor

This fixes #2173.

On Android 11, Fenix is no longer requesting access to the entire /sdcard/ and uses more fine grained permissions now. web-ext was still assuming it did have permission.

To fix this, we use another directory, /data/local/tmp/ that we do have access to. I think this directory is used by Android Studio and the rest of the official Android toolchain.

Before

$ web-ext run -t firefox-android --android-device=192.168.3.70:5555 --firefox-apk org.mozilla.fenix
Running web extension from /home/home/WebstormProjects/darkreader/debug-firefox
Selected ADB device: 192.168.3.70:5555
Stopping existing instances of org.mozilla.fenix...
Old artifacts directories have been found on 192.168.3.70:5555 device. Use --adb-remove-old-artifacts to remove them automatically.
Starting org.mozilla.fenix...
Waiting for org.mozilla.fenix Remote Debugging Server...
Make sure to enable "Remote Debugging via USB" from Settings -> Developer Tools if it is not yet enabled.
Building web extension from /home/home/WebstormProjects/darkreader/debug-firefox
Waiting for org.mozilla.fenix Remote Debugging Server...
Make sure to enable "Remote Debugging via USB" from Settings -> Developer Tools if it is not yet enabled.
You can connect to this Android device on TCP port 44615

o: installTemporaryAddon: Error: Error: Could not install add-on at '/sdcard/web-ext-artifacts-1615624272033/dark_reader-4.9.29.xpi': [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIZipReader.open]"  nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"  location: "JS frame :: resource://gre/modules/addons/XPIInstall.jsm :: XPIPackage :: line 321"  data: no]
    at b.installTemporaryAddon (/home/home/.nvm/versions/node/v15.10.0/lib/node_modules/web-ext/dist/web-ext.js:1:43043)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at w.rdpInstallExtensions (/home/home/.nvm/versions/node/v15.10.0/lib/node_modules/web-ext/dist/web-ext.js:1:27002)
    at w.run (/home/home/.nvm/versions/node/v15.10.0/lib/node_modules/web-ext/dist/web-ext.js:1:20597)
    at async Promise.all (index 0)
    at x.run (/home/home/.nvm/versions/node/v15.10.0/lib/node_modules/web-ext/dist/web-ext.js:1:5299)
    at $ (/home/home/.nvm/versions/node/v15.10.0/lib/node_modules/web-ext/dist/web-ext.js:1:10137)
    at O.execute (/home/home/.nvm/versions/node/v15.10.0/lib/node_modules/web-ext/dist/web-ext.js:1:64433)

After

$ web-ext run -t firefox-android --android-device=192.168.3.70:5555 --firefox-apk org.mozilla.fenix
Running web extension from /home/home/WebstormProjects/darkreader/debug-firefox
Selected ADB device: 192.168.3.70:5555
Stopping existing instances of org.mozilla.fenix...
Starting org.mozilla.fenix...
Waiting for org.mozilla.fenix Remote Debugging Server...
Make sure to enable "Remote Debugging via USB" from Settings -> Developer Tools if it is not yet enabled.
Building web extension from /home/home/WebstormProjects/darkreader/debug-firefox
Waiting for org.mozilla.fenix Remote Debugging Server...
Make sure to enable "Remote Debugging via USB" from Settings -> Developer Tools if it is not yet enabled.
You can connect to this Android device on TCP port 36069
Installed /data/local/tmp/web-ext-artifacts-1615624405277/dark_reader-4.9.29.xpi as a temporary add-on
The extension will reload if any source file changes
Press R to reload (and Ctrl-C to quit)

Test environment

Tested on a OnePlus 7 Pro running OP7Pro_O2_BETA_3 with Fenix 210310 17:03.

Tested the following:

  • npm test
  • Installing an extension and running it
  • CTRL-C while it's running
  • Deleting the temporary folder in /data/local/tmp/, force quitting the app, and relaunching it

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

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

Thanks for the patch and testing this.

@caitmuenster
Copy link

@danielzgtg, I wanted to echo Rob's thanks. 🙌 Your contribution has been added to our recognition wiki.

Hope to see you around the project!

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

Successfully merging this pull request may close these issues.

No way to temporarily install on Firefox for Android Nightly on Android 11
3 participants