diff options
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java | 9 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java | 20 |
2 files changed, 20 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java index ed981ed..3d47cb6 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java @@ -18,6 +18,7 @@ package com.android.systemui.recents; import android.content.Context; import android.content.res.Configuration; +import android.content.res.Resources; import android.graphics.Rect; import android.util.DisplayMetrics; import android.util.TypedValue; @@ -31,6 +32,7 @@ public class RecentsConfiguration { DisplayMetrics mDisplayMetrics; public Rect systemInsets = new Rect(); + public Rect displayRect = new Rect(); /** Private constructor */ private RecentsConfiguration() {} @@ -51,10 +53,11 @@ public class RecentsConfiguration { /** Updates the state, given the specified context */ void update(Context context) { - mDisplayMetrics = context.getResources().getDisplayMetrics(); + Resources res = context.getResources(); + DisplayMetrics dm = res.getDisplayMetrics(); + mDisplayMetrics = dm; - boolean isPortrait = context.getResources().getConfiguration().orientation == - Configuration.ORIENTATION_PORTRAIT; + displayRect.set(0, 0, dm.widthPixels, dm.heightPixels); } public void updateSystemInsets(Rect insets) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index 77b78f3..d997222 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -17,6 +17,7 @@ package com.android.systemui.recents.views; import android.app.ActivityOptions; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -210,11 +211,14 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV int offsetX = 0; int offsetY = 0; if (tv == null) { - // Launch the activity + // If there is no actual task view, then use the stack view as the source view + // and then offset to the expected transform rect, but bound this to just + // outside the display rect (to ensure we don't animate from too far away) + RecentsConfiguration config = RecentsConfiguration.getInstance(); sourceView = stackView; transform = stackView.getStackTransform(stack.indexOfTask(task)); offsetX = transform.rect.left; - offsetY = transform.rect.top; + offsetY = Math.min(transform.rect.top, config.displayRect.height()); } else { transform = stackView.getStackTransform(stack.indexOfTask(task)); } @@ -242,10 +246,14 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV i.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK); - if (opts != null) { - getContext().startActivityAsUser(i, opts.toBundle(), UserHandle.CURRENT); - } else { - getContext().startActivityAsUser(i, UserHandle.CURRENT); + try { + if (opts != null) { + getContext().startActivityAsUser(i, opts.toBundle(), UserHandle.CURRENT); + } else { + getContext().startActivityAsUser(i, UserHandle.CURRENT); + } + } catch (ActivityNotFoundException anfe) { + Console.logError(getContext(), "Could not start Activity"); } Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask, |