From 87168ca1f7fc0cbf0f708990b78211c5e5e3b358 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 1 Jun 2018 12:49:28 -0700 Subject: [PATCH] Skip logging if device profile is not initialized Since recentsAnimation and animationCancel come on the event queue, we may skip recentsAnimation and only process animationCancel if they happen too close to each other, before the first event is scheduled on eventQueue. As a result deviceProfile is never initialized. Prevent crash by skipping logging in this case, we shouldn't be logging it anyway Bug: 80515833 Change-Id: Ife1d6009bcdc34af6c281d848665145cd235fa40 --- .../quickstep/WindowTransformSwipeHandler.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java index 28062cfccc..c94174b35e 100644 --- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -683,15 +683,20 @@ public class WindowTransformSwipeHandler { } private void doLogGesture(boolean toLauncher) { + DeviceProfile dp = mDp; + if (dp == null) { + // We probably never received an animation controller, skip logging. + return; + } final int direction; - if (mDp.isVerticalBarLayout()) { - direction = (mDp.isSeascape() ^ toLauncher) ? Direction.LEFT : Direction.RIGHT; + if (dp.isVerticalBarLayout()) { + direction = (dp.isSeascape() ^ toLauncher) ? Direction.LEFT : Direction.RIGHT; } else { direction = toLauncher ? Direction.UP : Direction.DOWN; } int dstContainerType = toLauncher ? ContainerType.TASKSWITCHER : ContainerType.APP; - UserEventDispatcher.newInstance(mContext, mDp).logStateChangeAction( + UserEventDispatcher.newInstance(mContext, dp).logStateChangeAction( mLogAction, direction, ContainerType.NAVBAR, ContainerType.APP, dstContainerType,