Merge "When sharing to new frontend, stop sharing with old"
This commit is contained in:
@@ -1342,6 +1342,10 @@ int JTuner::shareFrontend(int feId) {
|
|||||||
return (int)Result::INVALID_STATE;
|
return (int)Result::INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mDemuxClient != NULL) {
|
||||||
|
mDemuxClient->setFrontendDataSourceById(feId);
|
||||||
|
}
|
||||||
|
|
||||||
mSharedFeId = feId;
|
mSharedFeId = feId;
|
||||||
return (int)Result::SUCCESS;
|
return (int)Result::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ public final class ClientProfile {
|
|||||||
*/
|
*/
|
||||||
private Set<Integer> mShareFeClientIds = new HashSet<>();
|
private Set<Integer> mShareFeClientIds = new HashSet<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client id sharee that has shared frontend with the current client.
|
||||||
|
*/
|
||||||
|
private Integer mShareeFeClientId = INVALID_RESOURCE_ID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of the Lnb handles that are used by the current client.
|
* List of the Lnb handles that are used by the current client.
|
||||||
*/
|
*/
|
||||||
@@ -223,12 +228,21 @@ public final class ClientProfile {
|
|||||||
return mShareFeClientIds;
|
return mShareFeClientIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getShareeFeClientId() {
|
||||||
|
return mShareeFeClientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareeFeClientId(Integer shareeFeClientId) {
|
||||||
|
mShareeFeClientId = shareeFeClientId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the client released a frontend.
|
* Called when the client released a frontend.
|
||||||
*/
|
*/
|
||||||
public void releaseFrontend() {
|
public void releaseFrontend() {
|
||||||
mUsingFrontendHandles.clear();
|
mUsingFrontendHandles.clear();
|
||||||
mShareFeClientIds.clear();
|
mShareFeClientIds.clear();
|
||||||
|
mShareeFeClientId = INVALID_RESOURCE_ID;
|
||||||
mPrimaryUsingFrontendHandle = TunerResourceManager.INVALID_RESOURCE_HANDLE;
|
mPrimaryUsingFrontendHandle = TunerResourceManager.INVALID_RESOURCE_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -996,9 +996,15 @@ public class TunerResourceManagerService extends SystemService implements IBinde
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "shareFrontend from " + selfClientId + " with " + targetClientId);
|
Slog.d(TAG, "shareFrontend from " + selfClientId + " with " + targetClientId);
|
||||||
}
|
}
|
||||||
|
Integer shareeFeClientId = getClientProfile(selfClientId).getShareeFeClientId();
|
||||||
|
if (shareeFeClientId != ClientProfile.INVALID_RESOURCE_ID) {
|
||||||
|
getClientProfile(shareeFeClientId).stopSharingFrontend(selfClientId);
|
||||||
|
getClientProfile(selfClientId).releaseFrontend();
|
||||||
|
}
|
||||||
for (int feId : getClientProfile(targetClientId).getInUseFrontendHandles()) {
|
for (int feId : getClientProfile(targetClientId).getInUseFrontendHandles()) {
|
||||||
getClientProfile(selfClientId).useFrontend(feId);
|
getClientProfile(selfClientId).useFrontend(feId);
|
||||||
}
|
}
|
||||||
|
getClientProfile(selfClientId).setShareeFeClientId(targetClientId);
|
||||||
getClientProfile(targetClientId).shareFrontend(selfClientId);
|
getClientProfile(targetClientId).shareFrontend(selfClientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1008,6 +1014,8 @@ public class TunerResourceManagerService extends SystemService implements IBinde
|
|||||||
// change the owner of all the inUse frontend
|
// change the owner of all the inUse frontend
|
||||||
newOwnerProfile.shareFrontend(currentOwnerId);
|
newOwnerProfile.shareFrontend(currentOwnerId);
|
||||||
currentOwnerProfile.stopSharingFrontend(newOwnerId);
|
currentOwnerProfile.stopSharingFrontend(newOwnerId);
|
||||||
|
newOwnerProfile.setShareeFeClientId(ClientProfile.INVALID_RESOURCE_ID);
|
||||||
|
currentOwnerProfile.setShareeFeClientId(newOwnerId);
|
||||||
for (int inUseHandle : newOwnerProfile.getInUseFrontendHandles()) {
|
for (int inUseHandle : newOwnerProfile.getInUseFrontendHandles()) {
|
||||||
getFrontendResource(inUseHandle).setOwner(newOwnerId);
|
getFrontendResource(inUseHandle).setOwner(newOwnerId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user