Protect against receiving partial key event sequences.

This changelist addresses the possibility of receiving only the latter
portions of a key event sequence in DreamService. In this case, some
initialization/tracking might not be in place. Values are now checked
before being used.

Test: atest DreamServiceTest#testPartialKeyHandling
Flag: android.service.dreams.dream_handles_confirm_keys
Fixes: 341920661
Change-Id: I7e416dc96ed8871eb7f5bb18a4521150b846bfb9
3 files changed