Android的5 ADB通知转储错误的数据 [英] Android 5 ADB notification dump wrong data

查看:134
本文介绍了Android的5 ADB通知转储错误的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个电脑程序,它的工作原理在桌面上,并通知你有关通知,功率电平,并让你与你的智能手机进行交互。 在所有亚行 - 所以在手机上没有的应用程序是必需的。 和所有在一个时尚的方式。

I built a pc program that works on your desktop and informs you about notifications, power-level, and lets you interact with your smartphone. All over the ADB - so no app on the phone is required. And all that in a stylish way.

但也足够了,它的工作,直到机器人5来了。

But enough for that, it worked until android 5 came along.

的通知转储(亚行外壳dumpsys通知)显示比SDK&LT不同的输出= 19

The notification dump (adb shell dumpsys notifications) shows different outputs than in sdk <= 19

例如:

该地区的群众演员给我的详细信息有关的通知。

The extras region showed me detailed informations about the notifications.

      extras={
        android.title=String
        android.subText=null
        android.template=String
        android.showChronometer=Boolean (false)
        android.icon=Integer (2130837507)
        android.text=String
        android.progress=Integer (0)
        android.progressMax=Integer (0)
        android.showWhen=Boolean (true)
        android.rebuild.applicationInfo=ApplicationInfo (ApplicationInfo{14a2c165 com.nero.android.htc.sync})
        android.rebuild.contentView=Boolean (true)
        android.bigText=String
        android.infoText=null
        android.originatingUserId=Integer (0)
        android.progressIndeterminate=Boolean (false)
        android.rebuild=Boolean (true)
        android.rebuild.bigView=Boolean (true)
      }

这是android 5通知转储的一个例子。 你看,还有的字符串,而不是实际值仅数据类型。

This is an example of the android 5 Notification dump. You see, there are only datatypes for strings, not the actual values.

有谁知道我能得到的实际值?像一些参数,我很想念?

Does anybody know how i can get the actual values? Like some parameters i am missing?

或者你知道得到通知,从手机到PC的更好的方法?

Or do you know an even better way of getting the notifications from the phone to the pc?

推荐答案

嗯,我面临同样的问题,现在看来,这已经没有办法了。

Well, I faced the same problem and it seems it has no solution.

我已经看了源$ C ​​$ c和比较它的版本时,一切工作。 在4.4.4版本,它仍在工作。出现在5.0.0版本和code变化不变化为5.1.1版本(我们在那一刻,我写这个帖子的最后一个来源$ C ​​$ C版本)。

I've looked at the source code and compared it to the version when everything was working. In the version 4.4.4 it was still working. Changes appeared in the version 5.0.0 and the code wasn't changed to the version 5.1.1 (the last source code version we have on the moment I'm writing this post).

所以,让我们看看源$ C ​​$ C,它负责印刷的通知多余的部分。

So, lets look at the source code that responsible for printing extra section of notification.

正如你看到的,它的一切就OK了在安卓4.4.4,在code打印字符串重价值presentation。 在安卓5.0.0 - 5.1.1它打印只是一个类型的值,而不是本身的价值

As you see, it's everything ok in Android 4.4.4, the code prints string representation of the value. In Android 5.0.0 - 5.1.1 it prints only a type of value, but not the value itself.

的Andr​​oid 4.4.4。

if (notification.extras != null && notification.extras.size() > 0) {
    pw.println(prefix + "  extras={");
    for (String key : notification.extras.keySet()) {
        pw.print(prefix + "    " + key + "="); // <====== print key name
        Object val = notification.extras.get(key);
        if (val == null) {
            pw.println("null");
        } else {
            pw.print(val.toString()); // <====== print value here
            if (val instanceof Bitmap) {
                pw.print(String.format(" (%dx%d)",
                        ((Bitmap) val).getWidth(),
                        ((Bitmap) val).getHeight()));
            } else if (val.getClass().isArray()) {
                pw.println(" {");
                final int N = Array.getLength(val);
                for (int i=0; i<N; i++) {
                    if (i > 0) pw.println(",");
                    pw.print(prefix + "      " + Array.get(val, i));
                }
                pw.print("\n" + prefix + "    }");
            }
            pw.println();
        }
    }
    pw.println(prefix + "  }");
}

的Andr​​oid 5.0.0 - 5.1.1

if (notification.extras != null && notification.extras.size() > 0) {
    pw.println(prefix + "  extras={");
    for (String key : notification.extras.keySet()) {
        pw.print(prefix + "    " + key + "="); // <====== print key name
        Object val = notification.extras.get(key);
        if (val == null) {
            pw.println("null");
        } else {
            pw.print(val.getClass().getSimpleName()); // <===== print a type, not a value itself
            if (val instanceof CharSequence || val instanceof String) {
                // redact contents from bugreports
            } else if (val instanceof Bitmap) {
                pw.print(String.format(" (%dx%d)",
                        ((Bitmap) val).getWidth(),
                        ((Bitmap) val).getHeight()));
            } else if (val.getClass().isArray()) {
                final int N = Array.getLength(val);
                pw.println(" (" + N + ")");
            } else {
                pw.print(" (" + String.valueOf(val) + ")");
            }
            pw.println();
        }
    }
    pw.println(prefix + "  }");
}

这篇关于Android的5 ADB通知转储错误的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