Skip to content

Commit

Permalink
Merge pull request iBotPeaches#97 from iBotPeaches/lollipop-support
Browse files Browse the repository at this point in the history
Lollipop support
  • Loading branch information
iBotPeaches committed Nov 25, 2014
2 parents daafeb2 + ad70082 commit 02b5c7c
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ private String generateQualifiers() {
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));
}
}
}
}
Expand Down Expand Up @@ -265,6 +270,9 @@ private String generateQualifiers() {
case DENSITY_XXXHIGH:
ret.append("-xxxhdpi");
break;
case DENSITY_ANY:
ret.append("-anydpi");
break;
case DENSITY_NONE:
ret.append("-nodpi");
break;
Expand Down Expand Up @@ -344,6 +352,9 @@ private String generateQualifiers() {
}

private short getNaturalSdkVersionRequirement() {
if (density == DENSITY_ANY) {
return SDK_LOLLIPOP;
}
if (smallestScreenWidthDp != 0 || screenWidthDp != 0 || screenHeightDp != 0) {
return SDK_HONEYCOMB_MR2;
}
Expand Down Expand Up @@ -402,7 +413,8 @@ public int hashCode() {
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;
Expand All @@ -423,6 +435,7 @@ public int hashCode() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public ResScalarValue factory(int type, int value, String rawValue)
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
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt
100644 → 100755
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,31 @@ public void xmlReferencesTest() throws BrutException {

@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");
Expand Down Expand Up @@ -202,6 +217,11 @@ public void drawableXxhdpiTest() throws BrutException, IOException {
compareResFolder("drawable-xxhdpi");
}

@Test
public void drawableXxxhdpiTest() throws BrutException, IOException {
compareResFolder("drawable-xxxhdpi");
}

@Test
public void resRawTest() throws BrutException, IOException {
compareResFolder("raw");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test1">test1</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test1">test1</string>
</resources>

0 comments on commit 02b5c7c

Please sign in to comment.