Skip MIFARE Ultralight test for an unsupported device
If a device doesn't have the feature "com.nxp.mifare",
MIFARE Ultralight is not supported on such device.
Change-Id: I1fb9bcdd2c0759ccf8598c78244a0e72e397c035
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java
old mode 100644
new mode 100755
index 3a85860..b158ad3
--- a/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java
@@ -22,6 +22,7 @@
import com.android.cts.verifier.TestListAdapter.TestListItem;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.nfc.tech.MifareUltralight;
import android.nfc.tech.Ndef;
import android.nfc.tech.TagTechnology;
@@ -36,6 +37,8 @@
private static final String MIFARE_ULTRALIGHT_ID =
TagVerifierActivity.getTagTestId(MifareUltralight.class);
+ private static final String FEATURE_NFC_MIFARE = "com.nxp.mifare";
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -56,8 +59,10 @@
adapter.add(TestListItem.newCategory(this, R.string.nfc_tag_verification));
adapter.add(TestListItem.newTest(this, R.string.nfc_ndef,
NDEF_ID, getTagIntent(Ndef.class), null));
- adapter.add(TestListItem.newTest(this, R.string.nfc_mifare_ultralight,
- MIFARE_ULTRALIGHT_ID, getTagIntent(MifareUltralight.class), null));
+ if (getPackageManager().hasSystemFeature(FEATURE_NFC_MIFARE)) {
+ adapter.add(TestListItem.newTest(this, R.string.nfc_mifare_ultralight,
+ MIFARE_ULTRALIGHT_ID, getTagIntent(MifareUltralight.class), null));
+ }
setTestListAdapter(adapter);
}