Merge 84c81e99a8ece34cd27afd91307778db7b0c2901 on remote branch

Change-Id: I8d31a20a15b5cbf0db4290429d877b84e83cb947
diff --git a/iconloaderlib/src/com/android/launcher3/util/ComponentKey.java b/iconloaderlib/src/com/android/launcher3/util/ComponentKey.java
index 34bed94..7145103 100644
--- a/iconloaderlib/src/com/android/launcher3/util/ComponentKey.java
+++ b/iconloaderlib/src/com/android/launcher3/util/ComponentKey.java
@@ -19,6 +19,9 @@
 import android.content.ComponentName;
 import android.os.UserHandle;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
 import java.util.Arrays;
 
 public class ComponentKey {
@@ -54,6 +57,28 @@
      */
     @Override
     public String toString() {
-        return componentName.flattenToString() + "#" + user;
+        return componentName.flattenToString() + "#" + user.hashCode();
+    }
+
+    /**
+     * Parses and returns ComponentKey objected from string representation
+     * Returns null if string is not properly formatted
+     */
+    @Nullable
+    public static ComponentKey fromString(@NonNull String str) {
+        int sep = str.indexOf('#');
+        if (sep < 0 || (sep + 1) >= str.length()) {
+            return null;
+        }
+        ComponentName componentName = ComponentName.unflattenFromString(str.substring(0, sep));
+        if (componentName == null) {
+            return null;
+        }
+        try {
+            return new ComponentKey(componentName,
+                    UserHandle.getUserHandleForUid(Integer.parseInt(str.substring(sep + 1))));
+        } catch (NumberFormatException ex) {
+            return null;
+        }
     }
 }
\ No newline at end of file