summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sid Soundararajan <ssoundar@google.com> 2016-05-04 17:14:18 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-05-04 17:14:19 +0000
commit2ff157c027cb3eb5eddefa39617ec49aeb75a139 (patch)
tree2d108a405baaf6084cbcf9879dcb902129e6a660
parent69e0d8299460afeea1d33619b341937914a42839 (diff)
parent841fa8ad94c27794846905be3804ccc1f356bed6 (diff)
Merge "Add a null check for the thumbnail image for transition" into nyc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvTransitionHelper.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvTransitionHelper.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvTransitionHelper.java
index 812bff1b84a7..482115ed9b94 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvTransitionHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvTransitionHelper.java
@@ -103,6 +103,16 @@ public class RecentsTvTransitionHelper {
EventBus.getDefault().send(new LaunchTaskFailedEvent());
}
+ Rect taskRect = taskView.getFocusedThumbnailRect();
+ // Check both the rect and the thumbnail for null. The rect can be null if the user
+ // decides to disallow animations, so automatic scrolling does not happen properly.
+
+ // The thumbnail can be null if the app was partially launched on TV. In this case
+ // we do not override the transition.
+ if (taskRect == null || task.thumbnail == null) {
+ return;
+ }
+
IRemoteCallback.Stub callback = null;
if (animStartedListener != null) {
callback = new IRemoteCallback.Stub() {
@@ -120,14 +130,11 @@ public class RecentsTvTransitionHelper {
};
}
try {
- Rect taskRect = taskView.getFocusedThumbnailRect();
- if (taskRect != null) {
- Bitmap thumbnail = Bitmap.createScaledBitmap(task.thumbnail, taskRect.width(),
- taskRect.height(), false);
- WindowManagerGlobal.getWindowManagerService()
- .overridePendingAppTransitionAspectScaledThumb(thumbnail, taskRect.left,
- taskRect.top, taskRect.width(), taskRect.height(), callback, true);
- }
+ Bitmap thumbnail = Bitmap.createScaledBitmap(task.thumbnail, taskRect.width(),
+ taskRect.height(), false);
+ WindowManagerGlobal.getWindowManagerService()
+ .overridePendingAppTransitionAspectScaledThumb(thumbnail, taskRect.left,
+ taskRect.top, taskRect.width(), taskRect.height(), callback, true);
} catch (RemoteException e) {
Log.w(TAG, "Failed to override transition: " + e);
}