Merge "Use source bounds/activity options for App Info System Shortcut" into ub-launcher3-dorval
diff --git a/res/layout/system_shortcut.xml b/res/layout/system_shortcut.xml
index 113b1be..dae9b5e 100644
--- a/res/layout/system_shortcut.xml
+++ b/res/layout/system_shortcut.xml
@@ -30,6 +30,7 @@
         android:paddingEnd="@dimen/popup_padding_end"
         android:textSize="14sp"
         android:fontFamily="sans-serif"
+        launcher:iconDisplay="shortcut_popup"
         launcher:layoutHorizontal="true" />
 
     <View
diff --git a/res/values-be-rBY/strings.xml b/res/values-be-rBY/strings.xml
index 8eb7e84..b820f59 100644
--- a/res/values-be-rBY/strings.xml
+++ b/res/values-be-rBY/strings.xml
@@ -46,7 +46,7 @@
     <string name="all_apps_home_button_label" msgid="252062713717058851">"Галоўная"</string>
     <string name="remove_drop_target_label" msgid="7812859488053230776">"Выдаліць"</string>
     <string name="uninstall_drop_target_label" msgid="4722034217958379417">"Выдаліць"</string>
-    <string name="app_info_drop_target_label" msgid="692894985365717661">"Звесткі пра праграму"</string>
+    <string name="app_info_drop_target_label" msgid="692894985365717661">"Звесткі пра праграмы"</string>
     <string name="permlab_install_shortcut" msgid="5632423390354674437">"усталёўваць ярлыкі"</string>
     <string name="permdesc_install_shortcut" msgid="923466509822011139">"Дазваляе праграмам дадаваць ярлыкі без умяшання карыстальніка."</string>
     <string name="permlab_read_settings" msgid="1941457408239617576">"счытваць налады і ярлыкі на Галоўнай старонцы"</string>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index 05502cf..3db1aa8 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -33,7 +33,7 @@
     <string name="long_accessible_way_to_add" msgid="4289502106628154155">"Toca dos veces y mantén pulsado el widget que quieras seleccionar o utiliza acciones personalizadas."</string>
     <string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
     <string name="widget_accessible_dims_format" msgid="3640149169885301790">"%1$d de ancho por %2$d de alto"</string>
-    <string name="add_item_request_drag_hint" msgid="5899764264480397019">"Mantén pulsado el elemento para añadirlo manualmente"</string>
+    <string name="add_item_request_drag_hint" msgid="5899764264480397019">"Mantenlo pulsado para añadirlo manualmente"</string>
     <string name="place_automatically" msgid="8064208734425456485">"Añadir automáticamente"</string>
     <string name="all_apps_search_bar_hint" msgid="7084713969757597256">"Busca aplicaciones"</string>
     <string name="all_apps_loading_message" msgid="7557140873644765180">"Cargando aplicaciones…"</string>
diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml
index 85b9712..858abfd 100644
--- a/res/values-iw/strings.xml
+++ b/res/values-iw/strings.xml
@@ -29,7 +29,7 @@
     <string name="shortcut_not_available" msgid="2536503539825726397">"קיצור הדרך אינו זמין"</string>
     <string name="home_screen" msgid="806512411299847073">"מסך דף הבית"</string>
     <string name="custom_actions" msgid="3747508247759093328">"פעולות מותאמות אישית"</string>
-    <string name="long_press_widget_to_add" msgid="7699152356777458215">"גע נגיעה רציפה בווידג\'ט כדי לבחור בו."</string>
+    <string name="long_press_widget_to_add" msgid="7699152356777458215">"אפשר לבחור את הווידג\'ט אם נוגעים בו נגיעה רציפה."</string>
     <string name="long_accessible_way_to_add" msgid="4289502106628154155">"הקש פעמיים וגע נגיעה רציפה בווידג\'ט כדי לבחור בו, או השתמש בפעולות מותאמות אישית."</string>
     <string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
     <string name="widget_accessible_dims_format" msgid="3640149169885301790">"‏רוחב %1$d על גובה %2$d"</string>
