WifiStateMachine: onDown triggers wifi off

When the underlying sta interface in Client Mode gets an onDown
callback, notify SelfRecovery if MacRandomization isn't enabled.  We
do expect onDown to happen with MacRandomization, so we don't want to
restart/disable client mode...  because we would disable wifi and never connect.

This CL additionally adds a check to get the interface state after
creation.  This fixes the issue where WSM does not know the interface is
up before a connection.

This CL triggers SelfRecovery with a new reason code.  Also added unit
tests.

Due to b/72459123, supplicant reports of iface down are still handled.

Bug: 75989180
Bug: 75991970
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: 'adb shell ifconfig wlan0 down' when connected, confirm wifi
disables
Test: 'adb shell ifconfig wlan0 down' when disconnected, confirm wifi
disables
Test: removed config while connected to the network does not disable
wifi
Test: removed config while disconnected does not disable wifi

Change-Id: Ifb7fc5289ed7f029ed02f6ce21d7b71710992501
6 files changed