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

Skip to content
Commit 21e96e64 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Do not call 'setEnabled' before mapper is configured

The mappers have a specific lifecycle:
1. constructor
2. configure(0)
3. reset
4. use it

However, currently, this could be broken because the 'reset' function is
getting invoked before the first configure(0).

If a mapper's 'configure(0)' method isn't called, then there will be
uninitialized variables inside.
Specifically, in TouchInputMapper, this will mean that:
a. mPointerUsage may be set to something like "STYLUS".
b. mPointerSimple::down or mPointerSimple::hovering may be set to true

The above combination could cause a crash, because it would try to
access mPointerController, which isn't yet initialized.

This is a speculative fix, because we can't reproduce the crash, since
it relies on a specific state of the uninitialized variables.

Ideally, we would simply eliminate these possibilities by either using
the constructor (and calling "configure" there), or providing some
default values.

To keep the fix simple, in this CL we just avoid calling 'setEnabled'
too early.

Bug: 255739891
Bug: 255839467
Test: atest inputflinger_tests
Change-Id: I44038c5ce5bfdd5ac4c2933e0dc4fa714c5cf260
parent 03e6b317
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment