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

Commit 245645ca authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Don't clear visible-behind activity if it is top" into lmp-dev

parents 15b2202b 64ccb708
Loading
Loading
Loading
Loading
+18 −12
Original line number Original line Diff line number Diff line
@@ -5466,27 +5466,33 @@ public class Activity extends ContextThemeWrapper


    /**
    /**
     * Activities that want to remain visible behind a translucent activity above them must call
     * Activities that want to remain visible behind a translucent activity above them must call
     * this method anytime before a return from {@link #onPause()}. If this call is successful
     * this method anytime between the start of {@link #onResume()} and the return from
     * then the activity will remain visible when {@link #onPause()} is called, and can continue to
     * {@link #onPause()}. If this call is successful then the activity will remain visible after
     * play media in the background, but it must stop playing and release resources prior to or
     * {@link #onPause()} is called, and is allowed to continue playing media in the background.
     * within the call to {@link #onVisibleBehindCanceled()}. If this call returns false, the 
     *
     * activity will not be visible in the background, and must release any media resources 
     * <p>The actions of this call are reset each time that this activity is brought to the
     * immediately.
     * front. That is, every time {@link #onResume()} is called the activity will be assumed
     * to not have requested visible behind. Therefore, if you want this activity to continue to
     * be visible in the background you must call this method again.
     *
     *
     * <p>Only fullscreen opaque activities may make this call. I.e. this call is a nop
     * <p>Only fullscreen opaque activities may make this call. I.e. this call is a nop
     * for dialog and translucent activities.
     * for dialog and translucent activities.
     *
     *
     * <p>False will be returned any time this method is call between the return of onPause and
     * <p>Under all circumstances, the activity must stop playing and release resources prior to or
     * within a call to {@link #onVisibleBehindCanceled()} or if this call returns false.
     *
     * <p>False will be returned any time this method is called between the return of onPause and
     *      the next call to onResume.
     *      the next call to onResume.
     *
     *
     * @param visible true to notify the system that the activity wishes to be visible behind other
     * @param visible true to notify the system that the activity wishes to be visible behind other
     *                translucent activities, false to indicate otherwise. Resources must be
     *                translucent activities, false to indicate otherwise. Resources must be
     *                released when passing false to this method.
     *                released when passing false to this method.
     * @return the resulting visibiity state. If true the activity may remain visible beyond
     * @return the resulting visibiity state. If true the activity will remain visible beyond
     *      {@link #onPause()}. If false then the activity may not count on being visible behind
     *      {@link #onPause()} if the next activity is translucent or not fullscreen. If false
     *      other translucent activities, and must stop any media playback and release resources.
     *      then the activity may not count on being visible behind other translucent activities,
     *      Returning false may occur in lieu of a call to onVisibleBehindCanceled() so the return
     *      and must stop any media playback and release resources.
     *      value must be checked.
     *      Returning false may occur in lieu of a call to {@link #onVisibleBehindCanceled()} so
     *      the return value must be checked.
     *
     *
     * @see #onVisibleBehindCanceled()
     * @see #onVisibleBehindCanceled()
     * @see #onBackgroundVisibleBehindChanged(boolean)
     * @see #onBackgroundVisibleBehindChanged(boolean)
+10 −0
Original line number Original line Diff line number Diff line
@@ -1105,6 +1105,11 @@ final class ActivityStack {
            invalidateLastScreenshot();
            invalidateLastScreenshot();
        }
        }
        next.returningOptions = null;
        next.returningOptions = null;

        if (mActivityContainer.mActivityDisplay.mVisibleBehindActivity == next) {
            // When resuming an activity, require it to call requestVisibleBehind() again.
            mActivityContainer.mActivityDisplay.setVisibleBehindActivity(null);
        }
    }
    }


    private void setVisibile(ActivityRecord r, boolean visible) {
    private void setVisibile(ActivityRecord r, boolean visible) {
@@ -3296,6 +3301,11 @@ final class ActivityStack {
        if (hasVisibleBehindActivity() &&
        if (hasVisibleBehindActivity() &&
                !mHandler.hasMessages(RELEASE_BACKGROUND_RESOURCES_TIMEOUT_MSG)) {
                !mHandler.hasMessages(RELEASE_BACKGROUND_RESOURCES_TIMEOUT_MSG)) {
            final ActivityRecord r = getVisibleBehindActivity();
            final ActivityRecord r = getVisibleBehindActivity();
            if (r == topRunningActivityLocked(null)) {
                // Don't release the top activity if it has requested to run behind the next
                // activity.
                return;
            }
            if (DEBUG_STATES) Slog.d(TAG, "releaseBackgroundResources activtyDisplay=" +
            if (DEBUG_STATES) Slog.d(TAG, "releaseBackgroundResources activtyDisplay=" +
                    mActivityContainer.mActivityDisplay + " visibleBehind=" + r + " app=" + r.app +
                    mActivityContainer.mActivityDisplay + " visibleBehind=" + r + " app=" + r.app +
                    " thread=" + r.app.thread);
                    " thread=" + r.app.thread);