Skip TouchInteractionService preload if restore task is pending.
Otherwise the preload may cause launcher to restore too early, resulting
in data loss.
Bug: 131315856
Change-Id: I4412c8f691286ba142e9c748a908a3ed42713a82
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 4bc4c76..debed89 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -76,6 +76,7 @@
import com.android.launcher3.logging.EventLogArray;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.AppLaunchTracker;
+import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.UiThreadHelper;
@@ -710,6 +711,12 @@
return;
}
+ if (RestoreDbTask.isPending(this)) {
+ // Preloading while a restore is pending may cause launcher to start the restore
+ // too early.
+ return;
+ }
+
final ActivityControlHelper<BaseDraggingActivity> activityControl =
mOverviewComponentObserver.getActivityControlHelper();
if (activityControl.getCreatedActivity() == null) {