[sword-devel] Where does Bishop store SWORD files on Android?
Troy A. Griffitts
scribe at crosswire.org
Thu Jan 7 18:00:32 EST 2021
Thanks Tobias, Timmy, and everyone contributing to this discussion. I
did a quick search and this page has been helpful. It recommends opting
out by using the requestLegacyExternalStorage options you've also
suggested, but if I understand things correctly, it says this will
basically make Android 10 work like Android 11 will work, so that sounds
promising. I need to make a few small updated to Bishop and release a
new build in the next days. I'll add the option and see if we do better
on Android 10 and I'll try both our oldest supported Android 4.4 env and
an Android 11 emulator to see how it goes across the spectrum.
Thanks again for having a look into this!
Troy
On 1/7/21 2:21 PM, Tobias Klein wrote:
>
> Regarding the /sdcard issues I reported with Bishop I think it is
> actually due to the changes Google introduced in API level 29 /
> Android 10 (see Timmy's earlier post).
>
> I was previously compiling my Ezra Project debug app for API level 26
> and there I didn't have issues reading/writing /sdcard.
> But with API level 29 / Android 10 I also faced issues reading/writing
> /sdcard with my test app (got a permission denied message in adb logcat).
>
> To fix that I added the following option in config.xml in the Android
> platform section:
>
> <edit-configfile="app/src/main/AndroidManifest.xml"mode="merge"target="/manifest/application"xmlns:android="http://schemas.android.com/apk/res/android">
> <applicationandroid:requestLegacyExternalStorage="true"/>
> </edit-config
>
> @Troy
> Can you add that option to the Bishop configuration? I fear it
> otherwise cannot read/write /sdcard on Android 10 or later.
>
> See also:
> https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage
> I have not found out yet how to use the new "Scoped Storage" model in
> native code (C/C++). The thing is that Google is already creating
> facts by not supporting the "legacy model" any longer starting from
> Android 11:
> *Caution:* After you update your app to target Android 11 (API
> level 30), the system ignores
> the |requestLegacyExternalStorage| attribute
> <https://developer.android.com/about/versions/11/privacy/storage#scoped-storage> when
> your app is running on Android 11 devices, so your app must be ready
> to support scoped storage and to migrate app data
> <https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage> for
> users on those devices.
> Best regards, Tobias
>
> On 1/2/21 4:37 PM, Troy A. Griffitts wrote:
>> It's not used for anything in particular, just as a write test. We
>> used to store (I guess we still do) stuff in a [globals] section like
>> a directory to scan for new module when SWORD first starts up and
>> then it would install those, letting an external program or user just
>> dump stuff to a folder, which would get install the next time their
>> app started up. That was typically used when we supported individual
>> module downloads by users from our webserver, but we discourage that
>> now and instead encourage use of installmgr.
>>
>> Anyway, you found exactly the problem. SWORD couldn't write to
>> /sdcard/sword.
>>
>> I suspect maybe file permission?
>>
>> We should probably all read up on the changes Timmy mentions.
>>
>> I would try this, remove /sdcard/sword entirely and see what Bishop does.
>>
>> I have had troubles myself making changes to my sdcard, using adb
>> shell to cd to /sdcard and mkdir xyz, then using a file browser and
>> looking on the sdcard and not seeing my folder. I wonder if it has
>> anything to do with the multiple profile support, i.e., can one user
>> take a photo to the sdcard and then change profiles on the phone and
>> have another user see that photo.
>>
>> Anyway, it seems we need to read and experiment a bit.
>>
>> Troy
>>
>> On January 2, 2021 2:49:52 AM MST, Tobias Klein <contact at tklein.info>
>> wrote:
>>
>> Ok!
>>
>> Below is a full dump of adb logcat | grep libsword.
>>
>> Seems like this is the key section, though:
>>
>> 01-02 10:35:25.259 5450 5538 D libsword.so: libsword: init()
>> sword config not found, attempting to create parent of:
>> /sdcard/sword/mods.d/globals.conf
>> 01-02 10:35:25.260 5450 5538 D libsword.so: libsword: init()
>> saving basic: /sdcard/sword/mods.d/globals.conf
>> 01-02 10:35:25.260 5450 5538 D libsword.so: libsword: init()
>> sword config STILL not found, attempting to create parent of:
>> /data/user/0/org.crosswire.bishop/files/mods.d/globals.conf
>> 01-02 10:35:25.262 5450 5538 D libsword.so: libsword: init()
>> saving basic:
>> /data/user/0/org.crosswire.bishop/files/mods.d/globals.conf
>>
>> What is mods.d/globals.conf used for? It seems like this file is
>> missing in my existing SWORD file structure.
>>
>> Best regards,
>> Tobias
>>
>> Complete log:
>>
>> 01-02 10:35:25.258 5450 5538 I libsword.so: LOOKING UP LOCALE
>> DIRECTORY...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking for
>> provided SWConfig("sword.conf")...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking working
>> directory for sword.conf...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking working
>> directory for mods.conf...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking working
>> directory for mods.d...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking working
>> directory ../library/ for mods.d...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking $SWORD_PATH...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Parsing
>> /etc/sword.conf:/usr/local/etc/sword.conf...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking for
>> /etc/sword.conf...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking for
>> /usr/local/etc/sword.conf...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking
>> $ALLUSERSPROFILE/Application Data/sword/...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking
>> $HOME/Library/Application Support/Sword/...
>> 01-02 10:35:25.258 5450 5538 I libsword.so: Checking home
>> directory for ~/.sword...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: LOOKING UP LOCALE
>> DIRECTORY COMPLETE.
>> 01-02 10:35:25.259 5450 5538 I libsword.so: LOOKING UP LOCALE
>> DIRECTORY...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking for
>> provided SWConfig("sword.conf")...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking working
>> directory for sword.conf...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking working
>> directory for mods.conf...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking working
>> directory for mods.d...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking working
>> directory ../library/ for mods.d...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking $SWORD_PATH...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Parsing
>> /etc/sword.conf:/usr/local/etc/sword.conf...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking for
>> /etc/sword.conf...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking for
>> /usr/local/etc/sword.conf...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking
>> $ALLUSERSPROFILE/Application Data/sword/...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking
>> $HOME/Library/Application Support/Sword/...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: Checking home
>> directory for ~/.sword...
>> 01-02 10:35:25.259 5450 5538 I libsword.so: LOOKING UP LOCALE
>> DIRECTORY COMPLETE.
>> 01-02 10:35:25.259 5450 5538 D libsword.so: libsword: init() begin
>> 01-02 10:35:25.259 5450 5538 D libsword.so: libsword: init()
>> sword config not found, attempting to create parent of:
>> /sdcard/sword/mods.d/globals.conf
>> 01-02 10:35:25.260 5450 5538 D libsword.so: libsword: init()
>> saving basic: /sdcard/sword/mods.d/globals.conf
>> 01-02 10:35:25.260 5450 5538 D libsword.so: libsword: init()
>> sword config STILL not found, attempting to create parent of:
>> /data/user/0/org.crosswire.bishop/files/mods.d/globals.conf
>> 01-02 10:35:25.262 5450 5538 D libsword.so: libsword: init()
>> saving basic:
>> /data/user/0/org.crosswire.bishop/files/mods.d/globals.conf
>> 01-02 10:35:25.263 5450 5538 D libsword.so: libsword:
>> extraConfig Exists at path:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf
>> 01-02 10:35:25.263 5450 5538 D libsword.so: libsword: init()
>> creating WebMgr using path: /data/user/0/org.crosswire.bishop/files
>> 01-02 10:35:25.267 5450 5538 I libsword.so: Checking at
>> provided path: /data/user/0/org.crosswire.bishop/files/...
>> 01-02 10:35:25.267 5450 5538 I libsword.so: Found mods.d/
>> 01-02 10:35:25.267 5450 5538 D libsword.so: libsword: WebMgr
>> c-tor(path: /data/user/0/org.crosswire.bishop/files,
>> extraConfPath:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf)
>> 01-02 10:35:25.267 5450 5538 D libsword.so: libsword:
>> WebMgr::c-tor extraConfPath supplied:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf)
>> 01-02 10:35:25.267 5450 5538 I libsword.so: LOADING MODULE
>> CONFIGURATIONS...
>> 01-02 10:35:25.267 5450 5538 I libsword.so: LOADING MODULE
>> CONFIGURATIONS COMPLETE.
>> 01-02 10:35:25.267 5450 5538 I libsword.so: LOADING MODULE
>> LIBRARY...
>> 01-02 10:35:25.268 5450 5538 D libsword.so: libsword:
>> WebMgr::createAllModules
>> 01-02 10:35:25.268 5450 5538 D libsword.so: libsword:
>> WebMgr::createAllModules extraConfig supplied:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf)
>> 01-02 10:35:25.268 5450 5538 D libsword.so: libsword:
>> WebMgr::createAllModules extraConfig exists. Augmenting modules
>> config
>> 01-02 10:35:25.269 5450 5538 D libsword.so: libsword:
>> SWMgr::createAllModules
>> 01-02 10:35:25.269 5450 5538 I libsword.so: LOADING MODULE
>> LIBRARY COMPLETE.
>> 01-02 10:35:25.269 5450 5538 D libsword.so: libsword: init()
>> augmenting modules from:
>> /sdcard/Android/data/net.bible.android.activity/files
>> 01-02 10:35:25.269 5450 5538 D libsword.so: libsword: init()
>> augmenting modules from: /sdcard/sword
>> 01-02 10:35:25.269 5450 5538 D libsword.so: libsword: init()
>> adding locales from baseDir.
>> 01-02 10:35:25.269 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading
>> /data/user/0/org.crosswire.bishop/files/locales.d
>> 01-02 10:35:25.269 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading
>> /data/user/0/org.crosswire.bishop/files/uilocales.d
>> 01-02 10:35:25.269 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading /sdcard/sword/locales.d
>> 01-02 10:35:25.269 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading /sdcard/sword/uilocales.d
>> 01-02 10:35:25.269 5450 5538 D libsword.so: libsword: init() end.
>> 01-02 10:35:25.413 5450 5538 D libsword.so: setting
>> STORAGE_BASE to: /data/user/0/org.crosswire.bishop/files
>> 01-02 10:35:25.416 5450 5538 D libsword.so: libsword: init() begin
>> 01-02 10:35:25.416 5450 5538 D libsword.so: libsword: init()
>> sword config not found, attempting to create parent of:
>> /sdcard/sword/mods.d/globals.conf
>> 01-02 10:35:25.417 5450 5538 D libsword.so: libsword: init()
>> saving basic: /sdcard/sword/mods.d/globals.conf
>> 01-02 10:35:25.417 5450 5538 D libsword.so: libsword: init()
>> sword config STILL not found, attempting to create parent of:
>> /data/user/0/org.crosswire.bishop/files/mods.d/globals.conf
>> 01-02 10:35:25.417 5450 5538 D libsword.so: libsword: init()
>> saving basic:
>> /data/user/0/org.crosswire.bishop/files/mods.d/globals.conf
>> 01-02 10:35:25.417 5450 5538 D libsword.so: libsword:
>> extraConfig Exists at path:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf
>> 01-02 10:35:25.417 5450 5538 D libsword.so: libsword: init()
>> creating WebMgr using path: /data/user/0/org.crosswire.bishop/files
>> 01-02 10:35:25.418 5450 5538 I libsword.so: Checking at
>> provided path: /data/user/0/org.crosswire.bishop/files/...
>> 01-02 10:35:25.418 5450 5538 I libsword.so: Found mods.d/
>> 01-02 10:35:25.418 5450 5538 D libsword.so: libsword: WebMgr
>> c-tor(path: /data/user/0/org.crosswire.bishop/files,
>> extraConfPath:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf)
>> 01-02 10:35:25.418 5450 5538 D libsword.so: libsword:
>> WebMgr::c-tor extraConfPath supplied:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf)
>> 01-02 10:35:25.418 5450 5538 I libsword.so: LOADING MODULE
>> CONFIGURATIONS...
>> 01-02 10:35:25.419 5450 5538 I libsword.so: LOADING MODULE
>> CONFIGURATIONS COMPLETE.
>> 01-02 10:35:25.419 5450 5538 I libsword.so: LOADING MODULE
>> LIBRARY...
>> 01-02 10:35:25.419 5450 5538 D libsword.so: libsword:
>> WebMgr::createAllModules
>> 01-02 10:35:25.419 5450 5538 D libsword.so: libsword:
>> WebMgr::createAllModules extraConfig supplied:
>> /data/user/0/org.crosswire.bishop/files/extraConfig.conf)
>> 01-02 10:35:25.419 5450 5538 D libsword.so: libsword:
>> WebMgr::createAllModules extraConfig exists. Augmenting modules
>> config
>> 01-02 10:35:25.419 5450 5538 D libsword.so: libsword:
>> SWMgr::createAllModules
>> 01-02 10:35:25.419 5450 5538 I libsword.so: LOADING MODULE
>> LIBRARY COMPLETE.
>> 01-02 10:35:25.419 5450 5538 D libsword.so: libsword: init()
>> augmenting modules from:
>> /sdcard/Android/data/net.bible.android.activity/files
>> 01-02 10:35:25.420 5450 5538 D libsword.so: libsword: init()
>> augmenting modules from: /sdcard/sword
>> 01-02 10:35:25.420 5450 5538 D libsword.so: libsword: init()
>> adding locales from baseDir.
>> 01-02 10:35:25.420 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading
>> /data/user/0/org.crosswire.bishop/files/locales.d
>> 01-02 10:35:25.420 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading
>> /data/user/0/org.crosswire.bishop/files/uilocales.d
>> 01-02 10:35:25.420 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading /sdcard/sword/locales.d
>> 01-02 10:35:25.420 5450 5538 D libsword.so:
>> LocaleMgr::loadConfigDir loading /sdcard/sword/uilocales.d
>> 01-02 10:35:25.420 5450 5538 D libsword.so: libsword: init() end.
>> 01-02 10:35:25.420 5450 5538 D libsword.so: getModInfoList
>> returning 0 length array
>> 01-02 10:35:25.456 5450 5538 W libsword.so:
>> LocaleMgr::getLocale failed to find locales
>> 01-02 10:35:25.460 5450 5538 W libsword.so:
>> LocaleMgr::getLocale failed to find locales
>>
>> On 1/1/21 10:57 PM, Troy A. Griffitts wrote:
>>> Hmmm. That's odd. If you can adb logcat your tablet while it is
>>> plugged into your laptop and have a look at the output when
>>> Bishop starts up, it might give us a clue. Bishop is pretty
>>> noisy to the logs. The detection logic is located in init(), here:
>>>
>>> https://crosswire.org/svn/sword/trunk/bindings/java-jni/jni/swordstub.cpp
>>> <https://crosswire.org/svn/sword/trunk/bindings/java-jni/jni/swordstub.cpp>
>>>
>>>
>>>
>>> On January 1, 2021 2:18:29 PM MST, Tobias Klein
>>> <contact at tklein.info> wrote:
>>>
>>> Thanks Troy!
>>>
>>> I see this working with Bishop on my phone (Android 8.1.0).
>>> There Bishop reads from and writes to /sdcard/sword.
>>>
>>> However, it is not working on my Tablet (Android 10). I do
>>> have SWORD directories there with this structure:
>>> /sdcard/sword
>>> /sdcard/sword/installMgr
>>> /sdcard/sword/mods.d
>>> /sdcard/sword/modules
>>>
>>> When starting Bishop on the Tablet it asks for permissions
>>> and after confirmation it does not show any existing modules
>>> based on the structure above.
>>>
>>> Best regards,
>>> Tobias
>>>
>>> Am 1. Januar 2021 21:34:00 schrieb "Troy A. Griffitts"
>>> <scribe at crosswire.org>:
>>>
>>>> Yes, that's exactly right. Upon install, Bishop asks for
>>>> permissions to read and right files to /sdcard/sword/. If
>>>> it is able, it does, if not, it writes to its app’s private
>>>> data area.
>>>>
>>>> I don't believe there is anything like this available on
>>>> iOS, but I am no expert. I would be interested to learn how
>>>> iOS handles other common data files which have multiple
>>>> apps needing the ability to read and write, like photos.
>>>>
>>>> Thanks for wanting to coordinate on where files are stored.
>>>>
>>>> Troy
>>>>
>>>> On January 1, 2021 1:07:16 PM MST, Tobias Klein
>>>> <contact at tklein.info> wrote:
>>>>
>>>> Hi Troy!
>>>>
>>>> Happy new year!
>>>>
>>>> Where does Bishop store the SWORD data files on
>>>> Android? I was browsing the filesystem but could not
>>>> find the respective directory.
>>>>
>>>> I am asking because I am working on Android support for
>>>> node-sword-interface and I wanted to align this and use
>>>> a common place for the SWORD data files. So far I
>>>> thought /sdcard/sword would be the right place.
>>>>
>>>> Best regards,
>>>> Tobias
>>>>
>>>>
>>>> --
>>>> Sent from my Android device with K-9 Mail. Please excuse my
>>>> brevity.
>>>
>>>
>>> --
>>> Sent from my Android device with K-9 Mail. Please excuse my
>>> brevity.
>>>
>>> _______________________________________________
>>> sword-devel mailing list: sword-devel at crosswire.org
>>> http://crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
>>
>>
>> --
>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20210107/603eee8f/attachment-0001.html>
More information about the sword-devel
mailing list