Added API 23 qualifier "roundness"

This commit is contained in:
Connor Tumbleson 2015-10-08 06:58:11 -05:00
parent 0abaab1173
commit a29839bab2
2 changed files with 31 additions and 3 deletions

View File

@ -51,6 +51,8 @@ public class ResConfigFlags {
private final char[] localeScript;
private final char[] localeVariant;
private final byte screenLayout2;
public final boolean isInvalid;
private final String mQualifiers;
@ -76,6 +78,7 @@ public class ResConfigFlags {
screenHeightDp = 0;
localeScript = null;
localeVariant = null;
screenLayout2 = 0;
isInvalid = false;
mQualifiers = "";
}
@ -87,7 +90,7 @@ public class ResConfigFlags {
short sdkVersion, byte screenLayout, byte uiMode,
short smallestScreenWidthDp, short screenWidthDp,
short screenHeightDp, char[] localeScript, char[] localeVariant,
boolean isInvalid) {
byte screenLayout2, boolean isInvalid) {
if (orientation < 0 || orientation > 3) {
LOGGER.warning("Invalid orientation value: " + orientation);
orientation = 0;
@ -150,6 +153,7 @@ public class ResConfigFlags {
this.screenHeightDp = screenHeightDp;
this.localeScript = localeScript;
this.localeVariant = localeVariant;
this.screenLayout2 = screenLayout2;
this.isInvalid = isInvalid;
mQualifiers = generateQualifiers();
}
@ -216,6 +220,14 @@ public class ResConfigFlags {
ret.append("-notlong");
break;
}
switch (screenLayout2 & MASK_SCREENROUND) {
case SCREENLAYOUT_ROUND_NO:
ret.append("-notround");
break;
case SCREENLAYOUT_ROUND_YES:
ret.append("-round");
break;
}
switch (orientation) {
case ORIENTATION_PORT:
ret.append("-port");
@ -373,6 +385,9 @@ public class ResConfigFlags {
}
private short getNaturalSdkVersionRequirement() {
if ((screenLayout2 & MASK_SCREENROUND) != 0) {
return SDK_MNC;
}
if (density == DENSITY_ANY) {
return SDK_LOLLIPOP;
}
@ -479,6 +494,7 @@ public class ResConfigFlags {
public final static byte SDK_KITKAT = 19;
public final static byte SDK_LOLLIPOP = 21;
public final static byte SDK_LOLLIPOP_MR1 = 22;
public final static byte SDK_MNC = 23;
public final static byte ORIENTATION_ANY = 0;
public final static byte ORIENTATION_PORT = 1;
@ -510,6 +526,11 @@ public class ResConfigFlags {
public final static short SCREENLAYOUT_LAYOUTDIR_RTL = 0x80;
public final static short SCREENLAYOUT_LAYOUTDIR_SHIFT = 0x06;
public final static short MASK_SCREENROUND = 0x03;
public final static short SCREENLAYOUT_ROUND_ANY = 0;
public final static short SCREENLAYOUT_ROUND_NO = 0x1;
public final static short SCREENLAYOUT_ROUND_YES = 0x2;
public final static byte KEYBOARD_ANY = 0;
public final static byte KEYBOARD_NOKEYS = 1;
public final static byte KEYBOARD_QWERTY = 2;

View File

@ -320,6 +320,13 @@ public class ARSCDecoder {
read = 48;
}
byte screenLayout2 = 0;
if (size >= 52) {
screenLayout2 = mIn.readByte();
mIn.skipBytes(3); // reserved padding
read = 52;
}
int exceedingSize = size - KNOWN_CONFIG_BYTES;
if (exceedingSize > 0) {
byte[] buf = new byte[exceedingSize];
@ -347,7 +354,7 @@ public class ARSCDecoder {
orientation, touchscreen, density, keyboard, navigation,
inputFlags, screenWidth, screenHeight, sdkVersion,
screenLayout, uiMode, smallestScreenWidthDp, screenWidthDp,
screenHeightDp, localeScript, localeVariant, isInvalid);
screenHeightDp, localeScript, localeVariant, screenLayout2, isInvalid);
}
private char[] unpackLanguageOrRegion(byte in0, byte in1, char base) throws AndrolibException {
@ -475,7 +482,7 @@ public class ARSCDecoder {
}
private static final Logger LOGGER = Logger.getLogger(ARSCDecoder.class.getName());
private static final int KNOWN_CONFIG_BYTES = 48;
private static final int KNOWN_CONFIG_BYTES = 52;
public static class ARSCData {