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

Commit 9090d4fa authored by gaoshang's avatar gaoshang
Browse files

Fix a anr bug caused by sendFinishedSignal logical error

Because of eliminate multiple benign overflow conditions see:
https://android-review.googlesource.com/#/c/172237/


Changed the do while loop resulting in a logical difference.

When the chainIndex-- to 0, the loop is not run.
It is the most important cycle, it will push head seq to mSeqChains.
If not run, will lead to a batch of seq can not corrected finish.
Eventually leading to the occurrence of anr.

Signed-off-by: default avatargaoshang <gaoshang@xiaomi.com>
Test: Input dispatche process
Bug: 38366215
Change-Id: I87e609dfcb00ac7b8e82c6de789df094e7c25efd
parent 3a6828d5
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -842,15 +842,14 @@ status_t InputConsumer::sendFinishedSignal(uint32_t seq, bool handled) {
        }
        if (status) {
            // An error occurred so at least one signal was not sent, reconstruct the chain.
            do {
            for (;;) {
                SeqChain seqChain;
                seqChain.seq = chainIndex != 0 ? chainSeqs[chainIndex - 1] : seq;
                seqChain.chain = chainSeqs[chainIndex];
                mSeqChains.push(seqChain);
                if (chainIndex != 0) {
                if (!chainIndex) break;
                chainIndex--;
            }
            } while (chainIndex > 0);
            return status;
        }
    }