Commit cc4f10b4 by ibaker Committed by Tofunmi Adigun-Hameed

Rollback of https://github.com/google/ExoPlayer/commit/b743ad9f7c36c3499dee12abd6c6c107b85e80c4

*** Original commit ***

Rollback of https://github.com/google/ExoPlayer/commit/221a56da38d52ae3f963dfd9e38de11262c0b725

*** Original commit ***

Rollback of https://github.com/google/ExoPlayer/commit/749d77b1d9989d091dc11269087093bc2c48d216

*** Original commit ***

PiperOrigin-RevId: 531530885
(cherry picked from commit 7e630fa90f85c29f9c2e6ac49e8ee176220aa6e0)
parent 14c52b4c
......@@ -56,7 +56,6 @@ project.ext {
androidxTestRulesVersion = '1.5.0'
androidxTestServicesStorageVersion = '1.4.2'
androidxTestTruthVersion = '1.5.0'
androidxWindowVersion = '1.0.0'
truthVersion = '1.1.3'
okhttpVersion = '4.11.0'
modulePrefix = ':'
......
......@@ -25,10 +25,7 @@ dependencies {
implementation project(modulePrefix + 'library-common')
api 'androidx.media:media:' + androidxMediaVersion
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
implementation 'androidx.core:core:' + androidxCoreVersion
implementation 'androidx.recyclerview:recyclerview:' + androidxRecyclerViewVersion
implementation 'androidx.window:window:' + androidxWindowVersion
implementation 'androidx.window:window-java:' + androidxWindowVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
testImplementation project(modulePrefix + 'testutils')
......
......@@ -26,10 +26,7 @@ import static com.google.android.exoplayer2.util.Util.getDrawable;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
......@@ -56,14 +53,6 @@ import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import androidx.core.util.Consumer;
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
import androidx.window.layout.DisplayFeature;
import androidx.window.layout.FoldingFeature;
import androidx.window.layout.FoldingFeature.Orientation;
import androidx.window.layout.FoldingFeature.State;
import androidx.window.layout.WindowInfoTracker;
import androidx.window.layout.WindowLayoutInfo;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.MediaMetadata;
import com.google.android.exoplayer2.PlaybackException;
......@@ -87,7 +76,6 @@ import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.List;
import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/**
......@@ -275,9 +263,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
private boolean controllerHideOnTouch;
private int textureViewRotation;
private boolean isTouching;
private boolean isTabletop;
private final WindowInfoTrackerCallbackAdapter windowInfoTracker;
@MonotonicNonNull private Consumer<WindowLayoutInfo> layoutStateChangeCallback;
public StyledPlayerView(Context context) {
this(context, /* attrs= */ null);
......@@ -291,9 +276,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
public StyledPlayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
isTabletop = false;
windowInfoTracker =
new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(context));
componentListener = new ComponentListener();
if (isInEditMode()) {
......@@ -597,25 +579,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
layoutStateChangeCallback = this::consumeWindowLayoutInfo;
@Nullable Activity activity = getActivity();
if (activity != null) {
windowInfoTracker.addWindowLayoutInfoListener(
activity, ContextCompat.getMainExecutor(getContext()), layoutStateChangeCallback);
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (layoutStateChangeCallback != null) {
windowInfoTracker.removeWindowLayoutInfoListener(layoutStateChangeCallback);
}
}
/**
* Sets the {@link ResizeMode}.
*
......@@ -1525,53 +1488,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
|| keyCode == KeyEvent.KEYCODE_DPAD_CENTER;
}
@Nullable
private Activity getActivity() {
Context context = getContext();
while (context instanceof ContextWrapper) {
if (context instanceof Activity) {
return (Activity) context;
}
context = ((ContextWrapper) context).getBaseContext();
}
return null;
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
isTabletop = false;
}
private void consumeWindowLayoutInfo(WindowLayoutInfo windowLayoutInfo) {
List<DisplayFeature> features = windowLayoutInfo.getDisplayFeatures();
int foldingFeatureIndex = C.INDEX_UNSET;
for (int i = 0; i < features.size(); i++) {
DisplayFeature feature = features.get(i);
if (feature instanceof FoldingFeature) {
if (foldingFeatureIndex != C.INDEX_UNSET) {
// For now, we are only handling single folding features like tabletop and book fold.
return;
}
foldingFeatureIndex = i;
}
}
if (foldingFeatureIndex != C.INDEX_UNSET) {
handleFoldingFeature((FoldingFeature) features.get(foldingFeatureIndex));
}
}
private void handleFoldingFeature(FoldingFeature feature) {
boolean isTabletopFeature =
feature.getOrientation() == Orientation.HORIZONTAL
&& feature.getState() == State.HALF_OPENED;
// Only enter or exit tabletop if different than current orientation and state
if (isTabletopFeature != isTabletop) {
isTabletop = isTabletopFeature;
}
}
// Implementing the deprecated StyledPlayerControlView.VisibilityListener and
// StyledPlayerControlView.OnFullScreenModeChangedListener for now.
@SuppressWarnings("deprecation")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment