Lines Matching refs:serviceState
284 ServiceState serviceState = userState.serviceStateMap.get(component);
285 if (serviceState == null) {
286 // New hardware input found. Create a new ServiceState and connect to the
288 serviceState = new ServiceState(component, userId);
289 userState.serviceStateMap.put(component, serviceState);
292 inputList.addAll(serviceState.hardwareInputMap.values());
338 ServiceState serviceState = userState.serviceStateMap.get(info.getComponent());
339 if (serviceState != null) {
340 abortPendingCreateSessionRequestsLocked(serviceState, inputId, userId);
401 ServiceState serviceState = userState.serviceStateMap.get(component);
402 if (serviceState != null && serviceState.sessionTokens.isEmpty()) {
403 if (serviceState.callback != null) {
405 serviceState.service.unregisterCallback(serviceState.callback);
410 mContext.unbindService(serviceState.connection);
466 for (ServiceState serviceState : userState.serviceStateMap.values()) {
467 if (serviceState.service != null) {
468 if (serviceState.callback != null) {
470 serviceState.service.unregisterCallback(serviceState.callback);
475 mContext.unbindService(serviceState.connection);
513 private ServiceState getServiceStateLocked(ComponentName component, int userId) {
515 ServiceState serviceState = userState.serviceStateMap.get(component);
516 if (serviceState == null) {
520 return serviceState;
558 ServiceState serviceState = userState.serviceStateMap.get(component);
559 if (serviceState == null) {
562 if (serviceState.reconnecting) {
563 if (!serviceState.sessionTokens.isEmpty()) {
567 serviceState.reconnecting = false;
572 shouldBind = !serviceState.sessionTokens.isEmpty() || serviceState.isHardware;
578 shouldBind = !serviceState.sessionTokens.isEmpty();
581 if (serviceState.service == null && shouldBind) {
584 if (serviceState.bound) {
594 serviceState.bound = mContext.bindServiceAsUser(
595 i, serviceState.connection,
598 } else if (serviceState.service != null && !shouldBind) {
604 mContext.unbindService(serviceState.connection);
609 private void abortPendingCreateSessionRequestsLocked(ServiceState serviceState,
614 for (IBinder sessionToken : serviceState.sessionTokens) {
626 updateServiceConnectionLocked(serviceState.component, userId);
713 ServiceState serviceState = userState.serviceStateMap.get(sessionState.componentName);
714 if (serviceState != null) {
715 serviceState.sessionTokens.remove(sessionToken);
733 ServiceState serviceState = getServiceStateLocked(sessionState.componentName, userId);
734 if (!serviceState.isHardware) {
830 ServiceState serviceState = userState.serviceStateMap.get(inputState.info.getComponent());
833 if (serviceState != null && serviceState.service == null
834 && (!serviceState.sessionTokens.isEmpty() || serviceState.isHardware)) {
1166 ServiceState serviceState = userState.serviceStateMap.get(info.getComponent());
1167 if (serviceState == null) {
1168 serviceState = new ServiceState(info.getComponent(), resolvedUserId);
1169 userState.serviceStateMap.put(info.getComponent(), serviceState);
1172 if (serviceState.reconnecting) {
1187 serviceState.sessionTokens.add(sessionToken);
1189 if (serviceState.service != null) {
1190 createSessionInternalLocked(serviceState.service, sessionToken,
2041 pw.println("serviceStateMap: ComponentName -> ServiceState");
2043 for (Map.Entry<ComponentName, ServiceState> entry :
2045 ServiceState service = entry.getValue();
2117 private final Map<ComponentName, ServiceState> serviceStateMap = new HashMap<>();
2170 private final class ServiceState {
2182 private ServiceState(ComponentName component, int userId) {
2259 ServiceState serviceState = userState.serviceStateMap.get(mComponent);
2260 serviceState.service = ITvInputService.Stub.asInterface(service);
2263 if (serviceState.isHardware && serviceState.callback == null) {
2264 serviceState.callback = new ServiceCallback(mComponent, mUserId);
2266 serviceState.service.registerCallback(serviceState.callback);
2273 for (IBinder sessionToken : serviceState.sessionTokens) {
2274 createSessionInternalLocked(serviceState.service, sessionToken, mUserId);
2285 if (serviceState.isHardware) {
2286 serviceState.hardwareInputMap.clear();
2289 serviceState.service.notifyHardwareAdded(hardware);
2296 serviceState.service.notifyHdmiDeviceAdded(device);
2316 ServiceState serviceState = userState.serviceStateMap.get(mComponent);
2317 if (serviceState != null) {
2318 serviceState.reconnecting = true;
2319 serviceState.bound = false;
2320 serviceState.service = null;
2321 serviceState.callback = null;
2323 abortPendingCreateSessionRequestsLocked(serviceState, null, mUserId);
2352 ServiceState serviceState = getServiceStateLocked(mComponent, mUserId);
2353 serviceState.hardwareInputMap.put(inputInfo.getId(), inputInfo);
2378 ServiceState serviceState = getServiceStateLocked(mComponent, mUserId);
2379 boolean removed = serviceState.hardwareInputMap.remove(inputId) != null;
2833 for (ServiceState serviceState : userState.serviceStateMap.values()) {
2834 if (!serviceState.isHardware || serviceState.service == null) continue;
2836 serviceState.service.notifyHardwareAdded(info);
2849 for (ServiceState serviceState : userState.serviceStateMap.values()) {
2850 if (!serviceState.isHardware || serviceState.service == null) continue;
2852 serviceState.service.notifyHardwareRemoved(info);
2865 for (ServiceState serviceState : userState.serviceStateMap.values()) {
2866 if (!serviceState.isHardware || serviceState.service == null) continue;
2868 serviceState.service.notifyHdmiDeviceAdded(deviceInfo);
2881 for (ServiceState serviceState : userState.serviceStateMap.values()) {
2882 if (!serviceState.isHardware || serviceState.service == null) continue;
2884 serviceState.service.notifyHdmiDeviceRemoved(deviceInfo);