Register the overlay view as non-obstructing

Currently IMA determines that the overlay is obstructing, even
if it's empty. Register it as friendly, which means we're
assuming that anything the apps puts in it is necessary for
playback.

PiperOrigin-RevId: 234963065
This commit is contained in:
andrewlewis 2019-02-21 11:08:11 +00:00 committed by Andrew Lewis
parent 1450b3713f
commit 253ea78679

View File

@ -70,6 +70,7 @@ import com.google.android.exoplayer2.video.VideoListener;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -1116,7 +1117,14 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
@Override @Override
public View[] getAdOverlayViews() { public View[] getAdOverlayViews() {
return controller != null ? new View[] {controller} : new View[0]; ArrayList<View> overlayViews = new ArrayList<>();
if (overlayFrameLayout != null) {
overlayViews.add(overlayFrameLayout);
}
if (controller != null) {
overlayViews.add(controller);
}
return overlayViews.toArray(new View[0]);
} }
// Internal methods. // Internal methods.