diff --git a/res/values-ky-rKG/strings.xml b/res/values-ky-rKG/strings.xml
index 2162292..cfdcc18 100644
--- a/res/values-ky-rKG/strings.xml
+++ b/res/values-ky-rKG/strings.xml
@@ -70,7 +70,7 @@
     <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>
+    <string name="settings_button_text" msgid="8119458837558863227">"Жөндөөлөр"</string>
     <string name="msg_disabled_by_admin" msgid="6898038085516271325">"Администраторуңуз өчүрүп койгон"</string>
     <string name="accessibility_action_overview" msgid="6257665857640347026">"Көз жүгүртүү"</string>
     <string name="allow_rotation_title" msgid="7728578836261442095">"Башкы экранды айлантууга уруксат берүү"</string>
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index eb36a18..0c655fd 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -30,7 +30,7 @@
     <string name="home_screen" msgid="806512411299847073">"Ana ekran"</string>
     <string name="custom_actions" msgid="3747508247759093328">"Özel işlemler"</string>
     <string name="long_press_widget_to_add" msgid="7699152356777458215">"Widget seçmek için dokunun ve basılı tutun."</string>
-    <string name="long_accessible_way_to_add" msgid="4289502106628154155">"Bir widget\'ı seçmek veya özel işlemleri kullanmak için iki kez hafifçe dokunun ve basılı tutun."</string>
+    <string name="long_accessible_way_to_add" msgid="4289502106628154155">"Bir widget\'ı seçmek veya özel işlemleri kullanmak için iki kez dokunun ve basılı tutun."</string>
     <string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
     <string name="widget_accessible_dims_format" msgid="3640149169885301790">"genişlik: %1$d, yükseklik: %2$d"</string>
     <string name="add_item_request_drag_hint" msgid="5899764264480397019">"Manuel olarak yerleştirmek için dokunun ve basılı tutun"</string>
@@ -63,8 +63,8 @@
     <string name="workspace_scroll_format" msgid="8458889198184077399">"Ana ekran %1$d / %2$d"</string>
     <string name="workspace_new_page" msgid="257366611030256142">"Yeni ana ekran sayfası"</string>
     <string name="folder_opened" msgid="94695026776264709">"Klasör açıldı, <xliff:g id="WIDTH">%1$d</xliff:g> x <xliff:g id="HEIGHT">%2$d</xliff:g>"</string>
-    <string name="folder_tap_to_close" msgid="4625795376335528256">"Klasörü kapatmak için hafifçe dokunun"</string>
-    <string name="folder_tap_to_rename" msgid="4017685068016979677">"Yeni adın kaydedilmesi için hafifçe dokunun"</string>
+    <string name="folder_tap_to_close" msgid="4625795376335528256">"Klasörü kapatmak için dokunun"</string>
+    <string name="folder_tap_to_rename" msgid="4017685068016979677">"Yeni adın kaydedilmesi için dokunun"</string>
     <string name="folder_closed" msgid="4100806530910930934">"Klasör kapatıldı"</string>
     <string name="folder_renamed" msgid="1794088362165669656">"Klasörün adı <xliff:g id="NAME">%1$s</xliff:g> olarak değiştirildi"</string>
     <string name="folder_name_format" msgid="6629239338071103179">"Klasör: <xliff:g id="NAME">%1$s</xliff:g>"</string>
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 9d1823d..27b8859 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3902,6 +3902,7 @@
         // Update AllApps
         if (mAppsView != null) {
             mAppsView.removeApps(appInfos);
+            tryAndUpdatePredictedApps();
         }
     }
 
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 14f4e6c..7178c5e 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -449,6 +449,12 @@
     }
 
     @Override
