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

Commit f1c06a21 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MediaPlayer2: keep EventCallbacks when reset"

parents c785e6d7 2472c30d
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -436,13 +436,6 @@ public class MediaPlayer2 implements AutoCloseable
     */
    // This is a synchronous call.
    public void reset() {
        synchronized (mEventCbLock) {
            mEventCallbackRecords.clear();
        }
        synchronized (mDrmEventCbLock) {
            mDrmEventCallbackRecords.clear();
        }

        clearSourceInfos();

        stayAwake(false);
@@ -2758,6 +2751,12 @@ public class MediaPlayer2 implements AutoCloseable
                    "Illegal null Executor for the EventCallback");
        }
        synchronized (mEventCbLock) {
            for (Pair<Executor, EventCallback> cb : mEventCallbackRecords) {
                if (cb.first == executor && cb.second == eventCallback) {
                    Log.w(TAG, "The callback has been registered before.");
                    return;
                }
            }
            mEventCallbackRecords.add(new Pair(executor, eventCallback));
        }
    }