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.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
|
||||||
import android.graphics.Region.Op;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pools;
|
import android.util.Pools;
|
||||||
import android.view.DisplayCutout;
|
import android.view.DisplayCutout;
|
||||||
@@ -78,6 +76,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
|||||||
private int[] mTmpTwoArray = new int[2];
|
private int[] mTmpTwoArray = new int[2];
|
||||||
private boolean mHeadsUpGoingAway;
|
private boolean mHeadsUpGoingAway;
|
||||||
private int mStatusBarState;
|
private int mStatusBarState;
|
||||||
|
private Rect mTouchableRegion = new Rect();
|
||||||
|
|
||||||
private AnimationStateHandler mAnimationStateHandler;
|
private AnimationStateHandler mAnimationStateHandler;
|
||||||
|
|
||||||
@@ -297,10 +296,13 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
|||||||
@Nullable
|
@Nullable
|
||||||
public void updateTouchableRegion(ViewTreeObserver.InternalInsetsInfo info) {
|
public void updateTouchableRegion(ViewTreeObserver.InternalInsetsInfo info) {
|
||||||
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||||
|
info.touchableRegion.set(calculateTouchableRegion());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rect calculateTouchableRegion() {
|
||||||
if (!hasPinnedHeadsUp()) {
|
if (!hasPinnedHeadsUp()) {
|
||||||
info.touchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
|
mTouchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
|
||||||
updateRegionForNotch(info.touchableRegion);
|
updateRegionForNotch(mTouchableRegion);
|
||||||
} else {
|
} else {
|
||||||
NotificationEntry topEntry = getTopEntry();
|
NotificationEntry topEntry = getTopEntry();
|
||||||
if (topEntry.isChildInGroup()) {
|
if (topEntry.isChildInGroup()) {
|
||||||
@@ -315,11 +317,12 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
|||||||
int minX = mTmpTwoArray[0];
|
int minX = mTmpTwoArray[0];
|
||||||
int maxX = mTmpTwoArray[0] + topRow.getWidth();
|
int maxX = mTmpTwoArray[0] + topRow.getWidth();
|
||||||
int height = topRow.getIntrinsicHeight();
|
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();
|
DisplayCutout cutout = mStatusBarWindowView.getRootWindowInsets().getDisplayCutout();
|
||||||
if (cutout == null) {
|
if (cutout == null) {
|
||||||
return;
|
return;
|
||||||
@@ -330,7 +333,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
|
|||||||
Rect bounds = new Rect();
|
Rect bounds = new Rect();
|
||||||
ScreenDecorations.DisplayCutoutView.boundsFromDirection(cutout, Gravity.TOP, bounds);
|
ScreenDecorations.DisplayCutoutView.boundsFromDirection(cutout, Gravity.TOP, bounds);
|
||||||
bounds.offset(0, mDisplayCutoutTouchableRegionSize);
|
bounds.offset(0, mDisplayCutoutTouchableRegionSize);
|
||||||
region.op(bounds, Op.UNION);
|
region.union(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ import com.android.systemui.util.InjectionInflationController;
|
|||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
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 String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek";
|
||||||
|
|
||||||
private static final Rect mDummyDirtyRect = new Rect(0, 0, 1, 1);
|
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()
|
private static final AnimationProperties CLOCK_ANIMATION_PROPERTIES = new AnimationProperties()
|
||||||
.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
||||||
@@ -596,6 +598,25 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mQs.setHeightOverride(mQs.getDesiredHeight());
|
mQs.setHeightOverride(mQs.getDesiredHeight());
|
||||||
}
|
}
|
||||||
updateMaxHeadsUpTranslation();
|
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) {
|
private void setIsFullWidth(boolean isFullWidth) {
|
||||||
@@ -1798,6 +1819,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
updateHeader();
|
updateHeader();
|
||||||
updateNotificationTranslucency();
|
updateNotificationTranslucency();
|
||||||
updatePanelExpanded();
|
updatePanelExpanded();
|
||||||
|
updateGestureExclusionRect();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
@@ -2568,6 +2590,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mNotificationStackScroller.runAfterAnimationFinished(
|
mNotificationStackScroller.runAfterAnimationFinished(
|
||||||
mHeadsUpExistenceChangedRunnable);
|
mHeadsUpExistenceChangedRunnable);
|
||||||
}
|
}
|
||||||
|
updateGestureExclusionRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
|
public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
|
||||||
@@ -2992,6 +3015,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
@Override
|
@Override
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
super.dump(fd, pw, args);
|
super.dump(fd, pw, args);
|
||||||
|
pw.println(" gestureExclusionRect: " + calculateGestureExclusionRect());
|
||||||
if (mKeyguardStatusBar != null) {
|
if (mKeyguardStatusBar != null) {
|
||||||
mKeyguardStatusBar.dump(fd, pw, args);
|
mKeyguardStatusBar.dump(fd, pw, args);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user