InputDispatcher: Properly store values inside optional
Before this CL, we were storing values inside the optional incorrectly.
The variable was first dereferenced (which is always valid, even if
there's no value contained inside), and then the value was stored.
However, the optional bool flag itself was not updated. As a result, the
assertion ALOG_ASSERT was failing. This was not observed in our runs
likely due to the behaviour of ALOG_ASSERT.
The failure could be reproduced when this was switched to LOG_IF(FATAL
locally. The test `PolicyNotifiedForUnhandledKey` was hitting that
assertion and failing.
The incorrect behaviour was introduced in ag/22679128: Use std::map
for fallback keys.
In this CL, the code is changed to properly update the optional and to
crash always when the unexpected condition occurs.
Bug: 377853843
Flag: EXEMPT bugfix
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: I1f74ff11ac62fcf577ecd146067858d43adc0288
1 file changed