diff --git a/src/main/java/au/id/micolous/metrodroid/MetrodroidApplication.java b/src/main/java/au/id/micolous/metrodroid/MetrodroidApplication.java index 1db96d3f0..528eed1f2 100644 --- a/src/main/java/au/id/micolous/metrodroid/MetrodroidApplication.java +++ b/src/main/java/au/id/micolous/metrodroid/MetrodroidApplication.java @@ -42,6 +42,8 @@ import java.util.Calendar; import java.util.GregorianCalendar; +import java.util.HashSet; +import java.util.Set; import au.id.micolous.farebot.R; import au.id.micolous.metrodroid.card.Card; @@ -85,6 +87,12 @@ public class MetrodroidApplication extends Application { public static final String PREF_LOCALISE_PLACES = "pref_localise_places"; public static final String PREF_LOCALISE_PLACES_HELP = "pref_localise_places_help"; public static final String PREF_CONVERT_TIMEZONES = "pref_convert_timezones"; + private static final Set devicesMifareWorks = new HashSet<>(); + private static final Set devicesMifareNotWorks = new HashSet<>(); + + static { + devicesMifareWorks.add("Pixel 2"); + } private static MetrodroidApplication sInstance; @@ -279,6 +287,16 @@ private void detectNfcSupport() { return; } + if (devicesMifareNotWorks.contains(android.os.Build.MODEL)) { + mMifareClassicSupport = false; + return; + } + + if (devicesMifareWorks.contains(android.os.Build.MODEL)) { + mMifareClassicSupport = true; + return; + } + // TODO: Some devices report MIFARE Classic support, when they actually don't have it. // // Detecting based on libraries and device nodes doesn't work great either. There's edge