Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d782bbb authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "MediaSessionRecord: add synchronize control for modification of...

Merge "MediaSessionRecord: add synchronize control for modification of mControllerCallbackHolders" into main
parents 0c111009 1853357f
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -786,7 +786,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        if (deadCallbackHolders != null) {
            mControllerCallbackHolders.removeAll(deadCallbackHolders);
            removeControllerHoldersSafely(deadCallbackHolders);
        }
    }

@@ -813,7 +813,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        if (deadCallbackHolders != null) {
            mControllerCallbackHolders.removeAll(deadCallbackHolders);
            removeControllerHoldersSafely(deadCallbackHolders);
        }
    }

@@ -848,7 +848,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        if (deadCallbackHolders != null) {
            mControllerCallbackHolders.removeAll(deadCallbackHolders);
            removeControllerHoldersSafely(deadCallbackHolders);
        }
    }

@@ -875,7 +875,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        if (deadCallbackHolders != null) {
            mControllerCallbackHolders.removeAll(deadCallbackHolders);
            removeControllerHoldersSafely(deadCallbackHolders);
        }
    }

@@ -902,7 +902,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        if (deadCallbackHolders != null) {
            mControllerCallbackHolders.removeAll(deadCallbackHolders);
            removeControllerHoldersSafely(deadCallbackHolders);
        }
    }

@@ -929,7 +929,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        if (deadCallbackHolders != null) {
            mControllerCallbackHolders.removeAll(deadCallbackHolders);
            removeControllerHoldersSafely(deadCallbackHolders);
        }
    }

@@ -954,7 +954,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        if (deadCallbackHolders != null) {
            mControllerCallbackHolders.removeAll(deadCallbackHolders);
            removeControllerHoldersSafely(deadCallbackHolders);
        }
    }

@@ -979,7 +979,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
            }
        }
        // After notifying clear all listeners
        mControllerCallbackHolders.clear();
        removeControllerHoldersSafely(null);
    }

    private PlaybackState getStateWithUpdatedPosition() {
@@ -1027,6 +1027,17 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
        return -1;
    }

    private void removeControllerHoldersSafely(
            Collection<ISessionControllerCallbackHolder> holders) {
        synchronized (mLock) {
            if (holders == null) {
                mControllerCallbackHolders.clear();
            } else {
                mControllerCallbackHolders.removeAll(holders);
            }
        }
    }

    private PlaybackInfo getVolumeAttributes() {
        int volumeType;
        AudioAttributes attributes;