AdguardForAndroid icon indicating copy to clipboard operation
AdguardForAndroid copied to clipboard

Download/Update install intent uses wrong file path

Open kudiaborm opened this issue 10 years ago • 5 comments

I'm not sure if this is new as of Android N, but using the in-app "check for updates" feature returns a "unable to parse app".

The resultant apk file in the downloads app also cannot parse, and the file is not actually in the ~/Downloads folder

Using the downloads app to move the file shows it is actually in /data/data/com.android.providers.downloads/cache/adguard_beta.apk and not /data/user/0/com.android.providers.downloads/cache/adguard_beta.apk

START u0 {act=android.intent.action.VIEW dat=file:///data/user/0/com.android.providers.downloads/cache/adguard_beta.apk typ=application/vnd.android.package-archive flg=0x10000000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.PackageInstallerActivity} from uid 10188 on display 0

I've attached logs of my process, note that apk download names probably conflict between logs because I tried multiple times without deleting old version (i.e. apk-1, apk, apk-2).

CopyFIle.txt FailedUpdate.txt IsolatedError.txt

kudiaborm avatar Jun 10 '16 18:06 kudiaborm

Wow, thank you very much for the detailed research!

We didn't do it as we thought this is some specific Android N issue with applying apk update:). After all it is not as bad.

@Revertron can we fix it before releasing v2.6?

ameshkov avatar Jun 10 '16 18:06 ameshkov

Okay, I will fix it tomorrow.

Revertron avatar Jun 14 '16 17:06 Revertron

I've tested so many times the process of loading update apk and trying to install it. The errors are various from not saving file at all (we get Size: 0) to "Permission denied" when trying to install. I think we can make some ugly workaround to copy the file (IF IT EXISTS) to our cache folder, set read permissions to all and try to install it from there... I will try this ugly workaround now, but no promises.

P.S.: I can waste some time on this Android N bug, but they may eventually fix it in later releases. Is there any point for this?

Revertron avatar Jun 15 '16 11:06 Revertron

java.io.FileNotFoundException: /data/user/0/com.android.providers.downloads/cache/adguard_beta-3.apk (Permission denied)

There is nothing we can do with the file...

Revertron avatar Jun 15 '16 11:06 Revertron

Fixed it :) Making a copy to our cache and starting PackageManager from there.

Revertron avatar Jun 15 '16 14:06 Revertron