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

Commit 042b770e authored by Ravindra Thattahalli Javaraiah's avatar Ravindra Thattahalli Javaraiah Committed by Ravindra
Browse files

Interface to check for deferred messages

Adding new inerface to check for deferred messages with a matching object.

Change-Id: Id518ec2ccdc9b27fc073b7ec8bcaa6b285190ede
CRs-Fixed: 1049393
parent 4404f4a2
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -1921,6 +1921,22 @@ public class StateMachine {
        return false;
        return false;
    }
    }


    /**
     * Check if there are any pending messages with code 'what' in deferred messages queue.
     */
    protected final boolean hasDeferredMessages(int what, Object obj) {
        SmHandler smh = mSmHandler;
        if (smh == null) return false;

        Iterator<Message> iterator = smh.mDeferredMessages.iterator();
        while (iterator.hasNext()) {
            Message msg = iterator.next();
            if ((msg.what == what) && (msg.obj == obj)) return true;
        }

        return false;
    }

    /**
    /**
     * Check if there are any pending posts of messages with code 'what' in
     * Check if there are any pending posts of messages with code 'what' in
     * the message queue. This does NOT check messages in deferred message queue.
     * the message queue. This does NOT check messages in deferred message queue.