@AfterReturning( pointcut = "execution(* brut.androlib.res.AndrolibResources.getResFileDecoder(..))", returning = "duo") public void getResFileDecoder_after(Duo<ResFileDecoder, AXmlResourceParser> duo) { if (!ShakaDecodeOption.getInstance().isNo9png()) { return; } ResFileDecoder fileDecoder = duo.m1; try { ResStreamDecoderContainer mDecoders = (ResStreamDecoderContainer) ReflectUtil.getFieldValue(fileDecoder, "mDecoders"); mDecoders.setDecoder("9patch", new ResRawStreamDecoder()); } catch (Exception e) { e.printStackTrace(); } }
@AfterReturning( pointcut = "execution(* brut.androlib.res.AndrolibResources.getFrameworkApk(..))" + "&& args(id, frameTag)", returning = "apk") public void getFrameworkApk(int id, String frameTag, File apk) throws AndrolibException { if (!ShakaDecodeOption.getInstance().isUsingDefaultFramework()) { return; } if (id == 1 && apk.getAbsolutePath().endsWith("1.apk")) { try (InputStream in = AndrolibResources.class.getResourceAsStream("/brut/androlib/android-framework.jar"); OutputStream out = new FileOutputStream(apk)) { IOUtils.copy(in, out); } catch (IOException ex) { throw new AndrolibException(ex); } } }