summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Utilities.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-06-25 16:37:44 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-06-25 17:41:06 -0700
commit4e5cc64eaf1f63d866d51ce0a6bbafb3d4085c21 (patch)
treea8428ef38bbf3c0576877f29b0c6621885c71a08 /src/com/android/launcher3/Utilities.java
parentb41b8369687025fe8d661eae8928cbbd9733da21 (diff)
downloadandroid_packages_apps_Trebuchet-4e5cc64eaf1f63d866d51ce0a6bbafb3d4085c21.tar.gz
android_packages_apps_Trebuchet-4e5cc64eaf1f63d866d51ce0a6bbafb3d4085c21.tar.bz2
android_packages_apps_Trebuchet-4e5cc64eaf1f63d866d51ce0a6bbafb3d4085c21.zip
Fixing backup restore
> Not deleting icons from cache, which have not been restored yet > Not checking if activity exists during DB migration. Missing components are removed during loader anyway > Backing up and restoring bitmaps even when iconType is resource. This allows us to show a proper bitmap icon, until the correct resource is available. > Loading proper shortcutResource icon for promiseIcons > Checking against promise intent when verifying duplicates > A launcher App intent can contain EXTRA_PROFILE Bug: 22094970 Change-Id: I982971338846733833ec133119393af0bea0eb08
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r--src/com/android/launcher3/Utilities.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index af118d7f6..0d13c6990 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -45,6 +45,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
+import android.os.Bundle;
import android.os.Process;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@@ -62,6 +63,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Locale;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -676,14 +678,23 @@ public final class Utilities {
* @param launchIntent The intent that will be launched when the shortcut is clicked.
*/
public static boolean isLauncherAppTarget(Intent launchIntent) {
- return launchIntent != null
+ if (launchIntent != null
&& Intent.ACTION_MAIN.equals(launchIntent.getAction())
&& launchIntent.getComponent() != null
&& launchIntent.getCategories() != null
&& launchIntent.getCategories().size() == 1
&& launchIntent.hasCategory(Intent.CATEGORY_LAUNCHER)
- && launchIntent.getExtras() == null
- && TextUtils.isEmpty(launchIntent.getDataString());
+ && TextUtils.isEmpty(launchIntent.getDataString())) {
+ // An app target can either have no extra or have ItemInfo.EXTRA_PROFILE.
+ Bundle extras = launchIntent.getExtras();
+ if (extras == null) {
+ return true;
+ } else {
+ Set<String> keys = extras.keySet();
+ return keys.size() == 1 && keys.contains(ItemInfo.EXTRA_PROFILE);
+ }
+ };
+ return false;
}
public static float dpiFromPx(int size, DisplayMetrics metrics){