ImaAdsLoader implements Player.EventListener,
        AdsLoader,
        VideoAdPlayer,
        ContentProgressProvider,
        AdErrorListener,
        AdsLoadedListener,
        AdEventListener { @Override public void start(EventListener eventListener, AdViewProvider adViewProvider) { Assertions.checkState( wasSetPlayerCalled, "Set player using adsLoader.setPlayer before preparing the player."); player = nextPlayer; if (player == null) { return; } this.eventListener = eventListener; lastVolumePercentage = 0; lastAdProgress = null; lastContentProgress = null; ViewGroup adViewGroup = adViewProvider.getAdViewGroup(); adDisplayContainer.setAdContainer(adViewGroup); View[] adOverlayViews = adViewProvider.getAdOverlayViews(); for (View view : adOverlayViews) { adDisplayContainer.registerVideoControlsOverlay(view); } player.addListener(this); maybeNotifyPendingAdLoadError(); if (adPlaybackState != null) { eventListener.onAdPlaybackState(adPlaybackState); if (imaPausedContent && player.getPlayWhenReady()) { adsManager.resume(); } } else if (adsManager != null) { adPlaybackState = new AdPlaybackState(getAdGroupTimesUs(adsManager.getAdCuePoints())); updateAdPlaybackState(); } else { requestAds(adViewGroup); } } ImaAdsLoader(Context context, Uri adTagUri); @Deprecated  ImaAdsLoader(Context context, Uri adTagUri, @Nullable ImaSdkSettings imaSdkSettings); private  ImaAdsLoader(
      Context context,
      @Nullable Uri adTagUri,
      @Nullable ImaSdkSettings imaSdkSettings,
      @Nullable String adsResponse,
      int vastLoadTimeoutMs,
      int mediaLoadTimeoutMs,
      int mediaBitrate,
      boolean focusSkipButtonWhenAvailable,
      @Nullable Set<UiElement> adUiElements,
      @Nullable AdEventListener adEventListener,
      ImaFactory imaFactory); com.google.ads.interactivemedia.v3.api.AdsLoader getAdsLoader(); AdDisplayContainer getAdDisplayContainer(); @Deprecated void setCompanionSlots(Collection<CompanionAdSlot> companionSlots); void requestAds(ViewGroup adViewGroup); @Override void setPlayer(@Nullable Player player); @Override void setSupportedContentTypes(@C.ContentType int... contentTypes); @Override void start(EventListener eventListener, AdViewProvider adViewProvider); @Override void stop(); @Override void release(); @Override void handlePrepareError(int adGroupIndex, int adIndexInAdGroup, IOException exception); @Override void onAdsManagerLoaded(AdsManagerLoadedEvent adsManagerLoadedEvent); @Override void onAdEvent(AdEvent adEvent); @Override void onAdError(AdErrorEvent adErrorEvent); @Override VideoProgressUpdate getContentProgress(); @Override VideoProgressUpdate getAdProgress(); @Override int getVolume(); @Override void loadAd(String adUriString); @Override void addCallback(VideoAdPlayerCallback videoAdPlayerCallback); @Override void removeCallback(VideoAdPlayerCallback videoAdPlayerCallback); @Override void playAd(); @Override void stopAd(); @Override void pauseAd(); @Override void resumeAd(); @Override void onTimelineChanged(Timeline timeline, @Player.TimelineChangeReason int reason); @Override void onPlayerStateChanged(boolean playWhenReady, @Player.State int playbackState); @Override void onPlayerError(ExoPlaybackException error); @Override void onPositionDiscontinuity(@Player.DiscontinuityReason int reason);  }
@Test public void testStart_setsAdUiViewGroup() { setupPlayback(CONTENT_TIMELINE, PREROLL_ADS_DURATIONS_US, PREROLL_CUE_POINTS_SECONDS); imaAdsLoader.start(adsLoaderListener, adViewProvider); verify(adDisplayContainer, atLeastOnce()).setAdContainer(adViewGroup); verify(adDisplayContainer, atLeastOnce()).registerVideoControlsOverlay(adOverlayView); }
@Test public void testStart_updatesAdPlaybackState() { setupPlayback(CONTENT_TIMELINE, PREROLL_ADS_DURATIONS_US, PREROLL_CUE_POINTS_SECONDS); imaAdsLoader.start(adsLoaderListener, adViewProvider); assertThat(adsLoaderListener.adPlaybackState) .isEqualTo( new AdPlaybackState( 0) .withAdDurationsUs(PREROLL_ADS_DURATIONS_US) .withContentDurationUs(CONTENT_DURATION_US)); }