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

Commit f3b731f2 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove unused window layout conditions

- No one sets FINISH_LAYOUT_REDO_CONFIG.
- mUpdateRotation is never true.
- Reduce wrapper method of performSurfacePlacement because
  it must be invoked from the only caller in real case.

Bug: 163976519
Flag: EXEMPT remove outdated code
Test: CtsWindowManagerDeviceActivity
Change-Id: I8c7dd18752cbefbc20a62d6625e99685b0e6a972
parent 3f5a77d3
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -148,8 +148,6 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
    int ACTION_PASS_TO_USER = 0x00000001;
    /** Layout state may have changed (so another layout will be performed) */
    int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
    /** Configuration state may have changed */
    int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
    /** Wallpaper may need to move */
    int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
    /** Need to recompute animations */
+0 −9
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@ import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_WALLPAPER;
import static com.android.internal.protolog.WmProtoLogGroups.WM_SHOW_TRANSACTIONS;
import static com.android.internal.util.LatencyTracker.ACTION_ROTATE_SCREEN;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.ActivityRecord.State.RESUMED;
@@ -5090,14 +5089,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            mWallpaperController.adjustWallpaperWindows();
        }

        if ((pendingLayoutChanges & FINISH_LAYOUT_REDO_CONFIG) != 0) {
            if (DEBUG_LAYOUT) Slog.v(TAG, "Computing new config from layout");
            if (updateOrientation()) {
                setLayoutNeeded();
                sendNewConfiguration();
            }
        }

        if ((pendingLayoutChanges & FINISH_LAYOUT_REDO_LAYOUT) != 0) {
            setLayoutNeeded();
        }
+3 −23
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import static android.window.DesktopExperienceFlags.ENABLE_DISPLAY_CONTENT_MODE_

import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_FOCUS_LIGHT;
import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_KEEP_SCREEN_ON;
import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ORIENTATION;
import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_STATES;
import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_TASKS;
import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_WALLPAPER;
@@ -109,7 +108,6 @@ import android.hardware.display.DisplayManagerInternal.DisplayBrightnessOverride
import android.hardware.power.Mode;
import android.net.Uri;
import android.os.Binder;
import android.os.Debug;
import android.os.FactoryTest;
import android.os.Handler;
import android.os.IBinder;
@@ -190,7 +188,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
    private final SparseArray<DisplayBrightnessOverrideRequest> mDisplayBrightnessOverrides =
            new SparseArray<>();
    private long mUserActivityTimeout = -1;
    private boolean mUpdateRotation = false;

    // Only set while traversing the default display based on its content.
    // Affects the behavior of mirroring on secondary displays.
    private boolean mObscureApplicationContentOnSecondaryDisplays = false;
@@ -738,20 +736,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
     * check and {@link WindowSurfacePlacer#isInLayout()} won't take effect.
     */
    void performSurfacePlacement() {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "performSurfacePlacement");
        try {
            performSurfacePlacementNoTrace();
        } finally {
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }
    }

    // "Something has changed!  Let's make it correct now."
    // TODO: Super long method that should be broken down...
    void performSurfacePlacementNoTrace() {
        if (DEBUG_WINDOW_TRACE) {
            Slog.v(TAG, "performSurfacePlacementInner: entry. Called by "
                    + Debug.getCallers(3));
            Slog.v(TAG, "performSurfacePlacement: entry");
        }

        int i;
@@ -862,13 +848,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                    mSustainedPerformanceModeEnabled);
        }

        if (mUpdateRotation) {
            ProtoLog.d(WM_DEBUG_ORIENTATION, "Performing post-rotate rotation");
            mUpdateRotation = updateRotationUnchecked();
        }

        if (!mWmService.mWaitingForDrawnCallbacks.isEmpty()
                || (!isLayoutNeeded() && !mUpdateRotation)) {
        if (!mWmService.mWaitingForDrawnCallbacks.isEmpty() || !isLayoutNeeded()) {
            mWmService.checkDrawnWindowsLocked();
        }

+0 −1
Original line number Diff line number Diff line
@@ -297,7 +297,6 @@ public abstract class WindowManagerInternal {
         *        bar caused by this app transition in millis
         *
         * @return Return any bit set of {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_LAYOUT},
         * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_CONFIG},
         * {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_WALLPAPER},
         * or {@link WindowManagerPolicy#FINISH_LAYOUT_REDO_ANIM}.
         */
+7 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static com.android.server.wm.WindowManagerService.H.REPORT_WINDOWS_CHANGE
import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD;

import android.os.Debug;
import android.os.Trace;
import android.util.Slog;

import java.io.PrintWriter;
@@ -169,8 +170,13 @@ class WindowSurfacePlacer {
            }
        }

        try {
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "performSurfacePlacement");
            try {
                mService.mRoot.performSurfacePlacement();
            } finally {
                Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
            }

            mInLayout = false;