[Android] Remove code for Android 2 & 3
Geoffrey Métais
git at videolan.org
Wed Apr 4 18:34:36 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 20 17:51:38 2018 +0100| [4d9d3eee1e6e4b7ac3d135fab51bc4b428ed1011] | committer: Geoffrey Métais
Remove code for Android 2 & 3
> https://code.videolan.org/videolan/vlc-android/commit/4d9d3eee1e6e4b7ac3d135fab51bc4b428ed1011
---
libvlc/src/org/videolan/libvlc/AWindow.java | 60 ++--------------------
libvlc/src/org/videolan/libvlc/LibVLC.java | 15 ------
.../src/org/videolan/libvlc/util/AndroidUtil.java | 4 --
.../org/videolan/libvlc/util/HWDecoderUtil.java | 2 +-
4 files changed, 4 insertions(+), 77 deletions(-)
diff --git a/libvlc/src/org/videolan/libvlc/AWindow.java b/libvlc/src/org/videolan/libvlc/AWindow.java
index 396c5c10e..90e60a445 100644
--- a/libvlc/src/org/videolan/libvlc/AWindow.java
+++ b/libvlc/src/org/videolan/libvlc/AWindow.java
@@ -26,7 +26,6 @@ import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.MainThread;
-import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@@ -186,8 +185,7 @@ public class AWindow implements IVLCVout {
};
}
- private final TextureView.SurfaceTextureListener mSurfaceTextureListener =
- AndroidUtil.isICSOrLater ? createSurfaceTextureListener() : null;
+ private final TextureView.SurfaceTextureListener mSurfaceTextureListener = createSurfaceTextureListener();
}
private final static int SURFACE_STATE_INIT = 0;
@@ -246,8 +244,6 @@ public class AWindow implements IVLCVout {
}
private void setView(int id, TextureView view) {
- if (!AndroidUtil.isICSOrLater)
- throw new IllegalArgumentException("TextureView not implemented in this android version");
ensureInitState();
if (view == null)
throw new NullPointerException("view is null");
@@ -535,7 +531,7 @@ public class AWindow implements IVLCVout {
}
/**
- * This method is only used for ICS and before since ANativeWindow_setBuffersGeometry doesn't work before.
+ * This method is only used for HoneyComb and before since ANativeWindow_setBuffersGeometry doesn't work before.
* It is synchronous.
*
* @param surface surface returned by getVideoSurface or getSubtitlesSurface
@@ -546,57 +542,7 @@ public class AWindow implements IVLCVout {
*/
@SuppressWarnings("unused") /* used by JNI */
private boolean setBuffersGeometry(final Surface surface, final int width, final int height, final int format) {
- if (AndroidUtil.isICSOrLater)
- return false;
- if (width * height == 0)
- return false;
- Log.d(TAG, "configureSurface: " + width + "x" + height);
-
- synchronized (mNativeLock) {
- if (mNativeLock.buffersGeometryConfigured || mNativeLock.buffersGeometryAbort)
- return false;
- }
-
- mHandler.post(new Runnable() {
- private AWindow.SurfaceHelper getSurfaceHelper(Surface surface) {
- for (int id = 0; id < ID_MAX; ++id) {
- final AWindow.SurfaceHelper surfaceHelper = mSurfaceHelpers[id];
- if (surfaceHelper != null && surfaceHelper.getSurface() == surface)
- return surfaceHelper;
- }
- return null;
- }
-
- @Override
- public void run() {
- final AWindow.SurfaceHelper surfaceHelper = getSurfaceHelper(surface);
- final SurfaceHolder surfaceHolder = surfaceHelper != null ? surfaceHelper.getSurfaceHolder() : null;
-
- if (surfaceHolder != null) {
- if (surfaceHolder.getSurface().isValid()) {
- if (format != 0)
- surfaceHolder.setFormat(format);
- surfaceHolder.setFixedSize(width, height);
- }
- }
-
- synchronized (mNativeLock) {
- mNativeLock.buffersGeometryConfigured = true;
- mNativeLock.notifyAll();
- }
- }
- });
-
- try {
- synchronized (mNativeLock) {
- while (!mNativeLock.buffersGeometryConfigured && !mNativeLock.buffersGeometryAbort)
- mNativeLock.wait();
- mNativeLock.buffersGeometryConfigured = false;
- }
- } catch (InterruptedException e) {
- return false;
- }
- return true;
+ return false;
}
/**
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index d0f7f2db2..f039cae00 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -24,7 +24,6 @@ import android.content.Context;
import android.os.Build;
import android.util.Log;
-import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.libvlc.util.HWDecoderUtil;
import java.util.ArrayList;
@@ -76,20 +75,6 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
options.add("RV16");
}
}
-
- /* XXX: HACK to remove when we drop 2.3 support: force android_display vout */
- if (!AndroidUtil.isHoneycombOrLater) {
- boolean setVout = true;
- for (String option : options) {
- if (option.startsWith("--vout")) {
- setVout = false;
- break;
- }
- }
- if (setVout)
- options.add("--vout=android_display,none");
- }
-
nativeNew(options.toArray(new String[options.size()]), context.getDir("vlc", Context.MODE_PRIVATE).getAbsolutePath());
}
diff --git a/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java b/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
index 512b41422..399be819c 100644
--- a/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
+++ b/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
@@ -35,10 +35,6 @@ public class AndroidUtil {
public static final boolean isJellyBeanMR2OrLater = isKitKatOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
public static final boolean isJellyBeanMR1OrLater = isJellyBeanMR2OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
public static final boolean isJellyBeanOrLater = isJellyBeanMR1OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
- public static final boolean isICSOrLater = isJellyBeanOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
- public static final boolean isHoneycombMr2OrLater = isICSOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2;
- public static final boolean isHoneycombMr1OrLater = isHoneycombMr2OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
- public static final boolean isHoneycombOrLater = isHoneycombMr1OrLater || android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
public static File UriToFile(Uri uri) {
return new File(uri.getPath().replaceFirst("file://", ""));
diff --git a/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java b/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java
index 44c6bbc8b..120b10069 100644
--- a/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java
+++ b/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java
@@ -143,7 +143,7 @@ public class HWDecoderUtil {
*/
if (AndroidUtil.isJellyBeanMR2OrLater)
return Decoder.ALL;
- else if (AndroidUtil.isHoneycombOrLater) {
+ else {
for (DecoderBySOC decBySOC : sDecoderBySOCList) {
final String prop = getSystemPropertyCached(decBySOC.key);
if (prop != null) {
More information about the Android
mailing list