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

Commit 2647253a authored by Mateusz Cicheński's avatar Mateusz Cicheński
Browse files

Send onActivityUnpinned when Activity is force killed or crashed

It seems like it is possible for the task to be in pinned mode while
WindowContainer it is in no longer is in that mode, which leads to a
skipped invocation to notifyActivityPipModeChanged.

Bug: 294096108
Bug: 257519948
Test: manually
Test: launch an app, crash/force kill it, confirm callback is delivered
Test: before http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/gBuDVFExNtbyDxL85YGYWu
Test: after http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/cQE890lYS2oqh60zS9L9Y4

Change-Id: I1742b85423e3924121263d088756125ae35771aa
parent 55f719c4
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2234,10 +2234,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            mService.getTaskChangeNotificationController().notifyActivityUnpinned();
        }
        mWindowManager.mPolicy.setPipVisibilityLw(inPip);
        if (task.getSurfaceControl() != null) {
            mWmService.mTransactionFactory.get()
                    .setTrustedOverlay(task.getSurfaceControl(), inPip)
                    .apply();
        }
    }

    void executeAppTransitionForAllDisplay() {
        for (int displayNdx = getChildCount() - 1; displayNdx >= 0; --displayNdx) {
+11 −5
Original line number Diff line number Diff line
@@ -1162,11 +1162,17 @@ class Task extends TaskFragment {
                forAllActivities(oldParentTask::cleanUpActivityReferences);
            }

            if (oldParent.inPinnedWindowingMode()
                    && (newParent == null || !newParent.inPinnedWindowingMode())) {
            if (newParent == null || !newParent.inPinnedWindowingMode()) {
                if (oldParent.inPinnedWindowingMode()) {
                    // Notify if a task from the root pinned task is being removed
                    // (or moved depending on the mode).
                    mRootWindowContainer.notifyActivityPipModeChanged(this, null);
                } else if (inPinnedWindowingMode()) {
                    // The task in pinned mode is removed, even though the old parent was not pinned
                    // The task was most likely force killed or crashed
                    Slog.e(TAG, "Pinned task is removed t=" + this);
                    mRootWindowContainer.notifyActivityPipModeChanged(this, null);
                }
            }
        }