Skip events on stale Ikev2VpnRunner

The exit() of of VpnRunner will do exitVpnRunner() and
cleanupVpnStateLocked(). But the exitVpnRunner() posts a runnable
to the executor. This means that disconnectVpnRunner() might run
concurrently with cleanupVpnStateLocked(), and it might even
complete after cleanupVpnStateLocked() finishes. After exiting
the runner, the states are reset. The remaining events in the
executor are irrelavent and should be skipped to prevent
accessing any of the outer class's members.

Also add missing synchronized block by verify that there is no
other field of the outer Vpn class that is used inside
Ikev2VpnRunner implicitly.

Bug: 235322391
Test: atest FrameworksNetTests
Change-Id: I9eed58b2e96ebaf33e557a42e83525a74a4697d8
1 file changed