Clear cache when PIN is too short
This commit is contained in:
@@ -305,7 +305,8 @@ public class NfcOperationActivity extends BaseNfcActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPinError() {
|
public void onNfcPinError(String error) {
|
||||||
|
onNfcError(error);
|
||||||
|
|
||||||
// avoid a loop
|
// avoid a loop
|
||||||
Preferences prefs = Preferences.getPreferences(this);
|
Preferences prefs = Preferences.getPreferences(this);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import android.nfc.TagLostException;
|
|||||||
import android.nfc.tech.IsoDep;
|
import android.nfc.tech.IsoDep;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import org.spongycastle.bcpg.HashAlgorithmTags;
|
import org.spongycastle.bcpg.HashAlgorithmTags;
|
||||||
import org.spongycastle.util.Arrays;
|
import org.spongycastle.util.Arrays;
|
||||||
@@ -137,11 +136,8 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
|||||||
/**
|
/**
|
||||||
* Override to do something when PIN is wrong, e.g., clear passphrases (UI thread)
|
* Override to do something when PIN is wrong, e.g., clear passphrases (UI thread)
|
||||||
*/
|
*/
|
||||||
protected void onPinError() {
|
protected void onNfcPinError(String error) {
|
||||||
// use Toast because activity is finished afterwards
|
onNfcError(error);
|
||||||
Toast.makeText(this, R.string.error_pin_wrong, Toast.LENGTH_LONG).show();
|
|
||||||
setResult(RESULT_CANCELED);
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleIntentInBackground(final Intent intent) {
|
public void handleIntentInBackground(final Intent intent) {
|
||||||
@@ -246,11 +242,9 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
|||||||
|
|
||||||
// Wrong PIN, a status of 63CX indicates X attempts remaining.
|
// Wrong PIN, a status of 63CX indicates X attempts remaining.
|
||||||
if ((status & (short) 0xFFF0) == 0x63C0) {
|
if ((status & (short) 0xFFF0) == 0x63C0) {
|
||||||
// hook to do something different when PIN is wrong
|
|
||||||
onPinError();
|
|
||||||
|
|
||||||
int tries = status & 0x000F;
|
int tries = status & 0x000F;
|
||||||
onNfcError(getResources().getQuantityString(R.plurals.error_pin, tries, tries));
|
// hook to do something different when PIN is wrong
|
||||||
|
onNfcPinError(getResources().getQuantityString(R.plurals.error_pin, tries, tries));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +278,7 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x6700: {
|
case 0x6700: {
|
||||||
onNfcError(getString(R.string.error_nfc_wrong_length));
|
onNfcPinError(getString(R.string.error_nfc_wrong_length));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x6982: {
|
case 0x6982: {
|
||||||
|
|||||||
Reference in New Issue
Block a user