android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java |    6 
++++++
 1 file changed, 6 insertions(+)

New commits:
commit 0306b029ab078a2e83ad4f1eee2d7b44ad85545e
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Fri Jul 3 23:07:47 2020 +0200
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Wed Jul 15 23:46:17 2020 +0200

    android: On ChromeOS, load files from Google Drive read-only.
    
    Apparently it is not possible to save to Google Drive yet.
    Unfortunately I don't have a proof in the documentation or anywhere on
    the net, but the good indication of this is that the
    Intent.ACTION_CREATE_DOCUMENT does not offer Google Drive (while it does
    on a "normal" Android).
    
    Change-Id: I521b866fd783b81a2bb9eace84354b5564ebabee
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97914
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git 
a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java 
b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
index 6111fc700..3374ff4ca 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -262,6 +262,12 @@ public class LOActivity extends AppCompatActivity {
 
             if 
(getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
                 isDocEditable = (getIntent().getFlags() & 
Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0;
+
+                // turns out that on ChromeOS, it is not possible to save back
+                // to Google Drive; detect it already here to avoid 
disappointment
+                if 
(getIntent().getData().toString().startsWith("content://org.chromium.arc.chromecontentprovider/externalfile"))
+                    isDocEditable = false;
+
                 if (!isDocEditable)
                     Toast.makeText(this, 
getResources().getString(R.string.temp_file_saving_disabled), 
Toast.LENGTH_SHORT).show();
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to