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

Commit bdaa6f70 authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "Refine the naming about compatible scale" into tm-qpr-dev

parents 1f9eb488 d95134d7
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ public final class ViewRootImpl implements ViewParent,
    private final InsetsState mTempInsets = new InsetsState();
    private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[SIZE];
    private final WindowConfiguration mTempWinConfig = new WindowConfiguration();
    private float mInvSizeCompatScale = 1f;
    private float mInvCompatScale = 1f;
    final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
            = new ViewTreeObserver.InternalInsetsInfo();

@@ -1119,11 +1119,11 @@ public final class ViewRootImpl implements ViewParent,

    private WindowConfiguration getCompatWindowConfiguration() {
        final WindowConfiguration winConfig = getConfiguration().windowConfiguration;
        if (mInvSizeCompatScale == 1f) {
        if (mInvCompatScale == 1f) {
            return winConfig;
        }
        mTempWinConfig.setTo(winConfig);
        mTempWinConfig.scale(mInvSizeCompatScale);
        mTempWinConfig.scale(mInvCompatScale);
        return mTempWinConfig;
    }

@@ -1257,11 +1257,11 @@ public final class ViewRootImpl implements ViewParent,
                    controlInsetsForCompatibility(mWindowAttributes);

                    Rect attachedFrame = new Rect();
                    final float[] sizeCompatScale = { 1f };
                    final float[] compatScale = { 1f };
                    res = mWindowSession.addToDisplayAsUser(mWindow, mWindowAttributes,
                            getHostVisibility(), mDisplay.getDisplayId(), userId,
                            mInsetsController.getRequestedVisibilities(), inputChannel, mTempInsets,
                            mTempControls, attachedFrame, sizeCompatScale);
                            mTempControls, attachedFrame, compatScale);
                    if (!attachedFrame.isValid()) {
                        attachedFrame = null;
                    }
@@ -1271,8 +1271,8 @@ public final class ViewRootImpl implements ViewParent,
                        mTranslator.translateRectInScreenToAppWindow(attachedFrame);
                    }
                    mTmpFrames.attachedFrame = attachedFrame;
                    mTmpFrames.sizeCompatScale = sizeCompatScale[0];
                    mInvSizeCompatScale = 1f / sizeCompatScale[0];
                    mTmpFrames.compatScale = compatScale[0];
                    mInvCompatScale = 1f / compatScale[0];
                } catch (RemoteException e) {
                    mAdded = false;
                    mView = null;
@@ -1794,24 +1794,24 @@ public final class ViewRootImpl implements ViewParent,
            mTranslator.translateRectInScreenToAppWindow(displayFrame);
            mTranslator.translateRectInScreenToAppWindow(attachedFrame);
        }
        final float sizeCompatScale = frames.sizeCompatScale;
        final float compatScale = frames.compatScale;
        final boolean frameChanged = !mWinFrame.equals(frame);
        final boolean configChanged = !mLastReportedMergedConfiguration.equals(mergedConfiguration);
        final boolean attachedFrameChanged = LOCAL_LAYOUT
                && !Objects.equals(mTmpFrames.attachedFrame, attachedFrame);
        final boolean displayChanged = mDisplay.getDisplayId() != displayId;
        final boolean resizeModeChanged = mResizeMode != resizeMode;
        final boolean sizeCompatScaleChanged = mTmpFrames.sizeCompatScale != sizeCompatScale;
        final boolean compatScaleChanged = mTmpFrames.compatScale != compatScale;
        if (msg == MSG_RESIZED && !frameChanged && !configChanged && !attachedFrameChanged
                && !displayChanged && !resizeModeChanged && !forceNextWindowRelayout
                && !sizeCompatScaleChanged) {
                && !compatScaleChanged) {
            return;
        }

        mPendingDragResizing = resizeMode != RESIZE_MODE_INVALID;
        mResizeMode = resizeMode;
        mTmpFrames.sizeCompatScale = sizeCompatScale;
        mInvSizeCompatScale = 1f / sizeCompatScale;
        mTmpFrames.compatScale = compatScale;
        mInvCompatScale = 1f / compatScale;

        if (configChanged) {
            // If configuration changed - notify about that and, maybe, about move to display.
@@ -8240,7 +8240,7 @@ public final class ViewRootImpl implements ViewParent,
                mTranslator.translateInsetsStateInScreenToAppWindow(mTempInsets);
                mTranslator.translateSourceControlsInScreenToAppWindow(mTempControls);
            }
            mInvSizeCompatScale = 1f / mTmpFrames.sizeCompatScale;
            mInvCompatScale = 1f / mTmpFrames.compatScale;
            mInsetsController.onStateChanged(mTempInsets);
            mInsetsController.onControlsChanged(mTempControls);

