Loading services/core/java/com/android/server/tv/TvInputManagerService.java +14 −14 Original line number Diff line number Diff line Loading @@ -143,9 +143,9 @@ public final class TvInputManagerService extends SystemService { // ID of the current user. @GuardedBy("mLock") private int mCurrentUserId = UserHandle.USER_SYSTEM; // IDs of the running managed profiles. Their parent user ID should be mCurrentUserId. // IDs of the running profiles. Their parent user ID should be mCurrentUserId. @GuardedBy("mLock") private final Set<Integer> mRunningManagedProfile = new HashSet<>(); private final Set<Integer> mRunningProfiles = new HashSet<>(); // A map from user id to UserState. @GuardedBy("mLock") Loading Loading @@ -440,13 +440,13 @@ public final class TvInputManagerService extends SystemService { private void startUser(int userId) { synchronized (mLock) { if (userId == mCurrentUserId || mRunningManagedProfile.contains(userId)) { if (userId == mCurrentUserId || mRunningProfiles.contains(userId)) { // user already started return; } UserInfo userInfo = mUserManager.getUserInfo(userId); UserInfo parentInfo = mUserManager.getProfileParent(userId); if (userInfo.isManagedProfile() if (userInfo.isProfile() && parentInfo != null && parentInfo.id == mCurrentUserId) { // only the children of the current user can be started in background Loading @@ -463,13 +463,13 @@ public final class TvInputManagerService extends SystemService { releaseSessionOfUserLocked(userId); unbindServiceOfUserLocked(userId); mRunningManagedProfile.remove(userId); mRunningProfiles.remove(userId); } private void startProfileLocked(int userId) { buildTvInputListLocked(userId, null); buildTvContentRatingSystemListLocked(userId); mRunningManagedProfile.add(userId); mRunningProfiles.add(userId); } private void switchUser(int userId) { Loading @@ -478,16 +478,16 @@ public final class TvInputManagerService extends SystemService { return; } UserInfo userInfo = mUserManager.getUserInfo(userId); if (userInfo.isManagedProfile()) { Slog.w(TAG, "cannot switch to a managed profile!"); if (userInfo.isProfile()) { Slog.w(TAG, "cannot switch to a profile!"); return; } for (int runningId : mRunningManagedProfile) { for (int runningId : mRunningProfiles) { releaseSessionOfUserLocked(runningId); unbindServiceOfUserLocked(runningId); } mRunningManagedProfile.clear(); mRunningProfiles.clear(); releaseSessionOfUserLocked(mCurrentUserId); unbindServiceOfUserLocked(mCurrentUserId); Loading Loading @@ -630,7 +630,7 @@ public final class TvInputManagerService extends SystemService { userState.mCallbacks.kill(); userState.mainSessionToken = null; mRunningManagedProfile.remove(userId); mRunningProfiles.remove(userId); mUserStates.remove(userId); if (userId == mCurrentUserId) { Loading Loading @@ -729,7 +729,7 @@ public final class TvInputManagerService extends SystemService { } boolean shouldBind; if (userId == mCurrentUserId || mRunningManagedProfile.contains(userId)) { if (userId == mCurrentUserId || mRunningProfiles.contains(userId)) { shouldBind = !serviceState.sessionTokens.isEmpty() || serviceState.isHardware; } else { // For a non-current user, Loading Loading @@ -1400,9 +1400,9 @@ public final class TvInputManagerService extends SystemService { String uniqueSessionId = UUID.randomUUID().toString(); try { synchronized (mLock) { if (userId != mCurrentUserId && !mRunningManagedProfile.contains(userId) if (userId != mCurrentUserId && !mRunningProfiles.contains(userId) && !isRecordingSession) { // Only current user and its running managed profiles can create // Only current user and its running profiles can create // non-recording sessions. // Let the client get onConnectionFailed callback for this case. sendSessionTokenToClientLocked(client, inputId, null, null, seq); Loading Loading
services/core/java/com/android/server/tv/TvInputManagerService.java +14 −14 Original line number Diff line number Diff line Loading @@ -143,9 +143,9 @@ public final class TvInputManagerService extends SystemService { // ID of the current user. @GuardedBy("mLock") private int mCurrentUserId = UserHandle.USER_SYSTEM; // IDs of the running managed profiles. Their parent user ID should be mCurrentUserId. // IDs of the running profiles. Their parent user ID should be mCurrentUserId. @GuardedBy("mLock") private final Set<Integer> mRunningManagedProfile = new HashSet<>(); private final Set<Integer> mRunningProfiles = new HashSet<>(); // A map from user id to UserState. @GuardedBy("mLock") Loading Loading @@ -440,13 +440,13 @@ public final class TvInputManagerService extends SystemService { private void startUser(int userId) { synchronized (mLock) { if (userId == mCurrentUserId || mRunningManagedProfile.contains(userId)) { if (userId == mCurrentUserId || mRunningProfiles.contains(userId)) { // user already started return; } UserInfo userInfo = mUserManager.getUserInfo(userId); UserInfo parentInfo = mUserManager.getProfileParent(userId); if (userInfo.isManagedProfile() if (userInfo.isProfile() && parentInfo != null && parentInfo.id == mCurrentUserId) { // only the children of the current user can be started in background Loading @@ -463,13 +463,13 @@ public final class TvInputManagerService extends SystemService { releaseSessionOfUserLocked(userId); unbindServiceOfUserLocked(userId); mRunningManagedProfile.remove(userId); mRunningProfiles.remove(userId); } private void startProfileLocked(int userId) { buildTvInputListLocked(userId, null); buildTvContentRatingSystemListLocked(userId); mRunningManagedProfile.add(userId); mRunningProfiles.add(userId); } private void switchUser(int userId) { Loading @@ -478,16 +478,16 @@ public final class TvInputManagerService extends SystemService { return; } UserInfo userInfo = mUserManager.getUserInfo(userId); if (userInfo.isManagedProfile()) { Slog.w(TAG, "cannot switch to a managed profile!"); if (userInfo.isProfile()) { Slog.w(TAG, "cannot switch to a profile!"); return; } for (int runningId : mRunningManagedProfile) { for (int runningId : mRunningProfiles) { releaseSessionOfUserLocked(runningId); unbindServiceOfUserLocked(runningId); } mRunningManagedProfile.clear(); mRunningProfiles.clear(); releaseSessionOfUserLocked(mCurrentUserId); unbindServiceOfUserLocked(mCurrentUserId); Loading Loading @@ -630,7 +630,7 @@ public final class TvInputManagerService extends SystemService { userState.mCallbacks.kill(); userState.mainSessionToken = null; mRunningManagedProfile.remove(userId); mRunningProfiles.remove(userId); mUserStates.remove(userId); if (userId == mCurrentUserId) { Loading Loading @@ -729,7 +729,7 @@ public final class TvInputManagerService extends SystemService { } boolean shouldBind; if (userId == mCurrentUserId || mRunningManagedProfile.contains(userId)) { if (userId == mCurrentUserId || mRunningProfiles.contains(userId)) { shouldBind = !serviceState.sessionTokens.isEmpty() || serviceState.isHardware; } else { // For a non-current user, Loading Loading @@ -1400,9 +1400,9 @@ public final class TvInputManagerService extends SystemService { String uniqueSessionId = UUID.randomUUID().toString(); try { synchronized (mLock) { if (userId != mCurrentUserId && !mRunningManagedProfile.contains(userId) if (userId != mCurrentUserId && !mRunningProfiles.contains(userId) && !isRecordingSession) { // Only current user and its running managed profiles can create // Only current user and its running profiles can create // non-recording sessions. // Let the client get onConnectionFailed callback for this case. sendSessionTokenToClientLocked(client, inputId, null, null, seq); Loading