Merge "[Bouncer] Fix swipe to unlock being too fast." into tm-qpr-dev
This commit is contained in:
@@ -1297,7 +1297,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
+ mAmbientState.getOverExpansion()
|
+ mAmbientState.getOverExpansion()
|
||||||
- getCurrentOverScrollAmount(false /* top */);
|
- getCurrentOverScrollAmount(false /* top */);
|
||||||
float fraction = mAmbientState.getExpansionFraction();
|
float fraction = mAmbientState.getExpansionFraction();
|
||||||
if (mAmbientState.isBouncerInTransit()) {
|
// If we are on quick settings, we need to quickly hide it to show the bouncer to avoid an
|
||||||
|
// overlap. Otherwise, we maintain the normal fraction for smoothness.
|
||||||
|
if (mAmbientState.isBouncerInTransit() && mQsExpansionFraction > 0f) {
|
||||||
fraction = BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(fraction);
|
fraction = BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(fraction);
|
||||||
}
|
}
|
||||||
final float stackY = MathUtils.lerp(0, endTopPosition, fraction);
|
final float stackY = MathUtils.lerp(0, endTopPosition, fraction);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import android.view.ViewGroup;
|
|||||||
import androidx.test.annotation.UiThreadTest;
|
import androidx.test.annotation.UiThreadTest;
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
|
import com.android.keyguard.BouncerPanelExpansionCalculator;
|
||||||
import com.android.systemui.ExpandHelper;
|
import com.android.systemui.ExpandHelper;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
@@ -178,6 +179,40 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
doNothing().when(mNotificationShelf).setAnimationsEnabled(anyBoolean());
|
doNothing().when(mNotificationShelf).setAnimationsEnabled(anyBoolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateStackHeight_qsExpansionGreaterThanZero() {
|
||||||
|
final float expansionFraction = 0.2f;
|
||||||
|
final float overExpansion = 50f;
|
||||||
|
|
||||||
|
mStackScroller.setQsExpansionFraction(1f);
|
||||||
|
mAmbientState.setExpansionFraction(expansionFraction);
|
||||||
|
mAmbientState.setOverExpansion(overExpansion);
|
||||||
|
when(mAmbientState.isBouncerInTransit()).thenReturn(true);
|
||||||
|
|
||||||
|
|
||||||
|
mStackScroller.setExpandedHeight(100f);
|
||||||
|
|
||||||
|
float expected = MathUtils.lerp(0, overExpansion,
|
||||||
|
BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(expansionFraction));
|
||||||
|
assertThat(mAmbientState.getStackY()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateStackHeight_qsExpansionZero() {
|
||||||
|
final float expansionFraction = 0.2f;
|
||||||
|
final float overExpansion = 50f;
|
||||||
|
|
||||||
|
mStackScroller.setQsExpansionFraction(0f);
|
||||||
|
mAmbientState.setExpansionFraction(expansionFraction);
|
||||||
|
mAmbientState.setOverExpansion(overExpansion);
|
||||||
|
when(mAmbientState.isBouncerInTransit()).thenReturn(true);
|
||||||
|
|
||||||
|
mStackScroller.setExpandedHeight(100f);
|
||||||
|
|
||||||
|
float expected = MathUtils.lerp(0, overExpansion, expansionFraction);
|
||||||
|
assertThat(mAmbientState.getStackY()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateStackHeight_withDozeAmount_whenDozeChanging() {
|
public void testUpdateStackHeight_withDozeAmount_whenDozeChanging() {
|
||||||
final float dozeAmount = 0.5f;
|
final float dozeAmount = 0.5f;
|
||||||
|
|||||||
Reference in New Issue
Block a user