初始化显示事件接收器失败 [英] Failed to initialize display event receiver

查看:18
本文介绍了初始化显示事件接收器失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个应用程序,它会定期启动一项从服务器检索信息的服务.

I have made an app which periodically starts a service that retrieves information from a server.

我使用 AlarmManager 来安排服务.
这工作正常,应用程序每 30 分钟收到一次警报.
该应用程序运行良好,但在整晚不活动后 - 我启动该应用程序时,它崩溃并出现错误:无法初始化显示事件接收器".

I use an AlarmManager to schedule the service.
This works fine and the app receives the alarm every 30 min.
The app works fine, but after a full night of inactivity -and I start the app, it crashes with the error: 'Failed to initialize display event receiver'.

否则,这完美无缺.

这个问题我找了半天,发现其他人也有同样的问题,但还没解决.

I searched this problem for a long time and found others with the same problem, but no solution, yet.

Process: it.unipi.iet.portolan.traceroute, PID: 13092
java.lang.RuntimeException: Failed to initialize display event receiver.  status=-2147483648
at android.view.DisplayEventReceiver.nativeInit(Native Method)
at android.view.DisplayEventReceiver.<init>(DisplayEventReceiver.java:61)
at android.view.Choreographer$FrameDisplayEventReceiver.<init>(Choreographer.java:695)
at android.view.Choreographer.<init>(Choreographer.java:169)
at android.view.Choreographer.<init>(Choreographer.java:72)
at android.view.Choreographer$1.initialValue(Choreographer.java:98)
at android.view.Choreographer$1.initialValue(Choreographer.java:91)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.view.Choreographer.getInstance(Choreographer.java:194)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:370)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2871)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5141)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)

推荐答案

只是一些信息,我不明白为什么,消息来自:

Just for some info, I can't understand why, The message throws from :

frameworks/base/core/jni/android_view_DisplayEventReceiver.cpp:4239:        message.appendFormat("Failed to initialize display event receiver.  status=%d", status);

或者这个

frameworks/base/libs/androidfw/DisplayEventDispatcher.cpp:1427:        ALOGW("Failed to initialize display event receiver, status=%d", result);

状态-2147483648 = 0x800000000

它从 DisplayEventReceiver 返回:

it return from the DisplayEventReceiver:

  /* initCheck returns the state of DisplayEventReceiver after construction.*/

status_t initCheck() const;

并查看 DisplayEventReceiver.cpp

and look at the DisplayEventReceiver.cpp

status_t DisplayEventReceiver::initCheck() const {
if (mDataChannel != NULL)
    return NO_ERROR;
return NO_INIT;
}

看起来 mDataChannel 为 NULL,

look like the mDataChannel is NULL,

在构造函数中初始化的mDataChannel

the mDataChannel initialized in the constructor

DisplayEventReceiver::DisplayEventReceiver() {
    sp<ISurfaceComposer> sf(ComposerService::getComposerService());
    if (sf != NULL) {
        mEventConnection = sf->createDisplayEventConnection();
        if (mEventConnection != NULL) {
            mDataChannel = mEventConnection->getDataChannel();
        }
    }
}

所以 sf SurfaceComposer 为 NULL 或 sf->createDisplayEventConnection 返回 NULL.

so sf SurfaceComposer is NULL or the sf-> createDisplayEventConnection return NULL.

在文件./system/core/include/utils/Errors.h

...
NO_ERROR            =0
UNKNOWN_ERROR       = (-2147483647-1), // INT32_MIN value

NO_MEMORY           = -ENOMEM,
INVALID_OPERATION   = -ENOSYS,
BAD_VALUE           = -EINVAL,
BAD_TYPE            = (UNKNOWN_ERROR + 1),
NO_INIT             = -ENODEV,
...

似乎状态必须NO_INIT...

这篇关于初始化显示事件接收器失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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