Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback // If the button will actually become visible and the navbar is about to hide, // tell the statusbar to keep it around for longer mAutoHideController.touchAutoHide(); mNavigationBarView.notifyActiveTouchRegions(); } }; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +19 −34 Original line number Diff line number Diff line Loading @@ -113,12 +113,8 @@ public class NavigationBarView extends FrameLayout implements int mNavigationIconHints = 0; private int mNavBarMode; private Rect mHomeButtonBounds = new Rect(); private Rect mBackButtonBounds = new Rect(); private Rect mRecentsButtonBounds = new Rect(); private Rect mRotationButtonBounds = new Rect(); private final Region mActiveRegion = new Region(); private int[] mTmpPosition = new int[2]; private Rect mTmpBounds = new Rect(); private KeyButtonDrawable mBackIcon; private KeyButtonDrawable mHomeDefaultIcon; Loading Loading @@ -709,6 +705,7 @@ public class NavigationBarView extends FrameLayout implements getHomeButton().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); getHomeHandle().setVisibility(disableHomeHandle ? View.INVISIBLE : View.VISIBLE); notifyActiveTouchRegions(); } @VisibleForTesting Loading Loading @@ -927,42 +924,30 @@ public class NavigationBarView extends FrameLayout implements protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); notifyActiveTouchRegions(); mRecentsOnboarding.setNavBarHeight(getMeasuredHeight()); } /** * Notifies the overview service of the active touch regions. */ public void notifyActiveTouchRegions() { mActiveRegion.setEmpty(); updateButtonLocation(getBackButton(), mBackButtonBounds, true); updateButtonLocation(getHomeButton(), mHomeButtonBounds, false); updateButtonLocation(getRecentsButton(), mRecentsButtonBounds, false); updateButtonLocation(getRotateSuggestionButton(), mRotationButtonBounds, true); // TODO: Handle button visibility changes updateButtonLocation(getBackButton()); updateButtonLocation(getHomeButton()); updateButtonLocation(getRecentsButton()); updateButtonLocation(getRotateSuggestionButton()); mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion); mRecentsOnboarding.setNavBarHeight(getMeasuredHeight()); } private void updateButtonLocation(ButtonDispatcher button, Rect buttonBounds, boolean isActive) { private void updateButtonLocation(ButtonDispatcher button) { View view = button.getCurrentView(); if (view == null) { buttonBounds.setEmpty(); if (view == null || !button.isVisible()) { return; } // Temporarily reset the translation back to origin to get the position in window final float posX = view.getTranslationX(); final float posY = view.getTranslationY(); view.setTranslationX(0); view.setTranslationY(0); if (isActive) { view.getLocationOnScreen(mTmpPosition); buttonBounds.set(mTmpPosition[0], mTmpPosition[1], mTmpPosition[0] + view.getMeasuredWidth(), mTmpPosition[1] + view.getMeasuredHeight()); mActiveRegion.op(buttonBounds, Op.UNION); } view.getLocationInWindow(mTmpPosition); buttonBounds.set(mTmpPosition[0], mTmpPosition[1], mTmpPosition[0] + view.getMeasuredWidth(), mTmpPosition[1] + view.getMeasuredHeight()); view.setTranslationX(posX); view.setTranslationY(posY); view.getBoundsOnScreen(mTmpBounds); mActiveRegion.op(mTmpBounds, Op.UNION); } private void updateOrientationViews() { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback // If the button will actually become visible and the navbar is about to hide, // tell the statusbar to keep it around for longer mAutoHideController.touchAutoHide(); mNavigationBarView.notifyActiveTouchRegions(); } }; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +19 −34 Original line number Diff line number Diff line Loading @@ -113,12 +113,8 @@ public class NavigationBarView extends FrameLayout implements int mNavigationIconHints = 0; private int mNavBarMode; private Rect mHomeButtonBounds = new Rect(); private Rect mBackButtonBounds = new Rect(); private Rect mRecentsButtonBounds = new Rect(); private Rect mRotationButtonBounds = new Rect(); private final Region mActiveRegion = new Region(); private int[] mTmpPosition = new int[2]; private Rect mTmpBounds = new Rect(); private KeyButtonDrawable mBackIcon; private KeyButtonDrawable mHomeDefaultIcon; Loading Loading @@ -709,6 +705,7 @@ public class NavigationBarView extends FrameLayout implements getHomeButton().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); getHomeHandle().setVisibility(disableHomeHandle ? View.INVISIBLE : View.VISIBLE); notifyActiveTouchRegions(); } @VisibleForTesting Loading Loading @@ -927,42 +924,30 @@ public class NavigationBarView extends FrameLayout implements protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); notifyActiveTouchRegions(); mRecentsOnboarding.setNavBarHeight(getMeasuredHeight()); } /** * Notifies the overview service of the active touch regions. */ public void notifyActiveTouchRegions() { mActiveRegion.setEmpty(); updateButtonLocation(getBackButton(), mBackButtonBounds, true); updateButtonLocation(getHomeButton(), mHomeButtonBounds, false); updateButtonLocation(getRecentsButton(), mRecentsButtonBounds, false); updateButtonLocation(getRotateSuggestionButton(), mRotationButtonBounds, true); // TODO: Handle button visibility changes updateButtonLocation(getBackButton()); updateButtonLocation(getHomeButton()); updateButtonLocation(getRecentsButton()); updateButtonLocation(getRotateSuggestionButton()); mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion); mRecentsOnboarding.setNavBarHeight(getMeasuredHeight()); } private void updateButtonLocation(ButtonDispatcher button, Rect buttonBounds, boolean isActive) { private void updateButtonLocation(ButtonDispatcher button) { View view = button.getCurrentView(); if (view == null) { buttonBounds.setEmpty(); if (view == null || !button.isVisible()) { return; } // Temporarily reset the translation back to origin to get the position in window final float posX = view.getTranslationX(); final float posY = view.getTranslationY(); view.setTranslationX(0); view.setTranslationY(0); if (isActive) { view.getLocationOnScreen(mTmpPosition); buttonBounds.set(mTmpPosition[0], mTmpPosition[1], mTmpPosition[0] + view.getMeasuredWidth(), mTmpPosition[1] + view.getMeasuredHeight()); mActiveRegion.op(buttonBounds, Op.UNION); } view.getLocationInWindow(mTmpPosition); buttonBounds.set(mTmpPosition[0], mTmpPosition[1], mTmpPosition[0] + view.getMeasuredWidth(), mTmpPosition[1] + view.getMeasuredHeight()); view.setTranslationX(posX); view.setTranslationY(posY); view.getBoundsOnScreen(mTmpBounds); mActiveRegion.op(mTmpBounds, Op.UNION); } private void updateOrientationViews() { Loading