diff options
Diffstat (limited to 'java/src')
| -rw-r--r-- | java/src/com/android/intentresolver/chooser/SelectableTargetInfo.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/java/src/com/android/intentresolver/chooser/SelectableTargetInfo.java b/java/src/com/android/intentresolver/chooser/SelectableTargetInfo.java index e8847edc..74c19e67 100644 --- a/java/src/com/android/intentresolver/chooser/SelectableTargetInfo.java +++ b/java/src/com/android/intentresolver/chooser/SelectableTargetInfo.java @@ -195,13 +195,13 @@ public final class SelectableTargetInfo extends ChooserTargetInfo { mResolvedComponentName = getResolvedComponentName(mSourceInfo, mBackupResolveInfo); - mAllSourceIntents = getAllSourceIntents(sourceInfo); - mBaseIntentToSend = getBaseIntentToSend( baseIntentToSend, mResolvedIntent, mReferrerFillInIntent); + mAllSourceIntents = getAllSourceIntents(sourceInfo, mBaseIntentToSend); + mHashProvider = context -> { final String plaintext = getChooserTargetComponentName().getPackageName() @@ -395,12 +395,24 @@ public final class SelectableTargetInfo extends ChooserTargetInfo { return sb.toString(); } - private static List<Intent> getAllSourceIntents(@Nullable DisplayResolveInfo sourceInfo) { + private static List<Intent> getAllSourceIntents( + @Nullable DisplayResolveInfo sourceInfo, Intent fallbackSourceIntent) { final List<Intent> results = new ArrayList<>(); if (sourceInfo != null) { results.addAll(sourceInfo.getAllSourceIntents()); + } else { + // This target wasn't joined to a `DisplayResolveInfo` result from our intent-resolution + // step, so it was provided directly by the caller. We don't support alternate intents + // in this case, but we still permit refinement of the intent we'll dispatch; e.g., + // clients may use this hook to defer the computation of "lazy" extras in their share + // payload. Note this accommodation isn't strictly "necessary" because clients could + // always implement equivalent behavior by pointing custom targets back at their own app + // for any amount of further refinement/modification outside of the Sharesheet flow; + // nevertheless, it's offered as a convenience for clients who may expect their normal + // refinement logic to apply equally in the case of these "special targets." + results.add(fallbackSourceIntent); } - return results; // TODO: just use our own intent if there's no sourceInfo? + return results; } private static ComponentName getResolvedComponentName( |