1 package com.android.cts.verifier.nfc.hce;
2 
3 import android.content.ComponentName;
4 import android.content.Context;
5 import android.content.Intent;
6 import android.nfc.cardemulation.CardEmulation;
7 import android.os.Bundle;
8 
9 import com.android.cts.verifier.R;
10 import com.android.cts.verifier.nfc.NfcDialogs;
11 
12 import java.util.ArrayList;
13 
14 public class ConflictingNonPaymentPrefixEmulatorActivity extends BaseEmulatorActivity {
15     @Override
onCreate(Bundle savedInstanceState)16     protected void onCreate(Bundle savedInstanceState) {
17         super.onCreate(savedInstanceState);
18         setContentView(R.layout.pass_fail_text);
19         setPassFailButtonClickListeners();
20         getPassButton().setEnabled(false);
21         setupServices(this, PrefixTransportService1.COMPONENT, PrefixTransportService2.COMPONENT);
22     }
23 
24     @Override
onResume()25     protected void onResume() {
26         super.onResume();
27     }
28 
29     @Override
onServicesSetup(boolean result)30     void onServicesSetup(boolean result) {
31         // Do dynamic AID registration
32         ArrayList<String> service_aids = new ArrayList<String>();
33         service_aids.add(HceUtils.TRANSPORT_PREFIX_AID + "*");
34         mCardEmulation.registerAidsForService(PrefixTransportService1.COMPONENT, CardEmulation.CATEGORY_OTHER, service_aids);
35         mCardEmulation.registerAidsForService(PrefixTransportService2.COMPONENT, CardEmulation.CATEGORY_OTHER, service_aids);
36         NfcDialogs.createHceTapReaderDialog(this, getString(R.string.nfc_hce_other_conflicting_prefix_aids_help)).show();
37     }
38 
buildReaderIntent(Context context)39     public static Intent buildReaderIntent(Context context) {
40         Intent readerIntent = new Intent(context, SimpleReaderActivity.class);
41         readerIntent.putExtra(SimpleReaderActivity.EXTRA_APDUS, PrefixTransportService2.APDU_COMMAND_SEQUENCE);
42         readerIntent.putExtra(SimpleReaderActivity.EXTRA_RESPONSES, PrefixTransportService2.APDU_RESPOND_SEQUENCE);
43         readerIntent.putExtra(SimpleReaderActivity.EXTRA_LABEL,
44                 context.getString(R.string.nfc_hce_other_conflicting_prefix_aids_reader));
45         return readerIntent;
46     }
47 
48     @Override
onApduSequenceComplete(ComponentName component, long duration)49     void onApduSequenceComplete(ComponentName component, long duration) {
50         if (component.equals(PrefixTransportService2.COMPONENT)) {
51             getPassButton().setEnabled(true);
52         }
53     }
54 }