Problem sharing maps between users

Started by MvG, July 27, 2018, 12:36:59 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

MvG

I've got a device with (a) little internal memory but a big SD card and (b) multiple Android user accounts. As https://android.stackexchange.com/q/199620/33460">I wrote on Stack Exchange, getting write access for user accounts other than the owner of the device appears to be tricky. But I would be happy to have the owner download all the maps, while other users merely access those downloaded by the owner in a read-only fashion. However, this does not seem to work either. What I did was the following:



  • Install OruxMaps Donate from Play Store for both user accounts
    • Install some maps as owner of device
    • Move data to Ext. SD card using Settings / Application / Migrate to Ext. SD
    • Authorize whole SD card (Note] Wait for migration to finish
    • Note maps directory as /storage/0000-0000/oruxmaps/mapfiles
    • Switch to non-owner user account
    • Set maps directory as above
    • When asked to authorize, select No since the ext. SD card doesn't show up in that dialog anyway
    • Refresh list of maps
    [/list]

    But even though the owner can use the downloaded maps, they don't show up for the other user. Could it be that OruxMaps requires write access even to read maps? I could use another app (Total Commander) to copy one file from the mapfiles directory, so reading the file does not seem to be a problem in general, only under OruxMaps.

  • orux

    #1
    Quote from: MvG post_id=13914 time=1532644619 user_id=7800
    I've got a device with (a) little internal memory but a big SD card and (b) multiple Android user accounts. As https://android.stackexchange.com/q/199620/33460">I wrote on Stack Exchange, getting write access for user accounts other than the owner of the device appears to be tricky. But I would be happy to have the owner download all the maps, while other users merely access those downloaded by the owner in a read-only fashion. However, this does not seem to work either. What I did was the following:



    • Install OruxMaps Donate from Play Store for both user accounts
    • Install some maps as owner of device
    • Move data to Ext. SD card using Settings / Application / Migrate to Ext. SD
    • Authorize whole SD card (Note] Wait for migration to finish
    • Note maps directory as /storage/0000-0000/oruxmaps/mapfiles
    • Switch to non-owner user account
    • Set maps directory as above
    • When asked to authorize, select No since the ext. SD card doesn't show up in that dialog anyway
    • Refresh list of maps
    [/list]

    But even though the owner can use the downloaded maps, they don't show up for the other user. Could it be that OruxMaps requires write access even to read maps? I could use another app (Total Commander) to copy one file from the mapfiles directory, so reading the file does not seem to be a problem in general, only under OruxMaps.




  • Hello;



    Of course, you can create a folder in the SD card, and give only permission for that folder to the app.



    Android manages what folders/files each app can see. If you refresh the map list, and no maps are there is because Android itself doesn't give that information to the app.



    For using the maps, the app always can access the external storage, the write permission is only needed for creating new maps.



    orux

    MvG

    #2
    Thanks for the quick reply.


    Quote from: orux post_id=13916 time=1532685707 user_id=2
    Of course, you can create a folder in the SD card, and give only permission for that folder to the app.


    Works if I select the directories manually, but not if I want to use the Migrate to Ext. SD function. That's complaining about some kind of access issue, haven't noted the exact wording. Presumably it attemts to create the already existing directory, which either fails because it already exists, or fails because the App doesn't have access to the parent which would be required. But this is me guessing, and I can't reproduce this after having granted access to the full SD card.


    Quote from: orux post_id=13916 time=1532685707 user_id=2
    Android manages what folders/files each app can see. If you refresh the map list, and no maps are there is because Android itself doesn't give that information to the app.


    There has to be something specific to the App here. As I wrote, at least one other app is able to copy (and therefore also read) these files. And that's an app I installed myself, so no special OEM powers there. The directory selection dialog in OruxMaps does show the map files, too. But the maps never appear in the list of offline maps. Is there some log or similar which would contain details on why reading these files failed?


    Quote from: orux post_id=13916 time=1532685707 user_id=2
    For using the maps, the app always can access the external storage, the write permission is only needed for creating new maps.


    On the one hand, I'm glad to hear that, since it makes a lot of sense this way. On the other hand, this invalidates my guess at an explanation for the behavior I'm seeing, so now I'm somewhat clueless as to why OruxMaps will show the files but not show the maps.



    I know this may require some work, but have you tried reproducing my issue? My feeling would be that this problem should not be specific to me, but applicable to any two-account setup with SD card. If so, having access to a reproducing environment might help you investigate the issue without round-trips to me.



    If you can't reproduce, I will have to dig deeper to see what makes my setup special. In that case, would you be willing to share the relevant lines of code you use to list, open and read the files in the mapfiles directory? In paricular, what API are you using, and what flags? I have little experience with Android app development so far, but I guess I could probably write a small app reproducing this behavior, see whether I can get it to fail in the same way.

    orux

    #3
    Quote from: MvG post_id=13923 time=1532699933 user_id=7800
    Thanks for the quick reply.


    Quote from: orux post_id=13916 time=1532685707 user_id=2
    Of course, you can create a folder in the SD card, and give only permission for that folder to the app.


    Works if I select the directories manually, but not if I want to use the Migrate to Ext. SD function. That's complaining about some kind of access issue, haven't noted the exact wording. Presumably it attemts to create the already existing directory, which either fails because it already exists, or fails because the App doesn't have access to the parent which would be required. But this is me guessing, and I can't reproduce this after having granted access to the full SD card.


    Quote from: orux post_id=13916 time=1532685707 user_id=2
    Android manages what folders/files each app can see. If you refresh the map list, and no maps are there is because Android itself doesn't give that information to the app.


    There has to be something specific to the App here. As I wrote, at least one other app is able to copy (and therefore also read) these files. And that's an app I installed myself, so no special OEM powers there. The directory selection dialog in OruxMaps does show the map files, too. But the maps never appear in the list of offline maps. Is there some log or similar which would contain details on why reading these files failed?


    Quote from: orux post_id=13916 time=1532685707 user_id=2
    For using the maps, the app always can access the external storage, the write permission is only needed for creating new maps.


    On the one hand, I'm glad to hear that, since it makes a lot of sense this way. On the other hand, this invalidates my guess at an explanation for the behavior I'm seeing, so now I'm somewhat clueless as to why OruxMaps will show the files but not show the maps.



    I know this may require some work, but have you tried reproducing my issue? My feeling would be that this problem should not be specific to me, but applicable to any two-account setup with SD card. If so, having access to a reproducing environment might help you investigate the issue without round-trips to me.



    If you can't reproduce, I will have to dig deeper to see what makes my setup special. In that case, would you be willing to share the relevant lines of code you use to list, open and read the files in the mapfiles directory? In paricular, what API are you using, and what flags? I have little experience with Android app development so far, but I guess I could probably write a small app reproducing this behavior, see whether I can get it to fail in the same way.




    Hello!



    Tested with a Xiaomi A1, different users can share maps in a folder in the external SD card.



    Depending on your settings, did you tested a manual refresh of map list (map selector view, top button bar)?





    orux

    MvG

    #4
    Quote from: orux post_id=13927 time=1532704095 user_id=2
    Depending on your settings, did you tested a manual refresh of map list (map selector view, top button bar)?


    Yes, I had pressed the reload button.


    Quote from: orux post_id=13927 time=1532704095 user_id=2
    Tested with a Xiaomi A1, different users can share maps in a folder in the external SD card.


    Thanks a lot for trying this, since it helps narrow things down.



    I just toyed a bit more with this, and found that I could exit OruxMaps (pressing back button twice, then also swiping from usual system list of running apps) and upon restart the maps would be there. Success!



    So it appears that there either is some problem with the manual refresh, or some problem with the propagation of settings.