diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e6a808a..ccfd5655 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,9 +93,9 @@ jobs: remote-reader/app/build/outputs/apk ACardEmulator-ubuntu: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: .github/build-ACardEmulator.sh - uses: actions/upload-artifact@v4 with: diff --git a/ACardEmulator/app/build.gradle b/ACardEmulator/app/build.gradle index 3e379fac..fb5e1404 100644 --- a/ACardEmulator/app/build.gradle +++ b/ACardEmulator/app/build.gradle @@ -1,20 +1,12 @@ apply plugin: 'com.android.application' -apply plugin: 'com.github.johnrengelman.shadow' - -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -task shadowJar(type: ShadowJar) { - configurations = [project.configurations.shadow] -} -tasks.withType(JavaCompile) { - compileTask -> compileTask.dependsOn shadowJar -} android { - compileSdkVersion 23 + compileSdkVersion 34 defaultConfig { applicationId "com.vsmartcard.acardemulator" - minSdkVersion 19 - targetSdkVersion 29 + minSdkVersion 21 + //noinspection ExpiredTargetSdkVersion + targetSdkVersion 30 versionCode 8 versionName "3.5" } @@ -24,6 +16,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + buildFeatures { + buildConfig true + } flavorDimensions "distribution" productFlavors { full { @@ -51,9 +46,6 @@ android { main.java.srcDirs += 'src/main/external/ykneo-openpgp/applet/src' main.java.srcDirs += 'src/main/external/ykneo-oath/applet/src' } - shadowJar { - relocate 'org.bouncycastle', 'com.vsmartcard.acardemulator.org.bouncycastle' - } } android.applicationVariants.all { variant -> @@ -77,16 +69,17 @@ android.applicationVariants.all { variant -> } } -dependencies { - shadow localGroovy() - shadow gradleApi() +repositories { + mavenCentral() +} +dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:23.0.1' - implementation 'com.android.support:support-v4:23.0.1' - implementation 'com.android.support:design:23.2.1' - implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar' - implementation 'com.google.zxing:core:3.2.1' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'com.google.android.material:material:1.12.0' + implementation 'com.journeyapps:zxing-android-embedded:4.3.0@aar' + implementation 'com.google.zxing:core:3.4.1' implementation 'org.bouncycastle:bcprov-jdk14:1.46' fullImplementation files('libs/sdk-v1.0.0.jar') } diff --git a/ACardEmulator/app/src/fdroid/java/com/vsmartcard/acardemulator/SmartcardProviderService.java b/ACardEmulator/app/src/fdroid/java/com/vsmartcard/acardemulator/SmartcardProviderService.java index 78c0f7ca..dc0177de 100644 --- a/ACardEmulator/app/src/fdroid/java/com/vsmartcard/acardemulator/SmartcardProviderService.java +++ b/ACardEmulator/app/src/fdroid/java/com/vsmartcard/acardemulator/SmartcardProviderService.java @@ -21,7 +21,8 @@ import android.app.IntentService; import android.content.Intent; -import android.support.annotation.Nullable; + +import androidx.annotation.Nullable; public class SmartcardProviderService extends IntentService { public SmartcardProviderService () { diff --git a/ACardEmulator/app/src/main/AndroidManifest.xml b/ACardEmulator/app/src/main/AndroidManifest.xml index 9cd3a626..6d3405d5 100644 --- a/ACardEmulator/app/src/main/AndroidManifest.xml +++ b/ACardEmulator/app/src/main/AndroidManifest.xml @@ -1,10 +1,10 @@ - - + + diff --git a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/AppCompatPreferenceActivity.java b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/AppCompatPreferenceActivity.java index e194461b..d0b2ab2b 100644 --- a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/AppCompatPreferenceActivity.java +++ b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/AppCompatPreferenceActivity.java @@ -3,11 +3,12 @@ import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceActivity; -import android.support.annotation.LayoutRes; -import android.support.annotation.Nullable; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatDelegate; -import android.support.v7.widget.Toolbar; +import androidx.annotation.LayoutRes; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.appcompat.widget.Toolbar; + import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; diff --git a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/EmulatorHostApduService.java b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/EmulatorHostApduService.java index a0fe639c..31641c77 100644 --- a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/EmulatorHostApduService.java +++ b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/EmulatorHostApduService.java @@ -22,7 +22,7 @@ import android.content.Intent; import android.nfc.cardemulation.HostApduService; import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.util.Log; import com.vsmartcard.acardemulator.emulators.EmulatorSingleton; diff --git a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/MainActivity.java b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/MainActivity.java index 325e0b48..132452f3 100644 --- a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/MainActivity.java +++ b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/MainActivity.java @@ -19,7 +19,6 @@ package com.vsmartcard.acardemulator; -import android.app.AlertDialog; import android.content.BroadcastReceiver; import android.content.ClipData; import android.content.ClipboardManager; @@ -30,19 +29,23 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.design.widget.FloatingActionButton; -import android.support.design.widget.Snackbar; -import android.support.v4.content.LocalBroadcastManager; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; +import androidx.appcompat.app.AlertDialog; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.snackbar.Snackbar; import com.vsmartcard.acardemulator.emulators.EmulatorSingleton; +import ACardEmulator.BuildConfig; +import ACardEmulator.R; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; public class MainActivity extends AppCompatActivity { @@ -135,26 +138,25 @@ public boolean onCreateOptionsMenu(Menu menu) { @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items - switch (item.getItemId()) { - case R.id.action_copy: - // Code to Copy the content of Text View to the Clip board. - ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText("simple text", textViewVPCDStatus.getText()); - clipboard.setPrimaryClip(clip); - Toast.makeText(getApplicationContext(), "Log copied to clipboard.", - Toast.LENGTH_LONG).show(); - return true; - case R.id.action_delete: + if (item.getItemId() == R.id.action_copy) { + // Code to Copy the content of Text View to the Clip board. + ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("simple text", textViewVPCDStatus.getText()); + clipboard.setPrimaryClip(clip); + Toast.makeText(getApplicationContext(), "Log copied to clipboard.", + Toast.LENGTH_LONG).show(); + return true; + } else if (item.getItemId() == R.id.action_delete) { textViewVPCDStatus.setText(""); - return true; - case R.id.action_help: - showStartupMessage(); - return true; - case R.id.action_settings: - startActivity(new Intent(this, SettingsActivity.class)); - return true; - default: - return super.onOptionsItemSelected(item); + return true; + } else if (item.getItemId() == R.id.action_help) { + showStartupMessage(); + return true; + } else if (item.getItemId() == R.id.action_settings) { + startActivity(new Intent(this, SettingsActivity.class)); + return true; + } else { + return super.onOptionsItemSelected(item); } } @@ -175,4 +177,4 @@ protected void onPause() { dialog.dismiss(); super.onPause(); } -} +} \ No newline at end of file diff --git a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/SettingsActivity.java b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/SettingsActivity.java index 1035af7a..7a779fb0 100644 --- a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/SettingsActivity.java +++ b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/SettingsActivity.java @@ -34,14 +34,18 @@ import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.SwitchPreference; -import android.support.design.widget.Snackbar; -import android.support.v7.app.ActionBar; +import com.google.android.material.snackbar.Snackbar; import android.view.MenuItem; +import androidx.appcompat.app.ActionBar; + import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult; import com.vsmartcard.acardemulator.emulators.VICCEmulator; +import ACardEmulator.BuildConfig; +import ACardEmulator.R; + /** * A {@link PreferenceActivity} that presents a set of application settings. On * handset devices, settings are presented as a single list. On tablets, @@ -65,7 +69,7 @@ protected void onCreate(Bundle savedInstanceState) { } /** - * Set up the {@link android.app.ActionBar}, if the API is available. + * Set up the {@link ActionBar}, if the API is available. */ private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); diff --git a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/EmulatorSingleton.java b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/EmulatorSingleton.java index ea418c88..c1df55b4 100644 --- a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/EmulatorSingleton.java +++ b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/EmulatorSingleton.java @@ -22,16 +22,12 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.content.res.Resources; import android.content.res.XmlResourceParser; -import android.nfc.NfcAdapter; -import android.nfc.cardemulation.CardEmulation; import android.preference.PreferenceManager; -import android.support.annotation.XmlRes; -import android.support.v4.content.LocalBroadcastManager; import android.util.Log; -import com.vsmartcard.acardemulator.R; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + import com.vsmartcard.acardemulator.Util; import org.xmlpull.v1.XmlPullParser; @@ -41,6 +37,8 @@ import java.util.ArrayList; import java.util.List; +import ACardEmulator.R; + public class EmulatorSingleton { public static final String TAG = "com.vsmartcard.acardemulator.EmulatorService"; public static final String EXTRA_CAPDU = "MSG_CAPDU"; diff --git a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/JCEmulator.java b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/JCEmulator.java index a4250e64..ed1e433a 100644 --- a/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/JCEmulator.java +++ b/ACardEmulator/app/src/main/java/com/vsmartcard/acardemulator/emulators/JCEmulator.java @@ -2,18 +2,19 @@ import android.content.Context; import android.content.Intent; -import android.support.v4.content.LocalBroadcastManager; + +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.licel.jcardsim.base.Simulator; import com.licel.jcardsim.base.SimulatorRuntime; import com.licel.jcardsim.utils.AIDUtil; import com.mysmartlogon.gidsApplet.GidsApplet; -import com.vsmartcard.acardemulator.R; import com.vsmartcard.acardemulator.Util; import net.pwendland.javacard.pki.isoapplet.IsoApplet; import net.cooperi.pivapplet.PivApplet; +import ACardEmulator.R; import openpgpcard.OpenPGPApplet; import pkgYkneoOath.YkneoOath; diff --git a/ACardEmulator/app/src/main/res/layout/activity_main.xml b/ACardEmulator/app/src/main/res/layout/activity_main.xml index cc41a10b..45069a6b 100644 --- a/ACardEmulator/app/src/main/res/layout/activity_main.xml +++ b/ACardEmulator/app/src/main/res/layout/activity_main.xml @@ -1,4 +1,4 @@ - - - - - - + + - - + - - \ No newline at end of file + diff --git a/ACardEmulator/build.gradle b/ACardEmulator/build.gradle index ce22669c..b42129ec 100644 --- a/ACardEmulator/build.gradle +++ b/ACardEmulator/build.gradle @@ -2,12 +2,11 @@ buildscript { repositories { - jcenter() + mavenCentral() google() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' + classpath 'com.android.tools.build:gradle:8.5.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -16,7 +15,18 @@ buildscript { allprojects { repositories { - jcenter() + mavenCentral() google() } -} + subprojects { + afterEvaluate { project -> + if (project.hasProperty('android')) { + project.android { + if (namespace == null) { + namespace project.group + } + } + } + } + } +} \ No newline at end of file diff --git a/ACardEmulator/gradle.properties b/ACardEmulator/gradle.properties index 1d3591c8..e7bcd1b7 100644 --- a/ACardEmulator/gradle.properties +++ b/ACardEmulator/gradle.properties @@ -15,4 +15,8 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.enableJetifier=true +android.nonFinalResIds=false +android.nonTransitiveRClass=true +android.useAndroidX=true \ No newline at end of file diff --git a/ACardEmulator/gradle/wrapper/gradle-wrapper.properties b/ACardEmulator/gradle/wrapper/gradle-wrapper.properties index 60fe95ed..aa830972 100644 --- a/ACardEmulator/gradle/wrapper/gradle-wrapper.properties +++ b/ACardEmulator/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jul 17 07:31:31 CEST 2017 +#Fri Nov 29 01:41:23 CET 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip