mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-06 10:45:20 +08:00
加入旧版状态栏小图标 Hook 方式日志记录 TAG
This commit is contained in:
@@ -315,11 +315,13 @@ class HookMain : IXposedHookLoadPackage {
|
|||||||
* @param context 实例
|
* @param context 实例
|
||||||
* @param expandedNf 通知实例
|
* @param expandedNf 通知实例
|
||||||
* @param param Hook Param
|
* @param param Hook Param
|
||||||
|
* @param isLegacyWay 旧版本 Hook 方式
|
||||||
*/
|
*/
|
||||||
private fun XC_LoadPackage.LoadPackageParam.hookSmallIconOnSet(
|
private fun XC_LoadPackage.LoadPackageParam.hookSmallIconOnSet(
|
||||||
context: Context,
|
context: Context,
|
||||||
expandedNf: StatusBarNotification?,
|
expandedNf: StatusBarNotification?,
|
||||||
param: XC_MethodHook.MethodHookParam
|
param: XC_MethodHook.MethodHookParam,
|
||||||
|
isLegacyWay: Boolean,
|
||||||
) {
|
) {
|
||||||
runWithoutError(error = "GetSmallIconOnSet") {
|
runWithoutError(error = "GetSmallIconOnSet") {
|
||||||
/** 获取通知小图标 */
|
/** 获取通知小图标 */
|
||||||
@@ -350,21 +352,23 @@ class HookMain : IXposedHookLoadPackage {
|
|||||||
logD(
|
logD(
|
||||||
content = "GetSmallIconOnSet -> " +
|
content = "GetSmallIconOnSet -> " +
|
||||||
"hook Custom AppIcon [pkgName] ${notifyInstance.opPkgName} " +
|
"hook Custom AppIcon [pkgName] ${notifyInstance.opPkgName} " +
|
||||||
"[appName] ${findAppName(notifyInstance)}"
|
"[appName] ${findAppName(notifyInstance)}\n" +
|
||||||
|
"[legacyWay] $isLegacyWay"
|
||||||
) { param.result = customIcon }
|
) { param.result = customIcon }
|
||||||
/** 若不是灰度图标自动处理为圆角 */
|
/** 若不是灰度图标自动处理为圆角 */
|
||||||
isNotGrayscaleIcon ->
|
isNotGrayscaleIcon ->
|
||||||
logD(
|
logD(
|
||||||
content = "GetSmallIconOnSet -> " +
|
content = "GetSmallIconOnSet -> " +
|
||||||
"hook Color AppIcon [pkgName] ${notifyInstance.opPkgName} " +
|
"hook Color AppIcon [pkgName] ${notifyInstance.opPkgName} " +
|
||||||
"[appName] ${findAppName(notifyInstance)}"
|
"[appName] ${findAppName(notifyInstance)}\n" +
|
||||||
|
"[legacyWay] $isLegacyWay"
|
||||||
) {
|
) {
|
||||||
param.result = Icon.createWithBitmap(
|
param.result = Icon.createWithBitmap(
|
||||||
iconDrawable.toBitmap().round(15.dp(context))
|
iconDrawable.toBitmap().round(15.dp(context))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ?: logW(content = "GetSmallIconOnSet -> StatusBarNotification got null")
|
} ?: logW(content = "GetSmallIconOnSet -> StatusBarNotification got null [legacyWay] $isLegacyWay")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,7 +682,8 @@ class HookMain : IXposedHookLoadPackage {
|
|||||||
runWithoutError(error = "GetSmallIconDoing") {
|
runWithoutError(error = "GetSmallIconDoing") {
|
||||||
lpparam.hookSmallIconOnSet(
|
lpparam.hookSmallIconOnSet(
|
||||||
context = lpparam.globalContext ?: param.args[0] as Context,
|
context = lpparam.globalContext ?: param.args[0] as Context,
|
||||||
param.args?.get(if (isTooOld) 1 else 0) as? StatusBarNotification?, param
|
param.args?.get(if (isTooOld) 1 else 0) as? StatusBarNotification?, param,
|
||||||
|
isLegacyWay = isTooOld
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user