@@ -0,0 +1,3146 @@
+// (c) Facebook, Inc. and its affiliates. Confidential and proprietary.%0A%0Apackage com.facebook.fresco.ui.common;%0A%0Aimport android.util.Log;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport javax.annotation.Nullable;%0A%0Apublic class ForwardingControllerListener2%3CI%3E extends BaseControllerListener2%3CI%3E %7B%0A%0A  private static final String TAG = %22FwdControllerListener2%22;%0A%0A  private final List%3CControllerListener2%3CI%3E%3E mListeners = new ArrayList%3C%3E(2);%0A%0A  public synchronized void addListener(ControllerListener2%3CI%3E listener) %7B%0A    mListeners.add(listener);%0A  %7D%0A%0A  public synchronized void removeListener(ControllerListener2%3CI%3E listener) %7B%0A    int index = mListeners.indexOf(listener);%0A    if (index != -1) %7B%0A      mListeners.set(index, null);%0A    %7D%0A  %7D%0A%0A  public synchronized void removeAllListeners() %7B%0A    mListeners.clear();%0A  %7D%0A%0A  private synchronized void onException(String message, Throwable t) %7B%0A    Log.e(TAG, message, t);%0A  %7D%0A%0A  @Override%0A  public void onSubmit(String id, Object callerContext) %7B%0A    final int numberOfListeners = mListeners.size();%0A    for (int i = 0; i %3C numberOfListeners; ++i) %7B%0A      try %7B%0A        ControllerListener2%3CI%3E listener = mListeners.get(i);%0A        if (listener != null) %7B%0A          listener.onSubmit(id, callerContext);%0A        %7D%0A      %7D catch (Exception exception) %7B%0A        // Don't punish the other listeners if we're given a bad one.%0A        onException(%22ForwardingControllerListener2 exception in onSubmit%22, exception);%0A      %7D%0A    %7D%0A  %7D%0A%0A  @Override%0A  public void onFinalImageSet(String id, @Nullable I imageInfo, Extras extraData) %7B%0A    final int numberOfListeners = mListeners.size();%0A    for (int i = 0; i %3C numberOfListeners; ++i) %7B%0A      try %7B%0A        ControllerListener2%3CI%3E listener = mListeners.get(i);%0A        if (listener != null) %7B%0A          listener.onFinalImageSet(id, imageInfo, extraData);%0A        %7D%0A      %7D catch (Exception exception) %7B%0A        // Don't punish the other listeners if we're given a bad one.%0A        onException(%22ForwardingControllerListener2 exception in onFinalImageSet%22, exception);%0A      %7D%0A    %7D%0A  %7D%0A%0A  @Override%0A  public void onFailure(String id, Throwable throwable) %7B%0A    final int numberOfListeners = mListeners.size();%0A    for (int i = 0; i %3C numberOfListeners; ++i) %7B%0A      try %7B%0A        ControllerListener2%3CI%3E listener = mListeners.get(i);%0A        if (listener != null) %7B%0A          listener.onFailure(id, throwable);%0A        %7D%0A      %7D catch (Exception exception) %7B%0A        // Don't punish the other listeners if we're given a bad one.%0A        onException(%22ForwardingControllerListener2 exception in onFailure%22, exception);%0A      %7D%0A    %7D%0A  %7D%0A%0A  @Override%0A  public void onRelease(String id) %7B%0A    final int numberOfListeners = mListeners.size();%0A    for (int i = 0; i %3C numberOfListeners; ++i) %7B%0A      try %7B%0A        ControllerListener2%3CI%3E listener = mListeners.get(i);%0A        if (listener != null) %7B%0A          listener.onRelease(id);%0A        %7D%0A      %7D catch (Exception exception) %7B%0A        // Don't punish the other listeners if we're given a bad one.%0A        onException(%22ForwardingControllerListener2 exception in onRelease%22, exception);%0A      %7D%0A    %7D%0A  %7D%0A%7D%0A

Add forwarding controller listener 2