OSDN Git Service

Fixes null error for quick scrub when there is no home button
authorMatthew Ng <ngmatthew@google.com>
Wed, 17 Jan 2018 20:28:41 +0000 (12:28 -0800)
committerMatthew Ng <ngmatthew@google.com>
Wed, 17 Jan 2018 20:28:41 +0000 (12:28 -0800)
Change-Id: I60c43009681d3e81442150f3c756eaa191619a67
Fixes: 72094006
Test: manual

packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java

index 9f8a7ef..161fc29 100644 (file)
@@ -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