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

Commit a084fa1c authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Android (Google) Code Review
Browse files

Merge "[CD] Fix Exception in EBGH when display is null" into main

parents b7cc19dc 32020b4e
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -691,9 +691,18 @@ public class EdgeBackGestureHandler {
    public void onDisplayAddSystemDecorations(int displayId) {
        if (enableMultidisplayTrackpadBackGesture() && mIsEnabled) {
            mUiThreadContext.runWithScissors(() -> {
                if (displayId == Display.DEFAULT_DISPLAY) {
                    Log.w(TAG, "onDisplayAddSystemDecorations called for main display");
                    return;
                }
                Display display = mDisplayManager.getDisplay(displayId);
                if (display == null) {
                    Log.w(TAG, "createDisplayBackGestureHandler: can't find display");
                    return;
                }
                removeAndDisposeDisplayResource(displayId);
                mDisplayBackGestureHandlers.put(displayId,
                        createDisplayBackGestureHandler(displayId));
                        createDisplayBackGestureHandler(display));
            });
        }
    }
@@ -709,12 +718,11 @@ public class EdgeBackGestureHandler {
        }
    }

    private DisplayBackGestureHandler createDisplayBackGestureHandler(int displayId) {
        Display display = mDisplayManager.getDisplay(displayId);
    private DisplayBackGestureHandler createDisplayBackGestureHandler(Display display) {
        Context windowContext = mContext.createWindowContext(display,
                WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL, null);
        WindowManager displayWindowManager = mDefaultWindowManager;
        if (displayId != mMainDisplayId) {
        if (display.getDisplayId() != mMainDisplayId) {
            displayWindowManager = windowContext.getSystemService(WindowManager.class);
            if (displayWindowManager == null) {
                displayWindowManager = mDefaultWindowManager;
@@ -815,9 +823,8 @@ public class EdgeBackGestureHandler {
                if (enableMultidisplayTrackpadBackGesture()) {
                    // Registers input event receiver and adds a nav bar panel window
                    for (Display display : mDisplayManager.getDisplays()) {
                        int displayId = display.getDisplayId();
                        mDisplayBackGestureHandlers.put(displayId,
                                createDisplayBackGestureHandler(displayId));
                        mDisplayBackGestureHandlers.put(display.getDisplayId(),
                                createDisplayBackGestureHandler(display));
                    }
                } else {
                    // Register input event receiver