diff --git a/api/current.txt b/api/current.txt index 23b0395cca8d9..4369bf08452d9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28633,10 +28633,10 @@ package android.service.carrier { package android.service.chooser { public final class ChooserTarget implements android.os.Parcelable { - ctor public ChooserTarget(java.lang.CharSequence, android.graphics.Bitmap, float, android.app.PendingIntent); - ctor public ChooserTarget(java.lang.CharSequence, android.graphics.Bitmap, float, android.content.IntentSender); + ctor public ChooserTarget(java.lang.CharSequence, android.graphics.drawable.Icon, float, android.app.PendingIntent); + ctor public ChooserTarget(java.lang.CharSequence, android.graphics.drawable.Icon, float, android.content.IntentSender); method public int describeContents(); - method public android.graphics.Bitmap getIcon(); + method public android.graphics.drawable.Icon getIcon(); method public android.content.IntentSender getIntentSender(); method public float getScore(); method public java.lang.CharSequence getTitle(); diff --git a/api/system-current.txt b/api/system-current.txt index bc47229fba1b7..8cf81e9ca5ea7 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30656,10 +30656,10 @@ package android.service.carrier { package android.service.chooser { public final class ChooserTarget implements android.os.Parcelable { - ctor public ChooserTarget(java.lang.CharSequence, android.graphics.Bitmap, float, android.app.PendingIntent); - ctor public ChooserTarget(java.lang.CharSequence, android.graphics.Bitmap, float, android.content.IntentSender); + ctor public ChooserTarget(java.lang.CharSequence, android.graphics.drawable.Icon, float, android.app.PendingIntent); + ctor public ChooserTarget(java.lang.CharSequence, android.graphics.drawable.Icon, float, android.content.IntentSender); method public int describeContents(); - method public android.graphics.Bitmap getIcon(); + method public android.graphics.drawable.Icon getIcon(); method public android.content.IntentSender getIntentSender(); method public float getScore(); method public java.lang.CharSequence getTitle(); diff --git a/core/java/android/service/chooser/ChooserTarget.java b/core/java/android/service/chooser/ChooserTarget.java index 4c94ee7ca23c2..50c435a90d1ca 100644 --- a/core/java/android/service/chooser/ChooserTarget.java +++ b/core/java/android/service/chooser/ChooserTarget.java @@ -25,6 +25,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.graphics.Bitmap; +import android.graphics.drawable.Icon; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; @@ -34,6 +35,16 @@ import android.util.Log; /** * A ChooserTarget represents a deep-link into an application as returned by a * {@link android.service.chooser.ChooserTargetService}. + * + *
A chooser target represents a specific deep link target into an application exposed + * for selection by the user. This might be a frequently emailed contact, a recently active + * group messaging conversation, a folder in a cloud storage app, a collection of related + * items published on a social media service or any other contextually relevant grouping + * of target app + relevant metadata.
+ * + *Creators of chooser targets should consult the relevant design guidelines for the type + * of target they are presenting. For example, targets involving people should be presented + * with a circular icon.
*/ public final class ChooserTarget implements Parcelable { private static final String TAG = "ChooserTarget"; @@ -48,7 +59,7 @@ public final class ChooserTarget implements Parcelable { * The icon that will be shown to the user to represent this target. * The system may resize this icon as appropriate. */ - private Bitmap mIcon; + private Icon mIcon; /** * The IntentSender that will be used to deliver the intent to the target. @@ -93,7 +104,7 @@ public final class ChooserTarget implements Parcelable { * @param score ranking score for this target between 0.0f and 1.0f, inclusive * @param pendingIntent PendingIntent to fill in and send if the user chooses this target */ - public ChooserTarget(CharSequence title, Bitmap icon, float score, + public ChooserTarget(CharSequence title, Icon icon, float score, PendingIntent pendingIntent) { this(title, icon, score, pendingIntent.getIntentSender()); } @@ -129,7 +140,7 @@ public final class ChooserTarget implements Parcelable { * @param score ranking score for this target between 0.0f and 1.0f, inclusive * @param intentSender IntentSender to fill in and send if the user chooses this target */ - public ChooserTarget(CharSequence title, Bitmap icon, float score, IntentSender intentSender) { + public ChooserTarget(CharSequence title, Icon icon, float score, IntentSender intentSender) { mTitle = title; mIcon = icon; if (score > 1.f || score < 0.f) { @@ -143,7 +154,7 @@ public final class ChooserTarget implements Parcelable { ChooserTarget(Parcel in) { mTitle = in.readCharSequence(); if (in.readInt() != 0) { - mIcon = Bitmap.CREATOR.createFromParcel(in); + mIcon = Icon.CREATOR.createFromParcel(in); } else { mIcon = null; } @@ -167,7 +178,7 @@ public final class ChooserTarget implements Parcelable { * * @return the icon representing this target, intended to be shown to a user */ - public Bitmap getIcon() { + public Icon getIcon() { return mIcon; } diff --git a/core/java/android/service/chooser/ChooserTargetService.java b/core/java/android/service/chooser/ChooserTargetService.java index 699bd0a4f97eb..0d1834a50b444 100644 --- a/core/java/android/service/chooser/ChooserTargetService.java +++ b/core/java/android/service/chooser/ChooserTargetService.java @@ -107,7 +107,7 @@ public abstract class ChooserTargetService extends Service { *The returned list should be sorted such that the most relevant targets appear first. * Any PendingIntents used to construct the resulting ChooserTargets should always be prepared * to have the relevant data fields filled in by the sender. See - * {@link ChooserTarget#ChooserTarget(CharSequence, android.graphics.Bitmap, float, android.app.PendingIntent) ChooserTarget}.
+ * {@link ChooserTarget#ChooserTarget(CharSequence, android.graphics.drawable.Icon, float, android.app.PendingIntent) ChooserTarget}. * *Important: Calls to this method from other applications will occur on
* a binder thread, not on your app's main thread. Make sure that access to relevant data
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 83fa967e5ca87..ea18c12a38ec8 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -29,8 +29,8 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.database.DataSetObserver;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -51,10 +51,8 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
-import android.widget.LinearLayout;
import android.widget.ListView;
import com.android.internal.R;
@@ -74,6 +72,8 @@ public class ChooserActivity extends ResolverActivity {
private IntentSender mRefinementIntentSender;
private RefinementResultReceiver mRefinementResultReceiver;
+ private Intent mReferrerFillInIntent;
+
private ChooserListAdapter mChooserListAdapter;
private final List