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

Commit f15da7ac authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Automerger Merge Worker
Browse files

Merge "Fix ActivityRecord leak if starting window was transferred." into sc-dev am: 0287fee4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14495877

Change-Id: If69dd4e566b9b49dc334f991987d96c66c3288e7
parents 1a0b8001 0287fee4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
import static android.view.SurfaceControl.METADATA_TASK_ID;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED;
@@ -1670,6 +1671,14 @@ class Task extends WindowContainer<WindowContainer> {
        return isUidPresent;
    }

    ActivityRecord topActivityContainsStartingWindow() {
        if (getParent() == null) {
            return null;
        }
        return getActivity((r) -> r.getWindow(window ->
                window.getBaseType() == TYPE_APPLICATION_STARTING) != null);
    }

    ActivityRecord topActivityWithStartingWindow() {
        if (getParent() == null) {
            return null;
+2 −6
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import android.os.Binder;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.util.Slog;
import android.util.proto.ProtoOutputStream;
import android.view.SurfaceControl;
@@ -76,9 +75,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
    private static final int REPORT_CONFIGS = CONTROLLABLE_CONFIGS;
    private static final int REPORT_WINDOW_CONFIGS = CONTROLLABLE_WINDOW_CONFIGS;

    private static final boolean DEBUG_ENABLE_REVEAL_ANIMATION =
            SystemProperties.getBoolean("persist.debug.enable_reveal_animation", false);

    // The set of modes that are currently supports
    // TODO: Remove once the task organizer can support all modes
    @VisibleForTesting
@@ -187,8 +183,8 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
            SurfaceControl windowAnimationLeash = null;
            Rect mainFrame = null;
            final boolean playShiftUpAnimation = !task.inMultiWindowMode();
            if (prepareAnimation && playShiftUpAnimation && DEBUG_ENABLE_REVEAL_ANIMATION) {
                final ActivityRecord topActivity = task.topActivityWithStartingWindow();
            if (prepareAnimation && playShiftUpAnimation) {
                final ActivityRecord topActivity = task.topActivityContainsStartingWindow();
                if (topActivity != null) {
                    final WindowState mainWindow =
                            topActivity.findMainWindow(false/* includeStartingApp */);
+7 −7
Original line number Diff line number Diff line
@@ -2412,14 +2412,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }

        if (startingWindow && StartingSurfaceController.DEBUG_ENABLE_SHELL_DRAWER) {
            // cancel the remove starting window animation on shell
            // Cancel the remove starting window animation on shell. The main window might changed
            // during animating, checking for all windows would be safer.
            if (mActivityRecord != null) {
                final WindowState mainWindow =
                        mActivityRecord.findMainWindow(false/* includeStartingApp */);
                if (mainWindow != null && mainWindow.isSelfAnimating(0 /* flags */,
                        ANIMATION_TYPE_STARTING_REVEAL)) {
                    mainWindow.cancelAnimation();
                mActivityRecord.forAllWindows(w -> {
                    if (w.isSelfAnimating(0, ANIMATION_TYPE_STARTING_REVEAL)) {
                        w.cancelAnimation();
                    }
                }, true);
            }
        }