appium/appium-android-driver

Delay before adb.keyevent() might not be required

scottdixon-zz opened this issue · 3 comments

The previous implementation of toggleSetting had a 2000ms delay before calling adb.keyevent().

adb.keyevent() seems to work without this delay (tested on 6.0/23). toggleSettings calls adb.keyevent() numerous times. Removing the delay could save ~10 seconds.

We should test all API versions to see if it's required.

https://github.com/appium/appium-android-driver/blob/master/lib/commands/network.js#L159-L163

Update: abd.keyevent() is being replaced with bootstrap.sendAction(“keyPressCode").

Delay was introduced here: appium/appium@1b488f7

From the contributor: "I can only assume it was a workaround because of the fact the system would not register all key presses if issued in too rapid succession"

As the project stands today and given we now use bootstrap.sendAction(“keyPressCode"), is this still a legitimate concern, @imurchie ?

I think that it is a legitimate concern, though I also think that without empirical knowledge it is hard to say. I would remove it, but add a comment about it so that if it becomes an issue we can re-implement it. Though in that reimplementation I would consider exposing a capability so that the tester can control it. So if it is not a problem for a particular tester they are not forced to be slowed down by the delay.