nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.14k stars 1.75k forks source link

Edit on the fly possible (*.xlsx, *.docx, *.txt ...)? #751

Closed kangaroo72 closed 6 years ago

kangaroo72 commented 7 years ago

Hello,

I've encountered following ...

Opening an excel-file from nc-android-app, editing and saving to cloud works directly on Android 6.0.1

The same procedure with Android 7.0 doesn't work anymore, 'cause the document is opened as "write-protected". Are privileges changed in 7.0??

Cheers,

Tom

Tested with Android App 1.4.2 on Android 6.0.1 & Android 7.0

AndyScherzinger commented 7 years ago

Hi Tom,

at least we didn't change anything here or implemented any Android version specific things, so my guess would then be an Android introduces permission change where we would have to look into then.

AndyScherzinger commented 7 years ago

Hi Tom,

actually just tested it (1.4.2 on Android 7.0) with a Word document and it works like a charm, did you since it a a different device then also set the excel file as available offline in the Nextcloud app? I did so and my local changes I can do are synced back and forth even though I didn't have an Excel file at hand so I used a Word file.

kangaroo72 commented 7 years ago

Just opened a word-file ... made available offline before ... but it's write protected in word (Samsung S7 - Android 7). Any other setting??

kangaroo72 commented 7 years ago

Checked on Note 5 (Android 6.0) - works ... Main problem is, that the word-doc is read-only ...

kangaroo72 commented 7 years ago

@AndyScherzinger are you using Word or an other app? I think the problem is "Word" ...

AndyScherzinger commented 7 years ago

@kangaroo72 yes, I use the Google Docs app to open/edit the Word document.

johnripper1 commented 7 years ago

I can confirm this on a Galaxy S7 with Android 7.0 latest pache level and latest Nextcloud client.

The MS Office Mobile Apps (Word, Excel, Powerpoint) only open there files in read only mode. With Google Docs, Tabels etc it works "on the fly".

I noted this since change to Android 7, but was sure if this is related to Nextcloud, Android or a changed behavior by the MS Office MObile Apps itself. But it worked with MS Office Mobile Apps in Android 6.

Unless the MS Office Mobile Apps work better than Google I would be happy if you bring them back.

mepreston commented 7 years ago

My phone was just upgraded to 7 last week. my android tablet 6 can edit documents and save the changes, when android 7 goes to save the changes are quietly lost so the client doesn't see any updates to upload. i don't have word, i use ES Note Editor for text doc updates.

mario commented 7 years ago

