Skip to content

[$250] Android - Notification shortcut are not display when longpress app icon #96377

Closed

Description

@nlemma

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.4.36-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/Expensify/issues/430593
Email or phone of affected tester (no customers): -
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Google Pixel 7 Pro - Android 16

Action Performed:

Precondition: 2 accounts log in 2 devices

  1. Log in to NewDot on Android native
  2. Accept notification permission
  3. Leave the app
  4. Send yourself a DM from another account
  5. Long-press on the app icon
  6. Verify that the message notification is displayed as a shortcut

Expected Result:

Verify that the message notification is displayed as a shortcut

Actual Result:

Missing notification shortcut

PLEASE ALSO RETEST THIS RELATED ISSUE: #96978

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7182481_1781621140898.430593.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 17, 2026
  2. MelvinBot commented on Jul 17, 2026

    @MelvinBot

    Proposal

    What is the root cause of that problem?

    The Android conversation shortcut is created natively while the push notification is being built, not from JS. When a DM push arrives, Airship invokes CustomNotificationProvider.applyMessageStyle(), which calls ShortcutManagerUtils.addDynamicShortcut() → ShortcutManagerCompat.pushDynamicShortcut(), then links the notification to it with builder.setShortcutId(accountID). All the ingredients Android needs (long-lived shortcut + Person + MessagingStyle + matching shortcutId) are present, so the recipe itself is correct.

    The most likely cause of the regression is that the app now targets Android 16 (targetSdkVersion = 36, android/build.gradle:6-7), and the shortcut is pushed from a background push-processing context. Newer Android versions rate-limit / restrict pushDynamicShortcut when the app is not in the foreground, so the call can be silently dropped or throw. Critically, any failure is swallowed — addDynamicShortcut has no error handling, and the outer block only does e.printStackTrace(). A throw at line 236 aborts before setStyle/setShortcutId at 267-268, producing exactly the reported symptom: the notification still shows, but no shortcut appears on long-press.

    ⚠️ This is a medium-confidence hypothesis. The shortcut mechanism is well understood, but why it fails on Android 16 needs on-device confirmation (see verification steps below). The exact regression point could not be bisected (shallow checkout).

    What changes do you think we should make in order to solve the problem?

    1. Add error handling + logging around addDynamicShortcut/pushDynamicShortcut so the failure is no longer silent — this is the fastest way to confirm the mechanism in production logs (Firebase/Sentry) instead of guessing.
    2. Guard against background rate-limiting on Android 16: check ShortcutManagerCompat.isRateLimitingActive() before pushing, and if the OS blocks background publishing on API 36, re-publish the shortcut from a foreground-eligible path (e.g. when the app next enters the foreground, or via the existing ShortcutManager JS module) rather than only during headless push processing.
    3. Add a regression test / QA step for the long-press shortcut on an Android 16 device.

    What alternative solutions did you explore? (Optional)

    Alternatives & things to rule out
    • Shortcuts cleared by deregister churn — JS deregister() calls removeAllDynamicShortcuts(). If register/deregister fires around notification receipt on Android 16, a freshly created shortcut could be wiped. Worth confirming it isn't firing unexpectedly.
    • Intent scheme mismatch — the shortcut uses new-expensify://r/<reportID> with no explicit package; verify Android 16 doesn't reject a shortcut whose intent scheme isn't resolvable in the effective manifest.
    • HybridApp caveat — the shipped Android app is HybridApp, which builds from the Mobile-Expensify submodule (not part of this public repo). If Mobile-Expensify ships its own copy of the notification provider, the effective code path may live there. This should be verified before implementing — if so, the fix must be made in Mobile-Expensify by an internal engineer.

    Verification (needed to confirm root cause): On an Android 16 device running 9.4.36-0, reproduce the flow and capture adb logcat (tag NotificationProvider, plus any ShortcutManager rate-limit warnings) and adb shell dumpsys shortcut to see whether the shortcut was published, rate-limited, or rejected.

    Related issues


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/96377) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 17, 2026
  4. MobileMage commented on Jul 17, 2026

    @MobileMage

    🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 10:09:46 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On Android (HybridApp), receiving a chat message push while the app is backgrounded no longer publishes a conversation shortcut, so long-pressing the app icon shows no notification shortcut. This is a regression of TC 430593, which passed after the shortcut support was ported to the HybridApp in September 2025 (#66703, Mobile-Expensify PRs #13653/#13679). The notification itself still arrives — only the dynamic shortcut (and conversation styling) is gone.

    What is the root cause of that problem?

    The shipping Android binary is the HybridApp built from Mobile-Expensify/Android (see .github/workflows/buildAndroid.yml), where ExpensifyNotificationProvider applies the MessagingStyle and publishes the shortcut via PushNotificationManager.addMessageShortcut(...) → ShortcutManagerCompat.pushDynamicShortcut(...). Since the Airship 26.5.0 upgrade (App PR #92497 plus its companion Mobile-Expensify PR #13960, merged 2026-06-08), the only way this custom provider gets installed is the new plugin-extender mechanism: the plugin removed the legacy com.urbanairship.reactnative.AIRSHIP_EXTENDER hook, and the framework proxy's BaseAutopilot now discovers the extender by reading the com.urbanairship.plugin.extender manifest meta-data and instantiating that class reflectively via Class.forName(...). The standalone app uses the identical pattern — a manifest string pointing at a tiny class whose only job is pushManager.setNotificationProvider(...):

    <meta-data
    android:name="com.urbanairship.plugin.extender"
    android:value="com.expensify.chat.customairshipextender.CustomAirshipExtender" />

    I decompiled the current production HybridApp APK (9.4.33-8, the build the issue reproduces on in production). The manifest correctly declares com.urbanairship.plugin.extender → org.me.mobiexpensifyg.CustomAirshipExtender, but that class does not exist anywhere in the DEX, and neither does ExpensifyNotificationProvider. The ported shortcut publisher PushNotificationManager.addMessageShortcut is still compiled in (it survives because PushNotificationManager is kept for the YAPL JS bridge) but has zero call sites in the entire APK — it is dead code. R8 even proved the consequence at build time: in the shipped proxy bytecode, ExtenderProvider.get() was rewritten to unconditionally return null because no AirshipPluginExtender implementor exists in the program:

    // decompiled from the production APK (9.4.33-8)
    public final AirshipPluginExtender get(Context context) {
        if (this.created) return null;
        createExtender(context);
        return null; // R8 const-propagated: the extender can never load in this binary
    }

    The cause is R8 shrinking, which is enabled for HybridApp release builds (CI collects outputs/mapping/*/mapping.txt; class names are unobfuscated, so it runs shrink-only). The extender class is referenced solely by the manifest meta-data string — a reference neither R8 nor aapt2's generated keep rules treat as a root (aapt2 only keeps manifest components like activities/services, not meta-data values) — and there is no -keep rule for it, so R8 stripped it, taking ExpensifyNotificationProvider with it as unreachable. At runtime Class.forName throws ClassNotFoundException, the proxy swallows it (logcat shows "Unable to create extender: org.me.mobiexpensifyg.CustomAirshipExtender"), and pushes are built by the stock ReactNotificationProvider: plain BigText notification, no setShortcutId, and pushDynamicShortcut is never called — exactly the reported symptom, with conversation styling/avatars silently lost too. This slipped through because debug builds don't minify (PR testing passed) and PR #92497's QA steps only verified that a notification arrives and opens the right report, which the stock provider still satisfies.

    What changes do you think we should make in order to solve the problem?

    Add an R8 keep rule for the Airship plugin extender to the Mobile-Expensify Android release build (companion PR, same as the #66703 fix precedent), and the same rule to the standalone app's android/app/proguard-rules.pro, which has the identical latent defect — com.expensify.chat.customairshipextender.CustomAirshipExtender is also referenced only from the manifest string and enableProguardInReleaseBuilds is true. Keying the rule on the interface makes it survive future class renames:

    # Airship's framework proxy loads the plugin extender reflectively from the
    # com.urbanairship.plugin.extender manifest meta-data, so R8 must not strip it.
    -keep class * implements com.urbanairship.android.framework.proxy.AirshipPluginExtender {
        public <init>();
    }
    

    This is safe and minimal: it only pins one tiny class per app (plus its no-arg constructor, which the proxy invokes via getDeclaredConstructor()), and once the implementor is kept, R8 no longer const-propagates the null through ExtenderProvider.get(), so the extender loads and ExpensifyNotificationProvider is registered again — restoring the shortcut publish, setShortcutId, and MessagingStyle in one shot. No keep rule is needed for the provider itself since the kept extender references it directly. The fix is verifiable end-to-end on a release/staging build: logcat no longer shows "Unable to create extender", and after a background DM push, adb shell dumpsys shortcut lists the sender's dynamic shortcut (category msg), which then appears in the launcher long-press menu:

    public void onAirshipReady(@NonNull Context context) {
    PushManager pushManager = Airship.getPush();
    CustomNotificationProvider notificationProvider = new CustomNotificationProvider(context, Airship.getAirshipConfigOptions());
    pushManager.setNotificationProvider(notificationProvider);

    What alternative solutions did you explore? (Optional)

    I considered registering the provider directly in code from OldDot's Airship bootstrap (a direct constructor reference R8 can trace, removing the reflection fragility entirely), but rejected it as the primary fix because the proxy's BaseAutopilot.onAirshipReady deliberately installs its own ReactNotificationProvider before invoking extenders — the extender hook exists precisely to guarantee our provider is set last, and a direct registration elsewhere risks being clobbered by that ordering. I also ruled out Android 16 shortcut rate-limiting as the cause: pushDynamicShortcut is exempt from background rate limits by design, and the decompiled production APK proves the publish code is unreachable, so no runtime throttling theory is needed.

  5. aswin-s commented on Jul 17, 2026

    @aswin-s

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On Android, when a user receives a DM and then long-presses the app icon on the launcher, no conversation shortcut appears. The notification renders correctly but the entry is absent from the launcher shortcut menu. Reproduced on Pixel 7 Pro / Android 16 (v9.4.36-0).

    What is the root cause of that problem?

    Primary cause (blocker): wrong shortcut category constant

    android/app/src/main/java/com/expensify/chat/shortcutManagerModule/ShortcutManagerUtils.java line 3 imports:

    import static androidx.core.app.NotificationCompat.CATEGORY_MESSAGE;

    This constant resolves to the string "msg" — a notification category used to signal urgency to the system. It is then passed directly into the shortcut's category set (line 29):

    .setCategories(Collections.singleton(CATEGORY_MESSAGE))

    Android's launcher long-press menu only surfaces shortcuts whose category set contains ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION ("android.shortcut.conversation"). A shortcut categorised as "msg" is treated as a generic shortcut and is never allocated a conversation slot in the launcher, regardless of whether MessagingStyle, setShortcutId, or setLongLived are correctly configured. This is the definitive reason the shortcut never appears.

    Secondary gaps (good-practice, won't unblock launcher on their own)

    The ShortcutInfoCompat in addDynamicShortcut does not call .setLocusId(new LocusIdCompat(accountID)), and builder in applyMessageStyle (line 268) does not call builder.setLocusId(new LocusIdCompat(accountID)). A matching LocusId pair lets Android correlate the app surface, the shortcut, and the notification into one conversation entity and is required for full Android 12+ conversation-notification ranking. Separately, ShortcutManagerCompat.reportShortcutUsed is never called after pushDynamicShortcut, which suppresses recency-based launcher ranking.

    What changes do you think we should make in order to solve the problem?

    Fix 1 — correct the shortcut category (root cause, required)

    In android/app/src/main/java/com/expensify/chat/shortcutManagerModule/ShortcutManagerUtils.java:

    • Remove: import static androidx.core.app.NotificationCompat.CATEGORY_MESSAGE;
    • Add: import android.content.pm.ShortcutInfo;
    • Change line 29 from:
      .setCategories(Collections.singleton(CATEGORY_MESSAGE))
      to:
      .setCategories(Collections.singleton(ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION))

    Note: NotificationCompat.CATEGORY_MESSAGE should still be imported in CustomNotificationProvider.java for builder.setCategory(CATEGORY_MESSAGE) at line 110 — that usage is correct and must not be changed.

    Fix 2 — add matching LocusId pair (secondary, Android 12+ conversation ranking)

    In ShortcutManagerUtils.addDynamicShortcut, add to the ShortcutInfoCompat.Builder chain:

    .setLocusId(new LocusIdCompat(accountID))

    Requires import androidx.core.content.LocusIdCompat;.

    In CustomNotificationProvider.applyMessageStyle, alongside the existing builder.setShortcutId(accountID) (line 268), add:

    builder.setLocusId(new LocusIdCompat(accountID));

    Fix 3 — report shortcut usage (secondary, recency ranking)

    After ShortcutManagerCompat.pushDynamicShortcut(context, shortcutInfo) in ShortcutManagerUtils.addDynamicShortcut, add:

    ShortcutManagerCompat.reportShortcutUsed(context, accountID);

    Verification

    1. Receive a DM while the app is backgrounded on Android 11+ (Pixel 7 Pro / Android 16 matches the repro device).
    2. Long-press the app icon — the sender's conversation should appear as a shortcut entry.
    3. Log out or call ShortcutManagerModule.removeAllDynamicShortcuts — confirm the shortcut is cleared.
    4. Fixes 2 and 3 require no platform gating because LocusIdCompat and ShortcutManagerCompat.reportShortcutUsed are no-ops below Android R via the Compat shims.

    What alternative solutions did you explore?

    • Adding only setLocusId / reportShortcutUsed (the approach in the first-pass proposal): these are improvements but do not fix the root problem. A shortcut with the wrong category still never appears in the launcher's conversation slot regardless of LocusId pairing or usage reporting.
    • Removing setLongLived: not viable — setLongLived(true) is required so the shortcut outlives the notification's lifetime; removing it would cause the shortcut to be garbage-collected when the notification is dismissed.
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 17, 2026
  7. ahmdshrif commented on Jul 17, 2026

    @ahmdshrif

    Note: This isn't a duplicate of the flagged proposal — That proposal blames a build-time failure — R8 shrinking strips CustomAirshipExtender (referenced only from the com.urbanairship.plugin.extender manifest meta-data), so ExpensifyNotificationProvider is never registered and addMessageShortcut is dead code; the fix is a -keep rule in proguard-rules.pro.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On Android, long-pressing the app icon does not show the expected conversation/notification shortcuts (the recent-chat shortcuts that should appear in the launcher pop-up menu).

    What is the root cause of that problem?

    The only code path that ever publishes a launcher shortcut is ShortcutManagerUtils.addDynamicShortcut(...), and it is invoked from exactly one place — CustomNotificationProvider.applyMessageStyle(...) when a message push notification is received:

    Bitmap personIcon = fetchIcon(context, avatar);
    builder.setLargeIcon(personIcon);
    Person person = createMessagePersonObject(IconCompat.createWithBitmap(personIcon), accountID, name);
    ShortcutManagerUtils.addDynamicShortcut(context, reportID, name, accountID, personIcon, person);

    Inside the builder, the icon is set unconditionally with IconCompat.createWithBitmap(personIcon):

    public static void addDynamicShortcut(Context context, long reportID, String name, String accountID, Bitmap personIcon, Person person) {
    Intent intent = new Intent(Intent.ACTION_VIEW,
    Uri.parse("new-expensify://r/" + reportID));
    ShortcutInfoCompat shortcutInfo = new ShortcutInfoCompat.Builder(context, accountID)
    .setShortLabel(name)
    .setLongLabel(name)
    .setCategories(Collections.singleton(CATEGORY_MESSAGE))
    .setIntent(intent)
    .setLongLived(true)
    .setPerson(person)
    .setIcon(IconCompat.createWithBitmap(personIcon))
    .build();
    ShortcutManagerCompat.pushDynamicShortcut(context, shortcutInfo);
    }

    personIcon comes from fetchIcon(), which returns null when the avatar URL is null/malformed or the fetch fails. IconCompat.createWithBitmap(null) throws, so pushDynamicShortcut never runs and no shortcut is registered — the long-press menu stays empty. Additionally, shortcuts are wiped on deregister/logout (ShortcutManager.removeAllDynamicShortcuts()) and are never re-published proactively, so until a fresh push with a valid avatar arrives the launcher shows nothing.

    What changes do you think we should make in order to solve the problem?

    Guard the icon in addDynamicShortcut so a null bitmap doesn't abort publication, falling back to a static app icon:

    IconCompat icon = personIcon != null
        ? IconCompat.createWithBitmap(personIcon)
        : IconCompat.createWithResource(context, R.mipmap.ic_launcher_round);
    ShortcutInfoCompat shortcutInfo = new ShortcutInfoCompat.Builder(context, accountID)
            ...
            .setIcon(icon)
            .build();

    This ensures pushDynamicShortcut always succeeds so the shortcut appears on long-press even when the avatar can't be loaded. Regression check: verify shortcuts still appear with a valid avatar and that the fallback icon shows when the avatar is missing.

  8. David-2002065 commented on Jul 17, 2026

    @David-2002065

    🚨 Edited by proposal-police: This proposal was edited at 2026-07-17 10:09:01 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On Android, after receiving a DM push notification while the app is backgrounded/killed, long‑pressing the app icon does not show the sender as a conversation shortcut. The notification itself is posted, but no launcher shortcut for it appears.

    What is the root cause of that problem?

    The launcher shortcut is a conversation shortcut that Android only surfaces if we actually publish a long‑lived dynamic shortcut (ShortcutManagerCompat.pushDynamicShortcut) and tag the notification with a matching setShortcutId. We do publish it — but only from inside applyMessageStyle, and the publish call sits after we turn the fetched avatar into an IconCompat, all wrapped in a try/catch that silently falls back to a plain notification.

    The shortcut is published here, right after building the avatar icon:

    Bitmap personIcon = fetchIcon(context, avatar);
    builder.setLargeIcon(personIcon);
    Person person = createMessagePersonObject(IconCompat.createWithBitmap(personIcon), accountID, name);
    ShortcutManagerUtils.addDynamicShortcut(context, reportID, name, accountID, personIcon, person);

    fetchIcon returns null whenever the avatar can't be downloaded within its 8s window — which is exactly what tends to happen when the push is handled by a cold background process (the repro literally starts with "Leave the app" before the DM arrives):

    try {
    Bitmap bitmap = future.get(MAX_ICON_FETCH_WAIT_TIME_SECONDS, TimeUnit.SECONDS);
    return getCroppedBitmap(bitmap);
    } catch (InterruptedException e) {
    Log.e(TAG,"Failed to fetch icon", e);
    Thread.currentThread().interrupt();
    } catch (Exception e) {
    Log.e(TAG,"Failed to fetch icon", e);
    future.cancel(true);
    }
    return null;

    When personIcon is null, IconCompat.createWithBitmap(personIcon) at L234 throws before ShortcutManagerUtils.addDynamicShortcut(...) at L236 ever runs, and the exception is swallowed by the surrounding catch:

    So the base notification still posts, but no dynamic/conversation shortcut is published — hence nothing shows in the app‑icon long‑press menu. addDynamicShortcut compounds this by making the bitmap mandatory too (setIcon(IconCompat.createWithBitmap(personIcon))):

    public static void addDynamicShortcut(Context context, long reportID, String name, String accountID, Bitmap personIcon, Person person) {
    Intent intent = new Intent(Intent.ACTION_VIEW,
    Uri.parse("new-expensify://r/" + reportID));
    ShortcutInfoCompat shortcutInfo = new ShortcutInfoCompat.Builder(context, accountID)
    .setShortLabel(name)
    .setLongLabel(name)
    .setCategories(Collections.singleton(CATEGORY_MESSAGE))
    .setIntent(intent)
    .setLongLived(true)
    .setPerson(person)
    .setIcon(IconCompat.createWithBitmap(personIcon))
    .build();
    ShortcutManagerCompat.pushDynamicShortcut(context, shortcutInfo);
    }

    What changes do you think we should make in order to solve the problem?

    Stop letting a missing avatar abort shortcut publication. Build the Person/shortcut with a fallback icon when fetchIcon returns null, so the shortcut is always pushed:

    Bitmap personIcon = fetchIcon(context, avatar);
    if (personIcon != null) {
        builder.setLargeIcon(personIcon);
    }
    
    // Fall back to the launcher icon so the Person/shortcut stay valid even when
    // the avatar can't be fetched in time (e.g. a cold background push process).
    IconCompat personIconCompat = personIcon != null
            ? IconCompat.createWithBitmap(personIcon)
            : IconCompat.createWithResource(context, R.mipmap.ic_launcher);
    
    Person person = createMessagePersonObject(personIconCompat, accountID, name);
    
    ShortcutManagerUtils.addDynamicShortcut(context, reportID, name, accountID, personIcon, person);

    And make the icon optional inside addDynamicShortcut so a null bitmap can't stop pushDynamicShortcut:

    ShortcutInfoCompat.Builder shortcutBuilder = new ShortcutInfoCompat.Builder(context, accountID)
            .setShortLabel(name)
            .setLongLabel(name)
            .setCategories(Collections.singleton(CATEGORY_MESSAGE))
            .setIntent(intent)
            .setLongLived(true)
            .setPerson(person);
    
    if (personIcon != null) {
        shortcutBuilder.setIcon(IconCompat.createWithBitmap(personIcon));
    }
    
    ShortcutManagerCompat.pushDynamicShortcut(context, shortcutBuilder.build());

    With these two changes the conversation shortcut is published on every report‑comment push, independent of whether the avatar resolves, so it reliably shows in the launcher long‑press menu.

    What specific scenarios should we cover in automated tests to prevent this problem from happening again?

    • An instrumented test that runs onExtendBuilder/applyMessageStyle for a report‑comment payload whose avatar URL is unreachable/slow (so fetchIcon returns null), then asserts ShortcutManagerCompat.getDynamicShortcuts(context) contains a shortcut whose id equals accountID, and that the posted notification's shortcutId matches it.
    • The happy path with a valid avatar: the shortcut is published with the avatar icon and the notification carries the matching shortcutId.

    What alternative solutions did you explore? (Optional)

    Publish the shortcut first (before any avatar/messaging‑style work) and update its icon asynchronously once fetchIcon completes — this guarantees the shortcut exists immediately, but it splits the shortcut into two writes and adds ordering complexity for little gain over the fallback‑icon approach above. I also considered skipping the network avatar fetch on the notification thread entirely and always using a generated initials avatar, but that would regress the avatars currently shown in the notification shade.

  9. mukhrr commented on Jul 17, 2026

    @mukhrr

    Proposal

    What is the root cause of that problem?

    I found that creating the conversation shortcut depends on successfully downloading the sender’s avatar. fetchIcon() returns null for a missing/malformed URL, a timeout, or any download error.

    private Bitmap fetchIcon(@NonNull Context context, String urlString) {
    URL parsedUrl = null;
    try {
    parsedUrl = urlString == null ? null : new URL(urlString);
    } catch (MalformedURLException e) {
    Log.e(TAG, "Failed to resolve URL " + urlString, e);
    }
    if (parsedUrl == null) {
    return null;
    }
    WindowManager window = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    DisplayMetrics dm = new DisplayMetrics();
    window.getDefaultDisplay().getMetrics(dm);
    final int reqWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, MAX_ICON_SIZE_DPS, dm);
    final int reqHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, MAX_ICON_SIZE_DPS, dm);
    final URL url = parsedUrl;
    Future<Bitmap> future = executorService.submit(() -> ImageUtils.INSTANCE.fetchScaledBitmap(context, url, reqWidth, reqHeight, reqWidth, reqHeight));
    try {
    Bitmap bitmap = future.get(MAX_ICON_FETCH_WAIT_TIME_SECONDS, TimeUnit.SECONDS);
    return getCroppedBitmap(bitmap);
    } catch (InterruptedException e) {
    Log.e(TAG,"Failed to fetch icon", e);
    Thread.currentThread().interrupt();
    } catch (Exception e) {
    Log.e(TAG,"Failed to fetch icon", e);
    future.cancel(true);
    }
    return null;

    However, applyMessageStyle() passes that nullable bitmap unconditionally to IconCompat.createWithBitmap() before calling addDynamicShortcut(). When the bitmap is unavailable, this throws and the shortcut is never published.

    // Create the Person object who sent the latest report comment
    Bitmap personIcon = fetchIcon(context, avatar);
    builder.setLargeIcon(personIcon);
    Person person = createMessagePersonObject(IconCompat.createWithBitmap(personIcon), accountID, name);
    ShortcutManagerUtils.addDynamicShortcut(context, reportID, name, accountID, personIcon, person);
    // Create latest received message object
    long createdTimeInMillis = getMessageTimeInMillis(messageData.get("created").getString(""));
    NotificationCompat.MessagingStyle.Message newMessage = new NotificationCompat.MessagingStyle.Message(message, createdTimeInMillis, person);

    The outer handler catches this failure and returns Airship’s default notification builder, which explains why the message notification itself appears while its launcher shortcut is missing.

    // Attempt to parse data and apply custom notification styling
    if (!message.containsKey(PAYLOAD_KEY)) {
    return builder;
    }
    try {
    String rawPayload = message.getExtra(PAYLOAD_KEY);
    if (rawPayload == null) {
    if (BuildConfig.DEBUG) Log.d(TAG, "Failed to parse payload - payload is empty. SendID=" + message.getSendId());
    return builder;
    }
    PayloadHandler handler = new PayloadHandler();
    String processedPayload = handler.processPayload(rawPayload);
    JsonMap payload = JsonValue.parseString(processedPayload).optMap();
    if (!payload.containsKey(ONYX_DATA_KEY)) {
    if (BuildConfig.DEBUG) Log.d(TAG, "Failed to process payload - no onyx data. SendID=" + message.getSendId());
    return builder;
    }
    Objects.requireNonNull(payload.get(ONYX_DATA_KEY)).isNull();
    if (BuildConfig.DEBUG) Log.d(TAG, "payload contains onxyData");
    String alert = message.getExtra(PushMessage.EXTRA_ALERT);
    applyMessageStyle(context, builder, payload, arguments.notificationId, alert);
    } catch (Exception e) {
    Log.e(TAG, "Failed to parse conversation, falling back to default notification style. SendID=" + message.getSendId(), e);
    }
    return builder;

    The shortcut implementation was introduced without nullable-avatar handling, and the recent Airship upgrade only adapted the avatar-loading API, preserving this failure path.

    4a28d61

    What changes do you think we should make in order to solve the problem?

    I think we should make the avatar optional in applyMessageStyle() and ShortcutManagerUtils.addDynamicShortcut(). We should always construct and publish the shortcut, but only add bitmap icons to the Person, notification, and shortcut when fetchIcon() returns a bitmap.

    For example, the shortcut construction would change along these lines:

    - .setIcon(IconCompat.createWithBitmap(personIcon))
    + if (personIcon != null) {
    +     builder.setIcon(IconCompat.createWithBitmap(personIcon));
    + }

    The same conditional handling should be used when creating the Person and setting the notification’s large icon. The remaining shortcut metadata—label, deep-link intent, message category, long-lived status, and person—already contains everything needed to publish and open the conversation.

    public static void addDynamicShortcut(Context context, long reportID, String name, String accountID, Bitmap personIcon, Person person) {
    Intent intent = new Intent(Intent.ACTION_VIEW,
    Uri.parse("new-expensify://r/" + reportID));
    ShortcutInfoCompat shortcutInfo = new ShortcutInfoCompat.Builder(context, accountID)
    .setShortLabel(name)
    .setLongLabel(name)
    .setCategories(Collections.singleton(CATEGORY_MESSAGE))
    .setIntent(intent)
    .setLongLived(true)
    .setPerson(person)
    .setIcon(IconCompat.createWithBitmap(personIcon))
    .build();
    ShortcutManagerCompat.pushDynamicShortcut(context, shortcutInfo);

    This does not change successful avatar downloads or existing shortcut navigation. It only allows the existing fallback path to publish a shortcut without a custom avatar instead of aborting the entire conversation-style setup. I would test both a valid avatar and a missing/failed avatar, confirm the message remains visible, long-press the launcher icon to verify the shortcut appears, and verify that tapping it opens the correct report.

    What alternative solutions did you explore? (Optional)

    We could use a bundled default bitmap whenever the avatar download fails. However, making the icon optional is smaller and avoids manufacturing or maintaining another avatar asset; Android can render the shortcut using its remaining person and label metadata.

  10. samranahm commented on Jul 17, 2026

    @samranahm

    Proposal

    What is the root cause of that problem?

    When a new comment notification is received, the showCommentNotification function in LocalNotification/index.ts is responsible for triggering its display:

    function showCommentNotification(report: Report, reportAction: ReportAction, onClick: LocalNotificationClickHandler, reportAttributes?: ReportAttributesDerivedValue['reports']) {
    BrowserNotifications.pushReportCommentNotification(report, reportAction, onClick, true, reportAttributes);
    }

    This function delegates to BrowserNotifications.pushReportCommentNotification. On Android, for a notification to appear as a dynamic shortcut when the app icon is long-pressed, the application must explicitly publish a ShortcutInfo object using the Android ShortcutManager API. The current Android-specific implementation of BrowserNotifications.pushReportCommentNotification does not include the necessary calls to the ShortcutManager to create and update these dynamic shortcuts. Consequently, while the notification itself is displayed, it is not registered with the system as a shortcut, leading to its absence from the long-press menu.

    What changes do you think we should make in order to solve the problem?

    1. Identify the native Android code responsible for BrowserNotifications.pushReportCommentNotification. This function is called by showCommentNotification when a new report comment notification needs to be displayed:
      function showCommentNotification(report: Report, reportAction: ReportAction, onClick: LocalNotificationClickHandler, reportAttributes?: ReportAttributesDerivedValue['reports']) {
      BrowserNotifications.pushReportCommentNotification(report, reportAction, onClick, true, reportAttributes);
      }

      Within this native Android implementation, before displaying the notification, add logic to interact with the Android ShortcutManager.
    2. When BrowserNotifications.pushReportCommentNotification is invoked, construct a ShortcutInfo object for the incoming report. This object should include:
      • A unique ID (e.g., derived from the reportID).
      • A short label (e.g., the sender's display name or report name).
      • A long label (e.g., the message content).
      • An Intent that, when activated, will open the Expensify app directly to the specific report associated with the notification.
    3. Use ShortcutManager.setDynamicShortcuts() or ShortcutManager.addDynamicShortcuts() to publish this ShortcutInfo to the Android system. This will make the notification available as a dynamic shortcut on the app icon long-press menu.
    4. Implement logic to update or remove these dynamic shortcuts when the corresponding notification is dismissed, read, or becomes irrelevant, to ensure the long-press menu remains accurate and up-to-date.

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  11. aswin-s commented on Jul 17, 2026

    @aswin-s

    Proposal

    Updated

  12. melvin-bot commented on Jul 17, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @cretadn22 (External)

  13. 16 remaining items

  14. melvin-bot commented on Jul 20, 2026

    @melvin-bot

    @cretadn22 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  15. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    @cretadn22 Eep! 4 days overdue now. Issues have feelings too...

  16. melvin-bot commented on Jul 24, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  17. melvin-bot commented on Jul 24, 2026

    @melvin-bot

    @cretadn22 Still overdue 6 days?! Let's take care of this!

  18. cretadn22 commented on Jul 25, 2026

    @cretadn22

    This issue involves changes to our internal Mobile-Expensify repo, so I'm bringing in an Expert Contributor to take over. Thank you all for your contributions

  19. self-assigned this
    on Jul 28, 2026
  20. added
    InternalRequires API changes or must be handled by Expensify staff
    and removed
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 28, 2026
  21. Julesssss commented on Jul 28, 2026

    @Julesssss
  22. arosiclair commented on Jul 30, 2026

    @arosiclair

    Fixed in v9.4.46-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.Help WantedApply this label when an issue is open to proposals by contributorsInternalRequires API changes or must be handled by Expensify staffWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions