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 emulator tests. */
31 public class OffhostUiccEmulatorTestActivity 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_emulator_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_emulator_tests));
43 
44             adapter.add(TestListItem.newTest(this, R.string.nfc_offhost_uicc_transaction_event1_emulator,
45                     UiccTransactionEvent1EmulatorActivity.class.getName(),
46                     new Intent(this, UiccTransactionEvent1EmulatorActivity.class), null));
47 
48             adapter.add(TestListItem.newTest(this, R.string.nfc_offhost_uicc_transaction_event2_emulator,
49                     UiccTransactionEvent2EmulatorActivity.class.getName(),
50                     new Intent(this, UiccTransactionEvent2EmulatorActivity.class), null));
51 
52             adapter.add(TestListItem.newTest(this, R.string.nfc_offhost_uicc_transaction_event3_emulator,
53                     UiccTransactionEvent3EmulatorActivity.class.getName(),
54                     new Intent(this, UiccTransactionEvent3EmulatorActivity.class), null));
55 
56         }
57 
58         setTestListAdapter(adapter);
59     }
60 }
61