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

Commit 9ce9a575 authored by David Zhao's avatar David Zhao Committed by Android (Google) Code Review
Browse files

Merge "Fix 'ConcurrentModificationException' issue" into main

parents aaf3a62e 8afdc1c6
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -401,7 +401,9 @@ public class TvView extends ViewGroup {

    private void resetInternal() {
        mSessionCallback = null;
        synchronized (mPendingAppPrivateCommands) {
            mPendingAppPrivateCommands.clear();
        }
        if (mSession != null) {
            setSessionSurface(null);
            removeSessionOverlayView();
@@ -691,9 +693,12 @@ public class TvView extends ViewGroup {
        } else {
            Log.w(TAG, "sendAppPrivateCommand - session not yet created (action \"" + action
                    + "\" pending)");

            synchronized (mPendingAppPrivateCommands) {
                mPendingAppPrivateCommands.add(Pair.create(action, data));
            }
        }
    }

    /**
     * Dispatches an unhandled input event to the next receiver.
@@ -1320,10 +1325,13 @@ public class TvView extends ViewGroup {
            mSession = session;
            if (session != null) {
                // Sends the pending app private commands first.

                synchronized (mPendingAppPrivateCommands) {
                    for (Pair<String, Bundle> command : mPendingAppPrivateCommands) {
                        mSession.sendAppPrivateCommand(command.first, command.second);
                    }
                    mPendingAppPrivateCommands.clear();
                }

                synchronized (sMainTvViewLock) {
                    if (hasWindowFocus() && TvView.this == sMainTvView.get()