Merge "Tuner: Clean up frontend sharee resource before sharing another resource" into main

This commit is contained in:
Henry Fang
2023-08-09 21:51:39 +00:00
committed by Gerrit Code Review

View File

@@ -443,6 +443,12 @@ public class Tuner implements AutoCloseable {
acquireTRMSLock("shareFrontendFromTuner()");
mFrontendLock.lock();
try {
if (mFeOwnerTuner != null) {
// unregister self from the Frontend callback
mFeOwnerTuner.unregisterFrontendCallbackListener(this);
mFeOwnerTuner = null;
nativeUnshareFrontend();
}
mTunerResourceManager.shareFrontend(mClientId, tuner.mClientId);
mFeOwnerTuner = tuner;
mFeOwnerTuner.registerFrontendCallbackListener(this);