35 Commits
3.1 ... 3.2

Author SHA1 Message Date
9b3585c309 Update version to 3.2,support QQ 8.8.80 2022-02-25 22:24:38 +08:00
8c38183869 适配 QQ 8.8.80 2022-02-25 22:22:18 +08:00
a1bc86cb81 适配 QQ 8.8.8.0 2022-02-25 22:04:57 +08:00
3fb12ae743 Merge code 2022-02-25 21:36:44 +08:00
f23034639e Merge code 2022-02-20 03:42:59 +08:00
ccff6c04fd Merge code 2022-02-19 03:11:32 +08:00
48fbadb692 更新依赖库版本 2022-02-18 04:17:35 +08:00
0594352859 规范资源文件命名 2022-02-16 03:35:05 +08:00
9aceec38b6 修改文案 2022-02-15 22:16:22 +08:00
b925296870 Merge new version 2022-02-15 13:40:56 +08:00
28b03d2205 Merge new version 2022-02-15 13:39:41 +08:00
aeb6654550 Merge new version 2022-02-15 13:39:12 +08:00
82ff6ac311 Merge new version 2022-02-15 12:51:13 +08:00
74ba88f201 优化代码 2022-02-15 03:32:22 +08:00
3144a160d4 Update README.md 2022-02-15 02:00:47 +08:00
34bfb4660e Update README.md 2022-02-15 02:00:24 +08:00
8d10a17914 Update README.md 2022-02-15 01:54:32 +08:00
1edd92ca79 Refactor to YukiHookAPI https://github.com/fankes/YukiHookAPI 2022-02-15 01:47:07 +08:00
4b583df6ae 更新文案 2022-02-10 19:53:11 +08:00
f6d51a7633 更新文案 2022-02-10 19:29:42 +08:00
a1791f327b 更新文案 2022-02-10 19:24:49 +08:00
3d78411738 更新文案 2022-02-10 19:24:12 +08:00
72597510f2 更新文案 2022-02-10 19:21:35 +08:00
5b371ba3da 更新文案 2022-02-10 19:20:37 +08:00
751b0c4ce5 更新文案 2022-02-10 18:57:08 +08:00
73677d1c33 更新文案 2022-02-10 18:54:57 +08:00
ed658c83e6 更新版本协议到 A-GPL3.0 2022-02-10 18:53:30 +08:00
Fankesyooni
0b4c58293a Update README.md 2022-02-10 18:40:47 +08:00
Fankesyooni
5a51ef571a Update README.md 2022-02-10 18:38:29 +08:00
Fankesyooni
4bd738b206 Update LICENSE 2022-02-10 18:38:07 +08:00
4a0473892b 修正文案 2022-02-07 21:15:48 +08:00
14354ec06f 摆烂 2022-02-07 00:39:32 +08:00
7eca11ed18 整理规范代码 2022-02-03 20:29:07 +08:00
4c13768500 整理规范代码 2022-01-30 23:07:14 +08:00
e30afc4011 适配夜间模式以及 Material3 2022-01-30 19:21:21 +08:00
58 changed files with 1416 additions and 1661 deletions

4
.idea/misc.xml generated
View File

@@ -4,11 +4,13 @@
<option name="filePathToZoomLevelMap"> <option name="filePathToZoomLevelMap">
<map> <map>
<entry key="app/src/main/res/drawable-v24/dark_round.xml" value="0.4482051282051282" /> <entry key="app/src/main/res/drawable-v24/dark_round.xml" value="0.4482051282051282" />
<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/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/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/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/drawable/red_round.xml" value="0.4482051282051282" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3586910327241819" /> <entry key="app/src/main/res/layout/activity_main.xml" value="0.3504380475594493" />
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.2495" />
</map> </map>
</option> </option>
</component> </component>

