diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index 71df2ad8d5b72..c39bcb196e11f 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -66,7 +66,6 @@ import com.android.systemui.power.PowerUI; import com.android.systemui.privacy.PrivacyItemController; import com.android.systemui.qs.ReduceBrightColorsController; import com.android.systemui.recents.OverviewProxyService; -import com.android.systemui.recents.Recents; import com.android.systemui.screenrecord.RecordingController; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -348,7 +347,6 @@ public class Dependency { @Inject Lazy mDozeParameters; @Inject Lazy mWallpaperManager; @Inject Lazy mCommandQueue; - @Inject Lazy mRecents; @Inject Lazy mRecordingController; @Inject Lazy mProtoTracer; @Inject Lazy mMediaOutputDialogFactory; @@ -551,7 +549,6 @@ public class Dependency { mProviders.put(DozeParameters.class, mDozeParameters::get); mProviders.put(IWallpaperManager.class, mWallpaperManager::get); mProviders.put(CommandQueue.class, mCommandQueue::get); - mProviders.put(Recents.class, mRecents::get); mProviders.put(ProtoTracer.class, mProtoTracer::get); mProviders.put(DeviceConfigProxy.class, mDeviceConfigProxy::get); mProviders.put(TelephonyListenerManager.class, mTelephonyListenerManager::get); diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index a2005d2bbe011..2f88291d1994d 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java @@ -140,7 +140,7 @@ public class SystemActions extends SystemUI { private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF"; private final SystemActionsBroadcastReceiver mReceiver; - private final Recents mRecents; + private final Optional mRecentsOptional; private Locale mLocale; private final AccessibilityManager mA11yManager; private final Lazy> mStatusBarOptionalLazy; @@ -152,9 +152,9 @@ public class SystemActions extends SystemUI { public SystemActions(Context context, NotificationShadeWindowController notificationShadeController, Lazy> statusBarOptionalLazy, - Recents recents) { + Optional recentsOptional) { super(context); - mRecents = recents; + mRecentsOptional = recentsOptional; mReceiver = new SystemActionsBroadcastReceiver(); mLocale = mContext.getResources().getConfiguration().getLocales().get(0); mA11yManager = (AccessibilityManager) mContext.getSystemService( @@ -370,7 +370,7 @@ public class SystemActions extends SystemUI { } private void handleRecents() { - mRecents.toggleRecentApps(); + mRecentsOptional.ifPresent(Recents::toggleRecentApps); } private void handleNotifications() { diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index e762839c96ed6..997975b4f03e6 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -611,6 +611,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener, @Override public void onViewAttachedToWindow(View v) { final Display display = v.getDisplay(); + mNavigationBarView.setComponents(mRecentsOptional); mNavigationBarView.setComponents(mStatusBarOptionalLazy.get().get().getPanelController()); mNavigationBarView.setDisabledFlags(mDisabledFlags1); mNavigationBarView.setOnVerticalChangedListener(this::onVerticalChanged); diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java index 23c066a75732a..81701d357e9e3 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java @@ -98,6 +98,7 @@ import com.android.wm.shell.pip.Pip; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; +import java.util.Optional; import java.util.function.Consumer; public class NavigationBarView extends FrameLayout implements @@ -165,6 +166,7 @@ public class NavigationBarView extends FrameLayout implements private NavigationBarInflaterView mNavigationInflaterView; private RecentsOnboarding mRecentsOnboarding; + private Optional mRecentsOptional = Optional.empty(); private NotificationPanelViewController mPanelView; private RotationContextButton mRotationContextButton; private FloatingRotationButton mFloatingRotationButton; @@ -253,7 +255,7 @@ public class NavigationBarView extends FrameLayout implements @Override public boolean performAccessibilityAction(View host, int action, Bundle args) { if (action == R.id.action_toggle_overview) { - Dependency.get(Recents.class).toggleRecentApps(); + mRecentsOptional.ifPresent(Recents::toggleRecentApps); } else { return super.performAccessibilityAction(host, action, args); } @@ -397,6 +399,10 @@ public class NavigationBarView extends FrameLayout implements return mBarTransitions.getLightTransitionsController(); } + public void setComponents(Optional recentsOptional) { + mRecentsOptional = recentsOptional; + } + public void setComponents(NotificationPanelViewController panel) { mPanelView = panel; updatePanelSystemUiStateFlags();