Move stopping DhcpClient to IpClient.StoppingState#enter.

This approach makes IpClient transit to StoppedState from StoppingState
smoothly regardless of the previous state. For example, when FILS
feature is enabled and IpClient receives provisioning timeout event
prior to preconnection abort message from wifi(e.g., L2 authentcation
timeout fies due to a wrong certification, which might take at least
1 min), then IpClient will stays at StoppingState and won't transit to
StoppedState, which also causes IpClient ignores the subsequent
CMD_START.

Moving stopping DhcpClient to StoppingState#enter() ensures IpClient
stop DhcpClient once it enters StoppingState, and quitting RunningState
is not a prerequisite any more. But also this fix doesn't change the
behavior for non-FILS cases:

- receive CMD_STOP at StartedState:
    - transitionToStoppingState() from StartedState, if mDhcpClient is
      null, just jump to StoppedState from StoppingState; if mDhcpClient
      isn't null(for example, from PreconnectingState), then IpClient
      stops DhcpClient at StoppingState and transits to StoppedState
      when receving DhcpClient.CMD_ON_QUIT.

- receive EVENT_PROVISIONING_TIMEOUT at StartedState:
    - transitionToStoppingState() from handleProvisioningFailure(),
      process is the same as above.

- receive DhcpClient.DHCP_FAILURE at RunningState:
    - transitionToStoppingState() from handleIPv4Failure(),
      StoppingState#enter() follows RunningState#exit() immediately.

- receive DhcpClient.CMD_CONFIGURE_LINKADDRESS at RunningState:
    - transitionToStoppingState() from RunningState when failed to
      set IPv4 address, StoppingState#enter() follows RunningState#exit()
      immediately.

- receive EVENT_NETLINK_LINKPROPERTIES_CHANGED at RunningState:
    - transitionToStoppingState() from RunningState when provisioning
      failed or user switched to another AP, StoppingState#enter() just
      follows RunningState#exit() immediately.

- receive CMD_STOP at RunningState:
    - StoppingState#enter() follows RunningState#exit() immediately.

Bug: 229039898
Bug: 191938960
Test: atest NetworkStackIntegrationTests
(cherry picked from commit 39511688b982cdef80c09512cb70a408c5d6c2e4)
Change-Id: I47e51094b008c8331d0126d9eca6c51bc8b0cd7b
2 files changed