Merge "Fix syntax in HdmiLogger" into udc-dev
diff --git a/core/java/com/android/internal/jank/FrameTracker.java b/core/java/com/android/internal/jank/FrameTracker.java
index 3226669..1c0da18 100644
--- a/core/java/com/android/internal/jank/FrameTracker.java
+++ b/core/java/com/android/internal/jank/FrameTracker.java
@@ -328,6 +328,7 @@
         mTracingStarted = true;
         markEvent("FT#begin");
         Trace.beginAsyncSection(mSession.getName(), (int) mBeginVsyncId);
+        markEvent("FT#layerId#" + mSurfaceControl.getLayerId());
         mSurfaceControlWrapper.addJankStatsListener(this, mSurfaceControl);
         if (!mSurfaceOnly) {
             mRendererWrapper.addObserver(mObserver);
@@ -437,8 +438,10 @@
                     "The length of the trace event description <%s> exceeds %d",
                     desc, MAX_LENGTH_EVENT_DESC));
         }
-        Trace.beginSection(TextUtils.formatSimple("%s#%s", mSession.getName(), desc));
-        Trace.endSection();
+        if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {
+            Trace.instant(Trace.TRACE_TAG_APP,
+                    TextUtils.formatSimple("%s#%s", mSession.getName(), desc));
+        }
     }
 
     private void notifyCujEvent(String action) {
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationSwipeActionHelper.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationSwipeActionHelper.java
index 4e70455..59911b2 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationSwipeActionHelper.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationSwipeActionHelper.java
@@ -53,10 +53,6 @@
     /** Returns true if the gesture should be rejected. */
     boolean isFalseGesture();
 
-    public boolean swipedFarEnough(float translation, float viewSize);
-
-    public boolean swipedFastEnough(float translation, float velocity);
-
     @ProvidesInterface(version = SnoozeOption.VERSION)
     public interface SnoozeOption {
         public static final int VERSION = 2;
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 64a9cc9..2503520 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -17,7 +17,6 @@
 package com.android.systemui;
 
 import static androidx.dynamicanimation.animation.DynamicAnimation.TRANSLATION_X;
-import static androidx.dynamicanimation.animation.DynamicAnimation.TRANSLATION_Y;
 import static androidx.dynamicanimation.animation.FloatPropertyCompat.createFloatPropertyCompat;
 
 import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS;
@@ -92,7 +91,6 @@
     private float mTouchSlopMultiplier;
 
     private final Callback mCallback;
-    private final int mSwipeDirection;
     private final VelocityTracker mVelocityTracker;
     private final FalsingManager mFalsingManager;
     private final FeatureFlags mFeatureFlags;
@@ -141,12 +139,10 @@
     private final ArrayMap<View, Animator> mDismissPendingMap = new ArrayMap<>();
 
     public SwipeHelper(
-            int swipeDirection, Callback callback, Resources resources,
-            ViewConfiguration viewConfiguration, FalsingManager falsingManager,
-            FeatureFlags featureFlags) {
+            Callback callback, Resources resources, ViewConfiguration viewConfiguration,
+            FalsingManager falsingManager, FeatureFlags featureFlags) {
         mCallback = callback;
         mHandler = new Handler();
-        mSwipeDirection = swipeDirection;
         mVelocityTracker = VelocityTracker.obtain();
         mPagingTouchSlop = viewConfiguration.getScaledPagingTouchSlop();
         mSlopMultiplier = viewConfiguration.getScaledAmbiguousGestureMultiplier();
@@ -179,22 +175,22 @@
     }
 
     private float getPos(MotionEvent ev) {
-        return mSwipeDirection == X ? ev.getX() : ev.getY();
+        return ev.getX();
     }
 
     private float getPerpendicularPos(MotionEvent ev) {
-        return mSwipeDirection == X ? ev.getY() : ev.getX();
+        return ev.getY();
     }
 
     protected float getTranslation(View v) {
-        return mSwipeDirection == X ? v.getTranslationX() : v.getTranslationY();
+        return v.getTranslationX();
     }
 
     private float getVelocity(VelocityTracker vt) {
-        return mSwipeDirection == X ? vt.getXVelocity() :
-                vt.getYVelocity();
+        return vt.getXVelocity();
     }
 
+
     protected Animator getViewTranslationAnimator(View view, float target,
             AnimatorUpdateListener listener) {
 
@@ -209,8 +205,7 @@
 
     protected Animator createTranslationAnimation(View view, float newPos,
             AnimatorUpdateListener listener) {
-        ObjectAnimator anim = ObjectAnimator.ofFloat(view,
-                mSwipeDirection == X ? View.TRANSLATION_X : View.TRANSLATION_Y, newPos);
+        ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X, newPos);
 
         if (listener != null) {
             anim.addUpdateListener(listener);
@@ -220,18 +215,13 @@
     }
 
     protected void setTranslation(View v, float translate) {
-        if (v == null) {
-            return;
-        }
-        if (mSwipeDirection == X) {
+        if (v != null) {
             v.setTranslationX(translate);
-        } else {
-            v.setTranslationY(translate);
         }
     }
 
     protected float getSize(View v) {
-        return mSwipeDirection == X ? v.getMeasuredWidth() : v.getMeasuredHeight();
+        return v.getMeasuredWidth();
     }
 
     public void setMinSwipeProgress(float minSwipeProgress) {
@@ -426,15 +416,12 @@
         float newPos;
         boolean isLayoutRtl = animView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
 
-        // if we use the Menu to dismiss an item in landscape, animate up
-        boolean animateUpForMenu = velocity == 0 && (getTranslation(animView) == 0 || isDismissAll)
-                && mSwipeDirection == Y;
         // if the language is rtl we prefer swiping to the left
         boolean animateLeftForRtl = velocity == 0 && (getTranslation(animView) == 0 || isDismissAll)
                 && isLayoutRtl;
         boolean animateLeft = (Math.abs(velocity) > getEscapeVelocity() && velocity < 0) ||
                 (getTranslation(animView) < 0 && !isDismissAll);
-        if (animateLeft || animateLeftForRtl || animateUpForMenu) {
+        if (animateLeft || animateLeftForRtl) {
             newPos = -getTotalTranslationLength(animView);
         } else {
             newPos = getTotalTranslationLength(animView);
@@ -576,8 +563,7 @@
                     startVelocity,
                     mSnapBackSpringConfig);
         }
-        return PhysicsAnimator.getInstance(target).spring(
-                mSwipeDirection == X ? TRANSLATION_X : TRANSLATION_Y, toPosition, startVelocity,
+        return PhysicsAnimator.getInstance(target).spring(TRANSLATION_X, toPosition, startVelocity,
                 mSnapBackSpringConfig);
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index 769edf7..1b49717 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -56,7 +56,6 @@
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.systemui.ExpandHelper;
 import com.android.systemui.Gefingerpoken;
-import com.android.systemui.SwipeHelper;
 import com.android.systemui.classifier.Classifier;
 import com.android.systemui.classifier.FalsingCollector;
 import com.android.systemui.dagger.qualifiers.Main;
@@ -748,7 +747,6 @@
                 !mKeyguardBypassController.getBypassEnabled());
 
         mSwipeHelper = mNotificationSwipeHelperBuilder
-                .setSwipeDirection(SwipeHelper.X)
                 .setNotificationCallback(mNotificationCallback)
                 .setOnMenuEventListener(mMenuEventListener)
                 .build();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
index b476b68..91f53b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java
@@ -76,11 +76,10 @@
             ViewConfiguration viewConfiguration,
             FalsingManager falsingManager,
             FeatureFlags featureFlags,
-            int swipeDirection,
             NotificationCallback callback,
             NotificationMenuRowPlugin.OnMenuEventListener menuListener,
             NotificationRoundnessManager notificationRoundnessManager) {
-        super(swipeDirection, callback, resources, viewConfiguration, falsingManager, featureFlags);
+        super(callback, resources, viewConfiguration, falsingManager, featureFlags);
         mNotificationRoundnessManager = notificationRoundnessManager;
         mUseRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES);
         mMenuListener = menuListener;
@@ -416,22 +415,12 @@
     }
 
     @Override
-    public boolean swipedFastEnough(float translation, float viewSize) {
-        return swipedFastEnough();
-    }
-
-    @Override
     @VisibleForTesting
     protected boolean swipedFastEnough() {
         return super.swipedFastEnough();
     }
 
     @Override
-    public boolean swipedFarEnough(float translation, float viewSize) {
-        return swipedFarEnough();
-    }
-
-    @Override
     @VisibleForTesting
     protected boolean swipedFarEnough() {
         return super.swipedFarEnough();
@@ -554,7 +543,6 @@
         private final ViewConfiguration mViewConfiguration;
         private final FalsingManager mFalsingManager;
         private final FeatureFlags mFeatureFlags;
-        private int mSwipeDirection;
         private NotificationCallback mNotificationCallback;
         private NotificationMenuRowPlugin.OnMenuEventListener mOnMenuEventListener;
         private NotificationRoundnessManager mNotificationRoundnessManager;
@@ -570,11 +558,6 @@
             mNotificationRoundnessManager = notificationRoundnessManager;
         }
 
-        Builder setSwipeDirection(int swipeDirection) {
-            mSwipeDirection = swipeDirection;
-            return this;
-        }
-
         Builder setNotificationCallback(NotificationCallback notificationCallback) {
             mNotificationCallback = notificationCallback;
             return this;
@@ -588,7 +571,7 @@
 
         NotificationSwipeHelper build() {
             return new NotificationSwipeHelper(mResources, mViewConfiguration, mFalsingManager,
-                    mFeatureFlags, mSwipeDirection, mNotificationCallback, mOnMenuEventListener,
+                    mFeatureFlags, mNotificationCallback, mOnMenuEventListener,
                     mNotificationRoundnessManager);
         }
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java
index 824eb4a..551499e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java
@@ -43,7 +43,6 @@
 
 import androidx.test.filters.SmallTest;
 
-import com.android.systemui.SwipeHelper;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.classifier.FalsingManagerFake;
 import com.android.systemui.flags.FeatureFlags;
@@ -101,7 +100,6 @@
                 ViewConfiguration.get(mContext),
                 new FalsingManagerFake(),
                 mFeatureFlags,
-                SwipeHelper.X,
                 mCallback,
                 mListener,
                 mNotificationRoundnessManager));