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

Commit 734bc94c authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Handle process die event of a bubble activity gracefully.

When the process behind a bubble activity died (e.g. killed by lmkd,
or app crash), collapse the bubble and restart the activity when it's
expanded next time.

Bug: 126945401
Test: atest TaskStackChangedListenerTest
Change-Id: Ia2ee21f9ced51fe33756b1e12159f445d6ed083d
parent 79d11d85
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -177,4 +177,11 @@ oneway interface ITaskStackListener {
     * @param displayId the id of the display on which contents are drawn.
     */
    void onSingleTaskDisplayDrawn(int displayId);

    /*
     * Called when the last task is removed from a display which can only contain one task.
     *
     * @param displayId the id of the display from which the window is removed.
     */
    void onSingleTaskDisplayEmpty(int displayId);
}
+4 −0
Original line number Diff line number Diff line
@@ -177,4 +177,8 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {
    @Override
    public void onSingleTaskDisplayDrawn(int displayId) throws RemoteException {
    }

    @Override
    public void onSingleTaskDisplayEmpty(int displayId) throws RemoteException {
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -72,6 +72,13 @@ public abstract class TaskStackChangeListener {
     */
    public void onSingleTaskDisplayDrawn(int displayId) { }

    /**
     * Called when the last task is removed from a display which can only contain one task.
     *
     * @param displayId the id of the display from which the window is removed.
     */
    public void onSingleTaskDisplayEmpty(int displayId) {}

    public void onTaskProfileLocked(int taskId, int userId) { }
    public void onTaskCreated(int taskId, ComponentName componentName) { }
    public void onTaskRemoved(int taskId) { }
+14 −0
Original line number Diff line number Diff line
@@ -208,6 +208,12 @@ public class TaskStackChangeListeners extends TaskStackListener {
                0 /* unused */).sendToTarget();
    }

    @Override
    public void onSingleTaskDisplayEmpty(int displayId) throws RemoteException {
        mHandler.obtainMessage(H.ON_SINGLE_TASK_DISPLAY_EMPTY, displayId,
                0 /* unused */).sendToTarget();
    }

    private final class H extends Handler {
        private static final int ON_TASK_STACK_CHANGED = 1;
        private static final int ON_TASK_SNAPSHOT_CHANGED = 2;
@@ -228,6 +234,7 @@ public class TaskStackChangeListeners extends TaskStackListener {
        private static final int ON_SIZE_COMPAT_MODE_ACTIVITY_CHANGED = 17;
        private static final int ON_BACK_PRESSED_ON_TASK_ROOT = 18;
        private static final int ON_SINGLE_TASK_DISPLAY_DRAWN = 19;
        private static final int ON_SINGLE_TASK_DISPLAY_EMPTY = 20;


        public H(Looper looper) {
@@ -370,6 +377,13 @@ public class TaskStackChangeListeners extends TaskStackListener {
                        }
                        break;
                    }
                    case ON_SINGLE_TASK_DISPLAY_EMPTY: {
                        for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
                            mTaskStackListeners.get(i).onSingleTaskDisplayEmpty(
                                    msg.arg1);
                        }
                        break;
                    }
                }
            }
        }
+14 −0
Original line number Diff line number Diff line
@@ -762,6 +762,20 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
                expandedBubble.setContentVisibility(true);
            }
        }

        @Override
        public void onSingleTaskDisplayEmpty(int displayId) {
            final Bubble expandedBubble = getExpandedBubble(mContext);
            if (expandedBubble == null) {
                return;
            }
            if (expandedBubble.getDisplayId() == displayId) {
                mBubbleData.setExpanded(false);
            }
            if (expandedBubble.expandedView != null) {
                expandedBubble.expandedView.notifyDisplayEmpty();
            }
        }
    }

    private static boolean areBubblesEnabled(Context context) {
Loading