+5 −5
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class ClientWindowFrames implements Parcelable {

    public boolean isParentFrameClippedByDisplayCutout;

    public float sizeCompatScale = 1f;
    public float compatScale = 1f;

    public ClientWindowFrames() {
    }
@@ -62,7 +62,7 @@ public class ClientWindowFrames implements Parcelable {
            attachedFrame = new Rect(other.attachedFrame);
        }
        isParentFrameClippedByDisplayCutout = other.isParentFrameClippedByDisplayCutout;
        sizeCompatScale = other.sizeCompatScale;
        compatScale = other.compatScale;
    }

    private ClientWindowFrames(Parcel in) {
@@ -76,7 +76,7 @@ public class ClientWindowFrames implements Parcelable {
        parentFrame.readFromParcel(in);
        attachedFrame = in.readTypedObject(Rect.CREATOR);
        isParentFrameClippedByDisplayCutout = in.readBoolean();
        sizeCompatScale = in.readFloat();
        compatScale = in.readFloat();
    }

    @Override
@@ -86,7 +86,7 @@ public class ClientWindowFrames implements Parcelable {
        parentFrame.writeToParcel(dest, flags);
        dest.writeTypedObject(attachedFrame, flags);
        dest.writeBoolean(isParentFrameClippedByDisplayCutout);
        dest.writeFloat(sizeCompatScale);
        dest.writeFloat(compatScale);
    }

    @Override
@@ -97,7 +97,7 @@ public class ClientWindowFrames implements Parcelable {
                + " parentFrame=" + parentFrame.toShortString(sb)
                + (attachedFrame != null ? " attachedFrame=" + attachedFrame.toShortString() : "")
                + (isParentFrameClippedByDisplayCutout ? " parentClippedByDisplayCutout" : "")
                + (sizeCompatScale != 1f ? " sizeCompatScale=" + sizeCompatScale : "") +  "}";
                + (compatScale != 1f ? " sizeCompatScale=" + compatScale : "") +  "}";
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -7940,8 +7940,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    @Override
    float getSizeCompatScale() {
        return hasSizeCompatBounds() ? mSizeCompatScale : super.getSizeCompatScale();
    float getCompatScale() {
        return hasSizeCompatBounds() ? mSizeCompatScale : super.getCompatScale();
    }

    @Override
+2 −3
Original line number Diff line number Diff line
@@ -576,9 +576,8 @@ final class LetterboxUiController {
        // Rounded corners should be displayed above the taskbar.
        bounds.bottom =
                Math.min(bounds.bottom, getTaskbarInsetsSource(mainWindow).getFrame().top);
        if (mActivityRecord.inSizeCompatMode()
                && mActivityRecord.getSizeCompatScale() < 1.0f) {
            bounds.scale(1.0f / mActivityRecord.getSizeCompatScale());
        if (mActivityRecord.inSizeCompatMode() && mActivityRecord.getCompatScale() < 1.0f) {
            bounds.scale(1.0f / mActivityRecord.getCompatScale());
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -1883,7 +1883,7 @@ public class WindowManagerService extends IWindowManager.Stub
                // Make this invalid which indicates a null attached frame.
                outAttachedFrame.set(0, 0, -1, -1);
            }
            outSizeCompatScale[0] = win.getSizeCompatScaleForClient();
            outSizeCompatScale[0] = win.getCompatScaleForClient();
        }

        Binder.restoreCallingIdentity(origId);
@@ -8866,7 +8866,7 @@ public class WindowManagerService extends IWindowManager.Stub
                outInsetsState.set(state, true /* copySources */);
                if (WindowState.hasCompatScale(attrs, token, overrideScale)) {
                    final float compatScale = token != null && token.hasSizeCompatBounds()
                            ? token.getSizeCompatScale() * overrideScale
                            ? token.getCompatScale() * overrideScale
                            : overrideScale;
                    outInsetsState.scale(1f / compatScale);
                }
Loading