summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Utilities.java
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2019-05-13 14:57:50 -0700
committerJonathan Miranda <jonmiranda@google.com>2019-05-14 17:30:04 +0000
commitc7206caf6e6d6006bbc4909e140c6720e5c472d2 (patch)
treedeea6aeab4b08356b3e58f55696ad1c84119fd0e /src/com/android/launcher3/Utilities.java
parent512a3c59eaccb6cac505258ebfc2795904709d59 (diff)
downloadandroid_packages_apps_Trebuchet-c7206caf6e6d6006bbc4909e140c6720e5c472d2.tar.gz
android_packages_apps_Trebuchet-c7206caf6e6d6006bbc4909e140c6720e5c472d2.tar.bz2
android_packages_apps_Trebuchet-c7206caf6e6d6006bbc4909e140c6720e5c472d2.zip
Ensure app widget ids are restored after database is sanitized.
Previously, it was possible for AppWidgetsRestoredReceiver to start the restore process before work profile has finished restoring which resulted in the work profile items being removed from the workspace. Bug: 131315856 Change-Id: I2f295a1ca91f1996522bcc8052aa139979526e3b
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r--src/com/android/launcher3/Utilities.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 5cfd95cd0..02fc84b9a 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -74,6 +74,7 @@ import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
+import java.util.StringTokenizer;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -652,4 +653,23 @@ public final class Utilities {
return null;
}
}
+
+ public static int[] getIntArrayFromString(String tokenized) {
+ StringTokenizer tokenizer = new StringTokenizer(tokenized, ",");
+ int[] array = new int[tokenizer.countTokens()];
+ int count = 0;
+ while (tokenizer.hasMoreTokens()) {
+ array[count] = Integer.parseInt(tokenizer.nextToken());
+ count++;
+ }
+ return array;
+ }
+
+ public static String getStringFromIntArray(int[] array) {
+ StringBuilder str = new StringBuilder();
+ for (int value : array) {
+ str.append(value).append(",");
+ }
+ return str.toString();
+ }
}