722
LICENSE

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,31 @@
# TSBattery # TSBattery
![Eclipse Marketplace](https://img.shields.io/badge/build-passing-brightgreen) ![Eclipse Marketplace](https://img.shields.io/badge/build-passing-brightgreen)
![Eclipse Marketplace](https://img.shields.io/badge/license-GPL3.0-blue) ![Eclipse Marketplace](https://img.shields.io/badge/license-AGPL3.0-blue)
![Eclipse Marketplace](https://img.shields.io/badge/version-v3.1-green) ![Eclipse Marketplace](https://img.shields.io/badge/version-v3.2-green)
<br/><br/> <br/><br/>
![banner](https://github.com/fankes/TSBattery/blob/master/banner.png)<br/> ![banner](https://github.com/fankes/TSBattery/blob/master/banner.png)<br/>
TSBattery a new way to save your battery avoid cancer apps hacker it.<br/> A new way to save your battery avoid cancer apps hacker it.<br/>
TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed 模块 TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed 模块
# 开始使用 # 开始使用
点击下载最新版本 点击下载最新版本
<a href='https://github.com/fankes/TSBattery/releases'>![Eclipse Marketplace](https://img.shields.io/badge/download-v3.1-green)</a> <a href='https://github.com/fankes/TSBattery/releases'>![Eclipse Marketplace](https://img.shields.io/badge/download-v3.2-green)</a>
<br/><br/> <br/><br/>
⚠️适配说明:此模块支持原生 Xposed、Lsposed(作用域 QQ、TIM、微信 如果不起作用勾选系统框架)、EdXposed(不推荐)、太极无极(阴和阳)、Pine(梦境模块) ⚠️ 适配说明<br/>
# 禁止任何商业用途 - 支持并建议使用 <b>LSPosed</b>(若作用域没有自动出现推荐请勾选 QQ、TIM、微信)
- 可以使用 <b>~~EdXposed~~</b>,但随时停止支持
- <b>太极无极 · 阴</b> 支持性不是很好,建议使用 <b>太极无极 · 阳</b>
- 支持 <b>Pine</b>(梦境模块) 但是部分功能有限制
- 请不要使用 <b>~~应用转生~~</b>,发生封号情况后果自负
本模块完全开源免费,如果好用你可以打赏支持开发,严禁未经许可进行二改贩卖,违者必惩必究。 # 请勿用于非法用途
- 本模块完全开源免费,如果好用你可以打赏支持开发,但是请不要用于非法用途。
- 本模块发布地址仅有 [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)、
[Release](https://github.com/fankes/TSBattery/releases) 及[蓝奏云](https://fankes.lanzouy.com/b02zfz3sj),从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
# 开始贡献 # 开始贡献
@@ -27,18 +35,24 @@ TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed
# 许可证 # 许可证
- [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.html) - [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)
``` ```
Copyright (C) 2020-2022 Fankes Studio(qzmmcn@163.com) Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Affero General Public License as
the Free Software Foundation, either version 3 of the License, or published by the Free Software Foundation, either version 3 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU 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
along with this program. If not, see <http://www.gnu.org/licenses/>.
``` ```
Powered by [YukiHookAPI](https://github.com/fankes/YukiHookAPI)<br/><br/>
版权所有 © 2019-2022 Fankes Studio(qzmmcn@163.com)

1
app/.gitignore vendored
View File

@@ -1 +1,2 @@
/build /build
/release

View File

@@ -1,6 +1,7 @@
plugins { plugins {
id 'com.android.application' id 'com.android.application'
id 'kotlin-android' id 'kotlin-android'
id 'com.google.devtools.ksp' version '1.6.10-1.0.2'
} }
android { android {
@@ -19,11 +20,10 @@ android {
defaultConfig { defaultConfig {
applicationId "com.fankes.tsbattery" applicationId "com.fankes.tsbattery"
minSdkVersion 22 minSdk 22
//noinspection ExpiredTargetSdkVersion targetSdk 26
targetSdkVersion 26 versionCode rootProject.ext.appVersionCode
versionCode 10 versionName rootProject.ext.appVersionName
versionName "3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -46,13 +46,10 @@ android {
dependencies { dependencies {
compileOnly 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82'
// 基础依赖包 implementation 'com.highcapable.yukihookapi:api:1.0.2'
implementation 'com.gyf.immersionbar:immersionbar:3.0.0' ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.2'
// Fragment 快速实现 implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0' implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.0'
// Kotlin 扩展
implementation 'com.gyf.immersionbar:immersionbar-ktx:3.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
@@ -61,3 +58,18 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
} }
/** 移除无效耗时 lint Task */
tasks.whenTaskAdded {
task -> if (task.name == "lintVitalRelease") task.enabled = false
}
/** 移除无效耗时 lint Task */
tasks.whenTaskAdded {
task -> if (task.name == "lintVitalAnalyzeRelease") task.enabled = false
}
/** 移除无效耗时 lint Task */
tasks.whenTaskAdded {
task -> if (task.name == "lintVitalReportRelease") task.enabled = false
}

Binary file not shown.

View File

@@ -1,20 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.fankes.tsbattery",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 10,
"versionName": "3.1",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

View File

@@ -3,6 +3,13 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.fankes.tsbattery"> package="com.fankes.tsbattery">
<!-- 作用域 APP -->
<queries>
<package android:name="com.tencent.mobileqq" />
<package android:name="com.tencent.tim" />
<package android:name="com.tencent.mm" />
</queries>
<application <application
android:name=".application.TSApplication" android:name=".application.TSApplication"
android:allowBackup="true" android:allowBackup="true"
@@ -13,25 +20,21 @@
android:theme="@style/Theme.TSBattery" android:theme="@style/Theme.TSBattery"
tools:ignore="AllowBackup"> tools:ignore="AllowBackup">
<!-- 是否是xposed模块 -->
<meta-data <meta-data
android:name="xposedmodule" android:name="xposedmodule"
android:value="true" /> android:value="true" />
<!-- 模块描述 -->
<meta-data <meta-data
android:name="xposeddescription" android:name="xposeddescription"
android:value="Tencent 社交毒瘤一键省电模块。\n目前支持 QQ、TIM、微信\n开发者酷安 @星夜不荟" /> android:value="Tencent 社交毒瘤一键省电模块。\n目前支持 QQ、TIM、微信\n开发者酷安 @星夜不荟" />
<!-- 最低xposed版本号 -->
<meta-data <meta-data
android:name="xposedminversion" android:name="xposedminversion"
android:value="82" /> android:value="93" />
<activity <activity
android:name="com.fankes.tsbattery.ui.MainActivity" android:name="com.fankes.tsbattery.ui.MainActivity"
android:exported="true" android:exported="true"
android:label="@string/app_name"
android:screenOrientation="behind"> android:screenOrientation="behind">
<intent-filter> <intent-filter>

View File

@@ -1 +1 @@
com.fankes.tsbattery.hook.HookMain com.fankes.tsbattery.hook.HookEntry_YukiHookXposedInit

View File

@@ -0,0 +1 @@
com.fankes.tsbattery.hook.HookEntry

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */
@@ -37,13 +38,18 @@ class TSApplication : Application() {
* @return [TSApplication] * @return [TSApplication]
*/ */
val appContext get() = context ?: error("App is death") val appContext get() = context ?: error("App is death")
/** 自身 APP 是否已启动 */
var isMineStarted = false
} }
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
/** 设置状态 */
isMineStarted = true
/** 设置静态实例 */ /** 设置静态实例 */
context = this context = this
/** 禁止系统夜间模式对自己造成干扰 - 模块要什么夜间模式?😅 (其实是我懒) */ /** 跟随系统夜间模式 */
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
} }
} }

View File

@@ -0,0 +1,37 @@
/*
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 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 2021/11/9.
*/
package com.fankes.tsbattery.hook
object HookConst {
const val ENABLE_HIDE_ICON = "_hide_icon"
const val ENABLE_RUN_INFO = "_tip_run_info"
const val ENABLE_QQTIM_WHITE_MODE = "_qqtim_white_mode"
const val ENABLE_QQTIM_CORESERVICE_BAN = "_qqtim_core_service_ban"
const val ENABLE_QQTIM_CORESERVICE_CHILD_BAN = "_qqtim_core_service_child_ban"
const val DISABLE_WECHAT_HOOK = "_disable_wechat_hook"
const val ENABLE_MODULE_VERSION = "_module_version"
const val QQ_PACKAGE_NAME = "com.tencent.mobileqq"
const val TIM_PACKAGE_NAME = "com.tencent.tim"
const val WECHAT_PACKAGE_NAME = "com.tencent.mm"
}

View File

@@ -0,0 +1,492 @@
/*
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 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/2/15.
*/
package com.fankes.tsbattery.hook
import android.app.Activity
import android.app.Service
import android.content.Intent
import android.os.Build
import com.fankes.tsbattery.hook.HookConst.DISABLE_WECHAT_HOOK
import com.fankes.tsbattery.hook.HookConst.ENABLE_MODULE_VERSION
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_BAN
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_WHITE_MODE
import com.fankes.tsbattery.hook.HookConst.ENABLE_RUN_INFO
import com.fankes.tsbattery.hook.HookConst.QQ_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookConst.TIM_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookConst.WECHAT_PACKAGE_NAME
import com.fankes.tsbattery.utils.showDialog
import com.fankes.tsbattery.utils.versionCode
import com.fankes.tsbattery.utils.versionName
import com.highcapable.yukihookapi.YukiHookAPI.configs
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
import com.highcapable.yukihookapi.hook.bean.VariousClass
import com.highcapable.yukihookapi.hook.factory.encase
import com.highcapable.yukihookapi.hook.factory.field
import com.highcapable.yukihookapi.hook.log.loggerD
import com.highcapable.yukihookapi.hook.log.loggerE
import com.highcapable.yukihookapi.hook.param.PackageParam
import com.highcapable.yukihookapi.hook.type.android.*
import com.highcapable.yukihookapi.hook.type.java.*
import com.highcapable.yukihookapi.hook.xposed.proxy.YukiHookXposedInitProxy
@InjectYukiHookWithXposed
class HookEntry : YukiHookXposedInitProxy {
companion object {
/** BaseChatPie 类名 */
private val BaseChatPieClass =
VariousClass("$QQ_PACKAGE_NAME.activity.aio.core.BaseChatPie", "$QQ_PACKAGE_NAME.activity.BaseChatPie")
}
/**
* 这个类 QQ 的 BaseChatPie 是控制聊天界面的
*
* 里面有两个随机混淆的方法 ⬇
*
* remainScreenOn、cancelRemainScreenOn
*
* 这两个方法一个是挂起电源锁常驻亮屏
*
* 一个是停止常驻亮屏
*
* 不由分说每个版本混淆的方法名都会变
*
* 所以说每个版本重新适配 - 也可以提交分支帮我适配
*
* - ❗Hook 错了方法会造成闪退!
* @param version QQ 版本
*/
private fun PackageParam.hookQQBaseChatPie(version: String) {
when (version) {
"8.2.11" -> {
interceptBaseChatPie(methodName = "bE")
interceptBaseChatPie(methodName = "aV")
}
"8.8.17" -> {
interceptBaseChatPie(methodName = "bd")
interceptBaseChatPie(methodName = "be")
}
"8.8.23" -> {
interceptBaseChatPie(methodName = "bf")
interceptBaseChatPie(methodName = "bg")
}
/** 8.8.35 贡献者StarWishsama */
"8.8.35", "8.8.38" -> {
interceptBaseChatPie(methodName = "bi")
interceptBaseChatPie(methodName = "bj")
}
/** 贡献者JiZhi-Error */
"8.8.50" -> {
interceptBaseChatPie(methodName = "bj")
interceptBaseChatPie(methodName = "bk")
}
"8.8.55", "8.8.68", "8.8.80" -> {
interceptBaseChatPie(methodName = "bk")
interceptBaseChatPie(methodName = "bl")
}
else -> loggerD(msg = "$version not supported!")
}
}
/**
* 拦截 [BaseChatPieClass] 的目标方法体封装
* @param methodName 方法名
*/
private fun PackageParam.interceptBaseChatPie(methodName: String) =
BaseChatPieClass.hook {
injectMember {
method {
name = methodName
returnType = UnitType
}
intercept()
}
}
/** Hook 系统电源锁 */
private fun PackageParam.hookSystemWakeLock() =
PowerManager_WakeLockClass.hook {
injectMember {
method {
name = "acquireLocked"
returnType = UnitType
}
intercept()
}
}
/** 增加通知栏文本显示守护状态 */
private fun PackageParam.hookNotification() =
Notification_BuilderClass.hook {
injectMember {
method {
name = "setContentText"
param(CharSequenceType)
}
beforeHook {
when (args[0] as CharSequence) {
"QQ正在后台运行" ->
args().set("QQ正在后台运行 - TSBattery 守护中")
"TIM正在后台运行" ->
args().set("TIM正在后台运行 - TSBattery 守护中")
}
}
}
}
/**
* 提示模块运行信息 QQ、TIM、微信
* @param isQQTIM 是否为 QQ、TIM
*/
private fun PackageParam.hookModuleRunningInfo(isQQTIM: Boolean) =
when {
!prefs.getBoolean(ENABLE_RUN_INFO) -> {}
isQQTIM ->
findClass(name = "$QQ_PACKAGE_NAME.activity.SplashActivity").hook {
/**
* Hook 启动界面的第一个 [Activity]
* QQ 和 TIM 都是一样的类
* 在里面加入提示运行信息的对话框测试模块是否激活
*/
injectMember {
method {
name = "doOnCreate"
param(BundleClass)
}
afterHook {
instance<Activity>().apply {
showDialog {
title = "TSBattery 已激活"
msg = "[提示模块运行信息功能已打开]\n\n" +
"模块工作看起来一切正常,请自行测试是否能达到省电效果。\n\n" +
"已生效模块版本:${prefs.getString(ENABLE_MODULE_VERSION)}\n" +
"当前模式:${if (prefs.getBoolean(ENABLE_QQTIM_WHITE_MODE)) "保守模式" else "完全模式"}" +
"\n\n包名:${packageName}\n版本:$versionName($versionCode)" +
"\n\n模块只对挂后台锁屏情况下有省电效果," +
"请不要将过多的群提醒,消息通知打开,这样子在使用过程时照样会极其耗电。\n\n" +
"如果你不想看到此提示。请在模块设置中关闭“提示模块运行信息”,此设置默认关闭。\n\n" +
"持续常驻使用 QQ 依然会耗电,任何软件都是如此," +
"模块无法帮你做到前台不耗电,永远记住这一点。\n\n" +
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
confirmButton(text = "我知道了")
noCancelable()
}
}
}
}
}
else ->
findClass(name = "$WECHAT_PACKAGE_NAME.ui.LauncherUI").hook {
/**
* Hook 启动界面的第一个 [Activity]
* 在里面加入提示运行信息的对话框测试模块是否激活
*/
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
afterHook {
instance<Activity>().apply {
showDialog(isUseBlackTheme = true) {
title = "TSBattery 已激活"
msg = "[提示模块运行信息功能已打开]\n\n" +
"模块工作看起来一切正常,请自行测试是否能达到省电效果。\n\n" +
"已生效模块版本:${prefs.getString(ENABLE_MODULE_VERSION)}\n" +
"当前模式:基础省电" +
"\n\n包名:${packageName}\n版本:$versionName($versionCode)" +
"\n\n当前只支持微信的基础省电,即系统电源锁,后续会继续适配微信相关的省电功能(在新建文件夹了)。\n\n" +
"如果你不想看到此提示。请在模块设置中关闭“提示模块运行信息”,此设置默认关闭。\n\n" +
"持续常驻使用微信依然会耗电,任何软件都是如此," +
"模块无法帮你做到前台不耗电,永远记住这一点。\n\n" +
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
confirmButton(text = "我知道了")
noCancelable()
}
}
}
}
}
}
/**
* Hook CoreService QQ、TIM
* @param isQQ 是否为 QQ - 单独处理
*/
private fun PackageParam.hookCoreService(isQQ: Boolean) {
if (prefs.getBoolean(ENABLE_QQTIM_CORESERVICE_BAN))
findClass(name = "$QQ_PACKAGE_NAME.app.CoreService").hook {
if (isQQ) {
injectMember {
method { name = "startTempService" }
intercept()
}
injectMember {
method {
name = "startCoreService"
param(BooleanType)
}
intercept()
}
injectMember {
method {
name = "onStartCommand"
param(IntentClass, IntType, IntType)
}
replaceTo(any = 2)
}
}
injectMember {
method { name = "onCreate" }
afterHook {
instance<Service>().apply {
stopForeground(true)
stopService(Intent(applicationContext, javaClass))
loggerD(msg = "Shutdown CoreService OK!")
}
}
}
}
if (prefs.getBoolean(ENABLE_QQTIM_CORESERVICE_CHILD_BAN))
findClass(name = "$QQ_PACKAGE_NAME.app.CoreService\$KernelService").hook {
injectMember {
method { name = "onCreate" }
afterHook {
instance<Service>().apply {
stopForeground(true)
stopService(Intent(applicationContext, javaClass))
loggerD(msg = "Shutdown CoreService\$KernelService OK!")
}
}
}
injectMember {
method {
name = "onStartCommand"
param(IntentClass, IntType, IntType)
}
replaceTo(any = 2)
}
}
}
override fun onHook() = encase {
configs {
debugTag = "TSBattery"
isDebug = false
}
loadApp(QQ_PACKAGE_NAME) {
hookSystemWakeLock()
hookNotification()
hookCoreService(isQQ = true)
hookModuleRunningInfo(isQQTIM = true)
if (prefs.getBoolean(ENABLE_QQTIM_WHITE_MODE)) return@loadApp
/** 通过在 SplashActivity 里取到应用的版本号 */
findClass(name = "$QQ_PACKAGE_NAME.activity.SplashActivity").hook {
injectMember {
method {
name = "doOnCreate"
param(BundleClass)
}
afterHook { hookQQBaseChatPie(instance<Activity>().versionName) }
}
}
/**
* 一个不知道是什么作用的电源锁
* 同样直接干掉
*/
findClass(name = "com.tencent.mars.ilink.comm.WakerLock").hook {
injectMember {
method {
name = "lock"
param(LongType)
}
intercept()
}.ignoredAllFailure()
}
/**
* 一个不知道是什么作用的电源锁
* 同样直接干掉
*/
findClass(name = "com.tencent.mars.comm.WakerLock").hook {
injectMember {
method {
name = "lock"
param(LongType)
}
intercept()
}.ignoredAllFailure()
injectMember {
method {
name = "lock"
param(StringType)
}
intercept()
}.ignoredAllFailure()
injectMember {
method { name = "lock" }
intercept()
}.ignoredAllFailure()
}
/**
* 干掉消息收发功能的电源锁
* 每个版本的差异暂未做排查
* 旧版本理论上没有这个类
*/
findClass(name = "$QQ_PACKAGE_NAME.msf.service.y").hook {
injectMember {
method {
name = "a"
param(StringType, LongType)
returnType = UnitType
}
intercept()
}.onAllFailure { loggerE(msg = "Hook MsfService Failed $it") }
}
/**
* 干掉自动上传服务的电源锁
* 每个版本的差异暂未做排查
*/
findClass(name = "com.tencent.upload.impl.UploadServiceImpl").hook {
injectMember {
method { name = "acquireWakeLockIfNot" }
intercept()
}.onAllFailure { loggerE(msg = "Hook UploadServiceImpl Failed $it") }
}
/**
* Hook 掉一个一像素保活 [Activity] 真的我怎么都想不到讯哥的程序员做出这种事情
* 这个东西经过测试会在锁屏的时候吊起来,解锁的时候自动 finish(),无限耍流氓耗电
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口的解锁后拉起保活界面,也是毒瘤
*/
findClass(name = "$QQ_PACKAGE_NAME.activity.QQLSUnlockActivity").hook {
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
var origDevice = ""
beforeHook {
/** 由于在 onCreate 里有一行判断只要型号是 xiaomi 的设备就开电源锁,所以说这里临时替换成菊花厂 */
origDevice = Build.MANUFACTURER
if (Build.MANUFACTURER.lowercase() == "xiaomi")
BuildClass.field { name = "MANUFACTURER" }.get().set("HUAWEI")
}
afterHook {
instance<Activity>().finish()
/** 这里再把型号替换回去 - 不影响应用变量等 Xposed 模块修改的型号 */
BuildClass.field { name = "MANUFACTURER" }.get().set(origDevice)
}
}
}
/**
* 这个东西同上
* 反正也是一个一像素保活的 [Activity]
* 讯哥的程序员真的有你的
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口
*/
findClass(name = "$QQ_PACKAGE_NAME.activity.QQLSActivity\$14").hook {
injectMember {
method { name = "run" }
intercept()
}.ignoredAllFailure()
}
/**
* 这个是毒瘤核心类
* WakeLockMonitor
* 这个名字真的起的特别诗情画意
* 带给用户的却是 shit 一样的体验
* 里面有各种使用 Handler 和 Timer 的各种耗时常驻后台耗电办法持续接收消息
* 直接循环全部方法全部干掉
* 👮🏻 经过排查 Play 版本没这个类...... Emmmm 不想说啥了
*/
findClass(name = "com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor").hook {
injectMember {
method {
name = "onHook"
param(StringType, AnyType, AnyArrayClass, AnyType)
}
intercept()
}
injectMember {
method {
name = "doReport"
param(("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity").clazz, IntType)
}
intercept()
}
injectMember {
method {
name = "afterHookedMethod"
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
}
intercept()
}
injectMember {
method {
name = "beforeHookedMethod"
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
}
intercept()
}
injectMember {
method { name = "onAppBackground" }
intercept()
}
injectMember {
method {
name = "onOtherProcReport"
param(BundleClass)
}
intercept()
}
injectMember {
method { name = "onProcessRun30Min" }
intercept()
}
injectMember {
method { name = "onProcessBG5Min" }
intercept()
}
injectMember {
method {
name = "writeReport"
param(BooleanType)
}
intercept()
}
}
}
loadApp(TIM_PACKAGE_NAME) {
hookSystemWakeLock()
hookNotification()
hookCoreService(isQQ = false)
hookModuleRunningInfo(isQQTIM = true)
}
loadApp(WECHAT_PACKAGE_NAME) {
if (prefs.getBoolean(DISABLE_WECHAT_HOOK)) return@loadApp
hookSystemWakeLock()
hookModuleRunningInfo(isQQTIM = false)
loggerD(msg = "ウイチャット:それが機能するかどうかはわかりませんでした")
}
}
}

View File

@@ -1,555 +0,0 @@
/**
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
*
* This file is part of TSBattery.
*
* TSBattery is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* This file is Created by fankes on 2021/9/4.
*/
@file:Suppress("DEPRECATION", "SameParameterValue")
package com.fankes.tsbattery.hook
import android.app.Activity
import android.app.Service
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.util.Log
import androidx.annotation.Keep
import com.fankes.tsbattery.hook.HookMedium.QQ_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookMedium.SELF_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookMedium.TIM_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookMedium.WECHAT_PACKAGE_NAME
import com.fankes.tsbattery.utils.XPrefUtils
import com.fankes.tsbattery.utils.showDialog
import com.fankes.tsbattery.utils.versionCode
import com.fankes.tsbattery.utils.versionName
import de.robv.android.xposed.*
import de.robv.android.xposed.callbacks.XC_LoadPackage
import java.util.*
@Keep
class HookMain : IXposedHookLoadPackage {
companion object {
/** 旧版类名 */
private const val BASE_CHAT_PIE_LEGACY = "activity.BaseChatPie"
/** 新版类名 */
private const val BASE_CHAT_PIE = "activity.aio.core.BaseChatPie"
}
/** 仅作用于替换的 Hook 方法体 */
private val replaceToNull = object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam?): Any? {
return null
}
}
/** 仅作用于替换的 Hook 方法体 */
private val replaceToTrue = object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam?): Any {
return true
}
}
/**
* 干掉目标方法体封装
* @param clazz 类名缩写
* @param name 方法名
*/
private fun XC_LoadPackage.LoadPackageParam.replaceToNull(clazz: String, name: String) {
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.$clazz",
classLoader,
name,
replaceToNull
)
}
/**
* 忽略异常运行
* @param it 正常回调
*/
private fun runWithoutError(error: String, it: () -> Unit) {
try {
it()
} catch (e: Error) {
logE("hookFailed: $error", e)
} catch (e: Exception) {
logE("hookFailed: $error", e)
} catch (e: Throwable) {
logE("hookFailed: $error", e)
}
}
/**
* 这个类 QQ 的 BaseChatPie 是控制聊天界面的
* 里面有两个随机混淆的方法 ⬇️
* remainScreenOn、cancelRemainScreenOn
* 这两个方法一个是挂起电源锁常驻亮屏
* 一个是停止常驻亮屏
* 不由分说每个版本混淆的方法名都会变
* 所以说每个版本重新适配 - 也可以提交分支帮我适配
* ⚠️ Hook 错了方法会造成闪退!
* @param version QQ 版本
*/
private fun XC_LoadPackage.LoadPackageParam.hookQQBaseChatPie(version: String) {
when (version) {
"8.2.11" -> {
replaceToNull(BASE_CHAT_PIE_LEGACY, "bE")
replaceToNull(BASE_CHAT_PIE_LEGACY, "aV")
}
"8.8.17" -> {
replaceToNull(BASE_CHAT_PIE, "bd")
replaceToNull(BASE_CHAT_PIE, "be")
}
"8.8.23" -> {
replaceToNull(BASE_CHAT_PIE, "bf")
replaceToNull(BASE_CHAT_PIE, "bg")
}
/** 8.8.35 贡献者StarWishsama */
"8.8.35", "8.8.38" -> {
replaceToNull(BASE_CHAT_PIE, "bi")
replaceToNull(BASE_CHAT_PIE, "bj")
}
/** 贡献者JiZhi-Error */
"8.8.50" -> {
replaceToNull(BASE_CHAT_PIE, "bj")
replaceToNull(BASE_CHAT_PIE, "bk")
}
"8.8.55", "8.8.68" -> {
replaceToNull(BASE_CHAT_PIE, "bk")
replaceToNull(BASE_CHAT_PIE, "bl")
}
else -> logD("$version not supported!")
}
}
/**
* Print the log
* @param content
*/
private fun logD(content: String) {
XposedBridge.log("[TSBattery][D]>$content")
Log.d("TSBattery", content)
}
/**
* Print the log
* @param content
*/
private fun logE(content: String, e: Throwable? = null) {
XposedBridge.log("[TSBattery][E]>$content")
XposedBridge.log(e)
Log.e("TSBattery", content, e)
}
/** Hook 系统电源锁 */
private fun XC_LoadPackage.LoadPackageParam.hookSystemWakeLock() {
runWithoutError("wakeLock acquire()") {
XposedHelpers.findAndHookMethod(
"android.os.PowerManager\$WakeLock",
classLoader,
"acquire",
replaceToNull
)
}
runWithoutError("hook wakeLock acquire(time)") {
XposedHelpers.findAndHookMethod(
"android.os.PowerManager\$WakeLock",
classLoader,
"acquire",
Long::class.java,
replaceToNull
)
}
}
/** 增加通知栏文本显示守护状态 */
private fun XC_LoadPackage.LoadPackageParam.hookNotification() =
runWithoutError("Notification") {
XposedHelpers.findAndHookMethod(
"android.app.Notification\$Builder",
classLoader,
"setContentText",
CharSequence::class.java,
object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam?) {
when (param?.args?.get(0) as? CharSequence?) {
"QQ正在后台运行" ->
param.args?.set(0, "QQ正在后台运行 - TSBattery 守护中")
"TIM正在后台运行" ->
param.args?.set(0, "TIM正在后台运行 - TSBattery 守护中")
}
}
})
}
/** 提示模块运行信息 QQ、TIM、微信 */
private fun XC_LoadPackage.LoadPackageParam.hookModuleRunningInfo() =
if (packageName != WECHAT_PACKAGE_NAME)
runWithoutError("SplashActivity") {
/** 判断是否开启提示模块运行信息 */
if (XPrefUtils.getBoolean(HookMedium.ENABLE_RUN_INFO))
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.activity.SplashActivity",
classLoader,
"doOnCreate",
Bundle::class.java,
object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam?) {
/**
* Hook 启动界面的第一个 [Activity]
* QQ 和 TIM 都是一样的类
* 在里面加入提示运行信息的对话框测试模块是否激活
*/
(param?.thisObject as? Activity?)?.apply {
showDialog {
title = "TSBattery 已激活"
msg = "[提示模块运行信息功能已打开]\n\n" +
"模块工作看起来一切正常,请自行测试是否能达到省电效果。\n\n" +
"已生效模块版本:${XPrefUtils.getString(HookMedium.ENABLE_MODULE_VERSION)}\n" +
"当前模式:${if (XPrefUtils.getBoolean(HookMedium.ENABLE_QQTIM_WHITE_MODE)) "保守模式" else "完全模式"}" +
"\n\n包名:${packageName}\n版本:$versionName($versionCode)" +
"\n\n模块只对挂后台锁屏情况下有省电效果,请不要将过多的群提醒,消息通知打开,这样子在使用过程时照样会极其耗电。\n\n" +
"如果你不想看到此提示。请在模块设置中关闭“提示模块运行信息”,此设置默认关闭。\n\n" +
"持续常驻使用 QQ 依然会耗电,任何软件都是如此,模块无法帮你做到前台不耗电,永远记住这一点。\n\n" +
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
confirmButton(text = "我知道了")
noCancelable()
}
}
}
})
}
else
runWithoutError("LauncherUI") {
/** 判断是否开启提示模块运行信息 */
if (XPrefUtils.getBoolean(HookMedium.ENABLE_RUN_INFO))
XposedHelpers.findAndHookMethod(
"$WECHAT_PACKAGE_NAME.ui.LauncherUI",
classLoader,
"onCreate",
Bundle::class.java,
object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam?) {
/**
* Hook 启动界面的第一个 [Activity]
* 在里面加入提示运行信息的对话框测试模块是否激活
*/
(param?.thisObject as? Activity?)?.apply {
showDialog(isUseBlackTheme = true) {
title = "TSBattery 已激活"
msg = "[提示模块运行信息功能已打开]\n\n" +
"模块工作看起来一切正常,请自行测试是否能达到省电效果。\n\n" +
"已生效模块版本:${XPrefUtils.getString(HookMedium.ENABLE_MODULE_VERSION)}\n" +
"当前模式:基础省电" +
"\n\n包名:${packageName}\n版本:$versionName($versionCode)" +
"\n\n当前只支持微信的基础省电,即系统电源锁,后续会继续适配微信相关的省电功能(在新建文件夹了)。\n\n" +
"如果你不想看到此提示。请在模块设置中关闭“提示模块运行信息”,此设置默认关闭。\n\n" +
"持续常驻使用微信依然会耗电,任何软件都是如此,模块无法帮你做到前台不耗电,永远记住这一点。\n\n" +
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
confirmButton(text = "我知道了")
noCancelable()
}
}
}
})
}
/** Hook CoreService QQ、TIM */
private fun XC_LoadPackage.LoadPackageParam.hookCoreService() {
/** Hook CoreService 指定方法 */
if (packageName == QQ_PACKAGE_NAME)
runWithoutError("CoreServiceKnownMethods") {
if (XPrefUtils.getBoolean(HookMedium.ENABLE_QQTIM_CORESERVICE_BAN)) {
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.app.CoreService",
classLoader, "startTempService", replaceToNull
)
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.app.CoreService",
classLoader, "startCoreService", Boolean::class.java, replaceToNull
)
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.app.CoreService",
classLoader,
"onStartCommand",
Intent::class.java, Int::class.java, Int::class.java,
object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam?) = 2
})
logD("hook CoreService OK!")
}
}
/** Hook CoreService 启动方法 */
runWithoutError("CoreService") {
if (XPrefUtils.getBoolean(HookMedium.ENABLE_QQTIM_CORESERVICE_BAN)) {
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.app.CoreService",
classLoader, "onCreate",
object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam?) {
(param?.thisObject as? Service)?.apply {
runWithoutError("StopCoreService") {
stopForeground(true)
stopService(Intent(applicationContext, javaClass))
logD("Shutdown CoreService OK!")
}
}
}
})
logD("hook CoreService [onCreate] OK!")
}
}
/** Hook CoreService$KernelService 启动方法 */
runWithoutError("CoreService\$KernelService") {
if (XPrefUtils.getBoolean(HookMedium.ENABLE_QQTIM_CORESERVICE_CHILD_BAN)) {
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.app.CoreService\$KernelService",
classLoader, "onCreate",
object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam?) {
(param?.thisObject as? Service)?.apply {
runWithoutError("StopKernelService") {
stopForeground(true)
stopService(Intent(applicationContext, javaClass))
logD("Shutdown CoreService\$KernelService OK!")
}
}
}
})
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.app.CoreService\$KernelService",
classLoader,
"onStartCommand",
Intent::class.java, Int::class.java, Int::class.java,
object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam?) = 2
})
logD("hook CoreService\$KernelService [onCreate] OK!")
}
}
}
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {
if (lpparam == null) return
when (lpparam.packageName) {
/** Hook 自身 */
SELF_PACKAGE_NAME ->
XposedHelpers.findAndHookMethod(
"$SELF_PACKAGE_NAME.hook.HookMedium",
lpparam.classLoader,
"isHooked",
replaceToTrue
)
/** Hook TIM */
TIM_PACKAGE_NAME ->
lpparam.apply {
hookSystemWakeLock()
hookNotification()
hookModuleRunningInfo()
hookCoreService()
logD("hook Completed!")
}
/** Hook QQ */
QQ_PACKAGE_NAME -> {
lpparam.apply {
hookSystemWakeLock()
hookNotification()
hookModuleRunningInfo()
hookCoreService()
}
/** 关闭保守模式后不再仅仅作用于系统电源锁 */
if (!XPrefUtils.getBoolean(HookMedium.ENABLE_QQTIM_WHITE_MODE)) {
runWithoutError("BaseChatPie(first time)") {
/** 通过在 SplashActivity 里取到应用的版本号 */
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.activity.SplashActivity",
lpparam.classLoader,
"doOnCreate",
Bundle::class.java,
object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam?) {
val self = param?.thisObject as? Activity ?: return
val version = self.versionName
runWithoutError("BaseChatPie") { lpparam.hookQQBaseChatPie(version) }
}
})
}
runWithoutError("WakerLock") {
/**
* 一个不知道是什么作用的电源锁
* 同样直接干掉
*/
XposedHelpers.findAndHookMethod(
"com.tencent.mars.ilink.comm.WakerLock",
lpparam.classLoader,
"lock", Long::class.java,
replaceToNull
)
}
runWithoutError("QQLSActivity") {
/**
* Hook 掉一个一像素保活 [Activity] 真的我怎么都想不到讯哥的程序员做出这种事情
* 这个东西经过测试会在锁屏的时候吊起来,解锁的时候自动 finish(),无限耍流氓耗电
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口的解锁后拉起保活界面,也是毒瘤
*/
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.activity.QQLSUnlockActivity",
lpparam.classLoader,
"onCreate", Bundle::class.java,
object : XC_MethodHook() {
private var origDevice = ""
override fun beforeHookedMethod(param: MethodHookParam?) {
/** 由于在 onCreate 里有一行判断只要型号是 xiaomi 的设备就开电源锁,所以说这里临时替换成菊花厂 */
origDevice = Build.MANUFACTURER
if (Build.MANUFACTURER.toLowerCase(Locale.ROOT) == "xiaomi")
XposedHelpers.setStaticObjectField(
Build::class.java,
"MANUFACTURER",
"HUAWEI"
)
}
override fun afterHookedMethod(param: MethodHookParam?) {
(param?.thisObject as? Activity)?.finish()
/** 这里再把型号替换回去 - 不影响应用变量等 Xposed 模块修改的型号 */
XposedHelpers.setStaticObjectField(
Build::class.java,
"MANUFACTURER",
origDevice
)
}
}
)
/**
* 这个东西同上
* 反正也是一个一像素保活的 [Activity]
* 讯哥的程序员真的有你的
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口
*/
XposedHelpers.findAndHookMethod(
"$QQ_PACKAGE_NAME.activity.QQLSActivity\$14",
lpparam.classLoader,
"run",
replaceToNull
)
}
runWithoutError("WakerLockMonitor") {
/**
* 这个是毒瘤核心类
* WakeLockMonitor
* 这个名字真的起的特别诗情画意
* 带给用户的却是 shit 一样的体验
* 里面有各种使用 Handler 和 Timer 的各种耗时常驻后台耗电办法持续接收消息
* 直接循环全部方法全部干掉
* 👮🏻 经过排查 Play 版本没这个类...... Emmmm 不想说啥了
*/
lpparam.classLoader.loadClass("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor")
.apply {
val lockClazz =
lpparam.classLoader.loadClass("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity")
val hookClazz =
lpparam.classLoader.loadClass("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
val onHook = getDeclaredMethod(
"onHook",
String::class.java,
Any::class.java,
java.lang.reflect.Array.newInstance(
Any::class.java,
0
).javaClass,
Any::class.java
).apply { isAccessible = true }
val doReport =
getDeclaredMethod(
"doReport",
lockClazz,
Int::class.java
).apply {
isAccessible = true
}
val afterHookedMethod =
getDeclaredMethod(
"afterHookedMethod",
hookClazz
).apply { isAccessible = true }
val beforeHookedMethod =
getDeclaredMethod("beforeHookedMethod", hookClazz).apply {
isAccessible = true
}
val onAppBackground =
getDeclaredMethod("onAppBackground").apply {
isAccessible = true
}
val onOtherProcReport =
getDeclaredMethod(
"onOtherProcReport",
Bundle::class.java
).apply { isAccessible = true }
val onProcessRun30Min =
getDeclaredMethod("onProcessRun30Min").apply {
isAccessible = true
}
val onProcessBG5Min =
getDeclaredMethod("onProcessBG5Min").apply {
isAccessible = true
}
val writeReport =
getDeclaredMethod(
"writeReport",
Boolean::class.java
).apply { isAccessible = true }
XposedBridge.hookMethod(onHook, replaceToNull)
XposedBridge.hookMethod(doReport, replaceToNull)
XposedBridge.hookMethod(afterHookedMethod, replaceToNull)
XposedBridge.hookMethod(beforeHookedMethod, replaceToNull)
XposedBridge.hookMethod(onAppBackground, replaceToNull)
XposedBridge.hookMethod(onOtherProcReport, replaceToNull)
XposedBridge.hookMethod(onProcessRun30Min, replaceToNull)
XposedBridge.hookMethod(onProcessBG5Min, replaceToNull)
XposedBridge.hookMethod(writeReport, replaceToNull)
}
}
logD("hook Completed!")
}
}
/** 微信 */
WECHAT_PACKAGE_NAME -> {
/** 判断是否关闭 Hook */
if (XPrefUtils.getBoolean(HookMedium.DISABLE_WECHAT_HOOK)) return
lpparam.apply {
hookSystemWakeLock()
hookModuleRunningInfo()
}
// TODO 新建文件夹
logD("ウイチャット:それが機能するかどうかはわかりませんでした")
}
}
}
}

