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

Commit 83cdd1e8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix launcher flicker when unlocking on seascape." into sc-dev

parents 6bdd00fa 954bb638
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -607,8 +607,9 @@ public class DeviceProfile {
     */
    public boolean updateIsSeascape(Context context) {
        if (isVerticalBarLayout()) {
            boolean isSeascape = DisplayController.getDefaultDisplay(context).getInfo().rotation
                    == Surface.ROTATION_270;
            // Check an up-to-date info.
            boolean isSeascape = DisplayController.getDefaultDisplay(context)
                    .createInfoForContext(context).rotation == Surface.ROTATION_270;
            if (mIsSeascape != isSeascape) {
                mIsSeascape = isSeascape;
                return true;
+19 −5
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import android.view.Display;

import androidx.annotation.VisibleForTesting;

import com.android.launcher3.Utilities;

import java.util.ArrayList;

/**
@@ -179,23 +181,35 @@ public class DisplayController implements DisplayListener {
            return mInfo;
        }

        /** Creates and up-to-date DisplayController.Info for the given context. */
        public Info createInfoForContext(Context context) {
            Display display = Utilities.ATLEAST_R
                    ? context.getDisplay()
                    : context
                        .getSystemService(DisplayManager.class)
                        .getDisplay(mId);
            return display == null
                    ? new Info(context)
                    : new Info(context, display);
        }

        protected void handleOnChange() {
            Info oldInfo = mInfo;
            Info info = new Info(mDisplayContext);
            Info newInfo = createInfoForContext(mDisplayContext);

            int change = 0;
            if (info.hasDifferentSize(oldInfo)) {
            if (newInfo.hasDifferentSize(oldInfo)) {
                change |= CHANGE_SIZE;
            }
            if (oldInfo.rotation != info.rotation) {
            if (newInfo.rotation != oldInfo.rotation) {
                change |= CHANGE_ROTATION;
            }
            if (info.singleFrameMs != oldInfo.singleFrameMs) {
            if (newInfo.singleFrameMs != oldInfo.singleFrameMs) {
                change |= CHANGE_FRAME_DELAY;
            }

            if (change != 0) {
                mInfo = info;
                mInfo = newInfo;
                final int flags = change;
                MAIN_EXECUTOR.execute(() -> notifyChange(flags));
            }