NetworkService: quitSafely() on onDestroy()

- When IwlanNetworkService is un-bound, such as when phone app dies,
  the typical sequence is onUnbind() followed by onDestroy() immediately.
- Messages queued by onUnbind() are not processed, which leaves the
  IwlanNetworkService in an unexpected state for the next onBind().
- The change is applied to DataService.java as well for safety.

Bug: 237447534
Test:
Live test by crashing com.android.phone to verify fix to unbind/destroy
behavior.

Change-Id: I25d968867401bd7d285735c83c71e3649467c5db
This commit is contained in:
Aswin Sankar
2022-09-08 18:51:43 -07:00
parent f63f20af72
commit 24e7f904e3
2 changed files with 2 additions and 2 deletions

View File

@@ -265,7 +265,7 @@ public abstract class NetworkService extends Service {
/** @hide */
@Override
public void onDestroy() {
mHandlerThread.quit();
mHandlerThread.quitSafely();
super.onDestroy();
}

View File

@@ -725,7 +725,7 @@ public abstract class DataService extends Service {
@Override
public void onDestroy() {
mHandlerThread.quit();
mHandlerThread.quitSafely();
super.onDestroy();
}