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

Commit 2ccf0ae6 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Resets the activity translucent state if app died" into main

parents fe764f9a ff4494a8
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -3272,8 +3272,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mOccludesParent = occludesParent;
        setMainWindowOpaque(occludesParent);
        if (changed && task != null && !occludesParent) {
        if (changed && task != null) {
            if (!occludesParent) {
                getRootTask().convertActivityToTranslucent(this);
            } else {
                getRootTask().convertActivityFromTranslucent(this);
            }
        }
        // Always ensure visibility if this activity doesn't occlude parent, so the
        // {@link #returningOptions} of the activity under this one can be applied in
@@ -4266,6 +4270,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        getTaskFragment().cleanUpActivityReferences(this);
        clearLastParentBeforePip();
        // Abort and reset state if the scence transition is playing.
        final Task rootTask = getRootTask();
        if (rootTask != null) {
            rootTask.abortTranslucentActivityWaiting(this);
        }
        // Clean up the splash screen if it was still displayed.
        cleanUpSplashScreen();
+34 −0
Original line number Diff line number Diff line
@@ -297,6 +297,10 @@ class Task extends TaskFragment {
    ActivityRecord mTranslucentActivityWaiting = null;
    ArrayList<ActivityRecord> mUndrawnActivitiesBelowTopTranslucent = new ArrayList<>();

    // The topmost Activity that was converted to translucent for scene transition, which should
    // be converted from translucent once the transition is completed, or the app died.
    private ActivityRecord mPendingConvertFromTranslucentActivity = null;

    /**
     * Set when we know we are going to be calling updateConfiguration()
     * soon, so want to skip intermediate config checks.
@@ -4988,6 +4992,27 @@ class Task extends TaskFragment {
        }
    }

    void abortTranslucentActivityWaiting(@NonNull ActivityRecord r) {
        if (r != mTranslucentActivityWaiting && r != mPendingConvertFromTranslucentActivity) {
            return;
        }

        if (mTranslucentActivityWaiting != null) {
            if (!mTranslucentActivityWaiting.finishing) {
                mTranslucentActivityWaiting.setOccludesParent(true);
            }
            mTranslucentActivityWaiting = null;
        }
        if (mPendingConvertFromTranslucentActivity != null) {
            if (!mPendingConvertFromTranslucentActivity.finishing) {
                mPendingConvertFromTranslucentActivity.setOccludesParent(true);
            }
            mPendingConvertFromTranslucentActivity = null;
        }
        mUndrawnActivitiesBelowTopTranslucent.clear();
        mHandler.removeMessages(TRANSLUCENT_TIMEOUT_MSG);
    }

    void checkTranslucentActivityWaiting(ActivityRecord top) {
        if (mTranslucentActivityWaiting != top) {
            mUndrawnActivitiesBelowTopTranslucent.clear();
@@ -5002,10 +5027,19 @@ class Task extends TaskFragment {

    void convertActivityToTranslucent(ActivityRecord r) {
        mTranslucentActivityWaiting = r;
        mPendingConvertFromTranslucentActivity = r;
        mUndrawnActivitiesBelowTopTranslucent.clear();
        mHandler.sendEmptyMessageDelayed(TRANSLUCENT_TIMEOUT_MSG, TRANSLUCENT_CONVERSION_TIMEOUT);
    }

    void convertActivityFromTranslucent(ActivityRecord r) {
        if (r != mPendingConvertFromTranslucentActivity) {
            Slog.e(TAG, "convertFromTranslucent expects " + mPendingConvertFromTranslucentActivity
                    + " but is " + r);
        }
        mPendingConvertFromTranslucentActivity = null;
    }

    /**
     * Called as activities below the top translucent activity are redrawn. When the last one is
     * redrawn notify the top activity by calling