While turning OFF do not honor ON requests.

Native stack does not handle being put from OFF -> ON state without
doing a complete cleanup. Hence instead of going from start -> ON -> OFF
-> cleanup it goes start -> ON -> OFF ->ON -> ... usually leads to race
conditions down the road in native.

This patch is a workaround so that we can throw away the requests if we
are in currently "turning off" phase. The side-effect would be that user
will need to turn it ON again. The race happens when the turn OFF time
is longer but usually it is found to be close to order of seconds hence
the wait should be bounded.

Bug: b/28318203
Change-Id: I14f6633f31311e5b561e1dcbc8a9d6d2a5dd6fdc
2 files changed