Poll if yubikey has been taken away
This commit is contained in:
@@ -24,7 +24,6 @@ import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
|||||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||||
import org.sufficientlysecure.keychain.ui.base.BaseNfcActivity;
|
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.Log;
|
||||||
import org.sufficientlysecure.keychain.util.Passphrase;
|
import org.sufficientlysecure.keychain.util.Passphrase;
|
||||||
import org.sufficientlysecure.keychain.util.Preferences;
|
import org.sufficientlysecure.keychain.util.Preferences;
|
||||||
@@ -217,13 +216,18 @@ public class NfcOperationActivity extends BaseNfcActivity {
|
|||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
// wait some 1000ms here, give the user time to appreciate the displayed finish
|
// check all 200ms if YubiKey has been taken away
|
||||||
try {
|
while (true) {
|
||||||
Thread.sleep(1000);
|
if (isNfcConnected()) {
|
||||||
} catch (InterruptedException e) {
|
try {
|
||||||
// never mind
|
Thread.sleep(200);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// never mind
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
|
|||||||
@@ -399,9 +399,10 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
|||||||
|
|
||||||
doNfcInBackground();
|
doNfcInBackground();
|
||||||
|
|
||||||
mIsoDep.close();
|
}
|
||||||
mIsoDep = null;
|
|
||||||
|
|
||||||
|
public boolean isNfcConnected() {
|
||||||
|
return mIsoDep.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the key id from application specific data stored on tag, or null
|
/** Return the key id from application specific data stored on tag, or null
|
||||||
|
|||||||
Reference in New Issue
Block a user