passpoint-r2: fix NullPointerException for OsuServerConnection

If we are doing OSU procedure continuously, system is crashed because of
NullPointerException for mServiceConnection.
This is a synchronization issue for accessing mServiceConnection between
two threads.
1) WifiServiceHandlerThread: call cleanUp to set mServiceConnection to null
when AP got disconnetted.
2) OsuServerHandler handlerThread: exchange Soap messages

Reproducible steps:
TimeoutTask for redirect response was not deleted for previous OSU
session while cleanup resource by disconnection.
Eventually the timeout task was triggered in new OSU procedure and causes
the current state machine to be reset causing mServiceConnection to be
null.
In the meantime, we are trying to call mOsuServerConnection.disconnect
to release resource on null mServiceConnection.

Solution:
1) clean up pending timeout task when calling stopSever.
2) handle the cleanup on the OsuServerHandlerThread.

error Log:
java.lang.NullPointerException: Attempt to invoke virtual method
'void com.android.server.wifi.hotspot2.soap.HttpsServiceConnection.disconnect()'
on a null object reference
com.android.server.wifi.hotspot2.OsuServerConnection
performSoapMessageExchange(OsuServerConnection.java:353)

Bug: 121223278
Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: tested with R2 AP for OSU procedure.
Change-Id: Ica3b2afa75919ad2291e14b3bf7cfa8af4022b9d
Signed-off-by: Ecco Park <eccopark@google.com>
4 files changed