migrated delete op to KeychainNewService
This commit is contained in:
@@ -41,6 +41,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction;
|
||||
import org.sufficientlysecure.keychain.service.ServiceProgressHandler.MessageStatus;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.DeleteKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
/**
|
||||
@@ -103,6 +104,9 @@ 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");
|
||||
op = new DeleteOperation(outerThis, new ProviderHelper(outerThis), outerThis);
|
||||
} else if (inputParcel instanceof ImportKeyringParcel
|
||||
|| inputParcel instanceof ExportKeyringParcel){
|
||||
op = new ImportExportOperation(outerThis, new ProviderHelper(outerThis),
|
||||
@@ -110,10 +114,10 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
@@ -87,12 +87,8 @@ 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_EDIT_KEYRING = Constants.INTENT_PREFIX + "EDIT_KEYRING";
|
||||
|
||||
public static final String ACTION_PROMOTE_KEYRING = Constants.INTENT_PREFIX + "PROMOTE_KEYRING";
|
||||
|
||||
public static final String ACTION_DELETE = Constants.INTENT_PREFIX + "DELETE";
|
||||
|
||||
public static final String ACTION_CONSOLIDATE = Constants.INTENT_PREFIX + "CONSOLIDATE";
|
||||
|
||||
public static final String ACTION_CANCEL = Constants.INTENT_PREFIX + "CANCEL";
|
||||
@@ -103,10 +99,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";
|
||||
|
||||
// delete keyring(s)
|
||||
public static final String DELETE_KEY_LIST = "delete_list";
|
||||
public static final String DELETE_IS_SECRET = "delete_is_secret";
|
||||
|
||||
// promote key
|
||||
public static final String PROMOTE_MASTER_KEY_ID = "promote_master_key_id";
|
||||
public static final String PROMOTE_CARD_AID = "promote_card_aid";
|
||||
@@ -281,21 +273,6 @@ public class KeychainService extends Service implements Progressable {
|
||||
|
||||
break;
|
||||
}
|
||||
case ACTION_DELETE: {
|
||||
|
||||
// Input
|
||||
long[] masterKeyIds = data.getLongArray(DELETE_KEY_LIST);
|
||||
boolean isSecret = data.getBoolean(DELETE_IS_SECRET);
|
||||
|
||||
// Operation
|
||||
DeleteOperation op = new DeleteOperation(KeychainService.this, providerHelper, KeychainService.this);
|
||||
DeleteResult result = op.execute(masterKeyIds, isSecret);
|
||||
|
||||
// Result
|
||||
sendMessageToHandler(MessageStatus.OKAY, result);
|
||||
|
||||
break;
|
||||
}
|
||||
case ACTION_PROMOTE_KEYRING: {
|
||||
|
||||
// Input
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.sufficientlysecure.keychain.service.input;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class DeleteKeyringParcel implements Parcelable {
|
||||
|
||||
public long[] mMasterKeyIds;
|
||||
public boolean mIsSecret;
|
||||
|
||||
public DeleteKeyringParcel(long[] masterKeyIds, boolean isSecret) {
|
||||
mMasterKeyIds = masterKeyIds;
|
||||
mIsSecret = isSecret;
|
||||
}
|
||||
|
||||
protected DeleteKeyringParcel(Parcel in) {
|
||||
mIsSecret = in.readByte() != 0x00;
|
||||
mMasterKeyIds = in.createLongArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeByte((byte) (mIsSecret ? 0x01 : 0x00));
|
||||
dest.writeLongArray(mMasterKeyIds);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DeleteKeyringParcel> CREATOR = new Parcelable.Creator<DeleteKeyringParcel>() {
|
||||
@Override
|
||||
public DeleteKeyringParcel createFromParcel(Parcel in) {
|
||||
return new DeleteKeyringParcel(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeleteKeyringParcel[] newArray(int size) {
|
||||
return new DeleteKeyringParcel[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user