mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-31 14:17:33 +01:00
New API 17 resource identifiers. ~ Untested
Adjust naming to match brut.all conventions & added natural SDK check w/ new configFlags
This commit is contained in:
parent
6b31aeb7c4
commit
5b106e5c34
@ -191,21 +191,41 @@ final public class AndrolibResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void prepPath() throws AndrolibException {
|
||||||
|
List<String> cmd = new ArrayList<String>();
|
||||||
|
|
||||||
|
// check for win vs linux
|
||||||
|
if (System.getProperty("os.name").indexOf("win") >= 0) {
|
||||||
|
cmd.add("set PATH=%PATH%;" + System.getProperty("user.dir"));
|
||||||
|
} else {
|
||||||
|
cmd.add("export PATH=$PATH:" + System.getProperty("user.dir"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
OS.exec(cmd.toArray(new String[0]));
|
||||||
|
} catch (BrutException ex) {
|
||||||
|
throw new AndrolibException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void aaptPackage(File apkFile, File manifest, File resDir,
|
public void aaptPackage(File apkFile, File manifest, File resDir,
|
||||||
File rawDir, File assetDir, File[] include, HashMap<String, Boolean> flags)
|
File rawDir, File assetDir, File[] include, HashMap<String, Boolean> flags)
|
||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
|
|
||||||
List<String> cmd = new ArrayList<String>();
|
List<String> cmd = new ArrayList<String>();
|
||||||
|
|
||||||
cmd.add("aapt");
|
cmd.add("aapt");
|
||||||
cmd.add("p");
|
cmd.add("p");
|
||||||
|
|
||||||
if (flags.get("verbose")) {
|
if (flags.get("verbose")) { //output aapt verbose
|
||||||
cmd.add("-v");
|
cmd.add("-v");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.get("update")) {
|
if (flags.get("update")) {
|
||||||
cmd.add("-u");
|
cmd.add("-u");
|
||||||
}
|
}
|
||||||
|
if (flags.get("debug")) { //inject debuggable="true" into manifest
|
||||||
|
cmd.add("--debug-mode");
|
||||||
|
}
|
||||||
if (mMinSdkVersion != null) {
|
if (mMinSdkVersion != null) {
|
||||||
cmd.add("--min-sdk-version");
|
cmd.add("--min-sdk-version");
|
||||||
cmd.add(mMinSdkVersion);
|
cmd.add(mMinSdkVersion);
|
||||||
@ -473,6 +493,7 @@ final public class AndrolibResources {
|
|||||||
entry.setCrc(crc.getValue());
|
entry.setCrc(crc.getValue());
|
||||||
out.putNextEntry(entry);
|
out.putNextEntry(entry);
|
||||||
out.write(data);
|
out.write(data);
|
||||||
|
zip.close();
|
||||||
|
|
||||||
LOGGER.info("Framework installed to: " + outFile);
|
LOGGER.info("Framework installed to: " + outFile);
|
||||||
} catch (ZipException ex) {
|
} catch (ZipException ex) {
|
||||||
|
@ -28,6 +28,8 @@ public class ResConfigFlags {
|
|||||||
public final char[] language;
|
public final char[] language;
|
||||||
public final char[] country;
|
public final char[] country;
|
||||||
|
|
||||||
|
public final short layoutDirection;
|
||||||
|
|
||||||
public final byte orientation;
|
public final byte orientation;
|
||||||
public final byte touchscreen;
|
public final byte touchscreen;
|
||||||
public final short density;
|
public final short density;
|
||||||
@ -57,6 +59,7 @@ public class ResConfigFlags {
|
|||||||
mnc = 0;
|
mnc = 0;
|
||||||
language = new char[]{'\00', '\00'};
|
language = new char[]{'\00', '\00'};
|
||||||
country = new char[]{'\00', '\00'};
|
country = new char[]{'\00', '\00'};
|
||||||
|
layoutDirection = SCREENLAYOUT_LAYOUTDIR_ANY;
|
||||||
orientation = ORIENTATION_ANY;
|
orientation = ORIENTATION_ANY;
|
||||||
touchscreen = TOUCHSCREEN_ANY;
|
touchscreen = TOUCHSCREEN_ANY;
|
||||||
density = DENSITY_DEFAULT;
|
density = DENSITY_DEFAULT;
|
||||||
@ -76,9 +79,9 @@ public class ResConfigFlags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResConfigFlags(short mcc, short mnc, char[] language, char[] country,
|
public ResConfigFlags(short mcc, short mnc, char[] language, char[] country,
|
||||||
byte orientation, byte touchscreen, short density, byte keyboard,
|
short layoutDirection, byte orientation, byte touchscreen,
|
||||||
byte navigation, byte inputFlags, short screenWidth,
|
short density, byte keyboard, byte navigation, byte inputFlags,
|
||||||
short screenHeight, short sdkVersion, byte screenLayout,
|
short screenWidth, short screenHeight, short sdkVersion, byte screenLayout,
|
||||||
byte uiMode, short smallestScreenWidthDp, short screenWidthDp,
|
byte uiMode, short smallestScreenWidthDp, short screenWidthDp,
|
||||||
short screenHeightDp, boolean isInvalid) {
|
short screenHeightDp, boolean isInvalid) {
|
||||||
if (orientation < 0 || orientation > 3) {
|
if (orientation < 0 || orientation > 3) {
|
||||||
@ -111,6 +114,7 @@ public class ResConfigFlags {
|
|||||||
this.mnc = mnc;
|
this.mnc = mnc;
|
||||||
this.language = language;
|
this.language = language;
|
||||||
this.country = country;
|
this.country = country;
|
||||||
|
this.layoutDirection = layoutDirection;
|
||||||
this.orientation = orientation;
|
this.orientation = orientation;
|
||||||
this.touchscreen = touchscreen;
|
this.touchscreen = touchscreen;
|
||||||
this.density = density;
|
this.density = density;
|
||||||
@ -147,6 +151,14 @@ public class ResConfigFlags {
|
|||||||
ret.append("-r").append(country);
|
ret.append("-r").append(country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch (screenLayout & MASK_LAYOUTDIR) {
|
||||||
|
case SCREENLAYOUT_LAYOUTDIR_RTL:
|
||||||
|
ret.append("-ldrtl");
|
||||||
|
break;
|
||||||
|
case SCREENLAYOUT_LAYOUTDIR_LTR:
|
||||||
|
ret.append("-ldltr");
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (smallestScreenWidthDp != 0) {
|
if (smallestScreenWidthDp != 0) {
|
||||||
ret.append("-sw").append(smallestScreenWidthDp).append("dp");
|
ret.append("-sw").append(smallestScreenWidthDp).append("dp");
|
||||||
}
|
}
|
||||||
@ -386,6 +398,12 @@ public class ResConfigFlags {
|
|||||||
public final static short DENSITY_XXHIGH = 480;
|
public final static short DENSITY_XXHIGH = 480;
|
||||||
public final static short DENSITY_NONE = -1;
|
public final static short DENSITY_NONE = -1;
|
||||||
|
|
||||||
|
public final static short MASK_LAYOUTDIR = 0xc0;
|
||||||
|
public final static short SCREENLAYOUT_LAYOUTDIR_ANY = 0x00;
|
||||||
|
public final static short SCREENLAYOUT_LAYOUTDIR_LTR = 0x40;
|
||||||
|
public final static short SCREENLAYOUT_LAYOUTDIR_RTL = 0x80;
|
||||||
|
public final static short SCREENLAYOUT_LAYOUTDIR_SHIFT = 0x06;
|
||||||
|
|
||||||
public final static byte KEYBOARD_ANY = 0;
|
public final static byte KEYBOARD_ANY = 0;
|
||||||
public final static byte KEYBOARD_NOKEYS = 1;
|
public final static byte KEYBOARD_NOKEYS = 1;
|
||||||
public final static byte KEYBOARD_QWERTY = 2;
|
public final static byte KEYBOARD_QWERTY = 2;
|
||||||
|
@ -273,8 +273,9 @@ public class ARSCDecoder {
|
|||||||
screenHeightDp = mIn.readShort();
|
screenHeightDp = mIn.readShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size >= 40) {
|
short layoutDirection = 0;
|
||||||
// mIn.skipBytes(2);
|
if (size >= 38 && !this.mPkg.getName().equalsIgnoreCase("com.htc")) {
|
||||||
|
layoutDirection = mIn.readShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
int exceedingSize = size - KNOWN_CONFIG_BYTES;
|
int exceedingSize = size - KNOWN_CONFIG_BYTES;
|
||||||
@ -295,7 +296,7 @@ public class ARSCDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResConfigFlags(mcc, mnc, language, country, orientation,
|
return new ResConfigFlags(mcc, mnc, language, country, layoutDirection, orientation,
|
||||||
touchscreen, density, keyboard, navigation, inputFlags,
|
touchscreen, density, keyboard, navigation, inputFlags,
|
||||||
screenWidth, screenHeight, sdkVersion, screenLayout, uiMode,
|
screenWidth, screenHeight, sdkVersion, screenLayout, uiMode,
|
||||||
smallestScreenWidthDp, screenWidthDp, screenHeightDp, isInvalid);
|
smallestScreenWidthDp, screenWidthDp, screenHeightDp, isInvalid);
|
||||||
|
@ -49,6 +49,11 @@ public class XmlPullStreamDecoder implements ResStreamDecoder {
|
|||||||
int type = pp.getEventType();
|
int type = pp.getEventType();
|
||||||
|
|
||||||
if (type == XmlPullParser.START_TAG) {
|
if (type == XmlPullParser.START_TAG) {
|
||||||
|
if ("packages".equalsIgnoreCase(pp.getName())) {
|
||||||
|
try {
|
||||||
|
boolean test = parseAttr(pp);
|
||||||
|
} catch (AndrolibException e) {}
|
||||||
|
}
|
||||||
if ("uses-sdk".equalsIgnoreCase(pp.getName())) {
|
if ("uses-sdk".equalsIgnoreCase(pp.getName())) {
|
||||||
try {
|
try {
|
||||||
hideSdkInfo = parseAttr(pp);
|
hideSdkInfo = parseAttr(pp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user