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

Commit 0c1ecb58 authored by Liana Kazanova's avatar Liana Kazanova Committed by Android (Google) Code Review
Browse files

Merge "Revert "Introducing Display Sythetic modes - used for app request...

Merge "Revert "Introducing Display Sythetic modes - used for app request refresh rate/resolution selection"" into main
parents 939bd52b caa86a7c
Loading
Loading
Loading
Loading
+9 −24
Original line number Diff line number Diff line
@@ -1230,7 +1230,7 @@ public final class Display {
    public Mode[] getSupportedModes() {
        synchronized (mLock) {
            updateDisplayInfoLocked();
            final Display.Mode[] modes = mDisplayInfo.appsSupportedModes;
            final Display.Mode[] modes = mDisplayInfo.supportedModes;
            return Arrays.copyOf(modes, modes.length);
        }
    }
@@ -2213,7 +2213,6 @@ public final class Display {
        @NonNull
        @HdrCapabilities.HdrType
        private final int[] mSupportedHdrTypes;
        private final boolean mIsSynthetic;

        /**
         * @hide
@@ -2224,6 +2223,13 @@ public final class Display {
                    new int[0]);
        }

        /**
         * @hide
         */
        public Mode(int width, int height, float refreshRate, float vsyncRate) {
            this(INVALID_MODE_ID, width, height, refreshRate, vsyncRate, new float[0], new int[0]);
        }

        /**
         * @hide
         */
@@ -2247,21 +2253,11 @@ public final class Display {
         */
        public Mode(int modeId, int width, int height, float refreshRate, float vsyncRate,
                float[] alternativeRefreshRates, @HdrCapabilities.HdrType int[] supportedHdrTypes) {
            this(modeId, width, height, refreshRate, vsyncRate, false, alternativeRefreshRates,
                    supportedHdrTypes);
        }
        /**
         * @hide
         */
        public Mode(int modeId, int width, int height, float refreshRate, float vsyncRate,
                boolean isSynthetic, float[] alternativeRefreshRates,
                @HdrCapabilities.HdrType int[] supportedHdrTypes) {
            mModeId = modeId;
            mWidth = width;
            mHeight = height;
            mPeakRefreshRate = refreshRate;
            mVsyncRate = vsyncRate;
            mIsSynthetic = isSynthetic;
            mAlternativeRefreshRates =
                    Arrays.copyOf(alternativeRefreshRates, alternativeRefreshRates.length);
            Arrays.sort(mAlternativeRefreshRates);
@@ -2325,15 +2321,6 @@ public final class Display {
            return mVsyncRate;
        }

        /**
         * Returns true if mode is synthetic and does not have corresponding
         * SurfaceControl.DisplayMode
         * @hide
         */
        public boolean isSynthetic() {
            return mIsSynthetic;
        }

        /**
         * Returns an array of refresh rates which can be switched to seamlessly.
         * <p>
@@ -2469,7 +2456,6 @@ public final class Display {
                    .append(", height=").append(mHeight)
                    .append(", fps=").append(mPeakRefreshRate)
                    .append(", vsync=").append(mVsyncRate)
                    .append(", synthetic=").append(mIsSynthetic)
                    .append(", alternativeRefreshRates=")
                    .append(Arrays.toString(mAlternativeRefreshRates))
                    .append(", supportedHdrTypes=")
@@ -2485,7 +2471,7 @@ public final class Display {

        private Mode(Parcel in) {
            this(in.readInt(), in.readInt(), in.readInt(), in.readFloat(), in.readFloat(),
                    in.readBoolean(), in.createFloatArray(), in.createIntArray());
                    in.createFloatArray(), in.createIntArray());
        }

        @Override
@@ -2495,7 +2481,6 @@ public final class Display {
            out.writeInt(mHeight);
            out.writeFloat(mPeakRefreshRate);
            out.writeFloat(mVsyncRate);
            out.writeBoolean(mIsSynthetic);
            out.writeFloatArray(mAlternativeRefreshRates);
            out.writeIntArray(mSupportedHdrTypes);
        }
+1 −21
Original line number Diff line number Diff line
@@ -211,12 +211,6 @@ public final class DisplayInfo implements Parcelable {
     */
    public Display.Mode[] supportedModes = Display.Mode.EMPTY_ARRAY;

    /**
     * The supported modes that will be exposed externally.
     * Might have different set of modes that supportedModes for VRR displays
     */
    public Display.Mode[] appsSupportedModes = Display.Mode.EMPTY_ARRAY;

    /** The active color mode. */
    public int colorMode;

@@ -435,7 +429,6 @@ public final class DisplayInfo implements Parcelable {
                && defaultModeId == other.defaultModeId
                && userPreferredModeId == other.userPreferredModeId
                && Arrays.equals(supportedModes, other.supportedModes)
                && Arrays.equals(appsSupportedModes, other.appsSupportedModes)
                && colorMode == other.colorMode
                && Arrays.equals(supportedColorModes, other.supportedColorModes)
                && Objects.equals(hdrCapabilities, other.hdrCapabilities)
@@ -495,8 +488,6 @@ public final class DisplayInfo implements Parcelable {
        defaultModeId = other.defaultModeId;
        userPreferredModeId = other.userPreferredModeId;
        supportedModes = Arrays.copyOf(other.supportedModes, other.supportedModes.length);
        appsSupportedModes = Arrays.copyOf(
                other.appsSupportedModes, other.appsSupportedModes.length);
        colorMode = other.colorMode;
        supportedColorModes = Arrays.copyOf(
                other.supportedColorModes, other.supportedColorModes.length);
@@ -554,11 +545,6 @@ public final class DisplayInfo implements Parcelable {
        for (int i = 0; i < nModes; i++) {
            supportedModes[i] = Display.Mode.CREATOR.createFromParcel(source);
        }
        int nAppModes = source.readInt();
        appsSupportedModes = new Display.Mode[nAppModes];
        for (int i = 0; i < nAppModes; i++) {
            appsSupportedModes[i] = Display.Mode.CREATOR.createFromParcel(source);
        }
        colorMode = source.readInt();
        int nColorModes = source.readInt();
        supportedColorModes = new int[nColorModes];
@@ -625,10 +611,6 @@ public final class DisplayInfo implements Parcelable {
        for (int i = 0; i < supportedModes.length; i++) {
            supportedModes[i].writeToParcel(dest, flags);
        }
        dest.writeInt(appsSupportedModes.length);
        for (int i = 0; i < appsSupportedModes.length; i++) {
            appsSupportedModes[i].writeToParcel(dest, flags);
        }
        dest.writeInt(colorMode);
        dest.writeInt(supportedColorModes.length);
        for (int i = 0; i < supportedColorModes.length; i++) {
@@ -867,10 +849,8 @@ public final class DisplayInfo implements Parcelable {
        sb.append(defaultModeId);
        sb.append(", userPreferredModeId ");
        sb.append(userPreferredModeId);
        sb.append(", supportedModes ");
        sb.append(", modes ");
        sb.append(Arrays.toString(supportedModes));
        sb.append(", appsSupportedModes ");
        sb.append(Arrays.toString(appsSupportedModes));
        sb.append(", hdrCapabilities ");
        sb.append(hdrCapabilities);
        sb.append(", userDisabledHdrTypes ");
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ abstract class DisplayAdapter {
            float[] alternativeRefreshRates,
            @Display.HdrCapabilities.HdrType int[] supportedHdrTypes) {
        return new Display.Mode(NEXT_DISPLAY_MODE_ID.getAndIncrement(), width, height, refreshRate,
                vsyncRate, false, alternativeRefreshRates, supportedHdrTypes);
                vsyncRate, alternativeRefreshRates, supportedHdrTypes);
    }

    public interface Listener {
+1 −7
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.view.SurfaceControl;

import com.android.server.display.layout.Layout;
import com.android.server.display.mode.DisplayModeDirector;
import com.android.server.display.mode.SyntheticModeManager;
import com.android.server.wm.utils.InsetUtils;

import java.io.PrintWriter;
@@ -409,8 +408,7 @@ final class LogicalDisplay {
     *
     * @param deviceRepo Repository of active {@link DisplayDevice}s.
     */
    public void updateLocked(DisplayDeviceRepository deviceRepo,
            SyntheticModeManager syntheticModeManager) {
    public void updateLocked(DisplayDeviceRepository deviceRepo) {
        // Nothing to update if already invalid.
        if (mPrimaryDisplayDevice == null) {
            return;
@@ -428,7 +426,6 @@ final class LogicalDisplay {
        // logical display that they are sharing.  (eg. Adjust size for pixel-perfect
        // mirroring over HDMI.)
        DisplayDeviceInfo deviceInfo = mPrimaryDisplayDevice.getDisplayDeviceInfoLocked();
        DisplayDeviceConfig config = mPrimaryDisplayDevice.getDisplayDeviceConfig();
        if (!Objects.equals(mPrimaryDisplayDeviceInfo, deviceInfo) || mDirty) {
            mBaseDisplayInfo.layerStack = mLayerStack;
            mBaseDisplayInfo.flags = 0;
@@ -510,9 +507,6 @@ final class LogicalDisplay {
            mBaseDisplayInfo.userPreferredModeId = deviceInfo.userPreferredModeId;
            mBaseDisplayInfo.supportedModes = Arrays.copyOf(
                    deviceInfo.supportedModes, deviceInfo.supportedModes.length);
            mBaseDisplayInfo.appsSupportedModes = syntheticModeManager.createAppSupportedModes(
                    config, mBaseDisplayInfo.supportedModes
            );
            mBaseDisplayInfo.colorMode = deviceInfo.colorMode;
            mBaseDisplayInfo.supportedColorModes = Arrays.copyOf(
                    deviceInfo.supportedColorModes,
+4 −8
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import com.android.server.LocalServices;
import com.android.server.display.feature.DisplayManagerFlags;
import com.android.server.display.layout.DisplayIdProducer;
import com.android.server.display.layout.Layout;
import com.android.server.display.mode.SyntheticModeManager;
import com.android.server.display.utils.DebugUtils;
import com.android.server.policy.WindowManagerPolicy;
import com.android.server.utils.FoldSettingProvider;
@@ -205,7 +204,6 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
    private boolean mBootCompleted = false;
    private boolean mInteractive;
    private final DisplayManagerFlags mFlags;
    private final SyntheticModeManager mSyntheticModeManager;

    LogicalDisplayMapper(@NonNull Context context, FoldSettingProvider foldSettingProvider,
            FoldGracePeriodProvider foldGracePeriodProvider,
@@ -215,8 +213,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
        this(context, foldSettingProvider, foldGracePeriodProvider, repo, listener, syncRoot,
                handler,
                new DeviceStateToLayoutMap((isDefault) -> isDefault ? DEFAULT_DISPLAY
                        : sNextNonDefaultDisplayId++, flags), flags,
                new SyntheticModeManager(flags));
                        : sNextNonDefaultDisplayId++, flags), flags);
    }

    LogicalDisplayMapper(@NonNull Context context, FoldSettingProvider foldSettingProvider,
@@ -224,7 +221,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
            @NonNull DisplayDeviceRepository repo,
            @NonNull Listener listener, @NonNull DisplayManagerService.SyncRoot syncRoot,
            @NonNull Handler handler, @NonNull DeviceStateToLayoutMap deviceStateToLayoutMap,
            DisplayManagerFlags flags, SyntheticModeManager syntheticModeManager) {
            DisplayManagerFlags flags) {
        mSyncRoot = syncRoot;
        mPowerManager = context.getSystemService(PowerManager.class);
        mInteractive = mPowerManager.isInteractive();
@@ -244,7 +241,6 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
        mDisplayDeviceRepo.addListener(this);
        mDeviceStateToLayoutMap = deviceStateToLayoutMap;
        mFlags = flags;
        mSyntheticModeManager = syntheticModeManager;
    }

    @Override
@@ -741,7 +737,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
            mTempDisplayInfo.copyFrom(display.getDisplayInfoLocked());
            display.getNonOverrideDisplayInfoLocked(mTempNonOverrideDisplayInfo);

            display.updateLocked(mDisplayDeviceRepo, mSyntheticModeManager);
            display.updateLocked(mDisplayDeviceRepo);
            final DisplayInfo newDisplayInfo = display.getDisplayInfoLocked();
            final int updateState = mUpdatedLogicalDisplays.get(displayId, UPDATE_STATE_NEW);
            final boolean wasPreviouslyUpdated = updateState != UPDATE_STATE_NEW;
@@ -1181,7 +1177,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
        final LogicalDisplay display = new LogicalDisplay(displayId, layerStack, device,
                mFlags.isPixelAnisotropyCorrectionInLogicalDisplayEnabled(),
                mFlags.isAlwaysRotateDisplayDeviceEnabled());
        display.updateLocked(mDisplayDeviceRepo, mSyntheticModeManager);
        display.updateLocked(mDisplayDeviceRepo);

        final DisplayInfo info = display.getDisplayInfoLocked();
        if (info.type == Display.TYPE_INTERNAL && mDeviceStateToLayoutMap.size() > 1) {
Loading