Public bug reported:

When an Android phone is plugged in over USB (MTP), unity-fallback-
mount-helper shows:

    Unable to open a folder for SAMSUNG Android
    Object does not exist at path "/org/gtk/vfs/mount/1"

Steps to reproduce:
1. Plug an Android phone (tested: Samsung Galaxy Note20, Android 13) with 
media-handling `automount-open` enabled (default).
2. The phone shows "Allow access to phone data?". Wait a few seconds, then tap 
"Allow".
3. The error dialog above appears. The phone storage is actually mounted and 
usable from the file manager.

Screenshot of the dialog (French locale):
https://gitlab.com/bigbob.fun/unity-settings-
daemon/-/raw/assets/automount-mtp/error-dialog.png

Cause: until access is allowed on the phone, gvfs mounts the device with
no storage. Once access is allowed, gvfs replaces that mount with a new
one (same `mtp://` URI). The automount plugin already asked to open a
folder for the first mount, which no longer exists, so `gtk_show_uri()`
fails with `G_DBUS_ERROR_UNKNOWN_OBJECT`. The original `GMount` object
is still listed by the volume monitor, so this cannot be detected by
checking for the mount alone.

Proposed fix (merge request linked below):
- Detect this precise case: opening fails with a "stale mount" error on a 
non-native mount, and the same URI has content again within 10 seconds.
- In that case, open the folder anyway and show a short explanation with a 
per-device choice: "Yes" (from now on, wait until the device has content before 
opening it, up to 60 s), "No", or "Don't ask again".
- The choice is stored per mount URI (which includes the device serial) in 
`~/.config/unity-settings-daemon/automount-devices.conf`.
- New small window, "Delayed Device Opening" (`unity-automount-devices`, with a 
desktop entry), to review, change or remove the registered devices.
- Any other error keeps the existing "Unable to open a folder" dialog.

Tested on Ubuntu 22.04 (unity-settings-daemon
15.04.1+21.10.20220207-0ubuntu1 rebuilt with the patch): detection,
"Yes" choice, then registered-device behaviour on later plug-ins (single
window, no error). The patch applies to `ubuntu/devel`
(15.04.1+21.10.20220802-0ubuntu7) and the changed files pass a strict
`gcc -fsyntax-only` check there; a full build and run on the development
release was not done.

** Affects: unity-settings-daemon (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2175476

Title:
  unity-fallback-mount-helper: "Unable to open a folder for <phone>"
  when an Android (MTP) phone is plugged in

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity-settings-daemon/+bug/2175476/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to