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
diff --git a/src/com/android/launcher3/model/data/FolderInfo.java b/src/com/android/launcher3/model/data/FolderInfo.java
index 05ce06a..41ccbd7 100644
--- a/src/com/android/launcher3/model/data/FolderInfo.java
+++ b/src/com/android/launcher3/model/data/FolderInfo.java
@@ -226,7 +226,7 @@
         }
 
         // 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 @@
                         : 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);
+        }
     }
 
     /**