View File

@@ -1,87 +0,0 @@
/*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
*
* This file is part of TSBattery.
*
* TSBattery is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* This file is Created by fankes on 2021/11/9.
*/
package com.fankes.tsbattery.hook
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.annotation.Keep
import com.fankes.tsbattery.ui.MainActivity
@Keep
object HookMedium {
const val ENABLE_HIDE_ICON = "_hide_icon"
const val ENABLE_RUN_INFO = "_tip_run_info"
const val ENABLE_QQTIM_WHITE_MODE = "_qqtim_white_mode"
const val ENABLE_QQTIM_CORESERVICE_BAN = "_qqtim_core_service_ban"
const val ENABLE_QQTIM_CORESERVICE_CHILD_BAN = "_qqtim_core_service_child_ban"
const val DISABLE_WECHAT_HOOK = "_disable_wechat_hook"
const val ENABLE_MODULE_VERSION = "_module_version"
const val SELF_PACKAGE_NAME = "com.fankes.tsbattery"
const val QQ_PACKAGE_NAME = "com.tencent.mobileqq"
const val TIM_PACKAGE_NAME = "com.tencent.tim"
const val WECHAT_PACKAGE_NAME = "com.tencent.mm"
/**
* 判断模块是否激活
* 在 [HookMain] 中 Hook 掉此方法
* @return [Boolean] 激活状态
*/
fun isHooked(): Boolean {
Log.d("TSBattery", "isHooked: true")
return isExpModuleActive()
}
/**
* 太极激活判断方式
* @return [Boolean] 是否激活
*/
private fun isExpModuleActive(): Boolean {
var isExp = false
MainActivity.instance?.also {
try {
val uri = Uri.parse("content://me.weishu.exposed.CP/")
var result: Bundle? = null
try {
result = it.contentResolver.call(uri, "active", null, null)
} catch (_: RuntimeException) {
// TaiChi is killed, try invoke
try {
val intent = Intent("me.weishu.exp.ACTION_ACTIVE")
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
it.startActivity(intent)
} catch (_: Throwable) {
return false
}
}
if (result == null) result = it.contentResolver.call(uri, "active", null, null)
if (result == null) return false
isExp = result.getBoolean("active", false)
} catch (_: Throwable) {
}
}
return isExp
}
}

