mirror of
https://github.com/revanced/Apktool.git
synced 2024-09-12 01:06:40 +02: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,
|
||||
File rawDir, File assetDir, File[] include, HashMap<String, Boolean> flags)
|
||||
throws AndrolibException {
|
||||
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
|
||||
cmd.add("aapt");
|
||||
cmd.add("p");
|
||||
|
||||
if (flags.get("verbose")) {
|
||||
if (flags.get("verbose")) { //output aapt verbose
|
||||
cmd.add("-v");
|
||||
}
|
||||
|
||||
if (flags.get("update")) {
|
||||
cmd.add("-u");
|
||||
}
|
||||
if (flags.get("debug")) { //inject debuggable="true" into manifest
|
||||
cmd.add("--debug-mode");
|
||||
}
|
||||
if (mMinSdkVersion != null) {
|
||||
cmd.add("--min-sdk-version");
|
||||
cmd.add(mMinSdkVersion);
|
||||
@ -473,6 +493,7 @@ final public class AndrolibResources {
|
||||
entry.setCrc(crc.getValue());
|
||||
out.putNextEntry(entry);
|
||||
out.write(data);
|
||||
zip.close();
|
||||
|
||||
LOGGER.info("Framework installed to: " + outFile);
|
||||
} catch (ZipException ex) {
|
||||
|
@ -28,6 +28,8 @@ public class ResConfigFlags {
|
||||
public final char[] language;
|
||||
public final char[] country;
|
||||
|
||||
public final short layoutDirection;
|
||||
|
||||
public final byte orientation;
|
||||
public final byte touchscreen;
|
||||
public final short density;
|
||||
@ -57,6 +59,7 @@ public class ResConfigFlags {
|
||||
mnc = 0;
|
||||
language = new char[]{'\00', '\00'};
|
||||
country = new char[]{'\00', '\00'};
|
||||
layoutDirection = SCREENLAYOUT_LAYOUTDIR_ANY;
|
||||
orientation = ORIENTATION_ANY;
|
||||
touchscreen = TOUCHSCREEN_ANY;
|
||||
density = DENSITY_DEFAULT;
|
||||
@ -76,9 +79,9 @@ public class ResConfigFlags {
|
||||
}
|
||||
|
||||
public ResConfigFlags(short mcc, short mnc, char[] language, char[] country,
|
||||
byte orientation, byte touchscreen, short density, byte keyboard,
|
||||
byte navigation, byte inputFlags, short screenWidth,
|
||||
short screenHeight, short sdkVersion, byte screenLayout,
|
||||
short layoutDirection, byte orientation, byte touchscreen,
|
||||
short density, byte keyboard, byte navigation, byte inputFlags,
|
||||
short screenWidth, short screenHeight, short sdkVersion, byte screenLayout,
|
||||
byte uiMode, short smallestScreenWidthDp, short screenWidthDp,
|
||||
short screenHeightDp, boolean isInvalid) {
|
||||
if (orientation < 0 || orientation > 3) {
|
||||
@ -111,6 +114,7 @@ public class ResConfigFlags {
|
||||
this.mnc = mnc;
|
||||
this.language = language;
|
||||
this.country = country;
|
||||
this.layoutDirection = layoutDirection;
|
||||
this.orientation = orientation;
|
||||
this.touchscreen = touchscreen;
|
||||
this.density = density;
|
||||
@ -147,6 +151,14 @@ public class ResConfigFlags {
|
||||
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) {
|
||||
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_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_NOKEYS = 1;
|
||||
public final static byte KEYBOARD_QWERTY = 2;
|
||||
|
@ -273,8 +273,9 @@ public class ARSCDecoder {
|
||||
screenHeightDp = mIn.readShort();
|
||||
}
|
||||
|
||||
if (size >= 40) {
|
||||
// mIn.skipBytes(2);
|
||||
short layoutDirection = 0;
|
||||
if (size >= 38 && !this.mPkg.getName().equalsIgnoreCase("com.htc")) {
|
||||
layoutDirection = mIn.readShort();
|
||||
}
|
||||
|
||||
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,
|
||||
screenWidth, screenHeight, sdkVersion, screenLayout, uiMode,
|
||||
smallestScreenWidthDp, screenWidthDp, screenHeightDp, isInvalid);
|
||||
|
@ -49,6 +49,11 @@ public class XmlPullStreamDecoder implements ResStreamDecoder {
|
||||
int type = pp.getEventType();
|
||||
|
||||
if (type == XmlPullParser.START_TAG) {
|
||||
if ("packages".equalsIgnoreCase(pp.getName())) {
|
||||
try {
|
||||
boolean test = parseAttr(pp);
|
||||
} catch (AndrolibException e) {}
|
||||
}
|
||||
if ("uses-sdk".equalsIgnoreCase(pp.getName())) {
|
||||
try {
|
||||
hideSdkInfo = parseAttr(pp);
|
||||
|
Loading…
Reference in New Issue
Block a user