Move close callback outside ProgramList lock
The callback of on-close listener in program list was moved outside of the lock in porgram list to avoid the deadlock between program list and tuner adpater. Bug: 254505565 Test: atest android.radio.cts.RadioTunerTest Change-Id: I9c668c63a578ba04b52747e0ef96e9e67cc00b72
This commit is contained in:
@@ -160,6 +160,7 @@ public final class ProgramList implements AutoCloseable {
|
|||||||
* Disables list updates and releases all resources.
|
* Disables list updates and releases all resources.
|
||||||
*/
|
*/
|
||||||
public void close() {
|
public void close() {
|
||||||
|
OnCloseListener onCompleteListenersCopied = null;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mIsClosed) return;
|
if (mIsClosed) return;
|
||||||
mIsClosed = true;
|
mIsClosed = true;
|
||||||
@@ -167,10 +168,14 @@ public final class ProgramList implements AutoCloseable {
|
|||||||
mListCallbacks.clear();
|
mListCallbacks.clear();
|
||||||
mOnCompleteListeners.clear();
|
mOnCompleteListeners.clear();
|
||||||
if (mOnCloseListener != null) {
|
if (mOnCloseListener != null) {
|
||||||
mOnCloseListener.onClose();
|
onCompleteListenersCopied = mOnCloseListener;
|
||||||
mOnCloseListener = null;
|
mOnCloseListener = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (onCompleteListenersCopied != null) {
|
||||||
|
onCompleteListenersCopied.onClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(Chunk chunk) {
|
void apply(Chunk chunk) {
|
||||||
|
|||||||
Reference in New Issue
Block a user