diff --git a/apktool-lib/pom.xml b/apktool-lib/pom.xml index a4c75052..b9390778 100644 --- a/apktool-lib/pom.xml +++ b/apktool-lib/pom.xml @@ -43,6 +43,7 @@ src/main/java/com/mindprod/** src/main/java/android/** + src/main/java/org/xmlpull/** src/main/resources/brut/androlib/apktool.properties src/test/resources/brut/apktool/testapp/** diff --git a/apktool-lib/src/main/java/brut/androlib/Androlib.java b/apktool-lib/src/main/java/brut/androlib/Androlib.java index a367c505..314c8660 100644 --- a/apktool-lib/src/main/java/brut/androlib/Androlib.java +++ b/apktool-lib/src/main/java/brut/androlib/Androlib.java @@ -179,6 +179,7 @@ public class Androlib { Map meta = readMetaFile(appDir); Object t1 = meta.get("isFrameworkApk"); boolean framework = t1 == null ? false : (Boolean) t1; + mAndRes.setSdkInfo((Map) meta.get("sdkInfo")); if (outFile == null) { String outFileName = (String) meta.get("apkFileName"); diff --git a/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java b/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java index 5d87d1ff..24d61f78 100644 --- a/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java +++ b/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java @@ -30,35 +30,23 @@ import org.apache.commons.io.IOUtils; * @author Ryszard Wiśniewski */ public class Res9patchStreamDecoder implements ResStreamDecoder { - public void decode(InputStream in, OutputStream out) + public void decode(InputStream in, OutputStream out) throws AndrolibException { try { byte[] data = IOUtils.toByteArray(in); - NinePatch np = getNinePatch(data); BufferedImage im = ImageIO.read(new ByteArrayInputStream(data)); int w = im.getWidth(), h = im.getHeight(); BufferedImage im2 = new BufferedImage( w + 2, h + 2, BufferedImage.TYPE_4BYTE_ABGR); - Raster src = im.getRaster(); - WritableRaster dst = im2.getRaster(); - int nbands = im.getSampleModel().getNumBands(); - int[] bands = new int[4]; - if (nbands == 2) { - bands[0] = bands[1] = bands[2] = 0; - bands[3] = 1; + if (im.getType() == BufferedImage.TYPE_4BYTE_ABGR) { + im2.getRaster().setRect(1, 1, im.getRaster()); } else { - bands[0] = 0; bands[1] = 1; bands[2] = 2; bands[3] = 3; - } - int[] band = null; - for (int y = 0; y < h; y++) { - for (int bi = 0; bi < 4; bi++) { - band = src.getSamples(0, y, w, 1, bands[bi], band); - dst.setSamples(1, y + 1, w, 1, bi, band); - } + im2.getGraphics().drawImage(im, 1, 1, null); } + NinePatch np = getNinePatch(data); drawHLine(im2, h + 1, np.padLeft + 1, w - np.padRight); drawVLine(im2, w + 1, np.padTop + 1, h - np.padBottom); diff --git a/apktool-lib/src/main/java/org/xmlpull/mxp1_serializer/MXSerializer.java b/apktool-lib/src/main/java/org/xmlpull/mxp1_serializer/MXSerializer.java index 47af7c2b..7a4f881b 100644 --- a/apktool-lib/src/main/java/org/xmlpull/mxp1_serializer/MXSerializer.java +++ b/apktool-lib/src/main/java/org/xmlpull/mxp1_serializer/MXSerializer.java @@ -1,19 +1,3 @@ -/** - * Copyright 2011 Ryszard Wiśniewski - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package org.xmlpull.mxp1_serializer; import java.io.IOException;