Clear the VPN network preference when error happens
This commit does
- Clear the VPN network preference before the Ikev2VpnRunner
becomes stale.
- Clear the VPN network preference when the retry delay is higher
than 5s. The clean work is not suitable for NETWORK_LOST error
since there might be a window when the underlying network is
back but the VPN is not connected yet. So keep the rule when
the underlying network is lost.
- Reset the VPN network preference when starting a new IKE
session. The rule might be set twice(One is in the constructor,
and the other is in startOrMigrateIkeSession()) when the IKEv2
VPN is the first time launched. There is no harm since
ConnectivityService will always clear the old rule first then
adding the new rule, which means it's ok for the caller to set
the same rule multiple times and ConnectivityService can handle
it well.
Bug: 231749077
Test: atest FrameworksNetTests
Change-Id: I2664b5fb4151e12d2531e950885bcb18e46b23c6
1 file changed