add in flag-guarded LogData for attention logging

PiperOrigin-RevId: 252863766
Change-Id: I58eb29425ed05a0a0b6b852498a5c1ec3c8c8159
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 75532f2..00e4c04 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
@@ -26,6 +26,7 @@
 import android.widget.FrameLayout;
 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;
 import com.google.android.libraries.feed.piet.ui.RoundedCornerWrapperView;
 import com.google.search.now.ui.piet.AccessibilityProto.Accessibility;
 import com.google.search.now.ui.piet.AccessibilityProto.AccessibilityRole;
@@ -292,6 +293,10 @@
     getBaseView()
         .setContentDescription(
             getAccessibilityString(baseElement.getAccessibility(), frameContext));
+    LogDataCallback callback = parameters.hostProviders.getLogDataCallback();
+    if (callback != null && baseElement.hasLogData()) {
+      callback.onBind(baseElement.getLogData(), getView());
+    }
   }
 
   private CharSequence getAccessibilityString(
@@ -415,6 +420,10 @@
     if (created) {
       onUnbindModel();
     }
+    LogDataCallback callback = parameters.hostProviders.getLogDataCallback();
+    if (callback != null && baseElement.hasLogData()) {
+      callback.onUnbind(baseElement.getLogData(), getView());
+    }
     model = null;
     baseElement = Element.getDefaultInstance();
     checkBoundVisibility = false;
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 65966c4..5735ca9 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
@@ -31,6 +31,7 @@
 import com.google.android.libraries.feed.piet.TemplateBinder.TemplateAdapterModel;
 import com.google.android.libraries.feed.piet.host.ActionHandler;
 import com.google.android.libraries.feed.piet.host.EventLogger;
+import com.google.android.libraries.feed.piet.host.LogDataCallback;
 import com.google.search.now.ui.piet.ActionsProto.VisibilityAction;
 import com.google.search.now.ui.piet.ElementsProto.BindingContext;
 import com.google.search.now.ui.piet.ElementsProto.Content;
@@ -149,6 +150,11 @@
       }
     }
     eventLogger.logEvents(localFrameContext.getDebugLogger().getErrorCodes());
+    LogDataCallback callback = parameters.hostProviders.getLogDataCallback();
+    Frame localFrame = localFrameContext.getFrame();
+    if (callback != null && localFrame != null && localFrame.hasLogData()) {
+      callback.onBind(localFrame.getLogData(), frameView);
+    }
   }
 
   @Override
@@ -156,6 +162,13 @@
     triggerHideActions();
 
     LinearLayout view = checkNotNull(this.view);
+    LogDataCallback callback = parameters.hostProviders.getLogDataCallback();
+    if (frameContext != null) {
+      Frame frame = frameContext.getFrame();
+      if (callback != null && frame != null && frame.hasLogData()) {
+        callback.onUnbind(frame.getLogData(), view);
+      }
+    }
     for (ElementAdapter<?, ?> child : childAdapters) {
       parameters.elementAdapterFactory.releaseAdapter(child);
     }
diff --git a/src/main/java/com/google/android/libraries/feed/piet/HostProviders.java b/src/main/java/com/google/android/libraries/feed/piet/HostProviders.java
index 54cfe52..a6fd8be 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/HostProviders.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/HostProviders.java
@@ -17,20 +17,24 @@
 import com.google.android.libraries.feed.piet.host.AssetProvider;
 import com.google.android.libraries.feed.piet.host.CustomElementProvider;
 import com.google.android.libraries.feed.piet.host.HostBindingProvider;
