Snap for 7101549 from 0b3194c95dda83a9d04de77e3115c3db2b054435 to sc-v2-release

Change-Id: I516e651074d370f3d5426c7c5fe05aed1bff358d
diff --git a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
index e7e47f2..4e1f25b 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
@@ -20,6 +20,7 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
+import android.graphics.drawable.InsetDrawable;
 import android.os.Build;
 import android.os.Process;
 import android.os.UserHandle;
@@ -152,6 +153,20 @@
         return BitmapInfo.of(icon, extractColor(icon));
     }
 
+    /**
+     * Creates an icon from the bitmap cropped to the current device icon shape
+     */
+    public BitmapInfo createShapedIconBitmap(Bitmap icon, UserHandle user) {
+        Drawable d = new FixedSizeBitmapDrawable(icon);
+        if (ATLEAST_OREO) {
+            float inset = AdaptiveIconDrawable.getExtraInsetFraction();
+            inset = inset / (1 + 2 * inset);
+            d = new AdaptiveIconDrawable(new ColorDrawable(Color.BLACK),
+                    new InsetDrawable(d, inset, inset, inset, inset));
+        }
+        return createBadgedIconBitmap(d, user, true);
+    }
+
     public BitmapInfo createBadgedIconBitmap(Drawable icon, UserHandle user,
             boolean shrinkNonAdaptiveIcons) {
         return createBadgedIconBitmap(icon, user, shrinkNonAdaptiveIcons, false, null);
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
index 4c634cb..5587a64 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
@@ -396,7 +396,7 @@
         }
         if (icon != null) {
             BaseIconFactory li = getIconFactory();
-            entry.bitmap = li.createIconBitmap(icon);
+            entry.bitmap = li.createShapedIconBitmap(icon, user);
             li.close();
         }
         if (!TextUtils.isEmpty(title) && entry.bitmap.icon != null) {
diff --git a/searchuilib/Android.bp b/searchuilib/Android.bp
index c01c710..69695c6 100644
--- a/searchuilib/Android.bp
+++ b/searchuilib/Android.bp
@@ -15,8 +15,8 @@
 android_library {
     name: "search_ui",
 
-    sdk_version: "system_current",
-    min_sdk_version: "system_current",
+    sdk_version: "current",
+    min_sdk_version: "current",
 
     srcs: [
         "src/**/*.java",
diff --git a/searchuilib/src/com/android/app/search/LayoutType.java b/searchuilib/src/com/android/app/search/LayoutType.java
index 055d551..9741b72 100644
--- a/searchuilib/src/com/android/app/search/LayoutType.java
+++ b/searchuilib/src/com/android/app/search/LayoutType.java
@@ -17,7 +17,7 @@
 package com.android.app.search;
 
 /**
- * Constants to be used with {@link android.app.search.SearchTarget}.
+ * Constants to be used with {@link SearchTarget}.
  */
 public class LayoutType {
 
@@ -48,6 +48,10 @@
     public static final String ICON_DOUBLE_HORIZONTAL_TEXT_BUTTON =
         "icon_texts_button";
 
+
+    // TODO: add diagram
+    public static final String ICON_SLICE = "slice";
+
     // TODO: add diagram
     public static final String TEXT_HEADER = "header";
 
diff --git a/searchuilib/src/com/android/app/search/ResultType.java b/searchuilib/src/com/android/app/search/ResultType.java
index 43ac626..698f5b8 100644
--- a/searchuilib/src/com/android/app/search/ResultType.java
+++ b/searchuilib/src/com/android/app/search/ResultType.java
@@ -28,6 +28,7 @@
     public static final int ACTION = 1 << 3;
     public static final int SETTING = 1 << 4;
     public static final int SCREENSHOT = 1 << 5;
-    public static final int TIPS = 1 << 2;
-    public static final int WIDGETS = 1 << 3;
+    public static final int TIPS = 1 << 6;
+    public static final int WIDGETS = 1 << 7;
+    public static final int PLAY = 1 << 8;
 }