qjmfktlf 2022-06-12 22:42 采纳率: 100%
浏览 85
已结题

各位大L,请问如何打包一个这样的Bundle。这个是关于通知传递的数据。。

各位大L,新ren求jiao,请问如何打包一个这样的Bundle。这个是关于通知传递的数据。。

notificationlistener传递了一个intent,如下:
intent.getExtras().toString()
输出结果: Bundle[mParcelledData.dataSize=2096]

toString后是这样的
Bundle[{
        net.dinglisch.android.tasker.extras.HOST_CAPABILITIES=254, 
        proxy_operation_type=AUTO_REPLY, 
        com.balda.notificationlistener.extra.KEY=0|com.tencent.mm|2144300744|null|10247, 
        com.twofortyfouram.locale.intent.extra.BUNDLE=Bundle[mParcelledData.dataSize=652], 
        com.balda.notificationlistener.extra.INT_VERSION_CODE=118, 
        com.balda.notificationlistener.extra.AUTO_REPLY_TYPE=0, 
        net.dinglisch.android.tasker.EXTRA_TARGET_API=29, 
        com.balda.wakelockid=1, 
        com.twofortyfouram.locale.intent.extra.BLURB=回复: 回复文本:%TIME, 
        com.balda.notificationlistener.extra.OPERATION=4, 
        net.dinglisch.android.tasker.extras.HINTS=Bundle[mParcelledData.dataSize=48], 
        com.balda.notificationlistener.extra.REPLY=回复文本:20.47
}]
整个intent全部显示出来是这样的
Bundle[{
 
 
        net.dinglisch.android.tasker.extras.HOST_CAPABILITIES=254,
        proxy_operation_type=AUTO_REPLY,
        com.balda.notificationlistener.extra.KEY=0|com.tencent.mm|2144300744|null|10247,
        com.twofortyfouram.locale.intent.extra.BUNDLE=Bundle[{
                com.balda.notificationlistener.extra.KEY=0|com.tencent.mm|2144300744|null|10247,
                com.balda.notificationlistener.extra.INT_VERSION_CODE=118,
                com.balda.notificationlistener.extra.AUTO_REPLY_TYPE=0,
                com.balda.notificationlistener.extra.OPERATION=4,
                com.balda.notificationlistener.extra.REPLY=你好
        }],
 
 
        com.balda.notificationlistener.extra.INT_VERSION_CODE=118, 
        com.balda.notificationlistener.extra.AUTO_REPLY_TYPE=0,
        net.dinglisch.android.tasker.EXTRA_TARGET_API=29,
        com.twofortyfouram.locale.intent.extra.BLURB=回复: 你好,
        com.balda.notificationlistener.extra.OPERATION=4,
        net.dinglisch.android.tasker.extras.HINTS=Bundle[{
                .hints.TIMEOUT=0
        }],         
        com.balda.notificationlistener.extra.REPLY=你好
}]
下面是我自己打包的,但是为什么完全不一样啊!
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
 
    if (lpparam.processName.equals(Hook_Package)) {
        XposedBridge.log("通知监听器hook成功");
 
        Class<?> classDb = XposedHelpers.findClassIfExists(Hook_Class, lpparam.classLoader);
        XposedHelpers.findAndHookMethod(classDb, Hook_Method, Intent.class, new XC_MethodHook() {
            final String NF_Key = "com.balda.notificationlistener.extra.KEY";
            final String NF_Key_V = "0|com.tencent.mm|2144300744|null|10247";
 
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                XposedBridge.log(" \n ==S==>"+ Hook_Method +"<==S==");
 
                Bundle bundle = new Bundle();
                bundle.putInt("net.dinglisch.android.tasker.extras.HOST_CAPABILITIES",254);
                bundle.putString("proxy_operation_type","AUTO_REPLY");
                bundle.putString(NF_Key,NF_Key_V);
 
                Bundle bundle1 = new Bundle();
                bundle1.putString(NF_Key,NF_Key_V);
                bundle1.putInt("com.balda.notificationlistener.extra.INT_VERSION_CODE",118);
                bundle1.putInt("com.balda.notificationlistener.extra.AUTO_REPLY_TYPE",0);
                bundle1.putInt("com.balda.notificationlistener.extra.OPERATION",4);
                bundle1.putString("com.balda.notificationlistener.extra.REPLY","XPosedHook成功");
 
                bundle.putParcelable("net.dinglisch.android.tasker.extras.BUNDLE",bundle1);
                //bundle.putBundle("net.dinglisch.android.tasker.extras.BUNDLE",bundle1);
                bundle.putInt("com.balda.notificationlistener.extra.INT_VERSION_CODE",118);
                bundle.putInt("com.balda.notificationlistener.extra.AUTO_REPLY_TYPE",0);
                bundle.putInt("net.dinglisch.android.tasker.EXTRA_TARGET_API",29);
                bundle.putString("com.twofortyfouram.locale.intent.extra.BLURB","回复:XPosedHook成功");
                bundle.putInt("com.balda.notificationlistener.extra.OPERATION",4);
 
                Bundle bundle2 = new Bundle();
                bundle2.putInt(".hints.TIMEOUT",0);
 
                bundle.putParcelable("net.dinglisch.android.tasker.extras.HINTS",bundle2);
                //bundle.putBundle("net.dinglisch.android.tasker.extras.HINTS",bundle2);
                bundle.putString("com.balda.notificationlistener.extra.REPLY","XPosedHook成功");
 
                Bundle b = new Bundle();
                b.putAll(bundle);
                String str = b.toString();
                XposedBridge.log(" \n =====> "+ str +" <=====");
                XposedBridge.log(" \n ==E==>"+ Hook_Method +"<==E==");
 
                Intent intent = new Intent();
                intent.setComponent(new ComponentName("com.balda.notificationlistener","com.balda.notificationlistener.service.NotificationProxy"));
                intent.putExtras(bundle);
 
                param.args[0] = intent;
 
                XposedBridge.log(" \n =====> "+ param.args[0].toString() +" <=====");
            }
        });
    }
}
  • 写回答

3条回答 默认 最新

  • 懒羊羊的南瓜屋 2022-06-13 10:29
    关注

    你为啥要在bundle里面再放bundle对象,完全可以通过key值来区分。还有就是你的目标是要做成啥样的?感觉你说的不清不楚

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 6月22日
  • 已采纳回答 6月14日
  • 创建了问题 6月12日

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效