+import com.google.android.libraries.feed.piet.host.LogDataCallback;
 
 /** Wrapper class to hold all host-related objects. */
 public class HostProviders {
   private final AssetProvider assetProvider;
   private final CustomElementProvider customElementProvider;
   private final HostBindingProvider hostBindingProvider;
+  /*@Nullable*/ private final LogDataCallback logDataCallback;
 
   public HostProviders(
       AssetProvider assetProvider,
       CustomElementProvider customElementProvider,
-      HostBindingProvider hostBindingProvider) {
+      HostBindingProvider hostBindingProvider,
+      /*@Nullable*/ LogDataCallback logDataCallback) {
     this.assetProvider = assetProvider;
     this.customElementProvider = customElementProvider;
     this.hostBindingProvider = hostBindingProvider;
+    this.logDataCallback = logDataCallback;
   }
 
   public AssetProvider getAssetProvider() {
@@ -44,4 +48,9 @@
   public HostBindingProvider getHostBindingProvider() {
     return hostBindingProvider;
   }
+
+  /*@Nullable*/
+  public LogDataCallback getLogDataCallback() {
+    return logDataCallback;
+  }
 }
diff --git a/src/main/java/com/google/android/libraries/feed/piet/PietManager.java b/src/main/java/com/google/android/libraries/feed/piet/PietManager.java
index ad00cde..7d9d6c0 100644
--- a/src/main/java/com/google/android/libraries/feed/piet/PietManager.java
+++ b/src/main/java/com/google/android/libraries/feed/piet/PietManager.java
@@ -29,6 +29,7 @@
 import com.google.android.libraries.feed.piet.host.EventLogger;
 import com.google.android.libraries.feed.piet.host.HostBindingProvider;
 import com.google.android.libraries.feed.piet.host.ImageLoader;
+import com.google.android.libraries.feed.piet.host.LogDataCallback;
 import com.google.android.libraries.feed.piet.host.NullImageLoader;
 import com.google.android.libraries.feed.piet.host.NullTypefaceProvider;
 import com.google.android.libraries.feed.piet.host.StringFormatter;
@@ -48,6 +49,13 @@
       EventLogger eventLogger,
       Context context);
 
+  FrameAdapter createPietFrameAdapter(
+      Supplier</*@Nullable*/ ViewGroup> cardViewProducer,
+      ActionHandler actionHandler,
+      EventLogger eventLogger,
+      Context context,
+      /*@Nullable*/ LogDataCallback logDataCallback);
+
   void purgeRecyclerPools();
 
   /** Builder for PietManager that provides defaults wherever possible */
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 e4c63a6..851be89 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
@@ -25,6 +25,7 @@
 import com.google.android.libraries.feed.piet.host.CustomElementProvider;
 import com.google.android.libraries.feed.piet.host.EventLogger;
 import com.google.android.libraries.feed.piet.host.HostBindingProvider;
+import com.google.android.libraries.feed.piet.host.LogDataCallback;
 
 /** Implementation of {@link PietManager}. */
 class PietManagerImpl implements PietManager {
@@ -61,7 +62,17 @@
       ActionHandler actionHandler,
       EventLogger eventLogger,
       Context context) {
-    AdapterParameters parameters = getAdapterParameters(context, cardViewProducer);
+    return createPietFrameAdapter(cardViewProducer, actionHandler, eventLogger, context, null);
+  }
+
+  @Override
+  public FrameAdapter createPietFrameAdapter(
+      Supplier</*@Nullable*/ ViewGroup> cardViewProducer,
+      ActionHandler actionHandler,
+      EventLogger eventLogger,
+      Context context,
+      /*@Nullable*/ LogDataCallback logDataCallback) {
+    AdapterParameters parameters = getAdapterParameters(context, cardViewProducer, logDataCallback);
 
     return new FrameAdapterImpl(context, parameters, actionHandler, eventLogger, debugBehavior);
   }
