diff options
author | Winson Chung <winsonc@google.com> | 2014-03-21 01:14:07 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-21 01:14:07 +0000 |
commit | dd1b145158a8c3ea269347c614814631297e7acd (patch) | |
tree | b75a95ed8d3c6c26c6207c18298bacbb38f13aae /packages | |
parent | 0bfae1063a9db09338dd87c3656445b439da5898 (diff) | |
parent | c620bafde865f7599401f5adf0521820ee9d4a9c (diff) | |
download | frameworks_base-dd1b145158a8c3ea269347c614814631297e7acd.zip frameworks_base-dd1b145158a8c3ea269347c614814631297e7acd.tar.gz frameworks_base-dd1b145158a8c3ea269347c614814631297e7acd.tar.bz2 |
Merge "Catching case where the activity we are launching from Recents no longer exists."
Diffstat (limited to 'packages')
-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, |