WifiNetworkFactory: Use ActiveModeWarden to track wifi on/off

Changes:
a) Stop plumbing the wifi state to WifiNetworkFactory from
ClientModeImpl (this is a problem when there are multiple instances of
CMI interacting with WifiNetworkFactory).
b) Change in behavior in WifiNetworkFactory when a request is received
when wifi is off. We previously used to ignore the request until the
user toggled wifi on (or it timed out in connectivity service). But,
that does not seem very correct. Instead, send an immediate failure when
wifi is off.
c) Use ActiveModeWarden.requestLocalOnlyModeManager() answer to figure
out if wifi is off (if null, wifi is off).
d) Use ActiveModeWarden mode change callback to track if wifi is
toggled off when a request is being processed.
e) Modify ActiveModeWarden's handling of requestLocalOnlyModeManager()
when wifi is off by returning null.

Bug: 148935691
Test: atest com.android.server.wifi
Change-Id: I36701eb2d92b0a4c59c936f2ced6a988e70cdc69
6 files changed
tree: 0d768502bbfa94912d825549f8dc745a5d9c1ee3
  1. apex/
  2. service/
  3. metrics_pdd_hook.py
  4. PREUPLOAD.cfg