Support for Color HDR & Gamut

This commit is contained in:
Connor Tumbleson 2017-08-23 13:53:30 -04:00
parent eee73b945d
commit bf44f9b809
2 changed files with 39 additions and 4 deletions

View File

@ -52,6 +52,7 @@ public class ResConfigFlags {
private final char[] localeVariant; private final char[] localeVariant;
private final byte screenLayout2; private final byte screenLayout2;
private final byte colorimetry;
public final boolean isInvalid; public final boolean isInvalid;
@ -81,6 +82,7 @@ public class ResConfigFlags {
localeScript = null; localeScript = null;
localeVariant = null; localeVariant = null;
screenLayout2 = 0; screenLayout2 = 0;
colorimetry = COLOR_WIDE_UNDEFINED;
isInvalid = false; isInvalid = false;
mQualifiers = ""; mQualifiers = "";
size = 0; size = 0;
@ -93,7 +95,7 @@ public class ResConfigFlags {
short sdkVersion, byte screenLayout, byte uiMode, short sdkVersion, byte screenLayout, byte uiMode,
short smallestScreenWidthDp, short screenWidthDp, short smallestScreenWidthDp, short screenWidthDp,
short screenHeightDp, char[] localeScript, char[] localeVariant, short screenHeightDp, char[] localeScript, char[] localeVariant,
byte screenLayout2, boolean isInvalid, int size) { byte screenLayout2, byte colorimetry, boolean isInvalid, int size) {
if (orientation < 0 || orientation > 3) { if (orientation < 0 || orientation > 3) {
LOGGER.warning("Invalid orientation value: " + orientation); LOGGER.warning("Invalid orientation value: " + orientation);
orientation = 0; orientation = 0;
@ -157,6 +159,7 @@ public class ResConfigFlags {
this.localeScript = localeScript; this.localeScript = localeScript;
this.localeVariant = localeVariant; this.localeVariant = localeVariant;
this.screenLayout2 = screenLayout2; this.screenLayout2 = screenLayout2;
this.colorimetry = colorimetry;
this.isInvalid = isInvalid; this.isInvalid = isInvalid;
this.size = size; this.size = size;
mQualifiers = generateQualifiers(); mQualifiers = generateQualifiers();
@ -232,6 +235,22 @@ public class ResConfigFlags {
ret.append("-notlong"); ret.append("-notlong");
break; break;
} }
switch (colorimetry & COLOR_HDR_MASK) {
case COLOR_HDR_YES:
ret.append("-highdr");
break;
case COLOR_HDR_NO:
ret.append("-lowdr");
break;
}
switch (colorimetry & COLOR_WIDE_MASK) {
case COLOR_WIDE_YES:
ret.append("-widecg");
break;
case COLOR_WIDE_NO:
ret.append("-nowidecg");
break;
}
switch (screenLayout2 & MASK_SCREENROUND) { switch (screenLayout2 & MASK_SCREENROUND) {
case SCREENLAYOUT_ROUND_NO: case SCREENLAYOUT_ROUND_NO:
ret.append("-notround"); ret.append("-notround");
@ -400,7 +419,7 @@ public class ResConfigFlags {
} }
private short getNaturalSdkVersionRequirement() { private short getNaturalSdkVersionRequirement() {
if ((uiMode & MASK_UI_MODE_TYPE) == UI_MODE_TYPE_VR_HEADSET) { if ((uiMode & MASK_UI_MODE_TYPE) == UI_MODE_TYPE_VR_HEADSET || (colorimetry & COLOR_WIDE_MASK) != 0 || ((colorimetry & COLOR_HDR_MASK) != 0)) {
return SDK_OREO; return SDK_OREO;
} }
if ((screenLayout2 & MASK_SCREENROUND) != 0) { if ((screenLayout2 & MASK_SCREENROUND) != 0) {
@ -609,5 +628,18 @@ public class ResConfigFlags {
public final static byte UI_MODE_NIGHT_NO = 0x10; public final static byte UI_MODE_NIGHT_NO = 0x10;
public final static byte UI_MODE_NIGHT_YES = 0x20; public final static byte UI_MODE_NIGHT_YES = 0x20;
public final static byte COLOR_HDR_MASK = 0xC;
public final static byte COLOR_HDR_NO = 0x4;
public final static byte COLOR_HDR_SHIFT = 0x2;
public final static byte COLOR_HDR_UNDEFINED = 0x0;
public final static byte COLOR_HDR_YES = 0x8;
public final static byte COLOR_UNDEFINED = 0x0;
public final static byte COLOR_WIDE_UNDEFINED = 0x0;
public final static byte COLOR_WIDE_NO = 0x1;
public final static byte COLOR_WIDE_YES = 0x2;
public final static byte COLOR_WIDE_MASK = 0x3;
private static final Logger LOGGER = Logger.getLogger(ResConfigFlags.class.getName()); private static final Logger LOGGER = Logger.getLogger(ResConfigFlags.class.getName());
} }

View File

@ -381,9 +381,11 @@ public class ARSCDecoder {
} }
byte screenLayout2 = 0; byte screenLayout2 = 0;
byte colorimetry = 0;
if (size >= 52) { if (size >= 52) {
screenLayout2 = mIn.readByte(); screenLayout2 = mIn.readByte();
mIn.skipBytes(3); // reserved padding colorimetry = mIn.readByte();
mIn.skipBytes(2); // reserved padding
read = 52; read = 52;
} }
@ -419,7 +421,8 @@ public class ARSCDecoder {
orientation, touchscreen, density, keyboard, navigation, orientation, touchscreen, density, keyboard, navigation,
inputFlags, screenWidth, screenHeight, sdkVersion, inputFlags, screenWidth, screenHeight, sdkVersion,
screenLayout, uiMode, smallestScreenWidthDp, screenWidthDp, screenLayout, uiMode, smallestScreenWidthDp, screenWidthDp,
screenHeightDp, localeScript, localeVariant, screenLayout2, isInvalid, size); screenHeightDp, localeScript, localeVariant, screenLayout2,
colorimetry,isInvalid, size);
} }
private char[] unpackLanguageOrRegion(byte in0, byte in1, char base) throws AndrolibException { private char[] unpackLanguageOrRegion(byte in0, byte in1, char base) throws AndrolibException {