Merge "Fix Taskbar Flicker with Recents or Running Apps Present" into main
This commit is contained in:
@@ -177,7 +177,7 @@ public class TaskbarControllers {
|
||||
bubbleControllers.ifPresent(controllers -> controllers.init(sharedState, this));
|
||||
taskbarInsetsController.init(this);
|
||||
voiceInteractionWindowController.init(this);
|
||||
taskbarRecentAppsController.init(this);
|
||||
taskbarRecentAppsController.init(this, sharedState.recentTasksBeforeTaskbarRecreate);
|
||||
taskbarTranslationController.init(this);
|
||||
taskbarEduTooltipController.init(this);
|
||||
keyboardQuickSwitchController.init(this);
|
||||
@@ -264,7 +264,6 @@ public class TaskbarControllers {
|
||||
*/
|
||||
public void onDestroy() {
|
||||
mAreAllControllersInitialized = false;
|
||||
mSharedState = null;
|
||||
|
||||
taskbarDragController.onDestroy();
|
||||
navbarButtonsViewController.onDestroy();
|
||||
@@ -289,6 +288,7 @@ public class TaskbarControllers {
|
||||
taskbarDesktopModeController.onDestroy();
|
||||
mControllersToLog = null;
|
||||
mBackgroundRendererControllers = null;
|
||||
mSharedState = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -171,7 +171,12 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
// tasks again if we have already requested it and the task list has not changed
|
||||
private var taskListChangeId = -1
|
||||
|
||||
fun init(taskbarControllers: TaskbarControllers) {
|
||||
private var recentTasksLoaded = false
|
||||
|
||||
fun init(taskbarControllers: TaskbarControllers, previousShownTasks: List<GroupTask>) {
|
||||
if (previousShownTasks.isNotEmpty()) {
|
||||
shownTasks = previousShownTasks
|
||||
}
|
||||
controllers = taskbarControllers
|
||||
if (canShowRunningApps || canShowRecentApps) {
|
||||
recentsModel.registerRecentTasksChangedListener(recentTasksChangedListener)
|
||||
@@ -180,6 +185,10 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
controllers.sharedState?.recentTasksBeforeTaskbarRecreate?.clear()
|
||||
if (shownTasks.isNotEmpty()) {
|
||||
controllers.sharedState?.recentTasksBeforeTaskbarRecreate?.addAll(shownTasks)
|
||||
}
|
||||
recentsModel.unregisterRecentTasksChangedListener()
|
||||
iconLoadRequests.forEach { it.cancel() }
|
||||
iconLoadRequests.clear()
|
||||
@@ -211,7 +220,9 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
)
|
||||
}
|
||||
|
||||
onRecentsOrHotseatChanged()
|
||||
if (recentTasksLoaded) {
|
||||
onRecentsOrHotseatChanged()
|
||||
}
|
||||
|
||||
return shownHotseatItems.toTypedArray()
|
||||
}
|
||||
@@ -229,6 +240,7 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re
|
||||
taskListChangeId =
|
||||
recentsModel.getTasks(
|
||||
{ tasks ->
|
||||
recentTasksLoaded = true
|
||||
allRecentTasks = tasks
|
||||
val oldRunningTaskdIds = runningTaskIds
|
||||
val oldMinimizedTaskIds = minimizedTaskIds
|
||||
|
||||
@@ -29,10 +29,12 @@ import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.view.InsetsFrameProvider;
|
||||
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -121,4 +123,6 @@ public class TaskbarSharedState {
|
||||
|
||||
// should show corner radius on persistent taskbar when in desktop mode.
|
||||
public boolean showCornerRadiusInDesktopMode = false;
|
||||
|
||||
public List<GroupTask> recentTasksBeforeTaskbarRecreate = new ArrayList<>();
|
||||
}
|
||||
|
||||
+4
-1
@@ -129,7 +129,10 @@ class TaskbarOverflowTest {
|
||||
if (!recentAppsController.canShowRunningApps) {
|
||||
recentAppsController.onDestroy()
|
||||
recentAppsController.canShowRunningApps = true
|
||||
recentAppsController.init(taskbarUnitTestRule.activityContext.controllers)
|
||||
recentAppsController.init(
|
||||
taskbarUnitTestRule.activityContext.controllers,
|
||||
emptyList(),
|
||||
)
|
||||
}
|
||||
|
||||
currentControllerInitCallback.invoke()
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ class TaskbarRecentAppsControllerTest : TaskbarBaseTestCase() {
|
||||
recentAppsController = TaskbarRecentAppsController(mockContext, mockRecentsModel)
|
||||
recentAppsController.canShowRunningApps = canShowRunningAndRecentAppsAtInit
|
||||
recentAppsController.canShowRecentApps = canShowRunningAndRecentAppsAtInit
|
||||
recentAppsController.init(taskbarControllers)
|
||||
recentAppsController.init(taskbarControllers, emptyList())
|
||||
taskbarControllers.onPostInit()
|
||||
|
||||
recentTasksChangedListener =
|
||||
|
||||
Reference in New Issue
Block a user