Merge "Add keyboard navigation for App Chip and Chip Menu" into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index a6e05c9..4c94432 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -129,7 +129,7 @@
 
     private final int mAllAppsButtonTranslationOffset;
 
-    private final int mNumStaticViews;
+    private int mNumStaticViews;
 
     private Set<GroupTask> mPrevRecentTasks = Collections.emptySet();
     private Set<GroupTask> mPrevOverflowTasks = Collections.emptySet();
@@ -199,8 +199,6 @@
 
         // TODO: Disable touch events on QSB otherwise it can crash.
         mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
-
-        mNumStaticViews = ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION.isTrue() ? addStaticViews() : 0;
     }
 
     /**
@@ -448,6 +446,10 @@
     private void updateItemsWithLayoutTransition(
             ItemInfo[] hotseatItemInfos, List<GroupTask> recentTasks) {
 
+        if (mNumStaticViews == 0) {
+            mNumStaticViews = addStaticViews();
+        }
+
         // Skip static views and potential All Apps divider, if they are on the left.
         mNextViewIndex = mIsRtl ? 0 : mNumStaticViews;
         if (getChildAt(mNextViewIndex) == mTaskbarDividerContainer && !mAddedDividerForRecents) {
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index c861d0b..2112638 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
@@ -498,12 +498,19 @@
                 sTempRect.bottom = y + mDotRadius;
                 sTempRect.left = x - diameter;
 
-                float posDif = Math.abs(mLastPosition - mCurrentPosition);
+                float currentPosition = mCurrentPosition;
+                float lastPosition = mLastPosition;
+
+                if (mIsRtl) {
+                    currentPosition = mNumPages - currentPosition - 1;
+                    lastPosition = mNumPages - lastPosition - 1;
+                }
+                float posDif = Math.abs(lastPosition - currentPosition);
                 float boundedPosition = (posDif > 1)
-                        ? Math.round(mCurrentPosition)
-                        : mCurrentPosition;
+                        ? Math.round(currentPosition)
+                        : currentPosition;
                 float bounceProgress = (posDif > 1) ? posDif - 1 : 0;
-                float bounceAdjustment = Math.abs(mCurrentPosition - boundedPosition) * diameter;
+                float bounceAdjustment = Math.abs(currentPosition - boundedPosition) * diameter;
 
                 if (mOnArrowClickListener != null && boundedPosition >= 1) {
                     // Here we draw the Left Arrow
@@ -537,10 +544,10 @@
                         // While the animation is shifting the active pagination dots size from
                         // the previously active one, to the newly active dot, there is no bounce
                         // adjustment. The bounce happens in the "Overshoot" phase of the animation.
-                        // mLastPosition is used to determine when the currentPosition is just
+                        // lastPosition is used to determine when the currentPosition is just
                         // leaving the page, or if it is in the overshoot phase.
                         if (boundedPosition == i && bounceProgress != 0) {
-                            if (mLastPosition < mCurrentPosition) {
+                            if (lastPosition < currentPosition) {
                                 sTempRect.left -= bounceAdjustment;
                             } else {
                                 sTempRect.right += bounceAdjustment;
@@ -549,8 +556,8 @@
                     } else {
                         sTempRect.right = sTempRect.left + diameter;
 
-                        if (mLastPosition == i && bounceProgress != 0) {
-                            if (mLastPosition > mCurrentPosition) {
+                        if (lastPosition == i && bounceProgress != 0) {
+                            if (lastPosition > currentPosition) {
                                 sTempRect.left += bounceAdjustment;
                             } else {
                                 sTempRect.right -= bounceAdjustment;