Loading services/core/java/com/android/server/tv/TvInputManagerService.java +31 −43 Original line number Diff line number Diff line Loading @@ -212,8 +212,6 @@ public final class TvInputManagerService extends SystemService { private void buildTvInputListLocked(int userId) { UserState userState = getUserStateLocked(userId); Map<String, TvInputState> inputMap = new HashMap<String, TvInputState>(); userState.packageSet.clear(); if (DEBUG) Slog.d(TAG, "buildTvInputList"); Loading @@ -229,8 +227,7 @@ public final class TvInputManagerService extends SystemService { + android.Manifest.permission.BIND_TV_INPUT); continue; } try { inputList.clear(); ComponentName component = new ComponentName(si.packageName, si.name); if (hasHardwarePermission(pm, component)) { ServiceState serviceState = userState.serviceStateMap.get(component); Loading @@ -244,9 +241,20 @@ public final class TvInputManagerService extends SystemService { inputList.addAll(serviceState.mInputList); } } else { try { inputList.add(TvInputInfo.createTvInputInfo(mContext, ri)); } catch (XmlPullParserException | IOException e) { Slog.e(TAG, "Failed to load TV input " + si.name, e); continue; } } // Reconnect the service if existing input is updated. updateServiceConnectionLocked(component, userId); userState.packageSet.add(si.packageName); } Map<String, TvInputState> inputMap = new HashMap<String, TvInputState>(); for (TvInputInfo info : inputList) { if (DEBUG) Slog.d(TAG, "add " + info.getId()); TvInputState state = userState.inputMap.get(info.getId()); Loading @@ -257,15 +265,6 @@ public final class TvInputManagerService extends SystemService { inputMap.put(info.getId(), state); } // Reconnect the service if existing input is updated. updateServiceConnectionLocked(component, userId); userState.packageSet.add(si.packageName); } catch (IOException | XmlPullParserException e) { Slog.e(TAG, "Can't load TV input " + si.name, e); } } for (String inputId : inputMap.keySet()) { if (!userState.inputMap.containsKey(inputId)) { notifyInputAddedLocked(userState, inputId); Loading Loading @@ -338,7 +337,6 @@ public final class TvInputManagerService extends SystemService { Slog.e(TAG, "error in unregisterCallback", e); } } serviceState.mClientTokens.clear(); mContext.unbindService(serviceState.mConnection); } userState.serviceStateMap.clear(); Loading Loading @@ -401,9 +399,7 @@ public final class TvInputManagerService extends SystemService { } private static boolean shouldMaintainConnection(ServiceState serviceState) { return !serviceState.mClientTokens.isEmpty() || !serviceState.mSessionTokens.isEmpty() || serviceState.mIsHardware; return !serviceState.mSessionTokens.isEmpty() || serviceState.mIsHardware; // TODO: Find a way to maintain connection only when necessary. } Loading Loading @@ -1611,13 +1607,6 @@ public final class TvInputManagerService extends SystemService { pw.increaseIndent(); pw.println("mClientTokens:"); pw.increaseIndent(); for (IBinder token : service.mClientTokens) { pw.println("" + token); } pw.decreaseIndent(); pw.println("mSessionTokens:"); pw.increaseIndent(); for (IBinder token : service.mSessionTokens) { Loading Loading @@ -1754,7 +1743,6 @@ public final class TvInputManagerService extends SystemService { } private final class ServiceState { private final List<IBinder> mClientTokens = new ArrayList<IBinder>(); private final List<IBinder> mSessionTokens = new ArrayList<IBinder>(); private final ServiceConnection mConnection; private final ComponentName mComponent; Loading Loading
services/core/java/com/android/server/tv/TvInputManagerService.java +31 −43 Original line number Diff line number Diff line Loading @@ -212,8 +212,6 @@ public final class TvInputManagerService extends SystemService { private void buildTvInputListLocked(int userId) { UserState userState = getUserStateLocked(userId); Map<String, TvInputState> inputMap = new HashMap<String, TvInputState>(); userState.packageSet.clear(); if (DEBUG) Slog.d(TAG, "buildTvInputList"); Loading @@ -229,8 +227,7 @@ public final class TvInputManagerService extends SystemService { + android.Manifest.permission.BIND_TV_INPUT); continue; } try { inputList.clear(); ComponentName component = new ComponentName(si.packageName, si.name); if (hasHardwarePermission(pm, component)) { ServiceState serviceState = userState.serviceStateMap.get(component); Loading @@ -244,9 +241,20 @@ public final class TvInputManagerService extends SystemService { inputList.addAll(serviceState.mInputList); } } else { try { inputList.add(TvInputInfo.createTvInputInfo(mContext, ri)); } catch (XmlPullParserException | IOException e) { Slog.e(TAG, "Failed to load TV input " + si.name, e); continue; } } // Reconnect the service if existing input is updated. updateServiceConnectionLocked(component, userId); userState.packageSet.add(si.packageName); } Map<String, TvInputState> inputMap = new HashMap<String, TvInputState>(); for (TvInputInfo info : inputList) { if (DEBUG) Slog.d(TAG, "add " + info.getId()); TvInputState state = userState.inputMap.get(info.getId()); Loading @@ -257,15 +265,6 @@ public final class TvInputManagerService extends SystemService { inputMap.put(info.getId(), state); } // Reconnect the service if existing input is updated. updateServiceConnectionLocked(component, userId); userState.packageSet.add(si.packageName); } catch (IOException | XmlPullParserException e) { Slog.e(TAG, "Can't load TV input " + si.name, e); } } for (String inputId : inputMap.keySet()) { if (!userState.inputMap.containsKey(inputId)) { notifyInputAddedLocked(userState, inputId); Loading Loading @@ -338,7 +337,6 @@ public final class TvInputManagerService extends SystemService { Slog.e(TAG, "error in unregisterCallback", e); } } serviceState.mClientTokens.clear(); mContext.unbindService(serviceState.mConnection); } userState.serviceStateMap.clear(); Loading Loading @@ -401,9 +399,7 @@ public final class TvInputManagerService extends SystemService { } private static boolean shouldMaintainConnection(ServiceState serviceState) { return !serviceState.mClientTokens.isEmpty() || !serviceState.mSessionTokens.isEmpty() || serviceState.mIsHardware; return !serviceState.mSessionTokens.isEmpty() || serviceState.mIsHardware; // TODO: Find a way to maintain connection only when necessary. } Loading Loading @@ -1611,13 +1607,6 @@ public final class TvInputManagerService extends SystemService { pw.increaseIndent(); pw.println("mClientTokens:"); pw.increaseIndent(); for (IBinder token : service.mClientTokens) { pw.println("" + token); } pw.decreaseIndent(); pw.println("mSessionTokens:"); pw.increaseIndent(); for (IBinder token : service.mSessionTokens) { Loading Loading @@ -1754,7 +1743,6 @@ public final class TvInputManagerService extends SystemService { } private final class ServiceState { private final List<IBinder> mClientTokens = new ArrayList<IBinder>(); private final List<IBinder> mSessionTokens = new ArrayList<IBinder>(); private final ServiceConnection mConnection; private final ComponentName mComponent; Loading