Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d97f8d1 authored by Pinyao Ting's avatar Pinyao Ting
Browse files

Disable Database overwrite upon restore

Launcher overwrites user's favorites table (icons in WorkSpace) upon new
install session from Play Store with install reason being restore. The
overwrite was introduced in the attempt to mitigate failed restore
session due to asynchronous nature of user profile restore, but it has
been causing general instability in backup and restore. Going forward
Launcher should be moving away from table overwrite approach, this will
be implemented in b/148284747.

Bug: 171774227
Test: manual
Change-Id: I91221544dbaeb42224ce9f595906b6d9f0e4aa89
parent f0d79cba
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -2343,9 +2343,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
            if (item.restoreStatus == LauncherAppWidgetInfo.RESTORE_COMPLETED) {
                // Verify that we own the widget
                if (appWidgetInfo == null) {
                    FileLog.e(TAG, "Removing invalid widget: id=" + item.appWidgetId
                            + ",title=" + item.title
                            + ",providerName=" + item.providerName.toShortString());
                    FileLog.e(TAG, "Removing invalid widget: id=" + item.appWidgetId);
                    getModelWriter().deleteWidgetInfo(item, getAppWidgetHost());
                    return null;
                }
+0 −6
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ import java.util.Arrays;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.Collectors;

public class LauncherProvider extends ContentProvider {
    private static final String TAG = "LauncherProvider";
@@ -932,11 +931,6 @@ public class LauncherProvider extends ContentProvider {
            final IntSet validWidgets = IntSet.wrap(LauncherDbUtils.queryIntArray(db,
                    Favorites.TABLE_NAME, Favorites.APPWIDGET_ID,
                    "itemType=" + Favorites.ITEM_TYPE_APPWIDGET, null, null));
            final String allWidgetIds = Arrays.stream(allWidgets).mapToObj(String::valueOf)
                    .collect(Collectors.joining(","));
            final String validWidgetIds = validWidgets.getArray().toConcatString();
            FileLog.d(TAG, "All widget ids: " + allWidgetIds);
            FileLog.d(TAG, "Valid widget ids: " + validWidgetIds);
            for (int widgetId : allWidgets) {
                if (!validWidgets.contains(widgetId)) {
                    try {
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public final class FeatureFlags {
            "ENABLE_OVERVIEW_CONTENT_PUSH", false, "Show Content Push button in Overview Actions");

    public static final BooleanFlag ENABLE_DATABASE_RESTORE = getDebugFlag(
            "ENABLE_DATABASE_RESTORE", true,
            "ENABLE_DATABASE_RESTORE", false,
            "Enable database restore when new restore session is created");

    public static final BooleanFlag ENABLE_SMARTSPACE_UNIVERSAL = getDebugFlag(
+1 −5
Original line number Diff line number Diff line
@@ -745,11 +745,7 @@ public class LoaderTask implements Runnable {
                                            + "span=" + appWidgetInfo.spanX + "x"
                                            + appWidgetInfo.spanY + " minSpan="
                                            + widgetProviderInfo.minSpanX + "x"
                                            + widgetProviderInfo.minSpanY
                                            + ", appWidgetInfo.provider="
                                            + appWidgetInfo.providerName.toShortString()
                                            + ", widgetProviderInfo.provider="
                                            + widgetProviderInfo.provider.toShortString());
                                            + widgetProviderInfo.minSpanY);
                                    continue;
                                }
                                if (!c.isOnWorkspaceOrHotseat()) {