Draw outline inside the view so it would not be cut off

Before: https://screenshot.googleplex.com/C2iwZxYV3KocTQq
After: https://screenshot.googleplex.com/BC9YYtm8GngssNF

Bug: 310953377
Test: Manual, navigate to the folder icon by keyboard, press enter to open and go to the bottom row app icon
Flag: ACONFIG com.android.launcher3.enable_focus_outline Staging
Change-Id: Iad5a081ef3838d2728f8845c4fa2ef726b2c781b
diff --git a/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java b/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java
index c36f455..3e320bd 100644
--- a/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java
+++ b/src/com/android/launcher3/keyboard/FocusIndicatorHelper.java
@@ -57,18 +57,7 @@
 
         @Override
         public void viewToRect(View v, Rect outRect) {
-            if (Flags.enableFocusOutline()) {
-                // Ensure the left and top would not be negative and drawn outside of canvas
-                outRect.set(Math.max(0, v.getLeft()), Math.max(0, v.getTop()), v.getRight(),
-                        v.getBottom());
-                // Stroke is drawn with half outside and half inside the view. Inset by half
-                // stroke width to move the whole stroke inside the view and avoid other views
-                // occluding it
-                int halfStrokeWidth = (int) mPaint.getStrokeWidth() / 2;
-                outRect.inset(halfStrokeWidth, halfStrokeWidth);
-            } else {
-                outRect.set(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
-            }
+            outRect.set(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
         }
     }
 }
diff --git a/src/com/android/launcher3/keyboard/ItemFocusIndicatorHelper.java b/src/com/android/launcher3/keyboard/ItemFocusIndicatorHelper.java
index 8eb5c7d..a8cd03b 100644
--- a/src/com/android/launcher3/keyboard/ItemFocusIndicatorHelper.java
+++ b/src/com/android/launcher3/keyboard/ItemFocusIndicatorHelper.java
@@ -146,6 +146,13 @@
 
         Rect newRect = getDrawRect();
         if (newRect != null) {
+            if (Flags.enableFocusOutline()) {
+                // Stroke is drawn with half outside and half inside the view. Inset by half
+                // stroke width to move the whole stroke inside the view and avoid other views
+                // occluding it
+                int halfStrokeWidth = (int) mPaint.getStrokeWidth() / 2;
+                newRect.inset(halfStrokeWidth, halfStrokeWidth);
+            }
             mDirtyRect.set(newRect);
             c.drawRoundRect((float) mDirtyRect.left, (float) mDirtyRect.top,
                     (float) mDirtyRect.right, (float) mDirtyRect.bottom,