Failed to initialize display event receiver

前端 未结 1 1982
Happy的楠姐
Happy的楠姐 2020-12-29 19:58

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

I use an AlarmManager to schedule the service.
This works fine

1条回答
  •  Happy的楠姐
    2020-12-29 20:52

    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);
    

    or maybe this

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

    the status -2147483648 = 0x800000000

    it return from the DisplayEventReceiver:

      /* initCheck returns the state of DisplayEventReceiver after construction.*/
    
    status_t initCheck() const;
    

    and look at the DisplayEventReceiver.cpp

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

    look like the mDataChannel is NULL,

    the mDataChannel initialized in the constructor

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

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

    and in the file ./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,
    ...
    

    seems the status must NO_INIT...

    0 讨论(0)
提交回复
热议问题