1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.cts.verifier.nfc.offhost;
18 
19 import com.android.cts.verifier.ArrayTestListAdapter;
20 import com.android.cts.verifier.PassFailButtons;
21 import com.android.cts.verifier.R;
22 import com.android.cts.verifier.TestListAdapter.TestListItem;
23 
24 import android.content.Intent;
25 import android.content.pm.PackageManager;
26 import android.nfc.NfcAdapter;
27 import android.nfc.cardemulation.CardEmulation;
28 import android.os.Bundle;
29 
30 /** Activity that lists all the NFC Offhost-UICC reader tests. */
31 public class OffhostUiccReaderTestActivity extends PassFailButtons.TestListActivity {
32     @Override
onCreate(Bundle savedInstanceState)33     protected void onCreate(Bundle savedInstanceState) {
34         super.onCreate(savedInstanceState);
35         setContentView(R.layout.pass_fail_list);
36         setInfoResources(R.string.nfc_test, R.string.nfc_offhost_uicc_reader_test_info, 0);
37         setPassFailButtonClickListeners();
38 
39         ArrayTestListAdapter adapter = new ArrayTestListAdapter(this);
40 
41         if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC)) {
42             adapter.add(TestListItem.newCategory(this, R.string.nfc_offhost_uicc_reader_tests));
43 
44             adapter.add(TestListItem.newTest(this, R.string.nfc_offhost_uicc_transaction_event1_reader,
45                     getString(R.string.nfc_offhost_uicc_transaction_event1_reader),
46                     UiccTransactionEvent1EmulatorActivity.buildReaderIntent(this), null));
47 
48             adapter.add(TestListItem.newTest(this, R.string.nfc_offhost_uicc_transaction_event2_reader,
49                     getString(R.string.nfc_offhost_uicc_transaction_event2_reader),
50                     UiccTransactionEvent2EmulatorActivity.buildReaderIntent(this), null));
51 
52             adapter.add(TestListItem.newTest(this, R.string.nfc_offhost_uicc_transaction_event3_reader,
53                     getString(R.string.nfc_offhost_uicc_transaction_event3_reader),
54                     UiccTransactionEvent3EmulatorActivity.buildReaderIntent(this), null));
55 
56         }
57 
58         setTestListAdapter(adapter);
59     }
60 }
61