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

Commit fca8ee70 authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge changes from topic "hasArrSupport" into main

* changes:
  Add a support for synthetic mode with hasArrSupport
  Use hasArrSupport api
  Adds hasArrSupport api
  adds a flag for hasArrSupport
parents 582b6fa2 122966ff
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -50947,6 +50947,7 @@ package android.view {
    method public android.view.Display.Mode[] getSupportedModes();
    method @Deprecated public float[] getSupportedRefreshRates();
    method @Deprecated public int getWidth();
    method @FlaggedApi("com.android.server.display.feature.flags.enable_has_arr_support") public boolean hasArrSupport();
    method public boolean isHdr();
    method public boolean isHdrSdrRatioAvailable();
    method public boolean isMinimalPostProcessingSupported();
+13 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS;
import static android.hardware.flags.Flags.FLAG_OVERLAYPROPERTIES_CLASS_API;

import static com.android.server.display.feature.flags.Flags.FLAG_HIGHEST_HDR_SDR_RATIO_API;
import static com.android.server.display.feature.flags.Flags.FLAG_ENABLE_HAS_ARR_SUPPORT;

import android.Manifest;
import android.annotation.FlaggedApi;
@@ -1265,6 +1266,18 @@ public final class Display {
        }
    }

    /**
     * Returns whether display supports adaptive refresh rate or not.
     */
    // TODO(b/372526856) Add a link to the documentation for ARR.
    @FlaggedApi(FLAG_ENABLE_HAS_ARR_SUPPORT)
    public boolean hasArrSupport() {
        synchronized (mLock) {
            updateDisplayInfoLocked();
            return mDisplayInfo.hasArrSupport;
        }
    }

    /**
     * <p> Returns true if the connected display can be switched into a mode with minimal
     * post processing. </p>
+12 −0
Original line number Diff line number Diff line
@@ -197,6 +197,12 @@ public final class DisplayInfo implements Parcelable {
     */
    public float renderFrameRate;

    /**
     * If {@code true} this Display supports adaptive refresh rates.
     * // TODO(b/372526856) Add a link to the documentation for ARR.
     */
    public boolean hasArrSupport;

    /**
     * The default display mode.
     */
@@ -436,6 +442,7 @@ public final class DisplayInfo implements Parcelable {
                && rotation == other.rotation
                && modeId == other.modeId
                && renderFrameRate == other.renderFrameRate
                && hasArrSupport == other.hasArrSupport
                && defaultModeId == other.defaultModeId
                && userPreferredModeId == other.userPreferredModeId
                && Arrays.equals(supportedModes, other.supportedModes)
@@ -497,6 +504,7 @@ public final class DisplayInfo implements Parcelable {
        rotation = other.rotation;
        modeId = other.modeId;
        renderFrameRate = other.renderFrameRate;
        hasArrSupport = other.hasArrSupport;
        defaultModeId = other.defaultModeId;
        userPreferredModeId = other.userPreferredModeId;
        supportedModes = Arrays.copyOf(other.supportedModes, other.supportedModes.length);
@@ -553,6 +561,7 @@ public final class DisplayInfo implements Parcelable {
        rotation = source.readInt();
        modeId = source.readInt();
        renderFrameRate = source.readFloat();
        hasArrSupport = source.readBoolean();
        defaultModeId = source.readInt();
        userPreferredModeId = source.readInt();
        int nModes = source.readInt();
@@ -626,6 +635,7 @@ public final class DisplayInfo implements Parcelable {
        dest.writeInt(rotation);
        dest.writeInt(modeId);
        dest.writeFloat(renderFrameRate);
        dest.writeBoolean(hasArrSupport);
        dest.writeInt(defaultModeId);
        dest.writeInt(userPreferredModeId);
        dest.writeInt(supportedModes.length);
@@ -871,6 +881,8 @@ public final class DisplayInfo implements Parcelable {
        sb.append(modeId);
        sb.append(", renderFrameRate ");
        sb.append(renderFrameRate);
        sb.append(", hasArrSupport ");
        sb.append(hasArrSupport);
        sb.append(", defaultMode ");
        sb.append(defaultModeId);
        sb.append(", userPreferredModeId ");
+5 −2
Original line number Diff line number Diff line
@@ -1810,6 +1810,7 @@ public final class SurfaceControl implements Parcelable {
        public DisplayMode[] supportedDisplayModes;
        public int activeDisplayModeId;
        public float renderFrameRate;
        public boolean hasArrSupport;

        public int[] supportedColorModes;
        public int activeColorMode;
@@ -1827,6 +1828,7 @@ public final class SurfaceControl implements Parcelable {
                    + "supportedDisplayModes=" + Arrays.toString(supportedDisplayModes)
                    + ", activeDisplayModeId=" + activeDisplayModeId
                    + ", renderFrameRate=" + renderFrameRate
                    + ", hasArrSupport=" + hasArrSupport
                    + ", supportedColorModes=" + Arrays.toString(supportedColorModes)
                    + ", activeColorMode=" + activeColorMode
                    + ", hdrCapabilities=" + hdrCapabilities
@@ -1846,13 +1848,14 @@ public final class SurfaceControl implements Parcelable {
                && Arrays.equals(supportedColorModes, that.supportedColorModes)
                && activeColorMode == that.activeColorMode
                && Objects.equals(hdrCapabilities, that.hdrCapabilities)
                && preferredBootDisplayMode == that.preferredBootDisplayMode;
                && preferredBootDisplayMode == that.preferredBootDisplayMode
                && hasArrSupport == that.hasArrSupport;
        }

        @Override
        public int hashCode() {
            return Objects.hash(Arrays.hashCode(supportedDisplayModes), activeDisplayModeId,
                    renderFrameRate, activeColorMode, hdrCapabilities);
                    renderFrameRate, activeColorMode, hdrCapabilities, hasArrSupport);
        }
    }

+4 −1
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ static struct {
    jfieldID supportedDisplayModes;
    jfieldID activeDisplayModeId;
    jfieldID renderFrameRate;
    jfieldID hasArrSupport;
    jfieldID supportedColorModes;
    jfieldID activeColorMode;
    jfieldID hdrCapabilities;
@@ -1453,7 +1454,7 @@ static jobject nativeGetDynamicDisplayInfo(JNIEnv* env, jclass clazz, jlong disp
    env->SetIntField(object, gDynamicDisplayInfoClassInfo.activeDisplayModeId,
                     info.activeDisplayModeId);
    env->SetFloatField(object, gDynamicDisplayInfoClassInfo.renderFrameRate, info.renderFrameRate);

    env->SetBooleanField(object, gDynamicDisplayInfoClassInfo.hasArrSupport, info.hasArrSupport);
    jintArray colorModesArray = env->NewIntArray(info.supportedColorModes.size());
    if (colorModesArray == NULL) {
        jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
@@ -2641,6 +2642,8 @@ int register_android_view_SurfaceControl(JNIEnv* env)
            GetFieldIDOrDie(env, dynamicInfoClazz, "activeDisplayModeId", "I");
    gDynamicDisplayInfoClassInfo.renderFrameRate =
            GetFieldIDOrDie(env, dynamicInfoClazz, "renderFrameRate", "F");
    gDynamicDisplayInfoClassInfo.hasArrSupport =
            GetFieldIDOrDie(env, dynamicInfoClazz, "hasArrSupport", "Z");
    gDynamicDisplayInfoClassInfo.supportedColorModes =
            GetFieldIDOrDie(env, dynamicInfoClazz, "supportedColorModes", "[I");
    gDynamicDisplayInfoClassInfo.activeColorMode =
Loading