diff options
3 files changed, 35 insertions, 25 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl index 77bb5141d1e0..9228b178c76f 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl @@ -55,10 +55,17 @@ interface ISystemUiProxy { /** * Control the {@param alpha} of the back button in the navigation bar and {@param animate} if * needed from current value + * @deprecated */ void setBackButtonAlpha(float alpha, boolean animate) = 8; /** + * Control the {@param alpha} of the option nav bar button (back-button in 2 button mode + * and home bar in no-button mode) and {@param animate} if needed from current value + */ + void setNavBarButtonAlpha(float alpha, boolean animate) = 19; + + /** * Proxies motion events from the homescreen UI to the status bar. Only called when * swipe down is detected on WORKSPACE. The sender guarantees the following order of events on * the tracking pointer. diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index b4299fd760fd..e5caf68c416e 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -118,7 +118,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private boolean mBound; private boolean mIsEnabled; private int mCurrentBoundedUserId = -1; - private float mBackButtonAlpha; + private float mNavBarButtonAlpha; private MotionEvent mStatusBarGestureDownEvent; private float mWindowCornerRadius; private boolean mSupportsRoundedCornersOnWindows; @@ -244,22 +244,25 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } @Override - public void setBackButtonAlpha(float alpha, boolean animate) { - if (!verifyCaller("setBackButtonAlpha")) { + public void setNavBarButtonAlpha(float alpha, boolean animate) { + if (!verifyCaller("setNavBarButtonAlpha")) { return; } long token = Binder.clearCallingIdentity(); try { - mBackButtonAlpha = alpha; - mHandler.post(() -> { - notifyBackButtonAlphaChanged(alpha, animate); - }); + mNavBarButtonAlpha = alpha; + mHandler.post(() -> notifyNavBarButtonAlphaChanged(alpha, animate)); } finally { Binder.restoreCallingIdentity(token); } } @Override + public void setBackButtonAlpha(float alpha, boolean animate) { + setNavBarButtonAlpha(alpha, animate); + } + + @Override public void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) { if (!verifyCaller("onAssistantProgress")) { return; @@ -470,7 +473,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis .supportsRoundedCornersOnWindows(mContext.getResources()); // Assumes device always starts with back button until launcher tells it that it does not - mBackButtonAlpha = 1.0f; + mNavBarButtonAlpha = 1.0f; // Listen for nav bar mode changes mNavBarMode = navModeController.addListener(this); @@ -583,7 +586,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } public float getBackButtonAlpha() { - return mBackButtonAlpha; + return mNavBarButtonAlpha; } public void cleanupAfterDeath() { @@ -655,7 +658,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis public void addCallback(OverviewProxyListener listener) { mConnectionCallbacks.add(listener); listener.onConnectionChanged(mOverviewProxy != null); - listener.onBackButtonAlphaChanged(mBackButtonAlpha, false); + listener.onNavBarButtonAlphaChanged(mNavBarButtonAlpha, false); listener.onSystemUiStateChanged(mSysUiStateFlags); } @@ -686,14 +689,14 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis if (mOverviewProxy != null) { mOverviewProxy.asBinder().unlinkToDeath(mOverviewServiceDeathRcpt, 0); mOverviewProxy = null; - notifyBackButtonAlphaChanged(1f, false /* animate */); + notifyNavBarButtonAlphaChanged(1f, false /* animate */); notifyConnectionChanged(); } } - private void notifyBackButtonAlphaChanged(float alpha, boolean animate) { + private void notifyNavBarButtonAlphaChanged(float alpha, boolean animate) { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { - mConnectionCallbacks.get(i).onBackButtonAlphaChanged(alpha, animate); + mConnectionCallbacks.get(i).onNavBarButtonAlphaChanged(alpha, animate); } } @@ -784,7 +787,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis default void onQuickStepStarted() {} default void onOverviewShown(boolean fromHome) {} default void onQuickScrubStarted() {} - default void onBackButtonAlphaChanged(float alpha, boolean animate) {} + /** Notify changes in the nav bar button alpha */ + default void onNavBarButtonAlphaChanged(float alpha, boolean animate) {} default void onSystemUiStateChanged(int sysuiStateFlags) {} default void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {} default void onAssistantGestureCompletion(float velocity) {} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java index 79976d0e104d..5708c1b2ed5c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java @@ -203,17 +203,16 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback } @Override - public void onBackButtonAlphaChanged(float alpha, boolean animate) { - final ButtonDispatcher backButton = mNavigationBarView.getBackButton(); - final boolean useAltBack = - (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; - if (QuickStepContract.isGesturalMode(mNavBarMode) && !useAltBack) { - // If property was changed to hide/show back button, going home will trigger - // launcher to to change the back button alpha to reflect property change - backButton.setVisibility(View.GONE); - } else { - backButton.setVisibility(alpha > 0 ? View.VISIBLE : View.INVISIBLE); - backButton.setAlpha(alpha, animate); + public void onNavBarButtonAlphaChanged(float alpha, boolean animate) { + ButtonDispatcher buttonDispatcher = null; + if (QuickStepContract.isSwipeUpMode(mNavBarMode)) { + buttonDispatcher = mNavigationBarView.getBackButton(); + } else if (QuickStepContract.isGesturalMode(mNavBarMode)) { + buttonDispatcher = mNavigationBarView.getHomeHandle(); + } + if (buttonDispatcher != null) { + buttonDispatcher.setVisibility(alpha > 0 ? View.VISIBLE : View.INVISIBLE); + buttonDispatcher.setAlpha(alpha, animate); } } }; |