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

Commit a8693ecd authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "DisplayManager: Add an API to query for DISPLAY_DECORATON"

parents 63282b49 c66a2ac7
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1205,6 +1205,17 @@ public final class DisplayManager {
        mGlobal.setRefreshRateSwitchingType(newValue);
    }

    /**
     * Returns whether the specified display supports DISPLAY_DECORATION.
     *
     * @param displayId The display to query support.
     *
     * @hide
     */
    public boolean getDisplayDecorationSupport(int displayId) {
        return mGlobal.getDisplayDecorationSupport(displayId);
    }

    /**
     * Returns the user preference for "Match content frame rate".
     * <p>
+15 −0
Original line number Diff line number Diff line
@@ -811,6 +811,21 @@ public final class DisplayManagerGlobal {
        }
    }

    /**
     * Report whether the display supports DISPLAY_DECORATION.
     *
     * @param displayId The display whose support is being queried.
     *
     * @hide
     */
    public boolean getDisplayDecorationSupport(int displayId) {
        try {
            return mDm.getDisplayDecorationSupport(displayId);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Gets the brightness of the display.
     *
+3 −0
Original line number Diff line number Diff line
@@ -180,4 +180,7 @@ interface IDisplayManager {

    // Returns the refresh rate switching type.
    int getRefreshRateSwitchingType();

    // Query for DISPLAY_DECORATION support.
    boolean getDisplayDecorationSupport(int displayId);
}
+15 −0
Original line number Diff line number Diff line
@@ -231,6 +231,7 @@ public final class SurfaceControl implements Parcelable {
            float shadowRadius);
    private static native void nativeSetGlobalShadowSettings(@Size(4) float[] ambientColor,
            @Size(4) float[] spotColor, float lightPosY, float lightPosZ, float lightRadius);
    private static native boolean nativeGetDisplayDecorationSupport(IBinder displayToken);

    private static native void nativeSetFrameRate(long transactionObj, long nativeObject,
            float frameRate, int compatibility, int changeFrameRateStrategy);
@@ -2650,6 +2651,20 @@ public final class SurfaceControl implements Parcelable {
        nativeSetGlobalShadowSettings(ambientColor, spotColor, lightPosY, lightPosZ, lightRadius);
    }

    /**
     * Returns whether a display supports DISPLAY_DECORATION.
     *
     * @param displayToken
     *      The token for the display.
     *
     * @return Whether the display supports DISPLAY_DECORATION.
     *
     * @hide
     */
    public static boolean getDisplayDecorationSupport(IBinder displayToken) {
        return nativeGetDisplayDecorationSupport(displayToken);
    }

    /**
     * Adds a callback to be informed about SF's jank classification for a specific surface.
     * @hide
+11 −0
Original line number Diff line number Diff line
@@ -1768,6 +1768,15 @@ static void nativeSetGlobalShadowSettings(JNIEnv* env, jclass clazz, jfloatArray
    client->setGlobalShadowSettings(ambientColor, spotColor, lightPosY, lightPosZ, lightRadius);
}

static jboolean nativeGetDisplayDecorationSupport(JNIEnv* env, jclass clazz,
        jobject displayTokenObject) {
    sp<IBinder> displayToken(ibinderForJavaObject(env, displayTokenObject));
    if (displayToken == nullptr) {
        return JNI_FALSE;
    }
    return static_cast<jboolean>(SurfaceComposerClient::getDisplayDecorationSupport(displayToken));
}

static jlong nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) {
    SurfaceControl *surfaceControl = reinterpret_cast<SurfaceControl*>(nativeObject);
    return reinterpret_cast<jlong>(surfaceControl->getHandle().get());
@@ -2092,6 +2101,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeMirrorSurface },
    {"nativeSetGlobalShadowSettings", "([F[FFFF)V",
            (void*)nativeSetGlobalShadowSettings },
    {"nativeGetDisplayDecorationSupport", "(Landroid/os/IBinder;)Z",
            (void*)nativeGetDisplayDecorationSupport},
    {"nativeGetHandle", "(J)J",
            (void*)nativeGetHandle },
    {"nativeSetFixedTransformHint", "(JJI)V",
Loading