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

Commit ae4be880 authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Fix issue with system gesture areas being too large" into sc-dev am:...

Merge "Fix issue with system gesture areas being too large" into sc-dev am: 7a2b7fc4 am: 2442bb9b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14796337

Change-Id: I7997d03ce78a1f391ee80651278d4e72d2fe0d8a
parents eb92c9a2 2442bb9b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1455,8 +1455,7 @@ public class DisplayPolicy {
    }

    void onDisplayInfoChanged(DisplayInfo info) {
        mSystemGestures.screenWidth = info.logicalWidth;
        mSystemGestures.screenHeight = info.logicalHeight;
        mSystemGestures.onDisplayInfoChanged(info);
    }

    private void layoutStatusBar(DisplayFrames displayFrames, Rect contentFrame) {
+14 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.Region;
import android.hardware.display.DisplayManagerGlobal;
@@ -65,6 +66,7 @@ class SystemGesturesPointerEventListener implements PointerEventListener {

    int screenHeight;
    int screenWidth;
    private DisplayInfo mTmpDisplayInfo = new DisplayInfo();
    private int mDownPointers;
    private boolean mSwipeFireable;
    private boolean mDebugFireable;
@@ -75,23 +77,31 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
        mContext = checkNull("context", context);
        mHandler = handler;
        mCallbacks = checkNull("callbacks", callbacks);
        onConfigurationChanged();
    }

    void onDisplayInfoChanged(DisplayInfo info) {
        screenWidth = info.logicalWidth;
        screenHeight = info.logicalHeight;
        onConfigurationChanged();
    }

    void onConfigurationChanged() {
        mSwipeStartThreshold = mContext.getResources()
                .getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);

        final Resources r = mContext.getResources();
        final Display display = DisplayManagerGlobal.getInstance()
                .getRealDisplay(Display.DEFAULT_DISPLAY);
        display.getDisplayInfo(mTmpDisplayInfo);
        mSwipeStartThreshold = mTmpDisplayInfo.logicalWidth > mTmpDisplayInfo.logicalHeight
                ? r.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height_landscape)
                : r.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height_portrait);

        final DisplayCutout displayCutout = display.getCutout();
        if (displayCutout != null) {
            final Rect bounds = displayCutout.getBoundingRectTop();
            if (!bounds.isEmpty()) {
                // Expand swipe start threshold such that we can catch touches that just start below
                // the notch area
                mDisplayCutoutTouchableRegionSize = mContext.getResources().getDimensionPixelSize(
                mDisplayCutoutTouchableRegionSize = r.getDimensionPixelSize(
                        com.android.internal.R.dimen.display_cutout_touchable_region_size);
                mSwipeStartThreshold += mDisplayCutoutTouchableRegionSize;
            }