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
This commit is contained in:
Sunny Goyal
2015-06-25 16:37:44 -07:00
parent b41b836968
commit 4e5cc64eaf
8 changed files with 178 additions and 98 deletions

View File

@@ -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){