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

Commit 249a510a authored by Sunny Goyal's avatar Sunny Goyal
Browse files

[DO NOT MERGE] Adding minSpanX and minSpanY for all the launcher widgets

Bug: 22353460
Change-Id: Id4450dee42a83e4603dcd56e1c4dec2b0e405858
parent 3fec14be
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -108,4 +108,8 @@ message Widget {
  optional bool configure = 3;
  optional Resource icon = 4;
  optional Resource preview = 5;

  // Assume that a widget is resizable upto 2x2 if no data is available
  optional int32 minSpanX = 6 [default = 2];
  optional int32 minSpanY = 7 [default = 2];
}
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
            LauncherClings.synchonouslyMarkFirstRunClingDismissed(this);

            // TODO: Update the backup set to include rank.
            if (mHelper.restoredBackupVersion <= 2) {
            if (mHelper.restoredBackupVersion <= 3) {
                LauncherAppState.getLauncherProvider().updateFolderItemsRank();
            }
        } else {
+8 −5
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import android.app.backup.BackupDataInputStream;
import android.app.backup.BackupDataOutput;
import android.app.backup.BackupHelper;
import android.app.backup.BackupManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -58,7 +57,6 @@ import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.zip.CRC32;

@@ -70,7 +68,7 @@ public class LauncherBackupHelper implements BackupHelper {
    private static final boolean VERBOSE = LauncherBackupAgentHelper.VERBOSE;
    private static final boolean DEBUG = LauncherBackupAgentHelper.DEBUG;

    private static final int BACKUP_VERSION = 2;
    private static final int BACKUP_VERSION = 3;
    private static final int MAX_JOURNAL_SIZE = 1000000;

    // Journal key is such that it is always smaller than any dynamically generated
@@ -171,6 +169,7 @@ public class LauncherBackupHelper implements BackupHelper {
                mExistingKeys.add(keyToBackupKey(key));
            }
        }
        restoredBackupVersion = journal.backupVersion;
    }

    /**
@@ -313,7 +312,6 @@ public class LauncherBackupHelper implements BackupHelper {
                MessageNano.mergeFrom(journal, readCheckedBytes(mBuffer, dataSize));
                applyJournal(journal);
                restoreSuccessful = isBackupCompatible(journal);
                restoredBackupVersion = journal.backupVersion;
                return;
            }

@@ -639,7 +637,7 @@ public class LauncherBackupHelper implements BackupHelper {
                } else {
                    Log.w(TAG, "empty intent on appwidget: " + id);
                }
                if (mExistingKeys.contains(backupKey)) {
                if (mExistingKeys.contains(backupKey) && restoredBackupVersion >= BACKUP_VERSION) {
                    if (DEBUG) Log.d(TAG, "already saved widget " + backupKey);

                    // remember that we already backed this up previously
@@ -942,6 +940,11 @@ public class LauncherBackupHelper implements BackupHelper {
                widget.preview.dpi = dpi;
            }
        }

        widget.minSpanX = (info.resizeMode & LauncherAppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0
                ? info.minSpanX : -1;
        widget.minSpanY = (info.resizeMode & LauncherAppWidgetProviderInfo.RESIZE_VERTICAL) != 0
                ? info.minSpanY : -1;
        return widget;
    }