Fix CTS testAutoSizeCallers_setText for android wear

Reduce the layouts to 200x200px in order to easily
accomodate the most low resolution watches (in compilance
with https://material.io/devices/).

Relax the assertions: we add/remove text 10 times but
on certain devices auto-size will not necessarily produce
10 distinct sizes and this is valid. Be strict with the
last assertion only when comparing to the initial size.

The test is inlined with the support library version now.

Bug: 62878673
Bug: 37645436
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases -t
      android.widget.cts.TextViewTest

Change-Id: I793c6b0fa3946896e457f5238d78b4507c222781
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index 4e71fdd..2c6635a 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -6675,7 +6675,7 @@
         // Configure layout params and auto-size both in pixels to dodge flakiness on different
         // devices.
         final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
-                500, 500);
+                200, 200);
         mActivityRule.runOnUiThread(() -> {
             autoSizeTextView.setLayoutParams(layoutParams);
             autoSizeTextView.setAutoSizeTextTypeUniformWithConfiguration(
@@ -6684,7 +6684,8 @@
         mInstrumentation.waitForIdleSync();
 
         final String initialText = "13characters ";
-        StringBuilder textToSet = new StringBuilder().append(initialText);
+        final StringBuilder textToSet = new StringBuilder().append(initialText);
+        float initialSize = 0;
 
         // As we add characters the text size shrinks.
         for (int i = 0; i < 10; i++) {
@@ -6692,29 +6693,38 @@
                     autoSizeTextView.setText(textToSet.toString()));
             mInstrumentation.waitForIdleSync();
             float expectedLargerSize = autoSizeTextView.getTextSize();
+            if (i == 0) {
+                initialSize = expectedLargerSize;
+            }
 
             textToSet.append(initialText);
             mActivityRule.runOnUiThread(() ->
                     autoSizeTextView.setText(textToSet.toString()));
             mInstrumentation.waitForIdleSync();
 
-            assertTrue(expectedLargerSize > autoSizeTextView.getTextSize());
+            assertTrue(expectedLargerSize >= autoSizeTextView.getTextSize());
         }
+        assertTrue(initialSize > autoSizeTextView.getTextSize());
 
+        initialSize = Integer.MAX_VALUE;
         // As we remove characters the text size expands.
         for (int i = 9; i >= 0; i--) {
             mActivityRule.runOnUiThread(() ->
                     autoSizeTextView.setText(textToSet.toString()));
             mInstrumentation.waitForIdleSync();
             float expectedSmallerSize = autoSizeTextView.getTextSize();
+            if (i == 9) {
+                initialSize = expectedSmallerSize;
+            }
 
             textToSet.replace((textToSet.length() - initialText.length()), textToSet.length(), "");
             mActivityRule.runOnUiThread(() ->
                     autoSizeTextView.setText(textToSet.toString()));
             mInstrumentation.waitForIdleSync();
 
-            assertTrue(autoSizeTextView.getTextSize() > expectedSmallerSize);
+            assertTrue(autoSizeTextView.getTextSize() >= expectedSmallerSize);
         }
+        assertTrue(autoSizeTextView.getTextSize() > initialSize);
     }
 
     @Test
@@ -7393,7 +7403,7 @@
 
         final String someText = "This is a string";
         final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
-                500, 500);
+                200, 200);
         // Configure identically and attach to layout.
         mActivityRule.runOnUiThread(() -> {
             granularityTextView.setLayoutParams(layoutParams);