Merge "Fix toggle QS tiles don't respond when One-handed mode triggered" into tm-dev
This commit is contained in:
@@ -3642,6 +3642,18 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
@ShadeViewRefactor(RefactorComponent.INPUT)
|
@ShadeViewRefactor(RefactorComponent.INPUT)
|
||||||
protected boolean isInsideQsHeader(MotionEvent ev) {
|
protected boolean isInsideQsHeader(MotionEvent ev) {
|
||||||
mQsHeader.getBoundsOnScreen(mQsHeaderBound);
|
mQsHeader.getBoundsOnScreen(mQsHeaderBound);
|
||||||
|
/**
|
||||||
|
* One-handed mode defines a feature FEATURE_ONE_HANDED of DisplayArea {@link DisplayArea}
|
||||||
|
* that will translate down the Y-coordinate whole window screen type except for
|
||||||
|
* TYPE_NAVIGATION_BAR and TYPE_NAVIGATION_BAR_PANEL .{@link DisplayAreaPolicy}.
|
||||||
|
*
|
||||||
|
* So, to consider triggered One-handed mode would translate down the absolute Y-coordinate
|
||||||
|
* of DisplayArea into relative coordinates for all windows, we need to correct the
|
||||||
|
* QS Head bounds here.
|
||||||
|
*/
|
||||||
|
final int xOffset = Math.round(ev.getRawX() - ev.getX());
|
||||||
|
final int yOffset = Math.round(ev.getRawY() - ev.getY());
|
||||||
|
mQsHeaderBound.offsetTo(xOffset, yOffset);
|
||||||
return mQsHeaderBound.contains((int) ev.getRawX(), (int) ev.getRawY());
|
return mQsHeaderBound.contains((int) ev.getRawX(), (int) ev.getRawY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -608,10 +608,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
assertFalse(mStackScroller.isInsideQsHeader(event1));
|
assertFalse(mStackScroller.isInsideQsHeader(event1));
|
||||||
|
|
||||||
MotionEvent event2 = transformEventForView(createMotionEvent(150f, 150f), mStackScroller);
|
MotionEvent event2 = transformEventForView(createMotionEvent(150f, 150f), mStackScroller);
|
||||||
assertTrue(mStackScroller.isInsideQsHeader(event2));
|
assertFalse(mStackScroller.isInsideQsHeader(event2));
|
||||||
|
|
||||||
MotionEvent event3 = transformEventForView(createMotionEvent(250f, 250f), mStackScroller);
|
MotionEvent event3 = transformEventForView(createMotionEvent(250f, 250f), mStackScroller);
|
||||||
assertTrue(mStackScroller.isInsideQsHeader(event2));
|
assertTrue(mStackScroller.isInsideQsHeader(event3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user