@@ -72,13 +83,16 @@
    */
   @VisibleForTesting
   AdapterParameters getAdapterParameters(
-      Context context, Supplier</*@Nullable*/ ViewGroup> cardViewProducer) {
+      Context context,
+      Supplier</*@Nullable*/ ViewGroup> cardViewProducer,
+      /*@Nullable*/ LogDataCallback logDataCallback) {
     if (adapterParameters == null || adapterParameters.context != context) {
       adapterParameters =
           new AdapterParameters(
               context,
               cardViewProducer,
-              new HostProviders(assetProvider, customElementProvider, hostBindingProvider),
+              new HostProviders(
+                  assetProvider, customElementProvider, hostBindingProvider, logDataCallback),
               clock,
               useLegacyRoundedCornerImpl,
               useOutlineRoundedCornerImpl);
diff --git a/src/main/java/com/google/android/libraries/feed/piet/host/LogDataCallback.java b/src/main/java/com/google/android/libraries/feed/piet/host/LogDataCallback.java
new file mode 100644
index 0000000..dbc2bc7
--- /dev/null
+++ b/src/main/java/com/google/android/libraries/feed/piet/host/LogDataCallback.java
@@ -0,0 +1,24 @@
+// 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.piet.host;
+
+import android.view.View;
+import com.google.search.now.ui.piet.LogDataProto.LogData;
+
+public interface LogDataCallback {
+  void onBind(LogData logData, View view);
+
+  void onUnbind(LogData logData, View view);
+}
diff --git a/src/test/java/com/google/android/libraries/feed/piet/ElementAdapterTest.java b/src/test/java/com/google/android/libraries/feed/piet/ElementAdapterTest.java
index 436554d..a04db17 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/ElementAdapterTest.java
+++ b/src/test/java/com/google/android/libraries/feed/piet/ElementAdapterTest.java
@@ -42,6 +42,7 @@
 import com.google.android.libraries.feed.piet.AdapterFactory.SingletonKeySupplier;
 import com.google.android.libraries.feed.piet.host.ActionHandler;
 import com.google.android.libraries.feed.piet.host.ActionHandler.ActionType;
+import com.google.android.libraries.feed.piet.host.LogDataCallback;
 import com.google.android.libraries.feed.piet.ui.BitmapMaskingRoundedCornerWrapperView;
 import com.google.android.libraries.feed.piet.ui.RoundedCornerMaskCache;
 import com.google.android.libraries.feed.piet.ui.RoundedCornerWrapperView;
@@ -62,6 +63,7 @@
 import com.google.search.now.ui.piet.ElementsProto.ElementStack;
 import com.google.search.now.ui.piet.ElementsProto.Visibility;
 import com.google.search.now.ui.piet.ElementsProto.VisibilityState;
+import com.google.search.now.ui.piet.LogDataProto.LogData;
 import com.google.search.now.ui.piet.PietProto.Frame;
 import com.google.search.now.ui.piet.RoundedCornersProto.RoundedCorners;
 import com.google.search.now.ui.piet.StylesProto.Borders;
@@ -87,6 +89,8 @@
   private static final boolean LEGACY_CORNERS_FLAG = false;
   private static final boolean OUTLINE_CORNERS_FLAG = false;
 
+  private final LogData logDataTest = LogData.getDefaultInstance();
+
   @Mock private FrameContext frameContext;
   @Mock private HostProviders hostProviders;
   @Mock private ActionHandler actionHandler;
@@ -98,11 +102,27 @@
   private RoundedCornerMaskCache maskCache;
 
   private TestElementAdapter adapter;
+  private boolean callbackBound;
+  private boolean callbackUnbound;
 
   @Before
   public void setUp() {
     initMocks(this);
     context = Robolectric.buildActivity(Activity.class).get();
+    LogDataCallback logDataCallback =
+        new LogDataCallback() {
+          @Override
+          public void onBind(LogData logData, View view) {
+            assertThat(logDataTest).isEqualTo(logData);
+            callbackBound = true;
+          }
+
+          @Override
+          public void onUnbind(LogData logData, View view) {
+            assertThat(logDataTest).isEqualTo(logData);
+            callbackUnbound = true;
+          }
+        };
     parameters =
         new AdapterParameters(
             context,
@@ -112,6 +132,7 @@
             LEGACY_CORNERS_FLAG,
             OUTLINE_CORNERS_FLAG);
     maskCache = parameters.roundedCornerMaskCache;
+    when(hostProviders.getLogDataCallback()).thenReturn(logDataCallback);
     when(frameContext.makeStyleFor(any(StyleIdsStack.class))).thenReturn(styleProvider);
     when(frameContext.getActionHandler()).thenReturn(actionHandler);
     when(styleProvider.hasRoundedCorners()).thenReturn(false);
@@ -491,6 +512,15 @@
   }
 
   @Test
+  public void testBindModel_callsOnBindLogDataCallback() {
+    Element defaultElement = Element.newBuilder().setLogData(logDataTest).build();
+
+    adapter.bindModel(defaultElement, defaultElement, frameContext);
+
+    assertThat(callbackBound).isTrue();
+  }
+
+  @Test
   public void testBindModel_extractsModelFromElement() {
     Element element = Element.getDefaultInstance();
 
@@ -832,6 +862,15 @@
   }
 
   @Test
+  public void testUnbindModel_callsOnBindLogDataCallback() {
+    Element defaultElement = Element.newBuilder().setLogData(logDataTest).build();
+
+    adapter.bindModel(defaultElement, defaultElement, frameContext);
+    adapter.unbindModel();
+    assertThat(callbackUnbound).isTrue();
+  }
+
+  @Test
   public void testUnbindModel_unsetsModel() {
     Element element = Element.getDefaultInstance();
 
diff --git a/src/test/java/com/google/android/libraries/feed/piet/FrameAdapterImplTest.java b/src/test/java/com/google/android/libraries/feed/piet/FrameAdapterImplTest.java
index 15a8c00..088f172 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/FrameAdapterImplTest.java
+++ b/src/test/java/com/google/android/libraries/feed/piet/FrameAdapterImplTest.java
@@ -47,6 +47,7 @@
 import com.google.android.libraries.feed.piet.host.CustomElementProvider;
 import com.google.android.libraries.feed.piet.host.EventLogger;
 import com.google.android.libraries.feed.piet.host.HostBindingProvider;
+import com.google.android.libraries.feed.piet.host.LogDataCallback;
 import com.google.android.libraries.feed.piet.ui.RoundedCornerMaskCache;
 import com.google.search.now.ui.piet.ActionsProto.Action;
 import com.google.search.now.ui.piet.ActionsProto.Actions;
@@ -64,6 +65,7 @@
 import com.google.search.now.ui.piet.ErrorsProto.ErrorCode;
 import com.google.search.now.ui.piet.GradientsProto.Fill;
 import com.google.search.now.ui.piet.ImagesProto.Image;
+import com.google.search.now.ui.piet.LogDataProto.LogData;
 import com.google.search.now.ui.piet.PietAndroidSupport.ShardingControl;
 import com.google.search.now.ui.piet.PietProto.Frame;
 import com.google.search.now.ui.piet.PietProto.PietSharedState;
@@ -102,6 +104,7 @@
                               Content.newBuilder().setElement(Element.getDefaultInstance()))))
           .build();
   private static final int FRAME_WIDTH = 321;
