乐呵呵、欢的博客

lehhair's Blog

来自安卓的神器-thanox 以及如何使用它解决qq消息代收(magisk and xposed)

233
2022-07-17

首先感谢thanox的开发大大@Tornaco 还有酷友@cherish0319

全文使用TIM作为例子,如你使用的是QQ请自行替换包名

应用场景

  • 使用手机的主要目的是接收信息提醒
  • 只会接收私信和群聊的艾特信息
  • 后面也会有消息刷新的方案,耗电可能增加

步骤一

  • 安装并登录qq手表版注意,是在手机上

  • 使用qq手表的开机自启动情景模式和保活模式

    [
    {
    "name": "开机自启动qq手表",
    "description": "qq手表启动推送服务",
    "priority": 2,
    "condition": "systemReady==true",
    "actions": [
    "su.exe(\"am start-foreground-service com.tencent.qqlite/com.tencent.mobileqq.app.CoreService\")",
    "su.exe(\"am start-foreground-service com.tencent.qqlite/com.tencent.mobileqq.msf.service.MsfService\")"
    ]
    }
    ]
    
    [
    {
    "name": "保活qq手表",
    "description": "qq手表",
    "priority": 2,
    "condition": "pkgKilled == true && pkgName == \"com.tencent.qqlite\"",
    "actions": [
    "su.exe(\"am start-foreground-service com.tencent.qqlite/com.tencent.mobileqq.app.CoreService\")",
    "su.exe(\"am start-foreground-service com.tencent.qqlite/com.tencent.mobileqq.msf.service.MsfService\")"
    ]
    }
    ]
    
    [
    {
    "name": "保活qq手表",
    "description": "beta2",
    "priority": 2,
    "condition": "thanos.activityManager.isPackageRunning(\"com.tencent.qqlite\") == false",
    "actions": [
    "su.exe(\"am start-foreground-service com.tencent.qqlite/com.tencent.mobileqq.app.CoreService\")",
    "su.exe(\"am start-foreground-service com.tencent.qqlite/com.tencent.mobileqq.msf.service.MsfService\")"
    ]
    }
    ]
    

    ps:这里有两个保活只需要使用一个,两种不同的写法而已

步骤二

  • 明确自己的需求选用不同的模式
  • 模式一:不拉起tim后台,仅第一条可以看见消息内容,后续有提醒但是没有详情
    [
    {
    "name": "1检测到qq推送通知拉起tim",
    "description": "模式1不拉起后台",
    "priority": 2,
    "condition": "notificationAdded == true && pkgName == \"com.tencent.qqlite\"",
    "actions": [
    "if(thanos.activityManager.isPackageRunning(\"com.tencent.tim\") == false && !thanos.windowManager.hasVisibleWindows(\"com.tencent.tim\")){ui.showNotification((pkgName) + System.currentTimeMillis(),(notificationTitle),(notificationContent),\"TIM\",\"com.tencent.tim\",null,\"ic_chat_1_line\",true,true,true);}"
    ]
    }
    ]
    
  • 模式二:拉起TIM后台,在TIM没有后台的情况下代收第一条消息,后续拉起TIM让TIM自己本身推送通知
    [
    {
    "name": "2检测到qq推送通知拉起tim",
    "description": "模式2拉起后台",
    "priority": 2,
    "condition": "notificationAdded == true && pkgName == \"com.tencent.qqlite\"",
    "actions": [
    "if(thanos.activityManager.isPackageRunning(\"com.tencent.tim\") == false && !thanos.windowManager.hasVisibleWindows(\"com.tencent.tim\")){ui.showNotification((pkgName) + System.currentTimeMillis(),(notificationTitle),(notificationContent),\"TIM\",\"com.tencent.tim\",null,\"ic_chat_1_line\",true,true,true);su.exe(\"am start-foreground-service com.tencent.tim/com.tencent.mobileqq.app.CoreService\");}"
    ]
    }
    ]
    
  • 模式三:不拉起TIM后台,但是可接收多条消息详情,实现原理为杀掉qq手表的进程,配合手表保活模式接收新的消息
    [
    {
    "name": "qq手表推送,带消息刷新",
    "description": "模式3不拉起tim后台",
    "priority": 2,
    "condition": "notificationAdded == true && pkgName == \"com.tencent.qqlite\"",
    "actions": [
    "if(thanos.activityManager.isPackageRunning(\"com.tencent.tim\") == false && !thanos.windowManager.hasVisibleWindows(\"com.tencent.tim\")){ui.showNotification((pkgName) + System.currentTimeMillis(),(notificationTitle),(notificationContent),\"TIM\",\"com.tencent.tim\",null,\"ic_chat_1_line\",true,true,true);killer.killPackage(\"com.tencent.qqlite\")}"
    ]
    }
    ]
    

ps:该情景模式通过捕捉qq手表的通知进行转发,所以你会看到两条通知,一条来自qq手表本身,另一条来自转发,你可以使用通知滤盒或者在安卓系统设置里面将qq手表通知的重要性设为低

  • 模式四:有些人并不想使用通知滤盒或者系统并不能更改通知重要性,本模式在模式三的基础上新增取消通知,来自thanox开发者,实现可能并不完美,具体效果自测
    [
    {
    "name": "qq手表推送,带消息刷新",
    "description": "模式4不拉起tim后台,取消qq手表通知",
    "priority": 2,
    "condition": "notificationAdded == true && pkgName == \"com.tencent.qqlite\"",
    "actions": [
    "if(thanos.activityManager.isPackageRunning(\"com.tencent.tim\") == false && !thanos.windowManager.hasVisibleWindows(\"com.tencent.tim\")){ui.showNotification((pkgName) + System.currentTimeMillis(),(notificationTitle),(notificationContent),\"TIM\",\"com.tencent.tim\",null,\"ic_chat_1_line\",true,true,true);android.app.INotificationManager.Stub.asInterface(android.os.ServiceManager.getService(\"notification\")).cancelAllNotifications(\"com.tencent.qqlite\", 0);killer.killPackage(\"com.tencent.qqlite\")}",
    "android.app.INotificationManager.Stub.asInterface(android.os.ServiceManager.getService(\"notification\")).cancelAllNotifications(\"com.tencent.qqlite\", 0)"
    ]
    }
    ]
    

本文到此结束 酷安原文 作者:为所欲为的我(lehhair)