Fixing launcher UI not reapplied properly when IDP changed as a result of display changes

> Removing unnecessary check when binding model data as its safe to bind old data,
  we should just not persist it (that check is already there in model writer)
> Adding additional check in model bind to skip old bind if there are multiple binds

Bug: 126259547
Bug: 118441555
Change-Id: Ic250d2af13797d3e70c6e1fc70da65ebe6ab8d70
This commit is contained in:
Sunny Goyal committed 2019-03-06 15:41:29 -08:00
1 parent 826405d095
commit 371ea051d1
6 files changed
+35 -86

No files matched your search

@@ -37,6 +37,7 @@ import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.LauncherSettings.Settings;
import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.ContentWriter;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -112,19 +113,18 @@ public class ModelWriter {
ItemInfo modelItem = mBgDataModel.itemsIdMap.get(itemId);
if (modelItem != null && item != modelItem) {
// check all the data is consistent
if (modelItem instanceof ShortcutInfo && item instanceof ShortcutInfo) {
ShortcutInfo modelShortcut = (ShortcutInfo) modelItem;
ShortcutInfo shortcut = (ShortcutInfo) item;
if (modelShortcut.title.toString().equals(shortcut.title.toString()) &&
modelShortcut.intent.filterEquals(shortcut.intent) &&
modelShortcut.id == shortcut.id &&
modelShortcut.itemType == shortcut.itemType &&
modelShortcut.container == shortcut.container &&
modelShortcut.screenId == shortcut.screenId &&
modelShortcut.cellX == shortcut.cellX &&
modelShortcut.cellY == shortcut.cellY &&
modelShortcut.spanX == shortcut.spanX &&
modelShortcut.spanY == shortcut.spanY) {
if (!Utilities.IS_DEBUG_DEVICE && !FeatureFlags.IS_DOGFOOD_BUILD &&
modelItem instanceof ShortcutInfo && item instanceof ShortcutInfo) {
if (modelItem.title.toString().equals(item.title.toString()) &&
modelItem.getIntent().filterEquals(item.getIntent()) &&
modelItem.id == item.id &&
modelItem.itemType == item.itemType &&
modelItem.container == item.container &&
modelItem.screenId == item.screenId &&
modelItem.cellX == item.cellX &&
modelItem.cellY == item.cellY &&
modelItem.spanX == item.spanX &&
modelItem.spanY == item.spanY) {
// For all intents and purposes, this is the same object
return;
}
@@ -310,7 +310,7 @@ public class ModelWriter {
/**
* Delete operations tracked using {@link #enqueueDeleteRunnable} will only be called
* if {@link #commitDelete} is called. Note that one of {@link #commitDelete()} or
* {@link #abortDelete()} MUST be called after this method, or else all delete
* {@link #abortDelete} MUST be called after this method, or else all delete
* operations will remain uncommitted indefinitely.
*/
public void prepareToUndoDelete() {
@@ -325,7 +325,7 @@ public class ModelWriter {
/**
* If {@link #prepareToUndoDelete} has been called, we store the Runnable to be run when
* {@link #commitDelete()} is called (or abandoned if {@link #abortDelete()} is called).
* {@link #commitDelete()} is called (or abandoned if {@link #abortDelete} is called).
* Otherwise, we run the Runnable immediately.
*/
private void enqueueDeleteRunnable(Runnable r) {