+  private final LogData logDataTest = LogData.getDefaultInstance();
 
   @Mock private AssetProvider assetProvider;
   @Mock private ElementAdapterFactory adapterFactory;
@@ -124,13 +127,28 @@
   private Context context;
   private List<PietSharedState> pietSharedStates;
   private AdapterParameters adapterParameters;
-
+  private boolean callbackBound;
+  private boolean callbackUnbound;
   private FrameAdapterImpl frameAdapter;
 
   @Before
   public void setUp() throws Exception {
     initMocks(this);
     context = Robolectric.buildActivity(Activity.class).get();
+    LogDataCallback logDataCallback =
+        new LogDataCallback() {
+          @Override
+          public void onBind(LogData logData, View view) {
+            assertThat(logDataTest).isEqualTo(logData);
+            callbackBound = true;
+          }
+
+          @Override
+          public void onUnbind(LogData logData, View view) {
+            assertThat(logDataTest).isEqualTo(logData);
+            callbackUnbound = true;
+          }
+        };
     adapterParameters =
         new AdapterParameters(
             null,
@@ -157,6 +175,7 @@
     when(templateAdapter.getHorizontalGravity(anyInt())).thenReturn(Gravity.CENTER_HORIZONTAL);
     when(templateAdapter.getVerticalGravity(anyInt())).thenReturn(Gravity.BOTTOM);
     when(hostProviders.getAssetProvider()).thenReturn(assetProvider);
+    when(hostProviders.getLogDataCallback()).thenReturn(logDataCallback);
     when(assetProvider.isRtLSupplier()).thenReturn(Suppliers.of(false));
     when(frameContext.reportMessage(eq(MessageType.ERROR), anyString()))
         .thenAnswer(
@@ -166,6 +185,7 @@
     when(frameContext.getDebugLogger()).thenReturn(debugLogger);
     when(frameContext.getDebugBehavior()).thenReturn(DebugBehavior.VERBOSE);
     when(frameContext.makeStyleFor(any(StyleIdsStack.class))).thenReturn(styleProvider);
+    when(frameContext.getFrame()).thenReturn(Frame.getDefaultInstance());
     when(elementAdapter.getElementStyle()).thenReturn(styleProvider);
     when(templateAdapter.getElementStyle()).thenReturn(styleProvider);
 
@@ -300,7 +320,8 @@
             debugBehavior,
             new DebugLogger(),
             actionHandler,
-            new HostProviders(assetProvider, customElementProvider, new HostBindingProvider()),
+            new HostProviders(
+                assetProvider, customElementProvider, new HostBindingProvider(), null),
             new FrameLayout(context));
 
     frameAdapter =
@@ -840,4 +861,24 @@
             eq(null));
     verify(elementAdapter).triggerHideActions(frameContext);
   }
