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

Commit b9ce4d03 authored by Annie Chin's avatar Annie Chin
Browse files

Use CopyOnWriteArrayList for mDragCallbacks.

Bug: 33396891

Needs to be combined with a touch fix; this alone will solve crashing,
but not freezing.

Change-Id: Ifab9ef779d00c8a9b59f231fce330ae8fc41528c
parent 8e367265
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ import android.view.View;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class DragLayout extends RelativeLayout {

@@ -40,7 +40,8 @@ public class DragLayout extends RelativeLayout {
    private FrameLayout mHistoryFrame;
    private ViewDragHelper mDragHelper;

    private final List<DragCallback> mDragCallbacks = new ArrayList<>();
    // No concurrency; allow modifications while iterating.
    private final List<DragCallback> mDragCallbacks = new CopyOnWriteArrayList<>();
    private CloseCallback mCloseCallback;

    private int mDraggingState = ViewDragHelper.STATE_IDLE;