aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ChangeUnlockParcel.java
blob: 2bfe8254c0f38ddcc41972c68e5843352d57cc48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.sufficientlysecure.keychain.service;

import android.os.Parcel;
import android.os.Parcelable;

import org.sufficientlysecure.keychain.util.Passphrase;

public class ChangeUnlockParcel implements Parcelable {

    // The new passphrase to use
    public final Passphrase mNewPassphrase;

    public ChangeUnlockParcel(Passphrase newPassphrase) {
        if (newPassphrase == null) {
            throw new AssertionError("newPassphrase must be non-null. THIS IS A BUG!");
        }
        mNewPassphrase = newPassphrase;
    }

    public ChangeUnlockParcel(Parcel source) {
        mNewPassphrase = source.readParcelable(Passphrase.class.getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel destination, int flags) {
        destination.writeParcelable(mNewPassphrase, flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<ChangeUnlockParcel> CREATOR = new Creator<ChangeUnlockParcel>() {
        public ChangeUnlockParcel createFromParcel(final Parcel source) {
            return new ChangeUnlockParcel(source);
        }

        public ChangeUnlockParcel[] newArray(final int size) {
            return new ChangeUnlockParcel[size];
        }
    };

    public String toString() {
        return "passphrase (" + mNewPassphrase + ")";
    }

}