Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +9 −1 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener; import android.view.inputmethod.InputMethodManager; import androidx.annotation.VisibleForTesting; Loading Loading @@ -1175,6 +1176,9 @@ public class NavigationBar implements View.OnAttachStateChangeListener, accessibilityButton.setOnLongClickListener(this::onAccessibilityLongClick); updateAccessibilityServicesState(mAccessibilityManager); ButtonDispatcher imeSwitcherButton = mNavigationBarView.getImeSwitchButton(); imeSwitcherButton.setOnClickListener(this::onImeSwitcherClick); updateScreenPinningGestures(); } Loading Loading @@ -1274,6 +1278,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener, mCommandQueue.toggleRecentApps(); } private void onImeSwitcherClick(View v) { mContext.getSystemService(InputMethodManager.class).showInputMethodPickerFromSystem( true /* showAuxiliarySubtypes */, mDisplayId); }; private boolean onLongPressBackHome(View v) { return onLongPressNavigationButtons(v, R.id.back, R.id.home); } Loading @@ -1282,7 +1291,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener, return onLongPressNavigationButtons(v, R.id.back, R.id.recent_apps); } /** * This handles long-press of both back and recents/home. Back is the common button with * combination of recents if it is visible or home if recents is invisible. Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java +3 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,9 @@ public class NavigationBarController implements Callbacks, @Override public void onNavigationModeChanged(int mode) { if (mNavMode == mode) { return; } final int oldMode = mNavMode; mNavMode = mode; mHandler.post(() -> { Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java +0 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,6 @@ public class NavigationBarInflaterView extends FrameLayout } public void onLikelyDefaultLayoutChange() { // Reevaluate new layout final String newValue = getDefaultLayout(); if (!Objects.equals(mCurrentLayout, newValue)) { Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java +26 −20 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ public class NavigationBarView extends FrameLayout implements private NavigationBarInflaterView mNavigationInflaterView; private RecentsOnboarding mRecentsOnboarding; private NotificationPanelViewController mPanelView; private RotationContextButton mRotationContextButton; private FloatingRotationButton mFloatingRotationButton; private RotationButtonController mRotationButtonController; private NavigationBarOverlayController mNavBarOverlayController; Loading Loading @@ -233,14 +234,6 @@ public class NavigationBarView extends FrameLayout implements } } private final OnClickListener mImeSwitcherClickListener = new OnClickListener() { @Override public void onClick(View view) { mContext.getSystemService(InputMethodManager.class).showInputMethodPickerFromSystem( true /* showAuxiliarySubtypes */, getContext().getDisplayId()); } }; private final AccessibilityDelegate mQuickStepAccessibilityDelegate = new AccessibilityDelegate() { private AccessibilityAction mToggleOverviewAction; Loading Loading @@ -311,32 +304,26 @@ public class NavigationBarView extends FrameLayout implements mIsVertical = false; mLongClickableAccessibilityButton = false; mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this); boolean isGesturalMode = isGesturalMode(mNavBarMode); mSysUiFlagContainer = Dependency.get(SysUiState.class); // Set up the context group of buttons mContextualButtonGroup = new ContextualButtonGroup(R.id.menu_container); final ContextualButton imeSwitcherButton = new ContextualButton(R.id.ime_switcher, mLightContext, R.drawable.ic_ime_switcher_default); final RotationContextButton rotateSuggestionButton = new RotationContextButton( R.id.rotate_suggestion, mLightContext, R.drawable.ic_sysbar_rotate_button_ccw_start_0); final ContextualButton accessibilityButton = new ContextualButton(R.id.accessibility_button, mLightContext, R.drawable.ic_sysbar_accessibility_button); mContextualButtonGroup.addButton(imeSwitcherButton); if (!isGesturalMode) { mContextualButtonGroup.addButton(rotateSuggestionButton); } mContextualButtonGroup.addButton(accessibilityButton); mOverviewProxyService = Dependency.get(OverviewProxyService.class); mRotationContextButton = new RotationContextButton(R.id.rotate_suggestion, mLightContext, R.drawable.ic_sysbar_rotate_button_ccw_start_0); mFloatingRotationButton = new FloatingRotationButton(context); mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService); mRotationButtonController = new RotationButtonController(mLightContext, mLightIconColor, mDarkIconColor, isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton, mRotationButtonListener); mLightIconColor, mDarkIconColor); updateRotationButton(); mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class); if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) { Loading @@ -357,7 +344,6 @@ public class NavigationBarView extends FrameLayout implements mButtonDispatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps)); mButtonDispatchers.put(R.id.ime_switcher, imeSwitcherButton); mButtonDispatchers.put(R.id.accessibility_button, accessibilityButton); mButtonDispatchers.put(R.id.rotate_suggestion, rotateSuggestionButton); mButtonDispatchers.put(R.id.menu_container, mContextualButtonGroup); mDeadZone = new DeadZone(this); Loading Loading @@ -555,6 +541,23 @@ public class NavigationBarView extends FrameLayout implements } } /** * Updates the rotation button based on the current navigation mode. */ private void updateRotationButton() { if (isGesturalMode(mNavBarMode)) { mContextualButtonGroup.removeButton(R.id.rotate_suggestion); mButtonDispatchers.remove(R.id.rotate_suggestion); mRotationButtonController.setRotationButton(mFloatingRotationButton, mRotationButtonListener); } else if (mContextualButtonGroup.getContextButton(R.id.rotate_suggestion) == null) { mContextualButtonGroup.addButton(mRotationContextButton); mButtonDispatchers.put(R.id.rotate_suggestion, mRotationContextButton); mRotationButtonController.setRotationButton(mRotationContextButton, mRotationButtonListener); } } public KeyButtonDrawable getBackDrawable() { KeyButtonDrawable drawable = getDrawable(getBackDrawableRes()); orientBackButton(drawable); Loading Loading @@ -908,6 +911,7 @@ public class NavigationBarView extends FrameLayout implements mBarTransitions.onNavigationModeChanged(mNavBarMode); mEdgeBackGestureHandler.onNavigationModeChanged(mNavBarMode); mRecentsOnboarding.onNavigationModeChanged(mNavBarMode); updateRotationButton(); if (isGesturalMode(mNavBarMode)) { mRegionSamplingHelper.start(mSamplingBounds); Loading @@ -932,7 +936,6 @@ public class NavigationBarView extends FrameLayout implements mNavigationInflaterView = findViewById(R.id.navigation_inflater); mNavigationInflaterView.setButtonDispatchers(mButtonDispatchers); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); updateOrientationViews(); reloadNavIcons(); } Loading Loading @@ -1027,6 +1030,9 @@ public class NavigationBarView extends FrameLayout implements private void updateButtonLocation(ButtonDispatcher button, boolean inScreenSpace, boolean useNearestRegion) { if (button == null) { return; } View view = button.getCurrentView(); if (view == null || !button.isVisible()) { return; Loading packages/SystemUI/src/com/android/systemui/navigationbar/RotationButtonController.java +8 −7 Original line number Diff line number Diff line Loading @@ -66,10 +66,10 @@ public class RotationButtonController { private static final int NUM_ACCEPTED_ROTATION_SUGGESTIONS_FOR_INTRODUCTION = 3; private final Context mContext; private final RotationButton mRotationButton; private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper()); private final UiEventLogger mUiEventLogger = new UiEventLoggerImpl(); private final ViewRippler mViewRippler = new ViewRippler(); private RotationButton mRotationButton; private int mLastRotationSuggestion; private boolean mPendingRotationSuggestion; Loading Loading @@ -125,20 +125,21 @@ public class RotationButtonController { } RotationButtonController(Context context, @ColorInt int lightIconColor, @ColorInt int darkIconColor, RotationButton rotationButton, Consumer<Boolean> visibilityChangedCallback) { @ColorInt int darkIconColor) { mContext = context; mLightIconColor = lightIconColor; mDarkIconColor = darkIconColor; mRotationButton = rotationButton; mRotationButton.setRotationButtonController(this); mIsNavigationBarShowing = true; mRotationLockController = Dependency.get(RotationLockController.class); mAccessibilityManagerWrapper = Dependency.get(AccessibilityManagerWrapper.class); // Register the task stack listener mTaskStackListener = new TaskStackListenerImpl(); } void setRotationButton(RotationButton rotationButton, Consumer<Boolean> visibilityChangedCallback) { mRotationButton = rotationButton; mRotationButton.setRotationButtonController(this); mRotationButton.setOnClickListener(this::onRotateSuggestionClick); mRotationButton.setOnHoverListener(this::onRotateSuggestionHover); mRotationButton.setVisibilityChangedCallback(visibilityChangedCallback); Loading Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +9 −1 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener; import android.view.inputmethod.InputMethodManager; import androidx.annotation.VisibleForTesting; Loading Loading @@ -1175,6 +1176,9 @@ public class NavigationBar implements View.OnAttachStateChangeListener, accessibilityButton.setOnLongClickListener(this::onAccessibilityLongClick); updateAccessibilityServicesState(mAccessibilityManager); ButtonDispatcher imeSwitcherButton = mNavigationBarView.getImeSwitchButton(); imeSwitcherButton.setOnClickListener(this::onImeSwitcherClick); updateScreenPinningGestures(); } Loading Loading @@ -1274,6 +1278,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener, mCommandQueue.toggleRecentApps(); } private void onImeSwitcherClick(View v) { mContext.getSystemService(InputMethodManager.class).showInputMethodPickerFromSystem( true /* showAuxiliarySubtypes */, mDisplayId); }; private boolean onLongPressBackHome(View v) { return onLongPressNavigationButtons(v, R.id.back, R.id.home); } Loading @@ -1282,7 +1291,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener, return onLongPressNavigationButtons(v, R.id.back, R.id.recent_apps); } /** * This handles long-press of both back and recents/home. Back is the common button with * combination of recents if it is visible or home if recents is invisible. Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java +3 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,9 @@ public class NavigationBarController implements Callbacks, @Override public void onNavigationModeChanged(int mode) { if (mNavMode == mode) { return; } final int oldMode = mNavMode; mNavMode = mode; mHandler.post(() -> { Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java +0 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,6 @@ public class NavigationBarInflaterView extends FrameLayout } public void onLikelyDefaultLayoutChange() { // Reevaluate new layout final String newValue = getDefaultLayout(); if (!Objects.equals(mCurrentLayout, newValue)) { Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java +26 −20 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ public class NavigationBarView extends FrameLayout implements private NavigationBarInflaterView mNavigationInflaterView; private RecentsOnboarding mRecentsOnboarding; private NotificationPanelViewController mPanelView; private RotationContextButton mRotationContextButton; private FloatingRotationButton mFloatingRotationButton; private RotationButtonController mRotationButtonController; private NavigationBarOverlayController mNavBarOverlayController; Loading Loading @@ -233,14 +234,6 @@ public class NavigationBarView extends FrameLayout implements } } private final OnClickListener mImeSwitcherClickListener = new OnClickListener() { @Override public void onClick(View view) { mContext.getSystemService(InputMethodManager.class).showInputMethodPickerFromSystem( true /* showAuxiliarySubtypes */, getContext().getDisplayId()); } }; private final AccessibilityDelegate mQuickStepAccessibilityDelegate = new AccessibilityDelegate() { private AccessibilityAction mToggleOverviewAction; Loading Loading @@ -311,32 +304,26 @@ public class NavigationBarView extends FrameLayout implements mIsVertical = false; mLongClickableAccessibilityButton = false; mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this); boolean isGesturalMode = isGesturalMode(mNavBarMode); mSysUiFlagContainer = Dependency.get(SysUiState.class); // Set up the context group of buttons mContextualButtonGroup = new ContextualButtonGroup(R.id.menu_container); final ContextualButton imeSwitcherButton = new ContextualButton(R.id.ime_switcher, mLightContext, R.drawable.ic_ime_switcher_default); final RotationContextButton rotateSuggestionButton = new RotationContextButton( R.id.rotate_suggestion, mLightContext, R.drawable.ic_sysbar_rotate_button_ccw_start_0); final ContextualButton accessibilityButton = new ContextualButton(R.id.accessibility_button, mLightContext, R.drawable.ic_sysbar_accessibility_button); mContextualButtonGroup.addButton(imeSwitcherButton); if (!isGesturalMode) { mContextualButtonGroup.addButton(rotateSuggestionButton); } mContextualButtonGroup.addButton(accessibilityButton); mOverviewProxyService = Dependency.get(OverviewProxyService.class); mRotationContextButton = new RotationContextButton(R.id.rotate_suggestion, mLightContext, R.drawable.ic_sysbar_rotate_button_ccw_start_0); mFloatingRotationButton = new FloatingRotationButton(context); mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService); mRotationButtonController = new RotationButtonController(mLightContext, mLightIconColor, mDarkIconColor, isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton, mRotationButtonListener); mLightIconColor, mDarkIconColor); updateRotationButton(); mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class); if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) { Loading @@ -357,7 +344,6 @@ public class NavigationBarView extends FrameLayout implements mButtonDispatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps)); mButtonDispatchers.put(R.id.ime_switcher, imeSwitcherButton); mButtonDispatchers.put(R.id.accessibility_button, accessibilityButton); mButtonDispatchers.put(R.id.rotate_suggestion, rotateSuggestionButton); mButtonDispatchers.put(R.id.menu_container, mContextualButtonGroup); mDeadZone = new DeadZone(this); Loading Loading @@ -555,6 +541,23 @@ public class NavigationBarView extends FrameLayout implements } } /** * Updates the rotation button based on the current navigation mode. */ private void updateRotationButton() { if (isGesturalMode(mNavBarMode)) { mContextualButtonGroup.removeButton(R.id.rotate_suggestion); mButtonDispatchers.remove(R.id.rotate_suggestion); mRotationButtonController.setRotationButton(mFloatingRotationButton, mRotationButtonListener); } else if (mContextualButtonGroup.getContextButton(R.id.rotate_suggestion) == null) { mContextualButtonGroup.addButton(mRotationContextButton); mButtonDispatchers.put(R.id.rotate_suggestion, mRotationContextButton); mRotationButtonController.setRotationButton(mRotationContextButton, mRotationButtonListener); } } public KeyButtonDrawable getBackDrawable() { KeyButtonDrawable drawable = getDrawable(getBackDrawableRes()); orientBackButton(drawable); Loading Loading @@ -908,6 +911,7 @@ public class NavigationBarView extends FrameLayout implements mBarTransitions.onNavigationModeChanged(mNavBarMode); mEdgeBackGestureHandler.onNavigationModeChanged(mNavBarMode); mRecentsOnboarding.onNavigationModeChanged(mNavBarMode); updateRotationButton(); if (isGesturalMode(mNavBarMode)) { mRegionSamplingHelper.start(mSamplingBounds); Loading @@ -932,7 +936,6 @@ public class NavigationBarView extends FrameLayout implements mNavigationInflaterView = findViewById(R.id.navigation_inflater); mNavigationInflaterView.setButtonDispatchers(mButtonDispatchers); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); updateOrientationViews(); reloadNavIcons(); } Loading Loading @@ -1027,6 +1030,9 @@ public class NavigationBarView extends FrameLayout implements private void updateButtonLocation(ButtonDispatcher button, boolean inScreenSpace, boolean useNearestRegion) { if (button == null) { return; } View view = button.getCurrentView(); if (view == null || !button.isVisible()) { return; Loading
packages/SystemUI/src/com/android/systemui/navigationbar/RotationButtonController.java +8 −7 Original line number Diff line number Diff line Loading @@ -66,10 +66,10 @@ public class RotationButtonController { private static final int NUM_ACCEPTED_ROTATION_SUGGESTIONS_FOR_INTRODUCTION = 3; private final Context mContext; private final RotationButton mRotationButton; private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper()); private final UiEventLogger mUiEventLogger = new UiEventLoggerImpl(); private final ViewRippler mViewRippler = new ViewRippler(); private RotationButton mRotationButton; private int mLastRotationSuggestion; private boolean mPendingRotationSuggestion; Loading Loading @@ -125,20 +125,21 @@ public class RotationButtonController { } RotationButtonController(Context context, @ColorInt int lightIconColor, @ColorInt int darkIconColor, RotationButton rotationButton, Consumer<Boolean> visibilityChangedCallback) { @ColorInt int darkIconColor) { mContext = context; mLightIconColor = lightIconColor; mDarkIconColor = darkIconColor; mRotationButton = rotationButton; mRotationButton.setRotationButtonController(this); mIsNavigationBarShowing = true; mRotationLockController = Dependency.get(RotationLockController.class); mAccessibilityManagerWrapper = Dependency.get(AccessibilityManagerWrapper.class); // Register the task stack listener mTaskStackListener = new TaskStackListenerImpl(); } void setRotationButton(RotationButton rotationButton, Consumer<Boolean> visibilityChangedCallback) { mRotationButton = rotationButton; mRotationButton.setRotationButtonController(this); mRotationButton.setOnClickListener(this::onRotateSuggestionClick); mRotationButton.setOnHoverListener(this::onRotateSuggestionHover); mRotationButton.setVisibilityChangedCallback(visibilityChangedCallback); Loading