refactor: rename enums for new overlays/stagedAliases

This commit is contained in:
Connor Tumbleson 2022-03-13 08:34:31 -04:00
parent 951d063cbd
commit e9a3993da8
No known key found for this signature in database
GPG Key ID: C3CC0A201EC7DA75

View File

@ -87,7 +87,7 @@ public class ARSCDecoder {
} }
private ResPackage readTablePackage() throws IOException, AndrolibException { private ResPackage readTablePackage() throws IOException, AndrolibException {
checkChunkType(Header.TYPE_PACKAGE); checkChunkType(Header.XML_TYPE_PACKAGE);
int id = mIn.readInt(); int id = mIn.readInt();
if (id == 0) { if (id == 0) {
@ -128,10 +128,10 @@ public class ARSCDecoder {
boolean flag = true; boolean flag = true;
while (flag) { while (flag) {
switch (mHeader.type) { switch (mHeader.type) {
case Header.TYPE_LIBRARY: case Header.XML_TYPE_LIBRARY:
readLibraryType(); readLibraryType();
break; break;
case Header.TYPE_SPEC_TYPE: case Header.XML_TYPE_SPEC_TYPE:
readTableTypeSpec(); readTableTypeSpec();
break; break;
default: default:
@ -144,7 +144,7 @@ public class ARSCDecoder {
} }
private void readLibraryType() throws AndrolibException, IOException { private void readLibraryType() throws AndrolibException, IOException {
checkChunkType(Header.TYPE_LIBRARY); checkChunkType(Header.XML_TYPE_LIBRARY);
int libraryCount = mIn.readInt(); int libraryCount = mIn.readInt();
int packageId; int packageId;
@ -156,7 +156,7 @@ public class ARSCDecoder {
LOGGER.info(String.format("Decoding Shared Library (%s), pkgId: %d", packageName, packageId)); LOGGER.info(String.format("Decoding Shared Library (%s), pkgId: %d", packageName, packageId));
} }
while(nextChunk().type == Header.TYPE_TYPE) { while(nextChunk().type == Header.XML_TYPE_TYPE) {
readTableTypeSpec(); readTableTypeSpec();
} }
} }
@ -168,7 +168,7 @@ public class ARSCDecoder {
int type = nextChunk().type; int type = nextChunk().type;
ResTypeSpec resTypeSpec; ResTypeSpec resTypeSpec;
while (type == Header.TYPE_SPEC_TYPE) { while (type == Header.XML_TYPE_SPEC_TYPE) {
resTypeSpec = readSingleTableTypeSpec(); resTypeSpec = readSingleTableTypeSpec();
addTypeSpec(resTypeSpec); addTypeSpec(resTypeSpec);
type = nextChunk().type; type = nextChunk().type;
@ -180,7 +180,7 @@ public class ARSCDecoder {
} }
} }
while (type == Header.TYPE_TYPE) { while (type == Header.XML_TYPE_TYPE) {
readTableType(); readTableType();
// skip "TYPE 8 chunks" and/or padding data at the end of this chunk // skip "TYPE 8 chunks" and/or padding data at the end of this chunk
@ -196,7 +196,7 @@ public class ARSCDecoder {
} }
private ResTypeSpec readSingleTableTypeSpec() throws AndrolibException, IOException { private ResTypeSpec readSingleTableTypeSpec() throws AndrolibException, IOException {
checkChunkType(Header.TYPE_SPEC_TYPE); checkChunkType(Header.XML_TYPE_SPEC_TYPE);
int id = mIn.readUnsignedByte(); int id = mIn.readUnsignedByte();
mIn.skipBytes(3); mIn.skipBytes(3);
int entryCount = mIn.readInt(); int entryCount = mIn.readInt();
@ -212,7 +212,7 @@ public class ARSCDecoder {
} }
private ResType readTableType() throws IOException, AndrolibException { private ResType readTableType() throws IOException, AndrolibException {
checkChunkType(Header.TYPE_TYPE); checkChunkType(Header.XML_TYPE_TYPE);
int typeId = mIn.readUnsignedByte() - mTypeIdOffset; int typeId = mIn.readUnsignedByte() - mTypeIdOffset;
if (mResTypeSpecs.containsKey(typeId)) { if (mResTypeSpecs.containsKey(typeId)) {
mResId = (0xff000000 & mResId) | mResTypeSpecs.get(typeId).getId() << 16; mResId = (0xff000000 & mResId) | mResTypeSpecs.get(typeId).getId() << 16;
@ -604,8 +604,18 @@ public class ARSCDecoder {
return new Header(type, in.readShort(), in.readInt(), start); return new Header(type, in.readShort(), in.readInt(), start);
} }
public final static short TYPE_NONE = -1, TYPE_TABLE = 0x0002, public final static short TYPE_NONE = -1;
TYPE_PACKAGE = 0x0200, TYPE_TYPE = 0x0201, TYPE_SPEC_TYPE = 0x0202, TYPE_LIBRARY = 0x0203; public final static short TYPE_STRING_POOL = 0x0001;
public final static short TYPE_TABLE = 0x0002;
public final static short TYPE_XML = 0x0003;
public final static short XML_TYPE_PACKAGE = 0x0200;
public final static short XML_TYPE_TYPE = 0x0201;
public final static short XML_TYPE_SPEC_TYPE = 0x0202;
public final static short XML_TYPE_LIBRARY = 0x0203;
public final static short XML_TYPE_OVERLAY = 0x0204;
public final static short XML_TYPE_OVERLAY_POLICY = 0x0205;
public final static short XML_TYPE_STAGED_ALIAS = 0x0206;
} }
public static class FlagsOffset { public static class FlagsOffset {