diff options
| author | Chad Brubaker <cbrubaker@google.com> | 2017-04-06 09:43:47 -0700 |
|---|---|---|
| committer | Chad Brubaker <cbrubaker@google.com> | 2017-04-26 14:01:48 -0700 |
| commit | 0606861de50995e997d7c117e3bab1eb5db06da8 (patch) | |
| tree | 8ebbadd9099f076bf41651df4bfaa1c0a0aa58cf /core/java/android/app/ActivityOptions.java | |
| parent | 9098a0260f43e89165783089e025f5fd51da78f3 (diff) | |
Allow apps to provide the Instant App installer extra information
Apps may want to provide additional context information to the instant
app installer in order to allow the installer to make smarter choices
about the context of the launch. This CL adds a bundle to
ActivityOptions that is sent to the Installer (if an Instant App is
launched) but not to any other application if something else on the
device handles the Intent instead.
Bug: 35180854
Test: manual
Change-Id: Ifc69a420a9c68041b39acd8a4b83db8a789822a6
Diffstat (limited to 'core/java/android/app/ActivityOptions.java')
| -rw-r--r-- | core/java/android/app/ActivityOptions.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index 63e8cc641ce9..3eec596fcb17 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -211,6 +211,9 @@ public class ActivityOptions { private static final String KEY_USAGE_TIME_REPORT = "android:activity.usageTimeReport"; private static final String KEY_ROTATION_ANIMATION_HINT = "android:activity.rotationAnimationHint"; + private static final String KEY_INSTANT_APP_VERIFICATION_BUNDLE + = "android:instantapps.installerbundle"; + /** @hide */ public static final int ANIM_NONE = 0; /** @hide */ @@ -264,6 +267,7 @@ public class ActivityOptions { private boolean mTaskOverlayCanResume; private AppTransitionAnimationSpec mAnimSpecs[]; private int mRotationAnimationHint = -1; + private Bundle mAppVerificationBundle; /** * Create an ActivityOptions specifying a custom animation to run when @@ -886,6 +890,7 @@ public class ActivityOptions { opts.getBinder(KEY_ANIMATION_FINISHED_LISTENER)); } mRotationAnimationHint = opts.getInt(KEY_ROTATION_ANIMATION_HINT); + mAppVerificationBundle = opts.getBundle(KEY_INSTANT_APP_VERIFICATION_BUNDLE); } /** @@ -1275,6 +1280,9 @@ public class ActivityOptions { b.putBinder(KEY_ANIMATION_FINISHED_LISTENER, mAnimationFinishedListener.asBinder()); } b.putInt(KEY_ROTATION_ANIMATION_HINT, mRotationAnimationHint); + if (mAppVerificationBundle != null) { + b.putBundle(KEY_INSTANT_APP_VERIFICATION_BUNDLE, mAppVerificationBundle); + } return b; } @@ -1342,6 +1350,30 @@ public class ActivityOptions { mRotationAnimationHint = hint; } + /** + * Pop the extra verification bundle for the installer. + * This removes the bundle from the ActivityOptions to make sure the installer bundle + * is only available once. + * @hide + */ + public Bundle popAppVerificationBundle() { + Bundle out = mAppVerificationBundle; + mAppVerificationBundle = null; + return out; + } + + /** + * Set the {@link Bundle} that is provided to the app installer for additional verification + * if the call to {@link Context#startActivity} results in an app being installed. + * + * This Bundle is not provided to any other app besides the installer. + */ + public ActivityOptions setAppVerificationBundle(Bundle bundle) { + mAppVerificationBundle = bundle; + return this; + + } + /** @hide */ @Override public String toString() { |
