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

Commit 2acc8b38 authored by Eric Laurent's avatar Eric Laurent
Browse files

Revert "stagefright: fix TimedEventQueue wakelock"

This reverts commit aef04853.
parent 35a9e7d4
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ TimedEventQueue::event_id TimedEventQueue::postTimedEvent(
    QueueItem item;
    item.event = event;
    item.realtime_us = realtime_us;
    item.has_wakelock = false;

    if (it == mQueue.begin()) {
        mQueueHeadChangedCondition.signal();
@@ -134,7 +135,7 @@ TimedEventQueue::event_id TimedEventQueue::postTimedEvent(

    if (realtime_us > ALooper::GetNowUs() + kWakelockMinDelay) {
        acquireWakeLock_l();
        event->setWakeLock();
        item.has_wakelock = true;
    }
    mQueue.insert(it, item);

@@ -190,7 +191,7 @@ void TimedEventQueue::cancelEvents(
        ALOGV("cancelling event %d", (*it).event->eventID());

        (*it).event->setEventID(0);
        if ((*it).event->hasWakeLock()) {
        if ((*it).has_wakelock) {
            releaseWakeLock_l();
        }
        it = mQueue.erase(it);
@@ -288,9 +289,6 @@ void TimedEventQueue::threadEntry() {
        if (event != NULL) {
            // Fire event with the lock NOT held.
            event->fire(this, now_us);
            if (event->hasWakeLock()) {
                releaseWakeLock_l();
            }
        }
    }
}
@@ -302,6 +300,9 @@ sp<TimedEventQueue::Event> TimedEventQueue::removeEventFromQueue_l(
        if ((*it).event->eventID() == id) {
            sp<Event> event = (*it).event;
            event->setEventID(0);
            if ((*it).has_wakelock) {
                releaseWakeLock_l();
            }
            mQueue.erase(it);
            return event;
        }
+2 −10
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ struct TimedEventQueue {

    struct Event : public RefBase {
        Event()
            : mEventID(0), mHasWakeLock(false) {
            : mEventID(0) {
        }

        virtual ~Event() {}
@@ -42,14 +42,6 @@ struct TimedEventQueue {
            return mEventID;
        }

        void setWakeLock() {
            mHasWakeLock = true;
        }

        bool hasWakeLock() {
            return mHasWakeLock;
        }

    protected:
        virtual void fire(TimedEventQueue *queue, int64_t now_us) = 0;

@@ -57,7 +49,6 @@ struct TimedEventQueue {
        friend class TimedEventQueue;

        event_id mEventID;
        bool mHasWakeLock;

        void setEventID(event_id id) {
            mEventID = id;
@@ -127,6 +118,7 @@ private:
    struct QueueItem {
        sp<Event> event;
        int64_t realtime_us;
        bool has_wakelock;
    };

    struct StopEvent : public TimedEventQueue::Event {