From a5612a0ccca1fd5157b350d15acad9e809f9e1d0 Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Wed, 17 Jan 2018 12:28:41 -0800 Subject: [PATCH] Fixes null error for quick scrub when there is no home button Change-Id: I60c43009681d3e81442150f3c756eaa191619a67 Fixes: 72094006 Test: manual --- .../systemui/statusbar/phone/QuickScrubController.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java index 9f8a7efa04f3..161fc2922b84 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java @@ -294,12 +294,14 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene // Get the touch rect of the home button location View homeView = mNavigationBarView.getHomeButton().getCurrentView(); - int[] globalHomePos = homeView.getLocationOnScreen(); - int[] globalNavBarPos = mNavigationBarView.getLocationOnScreen(); - int homeX = globalHomePos[0] - globalNavBarPos[0]; - int homeY = globalHomePos[1] - globalNavBarPos[1]; - mHomeButtonRect.set(homeX, homeY, homeX + homeView.getMeasuredWidth(), - homeY + homeView.getMeasuredHeight()); + if (homeView != null) { + int[] globalHomePos = homeView.getLocationOnScreen(); + int[] globalNavBarPos = mNavigationBarView.getLocationOnScreen(); + int homeX = globalHomePos[0] - globalNavBarPos[0]; + int homeY = globalHomePos[1] - globalNavBarPos[1]; + mHomeButtonRect.set(homeX, homeY, homeX + homeView.getMeasuredWidth(), + homeY + homeView.getMeasuredHeight()); + } } @Override -- 2.11.0