Merge "Hook up HDR capabilities from native SurfaceControl" into nyc-dev
This commit is contained in:
@@ -1163,6 +1163,14 @@ public final class Display {
|
|||||||
public HdrCapabilities() {
|
public HdrCapabilities() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HdrCapabilities(int[] supportedHdrTypes, float maxLuminance,
|
||||||
|
float maxAverageLuminance, float minLuminance) {
|
||||||
|
mSupportedHdrTypes = supportedHdrTypes;
|
||||||
|
mMaxLuminance = maxLuminance;
|
||||||
|
mMaxAverageLuminance = maxAverageLuminance;
|
||||||
|
mMinLuminance = minLuminance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the supported HDR types of this display.
|
* Gets the supported HDR types of this display.
|
||||||
* Returns empty array if HDR is not supported by the display.
|
* Returns empty array if HDR is not supported by the display.
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ui/DisplayInfo.h>
|
#include <ui/DisplayInfo.h>
|
||||||
|
#include <ui/HdrCapabilities.h>
|
||||||
#include <ui/FrameStats.h>
|
#include <ui/FrameStats.h>
|
||||||
#include <ui/Rect.h>
|
#include <ui/Rect.h>
|
||||||
#include <ui/Region.h>
|
#include <ui/Region.h>
|
||||||
@@ -83,6 +84,11 @@ static struct {
|
|||||||
jmethodID init;
|
jmethodID init;
|
||||||
} gWindowAnimationFrameStatsClassInfo;
|
} gWindowAnimationFrameStatsClassInfo;
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
jclass clazz;
|
||||||
|
jmethodID ctor;
|
||||||
|
} gHdrCapabilitiesClassInfo;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
|
static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
|
||||||
@@ -603,6 +609,22 @@ static jobject nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) {
|
|||||||
return javaObjectForIBinder(env, ctrl->getHandle());
|
return javaObjectForIBinder(env, ctrl->getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject tokenObject) {
|
||||||
|
sp<IBinder> token(ibinderForJavaObject(env, tokenObject));
|
||||||
|
if (token == NULL) return NULL;
|
||||||
|
|
||||||
|
HdrCapabilities capabilities;
|
||||||
|
SurfaceComposerClient::getHdrCapabilities(token, &capabilities);
|
||||||
|
|
||||||
|
const auto& types = capabilities.getSupportedHdrTypes();
|
||||||
|
auto typesArray = env->NewIntArray(types.size());
|
||||||
|
env->SetIntArrayRegion(typesArray, 0, types.size(), types.data());
|
||||||
|
|
||||||
|
return env->NewObject(gHdrCapabilitiesClassInfo.clazz, gPhysicalDisplayInfoClassInfo.ctor,
|
||||||
|
typesArray, capabilities.getDesiredMaxLuminance(),
|
||||||
|
capabilities.getDesiredMaxAverageLuminance(), capabilities.getDesiredMinLuminance());
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static const JNINativeMethod sSurfaceControlMethods[] = {
|
static const JNINativeMethod sSurfaceControlMethods[] = {
|
||||||
@@ -724,6 +746,11 @@ int register_android_view_SurfaceControl(JNIEnv* env)
|
|||||||
animFrameStatsClazz, "init", "(J[J)V");
|
animFrameStatsClazz, "init", "(J[J)V");
|
||||||
gWindowAnimationFrameStatsClassInfo.UNDEFINED_TIME_NANO = undefined_time_nano;
|
gWindowAnimationFrameStatsClassInfo.UNDEFINED_TIME_NANO = undefined_time_nano;
|
||||||
|
|
||||||
|
jclass hdrCapabilitiesClazz = FindClassOrDie(env, "android/view/Display$HdrCapabilities");
|
||||||
|
gHdrCapabilitiesClassInfo.clazz = MakeGlobalRefOrDie(env, hdrCapabilitiesClazz);
|
||||||
|
gHdrCapabilitiesClassInfo.ctor = GetMethodIDOrDie(env, hdrCapabilitiesClazz, "<init>",
|
||||||
|
"([IFFF)V");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user