Commit 4ff34aa3 authored by Tobias Wich's avatar Tobias Wich
Browse files

Merge branch 'master' into java11

parents 9ecb2be1 6e8048f3
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>src-parent</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
<relativePath>../src-parent/</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>addons</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.addons</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>addons</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.addons</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>addons</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.addons</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>src-parent</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
<relativePath>../src-parent/</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>addons</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.addons</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>addons</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.addons</groupId>
......
......@@ -302,8 +302,8 @@ public class PACEStep implements ProtocolStep<DIDAuthenticate, DIDAuthenticateRe
needsTermination = true;
}
}
// terminate activation thread
if (needsTermination) {
// terminate activation thread if it has not been interrupted already
if (needsTermination && guiResult != ResultStatus.INTERRUPTED) {
Thread actThread = (Thread) dynCtx2.get(TR03112Keys.ACTIVATION_THREAD);
if (actThread != null) {
LOG.debug("Interrupting activation thread.");
......@@ -399,6 +399,14 @@ public class PACEStep implements ProtocolStep<DIDAuthenticate, DIDAuthenticateRe
LOG.error(ex.getMessage(), ex);
response.setResult(WSHelper.makeResultError(ECardConstants.Minor.App.INCORRECT_PARM, ex.getMessage()));
dynCtx.put(EACProtocol.AUTHENTICATION_DONE, false);
} catch (InterruptedException e) {
LOG.error(e.getMessage(), e);
response.setResult(WSHelper.makeResultUnknownError(e.getMessage()));
dynCtx.put(EACProtocol.AUTHENTICATION_DONE, false);
Thread guiThread = (Thread) dynCtx.get(TR03112Keys.OPEN_USER_CONSENT_THREAD);
if (guiThread != null) {
guiThread.interrupt();
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
response.setResult(WSHelper.makeResultUnknownError(e.getMessage()));
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>bindings</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.bindings</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>src-parent</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
<relativePath>../src-parent/</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>src-parent</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
<relativePath>../src-parent/</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>clients</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.clients</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>clients</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.clients</groupId>
......
......@@ -42,7 +42,9 @@ import org.openecard.android.system.ServiceResponse;
import org.openecard.android.utils.NfcUtils;
import org.openecard.common.event.EventObject;
import org.openecard.common.event.EventType;
import org.openecard.common.event.IfdEventObject;
import org.openecard.common.interfaces.EventCallback;
import org.openecard.common.sal.state.CardStateEntry;
import org.openecard.common.util.CombinedPromise;
import org.openecard.common.util.Promise;
import org.openecard.gui.android.AndroidGui;
......@@ -144,6 +146,14 @@ public abstract class AbstractActivationHandler <T extends Activity, GUI extends
// add callback to this abstract activity when card is removed
cardRecognized = false;
// check card states for already inserted card and call recognised handler
CardStateEntry availableCard = getAvailableCard();
if (availableCard != null) {
insertionHandler.signalEvent(EventType.CARD_INSERTED, new IfdEventObject(availableCard.handleCopy()));
cardDetectHandler.signalEvent(EventType.RECOGNIZED_CARD_ACTIVE, new IfdEventObject(availableCard.handleCopy()));
}
octx.getEventDispatcher().add(insertionHandler, EventType.CARD_REMOVED, EventType.CARD_INSERTED);
octx.getEventDispatcher().add(cardDetectHandler, EventType.RECOGNIZED_CARD_ACTIVE);
octx.getEventDispatcher().add(removalHandler, EventType.CARD_REMOVED);
......@@ -168,6 +178,27 @@ public abstract class AbstractActivationHandler <T extends Activity, GUI extends
}
}
private CardStateEntry getAvailableCard() {
// look in card states for a card matching our criteria
Set<String> types = getSupportedCards();
if (types != null) {
for (String type : types) {
ConnectionHandleType query = new ConnectionHandleType();
ConnectionHandleType.RecognitionInfo rinfo = new ConnectionHandleType.RecognitionInfo();
rinfo.setCardType(type);
query.setRecognitionInfo(rinfo);
CardStateEntry entry = octx.getCardStates().getEntry(query);
if (entry != null) {
return entry;
}
}
return null;
} else {
return octx.getCardStates().getEntry(new ConnectionHandleType());
}
}
@Nullable
private Class<?> forClassName(@Nullable String className) {
if (className != null) {
......@@ -200,11 +231,7 @@ public abstract class AbstractActivationHandler <T extends Activity, GUI extends
public void onStop() {
// make sure nothing is running anymore
Thread at = authThread;
if (at != null) {
authThread = null; // prevent calling handler at all, we are shutting down
cancelAuthenticationInt(at, false, false);
}
cancelAuthenticationInt(authThread, false);
// remove callback which is set onStart
if (octx != null) {
......@@ -358,24 +385,24 @@ public abstract class AbstractActivationHandler <T extends Activity, GUI extends
@Override
public void cancelAuthentication(boolean runInThread) {
cancelAuthenticationInt(authThread, true, runInThread);
cancelAuthenticationInt(authThread, runInThread);
}
private void cancelAuthenticationInt(Thread at, boolean showFailure, boolean runInNewThread) {
private void cancelAuthenticationInt(Thread at, boolean runInNewThread) {
if (at != null) {
if (at == authThread) {
authThread = null;
}
// define function
Runnable fun = () -> {
try {
LOG.info("Stopping Authentication thread ...");
at.interrupt();
// cancel task and handle event
if (showFailure) {
String msg = "";
ActivationResult r = new ActivationResult(ActivationResultCode.INTERRUPTED, msg);
handleActivationResult(r);
}
String msg = "";
ActivationResult result = new ActivationResult(ActivationResultCode.INTERRUPTED, msg);
onAuthenticationInterrupted(result);
LOG.info("Stopping Authentication thread ...");
at.interrupt();
at.join();
LOG.info("Authentication thread has stopped.");
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>src-parent</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
<relativePath>../src-parent/</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>clients</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.clients</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>src-parent</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
<relativePath>../src-parent/</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>crypto</artifactId>
<groupId>org.openecard</groupId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.crypto</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>src-parent</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
<relativePath>../src-parent/</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.openecard</groupId>
<artifactId>crypto</artifactId>
<version>1.4.0-rc.3-SNAPSHOT</version>
<version>1.4.0-rc.4-SNAPSHOT</version>
</parent>
<groupId>org.openecard.crypto</groupId>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment