Migrate IntDef, StringDef, and VisibleForTesting to androidx.

PiperOrigin-RevId: 350234614
Change-Id: I0b46002dca377ecbf8f2a25af5e79e6ce0d79e33
diff --git a/WORKSPACE b/WORKSPACE
index c5b10b9..67299d3 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -25,6 +25,7 @@
     artifacts = [
         "androidx.test:core:1.1.0",
         "androidx.test:monitor:1.1.0",
+        "androidx.annotation:annotation:1.1.0",
         "com.android.support:appcompat-v7:" + ANDROID_SUPPORT_LIBRARY_VERSION,
         "com.android.support:collections:" + ANDROID_SUPPORT_LIBRARY_VERSION,
         "com.android.support:interpolator:" + ANDROID_SUPPORT_LIBRARY_VERSION,
diff --git a/src/main/java/com/google/android/libraries/feed/piet/AdapterParameters.java b/src/main/java/com/google/android/libraries/feed/piet/AdapterParameters.java
index b0009ae..10b868b 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/AdapterParameters.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/AdapterParameters.java
@@ -15,9 +15,9 @@
 package com.google.android.libraries.feed.piet;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.view.View;
 import android.view.ViewGroup;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.functional.Supplier;
 import com.google.android.libraries.feed.common.time.Clock;
 import com.google.android.libraries.feed.piet.PietStylesHelper.PietStylesHelperFactory;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/BUILD b/src/main/java/com/google/android/libraries/feed/piet/BUILD
index 0e06c2c..40bb30b 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/BUILD
+++ b/src/main/java/com/google/android/libraries/feed/piet/BUILD
@@ -18,7 +18,7 @@
         "//src/main/java/com/google/android/libraries/feed/piet/ui",
         "//src/main/proto/search/now/ui/piet:piet_errors_java_proto_lite",
         "//src/main/proto/search/now/ui/piet:piet_java_proto_lite",
-        "@maven//:com_android_support_support_annotations",  # buildcleaner: keep
+        "@maven//:androidx_annotation_annotation",  # buildcleaner: keep
         "@maven//:com_android_support_support_compat",
         "@maven//:com_google_code_findbugs_jsr305",
     ],
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapter.java b/src/main/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapter.java
index 4e33acc..d7a84ed 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapter.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapter.java
@@ -25,7 +25,6 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
-import android.support.annotation.VisibleForTesting;
 import android.text.Layout;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
@@ -39,6 +38,7 @@
 import android.view.MotionEvent;
 import android.view.View;
 import android.widget.TextView;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.functional.Consumer;
 import com.google.android.libraries.feed.common.logging.Logger;
 import com.google.android.libraries.feed.common.ui.LayoutUtils;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/DebugLogger.java b/src/main/java/com/google/android/libraries/feed/piet/DebugLogger.java
index b38ec62..eb95de0 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/DebugLogger.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/DebugLogger.java
@@ -15,8 +15,6 @@
 package com.google.android.libraries.feed.piet;
 
 import android.content.Context;
-import android.support.annotation.IntDef;
-import android.support.annotation.VisibleForTesting;
 import android.support.v4.widget.TextViewCompat;
 import android.util.SparseArray;
 import android.util.SparseIntArray;
@@ -24,6 +22,8 @@
 import android.view.ViewGroup.LayoutParams;
 import android.widget.LinearLayout;
 import android.widget.TextView;
+import androidx.annotation.IntDef;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.ui.LayoutUtils;
 import com.google.search.now.ui.piet.ErrorsProto.ErrorCode;
 import java.util.ArrayList;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ElementAdapter.java b/src/main/java/com/google/android/libraries/feed/piet/ElementAdapter.java
index 18ba076..2940265 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ElementAdapter.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ElementAdapter.java
@@ -19,11 +19,11 @@
 
 import android.content.Context;
 import android.os.Build;
-import android.support.annotation.VisibleForTesting;
 import android.view.View;
 import android.view.ViewGroup.LayoutParams;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.FrameLayout;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.logging.Logger;
 import com.google.android.libraries.feed.piet.DebugLogger.MessageType;
 import com.google.android.libraries.feed.piet.host.LogDataCallback;
@@ -166,8 +166,7 @@
       // We have already initialized the wrapper view.
       return;
     }
