TaskbarManager now sets TaskbarUIController for RecentsWindowManager
- FallbackTaskbarUIController can take in a generic RecentsViewContainer parameter, i.e. RecentsActivity or RecentsWindowManager. - When changing Overview targets to RecentsWindowManager, which is not an Activity, we still update the TaskbarUIController Test: Switch between default Home activities with the flag on and off, ensure Taskbar works as expected in each case (3P vs 1P launcher). Flag: com.android.launcher3.enable_fallback_overview_in_window Fixes: 368030750 Fixes: 365775636 Change-Id: Ife775e8c226f8c73ec9e1f97b4a6f2972f6c905f
This commit is contained in:
@@ -71,7 +71,9 @@ import com.android.launcher3.util.SimpleBroadcastReceiver;
|
||||
import com.android.quickstep.AllAppsActionManager;
|
||||
import com.android.quickstep.RecentsActivity;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowManager;
|
||||
import com.android.quickstep.util.ContextualSearchInvoker;
|
||||
import com.android.quickstep.views.RecentsViewContainer;
|
||||
import com.android.systemui.shared.statusbar.phone.BarTransitions;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
@@ -131,6 +133,8 @@ public class TaskbarManager {
|
||||
|
||||
private TaskbarActivityContext mTaskbarActivityContext;
|
||||
private StatefulActivity mActivity;
|
||||
private RecentsViewContainer mRecentsViewContainer;
|
||||
|
||||
/**
|
||||
* Cache a copy here so we can initialize state whenever taskbar is recreated, since
|
||||
* this class does not get re-initialized w/ new taskbars.
|
||||
@@ -404,9 +408,28 @@ public class TaskbarManager {
|
||||
}
|
||||
mUnfoldProgressProvider.setSourceProvider(unfoldTransitionProgressProvider);
|
||||
|
||||
if (activity instanceof RecentsViewContainer recentsViewContainer) {
|
||||
setRecentsViewContainer(recentsViewContainer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current RecentsViewContainer, from which we create a TaskbarUIController.
|
||||
*/
|
||||
public void setRecentsViewContainer(@NonNull RecentsViewContainer recentsViewContainer) {
|
||||
if (mRecentsViewContainer == recentsViewContainer) {
|
||||
return;
|
||||
}
|
||||
if (mRecentsViewContainer == mActivity) {
|
||||
// When switching to RecentsWindowManager (not an Activity), the old mActivity is not
|
||||
// destroyed, nor is there a new Activity to replace it. Thus if we don't clear it here,
|
||||
// it will not get re-set properly if we return to the Activity (e.g. NexusLauncher).
|
||||
mActivityOnDestroyCallback.run();
|
||||
}
|
||||
mRecentsViewContainer = recentsViewContainer;
|
||||
if (mTaskbarActivityContext != null) {
|
||||
mTaskbarActivityContext.setUIController(
|
||||
createTaskbarUIControllerForActivity(mActivity));
|
||||
createTaskbarUIControllerForRecentsViewContainer(mRecentsViewContainer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,12 +452,18 @@ public class TaskbarManager {
|
||||
/**
|
||||
* Creates a {@link TaskbarUIController} to use while the given StatefulActivity is active.
|
||||
*/
|
||||
private TaskbarUIController createTaskbarUIControllerForActivity(StatefulActivity activity) {
|
||||
if (activity instanceof QuickstepLauncher) {
|
||||
return new LauncherTaskbarUIController((QuickstepLauncher) activity);
|
||||
private TaskbarUIController createTaskbarUIControllerForRecentsViewContainer(
|
||||
RecentsViewContainer container) {
|
||||
if (container instanceof QuickstepLauncher quickstepLauncher) {
|
||||
return new LauncherTaskbarUIController(quickstepLauncher);
|
||||
}
|
||||
if (activity instanceof RecentsActivity) {
|
||||
return new FallbackTaskbarUIController((RecentsActivity) activity);
|
||||
// If a 3P Launcher is default, always use FallbackTaskbarUIController regardless of
|
||||
// whether the recents container is RecentsActivity or RecentsWindowManager.
|
||||
if (container instanceof RecentsActivity recentsActivity) {
|
||||
return new FallbackTaskbarUIController<>(recentsActivity);
|
||||
}
|
||||
if (container instanceof RecentsWindowManager recentsWindowManager) {
|
||||
return new FallbackTaskbarUIController<>(recentsWindowManager);
|
||||
}
|
||||
return TaskbarUIController.DEFAULT;
|
||||
}
|
||||
@@ -484,9 +513,9 @@ public class TaskbarManager {
|
||||
mSharedState.allAppsVisible = mSharedState.allAppsVisible && isLargeScreenTaskbar;
|
||||
mTaskbarActivityContext.init(mSharedState);
|
||||
|
||||
if (mActivity != null) {
|
||||
if (mRecentsViewContainer != null) {
|
||||
mTaskbarActivityContext.setUIController(
|
||||
createTaskbarUIControllerForActivity(mActivity));
|
||||
createTaskbarUIControllerForRecentsViewContainer(mRecentsViewContainer));
|
||||
}
|
||||
|
||||
if (enableTaskbarNoRecreate()) {
|
||||
|
||||
Reference in New Issue
Block a user