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

Commit e578aed5 authored by Keun-young Park's avatar Keun-young Park Committed by Automerger Merge Worker
Browse files

Merge "Fix crash coming from accessing invalid display from GestureDetector"...

Merge "Fix crash coming from accessing invalid display from GestureDetector" into rvc-dev am: 0b4de9e6 am: 0d363390 am: 6fda8fe8 am: c6badf4e

Change-Id: I4340a4516e315ee4c37a7754b988b1dca96b7a09
parents 0aefb518 c6badf4e
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.SystemClock;
import android.util.Slog;
import android.view.Display;
import android.view.DisplayCutout;
import android.view.DisplayInfo;
import android.view.GestureDetector;
import android.view.InputDevice;
import android.view.MotionEvent;
@@ -117,8 +118,17 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
        // GestureDetector would get a ViewConfiguration instance by context, that may also
        // create a new WindowManagerImpl for the new display, and lock WindowManagerGlobal
        // temporarily in the constructor that would make a deadlock.
        mHandler.post(() -> mGestureDetector =
                new GestureDetector(mContext, new FlingGestureDetector(), mHandler) {});
        mHandler.post(() -> {
            final int displayId = mContext.getDisplayId();
            final DisplayInfo info = DisplayManagerGlobal.getInstance().getDisplayInfo(displayId);
            if (info == null) {
                // Display already removed, stop here.
                Slog.w(TAG, "Cannot create GestureDetector, display removed:" + displayId);
                return;
            }
            mGestureDetector = new GestureDetector(mContext, new FlingGestureDetector(), mHandler) {
            };
        });
    }

    @Override