[Android] Clean device detection
Geoffrey Métais
git at videolan.org
Tue Feb 12 15:15:15 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 12 14:15:47 2019 +0100| [9c1258f2f64c433b8b4a569b7d97a8e7f32fd345] | committer: Geoffrey Métais
Clean device detection
> https://code.videolan.org/videolan/vlc-android/commit/9c1258f2f64c433b8b4a569b7d97a8e7f32fd345
---
vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt | 3 ++-
vlc-android/src/org/videolan/vlc/util/AndroidDevices.java | 13 ++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
index 733f1a30e..84606f33b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
@@ -218,10 +218,11 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt
return true
}
+ private val showInternalStorage = AndroidDevices.showInternalStorage()
suspend fun updateBrowsers() {
val list = mutableListOf<MediaLibraryItem>()
val directories = DirectoryRepository.getInstance(requireContext()).getMediaDirectoriesList(requireContext().applicationContext).toMutableList()
- if (!AndroidDevices.showInternalStorage && !directories.isEmpty()) directories.removeAt(0)
+ if (!showInternalStorage && !directories.isEmpty()) directories.removeAt(0)
for (directory in directories) {
if (directory.location.scanAllowed()) list.add(directory)
}
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index ee307ea5d..80276dccd 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -62,7 +62,6 @@ public class AndroidDevices {
public final static boolean isChromeBook;
public static final boolean hasPiP;
public static final boolean pipAllowed;
- public final static boolean showInternalStorage = !TextUtils.equals(Build.BRAND, "Swisscom") && !TextUtils.equals(Build.BOARD, "sprint");
private final static String[] noMediaStyleManufacturers = {"huawei", "symphony teleca"};
public final static boolean showMediaStyle = !isManufacturerBannedForMediastyleNotifications();
public static final boolean hasPlayServices;
@@ -102,7 +101,7 @@ public class AndroidDevices {
final PackageManager pm = ctx != null ? ctx.getPackageManager() : null;
hasTsp = pm == null || pm.hasSystemFeature("android.hardware.touchscreen");
isAndroidTv = pm != null && pm.hasSystemFeature("android.software.leanback");
- watchDevices = isAndroidTv && isBbox();
+ watchDevices = isAndroidTv && Build.MODEL.startsWith("Bouygtel");
isChromeBook = pm != null && pm.hasSystemFeature("org.chromium.arc.device_management");
isTv = isAndroidTv || (!isChromeBook && !hasTsp);
hasPlayServices = pm == null || hasPlayServices(pm);
@@ -111,17 +110,17 @@ public class AndroidDevices {
pipAllowed = hasPiP || (hasTsp && !AndroidUtil.isOOrLater);
final TelephonyManager tm = ctx != null ? ((TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE)) : null;
isPhone = tm == null || tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
- // hasCombBar test if device has Combined Bar : only for tablet with Honeycomb or ICS
- }
-
- private static boolean isBbox() {
- return Build.MODEL.startsWith("Bouygtel");
}
public static boolean hasExternalStorage() {
return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
}
+ public static boolean showInternalStorage() {
+ return !TextUtils.equals(Build.BRAND, "Swisscom") && !TextUtils.equals(Build.BOARD, "sprint")
+ && !TextUtils.equals(Build.BRAND, "BouyguesTelecom");
+ }
+
/**
* hasCombBar test if device has Combined Bar : only for tablet with Honeycomb or ICS
*/
More information about the Android
mailing list