Email: Fix Email ClassCastException in monkey test
It's a fault to cast base class array(Parcelable[]) to
derived class array(Conversation[]), there is no inheritance
relationship between these two array types.
So cast every element of the Parcelable array to Conversation
type separately to avoid this exception.
Change-Id: I17f06b439853604ef5d4f25ee708d0896e03b69a
CRs-Fixed: 2248737
Issue: FP2P-518
(cherry picked from commit 23ae37b57d3a19f7e569363fbb7f57a6ec866cf6)
diff --git a/src/com/android/mail/ui/FolderSelectionDialog.java b/src/com/android/mail/ui/FolderSelectionDialog.java
index 0e1ea1c..920edb6 100644
--- a/src/com/android/mail/ui/FolderSelectionDialog.java
+++ b/src/com/android/mail/ui/FolderSelectionDialog.java
@@ -22,6 +22,7 @@
import android.app.DialogFragment;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
+import android.os.Parcelable;
import android.view.View;
import android.widget.AdapterView;
@@ -86,7 +87,8 @@
mCurrentFolder = args.getParcelable(ARG_FOLDER_TAG);
mAccount = args.getParcelable(ARG_ACCOUNT_TAG);
mBatch = args.getBoolean(ARG_BATCH_TAG);
- mTarget = Arrays.asList((Conversation[])args.getParcelableArray(ARG_TARGET_TAG));
+ Parcelable[] data = args.getParcelableArray(ARG_TARGET_TAG);
+ mTarget = Arrays.asList(Arrays.copyOf(data, data.length, Conversation[].class));
}
@Override