[Android] Declare manufacturers blacklist for styled notifs

Geoffrey Métais git at videolan.org
Tue Jun 28 16:00:43 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 28 15:59:21 2016 +0200| [bdac7bc04b12f764fa2c507f9f9aeeea2f59b7f9] | committer: Geoffrey Métais

Declare manufacturers blacklist for styled notifs

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

 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 f1f8c0a..47b8877 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -51,6 +51,7 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 public class AndroidDevices {
@@ -59,6 +60,9 @@ public class AndroidDevices {
 
     final static boolean hasNavBar;
     final static boolean hasTsp, isTv, showInternalStorage;
+    public final static boolean showMediaStyle;
+
+    final static String[] noMediaStyleManufacturers = {"huawei", "symphony teleca"};
 
     static {
         HashSet<String> devicesWithoutNavBar = new HashSet<String>();
@@ -71,6 +75,8 @@ public class AndroidDevices {
         hasTsp = VLCApplication.getAppContext().getPackageManager().hasSystemFeature("android.hardware.touchscreen");
         isTv = VLCApplication.getAppContext().getPackageManager().hasSystemFeature("android.software.leanback");
         showInternalStorage = !TextUtils.equals(Build.BRAND, "Swisscom") && !TextUtils.equals(Build.BOARD, "sprint");
+
+        showMediaStyle = !isManufacturerBannedForMediastyleNotifications();
     }
 
     public static boolean hasExternalStorage() {
@@ -256,4 +262,11 @@ public class AndroidDevices {
                         PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                 PackageManager.DONT_KILL_APP);
     }
+
+    private static boolean isManufacturerBannedForMediastyleNotifications() {
+        for (String manufacturer : noMediaStyleManufacturers)
+            if (Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains(manufacturer))
+                return true;
+        return false;
+    }
 }



More information about the Android mailing list