migrated promote op to KeychainNewService

This commit is contained in:
Adithya Abraham Philip
2015-06-24 01:46:34 +05:30
parent 6e425e95f5
commit de4b203150
5 changed files with 80 additions and 70 deletions

View File

@@ -104,9 +104,11 @@ public class KeychainNewService extends Service implements Progressable {
} else if (inputParcel instanceof CertifyAction) {
op = new CertifyOperation(outerThis, new ProviderHelper(outerThis), outerThis,
mActionCanceled);
} else if (inputParcel instanceof DeleteKeyringParcel){
Log.e("PHILIP", "delete in KeychainNewService");
} else if (inputParcel instanceof DeleteKeyringParcel) {
op = new DeleteOperation(outerThis, new ProviderHelper(outerThis), outerThis);
} else if (inputParcel instanceof PromoteKeyringParcel){
op = new PromoteKeyOperation(outerThis, new ProviderHelper(outerThis),
outerThis, mActionCanceled);
} else if (inputParcel instanceof ImportKeyringParcel
|| inputParcel instanceof ExportKeyringParcel){
op = new ImportExportOperation(outerThis, new ProviderHelper(outerThis),
@@ -114,10 +116,8 @@ public class KeychainNewService extends Service implements Progressable {
} else {
return;
}
Log.e("PHILIP", "exec in KeychainNewService");
@SuppressWarnings("unchecked") // this is unchecked, we make sure it's the correct op above!
OperationResult result = op.execute(inputParcel, cryptoInput);
Log.e("PHILIP", "result in KeychainNewService" + result);
sendMessageToHandler(MessageStatus.OKAY, result);
}

View File

@@ -87,8 +87,6 @@ public class KeychainService extends Service implements Progressable {
public static final String ACTION_VERIFY_KEYBASE_PROOF = Constants.INTENT_PREFIX + "VERIFY_KEYBASE_PROOF";
public static final String ACTION_PROMOTE_KEYRING = Constants.INTENT_PREFIX + "PROMOTE_KEYRING";
public static final String ACTION_CONSOLIDATE = Constants.INTENT_PREFIX + "CONSOLIDATE";
public static final String ACTION_CANCEL = Constants.INTENT_PREFIX + "CANCEL";
@@ -99,11 +97,6 @@ public class KeychainService extends Service implements Progressable {
public static final String KEYBASE_REQUIRED_FINGERPRINT = "keybase_required_fingerprint";
public static final String KEYBASE_PROOF = "keybase_proof";
// promote key
public static final String PROMOTE_MASTER_KEY_ID = "promote_master_key_id";
public static final String PROMOTE_CARD_AID = "promote_card_aid";
public static final String PROMOTE_SUBKEY_IDS = "promote_fingerprints";
// consolidate
public static final String CONSOLIDATE_RECOVERY = "consolidate_recovery";
@@ -271,24 +264,6 @@ public class KeychainService extends Service implements Progressable {
sendErrorToHandler(e);
}
break;
}
case ACTION_PROMOTE_KEYRING: {
// Input
long keyRingId = data.getLong(PROMOTE_MASTER_KEY_ID);
byte[] cardAid = data.getByteArray(PROMOTE_CARD_AID);
long[] subKeyIds = data.getLongArray(PROMOTE_SUBKEY_IDS);
// Operation
PromoteKeyOperation op = new PromoteKeyOperation(
KeychainService.this, providerHelper, KeychainService.this,
mActionCanceled);
PromoteKeyResult result = op.execute(keyRingId, cardAid, subKeyIds);
// Result
sendMessageToHandler(MessageStatus.OKAY, result);
break;
}
}

View File

@@ -0,0 +1,47 @@
package org.sufficientlysecure.keychain.service;
import android.os.Parcel;
import android.os.Parcelable;
public class PromoteKeyringParcel implements Parcelable {
public long mKeyRingId;
public byte[] mCardAid;
public long[] mSubKeyIds;
public PromoteKeyringParcel(long keyRingId, byte[] cardAid, long[] subKeyIds) {
mKeyRingId = keyRingId;
mCardAid = cardAid;
mSubKeyIds = subKeyIds;
}
protected PromoteKeyringParcel(Parcel in) {
mKeyRingId = in.readLong();
mCardAid = in.createByteArray();
mSubKeyIds = in.createLongArray();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(mKeyRingId);
dest.writeByteArray(mCardAid);
dest.writeLongArray(mSubKeyIds);
}
public static final Parcelable.Creator<PromoteKeyringParcel> CREATOR = new Parcelable.Creator<PromoteKeyringParcel>() {
@Override
public PromoteKeyringParcel createFromParcel(Parcel in) {
return new PromoteKeyringParcel(in);
}
@Override
public PromoteKeyringParcel[] newArray(int size) {
return new PromoteKeyringParcel[size];
}
};
}