diff options
author | Ashley Hughes <spirit.returned@gmail.com> | 2014-03-06 23:47:11 +0000 |
---|---|---|
committer | Ashley Hughes <spirit.returned@gmail.com> | 2014-03-06 23:47:11 +0000 |
commit | 04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba (patch) | |
tree | 8b248117c6c7d4f9907a46846b0ac11a45f94dec /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java | |
parent | 01951810ae1b3a0e4fefab7d55c090fc8f776ce5 (diff) | |
download | open-keychain-04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba.tar.gz open-keychain-04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba.tar.bz2 open-keychain-04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba.zip |
use parcel to save keys, but saving existing keys is disabled, pending a rewrite...
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java')
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java index 9e290c1b6..ae481aa80 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java @@ -42,20 +42,25 @@ public class SaveKeyringParcel implements Parcelable { public boolean[] newKeys; public ArrayList<PGPSecretKey> keys; + public SaveKeyringParcel() {} + private SaveKeyringParcel(Parcel source) { - byte[] tmpB; userIDs = (ArrayList<String>)source.readSerializable(); originalIDs = (ArrayList<String>)source.readSerializable(); deletedIDs = (ArrayList<String>)source.readSerializable(); primaryIDChanged = source.readByte() != 0; - source.readBooleanArray(moddedKeys); - deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(source.createByteArray()); + moddedKeys = source.createBooleanArray(); + byte[] tmp = source.createByteArray(); + if (tmp == null) + deletedKeys = null; + else + deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(tmp); keysExpiryDates = (ArrayList<GregorianCalendar>)source.readSerializable(); keysUsages = source.readArrayList(Integer.class.getClassLoader()); newPassPhrase = source.readString(); oldPassPhrase = source.readString(); - source.readBooleanArray(newKeys); + newKeys = source.createBooleanArray(); keys = PgpConversionHelper.BytesToPGPSecretKeyList(source.createByteArray()); } @@ -67,7 +72,10 @@ public class SaveKeyringParcel implements Parcelable { destination.writeSerializable(deletedIDs); destination.writeByte((byte) (primaryIDChanged ? 1 : 0)); destination.writeBooleanArray(moddedKeys); - destination.writeByteArray(PgpConversionHelper.PGPSecretKeyArrayListToBytes(deletedKeys)); + byte[] tmp = null; + if (deletedKeys.size() != 0) + tmp = PgpConversionHelper.PGPSecretKeyArrayListToBytes(deletedKeys); + destination.writeByteArray(tmp); destination.writeSerializable(keysExpiryDates); destination.writeList(keysUsages); destination.writeString(newPassPhrase); |