Merge "Disable HDR dimming when screen rotates." into tm-dev
This commit is contained in:
@@ -221,6 +221,8 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
@DataSpace.NamedDataSpace int dataSpace);
|
@DataSpace.NamedDataSpace int dataSpace);
|
||||||
private static native void nativeSetDamageRegion(long transactionObj, long nativeObject,
|
private static native void nativeSetDamageRegion(long transactionObj, long nativeObject,
|
||||||
Region region);
|
Region region);
|
||||||
|
private static native void nativeSetDimmingEnabled(long transactionObj, long nativeObject,
|
||||||
|
boolean dimmingEnabled);
|
||||||
|
|
||||||
private static native void nativeOverrideHdrTypes(IBinder displayToken, int[] modes);
|
private static native void nativeOverrideHdrTypes(IBinder displayToken, int[] modes);
|
||||||
|
|
||||||
@@ -3837,6 +3839,27 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if the layer can be dimmed.
|
||||||
|
*
|
||||||
|
* <p>Dimming is to adjust brightness of the layer.
|
||||||
|
* Default value is {@code true}, which means the layer can be dimmed.
|
||||||
|
* Disabling dimming means the brightness of the layer can not be changed, i.e.,
|
||||||
|
* keep the white point for the layer same as the display brightness.</p>
|
||||||
|
*
|
||||||
|
* @param sc The SurfaceControl on which to enable or disable dimming.
|
||||||
|
* @param dimmingEnabled The dimming flag.
|
||||||
|
* @return this.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public @NonNull Transaction setDimmingEnabled(@NonNull SurfaceControl sc,
|
||||||
|
boolean dimmingEnabled) {
|
||||||
|
checkPreconditions(sc);
|
||||||
|
nativeSetDimmingEnabled(mNativeObject, sc.mNativeObject, dimmingEnabled);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the color space for the SurfaceControl. The supported color spaces are SRGB
|
* Set the color space for the SurfaceControl. The supported color spaces are SRGB
|
||||||
* and Display P3, other color spaces will be treated as SRGB. This can only be used for
|
* and Display P3, other color spaces will be treated as SRGB. This can only be used for
|
||||||
|
|||||||
@@ -851,6 +851,14 @@ static void nativeSetDamageRegion(JNIEnv* env, jclass clazz, jlong transactionOb
|
|||||||
transaction->setSurfaceDamageRegion(surfaceControl, region);
|
transaction->setSurfaceDamageRegion(surfaceControl, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nativeSetDimmingEnabled(JNIEnv* env, jclass clazz, jlong transactionObj,
|
||||||
|
jlong nativeObject, jboolean dimmingEnabled) {
|
||||||
|
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
|
||||||
|
|
||||||
|
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject);
|
||||||
|
transaction->setDimmingEnabled(ctrl, dimmingEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
static void nativeSetAlpha(JNIEnv* env, jclass clazz, jlong transactionObj,
|
static void nativeSetAlpha(JNIEnv* env, jclass clazz, jlong transactionObj,
|
||||||
jlong nativeObject, jfloat alpha) {
|
jlong nativeObject, jfloat alpha) {
|
||||||
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
|
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
|
||||||
@@ -2095,8 +2103,9 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
|
|||||||
(void*)nativeSetSize },
|
(void*)nativeSetSize },
|
||||||
{"nativeSetTransparentRegionHint", "(JJLandroid/graphics/Region;)V",
|
{"nativeSetTransparentRegionHint", "(JJLandroid/graphics/Region;)V",
|
||||||
(void*)nativeSetTransparentRegionHint },
|
(void*)nativeSetTransparentRegionHint },
|
||||||
{ "nativeSetDamageRegion", "(JJLandroid/graphics/Region;)V",
|
{"nativeSetDamageRegion", "(JJLandroid/graphics/Region;)V",
|
||||||
(void*)nativeSetDamageRegion },
|
(void*)nativeSetDamageRegion },
|
||||||
|
{"nativeSetDimmingEnabled", "(JJZ)V", (void*)nativeSetDimmingEnabled },
|
||||||
{"nativeSetAlpha", "(JJF)V",
|
{"nativeSetAlpha", "(JJF)V",
|
||||||
(void*)nativeSetAlpha },
|
(void*)nativeSetAlpha },
|
||||||
{"nativeSetColor", "(JJ[F)V",
|
{"nativeSetColor", "(JJ[F)V",
|
||||||
|
|||||||
@@ -216,6 +216,10 @@ class ScreenRotationAnimation {
|
|||||||
|
|
||||||
t.setLayer(mScreenshotLayer, SCREEN_FREEZE_LAYER_BASE);
|
t.setLayer(mScreenshotLayer, SCREEN_FREEZE_LAYER_BASE);
|
||||||
t.reparent(mBackColorSurface, displayContent.getSurfaceControl());
|
t.reparent(mBackColorSurface, displayContent.getSurfaceControl());
|
||||||
|
// If hdr layers are on-screen, e.g. picture-in-picture mode, the screenshot of
|
||||||
|
// rotation animation is an sdr image containing tone-mapping hdr content, then
|
||||||
|
// disable dimming effect to get avoid of hdr content being dimmed during animation.
|
||||||
|
t.setDimmingEnabled(mScreenshotLayer, false);
|
||||||
t.setLayer(mBackColorSurface, -1);
|
t.setLayer(mBackColorSurface, -1);
|
||||||
t.setColor(mBackColorSurface, new float[]{mStartLuma, mStartLuma, mStartLuma});
|
t.setColor(mBackColorSurface, new float[]{mStartLuma, mStartLuma, mStartLuma});
|
||||||
t.setAlpha(mBackColorSurface, 1);
|
t.setAlpha(mBackColorSurface, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user