mirror of
https://github.com/fankes/TSBattery.git
synced 2025-09-07 03:06:06 +08:00
优化代码
This commit is contained in:
@@ -115,7 +115,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
*/
|
*/
|
||||||
private fun PackageParam.interceptBaseChatPie(methodName: String) =
|
private fun PackageParam.interceptBaseChatPie(methodName: String) =
|
||||||
findClass(QQ_BASE_CHAT_PIE).hook {
|
findClass(QQ_BASE_CHAT_PIE).hook {
|
||||||
injectMember(tag = "BaseChatPie") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = methodName
|
name = methodName
|
||||||
returnType = UnitType
|
returnType = UnitType
|
||||||
@@ -127,7 +127,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
/** Hook 系统电源锁 */
|
/** Hook 系统电源锁 */
|
||||||
private fun PackageParam.hookSystemWakeLock() =
|
private fun PackageParam.hookSystemWakeLock() =
|
||||||
PowerManager_WakeLockClass.hook {
|
PowerManager_WakeLockClass.hook {
|
||||||
injectMember(tag = "WakeLock acquire") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "acquireLocked"
|
name = "acquireLocked"
|
||||||
returnType = UnitType
|
returnType = UnitType
|
||||||
@@ -139,7 +139,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
/** 增加通知栏文本显示守护状态 */
|
/** 增加通知栏文本显示守护状态 */
|
||||||
private fun PackageParam.hookNotification() =
|
private fun PackageParam.hookNotification() =
|
||||||
Notification_BuilderClass.hook {
|
Notification_BuilderClass.hook {
|
||||||
injectMember(tag = "Notification") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "setContentText"
|
name = "setContentText"
|
||||||
param(CharSequenceType)
|
param(CharSequenceType)
|
||||||
@@ -169,7 +169,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* QQ 和 TIM 都是一样的类
|
* QQ 和 TIM 都是一样的类
|
||||||
* 在里面加入提示运行信息的对话框测试模块是否激活
|
* 在里面加入提示运行信息的对话框测试模块是否激活
|
||||||
*/
|
*/
|
||||||
injectMember(tag = "SplashActivity") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "doOnCreate"
|
name = "doOnCreate"
|
||||||
param(BundleClass)
|
param(BundleClass)
|
||||||
@@ -202,7 +202,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* Hook 启动界面的第一个 [Activity]
|
* Hook 启动界面的第一个 [Activity]
|
||||||
* 在里面加入提示运行信息的对话框测试模块是否激活
|
* 在里面加入提示运行信息的对话框测试模块是否激活
|
||||||
*/
|
*/
|
||||||
injectMember(tag = "LauncherUI") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "onCreate"
|
name = "onCreate"
|
||||||
param(BundleClass)
|
param(BundleClass)
|
||||||
@@ -238,18 +238,18 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
if (prefs.getBoolean(ENABLE_QQTIM_CORESERVICE_BAN))
|
if (prefs.getBoolean(ENABLE_QQTIM_CORESERVICE_BAN))
|
||||||
findClass(name = "$QQ_PACKAGE_NAME.app.CoreService").hook {
|
findClass(name = "$QQ_PACKAGE_NAME.app.CoreService").hook {
|
||||||
if (isQQ) {
|
if (isQQ) {
|
||||||
injectMember(tag = "CoreService startTemp") {
|
injectMember {
|
||||||
method { name = "startTempService" }
|
method { name = "startTempService" }
|
||||||
intercept()
|
intercept()
|
||||||
}
|
}
|
||||||
injectMember(tag = "CoreService startCore") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "startCoreService"
|
name = "startCoreService"
|
||||||
param(BooleanType)
|
param(BooleanType)
|
||||||
}
|
}
|
||||||
intercept()
|
intercept()
|
||||||
}
|
}
|
||||||
injectMember(tag = "CoreService startCommand") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "onStartCommand"
|
name = "onStartCommand"
|
||||||
param(IntentClass, IntType, IntType)
|
param(IntentClass, IntType, IntType)
|
||||||
@@ -257,7 +257,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
replaceTo(any = 2)
|
replaceTo(any = 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
injectMember(tag = "CoreService onCreate") {
|
injectMember {
|
||||||
method { name = "onCreate" }
|
method { name = "onCreate" }
|
||||||
afterHook {
|
afterHook {
|
||||||
instance<Service>().apply {
|
instance<Service>().apply {
|
||||||
@@ -270,7 +270,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}
|
}
|
||||||
if (prefs.getBoolean(ENABLE_QQTIM_CORESERVICE_CHILD_BAN))
|
if (prefs.getBoolean(ENABLE_QQTIM_CORESERVICE_CHILD_BAN))
|
||||||
findClass(name = "$QQ_PACKAGE_NAME.app.CoreService\$KernelService").hook {
|
findClass(name = "$QQ_PACKAGE_NAME.app.CoreService\$KernelService").hook {
|
||||||
injectMember(tag = "CoreService\$KernelService onCreate") {
|
injectMember {
|
||||||
method { name = "onCreate" }
|
method { name = "onCreate" }
|
||||||
afterHook {
|
afterHook {
|
||||||
instance<Service>().apply {
|
instance<Service>().apply {
|
||||||
@@ -280,7 +280,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
injectMember(tag = "CoreService\$KernelService startCommand") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "onStartCommand"
|
name = "onStartCommand"
|
||||||
param(IntentClass, IntType, IntType)
|
param(IntentClass, IntType, IntType)
|
||||||
@@ -303,7 +303,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
if (prefs.getBoolean(ENABLE_QQTIM_WHITE_MODE)) return@loadApp
|
if (prefs.getBoolean(ENABLE_QQTIM_WHITE_MODE)) return@loadApp
|
||||||
/** 通过在 SplashActivity 里取到应用的版本号 */
|
/** 通过在 SplashActivity 里取到应用的版本号 */
|
||||||
findClass(name = "$QQ_PACKAGE_NAME.activity.SplashActivity").hook {
|
findClass(name = "$QQ_PACKAGE_NAME.activity.SplashActivity").hook {
|
||||||
injectMember(tag = "BaseChatPie(first time)") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "doOnCreate"
|
name = "doOnCreate"
|
||||||
param(BundleClass)
|
param(BundleClass)
|
||||||
@@ -316,7 +316,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* 同样直接干掉
|
* 同样直接干掉
|
||||||
*/
|
*/
|
||||||
findClass(name = "com.tencent.mars.ilink.comm.WakerLock").hook {
|
findClass(name = "com.tencent.mars.ilink.comm.WakerLock").hook {
|
||||||
injectMember(tag = "WakerLock") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "lock"
|
name = "lock"
|
||||||
param(LongType)
|
param(LongType)
|
||||||
@@ -330,7 +330,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口的解锁后拉起保活界面,也是毒瘤
|
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口的解锁后拉起保活界面,也是毒瘤
|
||||||
*/
|
*/
|
||||||
findClass(name = "$QQ_PACKAGE_NAME.activity.QQLSUnlockActivity").hook {
|
findClass(name = "$QQ_PACKAGE_NAME.activity.QQLSUnlockActivity").hook {
|
||||||
injectMember(tag = "QQLSActivity") {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "onCreate"
|
name = "onCreate"
|
||||||
param(BundleClass)
|
param(BundleClass)
|
||||||
@@ -356,7 +356,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口
|
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口
|
||||||
*/
|
*/
|
||||||
findClass(name = "$QQ_PACKAGE_NAME.activity.QQLSActivity\$14").hook {
|
findClass(name = "$QQ_PACKAGE_NAME.activity.QQLSActivity\$14").hook {
|
||||||
injectMember(tag = "QQLSActivity\$14") {
|
injectMember {
|
||||||
method { name = "run" }
|
method { name = "run" }
|
||||||
intercept()
|
intercept()
|
||||||
}.ignoredAllFailure()
|
}.ignoredAllFailure()
|
||||||
@@ -371,61 +371,59 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* 👮🏻 经过排查 Play 版本没这个类...... Emmmm 不想说啥了
|
* 👮🏻 经过排查 Play 版本没这个类...... Emmmm 不想说啥了
|
||||||
*/
|
*/
|
||||||
findClass(name = "com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor").hook {
|
findClass(name = "com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor").hook {
|
||||||
("WakeLockMonitor").also { tag ->
|
injectMember {
|
||||||
injectMember(tag) {
|
method {
|
||||||
method {
|
name = "onHook"
|
||||||
name = "onHook"
|
param(StringType, AnyType, AnyArrayClass(AnyType), AnyType)
|
||||||
param(StringType, AnyType, AnyArrayClass(AnyType), AnyType)
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
}
|
||||||
injectMember(tag) {
|
intercept()
|
||||||
method {
|
}
|
||||||
name = "doReport"
|
injectMember {
|
||||||
param(("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity").clazz, IntType)
|
method {
|
||||||
}
|
name = "doReport"
|
||||||
intercept()
|
param(("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity").clazz, IntType)
|
||||||
}
|
}
|
||||||
injectMember(tag) {
|
intercept()
|
||||||
method {
|
}
|
||||||
name = "afterHookedMethod"
|
injectMember {
|
||||||
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
|
method {
|
||||||
}
|
name = "afterHookedMethod"
|
||||||
intercept()
|
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
|
||||||
}
|
}
|
||||||
injectMember(tag) {
|
intercept()
|
||||||
method {
|
}
|
||||||
name = "beforeHookedMethod"
|
injectMember {
|
||||||
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
|
method {
|
||||||
}
|
name = "beforeHookedMethod"
|
||||||
intercept()
|
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
|
||||||
}
|
}
|
||||||
injectMember(tag) {
|
intercept()
|
||||||
method { name = "onAppBackground" }
|
}
|
||||||
intercept()
|
injectMember {
|
||||||
|
method { name = "onAppBackground" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onOtherProcReport"
|
||||||
|
param(BundleClass)
|
||||||
}
|
}
|
||||||
injectMember(tag) {
|
intercept()
|
||||||
method {
|
}
|
||||||
name = "onOtherProcReport"
|
injectMember {
|
||||||
param(BundleClass)
|
method { name = "onProcessRun30Min" }
|
||||||
}
|
intercept()
|
||||||
intercept()
|
}
|
||||||
}
|
injectMember {
|
||||||
injectMember(tag) {
|
method { name = "onProcessBG5Min" }
|
||||||
method { name = "onProcessRun30Min" }
|
intercept()
|
||||||
intercept()
|
}
|
||||||
}
|
injectMember {
|
||||||
injectMember(tag) {
|
method {
|
||||||
method { name = "onProcessBG5Min" }
|
name = "writeReport"
|
||||||
intercept()
|
param(BooleanType)
|
||||||
}
|
|
||||||
injectMember(tag) {
|
|
||||||
method {
|
|
||||||
name = "writeReport"
|
|
||||||
param(BooleanType)
|
|
||||||
}
|
|
||||||
intercept()
|
|
||||||
}
|
}
|
||||||
|
intercept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user