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

Cannot install an app downloaded to internal storage #417

Closed
shuhaowu opened this issue Apr 13, 2018 · 21 comments
Closed

Cannot install an app downloaded to internal storage #417

shuhaowu opened this issue Apr 13, 2018 · 21 comments
Labels
Milestone

Comments

@shuhaowu
Copy link

Expected behaviour

After enabling download of apps to internal storage, it should be installable.

Actual behaviour

A toast come out and say could not be installed, with the following error logs

04-13 00:35:32.334  2280  6451 I DictionaryProvider:UpdateHandler: downloadFinished() : DownloadId = -696006506
04-13 00:35:32.348  3199  5458 E DatabaseUtils: Writing exception to parcel
04-13 00:35:32.348  3199  5458 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/my_downloads from pid=2280, uid=10069 requires android.permission.INTERNET, or grantUriPermission()
04-13 00:35:32.348  3199  5458 E DatabaseUtils: 	at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:608)
04-13 00:35:32.348  3199  5458 E DatabaseUtils: 	at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:483)
04-13 00:35:32.348  3199  5458 E DatabaseUtils: 	at android.content.ContentProvider$Transport.query(ContentProvider.java:212)
04-13 00:35:32.348  3199  5458 E DatabaseUtils: 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
04-13 00:35:32.348  3199  5458 E DatabaseUtils: 	at android.os.Binder.execTransact(Binder.java:565)

Steps to reproduce

  1. Enable internal storage download for apps
  2. Try to install an app

Info about your device

kiwi (Huawei Honor 5x), Lineage 4 Microg 14.1

@JonnyTech
Copy link

Have you granted yalp privileges to access storage?

@shuhaowu
Copy link
Author

Yes.

@JonnyTech
Copy link

What is the download directory in yalp settings set to?

@shuhaowu
Copy link
Author

It is set to internal storage. i.e. not on the sdcard but in the private storage of the app itself.

@JonnyTech
Copy link

What is the actual string?

@shuhaowu
Copy link
Author

/storage/emulated/0/Download

@JonnyTech
Copy link

Can the native file manager for that rom access the downloaded file using the exact same path? (There are other paths to the same location such as /storage/self/primary)

@yeriomin
Copy link
Owner

/storage/emulated/0/Download

This is external storage path.

The log messages you provided do not come from Yalp Store. Your logs mention lack of INTERNET permission which Yalp Store has. Yalp Store has no classes called DictionaryProvider, UpdateHandler or DatabaseUtils. Seems like a DownloadManager error, but it is not used when downloading to internal storage.

Are you sure you enabled internal storage downloads in Yalp Store settings? Please reproduce the problem and use Yalp Store's built-in error reporter; mention this issue so that I would know it is you.

@yeriomin yeriomin reopened this Apr 13, 2018
@Rikk
Copy link

Rikk commented Apr 18, 2018

@yeriomin You are definitely confusing internal vs external storage definitions. External is, for example, a removable SD card, while Internal is the storage space already in the phone. The new option in Settings is mislabeled as well. I already tried to explain this in #386 but you haven't answered. I could say you are right if I look from the app perspective: internal for files inside app's own /data folder and external for every other place; but, this is wrong when we generally talk about file management in a phone...
As of today, YalpStore still can't download to removable SD cards.

@JonnyTech
Copy link

Indeed, on my device the last quoted location is internal storage

storage

@yeriomin
Copy link
Owner

@Rikk @JonnyTech

You are definitely confusing internal vs external storage definitions.

No, I am not. I understand why there is a confusion - according to Android docs:

All Android devices have two file storage areas: "internal" and "external" storage. These names come from the early days of Android, when most devices offered built-in non-volatile memory (internal storage), plus a removable storage medium such as a micro SD card (external storage). Many devices now divide the permanent storage space into separate "internal" and "external" partitions. So even without a removable storage medium, these two storage spaces always exist, and the API behavior is the same regardless of whether the external storage is removable.

So "external" does not mean that it is a removable SD card. It means public storage accessible to user and other apps, not its physical implementation.

Did you notice there is a word "emulated" in the path /storage/emulated/0/Download? What do you think is emulated exactly? It means external storage emulated by internal storage

@Rikk
Copy link

Rikk commented Apr 19, 2018

@yeriomin why all file managers call it internal?
I would say 'emulated' is a convention oems use to indicate this mount place. /storage/emulated/... is not the real path of the block devices that are mounted there.
This Google definition that "external" is a place "accessible by user" doesn't make much sense to me, because every place is accessible with the proper permissions (root).

It would be a good research someone talking about this difference in concepts.

Edit: after reading more of this Android docs my conclusion is that it 1) Makes sense from the perspective of apps and developers; 2) Is more likely a terminology that makes no sense to end-users but Google wants to impose on people; 3) Considering Android also use the path /sdcard for its 'external-(internal in truth) storage' which is not a real SD card, I would risk saying it is a legacy terminology from early Android versions when phones might have had real SD cards internally; 4) Is is bad and slow at fixing things that make little sense.

