Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 220be41a authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 587ae01a: fix a crasher when starting SF with the screen off

* commit '587ae01ad65a331ba259c31fbc1729cb5fbdf226':
  fix a crasher when starting SF with the screen off
parents d0f5059c f6de1c04
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -43,14 +43,6 @@ DisplayHardwareBase::DisplayEventThread::DisplayEventThread(
DisplayHardwareBase::DisplayEventThread::~DisplayEventThread() {
}

void DisplayHardwareBase::DisplayEventThread::onFirstRef() {
    if (initCheck() == NO_ERROR) {
        run("DisplayEventThread", PRIORITY_URGENT_DISPLAY);
    } else {
        ALOGW("/sys/power/wait_for_fb_{wake|sleep} don't exist");
    }
}

status_t DisplayHardwareBase::DisplayEventThread::initCheck() const {
    return ((access(kSleepFileName, R_OK) == 0 &&
            access(kWakeFileName, R_OK) == 0)) ? NO_ERROR : NO_INIT;
@@ -120,6 +112,14 @@ DisplayHardwareBase::DisplayHardwareBase(const sp<SurfaceFlinger>& flinger,
    mDisplayEventThread = new DisplayEventThread(flinger);
}

void DisplayHardwareBase::startSleepManagement() const {
    if (mDisplayEventThread->initCheck() == NO_ERROR) {
        mDisplayEventThread->run("DisplayEventThread", PRIORITY_URGENT_DISPLAY);
    } else {
        ALOGW("/sys/power/wait_for_fb_{wake|sleep} don't exist");
    }
}

DisplayHardwareBase::~DisplayHardwareBase() {
    // request exit
    mDisplayEventThread->requestExitAndWait();
+2 −1
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ public:

    ~DisplayHardwareBase();

    void startSleepManagement() const;

    // console management
    void releaseScreen() const;
    void acquireScreen() const;
@@ -52,7 +54,6 @@ private:
    public:
        DisplayEventThread(const sp<SurfaceFlinger>& flinger);
        virtual ~DisplayEventThread();
        virtual void onFirstRef();
        virtual bool threadLoop();
        status_t releaseScreen() const;
        status_t initCheck() const;
+1 −0
Original line number Diff line number Diff line
@@ -300,6 +300,7 @@ status_t SurfaceFlinger::readyToRun()
    // start the EventThread
    mEventThread = new EventThread(this);
    mEventQueue.setEventThread(mEventThread);
    hw.startSleepManagement();

    /*
     *  We're now ready to accept clients...