mirror of
https://github.com/fankes/TSBattery.git
synced 2025-09-04 09:45:41 +08:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
8025b45b06
|
|||
d8b3884cb0
|
|||
1a3c8d9bcb
|
|||
b6d8040bfa
|
|||
d4f8d7d3fd
|
|||
a4970747c0
|
|||
4a8816de37
|
|||
6969d7b2c6
|
|||
ea0b46020f
|
|||
4436815525
|
|||
e96b6a5d2a
|
|||
576c8574c8
|
|||
94d425fcf7
|
|||
58510cef52
|
|||
efe000d690
|
|||
c9d49a398f
|
|||
bd027b37f5
|
|||
2e56baa6c7
|
|||
147b7fa6f5
|
|||
6bd906a51e
|
|||
5c92671ae2
|
|||
b5bb7eb892
|
|||
3361284f16
|
|||
5b4da6df45
|
|||
f520983d32
|
|||
1e67116f0a
|
|||
7257127c0f
|
|||
63d5043f31
|
|||
64c4c282b2
|
|||
89cbc49287
|
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# noinspection EditorConfigKeyCorrectness
|
||||||
|
[{*.kt,*.kts}]
|
||||||
|
ktlint_standard_annotation = disabled
|
||||||
|
ktlint_standard_filename = disabled
|
||||||
|
ktlint_standard_wrapping = disabled
|
||||||
|
ktlint_standard_import-ordering = enabled
|
||||||
|
ktlint_standard_max-line-length = disabled
|
||||||
|
ktlint_standard_multiline-if-else = disabled
|
||||||
|
ktlint_standard_argument-list-wrapping = disabled
|
||||||
|
ktlint_standard_parameter-list-wrapping = disabled
|
||||||
|
ktlint_standard_trailing-comma-on-declaration-site = disabled
|
||||||
|
ktlint_function_signature_body_expression_wrapping = multiline
|
||||||
|
ij_continuation_indent_size = 2
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = false
|
||||||
|
max_line_length = 150
|
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -42,6 +42,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Android 版本
|
label: Android 版本
|
||||||
options:
|
options:
|
||||||
|
- 14
|
||||||
- 13
|
- 13
|
||||||
- 12L/12.1
|
- 12L/12.1
|
||||||
- 12
|
- 12
|
||||||
|
47
.github/workflows/commit_ci.yml
vendored
47
.github/workflows/commit_ci.yml
vendored
@@ -13,17 +13,34 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build CI
|
name: Build CI
|
||||||
|
if: ${{ success() }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
APK_OUTPUT_PATH: 'app/build/outputs/apk'
|
||||||
|
TG_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||||
|
TG_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||||
|
COMMIT_MESSAGE: |+
|
||||||
|
New push to GitHub\!
|
||||||
|
```
|
||||||
|
${{ github.event.head_commit.message }}
|
||||||
|
```by `${{ github.event.head_commit.author.name }}`
|
||||||
|
See commit detail [here](${{ github.event.head_commit.url }})
|
||||||
|
COMMIT_URL: ${{ github.event.head_commit.url }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- name: Prepare GitHub Env
|
||||||
|
run: |
|
||||||
|
GITHUB_SHA=${{ github.sha }}
|
||||||
|
GITHUB_CI_COMMIT_ID=${GITHUB_SHA:0:7}
|
||||||
|
echo "GITHUB_CI_COMMIT_ID=$GITHUB_CI_COMMIT_ID" >> $GITHUB_ENV
|
||||||
- name: Setup cmake
|
- name: Setup cmake
|
||||||
uses: jwlawson/actions-setup-cmake@v1
|
uses: jwlawson/actions-setup-cmake@v1
|
||||||
with:
|
with:
|
||||||
cmake-version: '3.22.1'
|
cmake-version: '3.22.1'
|
||||||
- name: Prepare Java 11
|
- name: Prepare Java 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 17
|
||||||
java-package: jdk
|
java-package: jdk
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: 'gradle'
|
cache: 'gradle'
|
||||||
@@ -34,7 +51,7 @@ jobs:
|
|||||||
~/.gradle/caches
|
~/.gradle/caches
|
||||||
~/.gradle/wrapper
|
~/.gradle/wrapper
|
||||||
!~/.gradle/caches/build-cache-*
|
!~/.gradle/caches/build-cache-*
|
||||||
key: gradle-deps-core-${{ hashFiles('**/build.gradle') }}
|
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
gradle-deps
|
gradle-deps
|
||||||
- name: Cache Gradle Build
|
- name: Cache Gradle Build
|
||||||
@@ -49,15 +66,23 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
./gradlew :app:assembleDebug
|
./gradlew :app:assembleDebug
|
||||||
./gradlew :app:assembleRelease
|
./gradlew :app:assembleRelease
|
||||||
echo "DEBUG_APK_FILE=$(find app/build/outputs/apk/debug -name '*.apk')" >> $GITHUB_ENV
|
echo "DEBUG_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
|
||||||
echo "RELEASE_APK_FILE=$(find app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV
|
echo "RELEASE_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
|
||||||
- name: Upload Artifacts(debug)
|
- name: Upload Artifacts (Debug)
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.DEBUG_APK_FILE }}
|
path: ${{ env.DEBUG_APK_PATH }}
|
||||||
name: app-debug
|
name: TSBattery-debug-${{ github.event.head_commit.id }}
|
||||||
- name: Upload Artifacts(release)
|
- name: Upload Artifacts (Release)
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.RELEASE_APK_FILE }}
|
path: ${{ env.RELEASE_APK_PATH }}
|
||||||
name: app-release
|
name: TSBattery-release-${{ github.event.head_commit.id }}
|
||||||
|
- name: Post Artifacts to Telegram
|
||||||
|
run: |
|
||||||
|
export debug=$(find ${{ env.APK_OUTPUT_PATH }}/debug -name "*.apk")
|
||||||
|
export release=$(find ${{ env.APK_OUTPUT_PATH }}/release -name "*.apk")
|
||||||
|
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'`
|
||||||
|
curl -v "https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMediaGroup?chat_id=${TG_CHAT_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdebug%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Frelease%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22:${ESCAPED}%7D%5D" \
|
||||||
|
-F debug="@$debug" \
|
||||||
|
-F release="@$release"
|
32
.github/workflows/pull_request_ci.yml
vendored
32
.github/workflows/pull_request_ci.yml
vendored
@@ -11,18 +11,26 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Pull request check
|
name: Pull Request Check
|
||||||
|
if: ${{ success() }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
APK_OUTPUT_PATH: 'app/build/outputs/apk'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- name: Prepare GitHub Env
|
||||||
|
run: |
|
||||||
|
GITHUB_SHA=${{ github.sha }}
|
||||||
|
GITHUB_CI_COMMIT_ID=${GITHUB_SHA:0:7}
|
||||||
|
echo "GITHUB_CI_COMMIT_ID=$GITHUB_CI_COMMIT_ID" >> $GITHUB_ENV
|
||||||
- name: Setup cmake
|
- name: Setup cmake
|
||||||
uses: jwlawson/actions-setup-cmake@v1
|
uses: jwlawson/actions-setup-cmake@v1
|
||||||
with:
|
with:
|
||||||
cmake-version: '3.22.1'
|
cmake-version: '3.22.1'
|
||||||
- name: Prepare Java 11
|
- name: Prepare Java 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 17
|
||||||
java-package: jdk
|
java-package: jdk
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: 'gradle'
|
cache: 'gradle'
|
||||||
@@ -33,7 +41,7 @@ jobs:
|
|||||||
~/.gradle/caches
|
~/.gradle/caches
|
||||||
~/.gradle/wrapper
|
~/.gradle/wrapper
|
||||||
!~/.gradle/caches/build-cache-*
|
!~/.gradle/caches/build-cache-*
|
||||||
key: gradle-deps-core-${{ hashFiles('**/build.gradle') }}
|
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
gradle-deps
|
gradle-deps
|
||||||
- name: Cache Gradle Build
|
- name: Cache Gradle Build
|
||||||
@@ -48,15 +56,15 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
./gradlew :app:assembleDebug
|
./gradlew :app:assembleDebug
|
||||||
./gradlew :app:assembleRelease
|
./gradlew :app:assembleRelease
|
||||||
echo "DEBUG_APK_FILE=$(find app/build/outputs/apk/debug -name '*.apk')" >> $GITHUB_ENV
|
echo "DEBUG_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
|
||||||
echo "RELEASE_APK_FILE=$(find app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV
|
echo "RELEASE_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
|
||||||
- name: Upload Artifacts(debug)
|
- name: Upload Artifacts (Debug)
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.DEBUG_APK_FILE }}
|
path: ${{ env.DEBUG_APK_PATH }}
|
||||||
name: app-debug
|
name: TSBattery-debug-${{ github.event.head_commit.id }}
|
||||||
- name: Upload Artifacts(release)
|
- name: Upload Artifacts (Release)
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.RELEASE_APK_FILE }}
|
path: ${{ env.RELEASE_APK_PATH }}
|
||||||
name: app-release
|
name: TSBattery-release-${{ github.event.head_commit.id }}
|
2
.idea/.gitignore
generated
vendored
2
.idea/.gitignore
generated
vendored
@@ -1,3 +1,5 @@
|
|||||||
# Default ignored files
|
# Default ignored files
|
||||||
/shelf/
|
/shelf/
|
||||||
/workspace.xml
|
/workspace.xml
|
||||||
|
/gradle.xml
|
||||||
|
/misc.xml
|
26
.idea/appInsightsSettings.xml
generated
Normal file
26
.idea/appInsightsSettings.xml
generated
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AppInsightsSettings">
|
||||||
|
<option name="tabSettings">
|
||||||
|
<map>
|
||||||
|
<entry key="Firebase Crashlytics">
|
||||||
|
<value>
|
||||||
|
<InsightsFilterSettings>
|
||||||
|
<option name="connection">
|
||||||
|
<ConnectionSetting>
|
||||||
|
<option name="appId" value="PLACEHOLDER" />
|
||||||
|
<option name="mobileSdkAppId" value="" />
|
||||||
|
<option name="projectId" value="" />
|
||||||
|
<option name="projectNumber" value="" />
|
||||||
|
</ConnectionSetting>
|
||||||
|
</option>
|
||||||
|
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||||
|
<option name="timeIntervalDays" value="THIRTY_DAYS" />
|
||||||
|
<option name="visibilityType" value="ALL" />
|
||||||
|
</InsightsFilterSettings>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
117
.idea/codeStyles/Project.xml
generated
Normal file
117
.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<codeStyleSettings language="XML">
|
||||||
|
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
|
<arrangement>
|
||||||
|
<rules>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:android</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:id</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>style</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
</rules>
|
||||||
|
</arrangement>
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="11" />
|
<bytecodeTargetLevel target="17" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
10
.idea/deploymentTargetDropDown.xml
generated
Normal file
10
.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetDropDown">
|
||||||
|
<value>
|
||||||
|
<entry key="app">
|
||||||
|
<State />
|
||||||
|
</entry>
|
||||||
|
</value>
|
||||||
|
</component>
|
||||||
|
</project>
|
20
.idea/gradle.xml
generated
20
.idea/gradle.xml
generated
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="testRunner" value="GRADLE" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="gradleJvm" value="11" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
<option value="$PROJECT_DIR$/app" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
1
.idea/inspectionProfiles/Project_Default.xml
generated
1
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -7,5 +7,6 @@
|
|||||||
<option name="processLiterals" value="true" />
|
<option name="processLiterals" value="true" />
|
||||||
<option name="processComments" value="true" />
|
<option name="processComments" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
|
<inspection_tool class="YAMLSchemaValidation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="KotlinJpsPluginSettings">
|
<component name="KotlinJpsPluginSettings">
|
||||||
<option name="version" value="1.7.20" />
|
<option name="version" value="1.9.10" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
6
.idea/ktlint.xml
generated
Normal file
6
.idea/ktlint.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KtlintProjectConfiguration">
|
||||||
|
<treatAsErrors>false</treatAsErrors>
|
||||||
|
</component>
|
||||||
|
</project>
|
10
.idea/migrations.xml
generated
Normal file
10
.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectMigrations">
|
||||||
|
<option name="MigrateToGradleLocalJavaHome">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
24
.idea/misc.xml
generated
24
.idea/misc.xml
generated
@@ -1,24 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DesignSurface">
|
|
||||||
<option name="filePathToZoomLevelMap">
|
|
||||||
<map>
|
|
||||||
<entry key="app/src/main/res/drawable-v24/dark_round.xml" value="0.4482051282051282" />
|
|
||||||
<entry key="app/src/main/res/drawable/bg_orange_round.xml" value="0.229" />
|
|
||||||
<entry key="app/src/main/res/drawable/bg_permotion_round.xml" value="0.2495" />
|
|
||||||
<entry key="app/src/main/res/drawable/button_round.xml" value="0.44871794871794873" />
|
|
||||||
<entry key="app/src/main/res/drawable/dark_round.xml" value="0.4482051282051282" />
|
|
||||||
<entry key="app/src/main/res/drawable/permotion_round.xml" value="0.4482051282051282" />
|
|
||||||
<entry key="app/src/main/res/drawable/red_round.xml" value="0.4482051282051282" />
|
|
||||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3413246647704185" />
|
|
||||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.2495" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"keyAlias": "public",
|
|
||||||
"keyPassword": "123456",
|
|
||||||
"storeFileName": "universal.p12",
|
|
||||||
"storePassword": "123456"
|
|
||||||
}
|
|
67
README.md
67
README.md
@@ -1,42 +1,47 @@
|
|||||||
# TSBattery
|
# TSBattery
|
||||||
|
|
||||||
[](https://github.com/fankes/TSBattery)
|
[](https://github.com/fankes/TSBattery/blob/master/LICENSE)
|
||||||
[](https://github.com/fankes/TSBattery/blob/master/LICENSE)
|
[](https://github.com/fankes/TSBattery/actions/workflows/commit_ci.yml)
|
||||||
[](https://github.com/fankes/TSBattery/releases)
|
[](https://github.com/fankes/TSBattery/releases)
|
||||||
[](https://github.com/fankes/TSBattery/releases)
|

|
||||||
[](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)
|

|
||||||
[](https://t.me/XiaofangInternet)
|
|
||||||
<br/><br/>
|
[](https://t.me/TSBATTERY_CI)
|
||||||
<br/>
|
[](https://t.me/XiaofangInternet)
|
||||||
|
[](https://qm.qq.com/cgi-bin/qm/qr?k=dp2h5YhWiga9WWb_Oh7kSHmx01X8I8ii&jump_from=webapi&authKey=Za5CaFP0lk7+Zgsk2KpoBD7sSaYbeXbsDgFjiWelOeH4VSionpxFJ7V0qQBSqvFM)
|
||||||
|
[](https://pd.qq.com/s/44gcy28h)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
A new way to save your battery avoid cancer apps hacker it.
|
A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
|
||||||
TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed 模块。
|
TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed 模块。
|
||||||
|
|
||||||
## Developer
|
## For Non-Chinese Users
|
||||||
|
|
||||||
[酷安 @星夜不荟](http://www.coolapk.com/u/876977)
|
This Xposed Module is for use by specific apps for users in mainland China, you should not need it.
|
||||||
|
|
||||||
## 适配说明
|
## 适配说明
|
||||||
|
|
||||||
- 解锁 BL 并安装 **Magisk** 的设备建议使用 [LSPosed](https://github.com/LSPosed/LSPosed)
|
- 解锁 BootLoader 并安装 **KernelSU**、**Magisk** 的设备建议使用 [LSPosed](https://github.com/LSPosed/LSPosed)
|
||||||
|
|
||||||
- 可以使用 **~~EdXposed~~**,但随时停止支持
|
- **太极 (无极)** 支持性不是很好,建议使用 [LSPatch](https://github.com/LSPosed/LSPatch)
|
||||||
|
|
||||||
- **太极无极 · 阴** 支持性不是很好,建议使用 [LSPatch](https://github.com/LSPosed/LSPatch)
|
- 支持一些第三方 Xposed 框架,但是不保证其稳定性
|
||||||
|
|
||||||
- 支持一些第三方免 Root 框架例如**应用转生**、**SandVXposed**,但是不推荐使用,可能会造成封号风险
|
- 支持一些第三方免 Root 框架例如**应用转生**、**SandVXposed**,但是不推荐使用,可能会造成封号风险
|
||||||
|
|
||||||
- 如果在微信设置界面右上角你无法找到 **TSBattery** 的图标,请尝试同时激活 [WeXposed (微X模块)](https://github.com/Xposed-Modules-Repo/com.fkzhang.wechatxposed)
|
- 如果在微信设置界面右上角你无法找到 **TSBattery**
|
||||||
|
的图标,请尝试同时激活 [WeXposed (微X模块)](https://github.com/Xposed-Modules-Repo/com.fkzhang.wechatxposed)
|
||||||
## 请勿用于非法用途
|
|
||||||
|
|
||||||
本模块完全开源免费,如果好用你可以打赏支持开发,但是请不要用于非法用途。
|
|
||||||
|
|
||||||
## 发行渠道说明
|
## 发行渠道说明
|
||||||
|
|
||||||
- [Automatic Build on Commit](https://github.com/fankes/TSBattery/actions/workflows/commit_ci.yml)
|
- [Automatic Build on Commit](https://github.com/fankes/TSBattery/actions/workflows/commit_ci.yml)
|
||||||
|
|
||||||
上述更新为代码 `commit` 后自动触发,具体更新内容可点击上方的文字前往 **GitHub Actions** 进行查看,本更新由开源的流程自动编译发布,**不保证其稳定性**,所发布的版本**仅供测试**,且不会特殊说明甚至可能会变更版本号或保持与当前稳定版相同的版本号。
|
上述更新为代码 `commit` 后自动触发,具体更新内容可点击上方的文字前往 **GitHub Actions** 进行查看,本更新由开源的流程自动编译发布,
|
||||||
|
**不保证其稳定性**, 所发布的版本**仅供测试**,且不会特殊说明甚至可能会变更版本号或保持与当前稳定版相同的版本号。
|
||||||
|
|
||||||
|
如果你需要直接下载 CI 自动构建打包的安装包,请点击顶部的 `CI builds | Telegram` 标签加入 Telegram CI 自动构建频道。
|
||||||
|
|
||||||
- [Release](https://github.com/fankes/TSBattery/releases)
|
- [Release](https://github.com/fankes/TSBattery/releases)
|
||||||
- [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)
|
- [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)
|
||||||
@@ -46,25 +51,23 @@ TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed
|
|||||||
|
|
||||||
本模块发布地址仅限于上述所列出的地址,从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
|
本模块发布地址仅限于上述所列出的地址,从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
|
||||||
|
|
||||||
## 发行状态说明
|
## 请勿用于非法用途
|
||||||
|
|
||||||

|
本模块完全开源免费,如果好用你可以打赏支持开发,但是请不要用于非法用途。
|
||||||
|
|
||||||
上述状态为当前稳定版与自动构建版本一致或当前代码改动与稳定版无功能差异。
|
## 项目推广
|
||||||
|
|
||||||

|
如果你正在寻找一个可以自动管理 Gradle 项目依赖的 Gradle 插件,你可以了解一下 [SweetDependency](https://github.com/HighCapable/SweetDependency) 项目。
|
||||||
|
|
||||||
上述状态为存在自动构建版本和新功能的更新但当前并未发布稳定版,处于预发行状态。
|
如果你正在寻找一个可以自动生成属性键值的 Gradle 插件,你可以了解一下 [SweetProperty](https://github.com/HighCapable/SweetProperty) 项目。
|
||||||
|
|
||||||

|
本项目同样使用了 **SweetDependency** 和 **SweetProperty**。
|
||||||
|
|
||||||
上述状态为当前发行的稳定版可能存在严重问题但并未及时进行修复且并未发布稳定版。
|
## 捐赠支持
|
||||||
|
|
||||||
## 开始贡献
|
工作不易,无意外情况此项目将继续维护下去,提供更多可能,欢迎打赏。
|
||||||
|
|
||||||
欢迎为此项目进行新版本的适配代码贡献!<br/>
|
<img src="https://github.com/fankes/fankes/blob/main/img-src/payment_code.jpg?raw=true" width = "500" alt="Payment Code"/>
|
||||||
|
|
||||||
- [CONTRIBUTING](https://github.com/fankes/TSBattery/blob/master/CONTRIBUTING.md)
|
|
||||||
|
|
||||||
## Star History
|
## Star History
|
||||||
|
|
||||||
@@ -88,9 +91,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
```
|
```
|
||||||
|
|
||||||
Powered by [YukiHookAPI](https://github.com/fankes/YukiHookAPI)
|
Powered by [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI)
|
||||||
|
|
||||||
版权所有 © 2017-2023 Fankes Studio(qzmmcn@163.com)
|
版权所有 © 2017-2023 Fankes Studio(qzmmcn@163.com)
|
@@ -1,86 +0,0 @@
|
|||||||
import groovy.json.JsonSlurper
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id 'com.android.application'
|
|
||||||
id 'org.jetbrains.kotlin.android'
|
|
||||||
id 'com.google.devtools.ksp'
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
signingConfigs {
|
|
||||||
universal {
|
|
||||||
def dirPath = rootProject.ext.app.signingConfigs.secretConfigsDirPath
|
|
||||||
def fileName = rootProject.ext.app.signingConfigs.secretConfigsFileName
|
|
||||||
def configs = new JsonSlurper().parse(file("${dirPath}/${fileName}"))
|
|
||||||
keyAlias configs.keyAlias
|
|
||||||
keyPassword configs.keyPassword
|
|
||||||
storeFile file("${dirPath}/${configs.storeFileName}")
|
|
||||||
storePassword configs.storePassword
|
|
||||||
v1SigningEnabled true
|
|
||||||
v2SigningEnabled true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace 'com.fankes.tsbattery'
|
|
||||||
compileSdk rootProject.ext.android.compileSdk
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId 'com.fankes.tsbattery'
|
|
||||||
|
|
||||||
minSdk rootProject.ext.android.minSdk
|
|
||||||
targetSdk rootProject.ext.android.targetSdk
|
|
||||||
|
|
||||||
versionCode rootProject.ext.app.versionCode
|
|
||||||
versionName rootProject.ext.app.versionName
|
|
||||||
|
|
||||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
debug {
|
|
||||||
minifyEnabled false
|
|
||||||
signingConfig signingConfigs.universal
|
|
||||||
}
|
|
||||||
release {
|
|
||||||
minifyEnabled true
|
|
||||||
shrinkResources true
|
|
||||||
zipAlignEnabled true
|
|
||||||
signingConfig signingConfigs.universal
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
|
||||||
}
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = '11'
|
|
||||||
freeCompilerArgs = [
|
|
||||||
'-Xno-param-assertions',
|
|
||||||
'-Xno-call-assertions',
|
|
||||||
'-Xno-receiver-assertions'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
buildFeatures {
|
|
||||||
viewBinding true
|
|
||||||
}
|
|
||||||
lintOptions {
|
|
||||||
checkReleaseBuilds false
|
|
||||||
}
|
|
||||||
aaptOptions.additionalParameters '--allow-reserved-package-id', '--package-id', '0x37'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly 'de.robv.android.xposed:api:82'
|
|
||||||
implementation 'com.highcapable.yukihookapi:api:1.1.11'
|
|
||||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.1.11'
|
|
||||||
implementation 'com.github.duanhong169:drawabletoolbox:1.0.7'
|
|
||||||
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.7'
|
|
||||||
implementation 'androidx.core:core-ktx:1.10.1'
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
||||||
implementation 'com.google.android.material:material:1.9.0'
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
||||||
testImplementation 'junit:junit:4.13.2'
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
|
||||||
}
|
|
84
app/build.gradle.kts
Normal file
84
app/build.gradle.kts
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
plugins {
|
||||||
|
autowire(libs.plugins.android.application)
|
||||||
|
autowire(libs.plugins.kotlin.android)
|
||||||
|
autowire(libs.plugins.kotlin.ksp)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = property.project.app.packageName
|
||||||
|
compileSdk = property.project.android.compileSdk
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
create("universal") {
|
||||||
|
keyAlias = property.project.app.signing.keyAlias
|
||||||
|
keyPassword = property.project.app.signing.keyPassword
|
||||||
|
storeFile = rootProject.file(property.project.app.signing.storeFilePath)
|
||||||
|
storePassword = property.project.app.signing.storePassword
|
||||||
|
enableV1Signing = true
|
||||||
|
enableV2Signing = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = property.project.app.packageName
|
||||||
|
minSdk = property.project.android.minSdk
|
||||||
|
targetSdk = property.project.android.targetSdk
|
||||||
|
versionName = property.project.app.versionName
|
||||||
|
versionCode = property.project.app.versionCode
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
all { signingConfig = signingConfigs.getByName("universal") }
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = true
|
||||||
|
isShrinkResources = true
|
||||||
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "17"
|
||||||
|
freeCompilerArgs = listOf(
|
||||||
|
"-Xno-param-assertions",
|
||||||
|
"-Xno-call-assertions",
|
||||||
|
"-Xno-receiver-assertions"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig = true
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
|
lint { checkReleaseBuilds = false }
|
||||||
|
androidResources.additionalParameters += listOf("--allow-reserved-package-id", "--package-id", "0x37")
|
||||||
|
}
|
||||||
|
|
||||||
|
androidComponents {
|
||||||
|
onVariants(selector().all()) {
|
||||||
|
it.outputs.forEach { output ->
|
||||||
|
val currentType = it.buildType
|
||||||
|
val currentSuffix = property.github.ci.commit.id.let { suffix -> if (suffix.isNotBlank()) "-$suffix" else "" }
|
||||||
|
val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})"
|
||||||
|
if (output is com.android.build.api.variant.impl.VariantOutputImpl)
|
||||||
|
output.outputFileName.set("${property.project.name}-v$currentVersion-$currentType.apk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly(de.robv.android.xposed.api)
|
||||||
|
implementation(com.highcapable.yukihookapi.api)
|
||||||
|
ksp(com.highcapable.yukihookapi.ksp.xposed)
|
||||||
|
implementation(com.fankes.projectpromote.project.promote)
|
||||||
|
implementation(org.luckypray.dexkit)
|
||||||
|
implementation(com.github.duanhong169.drawabletoolbox)
|
||||||
|
implementation(com.squareup.okhttp3.okhttp)
|
||||||
|
implementation(androidx.core.core.ktx)
|
||||||
|
implementation(androidx.appcompat.appcompat)
|
||||||
|
implementation(com.google.android.material.material)
|
||||||
|
implementation(androidx.constraintlayout.constraintlayout)
|
||||||
|
testImplementation(junit.junit)
|
||||||
|
androidTestImplementation(androidx.test.ext.junit)
|
||||||
|
androidTestImplementation(androidx.test.espresso.espresso.core)
|
||||||
|
}
|
11
app/proguard-rules.pro
vendored
11
app/proguard-rules.pro
vendored
@@ -32,11 +32,16 @@
|
|||||||
-adaptresourcefilecontents
|
-adaptresourcefilecontents
|
||||||
|
|
||||||
-renamesourcefileattribute P
|
-renamesourcefileattribute P
|
||||||
-keepattributes SourceFile,LineNumberTable
|
-keepattributes SourceFile,Signature,LineNumberTable
|
||||||
|
|
||||||
# 排除注入的 Activity
|
# 排除注入的 Activity
|
||||||
-keep class com.fankes.tsbattery.ui.activity.parasitic.ConfigActivity
|
-keep class com.fankes.tsbattery.ui.activity.parasitic.ConfigActivity
|
||||||
|
|
||||||
|
# DexKit
|
||||||
|
-keep class org.luckypray.dexkit.DexKitBridge {
|
||||||
|
native <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
# 防止某些类被 R8 混淆 (可能是 BUG)
|
# 防止某些类被 R8 混淆 (可能是 BUG)
|
||||||
# FIXME: 已知问题字符串类名 (即使是常量) 也会被 R8 处理为混淆后的类名
|
# FIXME: 已知问题字符串类名 (即使是常量) 也会被 R8 处理为混淆后的类名
|
||||||
# FIXME: 所以目前只能把不允许 R8 处理的类 keep 掉,同时在当前模块中也不会被混淆就是了
|
# FIXME: 所以目前只能把不允许 R8 处理的类 keep 掉,同时在当前模块中也不会被混淆就是了
|
||||||
@@ -48,6 +53,8 @@
|
|||||||
public static *** throwUninitializedPropertyAccessException(...);
|
public static *** throwUninitializedPropertyAccessException(...);
|
||||||
}
|
}
|
||||||
|
|
||||||
-keepclassmembers class * implements androidx.viewbinding.ViewBinding {
|
-keep class * extends android.app.Activity
|
||||||
|
-keep class * implements androidx.viewbinding.ViewBinding {
|
||||||
|
<init>();
|
||||||
*** inflate(android.view.LayoutInflater);
|
*** inflate(android.view.LayoutInflater);
|
||||||
}
|
}
|
@@ -1,11 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
package="com.fankes.tsbattery">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
|
<uses-permission
|
||||||
|
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
|
||||||
|
tools:node="remove" />
|
||||||
|
<permission
|
||||||
|
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
|
||||||
|
tools:node="remove" />
|
||||||
|
|
||||||
<!-- 作用域 APP -->
|
<!-- 作用域 APP -->
|
||||||
<queries>
|
<queries>
|
||||||
<package android:name="com.tencent.mobileqq" />
|
<package android:name="com.tencent.mobileqq" />
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2021/11/9.
|
* This file is created by fankes on 2021/11/9.
|
||||||
*/
|
*/
|
||||||
package com.fankes.tsbattery.application
|
package com.fankes.tsbattery.application
|
||||||
|
|
||||||
|
@@ -17,10 +17,15 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/9/29.
|
* This file is created by fankes on 2022/9/29.
|
||||||
*/
|
*/
|
||||||
|
@file:Suppress("MemberVisibilityCanBePrivate")
|
||||||
|
|
||||||
package com.fankes.tsbattery.const
|
package com.fankes.tsbattery.const
|
||||||
|
|
||||||
|
import com.fankes.tsbattery.generated.AppProperties
|
||||||
|
import com.fankes.tsbattery.wrapper.BuildConfigWrapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 包名常量定义类
|
* 包名常量定义类
|
||||||
*/
|
*/
|
||||||
@@ -43,4 +48,27 @@ object JumpEvent {
|
|||||||
|
|
||||||
/** 启动模块设置 */
|
/** 启动模块设置 */
|
||||||
const val OPEN_MODULE_SETTING = "tsbattery_open_module_settings"
|
const val OPEN_MODULE_SETTING = "tsbattery_open_module_settings"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块版本常量定义类
|
||||||
|
*/
|
||||||
|
object ModuleVersion {
|
||||||
|
|
||||||
|
/** 当前 GitHub 提交的 ID (CI 自动构建) */
|
||||||
|
const val GITHUB_COMMIT_ID = AppProperties.GITHUB_CI_COMMIT_ID
|
||||||
|
|
||||||
|
/** 版本名称 */
|
||||||
|
const val NAME = BuildConfigWrapper.VERSION_NAME
|
||||||
|
|
||||||
|
/** 版本号 */
|
||||||
|
const val CODE = BuildConfigWrapper.VERSION_CODE
|
||||||
|
|
||||||
|
/** 是否为 CI 自动构建版本 */
|
||||||
|
val isCiMode = GITHUB_COMMIT_ID.isNotBlank()
|
||||||
|
|
||||||
|
/** 当前版本名称后缀 */
|
||||||
|
val suffix = GITHUB_COMMIT_ID.let { if (it.isNotBlank()) "-$it" else "" }
|
||||||
|
|
||||||
|
override fun toString() = "$NAME$suffix($CODE)"
|
||||||
}
|
}
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/9/28.
|
* This file is created by fankes on 2022/9/28.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("StaticFieldLeak")
|
@file:Suppress("StaticFieldLeak")
|
||||||
|
|
||||||
|
@@ -17,10 +17,8 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/2/15.
|
* This file is created by fankes on 2022/2/15.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("IMPLICIT_CAST_TO_ANY")
|
|
||||||
|
|
||||||
package com.fankes.tsbattery.hook
|
package com.fankes.tsbattery.hook
|
||||||
|
|
||||||
import com.fankes.tsbattery.const.PackageName
|
import com.fankes.tsbattery.const.PackageName
|
||||||
@@ -31,7 +29,7 @@ import com.highcapable.yukihookapi.hook.factory.configs
|
|||||||
import com.highcapable.yukihookapi.hook.factory.encase
|
import com.highcapable.yukihookapi.hook.factory.encase
|
||||||
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
|
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
|
||||||
|
|
||||||
@InjectYukiHookWithXposed(isUsingResourcesHook = false)
|
@InjectYukiHookWithXposed
|
||||||
object HookEntry : IYukiHookXposedInit {
|
object HookEntry : IYukiHookXposedInit {
|
||||||
|
|
||||||
/** 是否完全支持当前版本 */
|
/** 是否完全支持当前版本 */
|
||||||
|
@@ -17,8 +17,10 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/9/29.
|
* This file is created by fankes on 2022/9/29.
|
||||||
*/
|
*/
|
||||||
|
@file:Suppress("ConstPropertyName")
|
||||||
|
|
||||||
package com.fankes.tsbattery.hook.entity
|
package com.fankes.tsbattery.hook.entity
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
@@ -30,8 +32,8 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.app.ServiceCompat
|
import androidx.core.app.ServiceCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.fankes.tsbattery.BuildConfig
|
|
||||||
import com.fankes.tsbattery.R
|
import com.fankes.tsbattery.R
|
||||||
|
import com.fankes.tsbattery.const.ModuleVersion
|
||||||
import com.fankes.tsbattery.const.PackageName
|
import com.fankes.tsbattery.const.PackageName
|
||||||
import com.fankes.tsbattery.data.ConfigData
|
import com.fankes.tsbattery.data.ConfigData
|
||||||
import com.fankes.tsbattery.hook.HookEntry
|
import com.fankes.tsbattery.hook.HookEntry
|
||||||
@@ -39,17 +41,33 @@ import com.fankes.tsbattery.hook.factory.hookSystemWakeLock
|
|||||||
import com.fankes.tsbattery.hook.factory.isQQNightMode
|
import com.fankes.tsbattery.hook.factory.isQQNightMode
|
||||||
import com.fankes.tsbattery.hook.factory.jumpToModuleSettings
|
import com.fankes.tsbattery.hook.factory.jumpToModuleSettings
|
||||||
import com.fankes.tsbattery.hook.factory.startModuleSettings
|
import com.fankes.tsbattery.hook.factory.startModuleSettings
|
||||||
|
import com.fankes.tsbattery.hook.helper.DexKitHelper
|
||||||
import com.fankes.tsbattery.utils.factory.appVersionName
|
import com.fankes.tsbattery.utils.factory.appVersionName
|
||||||
import com.fankes.tsbattery.utils.factory.dp
|
import com.fankes.tsbattery.utils.factory.dp
|
||||||
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
||||||
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
||||||
import com.highcapable.yukihookapi.hook.factory.*
|
import com.highcapable.yukihookapi.hook.factory.buildOf
|
||||||
import com.highcapable.yukihookapi.hook.log.loggerD
|
import com.highcapable.yukihookapi.hook.factory.current
|
||||||
import com.highcapable.yukihookapi.hook.log.loggerE
|
import com.highcapable.yukihookapi.hook.factory.field
|
||||||
import com.highcapable.yukihookapi.hook.log.loggerI
|
import com.highcapable.yukihookapi.hook.factory.injectModuleAppResources
|
||||||
import com.highcapable.yukihookapi.hook.log.loggerW
|
import com.highcapable.yukihookapi.hook.factory.method
|
||||||
import com.highcapable.yukihookapi.hook.type.android.*
|
import com.highcapable.yukihookapi.hook.factory.registerModuleAppActivities
|
||||||
import com.highcapable.yukihookapi.hook.type.java.*
|
import com.highcapable.yukihookapi.hook.log.YLog
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.BuildClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.BundleClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.ContextClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.IntentClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.MessageClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.AnyArrayClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.AnyClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.BooleanType
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.CharSequenceClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.IntType
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.ListClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.LongType
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.StringClass
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.UnitType
|
||||||
|
import java.lang.reflect.Method
|
||||||
import java.lang.reflect.Proxy
|
import java.lang.reflect.Proxy
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,40 +76,58 @@ import java.lang.reflect.Proxy
|
|||||||
object QQTIMHooker : YukiBaseHooker() {
|
object QQTIMHooker : YukiBaseHooker() {
|
||||||
|
|
||||||
/** QQ、TIM 存在的类 */
|
/** QQ、TIM 存在的类 */
|
||||||
const val JumpActivityClass = "${PackageName.QQ}.activity.JumpActivity"
|
const val JumpActivityClassName = "${PackageName.QQ}.activity.JumpActivity"
|
||||||
|
|
||||||
|
/** QQ、TIM 存在的类 */
|
||||||
|
private val JumpActivityClass by lazyClassOrNull(JumpActivityClassName)
|
||||||
|
|
||||||
/** QQ、TIM 存在的类 (NT 版本不再存在) */
|
/** QQ、TIM 存在的类 (NT 版本不再存在) */
|
||||||
private const val QQSettingSettingActivityClass = "${PackageName.QQ}.activity.QQSettingSettingActivity"
|
private val QQSettingSettingActivityClass by lazyClassOrNull("${PackageName.QQ}.activity.QQSettingSettingActivity")
|
||||||
|
|
||||||
/** QQ 新版存在的类 (Pad 模式 - NT 版本不再存在) */
|
/** QQ 新版存在的类 (Pad 模式 - NT 版本不再存在) */
|
||||||
private const val QQSettingSettingFragmentClass = "${PackageName.QQ}.fragment.QQSettingSettingFragment"
|
private val QQSettingSettingFragmentClass by lazyClassOrNull("${PackageName.QQ}.fragment.QQSettingSettingFragment")
|
||||||
|
|
||||||
/** QQ、TIM 存在的类 (NT 版本不再存在) */
|
/** QQ、TIM 存在的类 (NT 版本不再存在) */
|
||||||
private const val AboutActivityClass = "${PackageName.QQ}.activity.AboutActivity"
|
private val AboutActivityClass by lazyClassOrNull("${PackageName.QQ}.activity.AboutActivity")
|
||||||
|
|
||||||
/** QQ 新版本存在的类 */
|
/** QQ 新版本存在的类 */
|
||||||
private const val GeneralSettingActivityClass = "${PackageName.QQ}.activity.GeneralSettingActivity"
|
private val GeneralSettingActivityClass by lazyClassOrNull("${PackageName.QQ}.activity.GeneralSettingActivity")
|
||||||
|
|
||||||
/** QQ 新版本 (NT) 存在的类 */
|
/** QQ 新版本 (NT) 存在的类 */
|
||||||
private const val MainSettingFragmentClass = "${PackageName.QQ}.setting.main.MainSettingFragment"
|
private val MainSettingFragmentClass by lazyClassOrNull("${PackageName.QQ}.setting.main.MainSettingFragment")
|
||||||
|
|
||||||
/** QQ 新版本 (NT) 存在的类 */
|
/** QQ 新版本 (NT) 存在的类 */
|
||||||
private const val MainSettingConfigProviderClass = "${PackageName.QQ}.setting.main.MainSettingConfigProvider"
|
private val MainSettingConfigProviderClass by lazyClassOrNull("${PackageName.QQ}.setting.main.MainSettingConfigProvider")
|
||||||
|
|
||||||
/** QQ、TIM 新版本存在的类 */
|
/** QQ、TIM 新版本存在的类 */
|
||||||
private const val FormSimpleItemClass = "${PackageName.QQ}.widget.FormSimpleItem"
|
private val FormSimpleItemClass by lazyClassOrNull("${PackageName.QQ}.widget.FormSimpleItem")
|
||||||
|
|
||||||
/** QQ、TIM 旧版本存在的类 */
|
/** QQ、TIM 旧版本存在的类 */
|
||||||
private const val FormCommonSingleLineItemClass = "${PackageName.QQ}.widget.FormCommonSingleLineItem"
|
private val FormCommonSingleLineItemClass by lazyClassOrNull("${PackageName.QQ}.widget.FormCommonSingleLineItem")
|
||||||
|
|
||||||
/** QQ、TIM 存在的类 */
|
/** QQ、TIM 存在的类 */
|
||||||
private const val CoreServiceClass = "${PackageName.QQ}.app.CoreService"
|
private val CoreServiceClass by lazyClassOrNull("${PackageName.QQ}.app.CoreService")
|
||||||
|
|
||||||
/** QQ、TIM 存在的类 */
|
/** QQ、TIM 存在的类 */
|
||||||
private const val CoreService_KernelServiceClass = "${PackageName.QQ}.app.CoreService\$KernelService"
|
private val CoreService_KernelServiceClass by lazyClassOrNull("${PackageName.QQ}.app.CoreService\$KernelService")
|
||||||
|
|
||||||
/** 根据多个版本存的不同的类 */
|
/** 根据多个版本存的不同的类 */
|
||||||
private val BaseChatPieClass = VariousClass("${PackageName.QQ}.activity.aio.core.BaseChatPie", "${PackageName.QQ}.activity.BaseChatPie")
|
private val BaseChatPieClass by lazyClassOrNull(
|
||||||
|
VariousClass(
|
||||||
|
"${PackageName.QQ}.activity.aio.core.BaseChatPie",
|
||||||
|
"${PackageName.QQ}.activity.BaseChatPie"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DexKit 搜索结果数据实现类
|
||||||
|
*/
|
||||||
|
private object DexKitData {
|
||||||
|
var BaseChatPie_RemainScreenOnMethod: Method? = null
|
||||||
|
var BaseChatPie_CancelRemainScreenOnMethod: Method? = null
|
||||||
|
var SimpleItemProcessorClass: Class<*>? = null
|
||||||
|
var SimpleItemProcessorClass_OnClickMethod: Method? = null
|
||||||
|
}
|
||||||
|
|
||||||
/** 一个内部进程的名称 (与 X5 浏览器内核有关) */
|
/** 一个内部进程的名称 (与 X5 浏览器内核有关) */
|
||||||
private val privilegedProcessName = "$packageName:privileged_process"
|
private val privilegedProcessName = "$packageName:privileged_process"
|
||||||
@@ -111,7 +147,7 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
* 在 QQ NT 中 [AboutActivityClass] 已被移除 - 以此作为判断条件
|
* 在 QQ NT 中 [AboutActivityClass] 已被移除 - 以此作为判断条件
|
||||||
* @return [Boolean]
|
* @return [Boolean]
|
||||||
*/
|
*/
|
||||||
private val isQQNTVersion get() = isQQ && AboutActivityClass.hasClass().not()
|
private val isQQNTVersion get() = isQQ && AboutActivityClass == null
|
||||||
|
|
||||||
/** 当前宿主的版本 */
|
/** 当前宿主的版本 */
|
||||||
private var hostVersionName = "<unknown>"
|
private var hostVersionName = "<unknown>"
|
||||||
@@ -122,6 +158,61 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
*/
|
*/
|
||||||
private fun Any.compatToActivity() = if (this is Activity) this else current().method { name = "getActivity"; superClass() }.invoke()
|
private fun Any.compatToActivity() = if (this is Activity) this else current().method { name = "getActivity"; superClass() }.invoke()
|
||||||
|
|
||||||
|
/** 使用 DexKit 进行搜索 */
|
||||||
|
private fun searchUsingDexKit() {
|
||||||
|
val classLoader = appClassLoader ?: return
|
||||||
|
DexKitHelper.create(this) {
|
||||||
|
BaseChatPieClass?.name?.also { baseChatPieClassName ->
|
||||||
|
DexKitData.BaseChatPie_RemainScreenOnMethod =
|
||||||
|
findMethod {
|
||||||
|
matcher {
|
||||||
|
declaredClass(baseChatPieClassName)
|
||||||
|
usingStrings("remainScreenOn")
|
||||||
|
paramCount = 0
|
||||||
|
returnType = UnitType.name
|
||||||
|
}
|
||||||
|
}.firstOrNull()?.getMethodInstance(classLoader)
|
||||||
|
DexKitData.BaseChatPie_CancelRemainScreenOnMethod =
|
||||||
|
findMethod {
|
||||||
|
matcher {
|
||||||
|
declaredClass(baseChatPieClassName)
|
||||||
|
usingStrings("cancelRemainScreenOn")
|
||||||
|
paramCount = 0
|
||||||
|
returnType = UnitType.name
|
||||||
|
}
|
||||||
|
}.firstOrNull()?.getMethodInstance(classLoader)
|
||||||
|
}
|
||||||
|
val kotlinFunction0 = "kotlin.jvm.functions.Function0"
|
||||||
|
findClass {
|
||||||
|
searchPackages("${PackageName.QQ}.setting.processor")
|
||||||
|
matcher {
|
||||||
|
methods {
|
||||||
|
add {
|
||||||
|
name = "<init>"
|
||||||
|
paramTypes(ContextClass.name, IntType.name, CharSequenceClass.name, IntType.name)
|
||||||
|
}
|
||||||
|
add {
|
||||||
|
paramTypes(kotlinFunction0)
|
||||||
|
returnType = UnitType.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fields { count(6..Int.MAX_VALUE) }
|
||||||
|
}
|
||||||
|
}.firstOrNull()?.name?.also { className ->
|
||||||
|
DexKitData.SimpleItemProcessorClass = className.toClass()
|
||||||
|
DexKitData.SimpleItemProcessorClass_OnClickMethod =
|
||||||
|
findMethod {
|
||||||
|
matcher {
|
||||||
|
declaredClass = className
|
||||||
|
paramTypes(kotlinFunction0)
|
||||||
|
returnType = UnitType.name
|
||||||
|
usingNumbers(2)
|
||||||
|
}
|
||||||
|
}.firstOrNull()?.getMethodInstance(classLoader)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 这个类 QQ 的 BaseChatPie 是控制聊天界面的
|
* 这个类 QQ 的 BaseChatPie 是控制聊天界面的
|
||||||
*
|
*
|
||||||
@@ -129,232 +220,63 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
*
|
*
|
||||||
* remainScreenOn、cancelRemainScreenOn
|
* remainScreenOn、cancelRemainScreenOn
|
||||||
*
|
*
|
||||||
* 这两个方法一个是挂起电源锁常驻亮屏
|
* 这两个方法一个是挂起电源锁常驻亮屏 - 一个是停止常驻亮屏
|
||||||
*
|
|
||||||
* 一个是停止常驻亮屏
|
|
||||||
*
|
|
||||||
* 不由分说每个版本混淆的方法名都会变
|
|
||||||
*
|
|
||||||
* 所以说每个版本重新适配 - 也可以提交分支帮我适配
|
|
||||||
*
|
|
||||||
* - ❗Hook 错了方法会造成闪退!
|
|
||||||
*/
|
*/
|
||||||
private fun hookQQBaseChatPie() {
|
private fun hookQQBaseChatPie() {
|
||||||
if (isQQ) when (hostVersionName) {
|
/**
|
||||||
"8.0.0" -> {
|
* 打印警告信息
|
||||||
hookBaseChatPie("bq")
|
* @param index 序号
|
||||||
hookBaseChatPie("aL")
|
*/
|
||||||
}
|
fun warn(index: Int) {
|
||||||
"8.0.5", "8.0.7" -> {
|
HookEntry.isHookClientSupport = false
|
||||||
hookBaseChatPie("bw")
|
YLog.warn("$hostVersionName [$index] not support!")
|
||||||
hookBaseChatPie("aQ")
|
|
||||||
}
|
|
||||||
"8.1.0", "8.1.3" -> {
|
|
||||||
hookBaseChatPie("bE")
|
|
||||||
hookBaseChatPie("aT")
|
|
||||||
}
|
|
||||||
"8.1.5" -> {
|
|
||||||
hookBaseChatPie("bF")
|
|
||||||
hookBaseChatPie("aT")
|
|
||||||
}
|
|
||||||
"8.1.8", "8.2.0", "8.2.6" -> {
|
|
||||||
hookBaseChatPie("bC")
|
|
||||||
hookBaseChatPie("aT")
|
|
||||||
}
|
|
||||||
"8.2.7", "8.2.8", "8.2.11", "8.3.0" -> {
|
|
||||||
hookBaseChatPie("bE")
|
|
||||||
hookBaseChatPie("aV")
|
|
||||||
}
|
|
||||||
"8.3.5" -> {
|
|
||||||
hookBaseChatPie("bR")
|
|
||||||
hookBaseChatPie("aX")
|
|
||||||
}
|
|
||||||
"8.3.6" -> {
|
|
||||||
hookBaseChatPie("cp")
|
|
||||||
hookBaseChatPie("aX")
|
|
||||||
}
|
|
||||||
"8.3.9" -> {
|
|
||||||
hookBaseChatPie("cj")
|
|
||||||
hookBaseChatPie("aT")
|
|
||||||
}
|
|
||||||
"8.4.1", "8.4.5" -> {
|
|
||||||
hookBaseChatPie("ck")
|
|
||||||
hookBaseChatPie("aT")
|
|
||||||
}
|
|
||||||
"8.4.8", "8.4.10", "8.4.17", "8.4.18", "8.5.0" -> {
|
|
||||||
hookBaseChatPie("remainScreenOn")
|
|
||||||
hookBaseChatPie("cancelRemainScreenOn")
|
|
||||||
}
|
|
||||||
"8.5.5" -> {
|
|
||||||
hookBaseChatPie("bT")
|
|
||||||
hookBaseChatPie("aN")
|
|
||||||
}
|
|
||||||
"8.6.0", "8.6.5", "8.7.0", "8.7.5", "8.7.8", "8.8.0", "8.8.3", "8.8.5" -> {
|
|
||||||
hookBaseChatPie("ag")
|
|
||||||
hookBaseChatPie("ah")
|
|
||||||
}
|
|
||||||
"8.8.11", "8.8.12" -> {
|
|
||||||
hookBaseChatPie("bc")
|
|
||||||
hookBaseChatPie("bd")
|
|
||||||
}
|
|
||||||
"8.8.17", "8.8.20" -> {
|
|
||||||
hookBaseChatPie("bd")
|
|
||||||
hookBaseChatPie("be")
|
|
||||||
}
|
|
||||||
"8.8.23", "8.8.28" -> {
|
|
||||||
hookBaseChatPie("bf")
|
|
||||||
hookBaseChatPie("bg")
|
|
||||||
}
|
|
||||||
"8.8.33" -> {
|
|
||||||
hookBaseChatPie("bg")
|
|
||||||
hookBaseChatPie("bh")
|
|
||||||
}
|
|
||||||
"8.8.35", "8.8.38" -> {
|
|
||||||
hookBaseChatPie("bi")
|
|
||||||
hookBaseChatPie("bj")
|
|
||||||
}
|
|
||||||
"8.8.50" -> {
|
|
||||||
hookBaseChatPie("bj")
|
|
||||||
hookBaseChatPie("bk")
|
|
||||||
}
|
|
||||||
"8.8.55", "8.8.68", "8.8.80" -> {
|
|
||||||
hookBaseChatPie("bk")
|
|
||||||
hookBaseChatPie("bl")
|
|
||||||
}
|
|
||||||
"8.8.83", "8.8.85", "8.8.88", "8.8.90" -> {
|
|
||||||
hookBaseChatPie("bl")
|
|
||||||
hookBaseChatPie("bm")
|
|
||||||
}
|
|
||||||
"8.8.93", "8.8.95" -> {
|
|
||||||
hookBaseChatPie("J3")
|
|
||||||
hookBaseChatPie("S")
|
|
||||||
}
|
|
||||||
"8.8.98" -> {
|
|
||||||
hookBaseChatPie("M3")
|
|
||||||
hookBaseChatPie("S")
|
|
||||||
}
|
|
||||||
"8.9.0", "8.9.1", "8.9.2" -> {
|
|
||||||
hookBaseChatPie("N3")
|
|
||||||
hookBaseChatPie("S")
|
|
||||||
}
|
|
||||||
"8.9.3", "8.9.5" -> {
|
|
||||||
hookBaseChatPie("H3")
|
|
||||||
hookBaseChatPie("P")
|
|
||||||
}
|
|
||||||
"8.9.8", "8.9.10" -> {
|
|
||||||
hookBaseChatPie("H3")
|
|
||||||
hookBaseChatPie("N")
|
|
||||||
}
|
|
||||||
"8.9.13" -> {
|
|
||||||
hookBaseChatPie("y3")
|
|
||||||
hookBaseChatPie("H")
|
|
||||||
}
|
|
||||||
"8.9.15", "8.9.18", "8.9.19", "8.9.20" -> {
|
|
||||||
hookBaseChatPie("w3")
|
|
||||||
hookBaseChatPie("H")
|
|
||||||
}
|
|
||||||
"8.9.23", "8.9.25" -> {
|
|
||||||
hookBaseChatPie("z3")
|
|
||||||
hookBaseChatPie("H")
|
|
||||||
}
|
|
||||||
"8.9.28", "8.9.30", "8.9.33" -> {
|
|
||||||
hookBaseChatPie("A3")
|
|
||||||
hookBaseChatPie("H")
|
|
||||||
}
|
|
||||||
"8.9.35", "8.9.38", "8.9.50" -> {
|
|
||||||
hookBaseChatPie("B3")
|
|
||||||
hookBaseChatPie("H")
|
|
||||||
}
|
|
||||||
"8.9.53", "8.9.55", "8.9.58" -> {
|
|
||||||
hookBaseChatPie("C3")
|
|
||||||
hookBaseChatPie("H")
|
|
||||||
}
|
|
||||||
"8.9.63", "8.9.68" -> {
|
|
||||||
hookBaseChatPie("t3")
|
|
||||||
hookBaseChatPie("J")
|
|
||||||
}
|
|
||||||
"8.9.70" -> {
|
|
||||||
hookBaseChatPie("u3")
|
|
||||||
hookBaseChatPie("J")
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
HookEntry.isHookClientSupport = false
|
|
||||||
loggerW(msg = "$hostVersionName not supported!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拦截 [BaseChatPieClass] 的目标方法体封装
|
|
||||||
* @param methodName 方法名
|
|
||||||
*/
|
|
||||||
private fun hookBaseChatPie(methodName: String) {
|
|
||||||
BaseChatPieClass.hook {
|
|
||||||
injectMember {
|
|
||||||
method {
|
|
||||||
name = methodName
|
|
||||||
emptyParam()
|
|
||||||
returnType = UnitType
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
DexKitData.BaseChatPie_RemainScreenOnMethod?.hook()?.intercept() ?: warn(index = 0)
|
||||||
|
DexKitData.BaseChatPie_CancelRemainScreenOnMethod?.hook()?.intercept() ?: warn(index = 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hook CoreService QQ、TIM */
|
/** Hook CoreService QQ、TIM */
|
||||||
private fun hookCoreService() {
|
private fun hookCoreService() {
|
||||||
CoreServiceClass.hook {
|
CoreServiceClass?.apply {
|
||||||
if (isQQ) {
|
if (isQQ) {
|
||||||
injectMember {
|
method {
|
||||||
method { name = "startTempService" }
|
name = "startTempService"
|
||||||
intercept()
|
}.ignored().hook().intercept()
|
||||||
}.ignoredNoSuchMemberFailure()
|
method {
|
||||||
injectMember {
|
name = "startCoreService"
|
||||||
method {
|
param(BooleanType)
|
||||||
name = "startCoreService"
|
}.ignored().hook().intercept()
|
||||||
param(BooleanType)
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}.ignoredNoSuchMemberFailure()
|
|
||||||
injectMember {
|
|
||||||
method {
|
|
||||||
name = "onStartCommand"
|
|
||||||
param(IntentClass, IntType, IntType)
|
|
||||||
}
|
|
||||||
replaceTo(any = 2)
|
|
||||||
}.ignoredNoSuchMemberFailure()
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method { name = "onCreate" }
|
|
||||||
afterHook {
|
|
||||||
if (ConfigData.isEnableKillQQTimCoreService)
|
|
||||||
instance<Service>().apply {
|
|
||||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
|
||||||
stopSelf()
|
|
||||||
loggerD(msg = "Shutdown CoreService OK!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CoreService_KernelServiceClass.hook {
|
|
||||||
injectMember {
|
|
||||||
method { name = "onCreate" }
|
|
||||||
afterHook {
|
|
||||||
if (ConfigData.isEnableKillQQTimCoreServiceChild)
|
|
||||||
instance<Service>().apply {
|
|
||||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
|
||||||
stopSelf()
|
|
||||||
loggerD(msg = "Shutdown CoreService\$KernelService OK!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method {
|
method {
|
||||||
name = "onStartCommand"
|
name = "onStartCommand"
|
||||||
param(IntentClass, IntType, IntType)
|
param(IntentClass, IntType, IntType)
|
||||||
}
|
}.ignored().hook().replaceTo(any = 2)
|
||||||
replaceTo(any = 2)
|
}
|
||||||
}.ignoredNoSuchMemberFailure()
|
method {
|
||||||
|
name = "onCreate"
|
||||||
|
}.ignored().hook().after {
|
||||||
|
if (ConfigData.isEnableKillQQTimCoreService)
|
||||||
|
instance<Service>().apply {
|
||||||
|
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
||||||
|
stopSelf()
|
||||||
|
YLog.debug("Shutdown CoreService OK!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CoreService_KernelServiceClass?.apply {
|
||||||
|
method {
|
||||||
|
name = "onCreate"
|
||||||
|
}.ignored().hook().after {
|
||||||
|
if (ConfigData.isEnableKillQQTimCoreServiceChild)
|
||||||
|
instance<Service>().apply {
|
||||||
|
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
||||||
|
stopSelf()
|
||||||
|
YLog.debug("Shutdown CoreService\$KernelService OK!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
method {
|
||||||
|
name = "onStartCommand"
|
||||||
|
param(IntentClass, IntType, IntType)
|
||||||
|
}.ignored().hook().replaceTo(any = 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,63 +288,53 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
* 每个版本的差异暂未做排查
|
* 每个版本的差异暂未做排查
|
||||||
* 旧版本理论上没有这个类
|
* 旧版本理论上没有这个类
|
||||||
*/
|
*/
|
||||||
findClass(name = "${PackageName.QQ}.msf.service.y").hook {
|
"${PackageName.QQ}.msf.service.y".toClassOrNull()
|
||||||
injectMember {
|
?.method {
|
||||||
method {
|
name = "a"
|
||||||
name = "a"
|
param(StringClass, LongType)
|
||||||
param(StringClass, LongType)
|
returnType = UnitType
|
||||||
returnType = UnitType
|
}?.ignored()?.hook()?.intercept()
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}.onAllFailure { loggerE(msg = "Hook MsfService Failed $it") }
|
|
||||||
}.ignoredHookClassNotFoundFailure()
|
|
||||||
/**
|
/**
|
||||||
* 干掉自动上传服务的电源锁
|
* 干掉自动上传服务的电源锁
|
||||||
* 每个版本的差异暂未做排查
|
* 每个版本的差异暂未做排查
|
||||||
*/
|
*/
|
||||||
findClass(name = "com.tencent.upload.impl.UploadServiceImpl").hook {
|
"com.tencent.upload.impl.UploadServiceImpl".toClassOrNull()
|
||||||
injectMember {
|
?.method {
|
||||||
method { name = "acquireWakeLockIfNot" }
|
name = "acquireWakeLockIfNot"
|
||||||
intercept()
|
}?.ignored()?.hook()?.intercept()
|
||||||
}.onAllFailure { loggerE(msg = "Hook UploadServiceImpl Failed $it") }
|
|
||||||
}.ignoredHookClassNotFoundFailure()
|
|
||||||
/**
|
/**
|
||||||
* Hook 掉一个一像素保活 [Activity] 真的我怎么都想不到讯哥的程序员做出这种事情
|
* Hook 掉一个一像素保活 Activity 真的我怎么都想不到讯哥的程序员做出这种事情
|
||||||
* 这个东西经过测试会在锁屏的时候吊起来,解锁的时候自动 finish(),无限耍流氓耗电
|
* 这个东西经过测试会在锁屏的时候吊起来,解锁的时候自动 finish(),无限耍流氓耗电
|
||||||
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口的解锁后拉起保活界面,也是毒瘤
|
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口的解锁后拉起保活界面,也是毒瘤
|
||||||
*/
|
*/
|
||||||
findClass(name = "${PackageName.QQ}.activity.QQLSUnlockActivity").hook {
|
"${PackageName.QQ}.activity.QQLSUnlockActivity".toClassOrNull()
|
||||||
injectMember {
|
?.method {
|
||||||
method {
|
name = "onCreate"
|
||||||
name = "onCreate"
|
param(BundleClass)
|
||||||
param(BundleClass)
|
}?.ignored()?.hook {
|
||||||
}
|
|
||||||
var origDevice = ""
|
var origDevice = ""
|
||||||
beforeHook {
|
before {
|
||||||
/** 由于在 onCreate 里有一行判断只要型号是 xiaomi 的设备就开电源锁,所以说这里临时替换成菊花厂 */
|
/** 由于在 onCreate 里有一行判断只要型号是 xiaomi 的设备就开电源锁,所以说这里临时替换成菊花厂 */
|
||||||
origDevice = Build.MANUFACTURER
|
origDevice = Build.MANUFACTURER
|
||||||
if (Build.MANUFACTURER.lowercase() == "xiaomi")
|
if (Build.MANUFACTURER.lowercase() == "xiaomi")
|
||||||
BuildClass.field { name = "MANUFACTURER" }.get().set("HUAWEI")
|
BuildClass.field { name = "MANUFACTURER" }.get().set("HUAWEI")
|
||||||
}
|
}
|
||||||
afterHook {
|
after {
|
||||||
instance<Activity>().finish()
|
instance<Activity>().finish()
|
||||||
/** 这里再把型号替换回去 - 不影响应用变量等 Xposed 模块修改的型号 */
|
/** 这里再把型号替换回去 - 不影响应用变量等 Xposed 模块修改的型号 */
|
||||||
BuildClass.field { name = "MANUFACTURER" }.get().set(origDevice)
|
BuildClass.field { name = "MANUFACTURER" }.get().set(origDevice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 这个东西同上
|
* 这个东西同上
|
||||||
* 反正也是一个一像素保活的 [Activity]
|
* 反正也是一个一像素保活的 Activity
|
||||||
* 讯哥的程序员真的有你的
|
* 讯哥的程序员真的有你的
|
||||||
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口
|
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口
|
||||||
*/
|
*/
|
||||||
findClass("${PackageName.QQ}.activity.QQLSActivity\$14", "ktq").hook {
|
VariousClass("${PackageName.QQ}.activity.QQLSActivity\$14", "ktq").toClassOrNull()
|
||||||
injectMember {
|
?.method {
|
||||||
method { name = "run" }
|
name = "run"
|
||||||
intercept()
|
}?.ignored()?.hook()?.intercept()
|
||||||
}.ignoredAllFailure()
|
|
||||||
}.ignoredHookClassNotFoundFailure()
|
|
||||||
/**
|
/**
|
||||||
* 这个是毒瘤核心类
|
* 这个是毒瘤核心类
|
||||||
* WakeLockMonitor
|
* WakeLockMonitor
|
||||||
@@ -433,155 +345,99 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
* 👮🏻 经过排查 Play 版本没这个类...... Emmmm 不想说啥了
|
* 👮🏻 经过排查 Play 版本没这个类...... Emmmm 不想说啥了
|
||||||
* ✅ 备注:8.9.x 版本已经基本移除了这个功能,没有再发现存在这个类
|
* ✅ 备注:8.9.x 版本已经基本移除了这个功能,没有再发现存在这个类
|
||||||
*/
|
*/
|
||||||
findClass(name = "com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor").hook {
|
"com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor".toClassOrNull()?.apply {
|
||||||
injectMember {
|
method {
|
||||||
method {
|
name = "onHook"
|
||||||
name = "onHook"
|
param(StringClass, AnyClass, AnyArrayClass, AnyClass)
|
||||||
param(StringClass, AnyClass, AnyArrayClass, AnyClass)
|
}.ignored().hook().intercept()
|
||||||
}
|
method {
|
||||||
intercept()
|
name = "doReport"
|
||||||
}
|
param("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity", IntType)
|
||||||
injectMember {
|
}.ignored().hook().intercept()
|
||||||
method {
|
method {
|
||||||
name = "doReport"
|
name = "afterHookedMethod"
|
||||||
param("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity", IntType)
|
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
intercept()
|
method {
|
||||||
}
|
name = "beforeHookedMethod"
|
||||||
injectMember {
|
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
||||||
method {
|
}.ignored().hook().intercept()
|
||||||
name = "afterHookedMethod"
|
method {
|
||||||
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
name = "onAppBackground"
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
intercept()
|
method {
|
||||||
}
|
name = "onOtherProcReport"
|
||||||
injectMember {
|
param(BundleClass)
|
||||||
method {
|
}.ignored().hook().intercept()
|
||||||
name = "beforeHookedMethod"
|
method {
|
||||||
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
name = "onProcessRun30Min"
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
intercept()
|
method {
|
||||||
}
|
name = "onProcessBG5Min"
|
||||||
injectMember {
|
}.ignored().hook().intercept()
|
||||||
method { name = "onAppBackground" }
|
method {
|
||||||
intercept()
|
name = "writeReport"
|
||||||
}
|
param(BooleanType)
|
||||||
injectMember {
|
}.ignored().hook().intercept()
|
||||||
method {
|
}
|
||||||
name = "onOtherProcReport"
|
|
||||||
param(BundleClass)
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method { name = "onProcessRun30Min" }
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method { name = "onProcessBG5Min" }
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method {
|
|
||||||
name = "writeReport"
|
|
||||||
param(BooleanType)
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
}.ignoredHookClassNotFoundFailure()
|
|
||||||
/**
|
/**
|
||||||
* 这个是毒瘤核心操作类
|
* 这个是毒瘤核心操作类
|
||||||
* 功能同上、全部拦截
|
* 功能同上、全部拦截
|
||||||
* 👮🏻 经过排查 Play 版本也没这个类...... Emmmm 不想说啥了
|
* 👮🏻 经过排查 Play 版本也没这个类...... Emmmm 不想说啥了
|
||||||
* ✅ 备注:8.9.x 版本已经基本移除了这个功能,没有再发现存在这个类
|
* ✅ 备注:8.9.x 版本已经基本移除了这个功能,没有再发现存在这个类
|
||||||
*/
|
*/
|
||||||
findClass(name = "com.tencent.qapmsdk.qqbattery.QQBatteryMonitor").hook {
|
"com.tencent.qapmsdk.qqbattery.QQBatteryMonitor".toClassOrNull()?.apply {
|
||||||
injectMember {
|
method {
|
||||||
method { name = "start" }
|
name = "start"
|
||||||
intercept()
|
}.ignored().hook().intercept()
|
||||||
}
|
method {
|
||||||
injectMember {
|
name = "stop"
|
||||||
method { name = "stop" }
|
}.ignored().hook().intercept()
|
||||||
intercept()
|
method {
|
||||||
}
|
name = "handleMessage"
|
||||||
injectMember {
|
param(MessageClass)
|
||||||
method {
|
}.ignored().hook().intercept()
|
||||||
name = "handleMessage"
|
method {
|
||||||
param(MessageClass)
|
name = "startMonitorInner"
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
replaceToTrue()
|
method {
|
||||||
}
|
name = "onAppBackground"
|
||||||
injectMember {
|
}.ignored().hook().intercept()
|
||||||
method { name = "startMonitorInner" }
|
method {
|
||||||
intercept()
|
name = "onAppForeground"
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
injectMember {
|
method {
|
||||||
method { name = "onAppBackground" }
|
name = "setLogWhite"
|
||||||
intercept()
|
paramCount = 2
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
injectMember {
|
method {
|
||||||
method { name = "onAppForeground" }
|
name = "setCmdWhite"
|
||||||
intercept()
|
paramCount = 2
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
injectMember {
|
method {
|
||||||
method {
|
name = "onWriteLog"
|
||||||
name = "setLogWhite"
|
param(StringClass, StringClass)
|
||||||
paramCount = 2
|
}.ignored().hook().intercept()
|
||||||
}
|
method {
|
||||||
intercept()
|
name = "onCmdRequest"
|
||||||
}
|
param(StringClass)
|
||||||
injectMember {
|
}.ignored().hook().intercept()
|
||||||
method {
|
method {
|
||||||
name = "setCmdWhite"
|
name = "addData"
|
||||||
paramCount = 2
|
paramCount = 4
|
||||||
}
|
}.ignored().hook().intercept()
|
||||||
intercept()
|
method {
|
||||||
}
|
name = "onGpsScan"
|
||||||
injectMember {
|
paramCount = 2
|
||||||
method {
|
}.ignored().hook().intercept()
|
||||||
name = "onWriteLog"
|
}
|
||||||
param(StringClass, StringClass)
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method {
|
|
||||||
name = "onCmdRequest"
|
|
||||||
param(StringClass)
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method {
|
|
||||||
name = "addData"
|
|
||||||
paramCount = 4
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
injectMember {
|
|
||||||
method {
|
|
||||||
name = "onGpsScan"
|
|
||||||
paramCount = 2
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
}.ignoredHookClassNotFoundFailure()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hook QQ 的设置界面添加模块设置入口 (新版) */
|
/** Hook QQ 的设置界面添加模块设置入口 (新版) */
|
||||||
private fun hookQQSettingsUi() {
|
private fun hookQQSettingsUi() {
|
||||||
if (MainSettingFragmentClass.hasClass().not()) return loggerE(msg = "Could not found main setting class, hook aborted")
|
if (MainSettingFragmentClass == null) return YLog.error("Could not found main setting class, hook aborted")
|
||||||
val kotlinUnit = "kotlin.Unit"
|
val kotlinUnit = "kotlin.Unit"
|
||||||
val kotlinFunction0 = "kotlin.jvm.functions.Function0"
|
val simpleItemProcessorClass = DexKitData.SimpleItemProcessorClass ?: return YLog.error("Could not found processor class, hook aborted")
|
||||||
val simpleItemProcessorClass = searchClass {
|
|
||||||
from("${PackageName.QQ}.setting.processor").absolute()
|
|
||||||
constructor { param(ContextClass, IntType, CharSequenceClass, IntType) }
|
|
||||||
method {
|
|
||||||
param(kotlinFunction0)
|
|
||||||
returnType = UnitType
|
|
||||||
}
|
|
||||||
field().count { it >= 6 }
|
|
||||||
}.get() ?: return loggerE(msg = "Could not found processor class, hook aborted")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建入口点条目
|
* 创建入口点条目
|
||||||
@@ -595,11 +451,7 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
return simpleItemProcessorClass.buildOf(context, R.id.tsbattery_qq_entry_item_id, "TSBattery", iconResId) {
|
return simpleItemProcessorClass.buildOf(context, R.id.tsbattery_qq_entry_item_id, "TSBattery", iconResId) {
|
||||||
param(ContextClass, IntType, CharSequenceClass, IntType)
|
param(ContextClass, IntType, CharSequenceClass, IntType)
|
||||||
}?.also { entryItem ->
|
}?.also { entryItem ->
|
||||||
val onClickMethod = simpleItemProcessorClass.method {
|
val onClickMethod = DexKitData.SimpleItemProcessorClass_OnClickMethod ?: error("Could not found processor method")
|
||||||
param { it[0].name == kotlinFunction0 }
|
|
||||||
paramCount = 1
|
|
||||||
returnType = UnitType
|
|
||||||
}.giveAll().lastOrNull() ?: error("Could not found processor method")
|
|
||||||
val proxyOnClick = Proxy.newProxyInstance(appClassLoader, arrayOf(onClickMethod.parameterTypes[0])) { any, method, args ->
|
val proxyOnClick = Proxy.newProxyInstance(appClassLoader, arrayOf(onClickMethod.parameterTypes[0])) { any, method, args ->
|
||||||
if (method.name == "invoke") {
|
if (method.name == "invoke") {
|
||||||
context.startModuleSettings()
|
context.startModuleSettings()
|
||||||
@@ -608,20 +460,15 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
}; onClickMethod.invoke(entryItem, proxyOnClick)
|
}; onClickMethod.invoke(entryItem, proxyOnClick)
|
||||||
} ?: error("Could not create TSBattery entry item")
|
} ?: error("Could not create TSBattery entry item")
|
||||||
}
|
}
|
||||||
MainSettingConfigProviderClass.hook {
|
MainSettingConfigProviderClass?.method {
|
||||||
injectMember {
|
param(ContextClass)
|
||||||
method {
|
returnType = ListClass
|
||||||
param(ContextClass)
|
}?.hook()?.after {
|
||||||
returnType = ListClass
|
val context = args().first().cast<Context>() ?: return@after
|
||||||
}
|
val processor = result<MutableList<Any?>>() ?: return@after
|
||||||
afterHook {
|
processor.add(1, processor[0]?.javaClass?.buildOf(arrayListOf<Any>().apply { add(createTSEntryItem(context)) }, "", "") {
|
||||||
val context = args().first().cast<Context>() ?: return@afterHook
|
param(ListClass, CharSequenceClass, CharSequenceClass)
|
||||||
val processor = result<MutableList<Any?>>() ?: return@afterHook
|
})
|
||||||
processor.add(1, processor[0]?.javaClass?.buildOf(arrayListOf<Any>().apply { add(createTSEntryItem(context)) }, "", "") {
|
|
||||||
param(ListClass, CharSequenceClass, CharSequenceClass)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,10 +479,10 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
private fun hookQQSettingsUiLegacy(instance: Any?) {
|
private fun hookQQSettingsUiLegacy(instance: Any?) {
|
||||||
/** 当前的顶级 Item 实例 */
|
/** 当前的顶级 Item 实例 */
|
||||||
val formItemRefRoot = instance?.current()?.field {
|
val formItemRefRoot = instance?.current()?.field {
|
||||||
type { it.name == FormSimpleItemClass || it.name == FormCommonSingleLineItemClass }.index(num = 1)
|
type { it == FormSimpleItemClass || it == FormCommonSingleLineItemClass }.index(num = 1)
|
||||||
}?.cast<View?>()
|
}?.cast<View?>()
|
||||||
/** 创建一个新的 Item */
|
/** 创建一个新的 Item */
|
||||||
FormSimpleItemClass.toClassOrNull()?.buildOf<View>(instance?.compatToActivity()) { param(ContextClass) }?.current {
|
FormSimpleItemClass?.buildOf<View>(instance?.compatToActivity()) { param(ContextClass) }?.current {
|
||||||
method {
|
method {
|
||||||
name = "setLeftText"
|
name = "setLeftText"
|
||||||
param(CharSequenceClass)
|
param(CharSequenceClass)
|
||||||
@@ -643,7 +490,7 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
method {
|
method {
|
||||||
name = "setRightText"
|
name = "setRightText"
|
||||||
param(CharSequenceClass)
|
param(CharSequenceClass)
|
||||||
}.call("${BuildConfig.VERSION_NAME}(${BuildConfig.VERSION_CODE})")
|
}.call(ModuleVersion.toString())
|
||||||
method {
|
method {
|
||||||
name = "setBgType"
|
name = "setBgType"
|
||||||
param(IntType)
|
param(IntType)
|
||||||
@@ -663,6 +510,7 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onHook() {
|
override fun onHook() {
|
||||||
|
searchUsingDexKit()
|
||||||
onAppLifecycle(isOnFailureThrowToApp = false) {
|
onAppLifecycle(isOnFailureThrowToApp = false) {
|
||||||
attachBaseContext { baseContext, hasCalledSuper ->
|
attachBaseContext { baseContext, hasCalledSuper ->
|
||||||
if (hasCalledSuper.not()) baseConfiguration = baseContext.resources.configuration
|
if (hasCalledSuper.not()) baseConfiguration = baseContext.resources.configuration
|
||||||
@@ -672,52 +520,38 @@ object QQTIMHooker : YukiBaseHooker() {
|
|||||||
/** 不注入此进程防止部分系统发生 X5 浏览器内核崩溃问题 */
|
/** 不注入此进程防止部分系统发生 X5 浏览器内核崩溃问题 */
|
||||||
if (processName.startsWith(privilegedProcessName)) return@onCreate
|
if (processName.startsWith(privilegedProcessName)) return@onCreate
|
||||||
ConfigData.init(context = this)
|
ConfigData.init(context = this)
|
||||||
if (isQQNTVersion)
|
registerModuleAppActivities(when {
|
||||||
registerModuleAppActivities(GeneralSettingActivityClass)
|
isQQNTVersion -> GeneralSettingActivityClass
|
||||||
else registerModuleAppActivities(AboutActivityClass)
|
else -> AboutActivityClass
|
||||||
|
})
|
||||||
if (ConfigData.isDisableAllHook) return@onCreate
|
if (ConfigData.isDisableAllHook) return@onCreate
|
||||||
hookSystemWakeLock()
|
hookSystemWakeLock()
|
||||||
hookQQBaseChatPie()
|
hookQQBaseChatPie()
|
||||||
hookCoreService()
|
hookCoreService()
|
||||||
hookQQDisgusting()
|
hookQQDisgusting()
|
||||||
loggerI(msg = "All processes are completed for \"${processName.takeIf { it != packageName } ?: packageName}\"")
|
YLog.info("All processes are completed for \"${processName.takeIf { it != packageName } ?: packageName}\"")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** 仅注入主进程 */
|
/** 仅注入主进程 */
|
||||||
withProcess(mainProcessName) {
|
withProcess(mainProcessName) {
|
||||||
/** Hook 跳转事件 */
|
/** Hook 跳转事件 */
|
||||||
JumpActivityClass.hook {
|
JumpActivityClass?.method {
|
||||||
injectMember {
|
name = "doOnCreate"
|
||||||
method {
|
param(BundleClass)
|
||||||
name = "doOnCreate"
|
}?.hook()?.after { instance<Activity>().jumpToModuleSettings() }
|
||||||
param(BundleClass)
|
|
||||||
}
|
|
||||||
afterHook { instance<Activity>().jumpToModuleSettings() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/** Hook 设置界面入口点 */
|
/** Hook 设置界面入口点 */
|
||||||
if (isQQNTVersion) hookQQSettingsUi()
|
if (isQQNTVersion) hookQQSettingsUi()
|
||||||
else {
|
else {
|
||||||
/** 将条目注入设置界面 (Activity) */
|
/** 将条目注入设置界面 (Activity) */
|
||||||
QQSettingSettingActivityClass.hook {
|
QQSettingSettingActivityClass?.method {
|
||||||
injectMember {
|
name = "doOnCreate"
|
||||||
method {
|
param(BundleClass)
|
||||||
name = "doOnCreate"
|
}?.hook()?.after { hookQQSettingsUiLegacy(instance) }
|
||||||
param(BundleClass)
|
|
||||||
}
|
|
||||||
afterHook { hookQQSettingsUiLegacy(instance) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/** 将条目注入设置界面 (Fragment) */
|
/** 将条目注入设置界面 (Fragment) */
|
||||||
QQSettingSettingFragmentClass.hook {
|
QQSettingSettingFragmentClass?.method {
|
||||||
injectMember {
|
name = "doOnCreateView"
|
||||||
method {
|
paramCount = 3
|
||||||
name = "doOnCreateView"
|
}?.hook()?.after { hookQQSettingsUiLegacy(instance) }
|
||||||
paramCount = 3
|
|
||||||
}
|
|
||||||
afterHook { hookQQSettingsUiLegacy(instance) }
|
|
||||||
}
|
|
||||||
}.ignoredHookClassNotFoundFailure()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,10 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/9/29.
|
* This file is created by fankes on 2022/9/29.
|
||||||
*/
|
*/
|
||||||
|
@file:Suppress("ConstPropertyName")
|
||||||
|
|
||||||
package com.fankes.tsbattery.hook.entity
|
package com.fankes.tsbattery.hook.entity
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
@@ -43,9 +45,10 @@ import com.fankes.tsbattery.utils.factory.dp
|
|||||||
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
|
||||||
import com.highcapable.yukihookapi.hook.factory.current
|
import com.highcapable.yukihookapi.hook.factory.current
|
||||||
import com.highcapable.yukihookapi.hook.factory.injectModuleAppResources
|
import com.highcapable.yukihookapi.hook.factory.injectModuleAppResources
|
||||||
|
import com.highcapable.yukihookapi.hook.factory.method
|
||||||
import com.highcapable.yukihookapi.hook.factory.processName
|
import com.highcapable.yukihookapi.hook.factory.processName
|
||||||
import com.highcapable.yukihookapi.hook.factory.registerModuleAppActivities
|
import com.highcapable.yukihookapi.hook.factory.registerModuleAppActivities
|
||||||
import com.highcapable.yukihookapi.hook.log.loggerI
|
import com.highcapable.yukihookapi.hook.log.YLog
|
||||||
import com.highcapable.yukihookapi.hook.type.android.ViewClass
|
import com.highcapable.yukihookapi.hook.type.android.ViewClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,16 +59,19 @@ import com.highcapable.yukihookapi.hook.type.android.ViewClass
|
|||||||
object WeChatHooker : YukiBaseHooker() {
|
object WeChatHooker : YukiBaseHooker() {
|
||||||
|
|
||||||
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
||||||
const val LauncherUIClass = "${PackageName.WECHAT}.ui.LauncherUI"
|
const val LauncherUIClassName = "${PackageName.WECHAT}.ui.LauncherUI"
|
||||||
|
|
||||||
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
||||||
private const val EmptyActivityClass = "${PackageName.WECHAT}.ui.EmptyActivity"
|
private val LauncherUIClass by lazyClassOrNull("${PackageName.WECHAT}.ui.LauncherUI")
|
||||||
|
|
||||||
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
||||||
private const val WelabMainUIClass = "${PackageName.WECHAT}.plugin.welab.ui.WelabMainUI"
|
private val EmptyActivityClass by lazyClassOrNull("${PackageName.WECHAT}.ui.EmptyActivity")
|
||||||
|
|
||||||
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
||||||
private const val SettingsUIClass = "${PackageName.WECHAT}.plugin.setting.ui.setting.SettingsUI"
|
private val WelabMainUIClass by lazyClassOrNull("${PackageName.WECHAT}.plugin.welab.ui.WelabMainUI")
|
||||||
|
|
||||||
|
/** 微信存在的类 - 未测试每个版本是否都存在 */
|
||||||
|
private val SettingsUIClass by lazyClassOrNull("${PackageName.WECHAT}.plugin.setting.ui.setting.SettingsUI")
|
||||||
|
|
||||||
/** TSBattery 图标 TAG 名称 */
|
/** TSBattery 图标 TAG 名称 */
|
||||||
private const val TSBARRERY_ICON_TAG = "tsbattery_icon"
|
private const val TSBARRERY_ICON_TAG = "tsbattery_icon"
|
||||||
@@ -95,54 +101,42 @@ object WeChatHooker : YukiBaseHooker() {
|
|||||||
onAppLifecycle {
|
onAppLifecycle {
|
||||||
onCreate {
|
onCreate {
|
||||||
ConfigData.init(context = this)
|
ConfigData.init(context = this)
|
||||||
registerModuleAppActivities(
|
registerModuleAppActivities(when {
|
||||||
when {
|
EmptyActivityClass != null -> EmptyActivityClass
|
||||||
EmptyActivityClass.hasClass() -> EmptyActivityClass
|
WelabMainUIClass != null -> WelabMainUIClass
|
||||||
WelabMainUIClass.hasClass() -> WelabMainUIClass
|
else -> error("Inject WeChat Activity Proxy failed, unsupport version $appVersionName($appVersionCode)")
|
||||||
else -> error("Inject WeChat Activity Proxy failed, unsupport version $appVersionName($appVersionCode)")
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
if (ConfigData.isDisableAllHook) return@onCreate
|
if (ConfigData.isDisableAllHook) return@onCreate
|
||||||
hookSystemWakeLock()
|
hookSystemWakeLock()
|
||||||
loggerI(msg = "All processes are completed for \"${processName.takeIf { it != packageName } ?: packageName}\"")
|
YLog.info("All processes are completed for \"${processName.takeIf { it != packageName } ?: packageName}\"")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** 仅注入主进程 */
|
/** 仅注入主进程 */
|
||||||
withProcess(mainProcessName) {
|
withProcess(mainProcessName) {
|
||||||
/** Hook 跳转事件 */
|
/** Hook 跳转事件 */
|
||||||
LauncherUIClass.hook {
|
LauncherUIClass?.method {
|
||||||
injectMember {
|
name = "onResume"
|
||||||
method {
|
emptyParam()
|
||||||
name = "onResume"
|
}?.hook()?.after { instance<Activity>().jumpToModuleSettings(isFinish = false) }
|
||||||
emptyParam()
|
|
||||||
}
|
|
||||||
afterHook { instance<Activity>().jumpToModuleSettings(isFinish = false) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/** 向设置界面右上角添加按钮 */
|
/** 向设置界面右上角添加按钮 */
|
||||||
SettingsUIClass.hook {
|
SettingsUIClass?.method {
|
||||||
injectMember {
|
name = "onResume"
|
||||||
method {
|
emptyParam()
|
||||||
name = "onResume"
|
}?.hook()?.after {
|
||||||
emptyParam()
|
SettingsUIClass?.method {
|
||||||
}
|
name = "get_fragment"
|
||||||
afterHook {
|
emptyParam()
|
||||||
method {
|
superClass(isOnlySuperClass = true)
|
||||||
name = "get_fragment"
|
}?.get(instance)?.call()?.current()?.method {
|
||||||
emptyParam()
|
name = "getView"
|
||||||
superClass(isOnlySuperClass = true)
|
emptyParam()
|
||||||
}.get(instance).call()?.current()?.method {
|
returnType = ViewClass
|
||||||
name = "getView"
|
superClass(isOnlySuperClass = true)
|
||||||
emptyParam()
|
}?.invoke<ViewGroup?>()?.also {
|
||||||
returnType = ViewClass
|
it.context?.injectModuleAppResources()
|
||||||
superClass(isOnlySuperClass = true)
|
runCatching { it.getChildAt(0) as? ViewGroup? }.getOrNull()?.also { rootView ->
|
||||||
}?.invoke<ViewGroup?>()?.also {
|
if (rootView.findViewWithTag<View>(TSBARRERY_ICON_TAG) == null)
|
||||||
it.context?.injectModuleAppResources()
|
rootView.addView(createPreferenceIcon(it.context))
|
||||||
runCatching { it.getChildAt(0) as? ViewGroup? }.getOrNull()?.also { rootView ->
|
|
||||||
if (rootView.findViewWithTag<View>(TSBARRERY_ICON_TAG) == null)
|
|
||||||
rootView.addView(createPreferenceIcon(it.context))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/9/29.
|
* This file is created by fankes on 2022/9/29.
|
||||||
*/
|
*/
|
||||||
package com.fankes.tsbattery.hook.factory
|
package com.fankes.tsbattery.hook.factory
|
||||||
|
|
||||||
@@ -81,13 +81,8 @@ fun Activity.jumpToModuleSettings(isFinish: Boolean = true) {
|
|||||||
|
|
||||||
/** Hook 系统电源锁 */
|
/** Hook 系统电源锁 */
|
||||||
fun PackageParam.hookSystemWakeLock() {
|
fun PackageParam.hookSystemWakeLock() {
|
||||||
PowerManager_WakeLockClass.hook {
|
PowerManager_WakeLockClass.method {
|
||||||
injectMember {
|
name = "acquireLocked"
|
||||||
method {
|
emptyParam()
|
||||||
name = "acquireLocked"
|
}.hook().intercept()
|
||||||
emptyParam()
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is created by fankes on 2023/10/8.
|
||||||
|
*/
|
||||||
|
@file:Suppress("MemberVisibilityCanBePrivate")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.hook.helper
|
||||||
|
|
||||||
|
import com.highcapable.yukihookapi.hook.log.YLog
|
||||||
|
import com.highcapable.yukihookapi.hook.param.PackageParam
|
||||||
|
import org.luckypray.dexkit.DexKitBridge
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DexKit 工具类
|
||||||
|
*/
|
||||||
|
object DexKitHelper {
|
||||||
|
|
||||||
|
/** 是否已装载 */
|
||||||
|
private var isLoaded = false
|
||||||
|
|
||||||
|
/** 装载 */
|
||||||
|
fun load() {
|
||||||
|
if (isLoaded) return
|
||||||
|
runCatching {
|
||||||
|
System.loadLibrary("dexkit")
|
||||||
|
isLoaded = true
|
||||||
|
}.onFailure { YLog.error("Load DexKit failed!", it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建 [DexKitBridge]
|
||||||
|
* @param param 当前实例
|
||||||
|
* @param initiate 方法体
|
||||||
|
*/
|
||||||
|
fun create(param: PackageParam, initiate: DexKitBridge.() -> Unit) {
|
||||||
|
load()
|
||||||
|
runCatching { DexKitBridge.create(param.appInfo.sourceDir)?.use { initiate(it) } }
|
||||||
|
}
|
||||||
|
}
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2021/9/4.
|
* This file is created by fankes on 2021/9/4.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("SetTextI18n", "LocalVariableName", "SameParameterValue")
|
@file:Suppress("SetTextI18n", "LocalVariableName", "SameParameterValue")
|
||||||
|
|
||||||
@@ -27,54 +27,37 @@ import android.content.ComponentName
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.HapticFeedbackConstants
|
import android.view.HapticFeedbackConstants
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.fankes.tsbattery.BuildConfig
|
import com.fankes.projectpromote.ProjectPromote
|
||||||
import com.fankes.tsbattery.R
|
import com.fankes.tsbattery.R
|
||||||
import com.fankes.tsbattery.const.JumpEvent
|
import com.fankes.tsbattery.const.JumpEvent
|
||||||
|
import com.fankes.tsbattery.const.ModuleVersion
|
||||||
import com.fankes.tsbattery.const.PackageName
|
import com.fankes.tsbattery.const.PackageName
|
||||||
import com.fankes.tsbattery.databinding.ActivityMainBinding
|
import com.fankes.tsbattery.databinding.ActivityMainBinding
|
||||||
import com.fankes.tsbattery.hook.entity.QQTIMHooker
|
import com.fankes.tsbattery.hook.entity.QQTIMHooker
|
||||||
import com.fankes.tsbattery.hook.entity.WeChatHooker
|
import com.fankes.tsbattery.hook.entity.WeChatHooker
|
||||||
import com.fankes.tsbattery.ui.activity.base.BaseActivity
|
import com.fankes.tsbattery.ui.activity.base.BaseActivity
|
||||||
import com.fankes.tsbattery.utils.factory.*
|
import com.fankes.tsbattery.utils.factory.appVersionBrandOf
|
||||||
|
import com.fankes.tsbattery.utils.factory.hideOrShowLauncherIcon
|
||||||
|
import com.fankes.tsbattery.utils.factory.isInstall
|
||||||
|
import com.fankes.tsbattery.utils.factory.isLauncherIconShowing
|
||||||
|
import com.fankes.tsbattery.utils.factory.openBrowser
|
||||||
|
import com.fankes.tsbattery.utils.factory.showDialog
|
||||||
|
import com.fankes.tsbattery.utils.factory.snake
|
||||||
import com.fankes.tsbattery.utils.tool.GithubReleaseTool
|
import com.fankes.tsbattery.utils.tool.GithubReleaseTool
|
||||||
import com.fankes.tsbattery.utils.tool.YukiPromoteTool
|
import com.fankes.tsbattery.wrapper.BuildConfigWrapper
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
|
|
||||||
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val QQ_SUPPORT_VERSION = "理论支持 8.0.0+ 及以上版本。"
|
||||||
private val qqSupportVersions = arrayOf(
|
private const val TIM_SUPPORT_VERSION = "2+、3+ (并未完全测试每个版本)。"
|
||||||
"8.0.0", "8.0.5", "8.0.7", "8.1.0", "8.1.3", "8.1.5", "8.1.8",
|
private const val WECHAT_SUPPORT_VERSION = "全版本仅支持基础省电,更多功能依然画饼。"
|
||||||
"8.2.0", "8.2.6", "8.2.7", "8.2.8", "8.2.11", "8.3.0", "8.3.5",
|
|
||||||
"8.3.6", "8.3.9", "8.4.1", "8.4.5", "8.4.8", "8.4.10", "8.4.17",
|
|
||||||
"8.4.18", "8.5.0", "8.5.5", "8.6.0", "8.6.5", "8.7.0", "8.7.5",
|
|
||||||
"8.7.8", "8.8.0", "8.8.3", "8.8.5", "8.8.11", "8.8.12", "8.8.17",
|
|
||||||
"8.8.20", "8.8.23", "8.8.28", "8.8.33", "8.8.35", "8.8.38", "8.8.50",
|
|
||||||
"8.8.55", "8.8.68", "8.8.80", "8.8.83", "8.8.85", "8.8.88", "8.8.90",
|
|
||||||
"8.8.93", "8.8.95", "8.8.98", "8.9.0", "8.9.1", "8.9.2", "8.9.3",
|
|
||||||
"8.9.5", "8.9.8", "8.9.10", "8.9.13", "8.9.15", "8.9.18", "8.9.19",
|
|
||||||
"8.9.20", "8.9.23", "8.9.25", "8.9.28", "8.9.30", "8.9.33",
|
|
||||||
"8.9.35", "8.9.38", "8.9.50", "8.9.53", "8.9.55", "8.9.58",
|
|
||||||
"8.9.63", "8.9.68", "8.9.70"
|
|
||||||
)
|
|
||||||
private val qqSupportVersion by lazy {
|
|
||||||
if (qqSupportVersions.isNotEmpty()) {
|
|
||||||
var value = ""
|
|
||||||
qqSupportVersions.forEach { value += "$it、" }
|
|
||||||
"${value.trim().let { it.substring(0, it.lastIndex) }}\n\n其余版本请自行测试是否有效。"
|
|
||||||
} else "empty"
|
|
||||||
}
|
|
||||||
private const val timSupportVersion = "2+、3+ (并未完全测试每个版本)。"
|
|
||||||
private const val wechatSupportVersion = "全版本仅支持基础省电,更多功能依然画饼。"
|
|
||||||
|
|
||||||
/** 预发布的版本标识 */
|
|
||||||
private const val pendingFlag = ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
/** 检查更新 */
|
/** 检查更新 */
|
||||||
GithubReleaseTool.checkingForUpdate(context = this, BuildConfig.VERSION_NAME) { version, function ->
|
GithubReleaseTool.checkingForUpdate(context = this, ModuleVersion.NAME) { version, function ->
|
||||||
binding.mainTextReleaseVersion.apply {
|
binding.mainTextReleaseVersion.apply {
|
||||||
text = "点击更新 $version"
|
text = "点击更新 $version"
|
||||||
isVisible = true
|
isVisible = true
|
||||||
@@ -89,7 +72,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
binding.mainTextApiWay.isVisible = true
|
binding.mainTextApiWay.isVisible = true
|
||||||
refreshActivateExecutor()
|
refreshActivateExecutor()
|
||||||
/** 推广、恰饭 */
|
/** 推广、恰饭 */
|
||||||
YukiPromoteTool.promote(context = this)
|
ProjectPromote.show(activity = this, ModuleVersion.toString())
|
||||||
} else
|
} else
|
||||||
showDialog {
|
showDialog {
|
||||||
title = "模块没有激活"
|
title = "模块没有激活"
|
||||||
@@ -102,11 +85,31 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
binding.mainTextTimVer.text = PackageName.TIM.takeIf { isInstall(it) }?.let { appVersionBrandOf(it) } ?: "未安装"
|
binding.mainTextTimVer.text = PackageName.TIM.takeIf { isInstall(it) }?.let { appVersionBrandOf(it) } ?: "未安装"
|
||||||
binding.mainTextWechatVer.text = PackageName.WECHAT.takeIf { isInstall(it) }?.let { appVersionBrandOf(it) } ?: "未安装"
|
binding.mainTextWechatVer.text = PackageName.WECHAT.takeIf { isInstall(it) }?.let { appVersionBrandOf(it) } ?: "未安装"
|
||||||
/** 设置文本 */
|
/** 设置文本 */
|
||||||
binding.mainTextVersion.text = "模块版本:${BuildConfig.VERSION_NAME} $pendingFlag"
|
binding.mainTextVersion.text = "模块版本:${ModuleVersion.NAME}"
|
||||||
|
/** 设置 CI 自动构建标识 */
|
||||||
|
if (ModuleVersion.isCiMode)
|
||||||
|
binding.mainTextReleaseVersion.apply {
|
||||||
|
text = "CI ${ModuleVersion.GITHUB_COMMIT_ID}"
|
||||||
|
isVisible = true
|
||||||
|
setOnClickListener {
|
||||||
|
showDialog {
|
||||||
|
title = "CI 自动构建说明"
|
||||||
|
msg = """
|
||||||
|
你正在使用的是 CI 自动构建版本,Commit ID 为 ${ModuleVersion.GITHUB_COMMIT_ID}。
|
||||||
|
|
||||||
|
它是由代码提交后自动触发并构建、自动编译发布的,并未经任何稳定性测试,使用风险自负。
|
||||||
|
|
||||||
|
CI 构建的版本不支持太极 (也请不要提交 CI 版本的适配,因为它们是不稳定的),你可以使用 LSPosed / LSPatch。
|
||||||
|
""".trimIndent()
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
binding.mainQqItem.setOnClickListener {
|
binding.mainQqItem.setOnClickListener {
|
||||||
showDialog {
|
showDialog {
|
||||||
title = "兼容的 QQ 版本"
|
title = "兼容的 QQ 版本"
|
||||||
msg = qqSupportVersion
|
msg = QQ_SUPPORT_VERSION
|
||||||
confirmButton(text = "我知道了")
|
confirmButton(text = "我知道了")
|
||||||
}
|
}
|
||||||
/** 振动提醒 */
|
/** 振动提醒 */
|
||||||
@@ -115,7 +118,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
binding.mainTimItem.setOnClickListener {
|
binding.mainTimItem.setOnClickListener {
|
||||||
showDialog {
|
showDialog {
|
||||||
title = "兼容的 TIM 版本"
|
title = "兼容的 TIM 版本"
|
||||||
msg = timSupportVersion
|
msg = TIM_SUPPORT_VERSION
|
||||||
confirmButton(text = "我知道了")
|
confirmButton(text = "我知道了")
|
||||||
}
|
}
|
||||||
/** 振动提醒 */
|
/** 振动提醒 */
|
||||||
@@ -124,7 +127,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
binding.mainWechatItem.setOnClickListener {
|
binding.mainWechatItem.setOnClickListener {
|
||||||
showDialog {
|
showDialog {
|
||||||
title = "兼容的微信版本"
|
title = "兼容的微信版本"
|
||||||
msg = wechatSupportVersion
|
msg = WECHAT_SUPPORT_VERSION
|
||||||
confirmButton(text = "我知道了")
|
confirmButton(text = "我知道了")
|
||||||
}
|
}
|
||||||
/** 振动提醒 */
|
/** 振动提醒 */
|
||||||
@@ -148,6 +151,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
hideOrShowLauncherIcon(b)
|
hideOrShowLauncherIcon(b)
|
||||||
}
|
}
|
||||||
|
/** 判断当前启动模式 */
|
||||||
|
if (packageName != BuildConfigWrapper.APPLICATION_ID) {
|
||||||
|
binding.quickActionItem.isVisible = false
|
||||||
|
binding.displaySettingItem.isVisible = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +167,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
startActivity(Intent().apply {
|
startActivity(Intent().apply {
|
||||||
component = ComponentName(
|
component = ComponentName(
|
||||||
packageName,
|
packageName,
|
||||||
if (packageName != PackageName.WECHAT) QQTIMHooker.JumpActivityClass else WeChatHooker.LauncherUIClass
|
if (packageName != PackageName.WECHAT) QQTIMHooker.JumpActivityClassName else WeChatHooker.LauncherUIClassName
|
||||||
)
|
)
|
||||||
putExtra(JumpEvent.OPEN_MODULE_SETTING, YukiHookAPI.Status.compiledTimestamp)
|
putExtra(JumpEvent.OPEN_MODULE_SETTING, YukiHookAPI.Status.compiledTimestamp)
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
@@ -17,10 +17,8 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/1/30.
|
* This file is created by fankes on 2022/1/30.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("UNCHECKED_CAST")
|
|
||||||
|
|
||||||
package com.fankes.tsbattery.ui.activity.base
|
package com.fankes.tsbattery.ui.activity.base
|
||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/9/28.
|
* This file is created by fankes on 2022/9/28.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("SetTextI18n", "DEPRECATION")
|
@file:Suppress("SetTextI18n", "DEPRECATION")
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@ import android.content.res.Resources
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.fankes.tsbattery.BuildConfig
|
import com.fankes.projectpromote.ProjectPromote
|
||||||
|
import com.fankes.tsbattery.const.ModuleVersion
|
||||||
import com.fankes.tsbattery.const.PackageName
|
import com.fankes.tsbattery.const.PackageName
|
||||||
import com.fankes.tsbattery.data.ConfigData
|
import com.fankes.tsbattery.data.ConfigData
|
||||||
import com.fankes.tsbattery.data.ConfigData.bind
|
import com.fankes.tsbattery.data.ConfigData.bind
|
||||||
@@ -38,8 +39,14 @@ import com.fankes.tsbattery.hook.HookEntry
|
|||||||
import com.fankes.tsbattery.hook.entity.QQTIMHooker
|
import com.fankes.tsbattery.hook.entity.QQTIMHooker
|
||||||
import com.fankes.tsbattery.ui.activity.MainActivity
|
import com.fankes.tsbattery.ui.activity.MainActivity
|
||||||
import com.fankes.tsbattery.ui.activity.base.BaseActivity
|
import com.fankes.tsbattery.ui.activity.base.BaseActivity
|
||||||
import com.fankes.tsbattery.utils.factory.*
|
import com.fankes.tsbattery.utils.factory.appIconOf
|
||||||
|
import com.fankes.tsbattery.utils.factory.appNameOf
|
||||||
|
import com.fankes.tsbattery.utils.factory.appVersionCode
|
||||||
|
import com.fankes.tsbattery.utils.factory.appVersionName
|
||||||
|
import com.fankes.tsbattery.utils.factory.showDialog
|
||||||
|
import com.fankes.tsbattery.utils.factory.snake
|
||||||
import com.fankes.tsbattery.utils.tool.GithubReleaseTool
|
import com.fankes.tsbattery.utils.tool.GithubReleaseTool
|
||||||
|
import com.fankes.tsbattery.wrapper.BuildConfigWrapper
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
@@ -47,7 +54,7 @@ class ConfigActivity : BaseActivity<ActivityConfigBinding>() {
|
|||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
/** 检查更新 */
|
/** 检查更新 */
|
||||||
GithubReleaseTool.checkingForUpdate(context = this, BuildConfig.VERSION_NAME) { version, function ->
|
GithubReleaseTool.checkingForUpdate(context = this, ModuleVersion.NAME) { version, function ->
|
||||||
binding.updateVersionText.apply {
|
binding.updateVersionText.apply {
|
||||||
text = "点击更新 $version"
|
text = "点击更新 $version"
|
||||||
isVisible = true
|
isVisible = true
|
||||||
@@ -58,14 +65,18 @@ class ConfigActivity : BaseActivity<ActivityConfigBinding>() {
|
|||||||
binding.titleModuleIcon.setOnClickListener {
|
binding.titleModuleIcon.setOnClickListener {
|
||||||
showDialog {
|
showDialog {
|
||||||
title = "打开模块主界面"
|
title = "打开模块主界面"
|
||||||
msg = "点击确定后将打开模块主界面,如果未安装模块本体将会无法打开。"
|
msg = "点击确定后将打开模块主界面,如果未安装模块本体将尝试打开寄生界面。"
|
||||||
confirmButton {
|
confirmButton {
|
||||||
runCatching {
|
runCatching {
|
||||||
startActivity(Intent().apply {
|
startActivity(Intent().apply {
|
||||||
component = ComponentName(BuildConfig.APPLICATION_ID, MainActivity::class.java.name)
|
component = ComponentName(BuildConfigWrapper.APPLICATION_ID, MainActivity::class.java.name)
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
})
|
})
|
||||||
}.onFailure { snake(msg = "打开失败,请确认你已安装模块 APP\n$it") }
|
}.onFailure {
|
||||||
|
runCatching {
|
||||||
|
startActivity(Intent(this@ConfigActivity, MainActivity::class.java))
|
||||||
|
}.onFailure { snake(msg = "打开失败,请确认你已安装模块 APP 或在模块更新后重启过$appName\n$it") }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cancelButton()
|
cancelButton()
|
||||||
}
|
}
|
||||||
@@ -73,8 +84,8 @@ class ConfigActivity : BaseActivity<ActivityConfigBinding>() {
|
|||||||
binding.titleNameText.text = "TSBattery 设置 (${appName.trim()})"
|
binding.titleNameText.text = "TSBattery 设置 (${appName.trim()})"
|
||||||
binding.appIcon.setImageDrawable(appIconOf())
|
binding.appIcon.setImageDrawable(appIconOf())
|
||||||
binding.appName.text = appName.trim()
|
binding.appName.text = appName.trim()
|
||||||
binding.appVersion.text = "${appVersionName}($appVersionCode)"
|
binding.appVersion.text = "$appVersionName($appVersionCode)"
|
||||||
binding.moduleVersion.text = "${BuildConfig.VERSION_NAME}(${BuildConfig.VERSION_CODE})"
|
binding.moduleVersion.text = ModuleVersion.toString()
|
||||||
binding.activeModeIcon.isVisible = HookEntry.isHookClientSupport
|
binding.activeModeIcon.isVisible = HookEntry.isHookClientSupport
|
||||||
binding.inactiveModeIcon.isGone = HookEntry.isHookClientSupport
|
binding.inactiveModeIcon.isGone = HookEntry.isHookClientSupport
|
||||||
binding.unsupportItem.isGone = HookEntry.isHookClientSupport
|
binding.unsupportItem.isGone = HookEntry.isHookClientSupport
|
||||||
@@ -116,6 +127,8 @@ class ConfigActivity : BaseActivity<ActivityConfigBinding>() {
|
|||||||
binding.qqTimProtectModeSwitch.bind(ConfigData.ENABLE_QQ_TIM_PROTECT_MODE) { refreshCurrentModeText(); showNeedRestartTip() }
|
binding.qqTimProtectModeSwitch.bind(ConfigData.ENABLE_QQ_TIM_PROTECT_MODE) { refreshCurrentModeText(); showNeedRestartTip() }
|
||||||
binding.qqTimCoreServiceSwitch.bind(ConfigData.ENABLE_KILL_QQ_TIM_CORESERVICE) { showNeedRestartTip() }
|
binding.qqTimCoreServiceSwitch.bind(ConfigData.ENABLE_KILL_QQ_TIM_CORESERVICE) { showNeedRestartTip() }
|
||||||
binding.qqTimCoreServiceChildSwitch.bind(ConfigData.ENABLE_KILLE_QQ_TIM_CORESERVICE_CHILD) { showNeedRestartTip() }
|
binding.qqTimCoreServiceChildSwitch.bind(ConfigData.ENABLE_KILLE_QQ_TIM_CORESERVICE_CHILD) { showNeedRestartTip() }
|
||||||
|
/** 推广、恰饭 */
|
||||||
|
ProjectPromote.show(activity = this, ModuleVersion.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 显示需要重新启动提示 */
|
/** 显示需要重新启动提示 */
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/1/8.
|
* This file is created by fankes on 2022/1/8.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("SameParameterValue")
|
@file:Suppress("SameParameterValue")
|
||||||
|
|
||||||
|
@@ -17,9 +17,9 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/1/7.
|
* This file is created by fankes on 2022/1/7.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("unused", "OPT_IN_USAGE", "EXPERIMENTAL_API_USAGE")
|
@file:Suppress("unused")
|
||||||
|
|
||||||
package com.fankes.tsbattery.utils.factory
|
package com.fankes.tsbattery.utils.factory
|
||||||
|
|
||||||
@@ -34,7 +34,6 @@ import androidx.appcompat.app.AlertDialog
|
|||||||
import com.fankes.tsbattery.R
|
import com.fankes.tsbattery.R
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.progressindicator.CircularProgressIndicator
|
import com.google.android.material.progressindicator.CircularProgressIndicator
|
||||||
import com.highcapable.yukihookapi.annotation.CauseProblemsApi
|
|
||||||
import com.highcapable.yukihookapi.hook.factory.applyModuleTheme
|
import com.highcapable.yukihookapi.hook.factory.applyModuleTheme
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,7 +133,6 @@ class DialogBuilder(val context: Context) {
|
|||||||
fun cancel() = dialogInstance?.cancel()
|
fun cancel() = dialogInstance?.cancel()
|
||||||
|
|
||||||
/** 显示对话框 */
|
/** 显示对话框 */
|
||||||
@CauseProblemsApi
|
|
||||||
fun show() = runInSafe {
|
fun show() = runInSafe {
|
||||||
instance?.create()?.apply {
|
instance?.create()?.apply {
|
||||||
customLayoutView?.let { setView(it) }
|
customLayoutView?.let { setView(it) }
|
||||||
|
@@ -17,13 +17,13 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/3/13.
|
* This file is created by fankes on 2022/3/13.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("unused")
|
@file:Suppress("unused", "UnusedReceiverParameter")
|
||||||
|
|
||||||
package com.fankes.tsbattery.utils.factory
|
package com.fankes.tsbattery.utils.factory
|
||||||
|
|
||||||
import com.highcapable.yukihookapi.hook.log.loggerE
|
import com.highcapable.yukihookapi.hook.log.YLog
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 忽略异常返回值
|
* 忽略异常返回值
|
||||||
@@ -78,5 +78,5 @@ inline fun <T> safeOf(default: T, result: () -> T) = try {
|
|||||||
* @param block 正常回调
|
* @param block 正常回调
|
||||||
*/
|
*/
|
||||||
inline fun <T> T.runInSafe(msg: String = "", block: () -> Unit) {
|
inline fun <T> T.runInSafe(msg: String = "", block: () -> Unit) {
|
||||||
runCatching(block).onFailure { if (msg.isNotBlank()) loggerE(msg = msg, e = it) }
|
runCatching(block).onFailure { if (msg.isNotBlank()) YLog.error(msg, it) }
|
||||||
}
|
}
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/1/7.
|
* This file is created by fankes on 2022/1/7.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("unused", "DiscouragedApi", "InternalInsetResource")
|
@file:Suppress("unused", "DiscouragedApi", "InternalInsetResource")
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ import android.provider.Settings
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
import androidx.core.content.pm.PackageInfoCompat
|
import androidx.core.content.pm.PackageInfoCompat
|
||||||
import com.fankes.tsbattery.BuildConfig
|
import com.fankes.tsbattery.wrapper.BuildConfigWrapper
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ inline val Context.isNotSystemInDarkMode get() = !isSystemInDarkMode
|
|||||||
* @return [PackageInfo] or null
|
* @return [PackageInfo] or null
|
||||||
*/
|
*/
|
||||||
private fun Context.getPackageInfoCompat(packageName: String, flag: Number = 0) = runCatching {
|
private fun Context.getPackageInfoCompat(packageName: String, flag: Number = 0) = runCatching {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION", "KotlinRedundantDiagnosticSuppress")
|
||||||
if (Build.VERSION.SDK_INT >= 33)
|
if (Build.VERSION.SDK_INT >= 33)
|
||||||
packageManager?.getPackageInfo(packageName, PackageInfoFlags.of(flag.toLong()))
|
packageManager?.getPackageInfo(packageName, PackageInfoFlags.of(flag.toLong()))
|
||||||
else packageManager?.getPackageInfo(packageName, flag.toInt())
|
else packageManager?.getPackageInfo(packageName, flag.toInt())
|
||||||
@@ -227,7 +227,7 @@ fun Context.openBrowser(url: String, packageName: String = "") = runCatching {
|
|||||||
*/
|
*/
|
||||||
fun Context.hideOrShowLauncherIcon(isShow: Boolean) {
|
fun Context.hideOrShowLauncherIcon(isShow: Boolean) {
|
||||||
packageManager?.setComponentEnabledSetting(
|
packageManager?.setComponentEnabledSetting(
|
||||||
ComponentName(packageName, "${BuildConfig.APPLICATION_ID}.Home"),
|
ComponentName(packageName, "${BuildConfigWrapper.APPLICATION_ID}.Home"),
|
||||||
if (isShow) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
if (isShow) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||||
PackageManager.DONT_KILL_APP
|
PackageManager.DONT_KILL_APP
|
||||||
)
|
)
|
||||||
@@ -239,5 +239,5 @@ fun Context.hideOrShowLauncherIcon(isShow: Boolean) {
|
|||||||
*/
|
*/
|
||||||
val Context.isLauncherIconShowing
|
val Context.isLauncherIconShowing
|
||||||
get() = packageManager?.getComponentEnabledSetting(
|
get() = packageManager?.getComponentEnabledSetting(
|
||||||
ComponentName(packageName, "${BuildConfig.APPLICATION_ID}.Home")
|
ComponentName(packageName, "${BuildConfigWrapper.APPLICATION_ID}.Home")
|
||||||
) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
@@ -17,7 +17,7 @@
|
|||||||
* and eula along with this software. If not, see
|
* and eula along with this software. If not, see
|
||||||
* <https://www.gnu.org/licenses/>
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2022/3/20.
|
* This file is created by fankes on 2022/3/20.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("NewApi")
|
@file:Suppress("NewApi")
|
||||||
|
|
||||||
@@ -28,12 +28,20 @@ import android.content.Context
|
|||||||
import android.icu.text.SimpleDateFormat
|
import android.icu.text.SimpleDateFormat
|
||||||
import android.icu.util.Calendar
|
import android.icu.util.Calendar
|
||||||
import android.icu.util.TimeZone
|
import android.icu.util.TimeZone
|
||||||
import com.fankes.tsbattery.utils.factory.*
|
import com.fankes.tsbattery.utils.factory.isNetWorkSuccess
|
||||||
import okhttp3.*
|
import com.fankes.tsbattery.utils.factory.openBrowser
|
||||||
|
import com.fankes.tsbattery.utils.factory.openSelfSetting
|
||||||
|
import com.fankes.tsbattery.utils.factory.runInSafe
|
||||||
|
import com.fankes.tsbattery.utils.factory.showDialog
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.Callback
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.util.*
|
import java.util.Locale
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 GitHub Release 最新版本工具类
|
* 获取 GitHub Release 最新版本工具类
|
||||||
@@ -60,7 +68,6 @@ object GithubReleaseTool {
|
|||||||
.build()
|
.build()
|
||||||
).enqueue(object : Callback {
|
).enqueue(object : Callback {
|
||||||
override fun onFailure(call: Call, e: IOException) {}
|
override fun onFailure(call: Call, e: IOException) {}
|
||||||
|
|
||||||
override fun onResponse(call: Call, response: Response) = runInSafe {
|
override fun onResponse(call: Call, response: Response) = runInSafe {
|
||||||
JSONObject(response.body.string()).apply {
|
JSONObject(response.body.string()).apply {
|
||||||
GithubReleaseBean(
|
GithubReleaseBean(
|
||||||
@@ -72,7 +79,7 @@ object GithubReleaseTool {
|
|||||||
fun showUpdate() = context.showDialog {
|
fun showUpdate() = context.showDialog {
|
||||||
title = "最新版本 $name"
|
title = "最新版本 $name"
|
||||||
msg = "发布于 $date\n\n" +
|
msg = "发布于 $date\n\n" +
|
||||||
"更新日志\n\n" + content
|
"更新日志\n\n" + content
|
||||||
confirmButton(text = "更新") { context.openBrowser(htmlUrl) }
|
confirmButton(text = "更新") { context.openBrowser(htmlUrl) }
|
||||||
cancelButton()
|
cancelButton()
|
||||||
}
|
}
|
||||||
|
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
|
||||||
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
|
|
||||||
* https://github.com/fankes/TSBattery
|
|
||||||
*
|
|
||||||
* This software is non-free but opensource software: you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Affero General Public License
|
|
||||||
* as published by the Free Software Foundation; either
|
|
||||||
* version 3 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* and eula along with this software. If not, see
|
|
||||||
* <https://www.gnu.org/licenses/>
|
|
||||||
*
|
|
||||||
* This file is Created by fankes on 2022/5/30.
|
|
||||||
*/
|
|
||||||
package com.fankes.tsbattery.utils.tool
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import com.fankes.tsbattery.BuildConfig
|
|
||||||
import com.fankes.tsbattery.utils.factory.openBrowser
|
|
||||||
import com.fankes.tsbattery.utils.factory.showDialog
|
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
|
||||||
import com.highcapable.yukihookapi.hook.factory.prefs
|
|
||||||
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [YukiHookAPI] 的自动推广工具类
|
|
||||||
*/
|
|
||||||
object YukiPromoteTool {
|
|
||||||
|
|
||||||
/** 推广已读存储键值 */
|
|
||||||
private val YUKI_PROMOTE_READED = PrefsData("yuki_promote_readed_${BuildConfig.VERSION_NAME}", false)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示推广对话框
|
|
||||||
* @param context 实例
|
|
||||||
*/
|
|
||||||
fun promote(context: Context) {
|
|
||||||
fun saveReaded() = context.prefs().edit { put(YUKI_PROMOTE_READED, value = true) }
|
|
||||||
if (context.prefs().get(YUKI_PROMOTE_READED).not())
|
|
||||||
context.showDialog {
|
|
||||||
title = "面向开发者的推广"
|
|
||||||
msg = "你想快速拥有一个自己的 Xposed 模块吗,你只需要拥有基础的 Android 开发经验以及使用 Kotlin 编程语言即可。\n\n" +
|
|
||||||
"快来体验 YukiHookAPI,这是一个使用 Kotlin 构建的高效 Hook API 与 Xposed 模块解决方案,助你的开发变得更轻松。"
|
|
||||||
confirmButton(text = "去看看") {
|
|
||||||
context.openBrowser(url = "https://github.com/fankes/YukiHookAPI")
|
|
||||||
saveReaded()
|
|
||||||
}
|
|
||||||
cancelButton(text = "我不是开发者") { saveReaded() }
|
|
||||||
noCancelable()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is created by fankes on 2023/9/16.
|
||||||
|
*/
|
||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.wrapper
|
||||||
|
|
||||||
|
import com.fankes.tsbattery.BuildConfig
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对 [BuildConfig] 的包装
|
||||||
|
*/
|
||||||
|
object BuildConfigWrapper {
|
||||||
|
const val APPLICATION_ID = BuildConfig.APPLICATION_ID
|
||||||
|
const val VERSION_NAME = BuildConfig.VERSION_NAME
|
||||||
|
const val VERSION_CODE = BuildConfig.VERSION_CODE
|
||||||
|
val isDebug = BuildConfig.DEBUG
|
||||||
|
}
|
@@ -265,6 +265,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/quick_action_item"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
@@ -356,6 +357,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/display_setting_item"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
@@ -590,7 +592,8 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@mipmap/bg_qr_pay" />
|
android:adjustViewBounds="true"
|
||||||
|
android:src="@mipmap/bg_payment_code" />
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -628,7 +631,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="6dp"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:text="此模块使用 YukiHookAPI 构建。\n了解更多 https://github.com/fankes/YukiHookAPI"
|
android:text="此模块使用 YukiHookAPI 构建。\n了解更多 https://github.com/HighCapable/YukiHookAPI"
|
||||||
android:textColor="@color/colorTextGray"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="11sp" />
|
android:textSize="11sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
BIN
app/src/main/res/mipmap-xxhdpi/bg_payment_code.jpg
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/bg_payment_code.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 KiB |
Binary file not shown.
Before Width: | Height: | Size: 201 KiB |
26
build.gradle
26
build.gradle
@@ -1,26 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.android.application' version '7.4.1' apply false
|
|
||||||
id 'com.android.library' version '7.4.1' apply false
|
|
||||||
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
|
|
||||||
id 'com.google.devtools.ksp' version '1.8.20-1.0.10' apply false
|
|
||||||
}
|
|
||||||
|
|
||||||
ext {
|
|
||||||
android = [
|
|
||||||
compileSdk: 33,
|
|
||||||
minSdk : 21,
|
|
||||||
targetSdk : 33
|
|
||||||
]
|
|
||||||
app = [
|
|
||||||
versionName : '4.3',
|
|
||||||
versionCode : 29,
|
|
||||||
signingConfigs: [
|
|
||||||
secretConfigsDirPath : "${projectDir.getAbsolutePath()}/.secret",
|
|
||||||
secretConfigsFileName: "key_store_secret.json"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
task clean(type: Delete) {
|
|
||||||
delete rootProject.buildDir
|
|
||||||
}
|
|
5
build.gradle.kts
Normal file
5
build.gradle.kts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
plugins {
|
||||||
|
autowire(libs.plugins.android.application) apply false
|
||||||
|
autowire(libs.plugins.kotlin.android) apply false
|
||||||
|
autowire(libs.plugins.kotlin.ksp) apply false
|
||||||
|
}
|
@@ -1,23 +1,18 @@
|
|||||||
# Project-wide Gradle settings.
|
# Compiler Configuration
|
||||||
# IDE (e.g. Android Studio) users:
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
# Gradle settings configured through the IDE *will override*
|
|
||||||
# any settings specified in this file.
|
|
||||||
# For more details on how to configure your build environment visit
|
|
||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
|
||||||
org.gradle.jvmargs=-XX:+UseParallelGC
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
||||||
# org.gradle.parallel=true
|
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
|
||||||
# Android operating system, and which are packaged with your app"s APK
|
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
android.nonTransitiveRClass=true
|
||||||
android.enableJetifier=true
|
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
# Incremental
|
kotlin.incremental.useClasspathSnapshot=true
|
||||||
kotlin.incremental.useClasspathSnapshot=true
|
# Project Configuration
|
||||||
|
project.name=TSBattery
|
||||||
|
project.android.compileSdk=34
|
||||||
|
project.android.minSdk=24
|
||||||
|
project.android.targetSdk=34
|
||||||
|
project.app.packageName=com.fankes.tsbattery
|
||||||
|
project.app.versionName="4.4"
|
||||||
|
project.app.versionCode=30
|
||||||
|
project.app.signing.keyAlias=public
|
||||||
|
project.app.signing.keyPassword="123456"
|
||||||
|
project.app.signing.storePassword="123456"
|
||||||
|
project.app.signing.storeFilePath=.secret/universal.p12
|
78
gradle/sweet-dependency/sweet-dependency-config.yaml
Normal file
78
gradle/sweet-dependency/sweet-dependency-config.yaml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
preferences:
|
||||||
|
autowire-on-sync-mode: UPDATE_OPTIONAL_DEPENDENCIES
|
||||||
|
repositories-mode: FAIL_ON_PROJECT_REPOS
|
||||||
|
|
||||||
|
repositories:
|
||||||
|
gradle-plugin-portal:
|
||||||
|
scope: PLUGINS
|
||||||
|
google:
|
||||||
|
maven-central:
|
||||||
|
jit-pack:
|
||||||
|
sonatype-oss-releases:
|
||||||
|
rovo89-xposed-api:
|
||||||
|
scope: LIBRARIES
|
||||||
|
url: https://api.xposed.info/
|
||||||
|
content:
|
||||||
|
include:
|
||||||
|
group:
|
||||||
|
de.robv.android.xposed
|
||||||
|
fankes-maven-releases:
|
||||||
|
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
com.android.application:
|
||||||
|
alias: android-application
|
||||||
|
version: 8.1.2
|
||||||
|
org.jetbrains.kotlin.android:
|
||||||
|
alias: kotlin-android
|
||||||
|
version: 1.9.10
|
||||||
|
com.google.devtools.ksp:
|
||||||
|
alias: kotlin-ksp
|
||||||
|
version: 1.9.10-1.0.13
|
||||||
|
|
||||||
|
libraries:
|
||||||
|
com.fankes.projectpromote:
|
||||||
|
project-promote:
|
||||||
|
version: 1.0.0
|
||||||
|
repositories:
|
||||||
|
fankes-maven-releases
|
||||||
|
de.robv.android.xposed:
|
||||||
|
api:
|
||||||
|
version: 82
|
||||||
|
repositories:
|
||||||
|
rovo89-xposed-api
|
||||||
|
com.highcapable.yukihookapi:
|
||||||
|
api:
|
||||||
|
version: 1.2.0
|
||||||
|
ksp-xposed:
|
||||||
|
version-ref: <this>::api
|
||||||
|
org.luckypray:
|
||||||
|
dexkit:
|
||||||
|
version: 2.0.0-rc7
|
||||||
|
com.github.duanhong169:
|
||||||
|
drawabletoolbox:
|
||||||
|
version: 1.0.7
|
||||||
|
com.squareup.okhttp3:
|
||||||
|
okhttp:
|
||||||
|
version: 5.0.0-alpha.11
|
||||||
|
androidx.core:
|
||||||
|
core-ktx:
|
||||||
|
version: 1.12.0
|
||||||
|
androidx.appcompat:
|
||||||
|
appcompat:
|
||||||
|
version: 1.6.1
|
||||||
|
com.google.android.material:
|
||||||
|
material:
|
||||||
|
version: 1.10.0
|
||||||
|
androidx.constraintlayout:
|
||||||
|
constraintlayout:
|
||||||
|
version: 2.1.4
|
||||||
|
androidx.test.ext:
|
||||||
|
junit:
|
||||||
|
version: 1.1.5
|
||||||
|
androidx.test.espresso:
|
||||||
|
espresso-core:
|
||||||
|
version: 3.5.1
|
||||||
|
junit:
|
||||||
|
junit:
|
||||||
|
version: 4.13.2
|
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
|||||||
#Wed May 25 04:34:58 CST 2022
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
@@ -1,19 +0,0 @@
|
|||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
gradlePluginPortal()
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencyResolutionManagement {
|
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
maven { url "https://api.xposed.info/" }
|
|
||||||
maven { url "https://www.jitpack.io" }
|
|
||||||
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rootProject.name = "TSBattery"
|
|
||||||
include ':app'
|
|
23
settings.gradle.kts
Normal file
23
settings.gradle.kts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plugins {
|
||||||
|
id("com.highcapable.sweetdependency") version "1.0.2"
|
||||||
|
id("com.highcapable.sweetproperty") version "1.0.3"
|
||||||
|
}
|
||||||
|
sweetProperty {
|
||||||
|
global {
|
||||||
|
all {
|
||||||
|
permanentKeyValues("GITHUB_CI_COMMIT_ID" to "")
|
||||||
|
generateFrom(ROOT_PROJECT, SYSTEM_ENV)
|
||||||
|
}
|
||||||
|
sourcesCode { includeKeys("GITHUB_CI_COMMIT_ID") }
|
||||||
|
}
|
||||||
|
rootProject { all { isEnable = false } }
|
||||||
|
}
|
||||||
|
rootProject.name = "TSBattery"
|
||||||
|
include(":app")
|
Reference in New Issue
Block a user