1 /*
2  * Copyright (C) 2024 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 package com.android.nfc.emulator;
17 
18 import android.content.ComponentName;
19 import android.nfc.cardemulation.CardEmulation;
20 import android.os.Bundle;
21 
22 import com.android.nfc.utils.HceUtils;
23 import com.android.nfc.service.PrefixTransportService1;
24 import com.android.nfc.service.PrefixTransportService2;
25 
26 import java.util.ArrayList;
27 
28 public class ConflictingNonPaymentPrefixEmulatorActivity extends BaseEmulatorActivity {
29     @Override
onCreate(Bundle savedInstanceState)30     public void onCreate(Bundle savedInstanceState) {
31         super.onCreate(savedInstanceState);
32         setupServices(
33                 PrefixTransportService1.COMPONENT, PrefixTransportService2.COMPONENT);
34     }
35 
36     @Override
onServicesSetup()37     protected void onServicesSetup() {
38         // Do dynamic AID registration
39         ArrayList<String> service_aids = new ArrayList<>();
40         service_aids.add(HceUtils.TRANSPORT_PREFIX_AID + "*");
41         mCardEmulation.registerAidsForService(
42                 PrefixTransportService1.COMPONENT,
43                 CardEmulation.CATEGORY_OTHER,
44                 service_aids);
45         mCardEmulation.registerAidsForService(
46                 PrefixTransportService2.COMPONENT,
47                 CardEmulation.CATEGORY_OTHER,
48                 service_aids);
49     }
50 
51     @Override
onApduSequenceComplete(ComponentName component, long duration)52     public void onApduSequenceComplete(ComponentName component, long duration) {
53         if (component.equals(PrefixTransportService2.COMPONENT)) {
54             setTestPassed();
55         }
56     }
57 
58     @Override
getPreferredServiceComponent()59     public ComponentName getPreferredServiceComponent(){
60         return PrefixTransportService2.COMPONENT;
61     }
62 }
63