Merge "Sharesheet: be more defensive about un-unparcelable intents." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a1d1a38269
@@ -22,6 +22,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.os.BadParcelableException;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -109,17 +110,22 @@ public abstract class AbstractResolverComparator implements Comparator<ResolvedC
|
|||||||
|
|
||||||
// get annotations of content from intent.
|
// get annotations of content from intent.
|
||||||
private void getContentAnnotations(Intent intent) {
|
private void getContentAnnotations(Intent intent) {
|
||||||
ArrayList<String> annotations = intent.getStringArrayListExtra(
|
try {
|
||||||
Intent.EXTRA_CONTENT_ANNOTATIONS);
|
ArrayList<String> annotations = intent.getStringArrayListExtra(
|
||||||
if (annotations != null) {
|
Intent.EXTRA_CONTENT_ANNOTATIONS);
|
||||||
int size = annotations.size();
|
if (annotations != null) {
|
||||||
if (size > NUM_OF_TOP_ANNOTATIONS_TO_USE) {
|
int size = annotations.size();
|
||||||
size = NUM_OF_TOP_ANNOTATIONS_TO_USE;
|
if (size > NUM_OF_TOP_ANNOTATIONS_TO_USE) {
|
||||||
}
|
size = NUM_OF_TOP_ANNOTATIONS_TO_USE;
|
||||||
mAnnotations = new String[size];
|
}
|
||||||
for (int i = 0; i < size; i++) {
|
mAnnotations = new String[size];
|
||||||
mAnnotations[i] = annotations.get(i);
|
for (int i = 0; i < size; i++) {
|
||||||
|
mAnnotations[i] = annotations.get(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (BadParcelableException e) {
|
||||||
|
Log.i(TAG, "Couldn't unparcel intent annotations. Ignoring.");
|
||||||
|
mAnnotations = new String[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user