Fix the scrollbar of the SaveUi is outside the screen

The scrollbar of custom description on the save UI is outside the
screen. Adjusts the width of the view to show the scrollbar in the
screen.

Fixes: 138097635
Bug: 133515042
Test: manual
Test: atest CtsAutoFillServiceTestCases
Change-Id: Ifd902746eb52b72be8ac0cfddde93714fa496f41
diff --git a/services/autofill/java/com/android/server/autofill/ui/CustomScrollView.java b/services/autofill/java/com/android/server/autofill/ui/CustomScrollView.java
index e68263a..813fc8d 100644
--- a/services/autofill/java/com/android/server/autofill/ui/CustomScrollView.java
+++ b/services/autofill/java/com/android/server/autofill/ui/CustomScrollView.java
@@ -64,12 +64,13 @@
             return;
         }
 
+        mWidth = MeasureSpec.getSize(widthMeasureSpec);
         calculateDimensions();
         setMeasuredDimension(mWidth, mHeight);
     }
 
     private void calculateDimensions() {
-        if (mWidth != -1) return;
+        if (mHeight != -1) return;
 
         final TypedValue typedValue = new TypedValue();
         final Point point = new Point();
@@ -81,7 +82,6 @@
         final int childHeight = child.getMeasuredHeight();
         final int maxHeight = (int) typedValue.getFraction(point.y, point.y);
 
-        mWidth = point.x;
         mHeight = Math.min(childHeight, maxHeight);
         if (sDebug) {
             Slog.d(TAG, "calculateDimensions(): maxHeight=" + maxHeight