Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java +21 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,8 @@ import com.android.systemui.R; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonView; import com.android.systemui.statusbar.policy.KeyButtonView; import java.util.function.Consumer; /** Containing logic for the rotation button on the physical left bottom corner of the screen. */ /** Containing logic for the rotation button on the physical left bottom corner of the screen. */ public class FloatingRotationButton implements RotationButton { public class FloatingRotationButton implements RotationButton { Loading @@ -48,6 +50,7 @@ public class FloatingRotationButton implements RotationButton { private boolean mCanShow = true; private boolean mCanShow = true; private RotationButtonController mRotationButtonController; private RotationButtonController mRotationButtonController; private Consumer<Boolean> mVisibilityChangedCallback; FloatingRotationButton(Context context) { FloatingRotationButton(Context context) { mContext = context; mContext = context; Loading @@ -67,6 +70,11 @@ public class FloatingRotationButton implements RotationButton { mRotationButtonController = rotationButtonController; mRotationButtonController = rotationButtonController; } } @Override public void setVisibilityChangedCallback(Consumer<Boolean> visibilityChangedCallback) { mVisibilityChangedCallback = visibilityChangedCallback; } @Override @Override public View getCurrentView() { public View getCurrentView() { return mKeyButtonView; return mKeyButtonView; Loading Loading @@ -107,6 +115,16 @@ public class FloatingRotationButton implements RotationButton { mKeyButtonDrawable.resetAnimation(); mKeyButtonDrawable.resetAnimation(); mKeyButtonDrawable.startAnimation(); mKeyButtonDrawable.startAnimation(); } } mKeyButtonView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) { if (mIsShowing && mVisibilityChangedCallback != null) { mVisibilityChangedCallback.accept(true); } mKeyButtonView.removeOnLayoutChangeListener(this); } }); return true; return true; } } Loading @@ -117,6 +135,9 @@ public class FloatingRotationButton implements RotationButton { } } mWindowManager.removeViewImmediate(mKeyButtonView); mWindowManager.removeViewImmediate(mKeyButtonView); mIsShowing = false; mIsShowing = false; if (mVisibilityChangedCallback != null) { mVisibilityChangedCallback.accept(false); } return true; return true; } } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −11 Original line number Original line Diff line number Diff line Loading @@ -354,15 +354,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback } } }; }; private final ContextButtonListener mRotationButtonListener = (button, visible) -> { if (visible) { // 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(); } }; private final Runnable mAutoDim = () -> getBarTransitions().setAutoDim(true); private final Runnable mAutoDim = () -> getBarTransitions().setAutoDim(true); private final ContentObserver mAssistContentObserver = new ContentObserver( private final ContentObserver mAssistContentObserver = new ContentObserver( Loading Loading @@ -522,8 +513,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback // Currently there is no accelerometer sensor on non-default display. // Currently there is no accelerometer sensor on non-default display. if (mIsOnDefaultDisplay) { if (mIsOnDefaultDisplay) { mNavigationBarView.getRotateSuggestionButton().setListener(mRotationButtonListener); final RotationButtonController rotationButtonController = final RotationButtonController rotationButtonController = mNavigationBarView.getRotationButtonController(); mNavigationBarView.getRotationButtonController(); rotationButtonController.addRotationCallback(mRotationWatcher); rotationButtonController.addRotationCallback(mRotationWatcher); Loading Loading @@ -1316,6 +1305,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback if (mAutoHideController != null) { if (mAutoHideController != null) { mAutoHideController.setNavigationBar(mAutoHideUiElement); mAutoHideController.setNavigationBar(mAutoHideUiElement); } } mNavigationBarView.setAutoHideController(autoHideController); } } private boolean isTransientShown() { private boolean isTransientShown() { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +26 −2 Original line number Original line Diff line number Diff line Loading @@ -126,6 +126,7 @@ public class NavigationBarView extends FrameLayout implements private boolean mDeadZoneConsuming = false; private boolean mDeadZoneConsuming = false; private final NavigationBarTransitions mBarTransitions; private final NavigationBarTransitions mBarTransitions; private final OverviewProxyService mOverviewProxyService; private final OverviewProxyService mOverviewProxyService; private AutoHideController mAutoHideController; // performs manual animation in sync with layout transitions // performs manual animation in sync with layout transitions private final NavTransitionListener mTransitionListener = new NavTransitionListener(); private final NavTransitionListener mTransitionListener = new NavTransitionListener(); Loading Loading @@ -271,6 +272,15 @@ public class NavigationBarView extends FrameLayout implements info.touchableRegion.setEmpty(); info.touchableRegion.setEmpty(); }; }; private final Consumer<Boolean> mRotationButtonListener = (visible) -> { if (visible) { // 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(); } notifyActiveTouchRegions(); }; public NavigationBarView(Context context, AttributeSet attrs) { public NavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); super(context, attrs); Loading Loading @@ -301,7 +311,8 @@ public class NavigationBarView extends FrameLayout implements mFloatingRotationButton = new FloatingRotationButton(context); mFloatingRotationButton = new FloatingRotationButton(context); mRotationButtonController = new RotationButtonController(context, mRotationButtonController = new RotationButtonController(context, R.style.RotateButtonCCWStart90, R.style.RotateButtonCCWStart90, isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton); isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton, mRotationButtonListener); mConfiguration = new Configuration(); mConfiguration = new Configuration(); mTmpLastConfiguration = new Configuration(); mTmpLastConfiguration = new Configuration(); Loading Loading @@ -349,6 +360,10 @@ public class NavigationBarView extends FrameLayout implements }); }); } } public void setAutoHideController(AutoHideController autoHideController) { mAutoHideController = autoHideController; } public NavigationBarTransitions getBarTransitions() { public NavigationBarTransitions getBarTransitions() { return mBarTransitions; return mBarTransitions; } } Loading Loading @@ -936,7 +951,15 @@ public class NavigationBarView extends FrameLayout implements updateButtonLocation(getBackButton()); updateButtonLocation(getBackButton()); updateButtonLocation(getHomeButton()); updateButtonLocation(getHomeButton()); updateButtonLocation(getRecentsButton()); updateButtonLocation(getRecentsButton()); updateButtonLocation(getImeSwitchButton()); updateButtonLocation(getAccessibilityButton()); if (mFloatingRotationButton.isVisible()) { View floatingRotationView = mFloatingRotationButton.getCurrentView(); floatingRotationView.getBoundsOnScreen(mTmpBounds); mActiveRegion.op(mTmpBounds, Op.UNION); } else { updateButtonLocation(getRotateSuggestionButton()); updateButtonLocation(getRotateSuggestionButton()); } mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion); mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion); } } Loading Loading @@ -1208,6 +1231,7 @@ public class NavigationBarView extends FrameLayout implements dumpButton(pw, "rcnt", getRecentsButton()); dumpButton(pw, "rcnt", getRecentsButton()); dumpButton(pw, "rota", getRotateSuggestionButton()); dumpButton(pw, "rota", getRotateSuggestionButton()); dumpButton(pw, "a11y", getAccessibilityButton()); dumpButton(pw, "a11y", getAccessibilityButton()); dumpButton(pw, "ime", getImeSwitchButton()); pw.println(" }"); pw.println(" }"); pw.println(" mScreenOn: " + mScreenOn); pw.println(" mScreenOn: " + mScreenOn); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationButton.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -20,9 +20,12 @@ import android.view.View; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import java.util.function.Consumer; /** Interface of a rotation button that interacts {@link RotationButtonController}. */ /** Interface of a rotation button that interacts {@link RotationButtonController}. */ interface RotationButton { interface RotationButton { void setRotationButtonController(RotationButtonController rotationButtonController); void setRotationButtonController(RotationButtonController rotationButtonController); void setVisibilityChangedCallback(Consumer<Boolean> visibilityChangedCallback); View getCurrentView(); View getCurrentView(); boolean show(); boolean show(); boolean hide(); boolean hide(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationButtonController.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -117,7 +117,8 @@ public class RotationButtonController { return (disable2Flags & StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS) != 0; return (disable2Flags & StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS) != 0; } } RotationButtonController(Context context, @StyleRes int style, RotationButton rotationButton) { RotationButtonController(Context context, @StyleRes int style, RotationButton rotationButton, Consumer<Boolean> visibilityChangedCallback) { mContext = context; mContext = context; mRotationButton = rotationButton; mRotationButton = rotationButton; mRotationButton.setRotationButtonController(this); mRotationButton.setRotationButtonController(this); Loading @@ -131,6 +132,7 @@ public class RotationButtonController { mTaskStackListener = new TaskStackListenerImpl(); mTaskStackListener = new TaskStackListenerImpl(); mRotationButton.setOnClickListener(this::onRotateSuggestionClick); mRotationButton.setOnClickListener(this::onRotateSuggestionClick); mRotationButton.setOnHoverListener(this::onRotateSuggestionHover); mRotationButton.setOnHoverListener(this::onRotateSuggestionHover); mRotationButton.setVisibilityChangedCallback(visibilityChangedCallback); } } void registerListeners() { void registerListeners() { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java +21 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,8 @@ import com.android.systemui.R; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonView; import com.android.systemui.statusbar.policy.KeyButtonView; import java.util.function.Consumer; /** Containing logic for the rotation button on the physical left bottom corner of the screen. */ /** Containing logic for the rotation button on the physical left bottom corner of the screen. */ public class FloatingRotationButton implements RotationButton { public class FloatingRotationButton implements RotationButton { Loading @@ -48,6 +50,7 @@ public class FloatingRotationButton implements RotationButton { private boolean mCanShow = true; private boolean mCanShow = true; private RotationButtonController mRotationButtonController; private RotationButtonController mRotationButtonController; private Consumer<Boolean> mVisibilityChangedCallback; FloatingRotationButton(Context context) { FloatingRotationButton(Context context) { mContext = context; mContext = context; Loading @@ -67,6 +70,11 @@ public class FloatingRotationButton implements RotationButton { mRotationButtonController = rotationButtonController; mRotationButtonController = rotationButtonController; } } @Override public void setVisibilityChangedCallback(Consumer<Boolean> visibilityChangedCallback) { mVisibilityChangedCallback = visibilityChangedCallback; } @Override @Override public View getCurrentView() { public View getCurrentView() { return mKeyButtonView; return mKeyButtonView; Loading Loading @@ -107,6 +115,16 @@ public class FloatingRotationButton implements RotationButton { mKeyButtonDrawable.resetAnimation(); mKeyButtonDrawable.resetAnimation(); mKeyButtonDrawable.startAnimation(); mKeyButtonDrawable.startAnimation(); } } mKeyButtonView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) { if (mIsShowing && mVisibilityChangedCallback != null) { mVisibilityChangedCallback.accept(true); } mKeyButtonView.removeOnLayoutChangeListener(this); } }); return true; return true; } } Loading @@ -117,6 +135,9 @@ public class FloatingRotationButton implements RotationButton { } } mWindowManager.removeViewImmediate(mKeyButtonView); mWindowManager.removeViewImmediate(mKeyButtonView); mIsShowing = false; mIsShowing = false; if (mVisibilityChangedCallback != null) { mVisibilityChangedCallback.accept(false); } return true; return true; } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −11 Original line number Original line Diff line number Diff line Loading @@ -354,15 +354,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback } } }; }; private final ContextButtonListener mRotationButtonListener = (button, visible) -> { if (visible) { // 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(); } }; private final Runnable mAutoDim = () -> getBarTransitions().setAutoDim(true); private final Runnable mAutoDim = () -> getBarTransitions().setAutoDim(true); private final ContentObserver mAssistContentObserver = new ContentObserver( private final ContentObserver mAssistContentObserver = new ContentObserver( Loading Loading @@ -522,8 +513,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback // Currently there is no accelerometer sensor on non-default display. // Currently there is no accelerometer sensor on non-default display. if (mIsOnDefaultDisplay) { if (mIsOnDefaultDisplay) { mNavigationBarView.getRotateSuggestionButton().setListener(mRotationButtonListener); final RotationButtonController rotationButtonController = final RotationButtonController rotationButtonController = mNavigationBarView.getRotationButtonController(); mNavigationBarView.getRotationButtonController(); rotationButtonController.addRotationCallback(mRotationWatcher); rotationButtonController.addRotationCallback(mRotationWatcher); Loading Loading @@ -1316,6 +1305,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback if (mAutoHideController != null) { if (mAutoHideController != null) { mAutoHideController.setNavigationBar(mAutoHideUiElement); mAutoHideController.setNavigationBar(mAutoHideUiElement); } } mNavigationBarView.setAutoHideController(autoHideController); } } private boolean isTransientShown() { private boolean isTransientShown() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +26 −2 Original line number Original line Diff line number Diff line Loading @@ -126,6 +126,7 @@ public class NavigationBarView extends FrameLayout implements private boolean mDeadZoneConsuming = false; private boolean mDeadZoneConsuming = false; private final NavigationBarTransitions mBarTransitions; private final NavigationBarTransitions mBarTransitions; private final OverviewProxyService mOverviewProxyService; private final OverviewProxyService mOverviewProxyService; private AutoHideController mAutoHideController; // performs manual animation in sync with layout transitions // performs manual animation in sync with layout transitions private final NavTransitionListener mTransitionListener = new NavTransitionListener(); private final NavTransitionListener mTransitionListener = new NavTransitionListener(); Loading Loading @@ -271,6 +272,15 @@ public class NavigationBarView extends FrameLayout implements info.touchableRegion.setEmpty(); info.touchableRegion.setEmpty(); }; }; private final Consumer<Boolean> mRotationButtonListener = (visible) -> { if (visible) { // 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(); } notifyActiveTouchRegions(); }; public NavigationBarView(Context context, AttributeSet attrs) { public NavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); super(context, attrs); Loading Loading @@ -301,7 +311,8 @@ public class NavigationBarView extends FrameLayout implements mFloatingRotationButton = new FloatingRotationButton(context); mFloatingRotationButton = new FloatingRotationButton(context); mRotationButtonController = new RotationButtonController(context, mRotationButtonController = new RotationButtonController(context, R.style.RotateButtonCCWStart90, R.style.RotateButtonCCWStart90, isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton); isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton, mRotationButtonListener); mConfiguration = new Configuration(); mConfiguration = new Configuration(); mTmpLastConfiguration = new Configuration(); mTmpLastConfiguration = new Configuration(); Loading Loading @@ -349,6 +360,10 @@ public class NavigationBarView extends FrameLayout implements }); }); } } public void setAutoHideController(AutoHideController autoHideController) { mAutoHideController = autoHideController; } public NavigationBarTransitions getBarTransitions() { public NavigationBarTransitions getBarTransitions() { return mBarTransitions; return mBarTransitions; } } Loading Loading @@ -936,7 +951,15 @@ public class NavigationBarView extends FrameLayout implements updateButtonLocation(getBackButton()); updateButtonLocation(getBackButton()); updateButtonLocation(getHomeButton()); updateButtonLocation(getHomeButton()); updateButtonLocation(getRecentsButton()); updateButtonLocation(getRecentsButton()); updateButtonLocation(getImeSwitchButton()); updateButtonLocation(getAccessibilityButton()); if (mFloatingRotationButton.isVisible()) { View floatingRotationView = mFloatingRotationButton.getCurrentView(); floatingRotationView.getBoundsOnScreen(mTmpBounds); mActiveRegion.op(mTmpBounds, Op.UNION); } else { updateButtonLocation(getRotateSuggestionButton()); updateButtonLocation(getRotateSuggestionButton()); } mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion); mOverviewProxyService.onActiveNavBarRegionChanges(mActiveRegion); } } Loading Loading @@ -1208,6 +1231,7 @@ public class NavigationBarView extends FrameLayout implements dumpButton(pw, "rcnt", getRecentsButton()); dumpButton(pw, "rcnt", getRecentsButton()); dumpButton(pw, "rota", getRotateSuggestionButton()); dumpButton(pw, "rota", getRotateSuggestionButton()); dumpButton(pw, "a11y", getAccessibilityButton()); dumpButton(pw, "a11y", getAccessibilityButton()); dumpButton(pw, "ime", getImeSwitchButton()); pw.println(" }"); pw.println(" }"); pw.println(" mScreenOn: " + mScreenOn); pw.println(" mScreenOn: " + mScreenOn); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationButton.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -20,9 +20,12 @@ import android.view.View; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import java.util.function.Consumer; /** Interface of a rotation button that interacts {@link RotationButtonController}. */ /** Interface of a rotation button that interacts {@link RotationButtonController}. */ interface RotationButton { interface RotationButton { void setRotationButtonController(RotationButtonController rotationButtonController); void setRotationButtonController(RotationButtonController rotationButtonController); void setVisibilityChangedCallback(Consumer<Boolean> visibilityChangedCallback); View getCurrentView(); View getCurrentView(); boolean show(); boolean show(); boolean hide(); boolean hide(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationButtonController.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -117,7 +117,8 @@ public class RotationButtonController { return (disable2Flags & StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS) != 0; return (disable2Flags & StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS) != 0; } } RotationButtonController(Context context, @StyleRes int style, RotationButton rotationButton) { RotationButtonController(Context context, @StyleRes int style, RotationButton rotationButton, Consumer<Boolean> visibilityChangedCallback) { mContext = context; mContext = context; mRotationButton = rotationButton; mRotationButton = rotationButton; mRotationButton.setRotationButtonController(this); mRotationButton.setRotationButtonController(this); Loading @@ -131,6 +132,7 @@ public class RotationButtonController { mTaskStackListener = new TaskStackListenerImpl(); mTaskStackListener = new TaskStackListenerImpl(); mRotationButton.setOnClickListener(this::onRotateSuggestionClick); mRotationButton.setOnClickListener(this::onRotateSuggestionClick); mRotationButton.setOnHoverListener(this::onRotateSuggestionHover); mRotationButton.setOnHoverListener(this::onRotateSuggestionHover); mRotationButton.setVisibilityChangedCallback(visibilityChangedCallback); } } void registerListeners() { void registerListeners() { Loading