-    if (!elementStyle.hasRoundedCorners()
-        && !elementStyle.hasBorders()) {
+    if (!elementStyle.hasRoundedCorners() && !elementStyle.hasBorders()) {
       // We do not need a wrapper view.
       return;
     }
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ElementAdapterFactory.java b/src/main/java/com/google/android/libraries/feed/piet/ElementAdapterFactory.java
index 7832e02..b1b5a80 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ElementAdapterFactory.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ElementAdapterFactory.java
@@ -15,8 +15,8 @@
 package com.google.android.libraries.feed.piet;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.view.View;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.piet.DebugLogger.MessageType;
 import com.google.android.libraries.feed.piet.TemplateBinder.TemplateKey;
 import com.google.search.now.ui.piet.ElementsProto.CustomElement;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ElementListAdapter.java b/src/main/java/com/google/android/libraries/feed/piet/ElementListAdapter.java
index ab17de1..57668a7 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ElementListAdapter.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ElementListAdapter.java
@@ -17,12 +17,12 @@
 import static com.google.android.libraries.feed.piet.StyleProvider.DIMENSION_NOT_SET;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
 import android.widget.LinearLayout.LayoutParams;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.piet.AdapterFactory.SingletonKeySupplier;
 import com.google.android.libraries.feed.piet.DebugLogger.MessageType;
 import com.google.search.now.ui.piet.ElementsProto.Content;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/FrameAdapterImpl.java b/src/main/java/com/google/android/libraries/feed/piet/FrameAdapterImpl.java
index 5735ca9..5d769d5 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/FrameAdapterImpl.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/FrameAdapterImpl.java
@@ -19,12 +19,12 @@
 import static com.google.search.now.ui.piet.ErrorsProto.ErrorCode.ERR_POOR_FRAME_RATE;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
 import android.widget.LinearLayout;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.api.host.config.DebugBehavior;
 import com.google.android.libraries.feed.common.logging.Logger;
 import com.google.android.libraries.feed.piet.DebugLogger.MessageType;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/FrameContext.java b/src/main/java/com/google/android/libraries/feed/piet/FrameContext.java
index 2ff8f9f..f9620e5 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/FrameContext.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/FrameContext.java
@@ -21,8 +21,8 @@
 import static com.google.search.now.ui.piet.ErrorsProto.ErrorCode.ERR_MISSING_BINDING_VALUE;
 import static com.google.search.now.ui.piet.ErrorsProto.ErrorCode.ERR_MISSING_TEMPLATE;
 
-import android.support.annotation.VisibleForTesting;
 import android.view.View;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.api.host.config.DebugBehavior;
 import com.google.android.libraries.feed.common.logging.Logger;
 import com.google.android.libraries.feed.piet.DebugLogger.MessageType;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/GridRowAdapter.java b/src/main/java/com/google/android/libraries/feed/piet/GridRowAdapter.java
index 3a28abb..a23499e 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/GridRowAdapter.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/GridRowAdapter.java
@@ -21,10 +21,10 @@
 import static com.google.search.now.ui.piet.ErrorsProto.ErrorCode.ERR_UNSUPPORTED_FEATURE;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.view.Gravity;
 import android.view.View;
 import android.widget.LinearLayout;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.functional.Supplier;
 import com.google.android.libraries.feed.common.ui.LayoutUtils;
 import com.google.android.libraries.feed.piet.AdapterFactory.AdapterKeySupplier;
@@ -65,7 +65,6 @@
     return baseElement.getGridRow();
   }
 
