From 68e6e7f61de36d308220b583ef3183d16ec52cf5 Mon Sep 17 00:00:00 2001 From: Veha0001 Date: Sun, 29 Dec 2024 21:43:30 +0700 Subject: [PATCH] taskAffinity? should it change or not? idk rn. --- .pylintrc | 9 +++++---- autogen.py | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.pylintrc b/.pylintrc index 46e1abb..78fc666 100644 --- a/.pylintrc +++ b/.pylintrc @@ -290,10 +290,10 @@ exclude-too-few-public-methods= ignored-parents= # Maximum number of arguments for function / method. -max-args=5 +max-args=10 # Maximum number of attributes for a class (see R0902). -max-attributes=7 +max-attributes=10 # Maximum number of boolean expressions in an if statement (see R0916). max-bool-expr=5 @@ -308,7 +308,7 @@ max-locals=30 max-parents=7 # Maximum number of positional arguments for function / method. -max-positional-arguments=5 +max-positional-arguments=10 # Maximum number of public methods for a class (see R0904). max-public-methods=20 @@ -442,7 +442,8 @@ disable=raw-checker-failed, missing-class-docstring, use-symbolic-message-instead, use-implicit-booleaness-not-comparison-to-string, - use-implicit-booleaness-not-comparison-to-zero + use-implicit-booleaness-not-comparison-to-zero, + R1702 # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/autogen.py b/autogen.py index 7e3e666..7bdaab4 100755 --- a/autogen.py +++ b/autogen.py @@ -253,11 +253,22 @@ def rename_package_in_manifest( [ ( f'android:taskAffinity="{old_package_name}"', - f'android:taskAffinity="{new_package_name}"', + 'android:taskAffinity=""', ), ] ) + if level == 2: + replacements.extend( + [ + ( + f'android:taskAffinity="{old_package_name}"', + f'android:taskAffinity="{new_package_name}"', + ), + ] + ) + + if level == 3: replacements.extend( [ ( @@ -275,6 +286,25 @@ def rename_package_in_manifest( ] ) + if level == 4: + replacements.extend( + [ + ( + f'android:taskAffinity="{old_package_name}"', + 'android:taskAffinity=""', + ), + ( + f'android:host="{old_package_name}"', + f'android:host="{new_package_name}"', + ), + ( + f'android:host="cct\\.{old_package_name}"', + f'android:host="cct.{new_package_name}"', + ), + ] + ) + + # Perform replacements for pattern, replacement in replacements: @@ -283,7 +313,7 @@ def rename_package_in_manifest( with open(manifest_file, "w", encoding="utf-8") as file: file.write(content) - msg.success(f"Updated package name in AndroidManifest.xml") + msg.success("Updated package name in AndroidManifest.xml") except FileNotFoundError: msg.error(f"The manifest file '{manifest_file}' was not found.") @@ -659,7 +689,7 @@ def main(): msg.info("APK modification finished!", bold=True) - + if __name__ == "__main__": print_rainbow_art("DemodAPK", bold=True, font="small") main()