diff --git a/.travis.yml b/.travis.yml index 1f720399..719a1fe1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,6 @@ before_install: - git config --global user.name "Travis CI Bot" - sudo apt-get update -qq - sudo apt-get install -qq libstdc++6:i386 lib32z1 expect - - git submodule update --init --recursive script: ./gradlew build shadowJar proguard branches: only: diff --git a/INTERNAL.md b/INTERNAL.md index 57ea9cd0..996a81a5 100644 --- a/INTERNAL.md +++ b/INTERNAL.md @@ -2,7 +2,21 @@ The steps taken for slicing an official release of Apktool. -### Taging the release. +### Ensuring proper license headers + +Before we build a release, its a good practice to ensure all headers in source files contain +proper licenses. + + ./gradlew licenseMain && ./gradlew licenseTest + +If any license violations were found you can automatically fix them with either + + ./gradlew licenseFormatMain + ./gradlew licenseFormatTest + +Like described, one formats the `src/main` directory, while the other formats the `src/test` directory. + +### Tagging the release. Inside `build.gradle` there are two lines. diff --git a/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java b/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java index 590c72bf..87430e9c 100644 --- a/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java +++ b/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.apktool; import brut.androlib.*; @@ -74,7 +74,6 @@ public class Main { setAdvanceMode(true); } - // @todo use new ability of apache-commons-cli to check hasOption for non-prefixed items boolean cmdFound = false; for (String opt : commandLine.getArgs()) { if (opt.equalsIgnoreCase("d") || opt.equalsIgnoreCase("decode")) { @@ -96,9 +95,10 @@ public class Main { } // if no commands ran, run the version / usage check. - if (cmdFound == false) { + if (!cmdFound) { if (commandLine.hasOption("version")) { _version(); + System.exit(0); } else { usage(); } @@ -109,7 +109,7 @@ public class Main { ApkDecoder decoder = new ApkDecoder(); int paraCount = cli.getArgList().size(); - String apkName = (String) cli.getArgList().get(paraCount - 1); + String apkName = cli.getArgList().get(paraCount - 1); File outDir; // check for options @@ -192,13 +192,12 @@ public class Main { decoder.close(); } catch (IOException ignored) {} } - System.exit(0); } private static void cmdBuild(CommandLine cli) throws BrutException { String[] args = cli.getArgs(); String appDirName = args.length < 2 ? "." : args[1]; - File outFile = null; + File outFile; ApkOptions apkOptions = new ApkOptions(); // check for build options @@ -233,7 +232,7 @@ public class Main { private static void cmdInstallFramework(CommandLine cli) throws AndrolibException { int paraCount = cli.getArgList().size(); - String apkName = (String) cli.getArgList().get(paraCount - 1); + String apkName = cli.getArgList().get(paraCount - 1); ApkOptions apkOptions = new ApkOptions(); if (cli.hasOption("p") || cli.hasOption("frame-path")) { @@ -247,7 +246,7 @@ public class Main { private static void cmdPublicizeResources(CommandLine cli) throws AndrolibException { int paraCount = cli.getArgList().size(); - String apkName = (String) cli.getArgList().get(paraCount - 1); + String apkName = cli.getArgList().get(paraCount - 1); new Androlib().publicizeResources(new File(apkName)); } @@ -448,8 +447,6 @@ public class Main { } private static void usage() { - - // load basicOptions _Options(); HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(120); @@ -552,8 +549,8 @@ public class Main { Main.advanceMode = advanceMode; } - private static enum Verbosity { - NORMAL, VERBOSE, QUIET; + private enum Verbosity { + NORMAL, VERBOSE, QUIET } private static boolean advanceMode = false; diff --git a/brut.apktool/apktool-lib/src/main/java/android/content/res/XmlResourceParser.java b/brut.apktool/apktool-lib/src/main/java/android/content/res/XmlResourceParser.java index 1d7b59de..ee3ff224 100644 --- a/brut.apktool/apktool-lib/src/main/java/android/content/res/XmlResourceParser.java +++ b/brut.apktool/apktool-lib/src/main/java/android/content/res/XmlResourceParser.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2006 The Android Open Source Project +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * - * 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 + * 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 + * 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. + * 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 android.content.res; import org.xmlpull.v1.XmlPullParser; diff --git a/brut.apktool/apktool-lib/src/main/java/android/util/AttributeSet.java b/brut.apktool/apktool-lib/src/main/java/android/util/AttributeSet.java index 55840a6c..cd6b5d90 100644 --- a/brut.apktool/apktool-lib/src/main/java/android/util/AttributeSet.java +++ b/brut.apktool/apktool-lib/src/main/java/android/util/AttributeSet.java @@ -1,17 +1,18 @@ -/* - * Copyright 2008 Android4ME +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * - * 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 + * 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 + * 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. + * 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 android.util; diff --git a/brut.apktool/apktool-lib/src/main/java/android/util/TypedValue.java b/brut.apktool/apktool-lib/src/main/java/android/util/TypedValue.java index 8dc3922d..66360c89 100644 --- a/brut.apktool/apktool-lib/src/main/java/android/util/TypedValue.java +++ b/brut.apktool/apktool-lib/src/main/java/android/util/TypedValue.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2007 The Android Open Source Project +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * - * 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 + * 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 + * 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. + * 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 android.util; /** diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java index 9c61d964..de053d7f 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib; import brut.androlib.meta.MetaInfo; @@ -151,6 +151,9 @@ public class Androlib { if (in.containsDir("libs")) { in.copyToDir(outDir, "libs"); } + if (in.containsDir("kotlin")) { + in.copyToDir(outDir, "kotlin"); + } } catch (DirectoryException ex) { throw new AndrolibException(ex); } @@ -614,7 +617,7 @@ public class Androlib { ) { copyExistingFiles(inputFile, actualOutput); copyUnknownFiles(appDir, actualOutput, files); - } catch (IOException ex) { + } catch (IOException | BrutException ex) { throw new AndrolibException(ex); } @@ -643,12 +646,12 @@ public class Androlib { } private void copyUnknownFiles(File appDir, ZipOutputStream outputFile, Map files) - throws IOException { + throws BrutException, IOException { File unknownFileDir = new File(appDir, UNK_DIRNAME); // loop through unknown files for (Map.Entry unknownFileInfo : files.entrySet()) { - File inputFile = new File(unknownFileDir, unknownFileInfo.getKey()); + File inputFile = new File(unknownFileDir, BrutIO.sanitizeUnknownFile(unknownFileDir, unknownFileInfo.getKey())); if (inputFile.isDirectory()) { continue; } @@ -776,7 +779,7 @@ public class Androlib { "AndroidManifest.xml" }; private final static String[] APK_STANDARD_ALL_FILENAMES = new String[] { "classes.dex", "AndroidManifest.xml", "resources.arsc", "res", "r", "R", - "lib", "libs", "assets", "META-INF" }; + "lib", "libs", "assets", "META-INF", "kotlin" }; // Taken from AOSP's frameworks/base/tools/aapt/Package.cpp private final static Pattern NO_COMPRESS_PATTERN = Pattern.compile("\\.(" + "jpg|jpeg|png|gif|wav|mp2|mp3|ogg|aac|mpg|mpeg|mid|midi|smf|jet|rtttl|imy|xmf|mp4|" + diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/AndrolibException.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/AndrolibException.java index b8d7ed0a..e6c9594a 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/AndrolibException.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/AndrolibException.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib; import brut.common.BrutException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java index 34ec103e..96c52c27 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib; import brut.androlib.err.InFileNotFoundException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkOptions.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkOptions.java index b188d541..ca1415c3 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkOptions.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkOptions.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApktoolProperties.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApktoolProperties.java index b7c3bfdb..1733e8c3 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApktoolProperties.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApktoolProperties.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib; import java.io.IOException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFind9PatchChunk.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFind9PatchChunk.java index 0651dbce..38080e25 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFind9PatchChunk.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFind9PatchChunk.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.err; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFindFrameworkResException.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFindFrameworkResException.java index fe1bcd46..e7516339 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFindFrameworkResException.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/CantFindFrameworkResException.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.err; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/InFileNotFoundException.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/InFileNotFoundException.java index 8e51bec9..2b928e59 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/InFileNotFoundException.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/InFileNotFoundException.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.err; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/OutDirExistsException.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/OutDirExistsException.java index 0ae55c44..f8638350 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/OutDirExistsException.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/OutDirExistsException.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.err; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/UndefinedResObject.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/UndefinedResObject.java index 77ad1402..6627fd36 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/UndefinedResObject.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/err/UndefinedResObject.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.err; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/MetaInfo.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/MetaInfo.java index e1d78e84..799ae00d 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/MetaInfo.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/MetaInfo.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/PackageInfo.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/PackageInfo.java index b9fc3f3f..6ea3ae43 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/PackageInfo.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/PackageInfo.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExConstructor.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExConstructor.java index bcb09771..f0956620 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExConstructor.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExConstructor.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExRepresent.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExRepresent.java index a0499e9a..cad9774e 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExRepresent.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/StringExRepresent.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/UsesFramework.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/UsesFramework.java index 3184d7da..ae2231e1 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/UsesFramework.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/UsesFramework.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/VersionInfo.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/VersionInfo.java index 2e9ff3fe..e63314ef 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/VersionInfo.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/VersionInfo.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/YamlStringEscapeUtils.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/YamlStringEscapeUtils.java index eb5e188c..23de4dd3 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/YamlStringEscapeUtils.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/meta/YamlStringEscapeUtils.java @@ -1,18 +1,18 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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 * - * 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. + * 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 brut.androlib.meta; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java index 7c393c94..070839fc 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.mod; import java.io.*; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java index 2b1ad0c7..daa6711f 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res; import brut.androlib.AndrolibException; @@ -783,18 +783,18 @@ final public class AndrolibResources { try { if (OSDetection.isMacOSX()) { if (OSDetection.is64Bit()) { - aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/macosx/64/aapt"); + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/macosx/64/aapt", AndrolibResources.class); } else { - aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/macosx/32/aapt"); + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/macosx/32/aapt", AndrolibResources.class); } } else if (OSDetection.isUnix()) { if (OSDetection.is64Bit()) { - aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/linux/64/aapt"); + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/linux/64/aapt", AndrolibResources.class); } else { - aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/linux/32/aapt"); + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/linux/32/aapt", AndrolibResources.class); } } else if (OSDetection.isWindows()) { - aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/windows/aapt.exe"); + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/windows/aapt.exe", AndrolibResources.class); } else { LOGGER.warning("Unknown Operating System: " + OSDetection.returnOS()); return null; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/ResSmaliUpdater.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/ResSmaliUpdater.java index 99668b13..2325c17b 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/ResSmaliUpdater.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/ResSmaliUpdater.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java index 333c3aa7..4ddd76ae 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import java.util.logging.Logger; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java index 593d28b9..a2df9bd4 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; /** diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java index 5530bee5..aceef4be 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResPackage.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java index a11e2742..645821fd 100755 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import brut.androlib.AndrolibException; @@ -36,10 +36,11 @@ public class ResResSpec { String cleanName; ResResSpec resResSpec = type.getResSpecUnsafe(name); - if (resResSpec != null) + if (resResSpec != null) { cleanName = name + "_APKTOOL_DUPLICATENAME_" + id.toString(); - else + } else { cleanName = (name.isEmpty() ? ("APKTOOL_DUMMYVAL_" + id.toString()) : name); + } this.mName = cleanName; this.mPackage = pkg; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java index cf70aa49..13153d51 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResource.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java index bf18ec31..d01bafcb 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java index 7cb9f3a9..cfe45656 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResType.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java index 40022323..35ef3d3a 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTypeSpec.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResUnknownFiles.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResUnknownFiles.java index 86ad11a0..c00d99e9 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResUnknownFiles.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResUnknownFiles.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java index 7d140d94..896fd135 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResValuesFile.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data; import java.util.LinkedHashSet; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResArrayValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResArrayValue.java index b09fd660..cc5cd284 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResArrayValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResArrayValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResAttr.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResAttr.java index 5c2bd764..333df74e 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResAttr.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResAttr.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBagValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBagValue.java index 0d76cabf..3f2c7fbf 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBagValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBagValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBoolValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBoolValue.java index 8b824286..967d8245 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBoolValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResBoolValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; /** diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResColorValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResColorValue.java index 610cbfab..1d8f7d35 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResColorValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResColorValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; /** diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResDimenValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResDimenValue.java index 1726d327..db192dbb 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResDimenValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResDimenValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import android.util.TypedValue; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEmptyValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEmptyValue.java index 75acffee..59724c30 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEmptyValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEmptyValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2016 Pierre-Hugues Husson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEnumAttr.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEnumAttr.java index f1f85f51..33622d49 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEnumAttr.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResEnumAttr.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFileValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFileValue.java index 15d50151..f094743f 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFileValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFileValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFlagsAttr.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFlagsAttr.java index 07f0ff37..c525dc47 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFlagsAttr.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFlagsAttr.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFloatValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFloatValue.java index 142a0cb3..a08aea4c 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFloatValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFloatValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; /** diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFractionValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFractionValue.java index 99afe4dc..cfe183b1 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFractionValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResFractionValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import android.util.TypedValue; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIdValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIdValue.java index e2021a37..d791449f 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIdValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIdValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntBasedValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntBasedValue.java index 55602b32..39411df2 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntBasedValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntBasedValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; /** diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntValue.java index d7cb0e8a..5424e31d 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResIntValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import android.util.TypedValue; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResPluralsValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResPluralsValue.java index ced53fbf..a54bf632 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResPluralsValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResPluralsValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResReferenceValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResReferenceValue.java index 570a6d72..35f7a01e 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResReferenceValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResReferenceValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResScalarValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResScalarValue.java index 08f3b0ad..c792c222 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResScalarValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResScalarValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStringValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStringValue.java index 5a07bde1..dfce5336 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStringValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStringValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java index fe7bffc5..297d3d51 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValue.java index 7621ae40..50b8a609 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValue.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValue.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; /** diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java index 875142b0..c8d30b85 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResValueFactory.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.data.value; import android.util.TypedValue; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java index 2443646d..1888e954 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import android.util.TypedValue; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java index 8c1fe60e..c1e2deae 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java index 130c590e..5709fbee 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/Res9patchStreamDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResAttrDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResAttrDecoder.java index f42397b9..6812753d 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResAttrDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResAttrDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResFileDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResFileDecoder.java index 69280a20..f5051605 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResFileDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResFileDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java index 7187ea27..53c126b5 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoder.java index 7ede02f8..c9a140bc 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoderContainer.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoderContainer.java index a8648800..24a2745f 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoderContainer.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResStreamDecoderContainer.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java index dd692f41..29e56773 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import brut.androlib.res.xml.ResXmlEncoders; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java index 671a7b6e..e0d70b6c 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.decoder; import java.io.IOException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtFile.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtFile.java index 12fa9d40..b8254c1e 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtFile.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtFile.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtMXSerializer.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtMXSerializer.java index 8efa5bb7..5b24ac9d 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtMXSerializer.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtMXSerializer.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.util; import java.io.*; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtXmlSerializer.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtXmlSerializer.java index f5dc9e92..c1d20c00 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtXmlSerializer.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/util/ExtXmlSerializer.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.util; import java.io.IOException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResValuesXmlSerializable.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResValuesXmlSerializable.java index 16fc64eb..7c9eda70 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResValuesXmlSerializable.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResValuesXmlSerializable.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.xml; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncodable.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncodable.java index 27a83b3d..25abd970 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncodable.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncodable.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.xml; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java index 868bd4c1..e43cb887 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.res.xml; import brut.util.Duo; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlPatcher.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlPatcher.java index 6e36379f..a07a2f8c 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlPatcher.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlPatcher.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2015 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -106,13 +107,7 @@ public final class ResXmlPatcher { Node provider = attrs.getNamedItem("android:authorities"); if (provider != null) { - String reference = provider.getNodeValue(); - String replacement = pullValueFromStrings(file.getParentFile(), reference); - - if (replacement != null) { - provider.setNodeValue(replacement); - saved = true; - } + saved = isSaved(file, saved, provider); } } } @@ -132,13 +127,7 @@ public final class ResXmlPatcher { Node provider = attrs.getNamedItem("android:scheme"); if (provider != null) { - String reference = provider.getNodeValue(); - String replacement = pullValueFromStrings(file.getParentFile(), reference); - - if (replacement != null) { - provider.setNodeValue(replacement); - saved = true; - } + saved = isSaved(file, saved, provider); } } } @@ -153,6 +142,26 @@ public final class ResXmlPatcher { } } + /** + * Checks if the replacement was properly made to a node. + * + * @param file File we are searching for value + * @param saved boolean on whether we need to save + * @param provider Node we are attempting to replace + * @return boolean + * @throws AndrolibException setting node value failed + */ + private static boolean isSaved(File file, boolean saved, Node provider) throws AndrolibException { + String reference = provider.getNodeValue(); + String replacement = pullValueFromStrings(file.getParentFile(), reference); + + if (replacement != null) { + provider.setNodeValue(replacement); + saved = true; + } + return saved; + } + /** * Finds key in strings.xml file and returns text value * @@ -253,6 +262,10 @@ public final class ResXmlPatcher { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); docFactory.setFeature(FEATURE_DISABLE_DOCTYPE_DECL, true); + docFactory.setFeature(FEATURE_LOAD_DTD, false); + + docFactory.setAttribute(ACCESS_EXTERNAL_DTD, " "); + docFactory.setAttribute(ACCESS_EXTERNAL_SCHEMA, " "); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); // Not using the parse(File) method on purpose, so that we can control when @@ -284,5 +297,8 @@ public final class ResXmlPatcher { transformer.transform(source, result); } + private static final String ACCESS_EXTERNAL_DTD = "http://javax.xml.XMLConstants/property/accessExternalDTD"; + private static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema"; + private static final String FEATURE_LOAD_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; private static final String FEATURE_DISABLE_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl"; } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliBuilder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliBuilder.java index 935b62b2..db319d68 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliBuilder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliBuilder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.src; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliDecoder.java index e97f3a0e..9d5d22bb 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/src/SmaliDecoder.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib.src; import brut.androlib.AndrolibException; diff --git a/brut.apktool/apktool-lib/src/main/java/org/xmlpull/renamed/MXSerializer.java b/brut.apktool/apktool-lib/src/main/java/org/xmlpull/renamed/MXSerializer.java index 1adc9436..7603e45c 100644 --- a/brut.apktool/apktool-lib/src/main/java/org/xmlpull/renamed/MXSerializer.java +++ b/brut.apktool/apktool-lib/src/main/java/org/xmlpull/renamed/MXSerializer.java @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson + * + * 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.renamed; import java.io.IOException; diff --git a/brut.apktool/apktool-lib/src/main/resources/brut/androlib/android-framework.jar b/brut.apktool/apktool-lib/src/main/resources/brut/androlib/android-framework.jar index e438d290..99a00087 100644 Binary files a/brut.apktool/apktool-lib/src/main/resources/brut/androlib/android-framework.jar and b/brut.apktool/apktool-lib/src/main/resources/brut/androlib/android-framework.jar differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/32/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/32/aapt index 85915dd6..54b8aa32 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/32/aapt and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/32/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/64/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/64/aapt index 8848ff93..04017f9c 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/64/aapt and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/64/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/32/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/32/aapt index ffca404a..0027ab9d 100644 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/32/aapt and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/32/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/64/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/64/aapt index 79a74413..2d4dbba2 100644 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/64/aapt and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/64/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe index 8e701201..d3750238 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe differ diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/AndResGuardTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/AndResGuardTest.java index 50a8c3ea..92fff1c9 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/AndResGuardTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/AndResGuardTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2014 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeJarTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeJarTest.java index e53a142c..8073225d 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeJarTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeJarTest.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java index 0d0622a0..de311071 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/DebugTagRetainedTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DebugTagRetainedTest.java index e1ebaf0c..5e560dce 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/DebugTagRetainedTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DebugTagRetainedTest.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/DecodeKotlinTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DecodeKotlinTest.java new file mode 100644 index 00000000..d9414e8f --- /dev/null +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DecodeKotlinTest.java @@ -0,0 +1,78 @@ +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson + * + * 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 brut.androlib; + +import brut.directory.ExtFile; +import brut.common.BrutException; +import brut.util.OS; +import org.apache.commons.io.FileUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.util.logging.Logger; + +import static org.junit.Assert.assertTrue; + +/** + * @author Connor Tumbleson + */ +public class DecodeKotlinTest { + + @BeforeClass + public static void beforeClass() throws Exception { + TestUtils.cleanFrameworkFile(); + sTmpDir = new ExtFile(OS.createTempDirectory()); + TestUtils.copyResourceDir(DecodeKotlinTest.class, "brut/apktool/testkotlin/", sTmpDir); + + String apk = "testkotlin.apk"; + + // decode testkotlin.apk + ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + apk)); + sTestNewDir = new ExtFile(sTmpDir + File.separator + apk + ".out"); + + apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out")); + apkDecoder.decode(); + } + + @AfterClass + public static void afterClass() throws BrutException { + OS.rmdir(sTmpDir); + } + + @Test + public void kotlinFolderExistsTest() throws BrutException { + assertTrue(sTestNewDir.isDirectory()); + + File testKotlinFolder = new File(sTestNewDir, "kotlin"); + assertTrue(testKotlinFolder.isDirectory()); + } + + @Test + public void kotlinDecodeTest() throws BrutException, IOException { + File kotlinActivity = new File(sTestNewDir, "smali/org/example/kotlin/mixed/KotlinActivity.smali"); + + assertTrue(FileUtils.readFileToString(kotlinActivity).contains("KotlinActivity.kt")); + } + + private static ExtFile sTmpDir; + private static ExtFile sTestNewDir; + + private final static Logger LOGGER = Logger.getLogger(DecodeKotlinTest.class.getName()); +} \ No newline at end of file diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/DefaultBaksmaliVariableTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DefaultBaksmaliVariableTest.java index e3a50767..7ca65e22 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/DefaultBaksmaliVariableTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DefaultBaksmaliVariableTest.java @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson + * + * 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 brut.androlib; import brut.common.BrutException; diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/DoubleExtensionUnknownFileTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DoubleExtensionUnknownFileTest.java index d5f5c6ea..20227956 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/DoubleExtensionUnknownFileTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/DoubleExtensionUnknownFileTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2016 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ExternalEntityTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ExternalEntityTest.java index 4fb56f43..83242feb 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ExternalEntityTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ExternalEntityTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2016 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/LargeIntsInManifestTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/LargeIntsInManifestTest.java index 6af2c0d1..744a4ff4 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/LargeIntsInManifestTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/LargeIntsInManifestTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2014 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/MissingVersionManifestTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/MissingVersionManifestTest.java index 71298ab3..a85e3a02 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/MissingVersionManifestTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/MissingVersionManifestTest.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ParentDirectoryTraversalTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ParentDirectoryTraversalTest.java index 1361c570..84200faf 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ParentDirectoryTraversalTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ParentDirectoryTraversalTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2014 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java index ad134f2b..18a52546 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/PositionalEnumerationTest.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ProviderAttributeTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ProviderAttributeTest.java index 8d075e82..a1cef1f5 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ProviderAttributeTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ProviderAttributeTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2014 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ReferenceVersionCodeTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ReferenceVersionCodeTest.java index 18e51f28..0342756d 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/ReferenceVersionCodeTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/ReferenceVersionCodeTest.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/SharedLibraryTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/SharedLibraryTest.java index e61e0f44..47f2d7ce 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/SharedLibraryTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/SharedLibraryTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2014 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/TestUtils.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/TestUtils.java index 33a0b155..39334d32 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/TestUtils.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/TestUtils.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.androlib; import brut.androlib.res.AndrolibResources; diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/UnknownCompressionTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/UnknownCompressionTest.java index 5b64b0c9..bbe9177b 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/UnknownCompressionTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/UnknownCompressionTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2016 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/UnknownDirectoryTraversalTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/UnknownDirectoryTraversalTest.java new file mode 100644 index 00000000..30d3651d --- /dev/null +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/UnknownDirectoryTraversalTest.java @@ -0,0 +1,77 @@ +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson + * + * 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 brut.androlib; + +import brut.common.BrutException; +import brut.common.InvalidUnknownFileException; +import brut.common.RootUnknownFileException; +import brut.common.TraversalUnknownFileException; +import brut.directory.ExtFile; +import brut.util.BrutIO; +import brut.util.OS; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * @author Connor Tumbleson + */ +public class UnknownDirectoryTraversalTest { + + @BeforeClass + public static void beforeClass() throws Exception { + sTmpDir = new ExtFile(OS.createTempDirectory()); + TestUtils.copyResourceDir(UnknownDirectoryTraversalTest.class, "brut/apktool/traversal", sTmpDir); + } + + @Test + public void validFileTest() throws IOException, BrutException { + String validFilename = BrutIO.sanitizeUnknownFile(sTmpDir, "file"); + assertEquals(validFilename, "file"); + + File validFile = new File(sTmpDir, validFilename); + assertTrue(validFile.isFile()); + } + + @Test(expected = TraversalUnknownFileException.class) + public void invalidBackwardFileTest() throws IOException, BrutException { + BrutIO.sanitizeUnknownFile(sTmpDir, "../file"); + } + + @Test(expected = RootUnknownFileException.class) + public void invalidRootFileTest() throws IOException, BrutException { + BrutIO.sanitizeUnknownFile(sTmpDir, "/file"); + } + + @Test(expected = InvalidUnknownFileException.class) + public void noFilePassedTest() throws IOException, BrutException { + BrutIO.sanitizeUnknownFile(sTmpDir, ""); + } + + @Test + public void validDirectoryFileTest() throws IOException, BrutException { + String validFilename = BrutIO.sanitizeUnknownFile(sTmpDir, "dir" + File.separator + "file"); + assertEquals("dir" + File.separator + "file", validFilename); + } + + public static File sTmpDir; +} diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/VectorDrawableTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/VectorDrawableTest.java index 64e93061..1c70429a 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/VectorDrawableTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/VectorDrawableTest.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2014 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/brut.apktool/apktool-lib/src/test/resources/brut/apktool/testkotlin/testkotlin.apk b/brut.apktool/apktool-lib/src/test/resources/brut/apktool/testkotlin/testkotlin.apk new file mode 100644 index 00000000..7163ae36 Binary files /dev/null and b/brut.apktool/apktool-lib/src/test/resources/brut/apktool/testkotlin/testkotlin.apk differ diff --git a/brut.apktool/apktool-lib/src/test/resources/brut/apktool/traversal/file b/brut.apktool/apktool-lib/src/test/resources/brut/apktool/traversal/file new file mode 100644 index 00000000..1a010b1c --- /dev/null +++ b/brut.apktool/apktool-lib/src/test/resources/brut/apktool/traversal/file @@ -0,0 +1 @@ +file \ No newline at end of file diff --git a/brut.j.common/src/main/java/brut/common/BrutException.java b/brut.j.common/src/main/java/brut/common/BrutException.java index c47c8ce7..ab96f94d 100644 --- a/brut.j.common/src/main/java/brut/common/BrutException.java +++ b/brut.j.common/src/main/java/brut/common/BrutException.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.common; /** diff --git a/brut.j.common/src/main/java/brut/common/InvalidUnknownFileException.java b/brut.j.common/src/main/java/brut/common/InvalidUnknownFileException.java new file mode 100644 index 00000000..0adf7b55 --- /dev/null +++ b/brut.j.common/src/main/java/brut/common/InvalidUnknownFileException.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson + * + * 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 brut.common; + +public class InvalidUnknownFileException extends BrutException { + public InvalidUnknownFileException(String message) { + super(message); + } +} diff --git a/brut.j.common/src/main/java/brut/common/RootUnknownFileException.java b/brut.j.common/src/main/java/brut/common/RootUnknownFileException.java new file mode 100644 index 00000000..475a0fdf --- /dev/null +++ b/brut.j.common/src/main/java/brut/common/RootUnknownFileException.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson + * + * 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 brut.common; + +public class RootUnknownFileException extends BrutException { + public RootUnknownFileException(String message) { + super(message); + } +} diff --git a/brut.j.common/src/main/java/brut/common/TraversalUnknownFileException.java b/brut.j.common/src/main/java/brut/common/TraversalUnknownFileException.java new file mode 100644 index 00000000..1c694540 --- /dev/null +++ b/brut.j.common/src/main/java/brut/common/TraversalUnknownFileException.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson + * + * 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 brut.common; + +public class TraversalUnknownFileException extends BrutException { + public TraversalUnknownFileException(String message) { + super(message); + } +} diff --git a/brut.j.common/src/templates/apache2.0-header.txt b/brut.j.common/src/templates/apache2.0-header.txt index f8043844..0f470883 100644 --- a/brut.j.common/src/templates/apache2.0-header.txt +++ b/brut.j.common/src/templates/apache2.0-header.txt @@ -1,4 +1,5 @@ - Copyright 2014 Ryszard Wiśniewski + Copyright (C) ${year} ${brut} <${brutEmail}> + Copyright (C) ${year} ${ibot} <${ibotEmail}> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/brut.j.dir/src/main/java/brut/directory/AbstractDirectory.java b/brut.j.dir/src/main/java/brut/directory/AbstractDirectory.java index ea906c7a..9f7bd29c 100644 --- a/brut.j.dir/src/main/java/brut/directory/AbstractDirectory.java +++ b/brut.j.dir/src/main/java/brut/directory/AbstractDirectory.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; import java.io.File; diff --git a/brut.j.dir/src/main/java/brut/directory/ChangesWrapperDirectory.java b/brut.j.dir/src/main/java/brut/directory/ChangesWrapperDirectory.java index 5bf250ad..8ce6da6c 100644 --- a/brut.j.dir/src/main/java/brut/directory/ChangesWrapperDirectory.java +++ b/brut.j.dir/src/main/java/brut/directory/ChangesWrapperDirectory.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - //package brut.directory; // //import java.io.InputStream; diff --git a/brut.j.dir/src/main/java/brut/directory/DirUtil.java b/brut.j.dir/src/main/java/brut/directory/DirUtil.java index da022ca6..696dee2f 100644 --- a/brut.j.dir/src/main/java/brut/directory/DirUtil.java +++ b/brut.j.dir/src/main/java/brut/directory/DirUtil.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; import brut.common.BrutException; diff --git a/brut.j.dir/src/main/java/brut/directory/Directory.java b/brut.j.dir/src/main/java/brut/directory/Directory.java index e7a972be..72b6f3c3 100644 --- a/brut.j.dir/src/main/java/brut/directory/Directory.java +++ b/brut.j.dir/src/main/java/brut/directory/Directory.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; import java.io.*; diff --git a/brut.j.dir/src/main/java/brut/directory/DirectoryException.java b/brut.j.dir/src/main/java/brut/directory/DirectoryException.java index 027810a5..4bf6cf59 100644 --- a/brut.j.dir/src/main/java/brut/directory/DirectoryException.java +++ b/brut.j.dir/src/main/java/brut/directory/DirectoryException.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; import brut.common.BrutException; diff --git a/brut.j.dir/src/main/java/brut/directory/ExtFile.java b/brut.j.dir/src/main/java/brut/directory/ExtFile.java index 7da9f260..86fd1776 100644 --- a/brut.j.dir/src/main/java/brut/directory/ExtFile.java +++ b/brut.j.dir/src/main/java/brut/directory/ExtFile.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; import java.io.File; diff --git a/brut.j.dir/src/main/java/brut/directory/FileDirectory.java b/brut.j.dir/src/main/java/brut/directory/FileDirectory.java index ae911408..5bfa4066 100644 --- a/brut.j.dir/src/main/java/brut/directory/FileDirectory.java +++ b/brut.j.dir/src/main/java/brut/directory/FileDirectory.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; import java.io.*; diff --git a/brut.j.dir/src/main/java/brut/directory/PathAlreadyExists.java b/brut.j.dir/src/main/java/brut/directory/PathAlreadyExists.java index 26e89083..e7d1ca03 100644 --- a/brut.j.dir/src/main/java/brut/directory/PathAlreadyExists.java +++ b/brut.j.dir/src/main/java/brut/directory/PathAlreadyExists.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; public class PathAlreadyExists extends DirectoryException { diff --git a/brut.j.dir/src/main/java/brut/directory/PathNotExist.java b/brut.j.dir/src/main/java/brut/directory/PathNotExist.java index 9cbc97ef..0b52bf81 100644 --- a/brut.j.dir/src/main/java/brut/directory/PathNotExist.java +++ b/brut.j.dir/src/main/java/brut/directory/PathNotExist.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; public class PathNotExist extends DirectoryException { diff --git a/brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java b/brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java index c16dac31..cb9e2e86 100644 --- a/brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java +++ b/brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.directory; import java.io.File; diff --git a/brut.j.util/src/main/java/brut/util/BrutIO.java b/brut.j.util/src/main/java/brut/util/BrutIO.java index 4022a1f9..da4e8ece 100644 --- a/brut.j.util/src/main/java/brut/util/BrutIO.java +++ b/brut.j.util/src/main/java/brut/util/BrutIO.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.util; import java.io.*; @@ -22,6 +22,10 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; +import brut.common.BrutException; +import brut.common.InvalidUnknownFileException; +import brut.common.RootUnknownFileException; +import brut.common.TraversalUnknownFileException; import org.apache.commons.io.IOUtils; /** @@ -73,6 +77,26 @@ public class BrutIO { return crc; } + public static String sanitizeUnknownFile(final File directory, final String entry) throws IOException, BrutException { + if (entry.length() == 0) { + throw new InvalidUnknownFileException("Invalid Unknown File - " + entry); + } + + if (new File(entry).isAbsolute()) { + throw new RootUnknownFileException("Absolute Unknown Files is not allowed - " + entry); + } + + final String canonicalDirPath = directory.getCanonicalPath() + File.separator; + final String canonicalEntryPath = new File(directory, entry).getCanonicalPath(); + + if (!canonicalEntryPath.startsWith(canonicalDirPath)) { + throw new TraversalUnknownFileException("Directory Traversal is not allowed - " + entry); + } + + // https://stackoverflow.com/q/2375903/455008 + return canonicalEntryPath.substring(canonicalDirPath.length()); + } + public static void copy(File inputFile, ZipOutputStream outputFile) throws IOException { try ( FileInputStream fis = new FileInputStream(inputFile) diff --git a/brut.j.util/src/main/java/brut/util/DataInputDelegate.java b/brut.j.util/src/main/java/brut/util/DataInputDelegate.java index 4e6d5888..4be56bb6 100644 --- a/brut.j.util/src/main/java/brut/util/DataInputDelegate.java +++ b/brut.j.util/src/main/java/brut/util/DataInputDelegate.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.util; import java.io.DataInput; diff --git a/brut.j.util/src/main/java/brut/util/Duo.java b/brut.j.util/src/main/java/brut/util/Duo.java index 9715449e..5a220f98 100644 --- a/brut.j.util/src/main/java/brut/util/Duo.java +++ b/brut.j.util/src/main/java/brut/util/Duo.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.util; /** diff --git a/brut.j.util/src/main/java/brut/util/ExtDataInput.java b/brut.j.util/src/main/java/brut/util/ExtDataInput.java index 72f4e15c..e8e42140 100644 --- a/brut.j.util/src/main/java/brut/util/ExtDataInput.java +++ b/brut.j.util/src/main/java/brut/util/ExtDataInput.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.util; import java.io.*; diff --git a/brut.j.util/src/main/java/brut/util/Jar.java b/brut.j.util/src/main/java/brut/util/Jar.java index 4c945688..80009499 100644 --- a/brut.j.util/src/main/java/brut/util/Jar.java +++ b/brut.j.util/src/main/java/brut/util/Jar.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,15 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.util; import brut.common.BrutException; + import java.io.*; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; + import org.apache.commons.io.IOUtils; /** @@ -29,18 +31,21 @@ import org.apache.commons.io.IOUtils; */ abstract public class Jar { private final static Set mLoaded = new HashSet(); - private final static Map mExtracted = - new HashMap(); + private final static Map mExtracted = new HashMap(); - public static File getResourceAsFile(String name) throws BrutException { + public static File getResourceAsFile(String name, Class clazz) throws BrutException { File file = mExtracted.get(name); if (file == null) { - file = extractToTmp(name); + file = extractToTmp(name, clazz); mExtracted.put(name, file); } return file; } + public static File getResourceAsFile(String name) throws BrutException { + return getResourceAsFile(name, Class.class); + } + public static void load(String libPath) { if (mLoaded.contains(libPath)) { return; @@ -57,13 +62,20 @@ abstract public class Jar { } public static File extractToTmp(String resourcePath) throws BrutException { - return extractToTmp(resourcePath, "brut_util_Jar_"); + return extractToTmp(resourcePath, Class.class); } - public static File extractToTmp(String resourcePath, String tmpPrefix) - throws BrutException { + public static File extractToTmp(String resourcePath, Class clazz) throws BrutException { + return extractToTmp(resourcePath, "brut_util_Jar_", clazz); + } + + public static File extractToTmp(String resourcePath, String tmpPrefix) throws BrutException { + return extractToTmp(resourcePath, tmpPrefix, Class.class); + } + + public static File extractToTmp(String resourcePath, String tmpPrefix, Class clazz) throws BrutException { try { - InputStream in = Class.class.getResourceAsStream(resourcePath); + InputStream in = clazz.getResourceAsStream(resourcePath); if (in == null) { throw new FileNotFoundException(resourcePath); } @@ -75,8 +87,7 @@ abstract public class Jar { out.close(); return fileOut; } catch (IOException ex) { - throw new BrutException( - "Could not extract resource: " + resourcePath, ex); + throw new BrutException("Could not extract resource: " + resourcePath, ex); } } } diff --git a/brut.j.util/src/main/java/brut/util/OS.java b/brut.j.util/src/main/java/brut/util/OS.java index 7c508187..92cae4d4 100644 --- a/brut.j.util/src/main/java/brut/util/OS.java +++ b/brut.j.util/src/main/java/brut/util/OS.java @@ -1,5 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package brut.util; import brut.common.BrutException; diff --git a/brut.j.util/src/main/java/brut/util/OSDetection.java b/brut.j.util/src/main/java/brut/util/OSDetection.java index 1157c8d7..bc76334b 100644 --- a/brut.j.util/src/main/java/brut/util/OSDetection.java +++ b/brut.j.util/src/main/java/brut/util/OSDetection.java @@ -1,6 +1,6 @@ /** - * Copyright 2014 Ryszard Wiśniewski - * Copyright 2013 Connor Tumbleson + * Copyright (C) 2017 Ryszard Wiśniewski + * Copyright (C) 2017 Connor Tumbleson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index d4a912d0..1952f5d5 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,10 @@ buildscript { } } +plugins { + id "com.github.hierynomus.license" version "0.14.0" +} + apply from: 'gradle/functions.gradle' def apktoolversion_major = '2.2.4' @@ -34,8 +38,29 @@ defaultTasks 'build', 'shadowJar', 'proguard' allprojects { apply plugin: 'java' + apply plugin: 'license' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 + + license { + header rootProject.file("brut.j.common/src/templates/apache2.0-header.txt") + include "**/*.java" + strictCheck true + + ext.year = Calendar.getInstance().get(Calendar.YEAR) + ext.brut = 'Ryszard Wiśniewski' + ext.brutEmail = 'brut.alll@gmail.com' + ext.ibot = 'Connor Tumbleson' + ext.ibotEmail = 'connor.tumbleson@gmail.com' + } + + tasks.withType(JavaCompile) { + options.compilerArgs += ["-Xlint:-options"] + } + + // license plugin automatically fires these tasks, disable them and run them during releases + gradle.startParameter.excludedTaskNames += "licenseMain" + gradle.startParameter.excludedTaskNames += "licenseTest" } if (!('release' in gradle.startParameter.taskNames)) { @@ -86,7 +111,6 @@ subprojects { commons_cli: 'commons-cli:commons-cli:1.4', commons_io: 'commons-io:commons-io:2.4', commons_lang: 'org.apache.commons:commons-lang3:3.1', - findbugs: 'com.google.code.findbugs:jsr305:3.0.1', guava: 'com.google.guava:guava:14.0', junit: 'junit:junit:4.12', proguard_gradle: 'net.sf.proguard:proguard-gradle:5.2.1', @@ -101,10 +125,6 @@ subprojects { mavenCentral() } - dependencies { - testCompile depends.junit - } - test { testLogging { exceptionFormat = 'full' diff --git a/gradle/functions.gradle b/gradle/functions.gradle index 393f07d5..00289a93 100644 --- a/gradle/functions.gradle +++ b/gradle/functions.gradle @@ -14,36 +14,37 @@ * limitations under the License. */ -gradle.allprojects { +def getCheckedOutGitCommitHash() { + def gitFolder = "$projectDir/.git/" + def takeFromHash = 6 - // https://gist.github.com/JonasGroeger/7620911 - ext.getCheckedOutGitCommitHash = { - def gitFolder = "$projectDir/.git/" - def takeFromHash = 6 - - def head - try { - head = new File(gitFolder + "HEAD").text.split(":") - } catch(Exception e) { - return null; - } - - def isCommit = head.length == 1 - if(isCommit) return head[0].trim().take(takeFromHash) - - def refHead = new File(gitFolder + head[1].trim()) - refHead.text.trim().take takeFromHash + def head + try { + head = new File(gitFolder + "HEAD").text.split(":") + } catch(Exception e) { + return null; } - ext.getCheckedOutBranch = { - def gitFolder = "$projectDir/.git/" + def isCommit = head.length == 1 + if(isCommit) return head[0].trim().take(takeFromHash) - def head - try { - head = new File(gitFolder + "HEAD").text.split("/") - return head[2].trim(); - } catch(Exception e) { - return "SNAPSHOT"; - } + def refHead = new File(gitFolder + head[1].trim()) + refHead.text.trim().take takeFromHash +} + +def getCheckedOutBranch() { + def gitFolder = "$projectDir/.git/" + + def head + try { + head = new File(gitFolder + "HEAD").text.split("/") + return head[2].trim(); + } catch(Exception e) { + return "SNAPSHOT"; } } + +ext { + getCheckedOutGitCommitHash = this.&getCheckedOutGitCommitHash + getCheckedOutBranch = this.&getCheckedOutBranch +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index df04e474..f5bf744c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac0fa224..4e37c6d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Apr 24 12:27:08 SGT 2017 +#Mon Jul 03 07:09:45 EDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip diff --git a/gradlew b/gradlew index 4453ccea..cccdd3d5 100755 --- a/gradlew +++ b/gradlew @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -155,7 +155,7 @@ if $cygwin ; then fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " }