summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ji-Hwan Lee <jihwan@google.com> 2014-06-09 15:22:59 +0900
committer Ji-Hwan Lee <jihwan@google.com> 2014-06-09 15:22:59 +0900
commite17b2dd7bcc137bf4d842a779e8d62c63957a978 (patch)
treef4b841e642e63995697b7bd880e168e7b6f52a65
parentf43cea009447cb2d3741de94c93c28e2fd413a43 (diff)
Set mBound only when bind succeeds
Fixes an issue that TV input is disabled forever after package upgrade, when it's upgraded while in use. The root cause is as below: - Package is killed while upgrade. - Service disconnects, and tries to rebind for reconnecting, but bind fails because service is not available temporarily. Still ServiceState.mBound is set to true. - Should rebind next when callback is registered or new session is created, but doesn't because ServiceState is already marked bound. Bug: 14981201 Change-Id: Ia5b0acb33f1247064213024438f114bc40238648
-rw-r--r--services/core/java/com/android/server/tv/TvInputManagerService.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java
index 1c277a8dd961..10a67c4e421d 100644
--- a/services/core/java/com/android/server/tv/TvInputManagerService.java
+++ b/services/core/java/com/android/server/tv/TvInputManagerService.java
@@ -301,9 +301,8 @@ public final class TvInputManagerService extends SystemService {
Intent i = new Intent(TvInputService.SERVICE_INTERFACE).setComponent(
userState.inputMap.get(inputId).getComponent());
- mContext.bindServiceAsUser(i, serviceState.mConnection, Context.BIND_AUTO_CREATE,
- new UserHandle(userId));
- serviceState.mBound = true;
+ serviceState.mBound = mContext.bindServiceAsUser(
+ i, serviceState.mConnection, Context.BIND_AUTO_CREATE, new UserHandle(userId));
} else if (serviceState.mService != null && isStateEmpty) {
// This means that the service is already connected but its state indicates that we have
// nothing to do with it. Then, disconnect the service.