Loading packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -134,5 +134,8 @@ interface ISystemUiProxy { */ void onBackPressed() = 44; // Next id = 45 /** Sets home rotation enabled. */ void setHomeRotationEnabled(boolean enabled) = 45; // Next id = 46 } packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +6 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener, } } @Override public void onHomeRotationEnabled(boolean enabled) { mNavigationBarView.getRotationButtonController().setHomeRotationEnabled(enabled); } @Override public void onOverviewShown(boolean fromHome) { // If the overview has fixed orientation that may change display to natural rotation, Loading Loading @@ -951,6 +956,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener, if (running) { mNavbarOverlayController.setButtonState(/* visible */false, /* force */true); } mNavigationBarView.getRotationButtonController().setRecentsAnimationRunning(running); } /** Restores the appearance and the transient saved state to {@link NavigationBar}. */ Loading packages/SystemUI/src/com/android/systemui/navigationbar/RotationButtonController.java +28 −6 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ public class RotationButtonController { private final ViewRippler mViewRippler = new ViewRippler(); private RotationButton mRotationButton; private boolean mIsRecentsAnimationRunning; private boolean mHomeRotationEnabled; private int mLastRotationSuggestion; private boolean mPendingRotationSuggestion; private boolean mHoveringRotationSuggestion; Loading @@ -92,7 +94,6 @@ public class RotationButtonController { () -> mPendingRotationSuggestion = false; private Animator mRotateHideAnimator; private final Stub mRotationWatcher = new Stub() { @Override public void onRotationChanged(final int rotation) throws RemoteException { Loading @@ -105,7 +106,7 @@ public class RotationButtonController { if (shouldOverrideUserLockPrefs(rotation)) { setRotationLockedAtAngle(rotation); } setRotateSuggestionButtonState(false /* visible */, true /* forced */); setRotateSuggestionButtonState(false /* visible */, true /* hideImmediately */); } if (mRotWatcherListener != null) { Loading Loading @@ -192,10 +193,14 @@ public class RotationButtonController { } void setRotateSuggestionButtonState(boolean visible) { setRotateSuggestionButtonState(visible, false /* force */); setRotateSuggestionButtonState(visible, false /* hideImmediately */); } void setRotateSuggestionButtonState(final boolean visible, final boolean force) { /** * Change the visibility of rotate suggestion button. If {@code hideImmediately} is true, * it doesn't wait until the completion of the running animation. */ void setRotateSuggestionButtonState(final boolean visible, final boolean hideImmediately) { // At any point the the button can become invisible because an a11y service became active. // Similarly, a call to make the button visible may be rejected because an a11y service is // active. Must account for this. Loading Loading @@ -236,7 +241,7 @@ public class RotationButtonController { } else { // Hide mViewRippler.stop(); // Prevent any pending ripples, force hide or not if (force) { if (hideImmediately) { // If a hide animator is running stop it and make invisible if (mRotateHideAnimator != null && mRotateHideAnimator.isRunning()) { mRotateHideAnimator.pause(); Loading @@ -263,12 +268,29 @@ public class RotationButtonController { } } void setRecentsAnimationRunning(boolean running) { mIsRecentsAnimationRunning = running; updateRotationButtonStateInOverview(); } void setHomeRotationEnabled(boolean enabled) { mHomeRotationEnabled = enabled; updateRotationButtonStateInOverview(); } private void updateRotationButtonStateInOverview() { if (mIsRecentsAnimationRunning && !mHomeRotationEnabled) { setRotateSuggestionButtonState(false, true /* hideImmediately */ ); } } void setDarkIntensity(float darkIntensity) { mRotationButton.setDarkIntensity(darkIntensity); } void onRotationProposal(int rotation, int windowRotation, boolean isValid) { if (!mRotationButton.acceptRotationProposal()) { if (!mRotationButton.acceptRotationProposal() || (!mHomeRotationEnabled && mIsRecentsAnimationRunning)) { return; } Loading packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +22 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,21 @@ public class OverviewProxyService extends CurrentUserTracker implements } } @Override public void setHomeRotationEnabled(boolean enabled) { if (!verifyCaller("setHomeRotationEnabled")) { return; } final long token = Binder.clearCallingIdentity(); try { mHandler.post(() -> { mHandler.post(() -> notifyHomeRotationEnabled(enabled)); }); } finally { Binder.restoreCallingIdentity(token); } } private boolean sendEvent(int action, int code) { long when = SystemClock.uptimeMillis(); final KeyEvent ev = new KeyEvent(when, when, action, code, 0 /* repeat */, Loading Loading @@ -847,6 +862,12 @@ public class OverviewProxyService extends CurrentUserTracker implements } } private void notifyHomeRotationEnabled(boolean enabled) { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { mConnectionCallbacks.get(i).onHomeRotationEnabled(enabled); } } private void notifyConnectionChanged() { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { mConnectionCallbacks.get(i).onConnectionChanged(mOverviewProxy != null); Loading Loading @@ -994,6 +1015,7 @@ public class OverviewProxyService extends CurrentUserTracker implements default void onToggleRecentApps() {} /** Notify changes in the nav bar button alpha */ default void onNavBarButtonAlphaChanged(float alpha, boolean animate) {} default void onHomeRotationEnabled(boolean enabled) {} default void onSystemUiStateChanged(int sysuiStateFlags) {} default void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {} default void onAssistantGestureCompletion(float velocity) {} Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -134,5 +134,8 @@ interface ISystemUiProxy { */ void onBackPressed() = 44; // Next id = 45 /** Sets home rotation enabled. */ void setHomeRotationEnabled(boolean enabled) = 45; // Next id = 46 }
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +6 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener, } } @Override public void onHomeRotationEnabled(boolean enabled) { mNavigationBarView.getRotationButtonController().setHomeRotationEnabled(enabled); } @Override public void onOverviewShown(boolean fromHome) { // If the overview has fixed orientation that may change display to natural rotation, Loading Loading @@ -951,6 +956,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener, if (running) { mNavbarOverlayController.setButtonState(/* visible */false, /* force */true); } mNavigationBarView.getRotationButtonController().setRecentsAnimationRunning(running); } /** Restores the appearance and the transient saved state to {@link NavigationBar}. */ Loading
packages/SystemUI/src/com/android/systemui/navigationbar/RotationButtonController.java +28 −6 Original line number Diff line number Diff line Loading @@ -71,6 +71,8 @@ public class RotationButtonController { private final ViewRippler mViewRippler = new ViewRippler(); private RotationButton mRotationButton; private boolean mIsRecentsAnimationRunning; private boolean mHomeRotationEnabled; private int mLastRotationSuggestion; private boolean mPendingRotationSuggestion; private boolean mHoveringRotationSuggestion; Loading @@ -92,7 +94,6 @@ public class RotationButtonController { () -> mPendingRotationSuggestion = false; private Animator mRotateHideAnimator; private final Stub mRotationWatcher = new Stub() { @Override public void onRotationChanged(final int rotation) throws RemoteException { Loading @@ -105,7 +106,7 @@ public class RotationButtonController { if (shouldOverrideUserLockPrefs(rotation)) { setRotationLockedAtAngle(rotation); } setRotateSuggestionButtonState(false /* visible */, true /* forced */); setRotateSuggestionButtonState(false /* visible */, true /* hideImmediately */); } if (mRotWatcherListener != null) { Loading Loading @@ -192,10 +193,14 @@ public class RotationButtonController { } void setRotateSuggestionButtonState(boolean visible) { setRotateSuggestionButtonState(visible, false /* force */); setRotateSuggestionButtonState(visible, false /* hideImmediately */); } void setRotateSuggestionButtonState(final boolean visible, final boolean force) { /** * Change the visibility of rotate suggestion button. If {@code hideImmediately} is true, * it doesn't wait until the completion of the running animation. */ void setRotateSuggestionButtonState(final boolean visible, final boolean hideImmediately) { // At any point the the button can become invisible because an a11y service became active. // Similarly, a call to make the button visible may be rejected because an a11y service is // active. Must account for this. Loading Loading @@ -236,7 +241,7 @@ public class RotationButtonController { } else { // Hide mViewRippler.stop(); // Prevent any pending ripples, force hide or not if (force) { if (hideImmediately) { // If a hide animator is running stop it and make invisible if (mRotateHideAnimator != null && mRotateHideAnimator.isRunning()) { mRotateHideAnimator.pause(); Loading @@ -263,12 +268,29 @@ public class RotationButtonController { } } void setRecentsAnimationRunning(boolean running) { mIsRecentsAnimationRunning = running; updateRotationButtonStateInOverview(); } void setHomeRotationEnabled(boolean enabled) { mHomeRotationEnabled = enabled; updateRotationButtonStateInOverview(); } private void updateRotationButtonStateInOverview() { if (mIsRecentsAnimationRunning && !mHomeRotationEnabled) { setRotateSuggestionButtonState(false, true /* hideImmediately */ ); } } void setDarkIntensity(float darkIntensity) { mRotationButton.setDarkIntensity(darkIntensity); } void onRotationProposal(int rotation, int windowRotation, boolean isValid) { if (!mRotationButton.acceptRotationProposal()) { if (!mRotationButton.acceptRotationProposal() || (!mHomeRotationEnabled && mIsRecentsAnimationRunning)) { return; } Loading
packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +22 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,21 @@ public class OverviewProxyService extends CurrentUserTracker implements } } @Override public void setHomeRotationEnabled(boolean enabled) { if (!verifyCaller("setHomeRotationEnabled")) { return; } final long token = Binder.clearCallingIdentity(); try { mHandler.post(() -> { mHandler.post(() -> notifyHomeRotationEnabled(enabled)); }); } finally { Binder.restoreCallingIdentity(token); } } private boolean sendEvent(int action, int code) { long when = SystemClock.uptimeMillis(); final KeyEvent ev = new KeyEvent(when, when, action, code, 0 /* repeat */, Loading Loading @@ -847,6 +862,12 @@ public class OverviewProxyService extends CurrentUserTracker implements } } private void notifyHomeRotationEnabled(boolean enabled) { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { mConnectionCallbacks.get(i).onHomeRotationEnabled(enabled); } } private void notifyConnectionChanged() { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { mConnectionCallbacks.get(i).onConnectionChanged(mOverviewProxy != null); Loading Loading @@ -994,6 +1015,7 @@ public class OverviewProxyService extends CurrentUserTracker implements default void onToggleRecentApps() {} /** Notify changes in the nav bar button alpha */ default void onNavBarButtonAlphaChanged(float alpha, boolean animate) {} default void onHomeRotationEnabled(boolean enabled) {} default void onSystemUiStateChanged(int sysuiStateFlags) {} default void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {} default void onAssistantGestureCompletion(float velocity) {} Loading