Merge "Exclude the status bar and HUN from gestures" into qt-dev
This commit is contained in:
@@ -22,8 +22,6 @@ import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.Region.Op;
|
||||
import android.util.Log;
|
||||
import android.util.Pools;
|
||||
import android.view.DisplayCutout;
|
||||
@@ -78,6 +76,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
private int[] mTmpTwoArray = new int[2];
|
||||
private boolean mHeadsUpGoingAway;
|
||||
private int mStatusBarState;
|
||||
private Rect mTouchableRegion = new Rect();
|
||||
|
||||
private AnimationStateHandler mAnimationStateHandler;
|
||||
|
||||
@@ -297,10 +296,13 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
@Nullable
|
||||
public void updateTouchableRegion(ViewTreeObserver.InternalInsetsInfo info) {
|
||||
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||
info.touchableRegion.set(calculateTouchableRegion());
|
||||
}
|
||||
|
||||
public Rect calculateTouchableRegion() {
|
||||
if (!hasPinnedHeadsUp()) {
|
||||
info.touchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
|
||||
updateRegionForNotch(info.touchableRegion);
|
||||
mTouchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
|
||||
updateRegionForNotch(mTouchableRegion);
|
||||
} else {
|
||||
NotificationEntry topEntry = getTopEntry();
|
||||
if (topEntry.isChildInGroup()) {
|
||||
@@ -315,11 +317,12 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
int minX = mTmpTwoArray[0];
|
||||
int maxX = mTmpTwoArray[0] + topRow.getWidth();
|
||||
int height = topRow.getIntrinsicHeight();
|
||||
info.touchableRegion.set(minX, 0, maxX, mHeadsUpInset + height);
|
||||
mTouchableRegion.set(minX, 0, maxX, mHeadsUpInset + height);
|
||||
}
|
||||
return mTouchableRegion;
|
||||
}
|
||||
|
||||
private void updateRegionForNotch(Region region) {
|
||||
private void updateRegionForNotch(Rect region) {
|
||||
DisplayCutout cutout = mStatusBarWindowView.getRootWindowInsets().getDisplayCutout();
|
||||
if (cutout == null) {
|
||||
return;
|
||||
@@ -330,7 +333,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
||||
Rect bounds = new Rect();
|
||||
ScreenDecorations.DisplayCutoutView.boundsFromDirection(cutout, Gravity.TOP, bounds);
|
||||
bounds.offset(0, mDisplayCutoutTouchableRegionSize);
|
||||
region.op(bounds, Op.UNION);
|
||||
region.union(bounds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -100,6 +100,7 @@ import com.android.systemui.util.InjectionInflationController;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -141,6 +142,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
private static final String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek";
|
||||
|
||||
private static final Rect mDummyDirtyRect = new Rect(0, 0, 1, 1);
|
||||
private static final Rect mEmptyRect = new Rect();
|
||||
|
||||
private static final AnimationProperties CLOCK_ANIMATION_PROPERTIES = new AnimationProperties()
|
||||
.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
||||
@@ -596,6 +598,25 @@ public class NotificationPanelView extends PanelView implements
|
||||
mQs.setHeightOverride(mQs.getDesiredHeight());
|
||||
}
|
||||
updateMaxHeadsUpTranslation();
|
||||
updateGestureExclusionRect();
|
||||
}
|
||||
|
||||
private void updateGestureExclusionRect() {
|
||||
Rect exclusionRect = calculateGestureExclusionRect();
|
||||
setSystemGestureExclusionRects(exclusionRect.isEmpty()
|
||||
? Collections.EMPTY_LIST
|
||||
: Collections.singletonList(exclusionRect));
|
||||
}
|
||||
|
||||
private Rect calculateGestureExclusionRect() {
|
||||
Rect exclusionRect = null;
|
||||
if (isFullyCollapsed()) {
|
||||
// Note: The heads up manager also calculates the non-pinned touchable region
|
||||
exclusionRect = mHeadsUpManager.calculateTouchableRegion();
|
||||
}
|
||||
return exclusionRect != null
|
||||
? exclusionRect
|
||||
: mEmptyRect;
|
||||
}
|
||||
|
||||
private void setIsFullWidth(boolean isFullWidth) {
|
||||
@@ -1798,6 +1819,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
updateHeader();
|
||||
updateNotificationTranslucency();
|
||||
updatePanelExpanded();
|
||||
updateGestureExclusionRect();
|
||||
if (DEBUG) {
|
||||
invalidate();
|
||||
}
|
||||
@@ -2568,6 +2590,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
mNotificationStackScroller.runAfterAnimationFinished(
|
||||
mHeadsUpExistenceChangedRunnable);
|
||||
}
|
||||
updateGestureExclusionRect();
|
||||
}
|
||||
|
||||
public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
|
||||
@@ -2992,6 +3015,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
super.dump(fd, pw, args);
|
||||
pw.println(" gestureExclusionRect: " + calculateGestureExclusionRect());
|
||||
if (mKeyguardStatusBar != null) {
|
||||
mKeyguardStatusBar.dump(fd, pw, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user