List of usage examples for org.aspectj.lang ProceedingJoinPoint proceed
public Object proceed(Object[] args) throws Throwable;
From source file:com.rover12421.shaka.apktool.lib.AndrolibResourcesAj.java
License:Apache License
/** * png?/*from w w w . j a v a 2 s. c om*/ * brut.androlib.res.AndrolibResources * public void aaptPackage(File apkFile, File manifest, File resDir, File rawDir, File assetDir, File[] include) */ @Around("execution(* brut.androlib.res.AndrolibResources.aaptPackage(..))" + "&& args(apkFile, manifest, resDir, rawDir, assetDir, include)") public void aaptPackage_around(ProceedingJoinPoint joinPoint, File apkFile, File manifest, File resDir, File rawDir, File assetDir, File[] include) throws Throwable { AndrolibResources thiz = (AndrolibResources) joinPoint.getThis(); doNotCompress_in_aapt_fix(thiz); /** * ?10,? */ int max = 10; PrintStream olderr = System.err; String lastErrInfo = null; while (max-- > 0) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos)) { System.setErr(ps); try { joinPoint.proceed(joinPoint.getArgs()); System.setErr(olderr); /** * ???? */ fuckNotDefinedRes_clearAddRes(apkFile); break; } catch (Throwable e) { System.setErr(olderr); String errStr = new String(baos.toByteArray()); /** * ?,?, */ if (errStr.equals(lastErrInfo)) { throw new ShakaException(errStr, e); } lastErrInfo = errStr; boolean bContinue = false; if (manifest != null) { String rootDir = manifest.getParentFile().getAbsolutePath(); if (checkPng(errStr, rootDir)) { bContinue = true; } if (horizontalScrollView_check(errStr)) { bContinue = true; } if (!bContinue) { //????,???? bContinue = fuckNotDefinedRes(errStr, rootDir); } } if (!bContinue) { throw new ShakaException(errStr, e); } } finally { System.setErr(olderr); } } } }
From source file:com.rover12421.shaka.apktool.lib.ARSCDecoderAj.java
License:Apache License
@Around("execution(* brut.androlib.res.decoder.ARSCDecoder.addMissingResSpecs())") public void addMissingResSpecs(ProceedingJoinPoint joinPoint) throws Throwable { if (!ShakaDecodeOption.getInstance().isFuckUnkownId()) { joinPoint.proceed(joinPoint.getArgs()); }// w w w . j a v a 2s . c o m }
From source file:com.rover12421.shaka.apktool.lib.ResConfigAj.java
License:Apache License
@Around("execution(void brut.androlib.res.data.ResConfig.addResource(..))" + "&& args(res, overwrite)") public void addResource(ProceedingJoinPoint joinPoint, ResResource res, boolean overwrite) throws Throwable { ResResSpec spec = res.getResSpec();//from www . j av a 2 s. c om ResResSpec resSpec = ResTypeAj.MultipleSpecs.get(spec.getId().id); if (resSpec != null) { //??ResResSpec ResValue resValue = res.getValue(); String rename; if (resValue instanceof ResFileValue) { ResFileValue fileValue = (ResFileValue) resValue; rename = fileValue.getPath().replaceAll("/|\\\\|\\.", "_"); MultopleResFileValue.put(spec.getId().id, res); } else { rename = MultipleSpec_Perfix + spec.getId(); } if (rename != null) { // LogHelper.warning("Rename ResResSpec " + spec.getName() + " to " + rename); ResResSpecAj.setName(spec, rename); ResTypeAj.addSpecToResType(spec); } } try { joinPoint.proceed(joinPoint.getArgs()); } catch (AndrolibException e) { LogHelper.warning(e.getMessage()); } }
From source file:com.rover12421.shaka.apktool.lib.ResFileDecoderAj.java
License:Apache License
@Around("execution(* brut.androlib.res.decoder.ResFileDecoder.decode(..))" + "&& args(inDir, inFileName, outDir, outFileName, decoder)") public void decode(ProceedingJoinPoint joinPoint, Directory inDir, String inFileName, Directory outDir, String outFileName, String decoder) throws Throwable { if (inFileName.startsWith("/")) { //inFileName,?? inFileName = inFileName.substring(1); inDir = AndrolibResourcesAj.getApkFile().getDirectory(); if (!inFileName.equals(outFileName)) { AndrolibAj.metaInfo.addDecodeFileMap(inFileName, "res/" + outFileName); }/*from w ww. ja va2s .c om*/ } else { if (!inFileName.equals(outFileName)) { AndrolibAj.metaInfo.addDecodeFileMap("res/" + inFileName, "res/" + outFileName); } } if (inDir == null) { //?,skip! LogHelper.warning("No resources directory, skip res : " + inFileName); return; } /** * .9.xml ? nine patch images ? 099cc0fcb3baec56f0ba3150c82dda56a63501d5 ? * ,inFileName? * ???, */ // /** // * .9.xml ? nine patch images ? // */ // if (outFileName.endsWith(".xml") && decoder.equals("9patch")) { // LogHelper.warning(String.format("Correct decoder [%s] : %s >>> xml", outFileName, decoder)); // decoder = "xml"; // } try { joinPoint.proceed(new Object[] { inDir, inFileName, outDir, outFileName, decoder }); } catch (AndrolibException e) { Throwable cause = e.getCause(); if (cause != null && (cause instanceof PathNotExist)) { LogHelper.warning( "File not exist, Try using [fnd|fuck-not-defined-res] parameter when build the project : " + inFileName); return; } if (outFileName.endsWith(".9.png")) { /** * 9patch ,raw?copy */ LogHelper.info("Decode 9patch exception, Using raw decode try again : " + inFileName); joinPoint.proceed(new Object[] { inDir, inFileName, outDir, outFileName, "raw" }); } } }
From source file:com.rover12421.shaka.apktool.lib.ResFileValueAj.java
License:Apache License
@Around("execution(* brut.androlib.res.data.value.ResFileValue.getStrippedPath())") public String getStrippedPath(ProceedingJoinPoint joinPoint) { try {// w w w. j a va2 s .co m return (String) joinPoint.proceed(joinPoint.getArgs()); } catch (Throwable throwable) { //?res, //"/"?,???,? return "/" + ((ResFileValue) joinPoint.getThis()).getPath(); } }
From source file:com.rover12421.shaka.apktool.lib.ResPackageAj.java
License:Apache License
@Around("execution(* brut.androlib.res.data.ResPackage.getResSpec(..))" + "&& args(resID)") public ResResSpec getResSpec(ProceedingJoinPoint joinPoint, ResID resID) throws Throwable { try {/*from w w w.ja va 2s . c o m*/ return (ResResSpec) joinPoint.proceed(joinPoint.getArgs()); } catch (UndefinedResObject e) { if (ShakaDecodeOption.getInstance().isFuckUnkownId()) { ResPackage thiz = (ResPackage) joinPoint.getThis(); return new ResResSpec(resID, String.format("[%08x]", resID.id), thiz, new ResTypeSpec("FuckUnkownId", thiz.getResTable(), thiz, (byte) (resID.id & 0xFF), 0)); } else { throw e; } } }
From source file:com.rover12421.shaka.apktool.lib.ResPackageAj.java
License:Apache License
@Around("execution(* brut.androlib.res.data.ResPackage.addResSpec(..))") public void addResSpec(ProceedingJoinPoint joinPoint) { try {//w ww . j a v a 2 s. c o m joinPoint.proceed(joinPoint.getArgs()); } catch (Throwable throwable) { LogHelper.warning(throwable.getMessage()); } }
From source file:com.rover12421.shaka.apktool.lib.ResResourceAj.java
License:Apache License
@Around("execution(* brut.androlib.res.data.ResResource.replace(..))" + "&& args(value)") public void replace(ProceedingJoinPoint joinPoint, ResValue value) throws Throwable { if (!ShakaDecodeOption.getInstance().isIgnoreResDecodeError()) { joinPoint.proceed(joinPoint.getArgs()); }//from w ww . jav a 2s . c o m }
From source file:com.rover12421.shaka.apktool.lib.ResResSpecAj.java
License:Apache License
@Around("execution(void brut.androlib.res.data.ResResSpec.addResource(..))" + "&& args(res, overwrite)") public void addResource(ProceedingJoinPoint joinPoint, ResResource res, boolean overwrite) throws Throwable { try {/*from www. j a v a 2s . c o m*/ joinPoint.proceed(joinPoint.getArgs()); } catch (AndrolibException e) { LogHelper.warning(e.getMessage()); } }
From source file:com.rover12421.shaka.apktool.lib.ResTypeAj.java
License:Apache License
@Around("execution(void brut.androlib.res.data.ResType.addResource(..))" + "&& args(res, overwrite)") public void addResource(ProceedingJoinPoint joinPoint, ResResource res, boolean overwrite) throws Throwable { ResResSpec spec = res.getResSpec();/*from ww w . j av a 2 s . co m*/ ResResSpec resSpec = ResTypeSpecAj.MultipleSpecs.get(spec.getId().id); if (resSpec != null) { //??ResResSpec ResValue resValue = res.getValue(); String rename; if (resValue instanceof ResFileValue) { ResFileValue fileValue = (ResFileValue) resValue; rename = fileValue.getPath().replaceAll("/|\\\\|\\.", "_"); MultopleResFileValue.put(spec.getId().id, res); } else { rename = MultipleSpec_Perfix + spec.getId(); } if (rename != null) { // LogHelper.warning("Rename ResResSpec " + spec.getName() + " to " + rename); ResResSpecAj.setName(spec, rename); ResTypeSpecAj.addSpecToResType(spec); } } try { joinPoint.proceed(joinPoint.getArgs()); } catch (AndrolibException e) { LogHelper.warning(e.getMessage()); } }