Merge "Fix issue with system gesture areas being too large" into sc-dev
This commit is contained in:
@@ -1453,8 +1453,7 @@ public class DisplayPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onDisplayInfoChanged(DisplayInfo info) {
|
void onDisplayInfoChanged(DisplayInfo info) {
|
||||||
mSystemGestures.screenWidth = info.logicalWidth;
|
mSystemGestures.onDisplayInfoChanged(info);
|
||||||
mSystemGestures.screenHeight = info.logicalHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void layoutStatusBar(DisplayFrames displayFrames, Rect contentFrame) {
|
private void layoutStatusBar(DisplayFrames displayFrames, Rect contentFrame) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.server.wm;
|
package com.android.server.wm;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.hardware.display.DisplayManagerGlobal;
|
import android.hardware.display.DisplayManagerGlobal;
|
||||||
@@ -65,6 +66,7 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
|
|||||||
|
|
||||||
int screenHeight;
|
int screenHeight;
|
||||||
int screenWidth;
|
int screenWidth;
|
||||||
|
private DisplayInfo mTmpDisplayInfo = new DisplayInfo();
|
||||||
private int mDownPointers;
|
private int mDownPointers;
|
||||||
private boolean mSwipeFireable;
|
private boolean mSwipeFireable;
|
||||||
private boolean mDebugFireable;
|
private boolean mDebugFireable;
|
||||||
@@ -75,23 +77,31 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
|
|||||||
mContext = checkNull("context", context);
|
mContext = checkNull("context", context);
|
||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mCallbacks = checkNull("callbacks", callbacks);
|
mCallbacks = checkNull("callbacks", callbacks);
|
||||||
|
onConfigurationChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDisplayInfoChanged(DisplayInfo info) {
|
||||||
|
screenWidth = info.logicalWidth;
|
||||||
|
screenHeight = info.logicalHeight;
|
||||||
onConfigurationChanged();
|
onConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onConfigurationChanged() {
|
void onConfigurationChanged() {
|
||||||
mSwipeStartThreshold = mContext.getResources()
|
final Resources r = mContext.getResources();
|
||||||
.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
|
|
||||||
|
|
||||||
final Display display = DisplayManagerGlobal.getInstance()
|
final Display display = DisplayManagerGlobal.getInstance()
|
||||||
.getRealDisplay(Display.DEFAULT_DISPLAY);
|
.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();
|
final DisplayCutout displayCutout = display.getCutout();
|
||||||
if (displayCutout != null) {
|
if (displayCutout != null) {
|
||||||
final Rect bounds = displayCutout.getBoundingRectTop();
|
final Rect bounds = displayCutout.getBoundingRectTop();
|
||||||
if (!bounds.isEmpty()) {
|
if (!bounds.isEmpty()) {
|
||||||
// Expand swipe start threshold such that we can catch touches that just start below
|
// Expand swipe start threshold such that we can catch touches that just start below
|
||||||
// the notch area
|
// the notch area
|
||||||
mDisplayCutoutTouchableRegionSize = mContext.getResources().getDimensionPixelSize(
|
mDisplayCutoutTouchableRegionSize = r.getDimensionPixelSize(
|
||||||
com.android.internal.R.dimen.display_cutout_touchable_region_size);
|
com.android.internal.R.dimen.display_cutout_touchable_region_size);
|
||||||
mSwipeStartThreshold += mDisplayCutoutTouchableRegionSize;
|
mSwipeStartThreshold += mDisplayCutoutTouchableRegionSize;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user