diff options
| author | Android Build Merger (Role) <android-build-merger@google.com> | 2017-06-21 00:02:05 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-06-21 00:02:14 +0000 |
| commit | 14f8fd200465a6543ee02e98022508f535238c67 (patch) | |
| tree | 924459161c794a4414c994b6ec6bf34d576c645b /core/java | |
| parent | fd4b85ad1ce5a92e8b578cb89f2a4c0008daafb1 (diff) | |
| parent | f979298b48eb2cff5b4330a7e2bde7d35b333fe3 (diff) | |
Merge "Merge "Only enable wide color gamut support on capable devices" into oc-dr1-dev am: 8d4ff1b34f am: b11cf2d2e5"
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/content/res/Configuration.java | 25 | ||||
| -rw-r--r-- | core/java/android/view/Display.java | 4 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 3 |
3 files changed, 18 insertions, 14 deletions
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java index 88c1627f955b..6834ba816910 100644 --- a/core/java/android/content/res/Configuration.java +++ b/core/java/android/content/res/Configuration.java @@ -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; diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index 3e9fab1aee27..cdb9b8229314 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -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) { diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 1fc4c3eb516a..e27eab92319b 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -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()); |
