/
*
*
*
开屏广告钩子
*
/
class
SplashHook(classLoader: ClassLoader) : BaseHook(classLoader) {
override fun startHook() {
try
{
/
/
获取LoadingActivity类
val clsLoadingActivity
=
XposedHelpers.findClass(
"gov.pianzong.androidnga.activity.LoadingActivity"
,
mClassLoader
)
/
/
Hook toForeGround 方法
XposedHelpers.findAndHookMethod(
"com.donews.nga.interfaces.ActivityLifecycleImpl"
,
mClassLoader,
"toForeGround"
,
Activity::
class
.java,
object
: XC_MethodHook() {
@Throws
(Throwable::
class
)
override fun beforeHookedMethod(param: MethodHookParam?) {
super
.beforeHookedMethod(param)
val activity
=
param?.args?.get(
0
) as Activity
if
(activity.javaClass
=
=
clsLoadingActivity) {
Log.d(
"跳过启动页"
)
XposedHelpers.setBooleanField(activity,
"canJump"
, true)
XposedHelpers.setBooleanField(activity,
"isADShow"
, true)
XposedHelpers.callMethod(activity,
"goHome"
)
}
/
/
Log.d(activity.toString())
}
})
/
/
修改时间戳实现切屏无广告
XposedHelpers.findAndHookMethod(
"com.donews.nga.common.utils.SPUtil"
,
mClassLoader,
"getInt"
,
String::
class
.java,
Int
::
class
.java,
object
: XC_MethodHook() {
@Throws
(Throwable::
class
)
override fun afterHookedMethod(param: MethodHookParam) {
when (param.args[
0
] as String) {
"AD_FORGROUND_TIME"
-
> {
Log.d(
"FG "
+
param.result.toString())
param.result
=
0
}
"AD_BACKGROUND_TIME"
-
> {
Log.d(
"BG "
+
param.result.toString())
param.result
=
0
}
}
}
})
/
/
也可以Hook这个方法实现去开屏广告
/
/
但是类名被混淆,会随着应用版本变动
/
/
XposedHelpers.findAndHookMethod(
/
/
"mg.b"
,
/
/
mClassLoader,
/
/
"a"
,
/
/
Context::
class
.java,
/
/
object
: XC_MethodReplacement() {
/
/
override fun replaceHookedMethod(param: MethodHookParam?):
Int
{
/
/
return
0
;
/
/
}
/
/
})
} catch (e: Exception) {
Log.e(e)
}
}
}