Merge "Only enable wide color gamut support on capable devices" into oc-dr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8d4ff1b34f
@@ -16,29 +16,26 @@
|
||||
|
||||
package android.content.res;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayInfo;
|
||||
import com.android.internal.util.XmlUtils;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ActivityInfo.Config;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.LocaleList;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.DisplayInfo;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.internal.util.XmlUtils;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -1818,9 +1815,11 @@ public final class Configuration implements Parcelable, Comparable<Configuration
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the screen has a wide color gamut.
|
||||
* Return whether the screen has a wide color gamut and wide color gamut rendering
|
||||
* is supported by this device.
|
||||
*
|
||||
* @return true if the screen has a wide color gamut, false otherwise
|
||||
* @return true if the screen has a wide color gamut and wide color gamut rendering
|
||||
* is supported, false otherwise
|
||||
*/
|
||||
public boolean isScreenWideColorGamut() {
|
||||
return (colorMode & COLOR_MODE_WIDE_COLOR_GAMUT_MASK) == COLOR_MODE_WIDE_COLOR_GAMUT_YES;
|
||||
|
||||
@@ -21,6 +21,7 @@ import static android.Manifest.permission.CONFIGURE_DISPLAY_COLOR_MODE;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.content.res.CompatibilityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Point;
|
||||
@@ -854,6 +855,9 @@ public final class Display {
|
||||
|
||||
/**
|
||||
* Returns whether this display can be used to display wide color gamut content.
|
||||
* This does not necessarily mean the device itself can render wide color gamut
|
||||
* content. To ensure wide color gamut content can be produced, refer to
|
||||
* {@link Configuration#isScreenWideColorGamut()}.
|
||||
*/
|
||||
public boolean isWideColorGamut() {
|
||||
synchronized (this) {
|
||||
|
||||
@@ -963,7 +963,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|| insets.top != 0 || insets.bottom != 0;
|
||||
final boolean translucent = attrs.format != PixelFormat.OPAQUE || hasSurfaceInsets;
|
||||
final boolean wideGamut =
|
||||
attrs.getColorMode() == ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT;
|
||||
mContext.getResources().getConfiguration().isScreenWideColorGamut()
|
||||
&& attrs.getColorMode() == ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT;
|
||||
|
||||
mAttachInfo.mThreadedRenderer = ThreadedRenderer.create(mContext, translucent,
|
||||
attrs.getTitle().toString());
|
||||
|
||||
@@ -33,6 +33,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
android.hardware.oemlock-V1.0-java-static \
|
||||
android.hardware.tetheroffload.control-V1.0-java-static \
|
||||
android.hardware.vibrator-V1.0-java-constants \
|
||||
android.hardware.configstore-V1.0-java-static
|
||||
|
||||
ifneq ($(INCREMENTAL_BUILDS),)
|
||||
LOCAL_PROGUARD_ENABLED := disabled
|
||||
|
||||
@@ -1217,7 +1217,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
(displayInfo.isHdr()
|
||||
? Configuration.COLOR_MODE_HDR_YES
|
||||
: Configuration.COLOR_MODE_HDR_NO)
|
||||
| (displayInfo.isWideColorGamut()
|
||||
| (displayInfo.isWideColorGamut() && mService.hasWideColorGamutSupport()
|
||||
? Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_YES
|
||||
: Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_NO);
|
||||
|
||||
|
||||
@@ -131,6 +131,8 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import android.hardware.configstore.V1_0.ISurfaceFlingerConfigs;
|
||||
import android.hardware.configstore.V1_0.OptionalBool;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.hardware.display.DisplayManagerInternal;
|
||||
import android.hardware.input.InputManager;
|
||||
@@ -715,6 +717,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
final DisplayManager mDisplayManager;
|
||||
private final Display[] mDisplays;
|
||||
|
||||
// Indicates whether this device supports wide color gamut rendering
|
||||
private boolean mHasWideColorGamutSupport;
|
||||
|
||||
// Who is holding the screen on.
|
||||
private Session mHoldingScreenOn;
|
||||
private PowerManager.WakeLock mHoldingScreenWakeLock;
|
||||
@@ -4726,6 +4731,20 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public void systemReady() {
|
||||
mPolicy.systemReady();
|
||||
mTaskSnapshotController.systemReady();
|
||||
mHasWideColorGamutSupport = queryWideColorGamutSupport();
|
||||
}
|
||||
|
||||
private static boolean queryWideColorGamutSupport() {
|
||||
try {
|
||||
ISurfaceFlingerConfigs surfaceFlinger = ISurfaceFlingerConfigs.getService();
|
||||
OptionalBool hasWideColor = surfaceFlinger.hasWideColorDisplay();
|
||||
if (hasWideColor != null) {
|
||||
return hasWideColor.value;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// Ignore, we're in big trouble if we can't talk to SurfaceFlinger's config store
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
@@ -7521,4 +7540,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasWideColorGamutSupport() {
|
||||
return mHasWideColorGamutSupport;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user