View File

@@ -1,37 +1,33 @@
/** /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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( @file:Suppress("SetTextI18n", "LocalVariableName", "SameParameterValue")
"DEPRECATION", "SetTextI18n", "SetWorldReadable", "WorldReadableFiles",
"LocalVariableName", "SameParameterValue"
)
package com.fankes.tsbattery.ui package com.fankes.tsbattery.ui
import android.content.ComponentName import android.content.ComponentName
import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.view.View import android.view.View
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
@@ -42,16 +38,24 @@ import androidx.constraintlayout.utils.widget.ImageFilterView
import androidx.core.view.isGone import androidx.core.view.isGone
import com.fankes.tsbattery.BuildConfig import com.fankes.tsbattery.BuildConfig
import com.fankes.tsbattery.R import com.fankes.tsbattery.R
import com.fankes.tsbattery.hook.HookMedium import com.fankes.tsbattery.hook.HookConst.DISABLE_WECHAT_HOOK
import com.fankes.tsbattery.hook.HookMedium.QQ_PACKAGE_NAME import com.fankes.tsbattery.hook.HookConst.ENABLE_HIDE_ICON
import com.fankes.tsbattery.hook.HookMedium.TIM_PACKAGE_NAME import com.fankes.tsbattery.hook.HookConst.ENABLE_MODULE_VERSION
import com.fankes.tsbattery.hook.HookMedium.WECHAT_PACKAGE_NAME import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_BAN
import com.fankes.tsbattery.utils.FileUtils import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN
import com.fankes.tsbattery.hook.HookConst.ENABLE_QQTIM_WHITE_MODE
import com.fankes.tsbattery.hook.HookConst.ENABLE_RUN_INFO
import com.fankes.tsbattery.hook.HookConst.QQ_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookConst.TIM_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookConst.WECHAT_PACKAGE_NAME
import com.fankes.tsbattery.utils.isInstall import com.fankes.tsbattery.utils.isInstall
import com.fankes.tsbattery.utils.isNotSystemInDarkMode
import com.fankes.tsbattery.utils.openSelfSetting import com.fankes.tsbattery.utils.openSelfSetting
import com.fankes.tsbattery.utils.showDialog import com.fankes.tsbattery.utils.showDialog
import com.gyf.immersionbar.ImmersionBar import com.gyf.immersionbar.ktx.immersionBar
import java.io.File import com.highcapable.yukihookapi.hook.factory.isTaiChiModuleActive
import com.highcapable.yukihookapi.hook.factory.modulePrefs
import com.highcapable.yukihookapi.hook.xposed.YukiHookModuleStatus
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
@@ -59,50 +63,61 @@ class MainActivity : AppCompatActivity() {
private const val moduleVersion = BuildConfig.VERSION_NAME private const val moduleVersion = BuildConfig.VERSION_NAME
private const val qqSupportVersion = private const val qqSupportVersion =
"8.2.11(Play)、8.8.17、8.8.23、8.8.35、8.8.38、8.8.50、8.8.55、8.8.68 (8.2.11、8.5.5~8.8.68)" "8.2.11(Play)、8.8.17、8.8.23、8.8.35、8.8.38、8.8.50、8.8.55、8.8.68、8.8.80 (8.2.11、8.5.5~8.8.80)"
private const val timSupportVersion = "2+、3+ (并未完全测试每个版本)" private const val timSupportVersion = "2+、3+ (并未完全测试每个版本)"
private const val wechatSupportVersion = "全版本仅支持基础省电,更多功能依然画饼" private const val wechatSupportVersion = "全版本仅支持基础省电,更多功能依然画饼"
/** 声明当前实例 */
var instance: MainActivity? = null
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
/** 设置自身实例 */
instance = this
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
/** 隐藏系统的标题栏 */ /** 隐藏系统的标题栏 */
supportActionBar?.hide() supportActionBar?.hide()
/** 初始化沉浸状态栏 */ /** 初始化沉浸状态栏 */
ImmersionBar.with(this) immersionBar {
.statusBarColor(R.color.white) statusBarColor(R.color.colorThemeBackground)
.autoDarkModeEnable(false) autoDarkModeEnable(true)
.statusBarDarkFont(true) statusBarDarkFont(isNotSystemInDarkMode)
.navigationBarColor(R.color.white) navigationBarColor(R.color.colorThemeBackground)
.navigationBarDarkIcon(true) navigationBarDarkIcon(isNotSystemInDarkMode)
.fitsSystemWindows(true) fitsSystemWindows(true)
.init() }
/** 判断 Hook 状态 */ /** 判断 Hook 状态 */
if (isHooked()) { if (isHooked()) {
findViewById<LinearLayout>(R.id.main_lin_status).setBackgroundResource(R.drawable.green_round) findViewById<LinearLayout>(R.id.main_lin_status).setBackgroundResource(R.drawable.bg_green_round)
findViewById<ImageFilterView>(R.id.main_img_status).setImageResource(R.mipmap.succcess) findViewById<ImageFilterView>(R.id.main_img_status).setImageResource(R.mipmap.ic_success)
findViewById<TextView>(R.id.main_text_status).text = "模块已激活" findViewById<TextView>(R.id.main_text_status).text = "模块已激活"
/** 写入激活的模块版本 */ /** 写入激活的模块版本 */
putString(HookMedium.ENABLE_MODULE_VERSION, moduleVersion) modulePrefs.putString(ENABLE_MODULE_VERSION, moduleVersion)
} else } else
showDialog { showDialog {
title = "模块没有激活" title = "模块没有激活"
msg = "检测到模块没有激活,模块需要 Xposed 环境依赖," + msg = "检测到模块没有激活,模块需要 Xposed 环境依赖," +
"同时需要系统拥有 Root 权限(太极阴可以免 Root)" + "同时需要系统拥有 Root 权限(太极阴可以免 Root)" +
"请自行查看本页面使用帮助与说明第三条。\n" + "请自行查看本页面使用帮助与说明第三条。\n" +
"太极、应用转生、梦境(Pine)和第三方 Xposed 激活后" + "太极和第三方 Xposed 激活后" +
"可能不会提示激活,若想验证是否激活请打开“提示模块运行信息”自行检查," + "可能不会提示激活,若想验证是否激活请打开“提示模块运行信息”自行检查," +
"或观察 QQ、TIM 的常驻通知是否有“TSBattery 守护中”字样”," +
"如果生效就代表模块运行正常,这里的激活状态只是一个显示意义上的存在。\n" + "如果生效就代表模块运行正常,这里的激活状态只是一个显示意义上的存在。\n" +
"太极(无极)在 MIUI 设备上会提示打开授权,请进行允许,然后再次打开本应用查看激活状态。" "太极(无极)在 MIUI 设备上会提示打开授权,请进行允许,然后再次打开本应用查看激活状态。"
confirmButton(text = "我知道了") confirmButton(text = "我知道了")
noCancelable() noCancelable()
} }
/** 推荐使用 LSPosed */
if (isTaiChiModuleActive)
showDialog {
title = "兼容性提示"
msg = "若你的设备已 Root推荐使用 LSPosed 激活模块,太极可能会出现模块设置无法保存的问题。"
confirmButton(text = "我知道了")
}
/** 检测应用转生 */
if (("com.bug.xposed").isInstall)
showDialog {
title = "环境异常"
msg = "检测到“应用转生”已被安装,为了保证模块的安全和稳定,请卸载更换其他 Hook 框架后才能继续使用。"
confirmButton(text = "退出") { finish() }
noCancelable()
}
/** 设置安装状态 */ /** 设置安装状态 */
findViewById<View>(R.id.main_text_qq_noinstall).isGone = QQ_PACKAGE_NAME.isInstall findViewById<View>(R.id.main_text_qq_noinstall).isGone = QQ_PACKAGE_NAME.isInstall
findViewById<View>(R.id.main_text_tim_noinstall).isGone = TIM_PACKAGE_NAME.isInstall findViewById<View>(R.id.main_text_tim_noinstall).isGone = TIM_PACKAGE_NAME.isInstall
@@ -147,31 +162,31 @@ class MainActivity : AppCompatActivity() {
val hideIconInLauncherSwitch = findViewById<SwitchCompat>(R.id.hide_icon_in_launcher_switch) val hideIconInLauncherSwitch = findViewById<SwitchCompat>(R.id.hide_icon_in_launcher_switch)
val notifyModuleInfoSwitch = findViewById<SwitchCompat>(R.id.notify_module_info_switch) val notifyModuleInfoSwitch = findViewById<SwitchCompat>(R.id.notify_module_info_switch)
/** 获取 Sp 存储的信息 */ /** 获取 Sp 存储的信息 */
qqTimProtectModeSwitch.isChecked = getBoolean(HookMedium.ENABLE_QQTIM_WHITE_MODE) qqTimProtectModeSwitch.isChecked = modulePrefs.getBoolean(ENABLE_QQTIM_WHITE_MODE)
qqTimCoreServiceSwitch.isChecked = getBoolean(HookMedium.ENABLE_QQTIM_CORESERVICE_BAN) qqTimCoreServiceSwitch.isChecked = modulePrefs.getBoolean(ENABLE_QQTIM_CORESERVICE_BAN)
qqTimCoreServiceKnSwitch.isChecked = getBoolean(HookMedium.ENABLE_QQTIM_CORESERVICE_CHILD_BAN) qqTimCoreServiceKnSwitch.isChecked = modulePrefs.getBoolean(ENABLE_QQTIM_CORESERVICE_CHILD_BAN)
wechatDisableHookSwitch.isChecked = getBoolean(HookMedium.DISABLE_WECHAT_HOOK) wechatDisableHookSwitch.isChecked = modulePrefs.getBoolean(DISABLE_WECHAT_HOOK)
hideIconInLauncherSwitch.isChecked = getBoolean(HookMedium.ENABLE_HIDE_ICON) hideIconInLauncherSwitch.isChecked = modulePrefs.getBoolean(ENABLE_HIDE_ICON)
notifyModuleInfoSwitch.isChecked = getBoolean(HookMedium.ENABLE_RUN_INFO) notifyModuleInfoSwitch.isChecked = modulePrefs.getBoolean(ENABLE_RUN_INFO)
qqTimProtectModeSwitch.setOnCheckedChangeListener { btn, b -> qqTimProtectModeSwitch.setOnCheckedChangeListener { btn, b ->
if (!btn.isPressed) return@setOnCheckedChangeListener if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.ENABLE_QQTIM_WHITE_MODE, b) modulePrefs.putBoolean(ENABLE_QQTIM_WHITE_MODE, b)
} }
qqTimCoreServiceSwitch.setOnCheckedChangeListener { btn, b -> qqTimCoreServiceSwitch.setOnCheckedChangeListener { btn, b ->
if (!btn.isPressed) return@setOnCheckedChangeListener if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.ENABLE_QQTIM_CORESERVICE_BAN, b) modulePrefs.putBoolean(ENABLE_QQTIM_CORESERVICE_BAN, b)
} }
qqTimCoreServiceKnSwitch.setOnCheckedChangeListener { btn, b -> qqTimCoreServiceKnSwitch.setOnCheckedChangeListener { btn, b ->
if (!btn.isPressed) return@setOnCheckedChangeListener if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.ENABLE_QQTIM_CORESERVICE_CHILD_BAN, b) modulePrefs.putBoolean(ENABLE_QQTIM_CORESERVICE_CHILD_BAN, b)
} }
wechatDisableHookSwitch.setOnCheckedChangeListener { btn, b -> wechatDisableHookSwitch.setOnCheckedChangeListener { btn, b ->
if (!btn.isPressed) return@setOnCheckedChangeListener if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.DISABLE_WECHAT_HOOK, b) modulePrefs.putBoolean(DISABLE_WECHAT_HOOK, b)
} }
hideIconInLauncherSwitch.setOnCheckedChangeListener { btn, b -> hideIconInLauncherSwitch.setOnCheckedChangeListener { btn, b ->
if (!btn.isPressed) return@setOnCheckedChangeListener if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.ENABLE_HIDE_ICON, b) modulePrefs.putBoolean(ENABLE_HIDE_ICON, b)
packageManager.setComponentEnabledSetting( packageManager.setComponentEnabledSetting(
ComponentName(this@MainActivity, "com.fankes.tsbattery.Home"), ComponentName(this@MainActivity, "com.fankes.tsbattery.Home"),
if (b) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED, if (b) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
@@ -180,7 +195,7 @@ class MainActivity : AppCompatActivity() {
} }
notifyModuleInfoSwitch.setOnCheckedChangeListener { btn, b -> notifyModuleInfoSwitch.setOnCheckedChangeListener { btn, b ->
if (!btn.isPressed) return@setOnCheckedChangeListener if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.ENABLE_RUN_INFO, b) modulePrefs.putBoolean(ENABLE_RUN_INFO, b)
} }
/** 快捷操作 QQ */ /** 快捷操作 QQ */
findViewById<View>(R.id.quick_qq_button).setOnClickListener { openSelfSetting(QQ_PACKAGE_NAME) } findViewById<View>(R.id.quick_qq_button).setOnClickListener { openSelfSetting(QQ_PACKAGE_NAME) }
@@ -190,7 +205,7 @@ class MainActivity : AppCompatActivity() {
findViewById<View>(R.id.quick_wechat_button).setOnClickListener { openSelfSetting(WECHAT_PACKAGE_NAME) } findViewById<View>(R.id.quick_wechat_button).setOnClickListener { openSelfSetting(WECHAT_PACKAGE_NAME) }
/** 恰饭! */ /** 恰饭! */
findViewById<View>(R.id.link_with_follow_me).setOnClickListener { findViewById<View>(R.id.link_with_follow_me).setOnClickListener {
try { runCatching {
startActivity(Intent().apply { startActivity(Intent().apply {
setPackage("com.coolapk.market") setPackage("com.coolapk.market")
action = "android.intent.action.VIEW" action = "android.intent.action.VIEW"
@@ -198,20 +213,20 @@ class MainActivity : AppCompatActivity() {
/** 防止顶栈一样重叠在自己的 APP 中 */ /** 防止顶栈一样重叠在自己的 APP 中 */
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
}) })
} catch (e: Exception) { }.onFailure {
Toast.makeText(this, "你可能没有安装酷安", Toast.LENGTH_SHORT).show() Toast.makeText(this, "你可能没有安装酷安", Toast.LENGTH_SHORT).show()
} }
} }
/** 项目地址点击事件 */ /** 项目地址点击事件 */
findViewById<View>(R.id.link_with_project_address).setOnClickListener { findViewById<View>(R.id.link_with_project_address).setOnClickListener {
try { runCatching {
startActivity(Intent().apply { startActivity(Intent().apply {
action = "android.intent.action.VIEW" action = "android.intent.action.VIEW"
data = Uri.parse("https://github.com/fankes/TSBattery") data = Uri.parse("https://github.com/fankes/TSBattery")
/** 防止顶栈一样重叠在自己的 APP 中 */ /** 防止顶栈一样重叠在自己的 APP 中 */
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
}) })
} catch (e: Exception) { }.onFailure {
Toast.makeText(this, "无法启动系统默认浏览器", Toast.LENGTH_SHORT).show() Toast.makeText(this, "无法启动系统默认浏览器", Toast.LENGTH_SHORT).show()
} }
} }
@@ -221,97 +236,5 @@ class MainActivity : AppCompatActivity() {
* 判断模块是否激活 * 判断模块是否激活
* @return [Boolean] 激活状态 * @return [Boolean] 激活状态
*/ */
private fun isHooked() = HookMedium.isHooked() private fun isHooked() = YukiHookModuleStatus.isActive() || isTaiChiModuleActive
override fun onResume() {
super.onResume()
setWorldReadable()
}
override fun onRestart() {
super.onRestart()
setWorldReadable()
}
override fun onPause() {
super.onPause()
setWorldReadable()
}
/**
* 获取保存的值
* @param key 名称
* @return [Boolean] 保存的值
*/
private fun getBoolean(key: String) =
getSharedPreferences(
packageName + "_preferences",
Context.MODE_PRIVATE
).getBoolean(key, false)
/**
* 保存值
* @param key 名称
* @param bool 值
*/
private fun putBoolean(key: String, bool: Boolean) {
getSharedPreferences(
packageName + "_preferences",
Context.MODE_PRIVATE
).edit().putBoolean(key, bool).apply()
setWorldReadable()
/** 延迟继续设置强制允许 SP 可读可写 */
Handler().postDelayed({ setWorldReadable() }, 500)
Handler().postDelayed({ setWorldReadable() }, 1000)
Handler().postDelayed({ setWorldReadable() }, 1500)
}
/**
* 保存值
* @param key 名称
* @param value 值
*/
private fun putString(key: String, value: String) {
getSharedPreferences(
packageName + "_preferences",
Context.MODE_PRIVATE
).edit().putString(key, value).apply()
setWorldReadable()
/** 延迟继续设置强制允许 SP 可读可写 */
Handler().postDelayed({ setWorldReadable() }, 500)
Handler().postDelayed({ setWorldReadable() }, 1000)
Handler().postDelayed({ setWorldReadable() }, 1500)
}
/**
* 强制设置 Sp 存储为全局可读可写
* 以供模块使用
*/
private fun setWorldReadable() {
try {
if (FileUtils.getDefaultPrefFile(this).exists()) {
for (file in arrayOf<File>(
FileUtils.getDataDir(this),
FileUtils.getPrefDir(this),
FileUtils.getDefaultPrefFile(this)
)) {
file.setReadable(true, false)
file.setExecutable(true, false)
}
}
} catch (_: Exception) {
Toast.makeText(this, "无法写入模块设置,请检查权限\n如果此提示一直显示,请不要双开模块", Toast.LENGTH_SHORT).show()
}
}
override fun onBackPressed() {
setWorldReadable()
super.onBackPressed()
}
override fun onDestroy() {
super.onDestroy()
/** 销毁实例防止内存泄漏 */
instance = null
}
} }

View File

@@ -1,20 +1,21 @@
/** /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,85 +0,0 @@
/*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
*
* This file is part of TSBattery.
*
* TSBattery is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* This file is Created by zpp0196 on 2019/2/9.
*/
package com.fankes.tsbattery.utils;
import android.content.Context;
import com.fankes.tsbattery.BuildConfig;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
@SuppressWarnings("ALL")
public class FileUtils {
private static final String FILE_PREF_NAME = BuildConfig.APPLICATION_ID + "_preferences.xml";
public static boolean copyFile(File srcFile, File targetFile) {
FileInputStream ins = null;
FileOutputStream out = null;
try {
if (targetFile.exists()) {
targetFile.delete();
}
File targetParent = targetFile.getParentFile();
if (!targetParent.exists()) {
targetParent.mkdirs();
}
targetFile.createNewFile();
ins = new FileInputStream(srcFile);
out = new FileOutputStream(targetFile);
byte[] b = new byte[1024];
int n;
while ((n = ins.read(b)) != -1) {
out.write(b, 0, n);
}
} catch (IOException e) {
e.printStackTrace();
return false;
} finally {
try {
if (ins != null) {
ins.close();
}
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return true;
}
public static File getDataDir(Context context) {
return new File(context.getApplicationInfo().dataDir);
}
public static File getPrefDir(Context context) {
return new File(getDataDir(context), "shared_prefs");
}
public static File getDefaultPrefFile(Context context) {
return new File(getPrefDir(context), FILE_PREF_NAME);
}
}

View File

@@ -1,20 +1,21 @@
/** /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */
@@ -26,11 +27,25 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageInfo import android.content.pm.PackageInfo
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.content.res.Configuration
import android.net.Uri import android.net.Uri
import android.provider.Settings import android.provider.Settings
import android.widget.Toast import android.widget.Toast
import com.fankes.tsbattery.application.TSApplication.Companion.appContext import com.fankes.tsbattery.application.TSApplication.Companion.appContext
/**
* 系统深色模式是否开启
* @return [Boolean] 是否开启
*/
val isSystemInDarkMode
get() = (appContext.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
/**
* 系统深色模式是否没开启
* @return [Boolean] 是否开启
*/
inline val isNotSystemInDarkMode get() = !isSystemInDarkMode
/** /**
* 得到安装包信息 * 得到安装包信息
* @return [PackageInfo] * @return [PackageInfo]
@@ -42,16 +57,15 @@ val Context.packageInfo get() = packageManager?.getPackageInfo(packageName, 0) ?
* @return [Boolean] * @return [Boolean]
*/ */
val String.isInstall val String.isInstall
get() = get() = try {
try { appContext.packageManager.getPackageInfo(
appContext.packageManager.getPackageInfo( this,
this, PackageManager.GET_UNINSTALLED_PACKAGES
PackageManager.GET_UNINSTALLED_PACKAGES )
) true
true } catch (e: Exception) {
} catch (e: Exception) { false
false }
}
/** /**
* 得到版本信息 * 得到版本信息

View File

@@ -1,38 +0,0 @@
/*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
*
* This file is part of TSBattery.
*
* TSBattery is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* This file is Created by zpp0196 on 2018/4/11.
*/
package com.fankes.tsbattery.utils
import de.robv.android.xposed.XSharedPreferences
object XPrefUtils {
fun getBoolean(key: String) = pref.getBoolean(key, false)
fun getString(key: String) = pref.getString(key, "unknown")
private val pref: XSharedPreferences
get() {
val preferences = XSharedPreferences("com.fankes.tsbattery")
preferences.makeWorldReadable()
preferences.reload()
return preferences
}
}

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,24 +1,24 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */
package com.fankes.tsbattery.utils.drawable.drawabletoolbox package com.fankes.tsbattery.utils.drawable.drawabletoolbox
class Constants { class Constants {

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,20 +1,21 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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.
*/ */

View File

@@ -1,24 +1,24 @@
/* /*
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com) * TSBattery - A new way to save your battery avoid cancer apps hacker it.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/TSBattery
* *
* This file is part of 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.
* *
* TSBattery is free software: you can redistribute it and/or modify * This software is distributed in the hope that it will be useful,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TSBattery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * Affero General Public License for more details.
* *
* You should have received a copy of the GNU 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/>. * and eula along with this software. If not, see
* <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")
package com.fankes.tsbattery.view package com.fankes.tsbattery.view

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#66A6A6A6" />
<corners android:radius="15dp" />
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#666E6E6E" />
<corners android:radius="15dp" />
</shape>

View File

@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorThemeBackground"
android:orientation="vertical" android:orientation="vertical"
tools:context=".ui.MainActivity" tools:context=".ui.MainActivity"
tools:ignore="HardcodedText,UseCompoundDrawables,ContentDescription,TooManyViews"> tools:ignore="HardcodedText,UseCompoundDrawables,ContentDescription,TooManyViews">
@@ -11,7 +12,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white"
android:elevation="0dp" android:elevation="0dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingTop="13dp" android:paddingTop="13dp"
@@ -23,8 +23,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:text="TSBattery" android:text="TSBattery"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="30sp" android:textSize="25sp"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
@@ -36,7 +36,7 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:background="@drawable/dark_round" android:background="@drawable/bg_dark_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center"> android:gravity="center">
@@ -46,7 +46,7 @@
android:layout_height="25dp" android:layout_height="25dp"
android:layout_marginStart="25dp" android:layout_marginStart="25dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:src="@mipmap/warn" android:src="@mipmap/ic_warn"
android:tint="@color/white" /> android:tint="@color/white" />
<LinearLayout <LinearLayout
@@ -88,7 +88,7 @@
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:src="@mipmap/qq_icon" /> android:src="@mipmap/ic_qq_icon" />
<TextView <TextView
android:id="@+id/main_text_qq_noinstall" android:id="@+id/main_text_qq_noinstall"
@@ -96,7 +96,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:alpha="0.8" android:alpha="0.8"
android:background="@drawable/red_round" android:background="@drawable/bg_red_round"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingRight="2dp" android:paddingRight="2dp"
@@ -138,7 +138,7 @@
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:src="@mipmap/tim_icon" /> android:src="@mipmap/ic_tim_icon" />
<TextView <TextView
android:id="@+id/main_text_tim_noinstall" android:id="@+id/main_text_tim_noinstall"
@@ -146,7 +146,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:alpha="0.8" android:alpha="0.8"
android:background="@drawable/red_round" android:background="@drawable/bg_red_round"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingRight="2dp" android:paddingRight="2dp"
@@ -187,7 +187,7 @@
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:src="@mipmap/wechat_icon" /> android:src="@mipmap/ic_wechat_icon" />
<TextView <TextView
android:id="@+id/main_text_wechat_noinstall" android:id="@+id/main_text_wechat_noinstall"
@@ -195,7 +195,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:alpha="0.8" android:alpha="0.8"
android:background="@drawable/red_round" android:background="@drawable/bg_red_round"
android:paddingLeft="2dp" android:paddingLeft="2dp"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingRight="2dp" android:paddingRight="2dp"
@@ -247,7 +247,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
@@ -258,8 +258,8 @@
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="15dp" android:layout_marginEnd="15dp"
android:alpha="0.85" android:alpha="0.85"
android:src="@mipmap/about" android:src="@mipmap/ic_about"
android:tint="#FF777777" /> android:tint="@color/colorTextDark" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -267,7 +267,7 @@
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="5dp" android:lineSpacingExtra="5dp"
android:text="上述列出的版本号为最佳兼容版本,你可以点击进行查看。\n没有标注的版本在适配范围内的 APP 适用性都将有效,但可能不能达到最佳使用效果。\n如果当前版本失效请看下方的联系方式。" android:text="上述列出的版本号为最佳兼容版本,你可以点击进行查看。\n没有标注的版本在适配范围内的 APP 适用性都将有效,但可能不能达到最佳使用效果。\n如果当前版本失效请看下方的联系方式。"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="10sp" android:textSize="10sp"
tools:ignore="SmallSp" /> tools:ignore="SmallSp" />
</LinearLayout> </LinearLayout>
@@ -278,7 +278,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -294,13 +294,13 @@
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:src="@mipmap/qq_icon" /> android:src="@mipmap/ic_qq_icon" />
<ImageView <ImageView
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:src="@mipmap/tim_icon" /> android:src="@mipmap/ic_tim_icon" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -308,7 +308,7 @@
android:alpha="0.85" android:alpha="0.85"
android:singleLine="true" android:singleLine="true"
android:text="QQ、TIM" android:text="QQ、TIM"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -317,7 +317,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="启用保守模式 [QQ]" android:text="启用保守模式 [QQ]"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -327,7 +327,7 @@
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="此选项默认关闭,默认情况下模块将会干掉 QQ 自身的电源锁控制类,开启后模块将只对系统电源锁生效,如果你的 QQ 视频通话等设置发生了故障,可以尝试开启这个功能,开启后请重启 QQ。" android:text="此选项默认关闭,默认情况下模块将会干掉 QQ 自身的电源锁控制类,开启后模块将只对系统电源锁生效,如果你的 QQ 视频通话等设置发生了故障,可以尝试开启这个功能,开启后请重启 QQ。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<com.fankes.tsbattery.view.MaterialSwitch <com.fankes.tsbattery.view.MaterialSwitch
@@ -335,7 +335,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="关闭 CoreService" android:text="关闭 CoreService"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -345,7 +345,7 @@
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="关闭后可能会影响消息接收与视频通话,但是会达到省电效果,如果你的系统拥有推送服务(HMS)或(GMS)可以尝试关闭。" android:text="关闭后可能会影响消息接收与视频通话,但是会达到省电效果,如果你的系统拥有推送服务(HMS)或(GMS)可以尝试关闭。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<com.fankes.tsbattery.view.MaterialSwitch <com.fankes.tsbattery.view.MaterialSwitch
@@ -353,7 +353,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="关闭 CoreService$KernelService" android:text="关闭 CoreService$KernelService"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -362,7 +362,7 @@
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="这是一个辅助子服务,理论主服务关闭后子服务同样不会被启动,建议在保证消息接收的前提下可以尝试关闭子服务。" android:text="这是一个辅助子服务,理论主服务关闭后子服务同样不会被启动,建议在保证消息接收的前提下可以尝试关闭子服务。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -372,7 +372,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -388,7 +388,7 @@
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:src="@mipmap/wechat_icon" /> android:src="@mipmap/ic_wechat_icon" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -396,7 +396,7 @@
android:alpha="0.85" android:alpha="0.85"
android:singleLine="true" android:singleLine="true"
android:text="微信" android:text="微信"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -405,7 +405,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="停用省电策略" android:text="停用省电策略"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -414,7 +414,7 @@
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="选择停用后模块将不再对微信生效,可解决通话耳边不会黑屏和闪退问题,微信省电功能依然在开(画)发(饼),敬请期待。" android:text="选择停用后模块将不再对微信生效,可解决通话耳边不会黑屏和闪退问题,微信省电功能依然在开(画)发(饼),敬请期待。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -424,7 +424,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -440,7 +440,7 @@
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:src="@mipmap/shot_icon" /> android:src="@mipmap/ic_shot_icon" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -448,7 +448,7 @@
android:alpha="0.85" android:alpha="0.85"
android:singleLine="true" android:singleLine="true"
android:text="快捷操作" android:text="快捷操作"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -462,12 +462,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/button_round" android:background="@drawable/bg_button_round"
android:gravity="center" android:gravity="center"
android:padding="10dp" android:padding="10dp"
android:singleLine="true" android:singleLine="true"
android:text="QQ" android:text="QQ"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -476,12 +476,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/button_round" android:background="@drawable/bg_button_round"
android:gravity="center" android:gravity="center"
android:padding="10dp" android:padding="10dp"
android:singleLine="true" android:singleLine="true"
android:text="TIM" android:text="TIM"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -489,12 +489,12 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/button_round" android:background="@drawable/bg_button_round"
android:gravity="center" android:gravity="center"
android:padding="10dp" android:padding="10dp"
android:singleLine="true" android:singleLine="true"
android:text="微信" android:text="微信"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -505,7 +505,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -517,7 +517,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="提示模块运行信息" android:text="提示模块运行信息"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -527,7 +527,7 @@
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="模块工作正常情况下无需开启,如果你想测试模块是否正常激活,可以打开此提示,开启后将会在启动 QQ、TIM 或微信的时候提示运行信息。" android:text="模块工作正常情况下无需开启,如果你想测试模块是否正常激活,可以打开此提示,开启后将会在启动 QQ、TIM 或微信的时候提示运行信息。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -537,7 +537,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -549,7 +549,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="在桌面隐藏模块图标" android:text="在桌面隐藏模块图标"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
<TextView <TextView
@@ -558,8 +558,8 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="隐藏模块图标后,模块不会再在桌面显示,你可以在 EdXposed、太极、LsPosed 中找到模块设置并打开,对原生系统无效。" android:text="隐藏模块图标后,模块不会再在桌面显示,你可以在 EdXposed、太极、LSPosed 中找到模块设置并打开,对原生系统无效。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -569,7 +569,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -586,8 +586,8 @@
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:alpha="0.85" android:alpha="0.85"
android:src="@mipmap/about" android:src="@mipmap/ic_about"
android:tint="#FF323B42" /> android:tint="@color/colorTextGray" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -595,7 +595,7 @@
android:alpha="0.85" android:alpha="0.85"
android:singleLine="true" android:singleLine="true"
android:text="使用帮助与说明" android:text="使用帮助与说明"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -606,7 +606,7 @@
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.这个模块是做什么的?\nA.此模块的诞生来源于国内厂商毒瘤 APP 强行霸占后台耗电QQ 在 8.6.0 版本以后也只是接入了 HMS 推送,但是可笑的是开发组却并没有删除之前疯狂耗电的接收消息方法,于是这个模块就诞生了。" android:text="Q.这个模块是做什么的?\nA.此模块的诞生来源于国内厂商毒瘤 APP 强行霸占后台耗电QQ 在 8.6.0 版本以后也只是接入了 HMS 推送,但是可笑的是开发组却并没有删除之前疯狂耗电的接收消息方法,于是这个模块就诞生了。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@@ -616,7 +616,7 @@
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.原理是什么?\nA.模块有两套工作方式,一种是针对 QQ、TIM Hook 掉系统自身的电源锁“WakeLock”使其不能影响系统休眠这样子在锁屏的时候 QQ、TIM 就可以进入睡眠状态。第二种就是针对 QQ、TIM 删除其自身的无用耗电疯狂循环检测后台强行保活服务。" android:text="Q.原理是什么?\nA.模块有两套工作方式,一种是针对 QQ、TIM Hook 掉系统自身的电源锁“WakeLock”使其不能影响系统休眠这样子在锁屏的时候 QQ、TIM 就可以进入睡眠状态。第二种就是针对 QQ、TIM 删除其自身的无用耗电疯狂循环检测后台强行保活服务。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@@ -625,8 +625,8 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.如何使用?\nA.目前模块支持 EdXposed、LsPosed 以及太极(无极)框架,在太极和 LsPosed 的作用域中,只需勾选 QQ 和 TIM 即可,模块可以做到即插即用,激活后无需重启手机,重启 QQTIM 就可以了。" android:text="Q.如何使用?\nA.目前模块支持 LSPosed、EdXposed 以及太极(无极)框架,在太极和 LSPosed 的作用域中,只需勾选 QQ、TIM、微信即可,模块可以做到即插即用,激活后无需重启手机,重启 QQTIM 或微信就可以了。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@@ -635,8 +635,8 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.激活后一定可以非常省电吗?\nA.并不,模块只能减少 QQ、TIM 的耗电,但是请务必记住这一点,省电只是一个理论上的东西,实际水平由你使用的系统和硬件决定,如果你在前台疯狂使用 QQ、TIM那么照样会耗电模块只能保证后台运行和锁屏时毒瘤不会消耗过多的无用的电量仅此而已。" android:text="Q.激活后一定可以非常省电吗?\nA.并不,模块只能减少 QQ、TIM、微信的耗电,但是请务必记住这一点,省电只是一个理论上的东西,实际水平由你使用的系统和硬件决定,如果你在前台疯狂使用 QQ、TIM那么照样会耗电模块只能保证后台运行和锁屏时毒瘤不会消耗过多的无用的电量仅此而已。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@@ -646,7 +646,7 @@
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.模块是否需要挂后台?\nA.模块完全不需要挂后台,模块只是一个控制和显示的工具,真正的任务交由 Hook 处理,若出现失效的情况请发送模块运行日志给我们而不是将模块挂后台。" android:text="Q.模块是否需要挂后台?\nA.模块完全不需要挂后台,模块只是一个控制和显示的工具,真正的任务交由 Hook 处理,若出现失效的情况请发送模块运行日志给我们而不是将模块挂后台。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@@ -656,7 +656,7 @@
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.关于目前微信的适配情况?\nA.微信适配尚在实验阶段,敬请期待。" android:text="Q.关于目前微信的适配情况?\nA.微信适配尚在实验阶段,敬请期待。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@@ -665,8 +665,8 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.如何对单独的 APP 生效模块?\nA.请在 LsPosed 中勾选对应定义域即可,我们不建议使用 EdXposed。" android:text="Q.如何对单独的 APP 生效模块?\nA.请在 LSPosed 中勾选对应定义域即可,我们不建议使用 EdXposed。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@@ -675,7 +675,7 @@
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="Q.如何反馈问题?\nA.酷安关注 @星夜不荟" android:text="Q.如何反馈问题?\nA.酷安关注 @星夜不荟"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -686,7 +686,7 @@
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -703,8 +703,8 @@
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:alpha="0.85" android:alpha="0.85"
android:src="@mipmap/about" android:src="@mipmap/ic_about"
android:tint="#FF323B42" /> android:tint="@color/colorTextGray" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -712,7 +712,7 @@
android:alpha="0.85" android:alpha="0.85"
android:singleLine="true" android:singleLine="true"
android:text="项目地址" android:text="项目地址"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -721,8 +721,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha="0.8" android:alpha="0.8"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="本软件是免费开源项目,遵循 GPL 协议,你可以点击这里前往 Github 查看源码以及获取模块更新。\n严禁以任何形式贩卖、商用本软件否则开发者有权追究其法律责任。" android:text="本软件是免费开源项目,遵循 AGPL3.0 协议,你可以点击这里前往 Github 查看源码以及获取模块更新。"
android:textColor="#777777" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@@ -733,7 +733,7 @@
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:background="@drawable/permotion_round" android:background="@drawable/bg_permotion_round"
android:elevation="0dp" android:elevation="0dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
@@ -749,7 +749,7 @@
android:gravity="center" android:gravity="center"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="恰饭时间\n点击前往酷安关注我获取我的更多应用" android:text="恰饭时间\n点击前往酷安关注我获取我的更多应用"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="16sp" /> android:textSize="16sp" />
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
@@ -762,7 +762,7 @@
<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/qr_pay" /> android:src="@mipmap/bg_qr_pay" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<TextView <TextView
@@ -772,9 +772,23 @@
android:gravity="center" android:gravity="center"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="开发者 酷安 @星夜不荟\n未经允许不得转载、修改复制我的劳动成果" android:text="开发者 酷安 @星夜不荟\n未经允许不得转载、修改复制我的劳动成果"
android:textColor="#FF323B42" android:textColor="@color/colorTextGray"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
android:autoLink="web"
android:background="@drawable/bg_permotion_round"
android:lineSpacingExtra="6dp"
android:padding="10dp"
android:text="此模块使用 YukiHookAPI 构建。\n点击这里了解更多 https://github.com/fankes/YukiHookAPI"
android:textColor="@color/colorTextGray"
android:textSize="12sp" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</LinearLayout> </LinearLayout>

View File

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 201 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorThemeBackground">#FF2D2D2D</color>
<color name="colorTextDark">#FFCFCFCF</color>
<color name="colorTextGray">#FFD3D3D3</color>
</resources>

View File

@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.TSBattery" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.TSBattery" parent="Theme.Material3.DayNight">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item> <item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorPrimaryVariant">@color/purple_700</item>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorThemeBackground">#FFFFFFFF</color>
<color name="colorTextDark">#FF777777</color>
<color name="colorTextGray">#FF323B42</color>
</resources>

View File

@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.TSBattery" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.TSBattery" parent="Theme.Material3.DayNight">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item> <item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorPrimaryVariant">@color/purple_700</item>

View File

@@ -1,30 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins {
buildscript { id 'com.android.application' version '7.1.2' apply false
ext.kotlin_version = "1.6.10" id 'com.android.library' version '7.1.2' apply false
repositories { id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
google()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url "https://www.jitpack.io" }
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
} }
allprojects { ext {
repositories { appVersionName = "3.2"
google() appVersionCode = 11
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url "https://www.jitpack.io" }
mavenCentral()
}
} }
task clean(type: Delete) { task clean(type: Delete) {

View File

@@ -1,6 +1,6 @@
#Sat Sep 04 04:05:23 CST 2021 #Mon Feb 14 23:27:58 CST 2022
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@@ -1,2 +1,18 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
maven { url "https://api.xposed.info/" }
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
mavenCentral()
}
}
rootProject.name = "TSBattery" rootProject.name = "TSBattery"
include ':app' include ':app'