[Android] Remove references to FROYO

Geoffrey Métais git at videolan.org
Thu Aug 25 17:34:44 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 25 17:32:14 2016 +0200| [803ab392724d37ed374992239c5b094047c75092] | committer: Geoffrey Métais

Remove references to FROYO

> https://code.videolan.org/videolan/vlc-android/commit/803ab392724d37ed374992239c5b094047c75092
---

 .../src/org/videolan/libvlc/media/VideoView.java   |  1 -
 libvlc/src/org/videolan/libvlc/util/VLCUtil.java   |  7 +--
 .../src/org/videolan/vlc/PlaybackService.java      |  4 +-
 .../src/org/videolan/vlc/gui/MainActivity.java     |  2 -
 .../vlc/gui/video/VideoPlayerActivity.java         | 15 ++----
 .../src/org/videolan/vlc/util/VLCInstance.java     | 53 ----------------------
 6 files changed, 8 insertions(+), 74 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/media/VideoView.java b/libvlc/src/org/videolan/libvlc/media/VideoView.java
index 6a16bca..d3ba4b1 100644
--- a/libvlc/src/org/videolan/libvlc/media/VideoView.java
+++ b/libvlc/src/org/videolan/libvlc/media/VideoView.java
@@ -146,7 +146,6 @@ public class VideoView extends SurfaceView
     public void stopPlayback() {
     }
 
-    @TargetApi(Build.VERSION_CODES.FROYO)
     public void suspend() {
     }
 
diff --git a/libvlc/src/org/videolan/libvlc/util/VLCUtil.java b/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
index faf5650..3819a93 100644
--- a/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
+++ b/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
@@ -59,13 +59,10 @@ public class VLCUtil {
     }
 
     @SuppressWarnings("deprecation")
-    @TargetApi(Build.VERSION_CODES.FROYO)
     public static String[] getABIList() {
-        final boolean hasABI2 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;
-        final String[] abis = new String[hasABI2 ? 2 : 1];
+        final String[] abis = new String[2];
         abis[0] = android.os.Build.CPU_ABI;
-        if (hasABI2)
-            abis[1] = android.os.Build.CPU_ABI2;
+        abis[1] = android.os.Build.CPU_ABI2;
         return abis;
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 72de1be..77d22ef 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -325,7 +325,6 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
 
     private final OnAudioFocusChangeListener mAudioFocusListener = createOnAudioFocusChangeListener();
 
-    @TargetApi(Build.VERSION_CODES.FROYO)
     private OnAudioFocusChangeListener createOnAudioFocusChangeListener() {
         return new OnAudioFocusChangeListener() {
             private boolean mLossTransient = false;
@@ -377,7 +376,6 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
         };
     }
 
-    @TargetApi(Build.VERSION_CODES.FROYO)
     private void changeAudioFocus(boolean acquire) {
         final AudioManager am = (AudioManager)getSystemService(AUDIO_SERVICE);
         if (am == null)
@@ -394,7 +392,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
             }
         } else {
             if (mHasAudioFocus) {
-                final int result = am.abandonAudioFocus(mAudioFocusListener);
+                am.abandonAudioFocus(mAudioFocusListener);
                 am.setParameters("bgm_state=false");
                 mHasAudioFocus = false;
             }
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 245da93..a2cc75b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -92,7 +92,6 @@ import org.videolan.vlc.media.MediaDatabase;
 import org.videolan.vlc.media.MediaLibrary;
 import org.videolan.vlc.media.MediaUtils;
 import org.videolan.vlc.util.Permissions;
-import org.videolan.vlc.util.Util;
 import org.videolan.vlc.util.VLCInstance;
 import org.videolan.vlc.util.WeakHandler;
 
@@ -521,7 +520,6 @@ public class MainActivity extends AudioPlayerContainerActivity implements Filter
 
     /** Create menu from XML
      */
-    @TargetApi(Build.VERSION_CODES.FROYO)
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         mMenu = menu;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index eb4390a..11f24bc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -689,7 +689,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mHelper.onStop();
     }
 
-    @TargetApi(android.os.Build.VERSION_CODES.FROYO)
     private void restoreBrightness() {
         if (mRestoreAutoBrightness != -1f) {
             int brightness = (int) (mRestoreAutoBrightness*255f);
@@ -3072,15 +3071,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private int getScreenRotation(){
         WindowManager wm = (WindowManager) VLCApplication.getAppContext().getSystemService(Context.WINDOW_SERVICE);
         Display display = wm.getDefaultDisplay();
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO /* Android 2.2 has getRotation */) {
-            try {
-                Method m = display.getClass().getDeclaredMethod("getRotation");
-                return (Integer) m.invoke(display);
-            } catch (Exception e) {
-                return Surface.ROTATION_0;
-            }
-        } else {
-            return display.getOrientation();
+        try {
+            Method m = display.getClass().getDeclaredMethod("getRotation");
+            return (Integer) m.invoke(display);
+        } catch (Exception e) {
+            return Surface.ROTATION_0;
         }
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
index d2ee1aa..f978241 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
@@ -24,7 +24,6 @@ import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.AssetManager;
-import android.os.Build;
 import android.util.Log;
 
 import org.videolan.libvlc.LibVLC;
@@ -34,11 +33,6 @@ import org.videolan.vlc.VLCCrashHandler;
 import org.videolan.vlc.gui.CompatErrorActivity;
 import org.videolan.vlc.gui.NativeCrashActivity;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
 public class VLCInstance {
     public final static String TAG = "VLC/UiTools/VLCInstance";
 
@@ -54,49 +48,6 @@ public class VLCInstance {
         }
     };
 
-    public static void linkCompatLib(Context context) {
-        final File outDir = new File(context.getFilesDir(), "compat");
-        if (!outDir.exists())
-            outDir.mkdir();
-        final File outFile = new File(outDir, "libcompat.7.so");
-
-        /* The file may had been already copied from the asset, try to load it */
-        if (outFile.exists()) {
-            try {
-                System.load(outFile.getPath());
-                return;
-            } catch (UnsatisfiedLinkError ule) {
-                /* the file can be invalid, try to copy it again */
-            }
-        }
-
-        /* copy libcompat.7.so from assert to a data dir */
-        InputStream is = null;
-        FileOutputStream fos = null;
-        boolean success = false;
-        try {
-            is = VLCApplication.getAppResources().getAssets().open("libcompat.7.so");
-            fos = new FileOutputStream(outFile);
-            final byte[] buffer = new byte[16*1024];
-            int read;
-            while ((read = is.read(buffer)) != -1)
-                fos.write(buffer, 0, read);
-            success = true;
-        } catch (IOException e) {
-        } finally {
-            Util.close(is);
-            Util.close(fos);
-        }
-
-        /* load the lib coming from the asset */
-        if (success) {
-            try {
-                System.load(outFile.getPath());
-            } catch (UnsatisfiedLinkError ule) {
-            }
-        }
-    }
-
     /** A set of utility functions for the VLC application */
     public synchronized static LibVLC get() throws IllegalStateException {
         if (sLibVLC == null) {
@@ -107,10 +58,6 @@ public class VLCInstance {
                 Log.e(TAG, VLCUtil.getErrorMsg());
                 throw new IllegalStateException("LibVLC initialisation failed: " + VLCUtil.getErrorMsg());
             }
-            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.FROYO) {
-                Log.w(TAG, "linking with true compat lib...");
-                linkCompatLib(context);
-            }
 
             sLibVLC = new LibVLC(context, VLCOptions.getLibOptions());
             LibVLC.setOnNativeCrashListener(new LibVLC.OnNativeCrashListener() {



More information about the Android mailing list