Loading services/core/java/com/android/server/tv/tunerresourcemanager/CasResource.java +28 −2 Original line number Diff line number Diff line Loading @@ -89,9 +89,35 @@ public class CasResource { * @param ownerId the removing client id of the owner. */ public void removeOwner(int ownerId) { if (mOwnerClientIdsToSessionNum.containsKey(ownerId)) { mAvailableSessionNum += mOwnerClientIdsToSessionNum.get(ownerId); mOwnerClientIdsToSessionNum.remove(ownerId); } } /** * Remove a single session from resource * * @param ownerId the client Id of the owner of the session */ public void removeSession(int ownerId) { if (mOwnerClientIdsToSessionNum.containsKey(ownerId)) { int sessionNum = mOwnerClientIdsToSessionNum.get(ownerId); if (sessionNum > 0) { mOwnerClientIdsToSessionNum.put(ownerId, --sessionNum); mAvailableSessionNum++; } } } /** * Check if there are any open sessions owned by a client * * @param ownerId the client Id of the owner of the sessions */ public boolean hasOpenSessions(int ownerId) { return mOwnerClientIdsToSessionNum.get(ownerId) > 0; } public Set<Integer> getOwnerClientIds() { return mOwnerClientIdsToSessionNum.keySet(); Loading services/core/java/com/android/server/tv/tunerresourcemanager/TunerResourceManagerService.java +7 −5 Original line number Diff line number Diff line Loading @@ -1924,12 +1924,14 @@ public class TunerResourceManagerService extends SystemService implements IBinde ownerProfile.useCiCam(grantingId); } private void updateCasClientMappingOnRelease( @NonNull CasResource releasingCas, int ownerClientId) { private void updateCasClientMappingOnRelease(@NonNull CasResource cas, int ownerClientId) { cas.removeSession(ownerClientId); if (!cas.hasOpenSessions(ownerClientId)) { ClientProfile ownerProfile = getClientProfile(ownerClientId); releasingCas.removeOwner(ownerClientId); cas.removeOwner(ownerClientId); ownerProfile.releaseCas(); } } private void updateCiCamClientMappingOnRelease( @NonNull CiCamResource releasingCiCam, int ownerClientId) { Loading Loading
services/core/java/com/android/server/tv/tunerresourcemanager/CasResource.java +28 −2 Original line number Diff line number Diff line Loading @@ -89,9 +89,35 @@ public class CasResource { * @param ownerId the removing client id of the owner. */ public void removeOwner(int ownerId) { if (mOwnerClientIdsToSessionNum.containsKey(ownerId)) { mAvailableSessionNum += mOwnerClientIdsToSessionNum.get(ownerId); mOwnerClientIdsToSessionNum.remove(ownerId); } } /** * Remove a single session from resource * * @param ownerId the client Id of the owner of the session */ public void removeSession(int ownerId) { if (mOwnerClientIdsToSessionNum.containsKey(ownerId)) { int sessionNum = mOwnerClientIdsToSessionNum.get(ownerId); if (sessionNum > 0) { mOwnerClientIdsToSessionNum.put(ownerId, --sessionNum); mAvailableSessionNum++; } } } /** * Check if there are any open sessions owned by a client * * @param ownerId the client Id of the owner of the sessions */ public boolean hasOpenSessions(int ownerId) { return mOwnerClientIdsToSessionNum.get(ownerId) > 0; } public Set<Integer> getOwnerClientIds() { return mOwnerClientIdsToSessionNum.keySet(); Loading
services/core/java/com/android/server/tv/tunerresourcemanager/TunerResourceManagerService.java +7 −5 Original line number Diff line number Diff line Loading @@ -1924,12 +1924,14 @@ public class TunerResourceManagerService extends SystemService implements IBinde ownerProfile.useCiCam(grantingId); } private void updateCasClientMappingOnRelease( @NonNull CasResource releasingCas, int ownerClientId) { private void updateCasClientMappingOnRelease(@NonNull CasResource cas, int ownerClientId) { cas.removeSession(ownerClientId); if (!cas.hasOpenSessions(ownerClientId)) { ClientProfile ownerProfile = getClientProfile(ownerClientId); releasingCas.removeOwner(ownerClientId); cas.removeOwner(ownerClientId); ownerProfile.releaseCas(); } } private void updateCiCamClientMappingOnRelease( @NonNull CiCamResource releasingCiCam, int ownerClientId) { Loading