+
+  @Test
+  public void testBindModel_callsOnBindLogDataCallback() {
+    Frame frame = Frame.newBuilder().addContents(DEFAULT_CONTENT).setLogData(logDataTest).build();
+    when(frameContext.getFrame()).thenReturn(frame);
+    frameAdapter.bindModel(frame, FRAME_WIDTH, (ShardingControl) null, pietSharedStates);
+
+    assertThat(callbackBound).isTrue();
+  }
+
+  @Test
+  public void testUnbindModel_callsOnBindLogDataCallback() {
+    Frame frame = Frame.newBuilder().addContents(DEFAULT_CONTENT).setLogData(logDataTest).build();
+    when(frameContext.getFrame()).thenReturn(frame);
+    frameAdapter.bindModel(frame, FRAME_WIDTH, (ShardingControl) null, pietSharedStates);
+
+    when(frameContext.getActionHandler()).thenReturn(actionHandler);
+    frameAdapter.unbindModel();
+    assertThat(callbackUnbound).isTrue();
+  }
 }
diff --git a/src/test/java/com/google/android/libraries/feed/piet/FrameContextTest.java b/src/test/java/com/google/android/libraries/feed/piet/FrameContextTest.java
index ee8a6aa..b202b65 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/FrameContextTest.java
+++ b/src/test/java/com/google/android/libraries/feed/piet/FrameContextTest.java
@@ -137,7 +137,8 @@
     context = Robolectric.buildActivity(Activity.class).get();
     hostBindingProvider = new HostBindingProvider();
     hostProviders =
-        new HostProviders(assetProvider, mock(CustomElementProvider.class), hostBindingProvider);
+        new HostProviders(
+            assetProvider, mock(CustomElementProvider.class), hostBindingProvider, null);
     defaultStyleProvider = new StyleProvider(assetProvider);
 
     defaultStylesheet.put(SAMPLE_STYLE_ID, SAMPLE_STYLE);
diff --git a/src/test/java/com/google/android/libraries/feed/piet/ParameterizedTextElementAdapterFactoryTest.java b/src/test/java/com/google/android/libraries/feed/piet/ParameterizedTextElementAdapterFactoryTest.java
index 284c58e..43bd595 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/ParameterizedTextElementAdapterFactoryTest.java
+++ b/src/test/java/com/google/android/libraries/feed/piet/ParameterizedTextElementAdapterFactoryTest.java
@@ -63,7 +63,7 @@
         new AdapterParameters(
             null,
             null,
-            new HostProviders(mock(AssetProvider.class), null, null),
+            new HostProviders(mock(AssetProvider.class), null, null, null),
             new FakeClock(),
             false,
             false);
diff --git a/src/test/java/com/google/android/libraries/feed/piet/PietManagerImplTest.java b/src/test/java/com/google/android/libraries/feed/piet/PietManagerImplTest.java
index 850e649..1a02dbf 100644
--- a/src/test/java/com/google/android/libraries/feed/piet/PietManagerImplTest.java
+++ b/src/test/java/com/google/android/libraries/feed/piet/PietManagerImplTest.java
@@ -23,6 +23,7 @@
 import android.content.Context;
 import android.graphics.Typeface;
 import android.graphics.drawable.Drawable;
+import android.view.View;
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
 import android.widget.LinearLayout;
@@ -41,11 +42,13 @@
 import com.google.android.libraries.feed.piet.host.EventLogger;
 import com.google.android.libraries.feed.piet.host.HostBindingProvider;
 import com.google.android.libraries.feed.piet.host.ImageLoader;
+import com.google.android.libraries.feed.piet.host.LogDataCallback;
 import com.google.android.libraries.feed.piet.host.StringFormatter;
 import com.google.android.libraries.feed.piet.host.ThrowingCustomElementProvider;
 import com.google.android.libraries.feed.piet.host.TypefaceProvider;
 import com.google.android.libraries.feed.piet.ui.RoundedCornerMaskCache;
 import com.google.search.now.ui.piet.ImagesProto.Image;
+import com.google.search.now.ui.piet.LogDataProto.LogData;
 import com.google.search.now.ui.piet.PietProto.Frame;
 import java.util.Collections;
 import java.util.Locale;
@@ -94,11 +97,30 @@
     FrameAdapterImpl frameAdapter =
         (FrameAdapterImpl)
             pietManager.createPietFrameAdapter(
-                cardViewSupplier, actionHandler, eventLogger, context);
+                cardViewSupplier, actionHandler, eventLogger, context, /* logDataCallback= */ null);
     assertThat(frameAdapter.getParameters().parentViewSupplier).isSameInstanceAs(cardViewSupplier);
   }
 
   @Test
