Remove more unused code

This code became unused when the feed library was removed from G3

PiperOrigin-RevId: 286208899
Change-Id: I3d26a4a33f9cf73028ac984cbcc063646892eaa9
diff --git a/src/main/java/com/google/android/libraries/feed/api/host/imageloader/BUILD b/src/main/java/com/google/android/libraries/feed/api/host/imageloader/BUILD
deleted file mode 100644
index 11599b4..0000000
--- a/src/main/java/com/google/android/libraries/feed/api/host/imageloader/BUILD
+++ /dev/null
@@ -1,12 +0,0 @@
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"])  # Apache 2
-
-android_library(
-    name = "imageloader",
-    srcs = glob(["*.java"]),
-    deps = [
-        "//src/main/java/com/google/android/libraries/feed/common/functional",
-        "@com_google_code_findbugs_jsr305//jar",
-    ],
-)
diff --git a/src/main/java/com/google/android/libraries/feed/api/host/imageloader/ImageLoaderApi.java b/src/main/java/com/google/android/libraries/feed/api/host/imageloader/ImageLoaderApi.java
deleted file mode 100644
index 4294688..0000000
--- a/src/main/java/com/google/android/libraries/feed/api/host/imageloader/ImageLoaderApi.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2018 The Feed Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.android.libraries.feed.api.host.imageloader;
-
-import android.graphics.drawable.Drawable;
-import com.google.android.libraries.feed.common.functional.Consumer;
-import java.util.List;
-
-/** Feed Host API to load images. */
-public interface ImageLoaderApi {
-  /** Constant used to notify host that an image's height or width is not known. */
-  int DIMENSION_UNKNOWN = -1;
-
-  /**
-   * Asks host to load an image from the web, a bundled asset, or some other type of drawable like a
-   * monogram if supported.
-   *
-   * <p>The width and the height of the image can be provided preemptively, however it is not
-   * guaranteed that both dimensions will be known. In the case that only one dimension is known,
-   * the host should be careful to preserve the aspect ratio.
-   *
-   * <p>Feed will not cache any images, so if caching is desired, it should be done on the host
-   * side.
-   *
-   * @param urls A list of urls, tried in order until a load succeeds. Urls may be bundled. The list
-   *     of bundled assets will be defined via the {@link BundledAssets} StringDef.
-   * @param widthPx The width of the image in pixels. Will be {@link #DIMENSION_UNKNOWN} if unknown.
-   * @param heightPx The height of the image in pixels. Will be {@link #DIMENSION_UNKNOWN} if
-   *     unknown.
-   * @param consumer Callback to return the Drawable to if one of the urls provided is successful.
-   *     {@literal null} if no Drawable is found (or could not be loaded) after trying all possible
-   *     urls.
-   */
-  void loadDrawable(
-      List<String> urls, int widthPx, int heightPx, Consumer</*@Nullable*/ Drawable> consumer);
-}
diff --git a/src/main/java/com/google/android/libraries/feed/api/internal/common/BUILD b/src/main/java/com/google/android/libraries/feed/api/internal/common/BUILD
deleted file mode 100644
index dcb1bb5..0000000
--- a/src/main/java/com/google/android/libraries/feed/api/internal/common/BUILD
+++ /dev/null
@@ -1,8 +0,0 @@
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"])  # Apache 2
-
-android_library(
-    name = "common",
-    srcs = glob(["*.java"]),
-)
diff --git a/src/main/java/com/google/android/libraries/feed/api/internal/common/ThreadUtils.java b/src/main/java/com/google/android/libraries/feed/api/internal/common/ThreadUtils.java
deleted file mode 100644
index a722c45..0000000
--- a/src/main/java/com/google/android/libraries/feed/api/internal/common/ThreadUtils.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2018 The Feed Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.android.libraries.feed.api.internal.common;
-
-import android.os.Looper;
-
-/** Thread utilities. */
-// TODO: Need to make this class file for Tiktok compliance.  This is mocked in a bunch
-// of tests which run on the main thread.
-public class ThreadUtils {
-  public ThreadUtils() {}
-
-  /** Returns {@code true} if this method is being called from the main/UI thread. */
-  public boolean isMainThread() {
-    return Looper.getMainLooper() == Looper.myLooper();
-  }
-
-  public void checkNotMainThread() {
-    check(!isMainThread(), "checkNotMainThread failed");
-  }
-
-  public void checkMainThread() {
-    check(isMainThread(), "checkMainThread failed");
-  }
-
-  protected void check(boolean condition, String message) {
-    if (!condition) {
-      throw new IllegalStateException(message);
-    }
-  }
-}
diff --git a/src/main/java/com/google/android/libraries/feed/common/functional/Committer.java b/src/main/java/com/google/android/libraries/feed/common/functional/Committer.java
deleted file mode 100644
index c6d8eb4..0000000
--- a/src/main/java/com/google/android/libraries/feed/common/functional/Committer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2018 The Feed Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.android.libraries.feed.common.functional;
-
-/**
- * Interface which externalizes the action of committing a mutation from the class implementing the
- * mutation. This is a common design pattern used to mutate the library components. The mutation
- * builder will call a {@code Committer} to commit the accumulated changes.
- *
- * @param <R> The return value
- * @param <C> A class containing the changes which will be committed.
- */
-public interface Committer<R, C> {
-  /** Commit the change T, and optionally return a value R */
-  R commit(C change);
-}
diff --git a/src/main/java/com/google/android/libraries/feed/common/functional/Function.java b/src/main/java/com/google/android/libraries/feed/common/functional/Function.java
deleted file mode 100644
index 3a3b7af..0000000
--- a/src/main/java/com/google/android/libraries/feed/common/functional/Function.java
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Feed Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.android.libraries.feed.common.functional;
-
-/** Function definition used by the Feed. This is a subset of the Java 8 defined Function. */
-public interface Function<T, R> {
-  /** Applies this function to the given argument. */
-  R apply(T t);
-}
diff --git a/src/main/java/com/google/android/libraries/feed/common/functional/Predicate.java b/src/main/java/com/google/android/libraries/feed/common/functional/Predicate.java
deleted file mode 100644
index 9138379..0000000
--- a/src/main/java/com/google/android/libraries/feed/common/functional/Predicate.java
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Feed Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.android.libraries.feed.common.functional;
-
-/** Predicate support for the Feed. This is a copy of the Java 8 defined Predicate. */
-public interface Predicate<T> {
-  /** Evaluates this predicate on the argument. */
-  boolean test(T t);
-}
diff --git a/src/main/java/com/google/android/libraries/feed/common/ui/LayoutUtils.java b/src/main/java/com/google/android/libraries/feed/common/ui/LayoutUtils.java
index 7d3025e..91ecf38 100644
--- a/src/main/java/com/google/android/libraries/feed/common/ui/LayoutUtils.java
+++ b/src/main/java/com/google/android/libraries/feed/common/ui/LayoutUtils.java
@@ -17,25 +17,14 @@
 import android.annotation.TargetApi;
 import android.content.Context;
 import android.os.Build;
