Fixes missing folder label after launcher restarts.

Rootcause: FolderInfo was persisted into DB only when folder options are updated. Hence when folder was created (Folder option remains suggested) its title was not persisted into DB.

Fix: Persists folderInfo into DB always whenever title is updated

Bug: 159904890
Change-Id: If0d20b0d7fa6966dd7bb40a2c07bcb22bd0893e0
(cherry picked from commit 6ab4da8aa0)
This commit is contained in:
thiruram
2020-06-25 10:13:14 -07:00
committed by Thiru Ramasamy
parent 6b79a3767d
commit e148652075
@@ -226,7 +226,7 @@ public class FolderInfo extends ItemInfo {
}
// Updating title to same value does not change any states.
if (title != null && title == this.title) {
if (title != null && title.equals(this.title)) {
return;
}
@@ -236,7 +236,15 @@ public class FolderInfo extends ItemInfo {
: title.length() == 0 ? LabelState.EMPTY :
getAcceptedSuggestionIndex().isPresent() ? LabelState.SUGGESTED
: LabelState.MANUAL;
setOption(FLAG_MANUAL_FOLDER_NAME, newLabelState.equals(LabelState.MANUAL), modelWriter);
if (newLabelState.equals(LabelState.MANUAL)) {
options |= FLAG_MANUAL_FOLDER_NAME;
} else {
options &= ~FLAG_MANUAL_FOLDER_NAME;
}
if (modelWriter != null) {
modelWriter.updateItemInDatabase(this);
}
}
/**