diff options
| author | Mady Mellor <madym@google.com> | 2019-04-25 20:19:30 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-04-25 20:19:30 +0000 |
| commit | 7e36009dd06d57ee12beefff2edb13a36b6ba4da (patch) | |
| tree | 6ff0f88cfb25f61e660c29bb0bed0378385e9122 /core/java | |
| parent | 07deba3ce10587361fc4f2eded65548b0f80a4fd (diff) | |
| parent | 60101c9f298e69ee2b5ee5f67943515aae79b187 (diff) | |
Merge "Make lifecycle events for bubble activity views report normally" into qt-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ActivityView.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java index 0ccaf62d45b2..fc6fffabc917 100644 --- a/core/java/android/app/ActivityView.java +++ b/core/java/android/app/ActivityView.java @@ -255,6 +255,34 @@ public class ActivityView extends ViewGroup { } /** + * Launch a new activity into this container. + * <p>Activity resolved by the provided {@link PendingIntent} must have + * {@link android.R.attr#resizeableActivity} attribute set to {@code true} in order to be + * launched here. Also, if activity is not owned by the owner of this container, it must allow + * embedding and the caller must have permission to embed. + * <p>Note: This class must finish initializing and + * {@link StateCallback#onActivityViewReady(ActivityView)} callback must be triggered before + * this method can be called. + * + * @param pendingIntent Intent used to launch an activity. + * @param options options for the activity + * + * @see StateCallback + * @see #startActivity(Intent) + */ + public void startActivity(@NonNull PendingIntent pendingIntent, + @NonNull ActivityOptions options) { + options.setLaunchDisplayId(mVirtualDisplay.getDisplay().getDisplayId()); + try { + pendingIntent.send(null /* context */, 0 /* code */, null /* intent */, + null /* onFinished */, null /* handler */, null /* requiredPermission */, + options.toBundle()); + } catch (PendingIntent.CanceledException e) { + throw new RuntimeException(e); + } + } + + /** * Check if container is ready to launch and create {@link ActivityOptions} to target the * virtual display. */ |
