Fix some parcelling issues in credential provider APIs + write/read
to parcel consistent Test: Built & deployed locally Change-Id: If4d841c1b14cf6c2c9e23bc1b01be141be313444
This commit is contained in:
@@ -50,9 +50,8 @@ public final class Action implements Parcelable {
|
||||
}
|
||||
|
||||
private Action(@NonNull Parcel in) {
|
||||
mSlice = in.readParcelable(Slice.class.getClassLoader(), Slice.class);
|
||||
mPendingIntent = in.readParcelable(PendingIntent.class.getClassLoader(),
|
||||
PendingIntent.class);
|
||||
mSlice = in.readTypedObject(Slice.CREATOR);
|
||||
mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<Action> CREATOR = new Creator<Action>() {
|
||||
@@ -74,8 +73,8 @@ public final class Action implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
mSlice.writeToParcel(dest, flags);
|
||||
mPendingIntent.writeToParcel(dest, flags);
|
||||
dest.writeTypedObject(mSlice, flags);
|
||||
dest.writeTypedObject(mPendingIntent, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ public final class CreateCredentialRequest implements Parcelable {
|
||||
private CreateCredentialRequest(@NonNull Parcel in) {
|
||||
mCallingPackage = in.readString8();
|
||||
mType = in.readString8();
|
||||
mData = in.readBundle();
|
||||
mData = in.readTypedObject(Bundle.CREATOR);
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<CreateCredentialRequest> CREATOR =
|
||||
@@ -79,7 +79,7 @@ public final class CreateCredentialRequest implements Parcelable {
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeString8(mCallingPackage);
|
||||
dest.writeString8(mType);
|
||||
dest.writeBundle(mData);
|
||||
dest.writeTypedObject(mData, flags);
|
||||
}
|
||||
|
||||
/** Returns the calling package of the calling app. */
|
||||
|
||||
@@ -38,7 +38,9 @@ public final class CreateCredentialResponse implements Parcelable {
|
||||
|
||||
private CreateCredentialResponse(@NonNull Parcel in) {
|
||||
mHeader = in.readCharSequence();
|
||||
mSaveEntries = in.createTypedArrayList(SaveEntry.CREATOR);
|
||||
List<SaveEntry> saveEntries = new ArrayList<>();
|
||||
in.readTypedList(saveEntries, SaveEntry.CREATOR);
|
||||
mSaveEntries = saveEntries;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -65,12 +65,10 @@ public final class CredentialEntry implements Parcelable {
|
||||
}
|
||||
|
||||
private CredentialEntry(@NonNull Parcel in) {
|
||||
mType = in.readString();
|
||||
mSlice = in.readParcelable(Slice.class.getClassLoader(), Slice.class);
|
||||
mPendingIntent = in.readParcelable(PendingIntent.class.getClassLoader(),
|
||||
PendingIntent.class);
|
||||
mCredential = in.readParcelable(Credential.class.getClassLoader(),
|
||||
Credential.class);
|
||||
mType = in.readString8();
|
||||
mSlice = in.readTypedObject(Slice.CREATOR);
|
||||
mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
|
||||
mCredential = in.readTypedObject(Credential.CREATOR);
|
||||
mAutoSelectAllowed = in.readBoolean();
|
||||
}
|
||||
|
||||
@@ -95,9 +93,9 @@ public final class CredentialEntry implements Parcelable {
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeString8(mType);
|
||||
mSlice.writeToParcel(dest, flags);
|
||||
mPendingIntent.writeToParcel(dest, flags);
|
||||
mCredential.writeToParcel(dest, flags);
|
||||
dest.writeTypedObject(mSlice, flags);
|
||||
dest.writeTypedObject(mPendingIntent, flags);
|
||||
dest.writeTypedObject(mCredential, flags);
|
||||
dest.writeBoolean(mAutoSelectAllowed);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,12 @@ public final class CredentialsDisplayContent implements Parcelable {
|
||||
|
||||
private CredentialsDisplayContent(@NonNull Parcel in) {
|
||||
mHeader = in.readCharSequence();
|
||||
mCredentialEntries = in.createTypedArrayList(CredentialEntry.CREATOR);
|
||||
mActions = in.createTypedArrayList(Action.CREATOR);
|
||||
List<CredentialEntry> credentialEntries = new ArrayList<>();
|
||||
in.readTypedList(credentialEntries, CredentialEntry.CREATOR);
|
||||
mCredentialEntries = credentialEntries;
|
||||
List<Action> actions = new ArrayList<>();
|
||||
in.readTypedList(actions, Action.CREATOR);
|
||||
mActions = actions;
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<CredentialsDisplayContent> CREATOR =
|
||||
@@ -78,8 +82,8 @@ public final class CredentialsDisplayContent implements Parcelable {
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeCharSequence(mHeader);
|
||||
dest.writeTypedList(mCredentialEntries);
|
||||
dest.writeTypedList(mActions);
|
||||
dest.writeTypedList(mCredentialEntries, flags);
|
||||
dest.writeTypedList(mActions, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,8 +49,10 @@ public final class GetCredentialsRequest implements Parcelable {
|
||||
}
|
||||
|
||||
private GetCredentialsRequest(@NonNull Parcel in) {
|
||||
mCallingPackage = in.readString16NoHelper();
|
||||
mGetCredentialOptions = in.createTypedArrayList(GetCredentialOption.CREATOR);
|
||||
mCallingPackage = in.readString8();
|
||||
List<GetCredentialOption> getCredentialOptions = new ArrayList<>();
|
||||
in.readTypedList(getCredentialOptions, GetCredentialOption.CREATOR);
|
||||
mGetCredentialOptions = getCredentialOptions;
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<GetCredentialsRequest> CREATOR =
|
||||
@@ -73,7 +75,7 @@ public final class GetCredentialsRequest implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeString16NoHelper(mCallingPackage);
|
||||
dest.writeString8(mCallingPackage);
|
||||
dest.writeTypedList(mGetCredentialOptions);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,9 +78,8 @@ public final class GetCredentialsResponse implements Parcelable {
|
||||
}
|
||||
|
||||
private GetCredentialsResponse(@NonNull Parcel in) {
|
||||
mCredentialsDisplayContent = in.readParcelable(CredentialsDisplayContent.class
|
||||
.getClassLoader(), CredentialsDisplayContent.class);
|
||||
mAuthenticationAction = in.readParcelable(Action.class.getClassLoader(), Action.class);
|
||||
mCredentialsDisplayContent = in.readTypedObject(CredentialsDisplayContent.CREATOR);
|
||||
mAuthenticationAction = in.readTypedObject(Action.CREATOR);
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<GetCredentialsResponse> CREATOR =
|
||||
@@ -103,8 +102,8 @@ public final class GetCredentialsResponse implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeParcelable(mCredentialsDisplayContent, flags);
|
||||
dest.writeParcelable(mAuthenticationAction, flags);
|
||||
dest.writeTypedObject(mCredentialsDisplayContent, flags);
|
||||
dest.writeTypedObject(mAuthenticationAction, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,10 +40,9 @@ public final class SaveEntry implements Parcelable {
|
||||
private final @Nullable Credential mCredential;
|
||||
|
||||
private SaveEntry(@NonNull Parcel in) {
|
||||
mSlice = in.readParcelable(Slice.class.getClassLoader(), Slice.class);
|
||||
mPendingIntent = in.readParcelable(PendingIntent.class.getClassLoader(),
|
||||
PendingIntent.class);
|
||||
mCredential = in.readParcelable(Credential.class.getClassLoader(), Credential.class);
|
||||
mSlice = in.readTypedObject(Slice.CREATOR);
|
||||
mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
|
||||
mCredential = in.readTypedObject(Credential.CREATOR);
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<SaveEntry> CREATOR = new Creator<SaveEntry>() {
|
||||
@@ -65,9 +64,9 @@ public final class SaveEntry implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
mSlice.writeToParcel(dest, flags);
|
||||
mPendingIntent.writeToParcel(dest, flags);
|
||||
mCredential.writeToParcel(dest, flags);
|
||||
dest.writeTypedObject(mSlice, flags);
|
||||
dest.writeTypedObject(mPendingIntent, flags);
|
||||
dest.writeTypedObject(mCredential, flags);
|
||||
}
|
||||
|
||||
/* package-private */ SaveEntry(
|
||||
|
||||
Reference in New Issue
Block a user