Signal-Android icon indicating copy to clipboard operation
Signal-Android copied to clipboard

Android "Share" menu does not display the most recent/shared-to contacts

Open breversa opened this issue 1 year ago • 12 comments

  • [x] I have searched open and closed issues for duplicates
  • [x] I am submitting a bug report for existing functionality that does not work as intended
  • [x] I have read https://github.com/signalapp/Signal-Android/wiki/Submitting-useful-bug-reports
  • [x] This isn't a feature request or a discussion topic

Bug description

When sharing a file from any another app, the suggested Signal contacts are neither the most recent ones, nor the most shared-to ones.

Steps to reproduce

  • open the file manager
  • select a file
  • tap the "Share" button

Actual result: The Android share menu suggests Signal contacts to share the file to, but these are not the most recent ones, nor the most frequently shared-to ones. They seem to be random. Also, the share menu icons take a few seconds to appear and be selectable.

Expected result: The Android menu should suggest the latest contacts I’ve interacted with, or those to whom I have the most frequently shared files with.

Screenshots

obscura1706781990793 (contacts blurred for privacy reasons)

Device info

Device: Samsung Galaxy S9 Android version: Android 11 (/e/OS 1.17) Signal version: 6.44.3

breversa avatar Feb 01 '24 10:02 breversa

I have the same issue, Pixel 7a Android 14 Logs: https://debuglogs.org/android/6.47.0/536158454094eb89bd6b8d4c580c488f4a1fc0226d5a634cd7f79a1fc6ee178b

tedgravlin avatar Feb 10 '24 03:02 tedgravlin

The sharesheet is managed by Android OS and we can't control the order in which those are shown. ref: https://developer.android.com/training/sharing/send

sudansh avatar May 11 '24 22:05 sudansh

But the targets list has to be fed to/read by the Android Sharesheet somehow, hasn't it? There's a reason why the targets are displayed in that order (even if the reason doesn't make sense)... 🤔

breversa avatar May 11 '24 22:05 breversa

The targets are fed but how they're cached and managed are on the OS.

alex-signal avatar May 13 '24 12:05 alex-signal

Yeah, it seems like other apps have the same problems, see:

  • https://android.stackexchange.com/questions/128053/removing-a-contact-from-direct-share-panel
  • Telegram-FOSS-Team/Telegram-FOSS#447

How about working around this issue by reducing the number of most recent contacts which is giving to the Android OS?

Currently, the contacts/groups I'm seeing in Android's share menu are chats number 20, 40 and 48 on Signal's main view ("Chats"), i.e., chats that are less important to me. Though the numbers are not fixed, i.e., if I archive chat number 19 on the list, Android's "Share" menu does not change. On the other hand, it does change if I archive one of the shown chats (20, 40, 48 in the original counting), Android's share menu gets updated, replacing the archived chats.

If I understand it correctly, Signal communicates the top chats to the Android OS, with the number determined by this code:

  public static int getMaxShortcuts(@NonNull Context context) {
    return Math.min(ShortcutManagerCompat.getMaxShortcutCountPerActivity(context), 150);
  }

(That code is used here)

It would be nice to know what this function returns in practice. Is it possible to attach a debugger such as gdb (via adb) to Signal running on my Android phone to figure this out? I couldn't find any guide/docs on Signal to do so and I'd expect I'd need debug symbols from Signal for that.

Anyway, assuming that the order of most recently used contacts, which Signal is reporting to Android (code here), is correct, it seems like Android is picking some arbitrary items off that list. In this case, this (Android) bug could be worked around by reducing the number of chats Signal reports to Android.

How about changing the limit from 150 to some lower value, e.g. 8? On a smartphone, depending on screen size and scale, Android will only display 3…5 most recent chats anyways. On a tablet it may or may not be more. So I'd expect there is no use in passing more than a dozen contacts to Android.

As a side-effect, Signal would not leak (most of) the chat list to Android so easily.

genodeftest avatar May 20 '24 09:05 genodeftest

Thank you for this in-depth analysis and solution suggestion!

breversa avatar May 20 '24 18:05 breversa

After updating my phone to Android 12 (/e/OS 2.1), I still have that issue, but the share menu appears without delay now, so that’s already a better thing.

breversa avatar Jun 19 '24 09:06 breversa

Erratum: Following the upgrade to Android 12, the share menu is not empty, with no contact suggestion. :-/ It doesn't disturb me a lot ; at least it's much quicker that way.

breversa avatar Jun 22 '24 13:06 breversa

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 23 '24 04:08 stale[bot]

The issue is still present in Signal on Android version 7.14.2 and the code has not changed.

genodeftest avatar Aug 29 '24 18:08 genodeftest

Can anyone who has signal installed on an android tablet (or a foldable phone or any other android device with a screen that is way larger than a regular smartphone) please check how many contacts/items are shown in the direct share panel? Do you see a number that is different from 4? Or do you also see 4 contacts to directly share with?

Why I'm asking: If Android will never show more than 4 items in the direct share panel, I would create a PR to change the code I mentioned above to make Signal only pass the top 4 contacts instead of the top 150.

genodeftest avatar Aug 29 '24 19:08 genodeftest

Sorry, I don't have such a device but I wholeheartedly support your suggestion.

breversa avatar Sep 03 '24 14:09 breversa

Despite the change I proposed being merged and the update rolled out months ago, I still see the same behavior. In other words, my change did not fix the problem, it is caused by something else.

@breversa or @greyson-signal can you please reopen this issue?

genodeftest avatar Apr 18 '25 14:04 genodeftest

Despite the change I proposed being merged and the update rolled out months ago, I still see the same behavior. In other words, my change did not fix the problem, it is caused by something else.

@breversa or @greyson-signal can you please reopen this issue?

I can confirm the same behaviour on Oneui 8 in both foldable screen sizes on Fold7.

oneguynick avatar Sep 06 '25 13:09 oneguynick