[Android] Add DeX mode detection
Geoffrey Métais
git at videolan.org
Wed Feb 21 11:27:35 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 21 10:28:59 2018 +0100| [6750db189c7249e017270804f775a242c7e42203] | committer: Geoffrey Métais
Add DeX mode detection
> https://code.videolan.org/videolan/vlc-android/commit/6750db189c7249e017270804f775a242c7e42203
---
vlc-android/src/org/videolan/vlc/util/AndroidDevices.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index f696fa846..4f4d65580 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -24,6 +24,7 @@ import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
+import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION_CODES;
@@ -228,6 +229,18 @@ public class AndroidDevices {
return false;
}
+ public static boolean isDex(Context ctx) {
+ if (!AndroidUtil.isNougatOrLater) return false;
+ try {
+ final Configuration config = ctx.getResources().getConfiguration();
+ final Class configClass = config.getClass();
+ return configClass.getField("SEM_DESKTOP_MODE_ENABLED").getInt(configClass)
+ == configClass.getField("semDesktopModeEnabled").getInt(config);
+ } catch(Exception ignored) {
+ return false;
+ }
+ }
+
public static class MediaFolders {
public final static File EXTERNAL_PUBLIC_MOVIES_DIRECTORY_FILE = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
public final static File EXTERNAL_PUBLIC_MUSIC_DIRECTORY_FILE = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
More information about the Android
mailing list