diff options
| author | 2022-03-17 00:29:36 +0000 | |
|---|---|---|
| committer | 2022-03-17 00:36:14 +0000 | |
| commit | 569d88737b68b39a5d9a90c2113f3e574bd99f8d (patch) | |
| tree | 4a47585f9e667e9066906e46db93f7f85b32f6b6 | |
| parent | 1a89ec7056a4411dd33bb3170fd74fe867e78202 (diff) | |
Fix bug where GameService#onDisconnected isn't called
As it is, since the disconnected call happens in
unbind, the call is immediately dropped due to the
unbinding instead of going through. This change is a
quick fix that makes it so that unbind always
happens after disconnect.
Bug: 223981361
Test: atest CtsGameServiceTestCases
Change-Id: Icd331e64dd2be80829b8baead521906bb7d41bae
| -rw-r--r-- | services/core/java/com/android/server/app/GameServiceProviderInstanceImpl.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/app/GameServiceProviderInstanceImpl.java b/services/core/java/com/android/server/app/GameServiceProviderInstanceImpl.java index e9205230a4ad..67d6d3111955 100644 --- a/services/core/java/com/android/server/app/GameServiceProviderInstanceImpl.java +++ b/services/core/java/com/android/server/app/GameServiceProviderInstanceImpl.java @@ -85,15 +85,6 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan Slog.w(TAG, "Failed to send connected event", ex); } } - - @Override - public void onDisconnected(@NonNull IGameService service) { - try { - service.disconnected(); - } catch (RemoteException ex) { - Slog.w(TAG, "Failed to send disconnected event", ex); - } - } }; private final ServiceLifecycleCallbacks<IGameSessionService> @@ -181,7 +172,8 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan } @Override - public void onForegroundServicesChanged(int pid, int uid, int serviceTypes) {} + public void onForegroundServicesChanged(int pid, int uid, int serviceTypes) { + } }; private final IGameServiceController mGameServiceController = @@ -338,7 +330,9 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan destroyAndClearAllGameSessionsLocked(); - mGameServiceConnector.unbind(); + mGameServiceConnector.post(IGameService::disconnected).whenComplete((result, t) -> { + mGameServiceConnector.unbind(); + }); mGameSessionServiceConnector.unbind(); mGameServiceConnector.setServiceLifecycleCallbacks(null); |