[Android] Declare manufacturers blacklist for styled notifs

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


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

Declare manufacturers blacklist for styled notifs

(cherry picked from commit bdac7bc04b12f764fa2c507f9f9aeeea2f59b7f9)

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

 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