Also, I don't get what you mean by "external emulated by internal". Are there two different nand chips? Moreover, something emulated is, for example, a piece of software made for one platform that is being tricked to run in a non-native environment, eg, DOS emulated by QEMU running inside Windows, or a Nintendo game running inside a emulator on PC.

@yeriomin All above out, and sorry for the off-topic, my question really is: Are you going to support downloading to removable external SD cards?

@yeriomin
Copy link
Owner

@Rikk

I would say

doesn't make much sense to me

It is not a matter of opinion. The docs clearly state which is which.

Also, I don't get what you mean by "external emulated by internal".

From wikipedia:

Emulation - imitation of behavior of a computer or other electronic system with the help of another type of computer/system

Many android devices don't have an SD card slot at all. The need for a shared user-accessible storage for generic files has not disappeared though. Every android device has some kind of external storage. For old devices it is most likely an SD card. For new devices it is either just the internal storage which emulates externals storage (emulated storage) or emulated storage + SD card. Emulated because it has the function of the external storage, but is backed by something physically inseparable from the device.

Are there two different nand chips?

Two logical volumes on one physical device. It could be an HDD. Android does not care.

@conrad-heimbold
Copy link

Same problem here:

  • When downloading apps to /data/user/0/com.github.yeriomin.yalpstore/files , as shown in the following screenshot, installing the app fails: yalpstore settings
  • when downloading apps to /storage/emulated/0/Android/data/com.github.yeriomin.yalpstore/files , installing the app works .

Storage permissions have been granted: yalpstore permissions

@yeriomin
Copy link
Owner

@conrad-heimbold

installing the app fails

How exactly does it fail? Like I said, @shuhaowu's logs are not from Yalp Store. Please reproduce the problem and post the logs here or use Yalp Store's feedback tool (mention your name and/or this issue number because the reports are anonymous by default).

Storage permissions have been granted

This is irrelevant, that permission is for external storage. Using internal storage requires no permission at all.

@conrad-heimbold
Copy link

I finally got a logcat:

**DatabaseUtils**
Writing exception to parcel
java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/my_downloads from pid=5059, uid=10064 requires android.permission.INTERNET, or grantUriPermission()
	at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:608)
	at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:483)
	at android.content.ContentProvider$Transport.query(ContentProvider.java:212)
	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
	at android.os.Binder.execTransact(Binder.java:565)

@conrad-heimbold
Copy link

conrad-heimbold commented Jun 6, 2018

Now I know, how to fix this problem: I just have to execute adb pm grant com.github.yeriomin.yalpstore android.permission.INTERNET

Edit: This command didn't work. I got the following error:
Operation not allowed: java.lang.SecurityException: Permission android.permission.INTERNET is not a changeable permission type

@yeriomin
Copy link
Owner

yeriomin commented Jun 6, 2018

@conrad-heimbold That's very strange. android.permission.INTERNET is (and always has been) in Yalp Store's manifest. If it wasn't, no network request would be allowed to happen you wouldn't get to the download part. Also, it is not a dangerous permission, so it does not need to be requested explicitly.

Something might be wrong with your OS. When something as ubiquitous as internet permission is not granted, it usually means some third-party app has done that, or some xposed plugin maybe.

Does your problem happen all the time or downloads partly work? Does reinstalling Yalp Store help?

@conrad-heimbold
Copy link

my OS is LineageOS 15.1 with microg, I don't have xposed or anything like that. Deleting all data from yalpstore in the settings (almost equivalent to reinstalling) doesn't help; I got the error again.

It always fails, no matter what app I choose on google play.

@ghost
Copy link

ghost commented Jun 13, 2018

Same happened to me. Fresh LOS install. Yalp Store was installed through OTA. Installing an app through local storage failed so I had to disable it.
edit: first time I have this issue, also first time I install through OTA.

yeriomin added a commit that referenced this issue Jun 17, 2018
PackageInstaller is now used instead of reflection on Lollipop and higher. Reflection method could not work with content uris and file uris were deprecated in Nougat, which made privileged installation from internal storage impossible on Nougat and higher.
@yeriomin
Copy link
Owner

@GustavMarwin

Yalp Store was installed through OTA

This helped me find an issue. I'm not sure if it was the issue @shuhaowu and @conrad-heimbold were talking about...

Please, guys, don't ignore the issue template:

Send developer a bug report using Yalp's built-in crash tool. Please identify yourself - the reports are anonymous by default.

@yeriomin yeriomin added this to the 0.43 milestone Jun 19, 2018
@yeriomin yeriomin closed this as completed Jul 3, 2018
@yeriomin yeriomin added the bug label Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants