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

Commit ca4bd050 authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Add the finishing task as a trigger for crash.

When activity crashes, set the finishing task as the trigger task. This
allows shell to better handle crashes through #handleRequest.

Fix: 361058348
Fix: 356187158
Test: Open any app, crash it using "adb shel am crash", see that trigger
task set instead of being null.
Flag: EXEMPT Bugfix

Change-Id: I24d63ad5e74a336871327872d007663d65f8cbfc
parent 793ae050
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5612,8 +5612,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     * @see AppTransition#prepareAppTransition
     */
    void requestTransitionAndLegacyPrepare(@WindowManager.TransitionType int transit,
            @WindowManager.TransitionFlags int flags) {
        mTransitionController.requestTransitionIfNeeded(transit, flags, null /* trigger */, this);
            @WindowManager.TransitionFlags int flags, @Nullable WindowContainer trigger) {
        mTransitionController.requestTransitionIfNeeded(transit, flags, trigger, this);
    }

    void executeAppTransition() {
+1 −1
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ class KeyguardController {
                // to the locked state before holding the sleep token again
                if (!ENABLE_NEW_KEYGUARD_SHELL_TRANSITIONS) {
                    dc.requestTransitionAndLegacyPrepare(
                            TRANSIT_TO_FRONT, TRANSIT_FLAG_KEYGUARD_APPEARING);
                            TRANSIT_TO_FRONT, TRANSIT_FLAG_KEYGUARD_APPEARING, /* trigger= */ null);
                }
                dc.mWallpaperController.adjustWallpaperWindows();
                dc.executeAppTransition();
+2 −1
Original line number Diff line number Diff line
@@ -5480,7 +5480,8 @@ class Task extends TaskFragment {
        Slog.w(TAG, "  Force finishing activity "
                + r.intent.getComponent().flattenToShortString());
        Task finishedTask = r.getTask();
        mDisplayContent.requestTransitionAndLegacyPrepare(TRANSIT_CLOSE, TRANSIT_FLAG_APP_CRASHED);
        mDisplayContent.requestTransitionAndLegacyPrepare(TRANSIT_CLOSE, TRANSIT_FLAG_APP_CRASHED,
                finishedTask);
        r.finishIfPossible(reason, false /* oomAdj */);

        // Also terminate any activities below it that aren't yet stopped, to avoid a situation
+2 −1
Original line number Diff line number Diff line
@@ -482,8 +482,9 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
            r.detachFromProcess();
            if (r.isVisibleRequested()) {
                hasVisibleActivity = true;
                Task finishingTask = r.getTask();
                r.mDisplayContent.requestTransitionAndLegacyPrepare(TRANSIT_CLOSE,
                        TRANSIT_FLAG_APP_CRASHED);
                        TRANSIT_FLAG_APP_CRASHED, finishingTask);
            }
            r.destroyIfPossible("handleAppCrashed");
        }
+1 −1
Original line number Diff line number Diff line
@@ -1821,7 +1821,7 @@ public class DisplayContentTests extends WindowTestsBase {
                .setTask(nonTopVisible.getTask()).setVisible(false)
                .setActivityTheme(android.R.style.Theme_Translucent).build();
        final TestTransitionPlayer player = registerTestTransitionPlayer();
        mDisplayContent.requestTransitionAndLegacyPrepare(WindowManager.TRANSIT_OPEN, 0);
        mDisplayContent.requestTransitionAndLegacyPrepare(WindowManager.TRANSIT_OPEN, 0, null);
        translucentTop.setVisibility(true);
        mDisplayContent.updateOrientation();
        assertEquals("Non-top visible activity must be portrait",