From c73ce7046757d0ff101a2a2bb3eef5ae56dd47da Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Sun, 16 Jun 2019 13:50:07 -0700 Subject: [PATCH] Hiding home handle while on home in no-button mode > Unifying handling home and back button alpha logic Test: go home, manual Bug: 134381592 Change-Id: I93a72cc4ac252f2ced22216f14c50b074e9903c8 --- .../shared/recents/ISystemUiProxy.aidl | 7 ++++ .../recents/OverviewProxyService.java | 32 +++++++++++-------- .../phone/NavigationBarFragment.java | 21 ++++++------ 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 77bb5141d1e0e..9228b178c76f6 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,9 +55,16 @@ 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 diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 88a8b31dc3612..c13c46d1ba4c6 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -115,7 +115,7 @@ public class OverviewProxyService implements CallbackController { - 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")) { @@ -465,7 +468,7 @@ public class OverviewProxyService implements CallbackController= 0; --i) { - mConnectionCallbacks.get(i).onBackButtonAlphaChanged(alpha, animate); + mConnectionCallbacks.get(i).onNavBarButtonAlphaChanged(alpha, animate); } } @@ -766,7 +769,8 @@ public class OverviewProxyService implements CallbackController 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); } } };