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.os.Bundle; 7 8 import com.android.cts.verifier.R; 9 import com.android.cts.verifier.nfc.NfcDialogs; 10 11 public class DualNonPaymentEmulatorActivity extends BaseEmulatorActivity { 12 @Override onCreate(Bundle savedInstanceState)13 protected void onCreate(Bundle savedInstanceState) { 14 super.onCreate(savedInstanceState); 15 setContentView(R.layout.pass_fail_text); 16 setPassFailButtonClickListeners(); 17 getPassButton().setEnabled(false); 18 setupServices(this, TransportService2.COMPONENT, AccessService.COMPONENT); 19 } 20 21 @Override onResume()22 protected void onResume() { 23 super.onResume(); 24 } 25 26 @Override onServicesSetup(boolean result)27 void onServicesSetup(boolean result) { 28 NfcDialogs.createHceTapReaderDialog(this, null).show(); 29 } 30 buildReaderIntent(Context context)31 public static Intent buildReaderIntent(Context context) { 32 Intent readerIntent = new Intent(context, SimpleReaderActivity.class); 33 // Combine command/response APDU arrays 34 CommandApdu[] commandSequences = new CommandApdu[TransportService2.APDU_COMMAND_SEQUENCE.length + 35 AccessService.APDU_COMMAND_SEQUENCE.length]; 36 System.arraycopy(TransportService2.APDU_COMMAND_SEQUENCE, 0, commandSequences, 0, 37 TransportService2.APDU_COMMAND_SEQUENCE.length); 38 System.arraycopy(AccessService.APDU_COMMAND_SEQUENCE, 0, commandSequences, 39 TransportService2.APDU_COMMAND_SEQUENCE.length, 40 AccessService.APDU_COMMAND_SEQUENCE.length); 41 42 String[] responseSequences = new String[TransportService2.APDU_RESPOND_SEQUENCE.length + 43 AccessService.APDU_RESPOND_SEQUENCE.length]; 44 System.arraycopy(TransportService2.APDU_RESPOND_SEQUENCE, 0, responseSequences, 0, 45 TransportService2.APDU_RESPOND_SEQUENCE.length); 46 System.arraycopy(AccessService.APDU_RESPOND_SEQUENCE, 0, responseSequences, 47 TransportService2.APDU_RESPOND_SEQUENCE.length, 48 AccessService.APDU_RESPOND_SEQUENCE.length); 49 50 readerIntent.putExtra(SimpleReaderActivity.EXTRA_APDUS, commandSequences); 51 readerIntent.putExtra(SimpleReaderActivity.EXTRA_RESPONSES, responseSequences); 52 readerIntent.putExtra(SimpleReaderActivity.EXTRA_LABEL, 53 context.getString(R.string.nfc_hce_dual_non_payment_reader)); 54 return readerIntent; 55 } 56 57 @Override onApduSequenceComplete(ComponentName component, long duration)58 void onApduSequenceComplete(ComponentName component, long duration) { 59 if (component.equals(TransportService2.COMPONENT)) { 60 getPassButton().setEnabled(true); 61 } 62 } 63 }