ACardEmulator: Added F-Droid build flavor with FOSS only

- avoid precompiled JARs for JCardSim
- use gradle's shadow plugin to relocate JCardSim's use of Bouncycastle
- removes JCardSim's Hello world applet
- use vJCRE to avoid importing Oracle's api_classic.jar

(We may use vJCRE as full replacement for JCardSim in the future, but
JCardSim is currently the choice with more features and support)
This commit is contained in:
Frank Morgner
2019-09-27 15:29:57 +02:00
parent e6a42efb6b
commit 1caff4f497
15 changed files with 160 additions and 77 deletions

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2019 Frank Morgner
*
* This file is part of RemoteSmartCardReader.
*
* RemoteSmartCardReader is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* RemoteSmartCardReader is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* RemoteSmartCardReader. If not, see <http://www.gnu.org/licenses/>.
*/
package com.vsmartcard.acardemulator;
import android.app.IntentService;
import android.content.Intent;
import android.support.annotation.Nullable;
public class SmartcardProviderService extends IntentService {
public SmartcardProviderService () {
super("SmartcardProviderService");
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
}
}

View File

@@ -175,4 +175,4 @@ public class MainActivity extends AppCompatActivity {
dialog.dismiss();
super.onPause();
}
}
}

View File

@@ -214,18 +214,22 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
});
Preference gear_nfc = findPreference("gear_nfc");
gear_nfc.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
String gearPackage = "com.samsung.android.gearoplugin";
try {
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("market://details?id="+gearPackage)));
} catch (android.content.ActivityNotFoundException e) {
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id="+gearPackage)));
final Preference gear_nfc = findPreference("gear_nfc");
if (BuildConfig.FLAVOR.equals("fdroid")) {
gear_nfc.setSummary("Samsung Gear integration is disabled in F-Droid");
} else {
gear_nfc.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
String gearPackage = "com.samsung.android.gearoplugin";
try {
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("market://details?id="+gearPackage)));
} catch (android.content.ActivityNotFoundException e) {
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id="+gearPackage)));
}
return true;
}
return true;
}
});
});
}
}
@Override
@@ -288,4 +292,4 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
// onResume gets called after this to handle the intent
setIntent(intent);
}
}
}

View File

@@ -6,7 +6,6 @@ import android.support.v4.content.LocalBroadcastManager;
import com.licel.jcardsim.base.Simulator;
import com.licel.jcardsim.base.SimulatorRuntime;
import com.licel.jcardsim.samples.HelloWorldApplet;
import com.licel.jcardsim.utils.AIDUtil;
import com.mysmartlogon.gidsApplet.GidsApplet;
import com.vsmartcard.acardemulator.R;
@@ -33,18 +32,6 @@ public class JCEmulator implements Emulator {
String aid, name, extra_install = "", extra_error = "";
simulator = new Simulator(new SimulatorRuntime());
if (activate_helloworld) {
name = context.getResources().getString(R.string.applet_helloworld);
aid = context.getResources().getString(R.string.aid_helloworld);
try {
simulator.installApplet(AIDUtil.create(aid), HelloWorldApplet.class);
extra_install += "\n" + name + " (AID: " + aid + ")";
} catch (Exception e) {
e.printStackTrace();
extra_error += "\n" + "Could not install " + name + " (AID: " + aid + ")";
}
}
if (activate_openpgp) {
name = context.getResources().getString(R.string.applet_openpgp);
aid = context.getResources().getString(R.string.aid_openpgp);

View File

@@ -26,8 +26,6 @@
<string name="aid_pivapplet_truncated3">A00000030800</string>
<string name="aid_pivapplet_truncated4">A000000308</string>
<string name="applet_pivapplet">Alex Wilson\'s PIV Applet</string>
<string name="aid_helloworld">F000000001</string>
<string name="applet_helloworld">jCardSim Team\'s Hello World Applet</string>
<string name="aid_partial_openpgp">D27600012401</string>
<string name="aid_openpgp">D2760001240102000000000000010000</string>
<string name="applet_openpgp">Yubico\'s OpenPGP Applet</string>
@@ -36,7 +34,6 @@
<string name="startup_title">Tap To Emulate!</string>
<string name="startup_message">The following smart card applets are supported:\n
\n
<b>Hello World Applet</b> <small>(AID F000000001)</small>\n
<b>OpenPGP Applet</b> <small>(AID D2760001240102000000000000010000)</small>\n
<b>OATH Applet</b> <small>(AID A000000527210101)</small>\n
<b>PIV Applet</b> <small>(AID A00000030800001000)</small>\n

View File

@@ -4,10 +4,6 @@
android:description="@string/app_name"
android:requireDeviceUnlock="false">
<aid-group android:description="@string/applet_helloworld" android:category="other">
<aid-filter android:name="@string/aid_helloworld"/>
</aid-group>
<aid-group android:description="@string/applet_openpgp" android:category="other">
<aid-filter android:name="@string/aid_openpgp"/>
<aid-filter android:name="@string/aid_partial_openpgp"/>

View File

@@ -13,12 +13,6 @@
android:key="jc_settings"
>
<SwitchPreference
android:title="@string/applet_helloworld"
android:switchTextOn="@string/aid_helloworld"
android:key="activate_helloworld"
android:defaultValue="false"
/>
<SwitchPreference
android:title="@string/applet_openpgp"
android:switchTextOn="@string/aid_openpgp"
@@ -100,7 +94,7 @@
<Preference
android:title="Emulation with Gear's NFC"
android:summary="Samsung Gear needs to be installed for using the Gear's NFC emulation capabilities."
android:summary="Samsung Gear needs to be installed for using the Gear's NFC emulation capabilities. (Disabled on F-Droid)"
android:key="gear_nfc">
</Preference>