-import android.os.Build.VERSION_CODES;
 import android.text.TextUtils;
 import android.util.DisplayMetrics;
 import android.util.TypedValue;
 import android.view.View;
-import android.view.ViewGroup.MarginLayoutParams;
 import java.util.Locale;
 
 /** General utilities to help with UI layout. */
 public class LayoutUtils {
-  @TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
-  public static void setMarginsRelative(
-      MarginLayoutParams params, int start, int top, int end, int bottom) {
-    params.setMargins(start, top, end, bottom);
-    if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
-      params.setMarginStart(start);
-      params.setMarginEnd(end);
-    }
-  }
 
   /**
    * Converts DP to PX, where PX represents the actual number of pixels displayed, based on the
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 2f4b129..1a474e1 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/BUILD
+++ b/src/main/java/com/google/android/libraries/feed/piet/BUILD
@@ -9,7 +9,6 @@
     resource_files = glob(["res/**/*"]),
     deps = [
         "//src/main/java/com/google/android/libraries/feed/api/host/config",
-        "//src/main/java/com/google/android/libraries/feed/api/host/imageloader",
         "//src/main/java/com/google/android/libraries/feed/common",
         "//src/main/java/com/google/android/libraries/feed/common/functional",
         "//src/main/java/com/google/android/libraries/feed/common/logging",
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 8e6f1c5..4e33acc 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
@@ -14,8 +14,8 @@
 
 package com.google.android.libraries.feed.piet;
 
-import static com.google.android.libraries.feed.api.host.imageloader.ImageLoaderApi.DIMENSION_UNKNOWN;
 import static com.google.android.libraries.feed.common.Validators.checkState;
+import static com.google.android.libraries.feed.piet.host.ImageLoader.DIMENSION_UNKNOWN;
 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_OR_UNHANDLED_CONTENT;
 
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 cfca2d4..b5f8972 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
@@ -14,8 +14,8 @@
 
 package com.google.android.libraries.feed.piet;
 
-import static com.google.android.libraries.feed.api.host.imageloader.ImageLoaderApi.DIMENSION_UNKNOWN;
 import static com.google.android.libraries.feed.common.Validators.checkState;
+import static com.google.android.libraries.feed.piet.host.ImageLoader.DIMENSION_UNKNOWN;
 
 import android.content.Context;
 import android.support.annotation.VisibleForTesting;
diff --git a/src/main/java/com/google/android/libraries/feed/piet/host/ImageLoader.java b/src/main/java/com/google/android/libraries/feed/piet/host/ImageLoader.java
index 1402bdf..4faeda4 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/host/ImageLoader.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/host/ImageLoader.java
@@ -20,6 +20,8 @@
 
 /** Class that allows Piet to ask the host to load an image. */
 public interface ImageLoader {
+  /** Constant used to notify host that an image's height or width is not known. */
+  int DIMENSION_UNKNOWN = -1;
 
   /**
    * Given an {@link Image}, asynchronously load the {@link Drawable} and return via a {@link
diff --git a/src/main/java/com/google/android/libraries/feed/sharedstream/BUILD b/src/main/java/com/google/android/libraries/feed/sharedstream/BUILD
deleted file mode 100644
index 1621260..0000000
--- a/src/main/java/com/google/android/libraries/feed/sharedstream/BUILD
+++ /dev/null
@@ -1,3 +0,0 @@
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"])  # Apache 2
diff --git a/src/test/java/com/google/android/libraries/feed/common/ui/LayoutUtilsTest.java b/src/test/java/com/google/android/libraries/feed/common/ui/LayoutUtilsTest.java
index ef0c91c..3e29d08 100644
--- a/src/test/java/com/google/android/libraries/feed/common/ui/LayoutUtilsTest.java
+++ b/src/test/java/com/google/android/libraries/feed/common/ui/LayoutUtilsTest.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.os.Build.VERSION_CODES;
-import android.widget.LinearLayout;
 import androidx.test.core.app.ApplicationProvider;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -29,41 +28,9 @@
 @RunWith(RobolectricTestRunner.class)
 @Config(sdk = VERSION_CODES.JELLY_BEAN_MR1)
 public class LayoutUtilsTest {
-
-  private static final int START = 1;
-  private static final int TOP = 2;
-  private static final int END = 3;
-  private static final int BOTTOM = 4;
-
   private final Context context = ApplicationProvider.getApplicationContext();
 
   @Test
-  @Config(sdk = VERSION_CODES.JELLY_BEAN)
-  public void testSetMarginsRelative_api16() {
-    LinearLayout.LayoutParams lp =
-        new LinearLayout.LayoutParams(
-            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
-    LayoutUtils.setMarginsRelative(lp, START, TOP, END, BOTTOM);
-    assertThat(lp.leftMargin).isEqualTo(START);
-    assertThat(lp.rightMargin).isEqualTo(END);
-    assertThat(lp.topMargin).isEqualTo(TOP);
-    assertThat(lp.bottomMargin).isEqualTo(BOTTOM);
-  }
-
-  @Test
-  @Config(sdk = VERSION_CODES.JELLY_BEAN_MR1)
-  public void testSetMarginsRelative_api17() {
-    LinearLayout.LayoutParams lp =
-        new LinearLayout.LayoutParams(
-            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
-    LayoutUtils.setMarginsRelative(lp, START, TOP, END, BOTTOM);
-    assertThat(lp.getMarginStart()).isEqualTo(START);
-    assertThat(lp.getMarginEnd()).isEqualTo(END);
-    assertThat(lp.topMargin).isEqualTo(TOP);
-    assertThat(lp.bottomMargin).isEqualTo(BOTTOM);
-  }
-
-  @Test
   public void testDpToPx() {
     // TODO: Switch this to using @Config to set density to something different than 1.
     assertThat(LayoutUtils.dpToPx(1000.0f, context)).isWithin(1.0e-04f).of(1000.0f);
diff --git a/src/test/java/com/google/android/libraries/feed/piet/BUILD b/src/test/java/com/google/android/libraries/feed/piet/BUILD
index 0216b48..8379601 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/BUILD
+++ b/src/test/java/com/google/android/libraries/feed/piet/BUILD
@@ -9,7 +9,6 @@
     srcs = ["ChunkedTextElementAdapterTest.java"],
     manifest_values = DEFAULT_ANDROID_LOCAL_TEST_MANIFEST,
     deps = [
-        "//src/main/java/com/google/android/libraries/feed/api/host/imageloader",
         "//src/main/java/com/google/android/libraries/feed/common/testing",
         "//src/main/java/com/google/android/libraries/feed/common/time/testing",
         "//src/main/java/com/google/android/libraries/feed/common/ui",
@@ -243,7 +242,6 @@
     srcs = ["ImageElementAdapterTest.java"],
     manifest_values = DEFAULT_ANDROID_LOCAL_TEST_MANIFEST,
     deps = [
-        "//src/main/java/com/google/android/libraries/feed/api/host/imageloader",
         "//src/main/java/com/google/android/libraries/feed/common/functional",
         "//src/main/java/com/google/android/libraries/feed/common/testing",
         "//src/main/java/com/google/android/libraries/feed/common/time/testing",
diff --git a/src/test/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapterTest.java b/src/test/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapterTest.java
index a00de72..18502db 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapterTest.java
+++ b/src/test/java/com/google/android/libraries/feed/piet/ChunkedTextElementAdapterTest.java
@@ -14,9 +14,9 @@
 
 package com.google.android.libraries.feed.piet;
 
-import static com.google.android.libraries.feed.api.host.imageloader.ImageLoaderApi.DIMENSION_UNKNOWN;
 import static com.google.android.libraries.feed.common.testing.RunnableSubject.assertThatRunnable;
 import static com.google.android.libraries.feed.piet.ChunkedTextElementAdapter.SINGLE_LAYER_ID;
+import static com.google.android.libraries.feed.piet.host.ImageLoader.DIMENSION_UNKNOWN;
 import static com.google.common.truth.Truth.assertThat;
 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_OR_UNHANDLED_CONTENT;
diff --git a/src/test/java/com/google/android/libraries/feed/piet/ImageElementAdapterTest.java b/src/test/java/com/google/android/libraries/feed/piet/ImageElementAdapterTest.java
index db19829..d95ea72 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/ImageElementAdapterTest.java
+++ b/src/test/java/com/google/android/libraries/feed/piet/ImageElementAdapterTest.java
@@ -14,9 +14,9 @@
 
 package com.google.android.libraries.feed.piet;
 
-import static com.google.android.libraries.feed.api.host.imageloader.ImageLoaderApi.DIMENSION_UNKNOWN;
 import static com.google.android.libraries.feed.common.testing.RunnableSubject.assertThatRunnable;
 import static com.google.android.libraries.feed.piet.StyleProvider.DIMENSION_NOT_SET;
+import static com.google.android.libraries.feed.piet.host.ImageLoader.DIMENSION_UNKNOWN;
 import static com.google.common.truth.Truth.assertThat;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;