Android applications hijack^Wclaim MIME type associations

REPRODUCIBILITY: 100%
OS VERSION: 4.4.0.64
HARDWARE: X10III
UI LANGUAGE: en_GB
REGRESSION: unknonwn

DESCRIPTION:

Desktop files derived from Android packages can include a MimeType= tag.

Depending on the associations that package specifies, this can lead to an app “hijacking” a whole class of file mime types, or certain mimetypes which may not be wanted by the user.

See below for an example, in which the .apk claims to support the mime type text/*, which leads to an entry in the mimecache, which apparently overrides any other MimeType that is registered from other apps.

It would seem there are in fact two issues with wildcard use in types:

  • Mime Type foo/* leads to the app hijacking all file associations, overriding more specific assignments by other apps, so only one app appears in the chooser.
  • Mime handler type x-scheme-handler/* leads to the app appearing on any and all “open URL” type events. See comment below for an app that does this.

PRECONDITIONS:

Example: Install the application “Nextcloud Notes” (https://f-droid.org/is/packages/it.niedermann.owncloud.notes/)

STEPS TO REPRODUCE:

  1. stop Android Support
  2. create a text file called ‘text.log’ containg some ascii text. depending on the tool you use, the mime type might be text/x-log or text/plain
  3. tap on the file using a file manager

→ SFOS opens the file in nextcloud notes, starts Android Support to do it

EXPECTED RESULT:

A prompt to select the text editing/viewing application from a list of text-supporting apps, e.g. Sailfish Office

ACTUAL RESULT:

File is opened automatically without prompt (just the popup that the application may start in the backfround)

MODIFICATIONS:

Lots, but probably none which affect this:

  • defaultuser → nemo
  • patchmanager and mostly Silica patches

WRT applications and MIME types, I have a couple of custom files in ~/.local/share/applications, but nothing modified in /usr/share/applications

ADDITIONAL INFORMATION:

Query the file association:

$ lca-tool --file --print file:///home/nemo/test.log
apkd_handler_it_niedermann_owncloud_notes-it_niedermann_owncloud_notes_edit_EditNoteActivity

look in /usr/share/applications/apkd_handler_it_niedermann_owncloud_notes-it_niedermann_owncloud_notes_edit_EditNoteActivity.desktop

find that it has:

MimeType=text/*

look in /usr/share/applications/mimeinfo.cache and find the corresponding

text/*=apkd_handler_it_niedermann_owncloud_notes-it_niedermann_owncloud_notes_edit_EditNoteActivity.desktop

The text/* assiciation comes from the Android Manifest directive here:

1 Like

Another example is the app ‘Lite Uptodown App Store’ which claims to handle application/* and x-scheme-handler/*.

Question: is there any use case where associating foo/* makes sense?

I can’t think of any.See below for an example, in which the .apk claims to support the mime type text/*, which leads to an entry in the mimecache, which apparently overrides any other MimeType that is registered from other apps.

If there is not probably the easiest fix would be for either apkd or update-desktop-database to ignore wildcard assignments.

Or, allow them for things where they might be lazy but somewhat reasonable, like text, image, audio, video, but not for general things like application and scheme-handler. where a wild card assignment is obviously lazy and wrong.

In any case, wildcard-claiming apps should be added to the chooser (and if possible ordered last), not replace all others, properly configured applications.

1 Like

Thanks for reporting this @nephros. I’ve created an internal bug report about it and tagged it as tracked.

2 Likes

Additional info:

If you remove the wildcard entry from the .desktop file and update the app/mime cache, the issue goes away.

However either starting/stopping Android Support, upr updating an Android app (not the affected one!) makes it reappear.