+    public void setInsets(Rect insets) {
+        super.setInsets(insets);
+        setBackgroundResource(insets.top == 0 ? 0 : R.drawable.workspace_bg);
+    }
+
+    @Override
     public LayoutParams generateLayoutParams(AttributeSet attrs) {
         return new LayoutParams(getContext(), attrs);
     }
diff --git a/src/com/android/launcher3/notification/NotificationItemView.java b/src/com/android/launcher3/notification/NotificationItemView.java
index 5e8e2c7..e5bf35a 100644
--- a/src/com/android/launcher3/notification/NotificationItemView.java
+++ b/src/com/android/launcher3/notification/NotificationItemView.java
@@ -76,6 +76,11 @@
         mSwipeHelper.setDisableHardwareLayers(true);
     }
 
+    public int getHeightMinusFooter() {
+        int footerHeight = mFooter.getParent() == null ? 0 : mFooter.getHeight();
+        return getHeight() - footerHeight;
+    }
+
     public Animator animateHeightRemoval(int heightToRemove) {
         final int newHeight = getHeight() - heightToRemove;
         return new PillHeightRevealOutlineProvider(mPillRect,
diff --git a/src/com/android/launcher3/notification/NotificationListener.java b/src/com/android/launcher3/notification/NotificationListener.java
index cb37f08..8dca699 100644
--- a/src/com/android/launcher3/notification/NotificationListener.java
+++ b/src/com/android/launcher3/notification/NotificationListener.java
@@ -232,8 +232,8 @@
         boolean isGroupHeader = (notification.flags & Notification.FLAG_GROUP_SUMMARY) != 0;
         CharSequence title = notification.extras.getCharSequence(Notification.EXTRA_TITLE);
         CharSequence text = notification.extras.getCharSequence(Notification.EXTRA_TEXT);
-        boolean missingTitleOrText = TextUtils.isEmpty(title) || TextUtils.isEmpty(text);
-        return (notification.contentIntent == null || isGroupHeader || missingTitleOrText);
+        boolean missingTitleAndText = TextUtils.isEmpty(title) && TextUtils.isEmpty(text);
+        return (isGroupHeader || missingTitleAndText);
     }
 
     public interface NotificationsChangedListener {
diff --git a/src/com/android/launcher3/notification/NotificationMainView.java b/src/com/android/launcher3/notification/NotificationMainView.java
index bb2dac0..d6e0272 100644
--- a/src/com/android/launcher3/notification/NotificationMainView.java
+++ b/src/com/android/launcher3/notification/NotificationMainView.java
@@ -21,6 +21,7 @@
 import android.content.res.ColorStateList;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.RippleDrawable;
+import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
@@ -83,11 +84,21 @@
     public void applyNotificationInfo(NotificationInfo mainNotification, View iconView,
            boolean animate) {
         mNotificationInfo = mainNotification;
-        mTitleView.setText(mNotificationInfo.title);
-        mTextView.setText(mNotificationInfo.text);
+        CharSequence title = mNotificationInfo.title;
+        CharSequence text = mNotificationInfo.text;
+        if (!TextUtils.isEmpty(title) && !TextUtils.isEmpty(text)) {
+            mTitleView.setText(title);
+            mTextView.setText(text);
+        } else {
+            mTitleView.setMaxLines(2);
+            mTitleView.setText(TextUtils.isEmpty(title) ? text : title);
+            mTextView.setVisibility(GONE);
+        }
         iconView.setBackground(mNotificationInfo.getIconForBackground(getContext(),
                 mBackgroundColor));
-        setOnClickListener(mNotificationInfo);
+        if (mNotificationInfo.intent != null) {
+            setOnClickListener(mNotificationInfo);
+        }
         setTranslationX(0);
         // Add a dummy ItemInfo so that logging populates the correct container and item types
         // instead of DEFAULT_CONTAINERTYPE and DEFAULT_ITEMTYPE, respectively.
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index dc7fa05..fb7f80c 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -107,6 +107,7 @@
 
     protected Animator mOpenCloseAnimator;
     private boolean mDeferContainerRemoval;
+    private AnimatorSet mReduceHeightAnimatorSet;
 
     public PopupContainerWithArrow(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
@@ -584,7 +585,7 @@
                     R.integer.config_removeNotificationViewDuration);
             final int spacing = getResources().getDimensionPixelSize(R.dimen.popup_items_spacing);
             removeNotification.play(reduceNotificationViewHeight(
-                    mNotificationItemView.getHeight() + spacing, duration));
+                    mNotificationItemView.getHeightMinusFooter() + spacing, duration));
             final View removeMarginView = mIsAboveIcon ? getItemViewAt(getItemCount() - 2)
                     : mNotificationItemView;
             if (removeMarginView != null) {
@@ -642,9 +643,12 @@
      * Animates the height of the notification item and the translationY of other items accordingly.
      */
     public Animator reduceNotificationViewHeight(int heightToRemove, int duration) {
+        if (mReduceHeightAnimatorSet != null) {
+            mReduceHeightAnimatorSet.cancel();
+        }
         final int translateYBy = mIsAboveIcon ? heightToRemove : -heightToRemove;
-        AnimatorSet animatorSet = LauncherAnimUtils.createAnimatorSet();
-        animatorSet.play(mNotificationItemView.animateHeightRemoval(heightToRemove));
+        mReduceHeightAnimatorSet = LauncherAnimUtils.createAnimatorSet();
+        mReduceHeightAnimatorSet.play(mNotificationItemView.animateHeightRemoval(heightToRemove));
         PropertyResetListener<View, Float> resetTranslationYListener
                 = new PropertyResetListener<>(TRANSLATION_Y, 0f);
         for (int i = 0; i < getItemCount(); i++) {
@@ -656,20 +660,21 @@
             ValueAnimator translateItem = ObjectAnimator.ofFloat(itemView, TRANSLATION_Y,
                     itemView.getTranslationY() + translateYBy).setDuration(duration);
             translateItem.addListener(resetTranslationYListener);
-            animatorSet.play(translateItem);
+            mReduceHeightAnimatorSet.play(translateItem);
         }
-        if (mIsAboveIcon) {
-            // All the items, including the notification item, translated down, but the
-            // container itself did not. This means the items would jump back to their
-            // original translation unless we update the container's translationY here.
-            animatorSet.addListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationEnd(Animator animation) {
+        mReduceHeightAnimatorSet.addListener(new AnimatorListenerAdapter() {
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                if (mIsAboveIcon) {
+                    // All the items, including the notification item, translated down, but the
+                    // container itself did not. This means the items would jump back to their
+                    // original translation unless we update the container's translationY here.
                     setTranslationY(getTranslationY() + translateYBy);
                 }
-            });
-        }
-        return animatorSet;
+                mReduceHeightAnimatorSet = null;
+            }
+        });
+        return mReduceHeightAnimatorSet;
     }
 
     @Override
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 08e17dc..f158f71 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -6,6 +6,7 @@
 import android.os.Bundle;
 import android.view.View;
 
+import com.android.launcher3.AbstractFloatingView;
 import com.android.launcher3.InfoDropTarget;
 import com.android.launcher3.ItemInfo;
 import com.android.launcher3.Launcher;
@@ -62,7 +63,7 @@
             return new View.OnClickListener() {
                 @Override
                 public void onClick(View view) {
-                    PopupContainerWithArrow.getOpen(launcher).close(true);
+                    AbstractFloatingView.closeAllOpenViews(launcher);
                     WidgetsBottomSheet widgetsBottomSheet =
                             (WidgetsBottomSheet) launcher.getLayoutInflater().inflate(
                                     R.layout.widgets_bottom_sheet, launcher.getDragLayer(), false);