Kitkat save problem

Subforum for discussion and help with ScummVM's Android port

Moderator: ScummVM Team

jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Kitkat save problem

Post by jortlaban »

Since Android 4.4 Google has implemented new rules for apps writing to external storage.
An app is only allowed to write to is own folder structure or to the internal storage device.
My save folder is actually in the designated folder for ScummVM so this new android policy shouldn't be any problem, however I am able to load previous saves, but ScummVM fails to write to this folder.
Is there any way or plan to fix this issue in the daily builds?? (or even the "official" Google play release)
A work around is to just put the saves to my internal storage, but I rather have them on my external storage card for easy transfer to other devices.
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Hmm...
https://developer.android.com/about/ver ... d-4.4.html

"If your app reads from external storage...

Your app can not read shared files on the external storage when running on Android 4.4, unless your app has the READ_EXTERNAL_STORAGE permission. That is, files within the directory returned by getExternalStoragePublicDirectory() are no longer accessible without the permission. However, if you need to access only your app-specific directories, provided by getExternalFilesDir(), then you do not need the READ_EXTERNAL_STORAGE permission."

We can look at adding the READ_EXTERNAL_STORAGE permission to avoid this, but we may have another issue here, so best to investigate fully.

I have no idea why that would not work correctly to save..

Can you provide some debugging information as I have no Android 4.4 device (and having trouble setting up the VAD emulator):
http://wiki.scummvm.org/index.php/Debug ... VM#Android

Basically any warning or errors into the Android Debug Log when the save fails would allow us to investigate.

Also, ensure you are using the latest development master build from here:
http://buildbot.scummvm.org/builds.html

Important instructions for installing daily builds are given here:
http://wiki.scummvm.org/index.php/Android#Installation
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Have done a quick check through the relevant code in scummvm/dists/android and scummvm/backends/platform/android.

As far as I can see, comparing this to the Android documentation online, this should work fine.

The saves path will default to <External Storage>/ScummVM/Saves/. If this directory does not exist or can not be created, then it will switch to a directory under the application specific directory called "saves".

We ask for the WRITE_EXTERNAL_STORAGE permission in our manifest and this should implicitly grant READ_EXTERNAL_STORAGE as well according to:
https://developer.android.com/reference ... AL_STORAGE

This may be a subtle bug in your 4.4 implementation where we need to add the READ_EXTERNAL_STORAGE permission explicitly.

But the debug logs should make it clear what is happening when the save fails.. Thanks.
jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Post by jortlaban »

The biggest problem is that I can't find any scummVM files on my device.
It is clearly installed, since the app and all installed engines run perfectly.
I wouldn't mind using the main app folder for my saves, but I just can't find it.
The same goes for the debug files.
If someone could provide the standard installation path on Android, it wouldn't be any problem saving there since Android does allow an app to write to it's own installation folder.
jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Post by jortlaban »

I am using the latest developments build by the way.
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

jortlaban: As I said, I can't help you if you don't provide any further information.

Can you check the Android Debug Log, either using alogcat or adb as described here:
http://wiki.scummvm.org/index.php/Debug ... VM#Android

And can you indicate which development build you are using? The version will be v1.7.0git-xxxx . It is the xxxx value that we need. This should be the directory name after you unpacked the zip file of apks. If you no longer have this, then the version is written on the launcher screen below the ScummVM logo and above the games list, Add game button etc.
jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Post by jortlaban »

I am using 1.7.0git6218-g7da44b6.
still wondering where scummVM installs, since that would be the simplest solution. Then I could just copy my required saves to there.
I don't see where the debug report would help.

I will check later tonight to get that though.
thanks in advance anyway.
jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Post by jortlaban »

Tried to get an error log, but no error came up.
It just keeps up stating: "D/AbsListView(24773): unregisterIRlistener () is called" over and over again.
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

OK. That build is from 2014-03-15, and no revelant Android fixes have been applied since, so this is not an "outdated" issue.

ScummVM installs to the internal Android storage as per other applications... I think this is a "secure" location (.android_secure IIRC) which is not available to user access unless you have rooted the device... but I am not an Android expert, so don't quote me on that.

Anyway, the point is to work out what the problem is with the external storage location as this should work fine... and even if we avoid it for now, it could come back to bite us again... hence my desire to see if there are any relevant details in the debug/error log.

I don't think that D/AbsListView debug is relevant... You should be able to filter it out with logcat or other tools.
I am specifically looking for any E/ (error) and W/ (Warning) lines associated after the information I/ lines for starting ScummVM.

Also, can you indicate exactly which games you are observing the save failures with? If you have only seen these with one game so far, try Flight of the Amazon Queen, Dreamweb and some of the other freeware games on our download page:
http://www.scummvm.org/games
to eliminate this being an engine specific issue.
jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Post by jortlaban »

All games that access the external card for saving fail.
Currently I just use the internal storage basic scummvm folder (scummvm/saves) which works fine.
I just have to remember this when I tinker with my phone.
Games work fine from the external storage by the way.
It's just the save issue.
jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Post by jortlaban »

To be more precise, when the "save error" occurs, no error is present in the log. I tried to generate some other errors with some tinkering, that will show up just fine.
It looks like the save error is basically just and access denied issue which Android doesn't register as an error.
My library consists of basically the entire Scumm library, some SCI games and 7th Guest.
Or at least on my phone.
The problem seems to be solely connected to the permissions to write to the external storage. Android 4.3 doesn't have this issue.
The games want to write to the external storage because my phone already had the same folder present on the external storage. Will try to reinstall the app and delete the folder to see what happens
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

Hmm... OK, so if you have seen this with SCUMM, SCI and Groovie, it is unlikely to be an engine specific issue.

As far as I know, we have correctly asked for the permissions for this:
https://github.com/scummvm/scummvm/blob ... xml.in#L49

So not sure why this should be failing...
mac_es
Posts: 145
Joined: Mon Oct 31, 2005 9:37 am

Post by mac_es »

Hello,

Here you have an explanation of what is going on this:

http://www.androidpolice.com/2014/02/17 ... ting-them/

ScummVM is doing all it can.... Android is stopping it from saving
digitall
ScummVM Developer
Posts: 1172
Joined: Thu Aug 02, 2012 1:40 pm

Post by digitall »

OH hell... that is retarded.

@jortlaban: Use the fix suggested here. You will need to have rooted your device:
http://www.androidpolice.com/2014/03/21 ... -required/
jortlaban
Posts: 21
Joined: Thu Nov 21, 2013 10:13 pm

Post by jortlaban »

For the first time ever I have rooted my phone.
Never needed it, never found it that usefull... until now.

Saves work fine now, some other apps that are non-scummvm related still seem to have some issues, but that is not something for this board.

Thanks for your efforts anyway. in someway it is reassuring that the problem lies solely with Android's stupid stance towards external SD-cards.
Post Reply