Skip to content

Commit

Permalink
ACardEmulator: fixed full build
Browse files Browse the repository at this point in the history
regression from 3c2e54b
  • Loading branch information
frankmorgner committed Nov 29, 2024
1 parent 75df60a commit 0c31731
Showing 1 changed file with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.XmlResourceParser;
import android.preference.PreferenceManager;
import android.util.Log;

import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.util.Log;

import ACardEmulator.R;
import com.vsmartcard.acardemulator.Util;

import ACardEmulator.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class EmulatorSingleton {
public static final String TAG = "com.vsmartcard.acardemulator.EmulatorService";
Expand Down Expand Up @@ -92,6 +98,32 @@ public static byte[] process(Context context, byte[] capdu) {
return rapdu;
}

public static String[] getRegisteredAids(Context context) {
List<String> aidList = new ArrayList<>();
XmlResourceParser aidXmlParser = context.getResources().getXml(R.xml.aid_list);

try {
while (aidXmlParser.getEventType() != XmlPullParser.END_DOCUMENT) {
if (aidXmlParser.getEventType() == XmlPullParser.START_TAG) {
if (aidXmlParser.getName().equals("aid-filter")) {
int aid = aidXmlParser.getAttributeResourceValue(0, -1);
if (aid != -1) {
aidList.add(context.getResources().getString(aid));
}
}
}

aidXmlParser.next();
}

aidXmlParser.close();
} catch (XmlPullParserException | IOException e) {
Log.e(TAG.substring(0, 23), "Couldn't parse aid xml list.");
}

return aidList.toArray(new String[0]);
}

public static void deactivate() {
emulator.deactivate();
}
Expand Down

0 comments on commit 0c31731

Please sign in to comment.