Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8454ddf8 authored by Mady Mellor's avatar Mady Mellor
Browse files

Remove the bubble if intent has an issue

This isn't very graceful & it's a bit jarring that the bubble is removed,
however, if the intent has an issue we can't really populate the view.

Test: manual - have a bubble whose intent uses FLAG_ONE_SHOT
             - expand that bubble
             - cause bubbles to crash (adb shell killall com.google.android.samples.bubbles)
             - the stack should collapse, tap on that bubble
             => it gets removed (if there are other bubbles, stack still expands
                if that was the only bubble the stack goes away).
Bug: 139025304
Change-Id: I23dcd6ac252e56f339b06fe8ba1d4b3dad61c3ae
parent 273632ff
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
    @Retention(SOURCE)
    @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED,
            DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION, DISMISS_NO_LONGER_BUBBLE,
            DISMISS_USER_CHANGED, DISMISS_GROUP_CANCELLED})
            DISMISS_USER_CHANGED, DISMISS_GROUP_CANCELLED, DISMISS_INVALID_INTENT})
    @Target({FIELD, LOCAL_VARIABLE, PARAMETER})
    @interface DismissReason {}

@@ -127,6 +127,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
    static final int DISMISS_NO_LONGER_BUBBLE = 7;
    static final int DISMISS_USER_CHANGED = 8;
    static final int DISMISS_GROUP_CANCELLED = 9;
    static final int DISMISS_INVALID_INTENT = 10;

    public static final int MAX_BUBBLES = 5; // TODO: actually enforce this

+11 −1
Original line number Diff line number Diff line
@@ -127,7 +127,17 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
                            Log.d(TAG, "onActivityViewReady: calling startActivity, "
                                    + "bubble=" + getBubbleKey());
                        }
                        try {
                            mActivityView.startActivity(mBubbleIntent, options);
                        } catch (RuntimeException e) {
                            // If there's a runtime exception here then there's something
                            // wrong with the intent, we can't really recover / try to populate
                            // the bubble again so we'll just remove it.
                            Log.w(TAG, "Exception while displaying bubble: " + getBubbleKey()
                                    + ", " + e.getMessage() + "; removing bubble");
                            mBubbleController.removeBubble(mBubble.getKey(),
                                    BubbleController.DISMISS_INVALID_INTENT);
                        }
                    });
                    mActivityViewStatus = ActivityViewStatus.ACTIVITY_STARTED;
            }