From 89aeda1b78907fefe259df770a01f490d4901128 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Thu, 28 May 2015 14:45:59 -0700 Subject: [PATCH] Guard against monkey actor test NPE inside FocusHelper b/19626762 Change-Id: Icaff5931f4076323855f23e7165b0e78a11241b6 --- src/com/android/launcher3/FocusHelper.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java index e607047188..0dca07843b 100644 --- a/src/com/android/launcher3/FocusHelper.java +++ b/src/com/android/launcher3/FocusHelper.java @@ -284,6 +284,12 @@ public class FocusHelper { if (workspace != null) { int pageIndex = workspace.getCurrentPage(); CellLayout topLayout = (CellLayout) workspace.getChildAt(pageIndex); + if (topLayout == null) { + // This is to guard against monkey actor test where the cell layout + // of the new pageIndex is null monkey issuing commands while + // animations happen. + return wasHandled; + } ShortcutAndWidgetContainer children = topLayout.getShortcutsAndWidgets(); final View newIcon = getIconInDirection(layout, children, -1, 1); // Select the first bubble text view in the current page of the workspace