AndrolibResources.aaptPackage(): added include argument, removed some bad magic.

This commit is contained in:
Ryszard Wiśniewski 2010-06-02 11:07:17 +02:00
parent c410a27cd8
commit c3fc711ee2
2 changed files with 22 additions and 18 deletions

View File

@ -288,7 +288,11 @@ public class Androlib {
apkFile, apkFile,
new File(appDir, "AndroidManifest.xml"), new File(appDir, "AndroidManifest.xml"),
new File(appDir, "res"), new File(appDir, "res"),
ninePatch, null, false, framework ninePatch, null,
new File[]{
mAndRes.getAndroidResourcesFile(),
mAndRes.getHtcResourcesFile()},
false, framework
); );
new ExtFile(apkFile).getDirectory() new ExtFile(apkFile).getDirectory()
@ -337,7 +341,7 @@ public class Androlib {
assetDir = null; assetDir = null;
} }
mAndRes.aaptPackage(outApk, null, null, mAndRes.aaptPackage(outApk, null, null,
new File(appDir, APK_DIRNAME), assetDir, false, true); new File(appDir, APK_DIRNAME), assetDir, null, false, framework);
} }
public void publicizeResources(File arscFile) throws AndrolibException { public void publicizeResources(File arscFile) throws AndrolibException {

View File

@ -130,8 +130,8 @@ final public class AndrolibResources {
} }
public void aaptPackage(File apkFile, File manifest, File resDir, public void aaptPackage(File apkFile, File manifest, File resDir,
File rawDir, File assetDir, boolean update, boolean framework) File rawDir, File assetDir, File[] include,
throws AndrolibException { boolean update, boolean framework) throws AndrolibException {
List<String> cmd = new ArrayList<String>(); List<String> cmd = new ArrayList<String>();
cmd.add("aapt"); cmd.add("aapt");
@ -142,22 +142,22 @@ final public class AndrolibResources {
cmd.add("-F"); cmd.add("-F");
cmd.add(apkFile.getAbsolutePath()); cmd.add(apkFile.getAbsolutePath());
if (resDir != null) { if (framework) {
if (framework) { cmd.add("-x");
cmd.add("-x");
} else {
cmd.add("-I");
cmd.add(getAndroidResourcesFile().getAbsolutePath());
cmd.add("-I");
cmd.add(getHtcResourcesFile().getAbsolutePath());
}
cmd.add("-S");
cmd.add(resDir.getAbsolutePath());
} else if (framework) {
cmd.add("-0"); cmd.add("-0");
cmd.add("arsc"); cmd.add("arsc");
} }
if (include != null) {
for (File file : include) {
cmd.add("-I");
cmd.add(file.getPath());
}
}
if (resDir != null) {
cmd.add("-S");
cmd.add(resDir.getAbsolutePath());
}
if (manifest != null) { if (manifest != null) {
cmd.add("-M"); cmd.add("-M");
cmd.add(manifest.getAbsolutePath()); cmd.add(manifest.getAbsolutePath());
@ -354,7 +354,7 @@ final public class AndrolibResources {
return dir; return dir;
} }
private File getAndroidResourcesFile() throws AndrolibException { public File getAndroidResourcesFile() throws AndrolibException {
try { try {
return Jar.getResourceAsFile("/brut/androlib/android-framework.jar"); return Jar.getResourceAsFile("/brut/androlib/android-framework.jar");
} catch (BrutException ex) { } catch (BrutException ex) {
@ -362,7 +362,7 @@ final public class AndrolibResources {
} }
} }
private File getHtcResourcesFile() throws AndrolibException { public File getHtcResourcesFile() throws AndrolibException {
try { try {
return Jar.getResourceAsFile( return Jar.getResourceAsFile(
"/brut/androlib/com.htc.resources.apk"); "/brut/androlib/com.htc.resources.apk");