Merge "Tuned anti-falsing thresholds on the lockscreen" into lmp-dev
This commit is contained in:
@@ -289,13 +289,13 @@
|
||||
<dimen name="speed_bump_height">16dp</dimen>
|
||||
|
||||
<!-- Lockscreen unlocking falsing threshold. -->
|
||||
<dimen name="unlock_falsing_threshold">100dp</dimen>
|
||||
<dimen name="unlock_falsing_threshold">80dp</dimen>
|
||||
|
||||
<!-- Lockscreen falsing threshold for quick settings. -->
|
||||
<dimen name="qs_falsing_threshold">60dp</dimen>
|
||||
<dimen name="qs_falsing_threshold">80dp</dimen>
|
||||
|
||||
<!-- Falsing threshold used when dismissing notifications from the lockscreen. -->
|
||||
<dimen name="swipe_helper_falsing_threshold">100dp</dimen>
|
||||
<dimen name="swipe_helper_falsing_threshold">70dp</dimen>
|
||||
|
||||
<dimen name="notifications_top_padding">8dp</dimen>
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
<dimen name="heads_up_window_height">250dp</dimen>
|
||||
|
||||
<!-- The minimum amount the user needs to swipe to go to the camera / phone. -->
|
||||
<dimen name="keyguard_min_swipe_amount">85dp</dimen>
|
||||
<dimen name="keyguard_min_swipe_amount">90dp</dimen>
|
||||
|
||||
<!-- The minimum background radius when swiping to a side for the camera / phone affordances. -->
|
||||
<dimen name="keyguard_affordance_min_background_radius">30dp</dimen>
|
||||
|
||||
@@ -251,15 +251,19 @@ public class KeyguardAffordanceView extends ImageView {
|
||||
}
|
||||
|
||||
public void setCircleRadius(float circleRadius) {
|
||||
setCircleRadius(circleRadius, false);
|
||||
setCircleRadius(circleRadius, false, false);
|
||||
}
|
||||
|
||||
public void setCircleRadius(float circleRadius, boolean slowAnimation) {
|
||||
setCircleRadius(circleRadius, slowAnimation, false);
|
||||
}
|
||||
|
||||
public void setCircleRadiusWithoutAnimation(float circleRadius) {
|
||||
cancelAnimator(mCircleAnimator);
|
||||
setCircleRadius(circleRadius, true);
|
||||
setCircleRadius(circleRadius, false ,true);
|
||||
}
|
||||
|
||||
private void setCircleRadius(float circleRadius, boolean noAnimation) {
|
||||
private void setCircleRadius(float circleRadius, boolean slowAnimation, boolean noAnimation) {
|
||||
|
||||
// Check if we need a new animation
|
||||
boolean radiusHidden = (mCircleAnimator != null && mCircleWillBeHidden)
|
||||
@@ -292,10 +296,13 @@ public class KeyguardAffordanceView extends ImageView {
|
||||
? mDisappearInterpolator
|
||||
: mAppearInterpolator;
|
||||
animator.setInterpolator(interpolator);
|
||||
float durationFactor = Math.abs(mCircleRadius - circleRadius)
|
||||
/ (float) mMinBackgroundRadius;
|
||||
long duration = (long) (CIRCLE_APPEAR_DURATION * durationFactor);
|
||||
duration = Math.min(duration, CIRCLE_DISAPPEAR_MAX_DURATION);
|
||||
long duration = 250;
|
||||
if (!slowAnimation) {
|
||||
float durationFactor = Math.abs(mCircleRadius - circleRadius)
|
||||
/ (float) mMinBackgroundRadius;
|
||||
duration = (long) (CIRCLE_APPEAR_DURATION * durationFactor);
|
||||
duration = Math.min(duration, CIRCLE_DISAPPEAR_MAX_DURATION);
|
||||
}
|
||||
animator.setDuration(duration);
|
||||
animator.start();
|
||||
if (mPreviewView != null && mPreviewView.getVisibility() == View.VISIBLE) {
|
||||
|
||||
@@ -20,8 +20,6 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.View;
|
||||
@@ -85,9 +83,9 @@ public class KeyguardAffordanceHelper {
|
||||
mContext = context;
|
||||
mCallback = callback;
|
||||
initIcons();
|
||||
updateIcon(mLeftIcon, 0.0f, SWIPE_RESTING_ALPHA_AMOUNT, false);
|
||||
updateIcon(mCenterIcon, 0.0f, SWIPE_RESTING_ALPHA_AMOUNT, false);
|
||||
updateIcon(mRightIcon, 0.0f, SWIPE_RESTING_ALPHA_AMOUNT, false);
|
||||
updateIcon(mLeftIcon, 0.0f, SWIPE_RESTING_ALPHA_AMOUNT, false, false);
|
||||
updateIcon(mCenterIcon, 0.0f, SWIPE_RESTING_ALPHA_AMOUNT, false, false);
|
||||
updateIcon(mRightIcon, 0.0f, SWIPE_RESTING_ALPHA_AMOUNT, false, false);
|
||||
initDimens();
|
||||
}
|
||||
|
||||
@@ -295,8 +293,7 @@ public class KeyguardAffordanceHelper {
|
||||
float vel = getCurrentVelocity();
|
||||
|
||||
// We snap back if the current translation is not far enough
|
||||
boolean snapBack = Math.abs(mTranslation) < Math.abs(mTranslationOnDown)
|
||||
+ mMinTranslationAmount;
|
||||
boolean snapBack = isBelowFalsingThreshold();
|
||||
|
||||
// or if the velocity is in the opposite direction.
|
||||
boolean velIsInWrongDirection = vel * mTranslation < 0;
|
||||
@@ -305,6 +302,11 @@ public class KeyguardAffordanceHelper {
|
||||
fling(vel, snapBack || forceSnapBack);
|
||||
}
|
||||
|
||||
private boolean isBelowFalsingThreshold() {
|
||||
return Math.abs(mTranslation) < Math.abs(mTranslationOnDown)
|
||||
+ mMinTranslationAmount;
|
||||
}
|
||||
|
||||
private void fling(float vel, final boolean snapBack) {
|
||||
float target = mTranslation < 0 ? -mCallback.getPageWidth() : mCallback.getPageWidth();
|
||||
target = snapBack ? 0 : target;
|
||||
@@ -355,13 +357,14 @@ public class KeyguardAffordanceHelper {
|
||||
|
||||
boolean animateIcons = isReset && animateReset;
|
||||
float radius = getRadiusFromTranslation(absTranslation);
|
||||
boolean slowAnimation = isReset && isBelowFalsingThreshold();
|
||||
if (!isReset) {
|
||||
updateIcon(targetView, radius, alpha, false);
|
||||
updateIcon(targetView, radius, alpha, false, false);
|
||||
} else {
|
||||
updateIcon(targetView, 0.0f, fadeOutAlpha, animateIcons);
|
||||
updateIcon(targetView, 0.0f, fadeOutAlpha, animateIcons, slowAnimation);
|
||||
}
|
||||
updateIcon(otherView, 0.0f, fadeOutAlpha, animateIcons);
|
||||
updateIcon(mCenterIcon, 0.0f, fadeOutAlpha, animateIcons);
|
||||
updateIcon(otherView, 0.0f, fadeOutAlpha, animateIcons, slowAnimation);
|
||||
updateIcon(mCenterIcon, 0.0f, fadeOutAlpha, animateIcons, slowAnimation);
|
||||
|
||||
mTranslation = translation;
|
||||
}
|
||||
@@ -392,16 +395,16 @@ public class KeyguardAffordanceHelper {
|
||||
}
|
||||
|
||||
public void animateHideLeftRightIcon() {
|
||||
updateIcon(mRightIcon, 0f, 0f, true);
|
||||
updateIcon(mLeftIcon, 0f, 0f, true);
|
||||
updateIcon(mRightIcon, 0f, 0f, true, false);
|
||||
updateIcon(mLeftIcon, 0f, 0f, true, false);
|
||||
}
|
||||
|
||||
private void updateIcon(KeyguardAffordanceView view, float circleRadius, float alpha,
|
||||
boolean animate) {
|
||||
boolean animate, boolean slowRadiusAnimation) {
|
||||
if (view.getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
view.setCircleRadius(circleRadius);
|
||||
view.setCircleRadius(circleRadius, slowRadiusAnimation);
|
||||
updateIconAlpha(view, alpha, animate);
|
||||
}
|
||||
|
||||
|
||||
@@ -548,7 +548,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
}
|
||||
|
||||
private boolean flingExpandsQs(float vel) {
|
||||
if (!mQsTouchAboveFalsingThreshold && mStatusBarState == StatusBarState.KEYGUARD) {
|
||||
if (isBelowFalsingThreshold()) {
|
||||
return false;
|
||||
}
|
||||
if (Math.abs(vel) < mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
|
||||
@@ -558,6 +558,10 @@ public class NotificationPanelView extends PanelView implements
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBelowFalsingThreshold() {
|
||||
return !mQsTouchAboveFalsingThreshold && mStatusBar.isFalsingThresholdNeeded();
|
||||
}
|
||||
|
||||
private float getQsExpansionFraction() {
|
||||
return Math.min(1f, (mQsExpansionHeight - mQsMinExpansionHeight)
|
||||
/ (getTempQsMaxExpansion() - mQsMinExpansionHeight));
|
||||
@@ -1122,9 +1126,16 @@ public class NotificationPanelView extends PanelView implements
|
||||
}
|
||||
return;
|
||||
}
|
||||
boolean belowFalsingThreshold = isBelowFalsingThreshold();
|
||||
if (belowFalsingThreshold) {
|
||||
vel = 0;
|
||||
}
|
||||
mScrollView.setBlockFlinging(true);
|
||||
ValueAnimator animator = ValueAnimator.ofFloat(mQsExpansionHeight, target);
|
||||
mFlingAnimationUtils.apply(animator, mQsExpansionHeight, target, vel);
|
||||
if (belowFalsingThreshold) {
|
||||
animator.setDuration(350);
|
||||
}
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
@@ -1692,9 +1703,9 @@ public class NotificationPanelView extends PanelView implements
|
||||
}
|
||||
|
||||
public void setEmptyDragAmount(float amount) {
|
||||
float factor = 1f;
|
||||
float factor = 0.8f;
|
||||
if (mNotificationStackScroller.getNotGoneChildCount() > 0) {
|
||||
factor = 0.6f;
|
||||
factor = 0.4f;
|
||||
} else if (!mStatusBar.hasActiveNotifications()) {
|
||||
factor = 0.4f;
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ public abstract class PanelView extends FrameLayout {
|
||||
* @return whether a fling should expands the panel; contracts otherwise
|
||||
*/
|
||||
protected boolean flingExpands(float vel, float vectorVel) {
|
||||
if (!mTouchAboveFalsingThreshold && mStatusBar.isFalsingThresholdNeeded()) {
|
||||
if (isBelowFalsingThreshold()) {
|
||||
return true;
|
||||
}
|
||||
if (Math.abs(vectorVel) < mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
|
||||
@@ -489,6 +489,10 @@ public abstract class PanelView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBelowFalsingThreshold() {
|
||||
return !mTouchAboveFalsingThreshold && mStatusBar.isFalsingThresholdNeeded();
|
||||
}
|
||||
|
||||
protected void fling(float vel, boolean expand) {
|
||||
cancelPeek();
|
||||
float target = expand ? getMaxPanelHeight() : 0.0f;
|
||||
@@ -509,7 +513,14 @@ public abstract class PanelView extends FrameLayout {
|
||||
mOverExpandedBeforeFling = getOverExpansionAmount() > 0f;
|
||||
ValueAnimator animator = createHeightAnimator(target);
|
||||
if (expand) {
|
||||
boolean belowFalsingThreshold = isBelowFalsingThreshold();
|
||||
if (belowFalsingThreshold) {
|
||||
vel = 0;
|
||||
}
|
||||
mFlingAnimationUtils.apply(animator, mExpandedHeight, target, vel, getHeight());
|
||||
if (belowFalsingThreshold) {
|
||||
animator.setDuration(350);
|
||||
}
|
||||
} else {
|
||||
mFlingAnimationUtils.applyDismissing(animator, mExpandedHeight, target, vel,
|
||||
getHeight());
|
||||
|
||||
Reference in New Issue
Block a user