use autovalue for CryptoInputParcel
This commit is contained in:
@@ -523,7 +523,8 @@ public class BackupCodeFragment extends CryptoOperationFragment<BackupKeyringPar
|
||||
|
||||
// if we don't want to execute the actual operation outside of this activity, drop out here
|
||||
if (!mExecuteBackupOperation) {
|
||||
((BackupActivity) getActivity()).handleBackupOperation(new CryptoInputParcel(passphrase));
|
||||
((BackupActivity) getActivity()).handleBackupOperation(
|
||||
CryptoInputParcel.createCryptoInputParcel(passphrase));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -531,7 +532,7 @@ public class BackupCodeFragment extends CryptoOperationFragment<BackupKeyringPar
|
||||
mCachedBackupUri = TemporaryFileProvider.createFile(activity, filename,
|
||||
Constants.MIME_TYPE_ENCRYPTED_ALTERNATE);
|
||||
|
||||
cryptoOperation(new CryptoInputParcel(passphrase));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(passphrase));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public class CertifyKeyFragment
|
||||
Notify.create(getActivity(), getString(R.string.select_key_to_certify),
|
||||
Notify.Style.ERROR).show();
|
||||
} else {
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -499,7 +499,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
|
||||
|
||||
mMoveToCardOpHelper = new CryptoOperationHelper<>(2, this, callback, R.string.progress_modify);
|
||||
mMoveToCardOpHelper.cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
mMoveToCardOpHelper.cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
}
|
||||
|
||||
private void uploadKey(final EditKeyResult saveKeyResult) {
|
||||
|
||||
@@ -235,7 +235,7 @@ public class CreateSecurityTokenImportResetFragment
|
||||
Intent intent = new Intent(getActivity(), SecurityTokenOperationActivity.class);
|
||||
RequiredInputParcel resetP = RequiredInputParcel.createSecurityTokenReset();
|
||||
intent.putExtra(SecurityTokenOperationActivity.EXTRA_REQUIRED_INPUT, resetP);
|
||||
intent.putExtra(SecurityTokenOperationActivity.EXTRA_CRYPTO_INPUT, new CryptoInputParcel());
|
||||
intent.putExtra(SecurityTokenOperationActivity.EXTRA_CRYPTO_INPUT, CryptoInputParcel.createCryptoInputParcel());
|
||||
startActivityForResult(intent, REQUEST_CODE_RESET);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
}
|
||||
|
||||
private void startRevocationOperation() {
|
||||
mRevokeOpHelper.cryptoOperation(new CryptoInputParcel(new Date(), false));
|
||||
mRevokeOpHelper.cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date(), false));
|
||||
}
|
||||
|
||||
private void startDeletionOperation() {
|
||||
|
||||
@@ -156,7 +156,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
|
||||
if (mDataUri == null) {
|
||||
returnKeyringParcel();
|
||||
} else {
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
}
|
||||
}
|
||||
}, new OnClickListener() {
|
||||
|
||||
@@ -345,19 +345,19 @@ public class EncryptFilesFragment
|
||||
case R.id.encrypt_save: {
|
||||
hideKeyboard();
|
||||
mAfterEncryptAction = AfterEncryptAction.SAVE;
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
break;
|
||||
}
|
||||
case R.id.encrypt_share: {
|
||||
hideKeyboard();
|
||||
mAfterEncryptAction = AfterEncryptAction.SHARE;
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
break;
|
||||
}
|
||||
case R.id.encrypt_copy: {
|
||||
hideKeyboard();
|
||||
mAfterEncryptAction = AfterEncryptAction.COPY;
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
break;
|
||||
}
|
||||
case R.id.check_use_armor: {
|
||||
@@ -733,7 +733,7 @@ public class EncryptFilesFragment
|
||||
mOutputUris.add(data.getData());
|
||||
// make sure this is correct at this point
|
||||
mAfterEncryptAction = AfterEncryptAction.SAVE;
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||
onCryptoOperationCancelled();
|
||||
}
|
||||
|
||||
@@ -181,18 +181,18 @@ public class EncryptTextFragment
|
||||
case R.id.encrypt_copy: {
|
||||
hideKeyboard();
|
||||
mShareAfterEncrypt = false;
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
break;
|
||||
}
|
||||
case R.id.encrypt_share: {
|
||||
hideKeyboard();
|
||||
mShareAfterEncrypt = true;
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
break;
|
||||
}
|
||||
case R.id.encrypt_paste: {
|
||||
hideKeyboard();
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class OrbotRequiredDialogActivity extends FragmentActivity
|
||||
mCryptoInputParcel = getIntent().getParcelableExtra(EXTRA_CRYPTO_INPUT);
|
||||
if (mCryptoInputParcel == null) {
|
||||
// compatibility with usages that don't use a CryptoInputParcel
|
||||
mCryptoInputParcel = new CryptoInputParcel();
|
||||
mCryptoInputParcel = CryptoInputParcel.createCryptoInputParcel();
|
||||
}
|
||||
|
||||
mMessenger = getIntent().getParcelableExtra(EXTRA_MESSENGER);
|
||||
@@ -147,7 +147,7 @@ public class OrbotRequiredDialogActivity extends FragmentActivity
|
||||
public void onNeutralButton() {
|
||||
sendMessage(MESSAGE_ORBOT_IGNORE);
|
||||
Intent intent = new Intent();
|
||||
mCryptoInputParcel.addParcelableProxy(ParcelableProxy.getForNoProxy());
|
||||
mCryptoInputParcel = mCryptoInputParcel.withParcelableProxy(ParcelableProxy.getForNoProxy());
|
||||
intent.putExtra(RESULT_CRYPTO_INPUT, mCryptoInputParcel);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
|
||||
@@ -99,7 +99,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
|
||||
CryptoInputParcel cryptoInputParcel = getIntent().getParcelableExtra(EXTRA_CRYPTO_INPUT);
|
||||
if (cryptoInputParcel == null) {
|
||||
cryptoInputParcel = new CryptoInputParcel();
|
||||
cryptoInputParcel = CryptoInputParcel.createCryptoInputParcel();
|
||||
getIntent().putExtra(EXTRA_CRYPTO_INPUT, cryptoInputParcel);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
if (pubRing.getSecretKeyType(requiredInput.getSubKeyId()) == SecretKeyType.PASSPHRASE_EMPTY) {
|
||||
// also return passphrase back to activity
|
||||
Intent returnIntent = new Intent();
|
||||
cryptoInputParcel.mPassphrase = new Passphrase("");
|
||||
cryptoInputParcel = cryptoInputParcel.withPassphrase(new Passphrase(""));
|
||||
returnIntent.putExtra(RESULT_CRYPTO_INPUT, cryptoInputParcel);
|
||||
setResult(RESULT_OK, returnIntent);
|
||||
finish();
|
||||
@@ -539,7 +539,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
|
||||
CryptoInputParcel inputParcel = getArguments().getParcelable(EXTRA_CRYPTO_INPUT);
|
||||
// noinspection ConstantConditions, we handle the non-null case in PassphraseDialogActivity.onCreate()
|
||||
inputParcel.mPassphrase = passphrase;
|
||||
inputParcel = inputParcel.withPassphrase(passphrase);
|
||||
|
||||
((PassphraseDialogActivity) getActivity()).handleResult(inputParcel);
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
for (int i = 0; i < mRequiredInput.mInputData.length; i++) {
|
||||
byte[] encryptedSessionKey = mRequiredInput.mInputData[i];
|
||||
byte[] decryptedSessionKey = mSecurityTokenHelper.decryptSessionKey(encryptedSessionKey, publicKeyRing.getPublicKey(tokenKeyId));
|
||||
mInputParcel.addCryptoData(encryptedSessionKey, decryptedSessionKey);
|
||||
mInputParcel = mInputParcel.withCryptoData(encryptedSessionKey, decryptedSessionKey);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -218,13 +218,13 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
throw new IOException(getString(R.string.error_wrong_security_token));
|
||||
}
|
||||
|
||||
mInputParcel.addSignatureTime(mRequiredInput.mSignatureTime);
|
||||
mInputParcel = mInputParcel.withSignatureTime(mRequiredInput.mSignatureTime);
|
||||
|
||||
for (int i = 0; i < mRequiredInput.mInputData.length; i++) {
|
||||
byte[] hash = mRequiredInput.mInputData[i];
|
||||
int algo = mRequiredInput.mSignAlgos[i];
|
||||
byte[] signedHash = mSecurityTokenHelper.calculateSignature(hash, algo);
|
||||
mInputParcel.addCryptoData(hash, signedHash);
|
||||
mInputParcel = mInputParcel.withCryptoData(hash, signedHash);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
mSecurityTokenHelper.changeKey(key, passphrase);
|
||||
|
||||
// TODO: Is this really used anywhere?
|
||||
mInputParcel.addCryptoData(subkeyBytes, tokenSerialNumber);
|
||||
mInputParcel = mInputParcel.withCryptoData(subkeyBytes, tokenSerialNumber);
|
||||
}
|
||||
|
||||
// change PINs afterwards
|
||||
|
||||
@@ -323,7 +323,7 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
}
|
||||
|
||||
public void cryptoOperation() {
|
||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||
cryptoOperation(CryptoInputParcel.createCryptoInputParcel(new Date()));
|
||||
}
|
||||
|
||||
public void onHandleResult(OperationResult result) {
|
||||
|
||||
Reference in New Issue
Block a user