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

Commit 91913924 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

fix an issue where the screen could stay off

this would happen when toggling on/off/on very fast, the screen
could stay black (while the panel is on).

Bug: 5429724
Change-Id: Ic8aa6aff066e6267923c0d47ef65e314e7bb6d41
parent b946a56b
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ status_t DisplayHardwareBase::DisplayEventThread::initCheck() const

DisplayHardwareBase::DisplayHardwareBase(const sp<SurfaceFlinger>& flinger,
        uint32_t displayIndex) 
    : mCanDraw(true), mScreenAcquired(true)
    : mScreenAcquired(true)
{
    mDisplayEventThread = new DisplayEventThread(flinger);
}
@@ -133,14 +133,9 @@ DisplayHardwareBase::~DisplayHardwareBase()
    mDisplayEventThread->requestExitAndWait();
}

void DisplayHardwareBase::setCanDraw(bool canDraw)
{
    mCanDraw = canDraw;
}

bool DisplayHardwareBase::canDraw() const
{
    return mCanDraw && mScreenAcquired;
    return mScreenAcquired;
}

void DisplayHardwareBase::releaseScreen() const
+0 −2
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ public:
    bool isScreenAcquired() const;

    bool canDraw() const;
    void setCanDraw(bool canDraw);


private:
@@ -74,7 +73,6 @@ private:
    };

    sp<DisplayEventThreadBase>  mDisplayEventThread;
    mutable int                 mCanDraw;
    mutable int                 mScreenAcquired;
};

+0 −11
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ SurfaceFlinger::SurfaceFlinger()
        mBootTime(systemTime()),
        mVisibleRegionsDirty(false),
        mHwWorkListDirty(false),
        mDeferReleaseConsole(false),
        mFreezeDisplay(false),
        mElectronBeamAnimationMode(0),
        mFreezeCount(0),
@@ -503,17 +502,9 @@ void SurfaceFlinger::handleConsoleEvents()
        SurfaceFlinger::turnElectronBeamOn(mElectronBeamAnimationMode);
    }

    if (mDeferReleaseConsole && hw.isScreenAcquired()) {
        // We got the release signal before the acquire signal
        mDeferReleaseConsole = false;
        hw.releaseScreen();
    }

    if (what & eConsoleReleased) {
        if (hw.isScreenAcquired()) {
            hw.releaseScreen();
        } else {
            mDeferReleaseConsole = true;
        }
    }

@@ -2177,7 +2168,6 @@ status_t SurfaceFlinger::turnElectronBeamOffImplLocked(int32_t mode)
    glEnable(GL_SCISSOR_TEST);
    hw.flip( Region(hw.bounds()) );

    hw.setCanDraw(false);
    return NO_ERROR;
}

@@ -2226,7 +2216,6 @@ status_t SurfaceFlinger::turnElectronBeamOnImplLocked(int32_t mode)
    if (mode & ISurfaceComposer::eElectronBeamAnimationOn) {
        electronBeamOnAnimationImplLocked();
    }
    hw.setCanDraw(true);

    // make sure to redraw the whole screen when the animation is done
    mDirtyRegion.set(hw.bounds());
+0 −1
Original line number Diff line number Diff line
@@ -363,7 +363,6 @@ private:
                Region                      mWormholeRegion;
                bool                        mVisibleRegionsDirty;
                bool                        mHwWorkListDirty;
                bool                        mDeferReleaseConsole;
                bool                        mFreezeDisplay;
                int32_t                     mElectronBeamAnimationMode;
                int32_t                     mFreezeCount;