Allow media keys to wake device for external keyboards.
Legacy code for blocking wake on media keys can be removed,
since we block wake for internal keyboard (so that device don't
wake up in pockets), and devices like TV remove that have
doNoWakeByDefault flag set to true in their idc file.
For all other external keyboards we should wake the device even
for a media key.
Test: manual
Bug: 267526027
Change-Id: I522027c2a168996f229fd6ec11e72989b9a8f567
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index 0855683..9732e8d 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -3658,8 +3658,8 @@
};
TEST_F(KeyboardInputMapperTest_ExternalDevice, WakeBehavior) {
- // For external devices, non-media keys will trigger wake on key down. Media keys need to be
- // marked as WAKE in the keylayout file to trigger wake.
+ // For external devices, keys will trigger wake on key down. Media keys should also trigger
+ // wake if triggered from external devices.
mFakeEventHub->addKey(EVENTHUB_ID, KEY_HOME, 0, AKEYCODE_HOME, 0);
mFakeEventHub->addKey(EVENTHUB_ID, KEY_PLAY, 0, AKEYCODE_MEDIA_PLAY, 0);
@@ -3681,7 +3681,7 @@
process(mapper, ARBITRARY_TIME, READ_TIME, EV_KEY, KEY_PLAY, 1);
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args));
- ASSERT_EQ(uint32_t(0), args.policyFlags);
+ ASSERT_EQ(POLICY_FLAG_WAKE, args.policyFlags);
process(mapper, ARBITRARY_TIME + 1, READ_TIME, EV_KEY, KEY_PLAY, 0);
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args));