Home | History | Annotate | Download | only in hce
      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 LargeNumAidsEmulatorActivity extends BaseEmulatorActivity {
     15 
     16     @Override
     17     protected void onCreate(Bundle savedInstanceState) {
     18        super.onCreate(savedInstanceState);
     19        setContentView(R.layout.pass_fail_text);
     20        setPassFailButtonClickListeners();
     21        getPassButton().setEnabled(false);
     22        setupServices(this, LargeNumAidsService.COMPONENT);
     23     }
     24 
     25 
     26     @Override
     27     protected void onResume() {
     28         super.onResume();
     29     }
     30 
     31 
     32     @Override
     33     void onServicesSetup(boolean result) {
     34         ArrayList<String> aids = new ArrayList<String>();
     35         for (int i = 0; i < 256; i++) {
     36             aids.add(HceUtils.LARGE_NUM_AIDS_PREFIX + String.format("%02X", i) + HceUtils.LARGE_NUM_AIDS_POSTFIX);
     37         }
     38         mCardEmulation.registerAidsForService(LargeNumAidsService.COMPONENT,
     39                 CardEmulation.CATEGORY_OTHER, aids);
     40     }
     41 
     42     @Override
     43     void onApduSequenceComplete(ComponentName component, long duration) {
     44         if (component.equals(LargeNumAidsService.COMPONENT)) {
     45             getPassButton().setEnabled(true);
     46         }
     47     }
     48 
     49     public static Intent buildReaderIntent(Context context) {
     50         Intent readerIntent = new Intent(context, SimpleReaderActivity.class);
     51         readerIntent.putExtra(SimpleReaderActivity.EXTRA_APDUS,
     52                 LargeNumAidsService.getCommandSequence());
     53         readerIntent.putExtra(SimpleReaderActivity.EXTRA_RESPONSES,
     54                 LargeNumAidsService.getResponseSequence());
     55         readerIntent.putExtra(SimpleReaderActivity.EXTRA_LABEL,
     56                 context.getString(R.string.nfc_hce_large_num_aids_reader));
     57         return readerIntent;
     58     }
     59 }
     60