+  public void testCreatePietFrameAdapter_loggingCallback() {
+    LogDataCallback logDataCallback =
+        new LogDataCallback() {
+          @Override
+          public void onBind(LogData logData, View view) {}
+
+          @Override
+          public void onUnbind(LogData logData, View view) {}
+        };
+    Supplier<ViewGroup> cardViewSupplier = Suppliers.of(viewGroup1);
+    FrameAdapterImpl frameAdapter =
+        (FrameAdapterImpl)
+            pietManager.createPietFrameAdapter(
+                cardViewSupplier, actionHandler, eventLogger, context, logDataCallback);
+    assertThat(frameAdapter.getParameters().hostProviders.getLogDataCallback())
+        .isEqualTo(logDataCallback);
+  }
+
+  @Test
   public void testGetAdapterParameters() {
     Supplier<ViewGroup> viewGroupProducer1 = Suppliers.of(viewGroup1);
     Supplier<ViewGroup> viewGroupProducer2 = Suppliers.of(viewGroup2);
@@ -108,23 +130,28 @@
     AdapterParameters returnParams;
 
     // Get params for a context that does not exist
-    returnParams = pietManager.getAdapterParameters(context1, viewGroupProducer1);
+    returnParams =
+        pietManager.getAdapterParameters(context1, viewGroupProducer1, /* logDataCallback= */ null);
     assertThat(returnParams.parentViewSupplier).isEqualTo(viewGroupProducer1);
     assertThat(returnParams.context).isEqualTo(context1);
 
     // Get params for the same context again (use cached value)
-    returnParams = pietManager.getAdapterParameters(context1, Suppliers.of(null));
+    returnParams =
+        pietManager.getAdapterParameters(context1, Suppliers.of(null), /* logDataCallback= */ null);
     assertThat(returnParams.parentViewSupplier).isEqualTo(viewGroupProducer1);
 
     // Get params for a different context
-    returnParams = pietManager.getAdapterParameters(context2, viewGroupProducer2);
+    returnParams =
+        pietManager.getAdapterParameters(context2, viewGroupProducer2, /* logDataCallback= */ null);
     assertThat(returnParams.parentViewSupplier).isEqualTo(viewGroupProducer2);
   }
 
   @Test
   public void testBuilder_defaults() {
     PietManagerImpl manager = (PietManagerImpl) PietManager.builder().build();
-    AdapterParameters parameters = manager.getAdapterParameters(context, Suppliers.of(viewGroup1));
+    AdapterParameters parameters =
+        manager.getAdapterParameters(
+            context, Suppliers.of(viewGroup1), /* logDataCallback= */ null);
     assertThat(parameters.hostProviders.getCustomElementProvider())
         .isInstanceOf(ThrowingCustomElementProvider.class);
     assertThat(parameters.clock).isInstanceOf(SystemClockImpl.class);
@@ -133,7 +160,11 @@
     FrameAdapterImpl frameAdapter =
         (FrameAdapterImpl)
             manager.createPietFrameAdapter(
-                Suppliers.of(viewGroup1), actionHandler, eventLogger, context);
+                Suppliers.of(viewGroup1),
+                actionHandler,
+                eventLogger,
+                context,
+                /* logDataCallback= */ null);
     FrameContext frameContext =
         frameAdapter.createFrameContext(
             Frame.getDefaultInstance(), 0, Collections.emptyList(), viewGroup2);
@@ -184,7 +215,9 @@
                 .setHostBindingProvider(hostBindingProvider)
                 .setClock(clock)
                 .build();
-    AdapterParameters parameters = manager.getAdapterParameters(context, Suppliers.of(viewGroup1));
+    AdapterParameters parameters =
+        manager.getAdapterParameters(
+            context, Suppliers.of(viewGroup1), /* logDataCallback= */ null);
     assertThat(parameters.hostProviders.getCustomElementProvider())
         .isSameInstanceAs(customElementProvider);
     assertThat(parameters.hostProviders.getHostBindingProvider())
@@ -194,7 +227,11 @@
     FrameAdapterImpl frameAdapter =
         (FrameAdapterImpl)
             manager.createPietFrameAdapter(
-                Suppliers.of(viewGroup1), actionHandler, eventLogger, context);
+                Suppliers.of(viewGroup1),
+                actionHandler,
+                eventLogger,
+                context,
+                /* logDataCallback= */ null);
     FrameContext frameContext =
         frameAdapter.createFrameContext(
             Frame.getDefaultInstance(), 0, Collections.emptyList(), viewGroup2);