diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-06 14:12:33 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-06 14:12:33 +0200 |
commit | 45f85bcfdfa65d3c25cbcd66935fe2c17c56c09d (patch) | |
tree | 93ffdcadeaf48b6df3329464a5330765e5625a9e /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui | |
parent | 9c0ec1f4965bd34a05a7a417df51ca470f5f1fae (diff) | |
download | open-keychain-45f85bcfdfa65d3c25cbcd66935fe2c17c56c09d.tar.gz open-keychain-45f85bcfdfa65d3c25cbcd66935fe2c17c56c09d.tar.bz2 open-keychain-45f85bcfdfa65d3c25cbcd66935fe2c17c56c09d.zip |
Poll if yubikey has been taken away
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcOperationActivity.java | 18 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java | 5 |
2 files changed, 14 insertions, 9 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcOperationActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcOperationActivity.java index 1e900242a..cacfd2e52 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcOperationActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcOperationActivity.java @@ -24,7 +24,6 @@ import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; import org.sufficientlysecure.keychain.ui.base.BaseNfcActivity; -import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Passphrase; import org.sufficientlysecure.keychain.util.Preferences; @@ -217,13 +216,18 @@ public class NfcOperationActivity extends BaseNfcActivity { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { - // wait some 1000ms here, give the user time to appreciate the displayed finish - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // never mind + // check all 200ms if YubiKey has been taken away + while (true) { + if (isNfcConnected()) { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + // never mind + } + } else { + return null; + } } - return null; } @Override protected void onPostExecute(Void result) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java index dc5991f7a..02e8271cb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java @@ -399,9 +399,10 @@ public abstract class BaseNfcActivity extends BaseActivity { doNfcInBackground(); - mIsoDep.close(); - mIsoDep = null; + } + public boolean isNfcConnected() { + return mIsoDep.isConnected(); } /** Return the key id from application specific data stored on tag, or null |