diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java index ade86ae76db4e..20d811932363e 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java @@ -427,6 +427,15 @@ public class NavigationBarController implements } } + public boolean isOverviewEnabled(int displayId) { + final NavigationBarView navBarView = getNavigationBarView(displayId); + if (navBarView != null) { + return navBarView.isOverviewEnabled(); + } else { + return mTaskbarDelegate.isOverviewEnabled(); + } + } + /** @return {@link NavigationBar} on the default display. */ @Nullable public NavigationBar getDefaultNavigationBar() { diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java index 75a3df7cad0cf..be147b9fd5858 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java @@ -309,6 +309,10 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, .commitUpdate(mDisplayId); } + boolean isOverviewEnabled() { + return (mSysUiState.getFlags() & View.STATUS_BAR_DISABLE_RECENT) == 0; + } + private void updateAssistantAvailability(boolean assistantAvailable) { if (mOverviewProxyService.getProxy() == null) { return; diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java index 15ad7798b3a31..c272602e33879 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java @@ -271,10 +271,8 @@ public class ScreenPinningRequest implements View.OnClickListener, final Optional centralSurfacesOptional = mCentralSurfacesOptionalLazy.get(); - NavigationBarView navigationBarView = - centralSurfacesOptional.map(CentralSurfaces::getNavigationBarView).orElse(null); - final boolean recentsVisible = navigationBarView != null - && navigationBarView.isRecentsButtonVisible(); + boolean recentsVisible = + centralSurfacesOptional.map(CentralSurfaces::isOverviewEnabled).orElse(false); boolean touchExplorationEnabled = mAccessibilityService.isTouchExplorationEnabled(); int descriptionStringResId; if (QuickStepContract.isGesturalMode(mNavBarMode)) { @@ -295,6 +293,8 @@ public class ScreenPinningRequest implements View.OnClickListener, : R.string.screen_pinning_description_recents_invisible; } + NavigationBarView navigationBarView = + centralSurfacesOptional.map(CentralSurfaces::getNavigationBarView).orElse(null); if (navigationBarView != null) { ((ImageView) mLayout.findViewById(R.id.screen_pinning_back_icon)) .setImageDrawable(navigationBarView.getBackDrawable()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java index a2d22bc365899..db5dd9d378ea2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -3439,6 +3439,10 @@ public class CentralSurfaces extends CoreStartable implements return mNavigationBarController.getNavigationBarView(mDisplayId); } + public boolean isOverviewEnabled() { + return mNavigationBarController.isOverviewEnabled(mDisplayId); + } + public void showPinningEnterExitToast(boolean entering) { mNavigationBarController.showPinningEnterExitToast(mDisplayId, entering); }