Merge "Prevent work profile widget DnD crash b/26079469" into ub-launcher3-burnaby-polish
diff --git a/WallpaperPicker/res/values-v21/styles.xml b/WallpaperPicker/res/values-v21/styles.xml
index de4b2f2..d2f7dd4 100644
--- a/WallpaperPicker/res/values-v21/styles.xml
+++ b/WallpaperPicker/res/values-v21/styles.xml
@@ -34,6 +34,9 @@
     </style>
 
     <style name="Theme" parent="@style/BaseWallpaperTheme">
+        <item name="android:windowTranslucentStatus">false</item>
+        <item name="android:windowTranslucentNavigation">false</item>
+        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
         <item name="android:statusBarColor">#00000000</item>
         <item name="android:navigationBarColor">#00000000</item>
         <item name="android:colorControlActivated">@color/launcher_accent_color</item>
diff --git a/res/values-hy-rAM/strings.xml b/res/values-hy-rAM/strings.xml
index 950cca2..74d98d6 100644
--- a/res/values-hy-rAM/strings.xml
+++ b/res/values-hy-rAM/strings.xml
@@ -67,7 +67,7 @@
     <string name="folder_tap_to_rename" msgid="9191075570492871147">"Հպեք՝ վերանվանումը պահելու համար"</string>
     <string name="folder_closed" msgid="4100806530910930934">"Պանակը փակ է"</string>
     <string name="folder_renamed" msgid="1794088362165669656">"Պանակը վերանվանվեց <xliff:g id="NAME">%1$s</xliff:g>"</string>
-    <string name="folder_name_format" msgid="6629239338071103179">"Թղթապանակ՝ <xliff:g id="NAME">%1$s</xliff:g>"</string>
+    <string name="folder_name_format" msgid="6629239338071103179">"Պանակ՝ <xliff:g id="NAME">%1$s</xliff:g>"</string>
     <string name="widget_button_text" msgid="2880537293434387943">"Վիջեթներ"</string>
     <string name="wallpaper_button_text" msgid="8404103075899945851">"Պաստառներ"</string>
     <string name="settings_button_text" msgid="8119458837558863227">"Կարգավորումներ"</string>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 6392123..c5be9f2 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -100,12 +100,8 @@
         <attr name="y" format="string" />
         <attr name="spanX" format="string" />
         <attr name="spanY" format="string" />
-        <!--
-          Temporarily disabling attr format definitions to prevent conflicts with support libs.
-           Re-enable it once AAPT starts supporting multiple definitions of same attr.
-        <attr name="icon" format="reference" />  
-        <attr name="title" format="reference" />
-        -->
+        <attr name="icon" format="reference" />
+        <attr name="title" format="string" />
         <attr name="uri" format="string" />
     </declare-styleable>
 
@@ -119,7 +115,7 @@
     </declare-styleable>
 
     <declare-styleable name="PreloadIconDrawable">
-        <attr name="ringBackground" format="reference" />
+        <attr name="background" format="reference" />
         <attr name="ringOutset" format="dimension" />
         <attr name="indicatorSize" format="dimension" />
     </declare-styleable>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 2b13159..4eee130 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -84,13 +84,13 @@
     <style name="DropTargetButton" parent="DropTargetButtonBase" />
 
     <style name="PreloadIcon">
-        <item name="ringBackground">@drawable/virtual_preload</item>
+        <item name="background">@drawable/virtual_preload</item>
         <item name="indicatorSize">4dp</item>
         <item name="ringOutset">4dp</item>
     </style>
 
     <style name="PreloadIcon.Folder">
-        <item name="ringBackground">@drawable/virtual_preload_folder</item>
+        <item name="background">@drawable/virtual_preload_folder</item>
         <item name="indicatorSize">4dp</item>
         <item name="ringOutset">4dp</item>
     </style>
diff --git a/src/com/android/launcher3/PendingAppWidgetHostView.java b/src/com/android/launcher3/PendingAppWidgetHostView.java
index 85d8658..1c02904 100644
--- a/src/com/android/launcher3/PendingAppWidgetHostView.java
+++ b/src/com/android/launcher3/PendingAppWidgetHostView.java
@@ -231,26 +231,30 @@
 
             int actualIconSize = (int) Math.min(iconSize, grid.iconSizePx);
 
-            // Recreate the setup text.
-            mSetupTextLayout = new StaticLayout(
-                    getResources().getText(R.string.gadget_setup_text), mPaint, availableWidth,
-                    Layout.Alignment.ALIGN_CENTER, 1, 0, true);
-            int textHeight = mSetupTextLayout.getHeight();
+            // Icon top when we do not draw the text
+            int iconTop = (getHeight() - actualIconSize) / 2;
+            mSetupTextLayout = null;
 
-            // Extra icon size due to the setting icon
-            float minHeightWithText = textHeight + actualIconSize * settingIconScaleFactor
-                    + grid.iconDrawablePaddingPx;
+            if (availableWidth > 0) {
+                // Recreate the setup text.
+                mSetupTextLayout = new StaticLayout(
+                        getResources().getText(R.string.gadget_setup_text), mPaint, availableWidth,
+                        Layout.Alignment.ALIGN_CENTER, 1, 0, true);
+                int textHeight = mSetupTextLayout.getHeight();
 
-            int iconTop;
-            if (minHeightWithText < availableHeight) {
-                // We can draw the text as well
-                iconTop =  (getHeight() - textHeight -
-                        grid.iconDrawablePaddingPx - actualIconSize) / 2;
+                // Extra icon size due to the setting icon
+                float minHeightWithText = textHeight + actualIconSize * settingIconScaleFactor
+                        + grid.iconDrawablePaddingPx;
 
-            } else {
-                // The text will not fit. Only draw the icons.
-                iconTop = (getHeight() - actualIconSize) / 2;
-                mSetupTextLayout = null;
+                if (minHeightWithText < availableHeight) {
+                    // We can draw the text as well
+                    iconTop = (getHeight() - textHeight -
+                            grid.iconDrawablePaddingPx - actualIconSize) / 2;
+
+                } else {
+                    // We can't draw the text. Let the iconTop be same as before.
+                    mSetupTextLayout = null;
+                }
             }
 
             mRect.set(0, 0, actualIconSize, actualIconSize);
diff --git a/src/com/android/launcher3/PreloadIconDrawable.java b/src/com/android/launcher3/PreloadIconDrawable.java
index a31ae0b..908c8b9 100644
--- a/src/com/android/launcher3/PreloadIconDrawable.java
+++ b/src/com/android/launcher3/PreloadIconDrawable.java
@@ -60,7 +60,7 @@
 
     public void applyPreloaderTheme(Theme t) {
         TypedArray ta = t.obtainStyledAttributes(R.styleable.PreloadIconDrawable);
-        mBgDrawable = ta.getDrawable(R.styleable.PreloadIconDrawable_ringBackground);
+        mBgDrawable = ta.getDrawable(R.styleable.PreloadIconDrawable_background);
         mBgDrawable.setFilterBitmap(true);
         mPaint.setStrokeWidth(ta.getDimension(R.styleable.PreloadIconDrawable_indicatorSize, 0));
         mRingOutset = ta.getDimensionPixelSize(R.styleable.PreloadIconDrawable_ringOutset, 0);