Merge pull request #97 from iBotPeaches/lollipop-support

Lollipop support
This commit is contained in:
Connor Tumbleson 2014-11-25 06:21:38 -08:00
commit 02b5c7c57b
14 changed files with 53 additions and 4 deletions

View File

@ -48,6 +48,8 @@ v2.0.0 (TBA)
-Fixed (issue #664) - Fixed issue with apks with large StringPools failing to decode.
-Fixed (issue #447) - Fixed bad cast of ResStringValue to ResAtr by handling ResStringValue correctly (Thanks whydoubt)
-Fixed (issue #689) - Fixed issue with hard coding extension as PNG.
-Fixed (issue #653) - Added Android Lollipop support.
-Fixed (issue #706) - Added support for TYPE_DYNAMIC_REFERENCE.
-Fixed issue with APKs with multiple dex files.
-Fixed issue with using Apktool without smali/baksmali for ApktoolProperties (Thanks teprrr)
-Fixed issue with non-URI standard characters in apk name (Thanks rover12421)

View File

@ -51,7 +51,11 @@ public class TypedValue {
* container.
*/
public static final int TYPE_FRACTION = 0x06;
/**
* The <var>data</var> holds a dynamic res table reference, which needs to be
* resolved before it can be used like TYPE_REFERENCE
*/
public static final int TYPE_DYNAMIC_REFERENCE = 0x07;
/**
* Identifies the start of plain integer values. Any type value from this to
* {@link #TYPE_LAST_INT} means the <var>data</var> field holds a generic

View File

@ -144,7 +144,12 @@ public class ResConfigFlags {
ret.append("-mcc").append(String.format("%03d", mcc));
if (mcc != MNC_ZERO) {
if (mnc != 0 && mnc != -1) {
ret.append("-mnc").append(mnc);
ret.append("-mnc");
if (mnc > 0 && mnc < 10) {
ret.append(String.format("%02d", mnc));
} else {
ret.append(String.format("%03d", mnc));
}
}
}
}
@ -265,6 +270,9 @@ public class ResConfigFlags {
case DENSITY_XXXHIGH:
ret.append("-xxxhdpi");
break;
case DENSITY_ANY:
ret.append("-anydpi");
break;
case DENSITY_NONE:
ret.append("-nodpi");
break;
@ -344,6 +352,9 @@ public class ResConfigFlags {
}
private short getNaturalSdkVersionRequirement() {
if (density == DENSITY_ANY) {
return SDK_LOLLIPOP;
}
if (smallestScreenWidthDp != 0 || screenWidthDp != 0 || screenHeightDp != 0) {
return SDK_HONEYCOMB_MR2;
}
@ -402,7 +413,8 @@ public class ResConfigFlags {
public final static byte SDK_JELLY_BEAN = 16;
public final static byte SDK_JELLY_BEAN_MR1 = 17;
public final static byte SDK_JELLY_BEAN_MR2 = 18;
public final static byte KITKAT = 19;
public final static byte SDK_KITKAT = 19;
public final static byte SDK_LOLLIPOP = 21;
public final static byte ORIENTATION_ANY = 0;
public final static byte ORIENTATION_PORT = 1;
@ -423,6 +435,7 @@ public class ResConfigFlags {
public final static int DENSITY_XHIGH = 320;
public final static int DENSITY_XXHIGH = 480;
public final static int DENSITY_XXXHIGH = 640;
public final static int DENSITY_ANY = 0xFFFE;
public final static int DENSITY_NONE = 0xFFFF;
public final static int MNC_ZERO = 0xFFFF;

View File

@ -48,6 +48,8 @@ public class ResValueFactory {
return new ResFractionValue(value, rawValue);
case TypedValue.TYPE_INT_BOOLEAN:
return new ResBoolValue(value != 0, rawValue);
case TypedValue.TYPE_DYNAMIC_REFERENCE:
return newReference(value, rawValue);
}
if (type >= TypedValue.TYPE_FIRST_COLOR_INT

Binary file not shown.

View File

@ -162,16 +162,31 @@ public class BuildAndDecodeTest {
@Test
public void qualifiersTest() throws BrutException {
compareValuesFiles("values-mcc004-mnc4-en-rUS-ldrtl-sw100dp-w200dp-h300dp"
compareValuesFiles("values-mcc004-mnc04-en-rUS-ldrtl-sw100dp-w200dp-h300dp"
+ "-xlarge-long-land-desk-night-xhdpi-finger-keyssoft-12key"
+ "-navhidden-dpad/strings.xml");
}
@Test
public void shortendedMncTest() throws BrutException {
compareValuesFiles("values-mcc001-mnc01/strings.xml");
}
@Test
public void anyDpiTest() throws BrutException, IOException {
compareValuesFiles("values-watch/strings.xml");
}
@Test
public void drawableNoDpiTest() throws BrutException, IOException {
compareResFolder("drawable-nodpi");
}
@Test
public void drawableAnyDpiTest() throws BrutException, IOException {
compareResFolder("drawable-anydpi");
}
@Test
public void drawableNumberedDpiTest() throws BrutException, IOException {
compareResFolder("drawable-534dpi");
@ -202,6 +217,11 @@ public class BuildAndDecodeTest {
compareResFolder("drawable-xxhdpi");
}
@Test
public void drawableXxxhdpiTest() throws BrutException, IOException {
compareResFolder("drawable-xxxhdpi");
}
@Test
public void resRawTest() throws BrutException, IOException {
compareResFolder("raw");

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test1">test1</string>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test1">test1</string>
</resources>