Unfortunately, this is a problem with MS Office apps that we cannot workaround :( Sorry folks!

Closing for now until they fix it.

mepreston commented 7 years ago

i do not use MS crap. i can reproduce it without MS crap. so while it may be a v7 issue it is not a MS issue

kangaroo72 commented 7 years ago

@tiggerfan ... You're using Android 7.0? On which mobile? Why I'm asking?? WebDav was also not working on 7.0 (using NGINX) 'cause 7.0 has the bug with ssl_curves ... But I don't know if this is coherently ... Would be interesting to know what a 7.1-device is doing ...

mepreston commented 7 years ago

i have a moto G4 plus and they just pushed out Andriod 7.0 last week and i upgraded. i didn't have issues before the upgrade. so this needs to be reopened as it has not been properly investigated.

kangaroo72 commented 7 years ago

same here ... but I'm using the Samsung Note 5 ... I'm thinking 'bout downgrading to 6.0.1 - there're more problems with Nougat which I have ...

mepreston commented 7 years ago

i haven't had any other issues. just not able to save documents in the nextcloud location when i change using "ES Note Editor"

kangaroo72 commented 7 years ago

are U using webdav-sync for contacts too?

mepreston commented 7 years ago

no, switch from owncloud to next a month ago and was using calDAV-Sync and CardDAV-Sync and kept them after i switched, they still work so i don't see any need to use webdav-sync

kangaroo72 commented 7 years ago

yep - that was what I mean - sorry. I've used DavDroid for this, and it was unable to connect to my nextcloud. This was that problem ... https://forums.bitfire.at/topic/1242/elliptic-curve-ciphers-not-available-on-android-7

mario commented 7 years ago

Will re-open and investigate more...

mario commented 7 years ago

From everything I've seen this is an issue with the other apps. If you try opening a Word file even from Google drive it will open only read only because it doesnt respect the intent. Same with some other apps...

ojamay commented 7 years ago

Hello, I use Android 7.0 on Samsung S7edge Stock and Nextcloud client 1.4.2.

I encounter the same issue :

A other similar change occurred since the last NC version :

Thanks

mario commented 7 years ago

Were you using the previous version with Android 7.0 as well?

ojamay commented 7 years ago

I updated to Android 7 before 29/03/2017 (my last system check update date). I think it worked with Android 7 and the previous NC version. But it's a two weeks window, so I won't swear on it. Thanks

tobiasKaminsky commented 7 years ago

@yamajo is the app on internal storage or external?

mario commented 7 years ago

Has nothing to do with it afaik. Its an issue with some apps not using requested permissions.

On Thu, 27 Apr 2017 at 16:35, Tobias Kaminsky notifications@github.com wrote:

@yamajo https://github.com/yamajo is the app on internal storage or external?

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/nextcloud/android/issues/751#issuecomment-297731992, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAWskVUCtfUzs9t5eEXgvQeAZJE0GJvks5r0KehgaJpZM4MfKMe .

ojamay commented 7 years ago

@tobiasKaminsky the app is on internal storage. On external storage it was always "read only" from the beginning and even when I was under OwnCloud. @mario yes, but it has been working for the previous months.

In waiting for a solution, I can use an external text editor to access directly the downloaded files on the data folder, without going through NC. And the offline available files I change like that are automaticaly uploaded.

Thanks for your concern.

mario commented 7 years ago

Android 7 changed quite a lot in how files are accessed though :-/ On Thu, 27 Apr 2017 at 16:46, Yamajo notifications@github.com wrote:

@tobiasKaminsky https://github.com/tobiasKaminsky the app is on internal storage. On external storage it was always "read only" from the beginning and even when I was under OwnCloud. @mario https://github.com/mario yes, but it has been working for the previous months.

In waiting for a solution, I can use an external text editor to access directly the downloaded files on the data folder, without going through NC. And the offline available files I change like that are automaticaly uploaded.

Thanks for your concern.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/nextcloud/android/issues/751#issuecomment-297735296, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAWsiEcNgv1DIb0X0-jyTmn7IZLZSLTks5r0KpIgaJpZM4MfKMe .

mario commented 7 years ago

Unfortunately closing :( All my investigations lead me to believe this is really a problem with 3rd party apps that we cannot workaround.

jeffsf commented 7 years ago

@mario I would definitely like to know what problems you've found with app permissions to be the root cause of this. I have been experiencing problems with pwsafe not being able to open files except in read-only mode. The program needs to be able to read, write, and create files (backups) in the directory in which the data file exists.

If it is a problem with the app, being able to guide the developer in a direction to resolve the issue would be very helpful. Any documented insight from you would be appreciated.

Thanks!

Android 7 (OmniROM) on Nexus 5x

https://play.google.com/store/apps/details?id=com.jefftharris.passwdsafe

kangaroo72 commented 7 years ago

That's what I wonder ... I'm still not satisfied in this direction. I don't use it often, so I can live with it. But in my eyes it's not (only) an 3rd-party problem. But I'm sorry - I'm only (advanced-)user. -Tom-

ojamay commented 7 years ago

I finally found a text editor that can open and write files: QuickEdit Pro. Also it works with Keepass2Android.

mepreston commented 7 years ago

i'm not a android developer but as a linux admin i do know something about file permissions. i also know how to do research into issues and look for possible resolutions. Android seems to limit apps to use only their data. so netcloud client has no problem access the files it has copied locally. The issue seems to be when another app wants to access files that are "owned" by netcloud. This seems to be a known issue in android that i would think any android developer would be well aware of. It seems these restrictions are becoming more restrictive as each major release of android is released. so a quick search comes up with this info about sharing files and data been android apps. Why isn't the developer for this app looking at this issue to make sure they are doing it properly?

https://developer.android.com/training/secure-file-sharing/index.html https://developer.android.com/training/secure-file-sharing/share-file.html https://stackoverflow.com/questions/18986611/access-permissions-during-android-file-sharing https://stackoverflow.com/questions/5745243/data-sharing-between-two-applications https://medium.com/google-developers/sharing-content-between-android-apps-2e6db9d1368b

cheers, m.

jeffsf commented 7 years ago

It's not just file permissions, but also SELinux security contexts. To the benefit of app developers, it isn't a wildly unreasonable assumption that your "working directory" is something that you have rwx privileges for, not some other user/app. That's the working assumption for just about every `nix program out there that accesses the file system, be it physical storage or device access.

The "file sharing" references, above, are more about sharing files by intent, through your app, not on the filesystem. The two apps need to have intimate knowledge of each other, and it is active IPC that is used, not that one directly opens the file that another has written. This is more for providing either high-level access to information (a calendar provider, for example), or the "share this" functionality ("send this photo by MMS/email/Bluetooth/...")

I'm still digging into the why with PasswdSafe, but the file permissions themselves set by nextcloud look reasonable. The files aren't "owned" by the nextcloud app, but appear to have reasonable permissions and SELinux context when exposed through /data/media/0/Android/data/com.nextcloud.android.beta/files/nextcloud/

-rw-rw-r-- 1 media_rw media_rw u:object_r:media_rw_data_file:s0

as well as when exposed through /storage/emulated/0/Android/data/com.nextcloud.android.beta/files/nextcloud/

rw-rw---- 1 u0_a141 sdcard_rw u:object_r:fuse:s0

At this point, I'm guessing that it will matter which path is used to access the data directory/file, as well as the contexts that the accessing app is permitted to use.

I've noted that PasswdSafe gets content://org.nextcloud.beta.files/external_files/emulated/0/Android/data/com.nextcloud.andriod.beta/files/nextcloud/... which may have something to do with its inability to write to the file/directory.

(Edit: This is pretty much the "normal" way to request another app to open a file.)

Edit: My next course of action, and perhaps helpful for other applications, is to see if the issue is write permission on the directory. At this point, I'm guessing that applications that need to write to the directory, be it for a temporary file or a new file are going to "fail" if the FileProvider is on the data file itself. Microsoft, at least on desktop OS, insists on opening a temp file the moment a file is opened, so it doesn't surprise me that it won't allow file edits if the directory is effectively read-only.

mario commented 7 years ago

There is something called "FLAG_GRANT_WRITE_URI_PERMISSION" through which you give third-party apps temporary access to your files. We use that (just like every other sane app), and it works for some applications, while (as of recently) it stopped working for some others.

We are looking into all issues, and have looked into this one as well. All debugging efforts hit a brick wall, and all help is appreciated.

jeffsf commented 7 years ago

I examined the current source for passwdsafe app and found that it was looking for .isWritable() which should return "true"

The version I was running off FDroid was very outdated. Current Play store version works as expected, allowing write, at least of the primary file (the one in the context passed from NextCloud to the "opener" app). At least in this case, the problem was with the app itself.

I haven't been able to configure/write backups in passwdsafe at this time, so I am unsure if the "directory-write" is a problem or not.

mario commented 7 years ago

@jeffsf ;)

mepreston commented 7 years ago

this issue is marked as closed, i think it should be reopened since this is still being investigated.

mario commented 7 years ago

I still think this is an issue with 3rd party apps. If you find it otherwise, I'm happy to re-open.

mario commented 7 years ago

@jeffsf what version of passwdsafe were you previously running, and which one are you running now?

jeffsf commented 7 years ago

The version from FDroid is identified as 5.2.0 by Titanium Backup and FDroid shows "Added on 2/11/15"

The version from Play is identified as 6.8.1 by Titanium Backup.

I don't immediately see a difference between the two in the code that determines the UI reflecting the ability to edit the target file. Both call uri.isWritable() in similar ways (though class and variable names have changed).

I am guessing that the difference in behavior may be related to the build as the Nougat SDK wasn't available in early 2015, as far as I know.

P.S. The issues of https://github.com/nextcloud/client_theming/issues/13 notwithstanding, this permits me to finally get off Dropbox and regain control of my own data.

mario commented 7 years ago

Yes, I was just checking that.

If the app that tries to open the file from NC has a lower build/target sdk it will open them read only.

Thanks for the testing!

On Wed, 7 Jun 2017 at 06:53, Jeff Kletsky notifications@github.com wrote:

The version from FDroid is identified as 5.2.0 by Titanium Backup and FDroid shows "Added on 2/11/15"

The version from Play is identified as 6.8.1 by Titanium Backup.

I don't immediately see a difference between the two in the code that determines the UI reflecting the ability to edit the target file. Both call uri.isWritable() in similar ways (though class and variable names have changed).

I am guessing that the difference in behavior may be related to the build as the Nougat SDK wasn't available in early 2015, as far as I know.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/nextcloud/android/issues/751#issuecomment-306686121, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAWsqQnhMqb7IsUO6Y-LDI_zTWrb5CHks5sBiyugaJpZM4MfKMe .

kangaroo72 commented 6 years ago

Now I sold my Samsung Note 5 (which I've downgraded to Android 6.0.1 'causing this issue). I'm using the Note 8 with Android 7.1.1 now, and again I have this issue ... but it seems that doesn't matter :-(

DaDirnbocher commented 6 years ago

I think there must have been a change from android 6.x to Android 7.x how opening files are passed to 3rd Party apps.

I have tried this with different settings:

All (*) combinations (android Version, android app, 3rd party app, cloud) are working except nextcloud app or owncloud app on android 7. It does not depend on the 3rd party app, it does not depend on the cloudversion. And it is working on Android 7 using ocloud.de-app.

The issue (in my case) is not that files are opened read only, the issue is that the are opened from another place (which is read only).

For example using nextcloud 1.4.3 with an account on a nextcloud 11-cloud and opening a *.xls file with DocsToGo is ...

my current workarounds on android 7 are:

(*) to be fair: i didn't really test all combinations but enough of them to be sure about this.

mario commented 6 years ago

I found a workaround for this: https://github.com/nextcloud/android/pull/1651

kangaroo72 commented 6 years ago

still no fixed version in sight for us ... :-( "pr exists" - does this mean "Pre Release exists"?? If so, where is this release? :-) is the fix implemented in the source-code? So I'm trying to compile? :-)

jakejoh commented 6 years ago

PR stands for pull request, so someone offered a solution to the problem which possibly could be implemented. See https://help.github.com/articles/about-pull-requests/

kangaroo72 commented 6 years ago

yep - just googled now :-P - thanks

AndyScherzinger commented 6 years ago

@kangaroo72 atm you could compile https://github.com/nextcloud/android/pull/1651 and install it on your device. It is also part of dev builds but for some reasons no new dev builds get created/published but we need @tobiasKaminsky for that so this won't happen before end of next week. :/ Sorry :(

kangaroo72 commented 6 years ago

@AndyScherzinger I've just installed the SDK and took a look ... without coding skills no chance :-(

AndyScherzinger commented 6 years ago

You don't need the coding skills ;) You just need to install the latest Android Studio 3 RC1 and open the cloned branch in Android Studio. At the top is a play button and in case Android Studio detects your device you ca install the app.

kangaroo72 commented 6 years ago

I'll try again later :-)