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

Commit ce742897 authored by chaviw's avatar chaviw
Browse files

Remove detachChildren

There's no longer a need to have detachChildren since we only used it to
ensure the children were not deleted before the exit animation. The
timing when closing an app has changed so the app is not stopped until
everything has closed. This means the children of the window will not
try to remove themselves until after the animation completes

Test: Close app with SurfaceView. No hole in exit animation
Bug: 177557720

Change-Id: I48642864d5315b2bf563c675756283fa73554de4
parent 07a787db
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -192,7 +192,6 @@ public final class SurfaceControl implements Parcelable {
            long newParentObject);
    private static native void nativeReparent(long transactionObj, long nativeObject,
            long newParentNativeObject);
    private static native void nativeSeverChildren(long transactionObj, long nativeObject);

    private static native Display.HdrCapabilities nativeGetHdrCapabilities(IBinder displayToken);

@@ -2997,15 +2996,6 @@ public final class SurfaceControl implements Parcelable {
            return this;
        }

        /**
         * @hide
         */
        public Transaction detachChildren(SurfaceControl sc) {
            checkPreconditions(sc);
            nativeSeverChildren(mNativeObject, sc.mNativeObject);
            return this;
        }

        /**
         * Fills the surface with the specified color.
         * @param color A float array with three values to represent r, g, b in range [0..1]. An
+0 −10
Original line number Diff line number Diff line
@@ -1420,14 +1420,6 @@ static void nativeReparent(JNIEnv* env, jclass clazz, jlong transactionObj,
    transaction->reparent(ctrl, newParent);
}

static void nativeSeverChildren(JNIEnv* env, jclass clazz, jlong transactionObj,
        jlong nativeObject) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);

    auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
    transaction->detachChildren(ctrl);
}

static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject tokenObject) {
    sp<IBinder> token(ibinderForJavaObject(env, tokenObject));
    if (token == NULL) return NULL;
@@ -1841,8 +1833,6 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeReparentChildren } ,
    {"nativeReparent", "(JJJ)V",
            (void*)nativeReparent },
    {"nativeSeverChildren", "(JJ)V",
            (void*)nativeSeverChildren } ,
    {"nativeCaptureDisplay",
            "(Landroid/view/SurfaceControl$DisplayCaptureArgs;Landroid/view/SurfaceControl$ScreenCaptureListener;)I",
            (void*)nativeCaptureDisplay },
+0 −16
Original line number Diff line number Diff line
@@ -3109,12 +3109,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            freezeBounds();
        }

        // In the process of tearing down before relaunching, the app will
        // try and clean up it's child surfaces. We need to prevent this from
        // happening, so we sever the children, transfering their ownership
        // from the client it-self to the parent surface (owned by us).
        detachChildren();

        clearAllDrawn();

        mPendingRelaunchCount++;
@@ -3139,15 +3133,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        task.mPreparedFrozenMergedConfig.unset();
    }

    void detachChildren() {
        SurfaceControl.openTransaction();
        for (int i = mChildren.size() - 1; i >= 0; i--) {
            final WindowState w = mChildren.get(i);
            w.mWinAnimator.detachChildren(getGlobalTransaction());
        }
        SurfaceControl.closeTransaction();
    }

    void finishRelaunching() {
        mTaskSupervisor.getActivityMetricsLogger().notifyActivityRelaunched(this);
        unfreezeBounds();
@@ -4577,7 +4562,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                        + appToken);
                return;
            }
            detachChildren();
        }
        if (app != null) {
            mTaskSupervisor.onProcessActivityStateChanged(app, false /* forceBatch */);
+0 −9
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import static android.provider.Settings.Global.DEVELOPMENT_RENDER_SHADOWS_IN_COM
import static android.provider.Settings.Global.DEVELOPMENT_WM_DISPLAY_SETTINGS_PATH;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
import static android.view.SurfaceControl.getGlobalTransaction;
import static android.view.WindowManager.DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
@@ -2585,14 +2584,6 @@ public class WindowManagerService extends IWindowManager.Stub
            mAccessibilityController.onWindowTransitionLocked(win, transit);
        }

        // When we start the exit animation we take the Surface from the client
        // so it will stop perturbing it. We need to likewise takeaway the SurfaceFlinger
        // side child surfaces, so they will remain preserved in their current state
        // (rather than be cleaned up immediately by the app code).
        SurfaceControl.openTransaction();
        winAnimator.detachChildren(getGlobalTransaction());
        SurfaceControl.closeTransaction();

        return focusMayChange;
    }

+0 −12
Original line number Diff line number Diff line
@@ -3201,18 +3201,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            return;
        }

        if (!clientVisible) {
            // Once we are notifying the client that it's visibility has changed, we need to prevent
            // it from destroying child surfaces until the animation has finished. We do this by
            // detaching any surface control the client added from the client.
            for (int i = mChildren.size() - 1; i >= 0; --i) {
                final WindowState c = mChildren.get(i);
                c.mWinAnimator.detachChildren(getGlobalTransaction());
            }

            mWinAnimator.detachChildren(getGlobalTransaction());
        }

        try {
            if (DEBUG_VISIBILITY) Slog.v(TAG,
                    "Setting visibility of " + this + ": " + clientVisible);
Loading