Removing all usage of LauncherProvider

Also fixing a race condition in model when an item update/delete task
gets queued and executed after the model has reloaded (making the old
data obsolete)

Bug: 277345535
Bug: 263079498
Test: Presubmit
Flag: N/A
Change-Id: Ibd4bdbb3eece05b38b73a22a4be5f368df3754f0
This commit is contained in:
Sunny Goyal
2023-05-17 12:44:03 -07:00
parent 859d0d87e2
commit 7b9e28f152
26 changed files with 326 additions and 518 deletions

View File

@@ -31,7 +31,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.testing.shared.TestProtocol;
@@ -189,10 +189,11 @@ public class DebugTestInformationHandler extends TestInformationHandler {
case TestProtocol.REQUEST_CLEAR_DATA: {
final long identity = Binder.clearCallingIdentity();
try {
LauncherSettings.Settings.call(mContext.getContentResolver(),
LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
MAIN_EXECUTOR.submit(() ->
LauncherAppState.getInstance(mContext).getModel().forceReload());
MODEL_EXECUTOR.execute(() -> {
LauncherModel model = LauncherAppState.getInstance(mContext).getModel();
model.getModelDbController().createEmptyDB();
MAIN_EXECUTOR.execute(model::forceReload);
});
return response;
} finally {
Binder.restoreCallingIdentity(identity);