-
   @Override
   List<Content> getContentsFromModel(GridRow model) {
     ArrayList<Content> contents = new ArrayList<>();
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ImageElementAdapter.java b/src/main/java/com/google/android/libraries/feed/piet/ImageElementAdapter.java
index b5f8972..09173b3 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ImageElementAdapter.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ImageElementAdapter.java
@@ -18,9 +18,9 @@
 import static com.google.android.libraries.feed.piet.host.ImageLoader.DIMENSION_UNKNOWN;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.widget.ImageView;
 import android.widget.ImageView.ScaleType;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.piet.AdapterFactory.SingletonKeySupplier;
 import com.google.android.libraries.feed.piet.ui.AspectRatioScalingImageView;
 import com.google.search.now.ui.piet.ElementsProto.BindingValue;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/MediaQueryHelper.java b/src/main/java/com/google/android/libraries/feed/piet/MediaQueryHelper.java
index 9c8319d..8abd648 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/MediaQueryHelper.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/MediaQueryHelper.java
@@ -16,7 +16,7 @@
 
 import android.content.Context;
 import android.content.res.Configuration;
-import android.support.annotation.VisibleForTesting;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.logging.Logger;
 import com.google.android.libraries.feed.common.ui.LayoutUtils;
 import com.google.android.libraries.feed.piet.host.AssetProvider;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/PietManagerImpl.java b/src/main/java/com/google/android/libraries/feed/piet/PietManagerImpl.java
index 5afdc4d..d2d1b92 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/PietManagerImpl.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/PietManagerImpl.java
@@ -15,8 +15,8 @@
 package com.google.android.libraries.feed.piet;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.view.ViewGroup;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.api.host.config.DebugBehavior;
 import com.google.android.libraries.feed.common.functional.Supplier;
 import com.google.android.libraries.feed.common.time.Clock;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/PietStylesHelper.java b/src/main/java/com/google/android/libraries/feed/piet/PietStylesHelper.java
index ac1e337..bdeda5c 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/PietStylesHelper.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/PietStylesHelper.java
@@ -16,8 +16,8 @@
 
 import static com.google.android.libraries.feed.common.Validators.checkNotNull;
 
-import android.support.annotation.VisibleForTesting;
 import android.util.LruCache;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.logging.Logger;
 import com.google.android.libraries.feed.piet.DebugLogger.MessageType;
 import com.google.search.now.ui.piet.ErrorsProto.ErrorCode;
@@ -173,9 +173,7 @@
       }
       if (boundStyle.hasImageLoadingSettings()) {
         mergedStyle.setImageLoadingSettings(
-            mergedStyle
-                .getImageLoadingSettings()
-                .toBuilder()
+            mergedStyle.getImageLoadingSettings().toBuilder()
                 .mergeFrom(boundStyle.getImageLoadingSettings()));
       }
       if (boundStyle.hasScaleType()) {
diff --git a/src/main/java/com/google/android/libraries/feed/piet/TextElementAdapter.java b/src/main/java/com/google/android/libraries/feed/piet/TextElementAdapter.java
index b47ed6b..f915e8b 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/TextElementAdapter.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/TextElementAdapter.java
@@ -19,12 +19,12 @@
 import android.os.Build;
 import android.os.Build.VERSION;
 import android.os.Build.VERSION_CODES;
-import android.support.annotation.VisibleForTesting;
 import android.support.v4.widget.TextViewCompat;
 import android.text.Layout;
 import android.text.TextUtils;
 import android.view.View;
 import android.widget.TextView;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.functional.Consumer;
 import com.google.android.libraries.feed.common.ui.LayoutUtils;
 import com.google.android.libraries.feed.piet.AdapterFactory.AdapterKeySupplier;
@@ -191,8 +191,8 @@
     // padding (so that only half the padding is on the bottom). That means
     // extraPaddingForLineHeightBottom needs to be negative.
     if (VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) {
-        extraPaddingForLineHeightBottom =
-            -(extraLineHeightBetweenLines - extraPaddingForLineHeightBottom);
+      extraPaddingForLineHeightBottom =
+          -(extraLineHeightBetweenLines - extraPaddingForLineHeightBottom);
     }
 
     extraLineHeight =
diff --git a/src/main/java/com/google/android/libraries/feed/piet/host/ActionHandler.java b/src/main/java/com/google/android/libraries/feed/piet/host/ActionHandler.java
index 13816e2..00a3142 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/host/ActionHandler.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/host/ActionHandler.java
@@ -14,8 +14,8 @@
 
 package com.google.android.libraries.feed.piet.host;
 
-import android.support.annotation.IntDef;
 import android.view.View;
+import androidx.annotation.IntDef;
 import com.google.search.now.ui.piet.ActionsProto.Action;
 import com.google.search.now.ui.piet.LogDataProto.LogData;
 import com.google.search.now.ui.piet.PietProto.Frame;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/host/AssetProvider.java b/src/main/java/com/google/android/libraries/feed/piet/host/AssetProvider.java
index 7c4f570..506ee47 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/host/AssetProvider.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/host/AssetProvider.java
@@ -16,7 +16,7 @@
 
 import android.graphics.Typeface;
 import android.graphics.drawable.Drawable;
-import android.support.annotation.VisibleForTesting;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.functional.Consumer;
 import com.google.android.libraries.feed.common.functional.Supplier;
 import com.google.android.libraries.feed.piet.host.TypefaceProvider.GoogleSansTypeface;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/host/BUILD b/src/main/java/com/google/android/libraries/feed/piet/host/BUILD
index f273d5f..47340a0 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/host/BUILD
+++ b/src/main/java/com/google/android/libraries/feed/piet/host/BUILD
@@ -9,7 +9,7 @@
         "//src/main/java/com/google/android/libraries/feed/common/functional",
         "//src/main/proto/search/now/ui/piet:piet_errors_java_proto_lite",
         "//src/main/proto/search/now/ui/piet:piet_java_proto_lite",
-        "@maven//:com_android_support_support_annotations",
+        "@maven//:androidx_annotation_annotation",
         "@maven//:com_google_code_findbugs_jsr305",
     ],
 )
