Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +10 −3 Original line number Diff line number Diff line Loading @@ -327,7 +327,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private final OverviewProxyListener mOverviewProxyListener = new OverviewProxyListener() { @Override public void onConnectionChanged(boolean isConnected) { mView.updateStates(); mView.onOverviewProxyConnectionChange( mOverviewProxyService.isEnabled(), mOverviewProxyService.shouldShowSwipeUpUI()); updateScreenPinningGestures(); } Loading Loading @@ -557,11 +558,10 @@ public class NavigationBar extends ViewController<NavigationBarView> implements @Override public void onInit() { // TODO: A great deal of this code should probalby live in onViewAttached. // TODO: A great deal of this code should probably live in onViewAttached. // It should also has corresponding cleanup in onViewDetached. mView.setTouchHandler(mTouchHandler); mView.setNavBarMode(mNavBarMode); mView.updateRotationButton(); mView.setVisibility( Loading Loading @@ -637,6 +637,12 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mView.setWindowVisible(isNavBarWindowVisible()); mView.setBehavior(mBehavior); mView.setNavBarMode(mNavBarMode); mView.setUpdateActiveTouchRegionsCallback( () -> mOverviewProxyService.onActiveNavBarRegionChanges( mView.getButtonLocations( true /* includeFloatingButtons */, true /* inScreen */, true /* useNearestRegion */))); mNavBarHelper.registerNavTaskStateUpdater(mNavbarTaskbarStateUpdater); Loading Loading @@ -697,6 +703,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements final RotationButtonController rotationButtonController = mView.getRotationButtonController(); rotationButtonController.setRotationCallback(null); mView.setUpdateActiveTouchRegionsCallback(null); mView.getBarTransitions().destroy(); mView.getLightTransitionsController().destroy(mContext); mOverviewProxyService.removeCallback(mOverviewProxyListener); Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java +33 −19 Original line number Diff line number Diff line Loading @@ -77,7 +77,6 @@ import com.android.systemui.navigationbar.buttons.KeyButtonDrawable; import com.android.systemui.navigationbar.buttons.NearestTouchFrame; import com.android.systemui.navigationbar.buttons.RotationContextButton; import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.recents.Recents; import com.android.systemui.shared.navigationbar.RegionSamplingHelper; import com.android.systemui.shared.rotation.FloatingRotationButton; Loading Loading @@ -142,7 +141,6 @@ public class NavigationBarView extends FrameLayout { private final DeadZone mDeadZone; private boolean mDeadZoneConsuming = false; private final NavigationBarTransitions mBarTransitions; private final OverviewProxyService mOverviewProxyService; @Nullable private AutoHideController mAutoHideController; Loading Loading @@ -198,6 +196,9 @@ public class NavigationBarView extends FrameLayout { */ private final boolean mImeCanRenderGesturalNavButtons = canImeRenderGesturalNavButtons(); private Gefingerpoken mTouchHandler; private boolean mOverviewProxyEnabled; private boolean mShowSwipeUpUi; private UpdateActiveTouchRegionsCallback mUpdateActiveTouchRegionsCallback; private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; Loading Loading @@ -364,8 +365,6 @@ public class NavigationBarView extends FrameLayout { R.drawable.ic_sysbar_rotate_button_cw_start_90, () -> getDisplay().getRotation()); mOverviewProxyService = Dependency.get(OverviewProxyService.class); mConfiguration = new Configuration(); mTmpLastConfiguration = new Configuration(); mConfiguration.updateFrom(context.getResources().getConfiguration()); Loading Loading @@ -562,7 +561,7 @@ public class NavigationBarView extends FrameLayout { } private boolean isQuickStepSwipeUpEnabled() { return mOverviewProxyService.shouldShowSwipeUpUI() && isOverviewEnabled(); return mShowSwipeUpUi && isOverviewEnabled(); } private void reloadNavIcons() { Loading Loading @@ -616,8 +615,7 @@ public class NavigationBarView extends FrameLayout { } public KeyButtonDrawable getHomeDrawable() { final boolean quickStepEnabled = mOverviewProxyService.shouldShowSwipeUpUI(); KeyButtonDrawable drawable = quickStepEnabled KeyButtonDrawable drawable = mShowSwipeUpUi ? getDrawable(R.drawable.ic_sysbar_home_quick_step) : getDrawable(R.drawable.ic_sysbar_home); orientHomeButton(drawable); Loading @@ -640,7 +638,7 @@ public class NavigationBarView extends FrameLayout { // Animate the back button's rotation to the new degrees and only in portrait move up the // back button to line up with the other buttons float targetY = !mOverviewProxyService.shouldShowSwipeUpUI() && !mIsVertical && useAltBack float targetY = !mShowSwipeUpUi && !mIsVertical && useAltBack ? - getResources().getDimension(R.dimen.navbar_back_button_ime_offset) : 0; ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable, Loading @@ -657,8 +655,7 @@ public class NavigationBarView extends FrameLayout { private @DrawableRes int chooseNavigationIconDrawableRes(@DrawableRes int icon, @DrawableRes int quickStepIcon) { final boolean quickStepEnabled = mOverviewProxyService.shouldShowSwipeUpUI(); return quickStepEnabled ? quickStepIcon : icon; return mShowSwipeUpUi ? quickStepIcon : icon; } private KeyButtonDrawable getDrawable(@DrawableRes int icon) { Loading Loading @@ -770,7 +767,7 @@ public class NavigationBarView extends FrameLayout { // recents buttons when disconnected from launcher service in screen pinning mode, // as they are used for exiting. final boolean pinningActive = ActivityManagerWrapper.getInstance().isScreenPinningActive(); if (mOverviewProxyService.isEnabled()) { if (mOverviewProxyEnabled) { // Force disable recents when not in legacy mode disableRecent |= !QuickStepContract.isLegacyMode(mNavBarMode); if (pinningActive && !QuickStepContract.isGesturalMode(mNavBarMode)) { Loading Loading @@ -891,9 +888,14 @@ public class NavigationBarView extends FrameLayout { } } public void updateStates() { final boolean showSwipeUpUI = mOverviewProxyService.shouldShowSwipeUpUI(); void onOverviewProxyConnectionChange(boolean enabled, boolean showSwipeUpUi) { mOverviewProxyEnabled = enabled; mShowSwipeUpUi = showSwipeUpUi; updateStates(); } /** */ public void updateStates() { if (mNavigationInflaterView != null) { // Reinflate the navbar if needed, no-op unless the swipe up state changes mNavigationInflaterView.onLikelyDefaultLayoutChange(); Loading @@ -902,9 +904,10 @@ public class NavigationBarView extends FrameLayout { updateSlippery(); reloadNavIcons(); updateNavButtonIcons(); WindowManagerWrapper.getInstance().setNavBarVirtualKeyHapticFeedbackEnabled(!showSwipeUpUI); WindowManagerWrapper.getInstance().setNavBarVirtualKeyHapticFeedbackEnabled( !mShowSwipeUpUi); getHomeButton().setAccessibilityDelegate( showSwipeUpUI ? mQuickStepAccessibilityDelegate : null); mShowSwipeUpUi ? mQuickStepAccessibilityDelegate : null); } /** Loading Loading @@ -1010,9 +1013,14 @@ public class NavigationBarView extends FrameLayout { * Notifies the overview service of the active touch regions. */ public void notifyActiveTouchRegions() { mOverviewProxyService.onActiveNavBarRegionChanges( getButtonLocations(true /* includeFloatingButtons */, true /* inScreen */, true /* useNearestRegion */)); if (mUpdateActiveTouchRegionsCallback != null) { mUpdateActiveTouchRegionsCallback.update(); } } void setUpdateActiveTouchRegionsCallback(UpdateActiveTouchRegionsCallback callback) { mUpdateActiveTouchRegionsCallback = callback; notifyActiveTouchRegions(); } private void updateButtonTouchRegionCache() { Loading @@ -1030,8 +1038,10 @@ public class NavigationBarView extends FrameLayout { * @param useNearestRegion Whether to use the nearest region instead of the actual button bounds * @return */ private Region getButtonLocations(boolean includeFloatingButtons, boolean inScreenSpace, Region getButtonLocations(boolean includeFloatingButtons, boolean inScreenSpace, boolean useNearestRegion) { // TODO: move this method to NavigationBar. // TODO: don't use member variables for temp storage like mTmpRegion. if (useNearestRegion && !inScreenSpace) { // We currently don't support getting the nearest region in anything but screen space useNearestRegion = false; Loading Loading @@ -1426,4 +1436,8 @@ public class NavigationBarView extends FrameLayout { mRegionSamplingHelper.stop(); } } interface UpdateActiveTouchRegionsCallback { void update(); } } Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +10 −3 Original line number Diff line number Diff line Loading @@ -327,7 +327,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private final OverviewProxyListener mOverviewProxyListener = new OverviewProxyListener() { @Override public void onConnectionChanged(boolean isConnected) { mView.updateStates(); mView.onOverviewProxyConnectionChange( mOverviewProxyService.isEnabled(), mOverviewProxyService.shouldShowSwipeUpUI()); updateScreenPinningGestures(); } Loading Loading @@ -557,11 +558,10 @@ public class NavigationBar extends ViewController<NavigationBarView> implements @Override public void onInit() { // TODO: A great deal of this code should probalby live in onViewAttached. // TODO: A great deal of this code should probably live in onViewAttached. // It should also has corresponding cleanup in onViewDetached. mView.setTouchHandler(mTouchHandler); mView.setNavBarMode(mNavBarMode); mView.updateRotationButton(); mView.setVisibility( Loading Loading @@ -637,6 +637,12 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mView.setWindowVisible(isNavBarWindowVisible()); mView.setBehavior(mBehavior); mView.setNavBarMode(mNavBarMode); mView.setUpdateActiveTouchRegionsCallback( () -> mOverviewProxyService.onActiveNavBarRegionChanges( mView.getButtonLocations( true /* includeFloatingButtons */, true /* inScreen */, true /* useNearestRegion */))); mNavBarHelper.registerNavTaskStateUpdater(mNavbarTaskbarStateUpdater); Loading Loading @@ -697,6 +703,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements final RotationButtonController rotationButtonController = mView.getRotationButtonController(); rotationButtonController.setRotationCallback(null); mView.setUpdateActiveTouchRegionsCallback(null); mView.getBarTransitions().destroy(); mView.getLightTransitionsController().destroy(mContext); mOverviewProxyService.removeCallback(mOverviewProxyListener); Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java +33 −19 Original line number Diff line number Diff line Loading @@ -77,7 +77,6 @@ import com.android.systemui.navigationbar.buttons.KeyButtonDrawable; import com.android.systemui.navigationbar.buttons.NearestTouchFrame; import com.android.systemui.navigationbar.buttons.RotationContextButton; import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.recents.Recents; import com.android.systemui.shared.navigationbar.RegionSamplingHelper; import com.android.systemui.shared.rotation.FloatingRotationButton; Loading Loading @@ -142,7 +141,6 @@ public class NavigationBarView extends FrameLayout { private final DeadZone mDeadZone; private boolean mDeadZoneConsuming = false; private final NavigationBarTransitions mBarTransitions; private final OverviewProxyService mOverviewProxyService; @Nullable private AutoHideController mAutoHideController; Loading Loading @@ -198,6 +196,9 @@ public class NavigationBarView extends FrameLayout { */ private final boolean mImeCanRenderGesturalNavButtons = canImeRenderGesturalNavButtons(); private Gefingerpoken mTouchHandler; private boolean mOverviewProxyEnabled; private boolean mShowSwipeUpUi; private UpdateActiveTouchRegionsCallback mUpdateActiveTouchRegionsCallback; private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; Loading Loading @@ -364,8 +365,6 @@ public class NavigationBarView extends FrameLayout { R.drawable.ic_sysbar_rotate_button_cw_start_90, () -> getDisplay().getRotation()); mOverviewProxyService = Dependency.get(OverviewProxyService.class); mConfiguration = new Configuration(); mTmpLastConfiguration = new Configuration(); mConfiguration.updateFrom(context.getResources().getConfiguration()); Loading Loading @@ -562,7 +561,7 @@ public class NavigationBarView extends FrameLayout { } private boolean isQuickStepSwipeUpEnabled() { return mOverviewProxyService.shouldShowSwipeUpUI() && isOverviewEnabled(); return mShowSwipeUpUi && isOverviewEnabled(); } private void reloadNavIcons() { Loading Loading @@ -616,8 +615,7 @@ public class NavigationBarView extends FrameLayout { } public KeyButtonDrawable getHomeDrawable() { final boolean quickStepEnabled = mOverviewProxyService.shouldShowSwipeUpUI(); KeyButtonDrawable drawable = quickStepEnabled KeyButtonDrawable drawable = mShowSwipeUpUi ? getDrawable(R.drawable.ic_sysbar_home_quick_step) : getDrawable(R.drawable.ic_sysbar_home); orientHomeButton(drawable); Loading @@ -640,7 +638,7 @@ public class NavigationBarView extends FrameLayout { // Animate the back button's rotation to the new degrees and only in portrait move up the // back button to line up with the other buttons float targetY = !mOverviewProxyService.shouldShowSwipeUpUI() && !mIsVertical && useAltBack float targetY = !mShowSwipeUpUi && !mIsVertical && useAltBack ? - getResources().getDimension(R.dimen.navbar_back_button_ime_offset) : 0; ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable, Loading @@ -657,8 +655,7 @@ public class NavigationBarView extends FrameLayout { private @DrawableRes int chooseNavigationIconDrawableRes(@DrawableRes int icon, @DrawableRes int quickStepIcon) { final boolean quickStepEnabled = mOverviewProxyService.shouldShowSwipeUpUI(); return quickStepEnabled ? quickStepIcon : icon; return mShowSwipeUpUi ? quickStepIcon : icon; } private KeyButtonDrawable getDrawable(@DrawableRes int icon) { Loading Loading @@ -770,7 +767,7 @@ public class NavigationBarView extends FrameLayout { // recents buttons when disconnected from launcher service in screen pinning mode, // as they are used for exiting. final boolean pinningActive = ActivityManagerWrapper.getInstance().isScreenPinningActive(); if (mOverviewProxyService.isEnabled()) { if (mOverviewProxyEnabled) { // Force disable recents when not in legacy mode disableRecent |= !QuickStepContract.isLegacyMode(mNavBarMode); if (pinningActive && !QuickStepContract.isGesturalMode(mNavBarMode)) { Loading Loading @@ -891,9 +888,14 @@ public class NavigationBarView extends FrameLayout { } } public void updateStates() { final boolean showSwipeUpUI = mOverviewProxyService.shouldShowSwipeUpUI(); void onOverviewProxyConnectionChange(boolean enabled, boolean showSwipeUpUi) { mOverviewProxyEnabled = enabled; mShowSwipeUpUi = showSwipeUpUi; updateStates(); } /** */ public void updateStates() { if (mNavigationInflaterView != null) { // Reinflate the navbar if needed, no-op unless the swipe up state changes mNavigationInflaterView.onLikelyDefaultLayoutChange(); Loading @@ -902,9 +904,10 @@ public class NavigationBarView extends FrameLayout { updateSlippery(); reloadNavIcons(); updateNavButtonIcons(); WindowManagerWrapper.getInstance().setNavBarVirtualKeyHapticFeedbackEnabled(!showSwipeUpUI); WindowManagerWrapper.getInstance().setNavBarVirtualKeyHapticFeedbackEnabled( !mShowSwipeUpUi); getHomeButton().setAccessibilityDelegate( showSwipeUpUI ? mQuickStepAccessibilityDelegate : null); mShowSwipeUpUi ? mQuickStepAccessibilityDelegate : null); } /** Loading Loading @@ -1010,9 +1013,14 @@ public class NavigationBarView extends FrameLayout { * Notifies the overview service of the active touch regions. */ public void notifyActiveTouchRegions() { mOverviewProxyService.onActiveNavBarRegionChanges( getButtonLocations(true /* includeFloatingButtons */, true /* inScreen */, true /* useNearestRegion */)); if (mUpdateActiveTouchRegionsCallback != null) { mUpdateActiveTouchRegionsCallback.update(); } } void setUpdateActiveTouchRegionsCallback(UpdateActiveTouchRegionsCallback callback) { mUpdateActiveTouchRegionsCallback = callback; notifyActiveTouchRegions(); } private void updateButtonTouchRegionCache() { Loading @@ -1030,8 +1038,10 @@ public class NavigationBarView extends FrameLayout { * @param useNearestRegion Whether to use the nearest region instead of the actual button bounds * @return */ private Region getButtonLocations(boolean includeFloatingButtons, boolean inScreenSpace, Region getButtonLocations(boolean includeFloatingButtons, boolean inScreenSpace, boolean useNearestRegion) { // TODO: move this method to NavigationBar. // TODO: don't use member variables for temp storage like mTmpRegion. if (useNearestRegion && !inScreenSpace) { // We currently don't support getting the nearest region in anything but screen space useNearestRegion = false; Loading Loading @@ -1426,4 +1436,8 @@ public class NavigationBarView extends FrameLayout { mRegionSamplingHelper.stop(); } } interface UpdateActiveTouchRegionsCallback { void update(); } }