exclude all realme devices up to Android 11

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/services/CallIntegration.java | 25 
1 file changed, 15 insertions(+), 10 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/services/CallIntegration.java 🔗

@@ -38,15 +38,8 @@ public class CallIntegration extends Connection {
 
     private static final List<String> BROKEN_DEVICE_MODELS =
             Arrays.asList(
-                    "OnePlus6", // OnePlus 6 (Android 8.1-11) Device is buggy and always starts the
-                                // operating system call screen even though we want to be self
-                                // managed
-                    "RMX1921", // Realme XT (Android 9-10) shows "Call not sent" dialog
-                    "RMX1971", // Realme 5 Pro (Android 9-11), show "Call not sent" dialog
-                    "RMX1973", // Realme 5 Pro (see above),
-                    "RMX2071", // Realme X50 Pro 5G (Call not sent)
-                    "RMX2075L1", // Realme X50 Pro 5G
-                    "RMX2076" // Realme X50 Pro 5G
+                    "OnePlus6" // OnePlus 6 (Android 8.1-11) Device is buggy and always starts the
+                               // OS call screen even though we want to be self managed
                     );
 
     public static final int DEFAULT_TONE_VOLUME = 60;
@@ -491,7 +484,7 @@ public class CallIntegration extends Connection {
     public static boolean selfManaged(final Context context) {
         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
                 && hasSystemFeature(context)
-                && !BROKEN_DEVICE_MODELS.contains(Build.DEVICE);
+                && isDeviceModelSupported();
     }
 
     public static boolean hasSystemFeature(final Context context) {
@@ -504,6 +497,18 @@ public class CallIntegration extends Connection {
         }
     }
 
+    private static boolean isDeviceModelSupported() {
+        if (BROKEN_DEVICE_MODELS.contains(Build.DEVICE)) {
+            return false;
+        }
+        // all Realme devices at least up to and including Android 11 are broken
+        if ("realme".equalsIgnoreCase(Build.MANUFACTURER)
+                && Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
+            return false;
+        }
+        return true;
+    }
+
     public static boolean notSelfManaged(final Context context) {
         return !selfManaged(context);
     }