diff --git a/src/main/java/com/google/android/libraries/feed/piet/host/TypefaceProvider.java b/src/main/java/com/google/android/libraries/feed/piet/host/TypefaceProvider.java
index d93c34c..4e99e87 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/host/TypefaceProvider.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/host/TypefaceProvider.java
@@ -15,7 +15,7 @@
 package com.google.android.libraries.feed.piet.host;
 
 import android.graphics.Typeface;
-import android.support.annotation.StringDef;
+import androidx.annotation.StringDef;
 import com.google.android.libraries.feed.common.functional.Consumer;
 
 /** Allows the host to provide Typefaces to Piet. */
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ui/BUILD b/src/main/java/com/google/android/libraries/feed/piet/ui/BUILD
index c478b94..c0b8926 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ui/BUILD
+++ b/src/main/java/com/google/android/libraries/feed/piet/ui/BUILD
@@ -11,7 +11,7 @@
         "//src/main/java/com/google/android/libraries/feed/common/logging",
         "//src/main/java/com/google/android/libraries/feed/common/ui",
         "//src/main/proto/search/now/ui/piet:piet_java_proto_lite",
-        "@maven//:com_android_support_support_annotations",
+        "@maven//:androidx_annotation_annotation",
         "@maven//:com_android_support_support_compat",
         "@maven//:com_google_code_findbugs_jsr305",
     ],
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ui/GradientShader.java b/src/main/java/com/google/android/libraries/feed/piet/ui/GradientShader.java
index c7a8498..3579eb7 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ui/GradientShader.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ui/GradientShader.java
@@ -20,7 +20,7 @@
 import android.graphics.Shader;
 import android.graphics.Shader.TileMode;
 import android.graphics.drawable.ShapeDrawable;
-import android.support.annotation.VisibleForTesting;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.functional.Supplier;
 
 /** Generates a linear gradient according to CSS behavior */
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ui/GridRowView.java b/src/main/java/com/google/android/libraries/feed/piet/ui/GridRowView.java
index 12e5be4..5881e08 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ui/GridRowView.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ui/GridRowView.java
@@ -15,13 +15,13 @@
 package com.google.android.libraries.feed.piet.ui;
 
 import android.content.Context;
-import android.support.annotation.VisibleForTesting;
 import android.support.v4.view.MarginLayoutParamsCompat;
 import android.util.AttributeSet;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
+import androidx.annotation.VisibleForTesting;
 import com.google.android.libraries.feed.common.functional.Supplier;
 import com.google.android.libraries.feed.common.logging.Logger;
 
diff --git a/src/main/java/com/google/android/libraries/feed/piet/ui/RoundedCornerMaskCache.java b/src/main/java/com/google/android/libraries/feed/piet/ui/RoundedCornerMaskCache.java
index 3beb3a6..d520a34 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/ui/RoundedCornerMaskCache.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/ui/RoundedCornerMaskCache.java
@@ -21,9 +21,9 @@
 import android.graphics.Paint;
 import android.graphics.PorterDuff.Mode;
 import android.graphics.PorterDuffXfermode;
-import android.support.annotation.IntDef;
-import android.support.annotation.VisibleForTesting;
 import android.util.LruCache;
+import androidx.annotation.IntDef;
+import androidx.annotation.VisibleForTesting;
 
 /** Caches rounded corner masks to save memory and time spent creating them */
 public class RoundedCornerMaskCache {