Bug 406707 - Copying files to KDE connect on android using Dolphin fails
Summary: Copying files to KDE connect on android using Dolphin fails
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: android-application (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
: 406385 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-04-20 15:09 UTC by michael.wagner
Modified: 2019-07-23 12:58 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: v1.12.7


Attachments
logcat show many exceptions (5.34 KB, text/plain)
2019-04-20 15:11 UTC, michael.wagner
Details
logcat for the crash described in previous comment (5.23 KB, text/plain)
2019-04-24 22:22 UTC, michael.wagner
Details
Logcat from reproduced occurence (69.64 KB, text/x-log)
2019-04-25 19:30 UTC, michael.wagner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description michael.wagner 2019-04-20 15:09:31 UTC
SUMMARY

STEPS TO REPRODUCE
1. In the App, configure a location for File-Browsing (in this case: "Music", located on the internal storage)
2. Access it from Dolphin with KDE - Reading files works
3. Try to copy a folder (here: "testfolder") containing a file ("test.txt")

OBSERVED RESULT
While the folder was created, any containing file could not be written to the mobile phone. Instead, many exception occured in logcat.

Sometimes, copying single files works, but more often it does not - however, copying whole folders never succeeded.

EXPECTED RESULT
The file "testfolder/test.txt" is copied to the mobile phone.

SOFTWARE/OS VERSIONS
Windows: -
macOS: -
Linux/KDE Plasma: Kubuntu 18.10, Kernel 4.18.0-17-generic
(available in About System)
KDE Plasma Version: 5.12.7
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5
kdeconnect: 1.3.3-0ubuntu0.18.04.1
Android App: 1.12.6
Mobile Phone: Samsung Galaxy S9 with latest Software (Android 9)

ADDITIONAL INFORMATION
Comment 1 michael.wagner 2019-04-20 15:11:23 UTC
Created attachment 119528 [details]
logcat show many exceptions
Comment 2 michael.wagner 2019-04-20 15:24:32 UTC
Please let me know if any other information or logs (e.g. I could not find the kdeconnect-log in KDE), or even try test-build of the app.
Comment 3 Erik Duisters 2019-04-23 18:11:03 UTC
Hi Michael,

I have not been able to reproduce this situation yet. I hope you can give me some more info.

- Are you only exposing Music or are you exposing the entire internal storage
- Can you give me a detailed listing of both the Music directory and the testfolder (ls -la)
- If possible your dolphin settings

I'll keep trying to reproduce on my side as well.
Comment 4 michael.wagner 2019-04-24 18:46:54 UTC
Hi,

my exposed folders are (according to apps settings):
"downloads" / "downloads"
"Music" / "primary:Music"

I'll add the ls -la later. What exactly do you mean by dolphin-settings? Which Menu-Entries of configfile?
Comment 5 michael.wagner 2019-04-24 22:20:29 UTC
For some reason, the SFTP-connection did not longer wok at all, so I wanted try a fresh re-installation of kdeconnect. I deleted App-Data, cache and uninstalled the app, and re-installed it afterwards - however, the exposed folders were still configured (in "Modul-Einstellungen" / "Dateisystem anzeigen") as "configured storage locations". Everytime I try to delete them, the app crashes (I'll attach the stacktrace as file - posting it as part of a comment is "blocked as spam"...).

Is there any chance to "cleanup" my kdeconnect-installation?
Comment 6 michael.wagner 2019-04-24 22:22:40 UTC
Created attachment 119618 [details]
logcat for the crash described in previous comment
Comment 7 Erik Duisters 2019-04-25 07:41:41 UTC
The crash when you try to delete a configured storage location has been fixed in master but it has not been released yet. For the time being you will have to de-install and then re-install kdeconnect on android. I'm still investigating how it is possible that after you configure exposing "Internal Storage/Music" android for some reason forgets this.
Comment 8 Erik Duisters 2019-04-25 07:49:18 UTC
*** Bug 406385 has been marked as a duplicate of this bug. ***
Comment 9 Christoph Feck 2019-04-25 08:14:26 UTC
Erik, is there still information needed from the reporter?
Comment 10 Erik Duisters 2019-04-25 08:18:47 UTC
(In reply to Christoph Feck from comment #9)
> Erik, is there still information needed from the reporter?

Yes, i have not been able to reproduce the problem yet
Comment 11 Erik Duisters 2019-04-25 14:13:28 UTC
When constructing the parentDocumentId of a subdirectory below a shared storage location the leading '/' was stripped from the path leading to a parentDocumentId of content://com.android.externalstorage.documents/tree/primary:Music/document/primary:Musictestfolder instead of
content://com.android.externalstorage.documents/tree/primary:Music/document/primary:Music/testfolder
Comment 12 michael.wagner 2019-04-25 15:42:03 UTC
Hi,

I´d like to add the info, but I somehow messed up my whole kdeconnect-installation (on the android-phone).
Your advice ("For the time being you will have to de-install and then re-install kdeconnect on android.") did not work for me - after deinstallation and fresh install, kdeconnect still remembers all previously configured storage locations (and my notebook as well).
How can I get completely rid of the configuration? ("delete app data" and "delete cache" prior to de-installation also did not help)...
Comment 13 Erik Duisters 2019-04-25 16:51:45 UTC
(In reply to michael.wagner from comment #12)
> Hi,
> 
> I´d like to add the info, but I somehow messed up my whole
> kdeconnect-installation (on the android-phone).
> Your advice ("For the time being you will have to de-install and then
> re-install kdeconnect on android.") did not work for me - after
> deinstallation and fresh install, kdeconnect still remembers all previously
> configured storage locations (and my notebook as well).
> How can I get completely rid of the configuration? ("delete app data" and
> "delete cache" prior to de-installation also did not help)...

That should not happen because we use standard android shared preferences to store the configured storage locations. When you uninstall the app those preferences are deleted
Comment 14 michael.wagner 2019-04-25 18:26:45 UTC
Thanks for the hint with the shared preferences. Actually, Android per default backs them up, and restores them on reinstallation, as I found here:
https://mobikul.com/application-restored-data-shared-preference-even-reinstall/

Now I managed to clean my installation, and can do further retests later.
Comment 15 michael.wagner 2019-04-25 19:30:15 UTC
Created attachment 119635 [details]
Logcat from reproduced occurence

I succeeded in reproducing the issue on a fresh installation on android (and on a new KDE profile).
The attached logcat shows:
- initial connection of kdeconnect to test@vademecum
- configuration the new storage location "primary:Testfolder_phone"
- copy the file "single_file.txt" to the phone using dolphin: OK
- copy the folder testfolder to the phone: folder is created, the contained file is NOT
- copy the file file2.txt to the phone: OK

The requested file-listing of the two folders is as follows:

test@vademecum:~$ ls -al testfolder/
insgesamt 12
drwxrwxr-x  2 test test 4096 Apr 24 23:53 .
drwxr-xr-x 19 test test 4096 Apr 25 21:11 ..
-rw-r--r--  1 test test    6 Apr 24 23:53 testfile.txt
test@vademecum:~$ ls -al /run/user/1001/dda7056acec3b75d/Testfolder_phone/
insgesamt 8
-rw-rw-rw- 1 test test 6 Apr 25 21:12 file2.txt
-rw-rw-rw- 1 test test 6 Apr 25 21:10 single_file.txt
drwxrwxrwx 1 test test 0 Apr 25 21:10 testfolder
test@vademecum:~$ ls -al /run/user/1001/dda7056acec3b75d/Testfolder_phone/testfolder/
insgesamt 0

I hope this helps - please let me know if further information is necessary.
Comment 16 Perles 2019-04-29 17:24:39 UTC
I am experiencing the very same issue. I run Gentoo Linux, KDEConnect 1.3.4 with Dolphin 18.12.3 and Plasma Desktop 5.14.5.1. My Android phone is a OnePlus 6 running Android 9. Same happens when I try to copy a folder from my computer to a Lenovo Tablet running Android 6.0.1. The folder gets created but nothing can be copied to the folder.
Comment 17 Albert Vaca Cintora 2019-07-23 12:58:58 UTC
Git commit 4be5800b8be20d3612904373e7e840fb24eb6b27 by Albert Vaca.
Committed on 23/07/2019 at 12:58.
Pushed by albertvaka into branch 'master'.

Disable google backups of the app

This was causing problems when a restored app remembered the list of
storage locations it had access to, but it no longer could access them.

In the past, this also caused problems when a restored app would carry
with it a certificate that was no longer valid on the new device because
the device id had changed.

M  +1    -0    AndroidManifest.xml

https://invent.kde.org/kde/kdeconnect-android/commit/4be5800b8be20d3612904373e7e840fb24eb6b27