diff options
| author | Chong Zhang <chz@google.com> | 2015-08-31 15:17:21 -0700 |
|---|---|---|
| committer | Chong Zhang <chz@google.com> | 2015-09-03 18:23:21 -0700 |
| commit | 0fa656b95256b7ad6d3dce287107a79ace3abdb8 (patch) | |
| tree | bf49a2ae2ef313ba40b8707bb0cf746117dffaec /core/java/android | |
| parent | ed76be0caa79d293446a983a5fdb27446087265c (diff) | |
Allow apps to pass in launch bounds when moving/starting a task
Pass in bounds via ActivityOptions for moveTaskToFront and
startActivityFromRecents. Allow bounds to be overriden by rects
in starting intents.
Set bounds to null in RecentsView for full screen layout.
Change-Id: I0ff79fd75068f4ba82d5e2c0a21881fabebdadb8
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/ActivityOptions.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index 2406985c411a..933f98d968dc 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -19,6 +19,7 @@ package android.app; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; +import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; import android.os.IRemoteCallback; @@ -59,6 +60,13 @@ public class ActivityOptions { public static final String KEY_PACKAGE_NAME = "android:activity.packageName"; /** + * The bounds that the activity should be started in. Set to null explicitly + * for full screen. If the key is not found, previous bounds will be preserved. + * @hide + */ + public static final String KEY_BOUNDS = "android:activity.bounds"; + + /** * Type of animation that arguments specify. * @hide */ @@ -163,6 +171,8 @@ public class ActivityOptions { public static final int ANIM_CLIP_REVEAL = 11; private String mPackageName; + private boolean mHasBounds; + private Rect mBounds; private int mAnimationType = ANIM_NONE; private int mCustomEnterResId; private int mCustomExitResId; @@ -631,6 +641,10 @@ public class ActivityOptions { } catch (RuntimeException e) { Slog.w(TAG, e); } + mHasBounds = opts.containsKey(KEY_BOUNDS); + if (mHasBounds) { + mBounds = opts.getParcelable(KEY_BOUNDS); + } mAnimationType = opts.getInt(KEY_ANIM_TYPE); switch (mAnimationType) { case ANIM_CUSTOM: @@ -677,11 +691,28 @@ public class ActivityOptions { } /** @hide */ + public ActivityOptions setBounds(Rect bounds) { + mHasBounds = true; + mBounds = bounds; + return this; + } + + /** @hide */ public String getPackageName() { return mPackageName; } /** @hide */ + public boolean hasBounds() { + return mHasBounds; + } + + /** @hide */ + public Rect getBounds(){ + return mBounds; + } + + /** @hide */ public int getAnimationType() { return mAnimationType; } @@ -867,6 +898,9 @@ public class ActivityOptions { if (mPackageName != null) { b.putString(KEY_PACKAGE_NAME, mPackageName); } + if (mHasBounds) { + b.putParcelable(KEY_BOUNDS, mBounds); + } b.putInt(KEY_ANIM_TYPE, mAnimationType); if (mUsageTimeReport != null) { b.putParcelable(KEY_USAGE_TIME_REPORT, mUsageTimeReport); |
