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

Commit 0ddb7d49 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[SurfaceControl] Add API to query protected content support.

To facilitate display color service to know the capability of protected content
in GPU composition, add an API to SurfaceControl to query back from composer.

BUG: 117436546
Test: Build. flash and boot. Verify by checking returned value.
Change-Id: I313c88e68dc4d2ae3f1e8e9d11b1f4d877a4d64f
parent becdfa7a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@ public class SurfaceControl implements Parcelable {
            InputWindowHandle handle);
    private static native void nativeTransferTouchFocus(long transactionObj, IBinder fromToken,
            IBinder toToken);
    private static native boolean nativeGetProtectedContentSupport();

    private final CloseGuard mCloseGuard = CloseGuard.get();
    private String mName;
@@ -1729,6 +1730,14 @@ public class SurfaceControl implements Parcelable {
        return nativeCaptureLayers(layerHandleToken, sourceCrop, frameScale);
    }

    /**
     * Returns whether protected content is supported in GPU composition.
     * @hide
     */
    public static boolean getProtectedContentSupport() {
        return nativeGetProtectedContentSupport();
    }

    /**
     * @hide
     */
+6 −0
Original line number Diff line number Diff line
@@ -660,6 +660,10 @@ static void nativeSetDisplayPowerMode(JNIEnv* env, jclass clazz, jobject tokenOb
    if (t.duration() > 100ms) ALOGD("Excessive delay in setPowerMode()");
}

static jboolean nativeGetProtectedContentSupport(JNIEnv* env, jclass) {
    return static_cast<jboolean>(SurfaceComposerClient::getProtectedContentSupport());
}

static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) {
    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
    status_t err = ctrl->clearLayerFrameStats();
@@ -1028,6 +1032,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeGetAnimationFrameStats },
    {"nativeSetDisplayPowerMode", "(Landroid/os/IBinder;I)V",
            (void*)nativeSetDisplayPowerMode },
    {"nativeGetProtectedContentSupport", "()Z",
            (void*)nativeGetProtectedContentSupport },
    {"nativeDeferTransactionUntil", "(JJLandroid/os/IBinder;J)V",
            (void*)nativeDeferTransactionUntil },
    {"nativeDeferTransactionUntilSurface", "(JJJJ)V",