ungoogled-software / ungoogled-chromium-android

Android build for ungoogled-chromium
GNU General Public License v3.0
495 stars 42 forks source link

Developer mode folder loading on Android 11 devices does not work #51

Closed ungubajue90k closed 3 years ago

ungubajue90k commented 3 years ago

Hi,

my friends told me that on their Android 11 devices it does not work with the extension install by folder.

Everything was enabled "Storage" permissions and "Allow from unknown source".

Tested version:

ungoogled-chromium android https://github.com/ungoogled-software/ungoogled-chromium-android/releases/tag/87.0.4280.141-2-extensions

uBlock Origin https://github.com/gorhill/uBlock/releases/download/1.32.4/uBlock0_1.32.4.chromium.zip

Here is the log file.

log Android 11.txt

wchen342 commented 3 years ago

From the log the Java method to get volume path got accessed denied because it is part of greylist-max-q. The method I used was a workaround from the beginning, and although there is an improved version of it it is not guarunteed to work since Google has changed the file access framework.

So in short, direct access will stop working sooner or later, unless you have root had someone makes a magisk module for it. This is an OS level restriction.

As an alternative, what happens if you put an crx file into, say Download folder, and type in omnibox file:///storage/emulated/0/Download/{filename}.crx? Storage permission and "Allow from this source" are still needed.

ungubajue90k commented 3 years ago

As an alternative, what happens if you put an crx file into, say Download folder, and type in omnibox file:///storage/emulated/0/Download/{filename}.crx? Storage permission and "Allow from this source" are still needed.

Access to the file was denied

The file at file:///storage/emulated/0/Download/uBlock Origin 1.32.4.crx is not readable. It may have been removed, moved or file permissions may be preventing access.

ERR_ACCESS_DENIED

wchen342 commented 3 years ago

Can you accress from shell and see the full path to the crx file?

ungubajue90k commented 3 years ago

Can you accress from shell and see the full path to the crx file?

I have pasted this into Termux. Storage permission and "Allow from this source" are enabled.

"/storage/emulated/0/Download/uBlock Origin 1.32.4.crx"

Result

bash: /storage/emulated/0/Download/uBlock Origin 1.32.4.crx: Permission denied

Same result in Android 10.


https://github.com/Kunzisoft/KeePassDX When I use the KeePassDX app on Android 11 and open a .kdbx file under /storage/emulated/0/Download with "Files" app, KeePassDX app shows me this path in the main view content://com.android.providers.downloads.documents/document/msf:39

wchen342 commented 3 years ago

"/storage/emulated/0/Download/uBlock Origin 1.32.4.crx"

What I was trying to do here is determine the physical path is actually right. It is possible that Permission denied comes from a wrong path. Do you have root on you phone? If you have root it will be much easier since this can be done from adb. Still you can try to run adb shell from a pc with your phone connected, and then try to ls around and find the correct path to the file.

content://com.android.providers.downloads.documents/document/msf:39

That is the mUri which is only useful in Java. Reading extensions requires C++ file reading unfortunately.

ungubajue90k commented 3 years ago

Do you have root on you phone? If you have root it will be much easier since this can be done from adb.

No I do not have root on Android 11 devices because these devices are from friends. In general, I do not know of any Android phone that I can immediately assign root rights without a network connection, i.e. completely offline/local. Most current Android devices I've tested require a network connection or online account to unlock the device first, and then I can root, etc.

Still you can try to run adb shell from a pc with your phone connected, and then try to ls around and find the correct path to the file.

I tried with adb shell and pasted this ls "/storage/emulated/0/Download/uBlock Origin 1.32.4.crx"

Result:

/storage/emulated/0/Download/uBlock\ Origin\ 1.32.4.crx

wchen342 commented 3 years ago

So the path seems right, if when you first use adb shell it was under/. This left the only way to do file loading with passing a whole crx file from java and load it with the existing crx unpacking installer, which will take much more work.

I will implement this when I have time, but for now I think I may first put my focus on getting the extension popup window working so this may have to wait for a while.

ungubajue90k commented 3 years ago

So the path seems right, if when you first use adb shell it was under/.

If I just type in adb shell -> ls / then I do not find the .crx file. It shows very few results (under 30 results) and many with the message : Permission denied.

I must to type exactly ls /storage/emulated/0/Download or ls "/storage/emulated/0/Download/ublock Origin 1.32.4.crx", then in adb shell shows the .crx file.

wchen342 commented 3 years ago

Yes that's what I meant, since your ls above didn't start with a leading / so I didn't knwo where you ran that command.

wchen342 commented 3 years ago

See https://github.com/ungoogled-software/ungoogled-chromium-android#extensions.