Using a different interpolator when unlocking to an app

On the lockscreen when unlocking to an app without security
/ when trusted, we use a different interpolator not to break
the animation in between.

Change-Id: Iedf3172ff281e82e02f0859101198cb2f7ffe265
Fixes: 33652632
Fixes: 33652041
Test: unlock without security
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 50a258d..82a5cc2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -2007,6 +2007,12 @@
     }
 
     @Override
+    protected boolean shouldUseDismissingAnimation() {
+        return mStatusBarState != StatusBarState.SHADE
+                && !mStatusBar.isKeyguardCurrentlySecure();
+    }
+
+    @Override
     protected boolean fullyExpandedClearAllVisible() {
         return mNotificationStackScroller.isDismissViewNotGone()
                 && mNotificationStackScroller.isScrolledToBottom() && !mQsExpandImmediate;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index c8d0932..18e394e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -94,6 +94,7 @@
     private VelocityTrackerInterface mVelocityTracker;
     private FlingAnimationUtils mFlingAnimationUtils;
     private FlingAnimationUtils mFlingAnimationUtilsClosing;
+    private FlingAnimationUtils mFlingAnimationUtilsDismissing;
     private FalsingManager mFalsingManager;
 
     /**
@@ -184,6 +185,9 @@
                 0.6f /* speedUpFactor */);
         mFlingAnimationUtilsClosing = new FlingAnimationUtils(context, 0.5f /* maxLengthSeconds */,
                 0.6f /* speedUpFactor */);
+        mFlingAnimationUtilsDismissing = new FlingAnimationUtils(context,
+                0.5f /* maxLengthSeconds */, 0.2f /* speedUpFactor */, 0.6f /* x2 */,
+                0.84f /* y2 */);
         mBounceInterpolator = new BounceInterpolator();
         mFalsingManager = FalsingManager.getInstance(context);
     }
@@ -702,7 +706,13 @@
                 animator.setDuration(350);
             }
         } else {
-            mFlingAnimationUtilsClosing.apply(animator, mExpandedHeight, target, vel, getHeight());
+            if (shouldUseDismissingAnimation()) {
+                mFlingAnimationUtilsDismissing.apply(animator, mExpandedHeight, target, vel,
+                        getHeight());
+            } else {
+                mFlingAnimationUtilsClosing
+                        .apply(animator, mExpandedHeight, target, vel, getHeight());
+            }
 
             // Make it shorter if we run a canned animation
             if (vel == 0) {
@@ -733,6 +743,8 @@
         animator.start();
     }
 
+    protected abstract boolean shouldUseDismissingAnimation();
+
     @Override
     protected void onAttachedToWindow() {
         super.onAttachedToWindow();