summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaewan Kim <jaewan@google.com>2014-06-24 16:59:48 +0900
committerJaewan Kim <jaewan@google.com>2014-06-26 02:00:32 +0000
commit226a51958d645a8e2be3e40a6b6daaca558b4913 (patch)
treea5267aefb42dbc71c837a92b6b23575c50bd9e0a
parent4e2de24bf3393be04908d4eac4c4901b900c467d (diff)
Update service connections when TV input list is updated
Bug: 15738607 Change-Id: Ie2d24d0c36308e6757b7d6939d79874c3bdd7211
-rw-r--r--services/core/java/com/android/server/tv/TvInputManagerService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java
index 6798f3fb97be..61fdaccba8d6 100644
--- a/services/core/java/com/android/server/tv/TvInputManagerService.java
+++ b/services/core/java/com/android/server/tv/TvInputManagerService.java
@@ -214,6 +214,9 @@ public final class TvInputManagerService extends SystemService {
if (DEBUG) Slog.d(TAG, "add " + info.getId());
userState.inputMap.put(info.getId(), info);
userState.packageList.add(si.packageName);
+
+ // Reconnect the service if existing input is updated.
+ updateServiceConnectionLocked(info.getId(), userId);
} catch (IOException | XmlPullParserException e) {
Slog.e(TAG, "Can't load TV input " + si.name, e);
}
@@ -353,6 +356,9 @@ public final class TvInputManagerService extends SystemService {
Intent i = new Intent(TvInputService.SERVICE_INTERFACE).setComponent(
userState.inputMap.get(inputId).getComponent());
+ // Binding service may fail if the service is updating.
+ // In that case, the connection will be revived in buildTvInputListLocked called by
+ // onSomePackagesChanged.
serviceState.mBound = mContext.bindServiceAsUser(
i, serviceState.mConnection, Context.BIND_AUTO_CREATE, new UserHandle(userId));
} else if (serviceState.mService != null && isStateEmpty) {