Merge mainline-release 6664920 to master - DO NOT MERGE

Merged-In: I0631b58f00dc0c39222e538a31e570206cf546f3
Change-Id: Ib98711b240a5856a3c902e9ef3a25eadfd9ae749
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
index 37aa0da..6c4c5d3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
@@ -42,6 +42,7 @@
 import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE;
 import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK;
 import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
+import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
 
 import android.animation.Animator;
 import android.animation.TimeInterpolator;
@@ -90,6 +91,7 @@
 import com.android.systemui.shared.system.InputConsumerController;
 import com.android.systemui.shared.system.LatencyTrackerCompat;
 import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
+import com.android.systemui.shared.system.TaskInfoCompat;
 import com.android.systemui.shared.system.TaskStackChangeListener;
 
 /**
@@ -940,7 +942,8 @@
         @Override
         public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
                 boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
-            if (task.taskId == mGestureState.getRunningTaskId()) {
+            if (task.taskId == mGestureState.getRunningTaskId()
+                    && TaskInfoCompat.getActivityType(task) != ACTIVITY_TYPE_HOME) {
                 // Since this is an edge case, just cancel and relaunch with default activity
                 // options (since we don't know if there's an associated app icon to launch from)
                 endRunningWindowAnim(true /* cancel */);
@@ -1327,6 +1330,6 @@
 
     private static boolean isNotInRecents(RemoteAnimationTargetCompat app) {
         return app.isNotInRecents
-                || app.activityType == RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
+                || app.activityType == ACTIVITY_TYPE_HOME;
     }
 }
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
index d972c0f..1c77a05 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
@@ -19,7 +19,6 @@
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
 
 import android.content.Context;
-import android.content.Intent;
 import android.graphics.PointF;
 import android.view.MotionEvent;
 
@@ -80,9 +79,7 @@
 
     @Override
     public void onSwipeUp(boolean wasFling, PointF finalVelocity) {
-        mContext.startActivity(new Intent(Intent.ACTION_MAIN)
-                .addCategory(Intent.CATEGORY_HOME)
-                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+        mContext.startActivity(mGestureState.getHomeIntent());
         ActiveGestureLog.INSTANCE.addLog("startQuickstep");
         BaseActivity activity = BaseDraggingActivity.fromContext(mContext);
         int pageIndex = -1; // This number doesn't reflect workspace page index.
diff --git a/res/values-rm/strings.xml b/res/values-rm/strings.xml
new file mode 100644
index 0000000..0758148
--- /dev/null
+++ b/res/values-rm/strings.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+/*
+* Copyright (C) 2008 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- no translation found for application_name (5181331383435256801) -->
+    <skip />
+    <!-- no translation found for home (7658288663002113681) -->
+    <skip />
+    <!-- no translation found for uid_name (7820867637514617527) -->
+    <skip />
+    <string name="folder_name" msgid="7371454440695724752"></string>
+    <!-- no translation found for activity_not_found (8071924732094499514) -->
+    <skip />
+    <!-- no translation found for widgets_tab_label (2921133187116603919) -->
+    <skip />
+    <!-- no translation found for widget_adder (3201040140710381657) -->
+    <skip />
+    <!-- no translation found for toggle_weight_watcher (5645299835184636119) -->
+    <skip />
+    <!-- no translation found for long_press_widget_to_add (7699152356777458215) -->
+    <skip />
+    <!-- no translation found for market (2619650989819296998) -->
+    <skip />
+    <!-- no translation found for widget_dims_format (2370757736025621599) -->
+    <skip />
+    <!-- no translation found for external_drop_widget_error (3165821058322217155) -->
+    <skip />
+    <!-- no translation found for external_drop_widget_pick_title (3486317258037690630) -->
+    <skip />
+    <!-- no translation found for rename_folder_label (3727762225964550653) -->
+    <skip />
+    <!-- no translation found for rename_folder_title (3771389277707820891) -->
+    <skip />
+    <!-- no translation found for rename_action (5559600076028658757) -->
+    <skip />
+    <!-- no translation found for cancel_action (7009134900002915310) -->
+    <skip />
+    <!-- no translation found for menu_item_add_item (1264911265836810421) -->
+    <skip />
+    <!-- no translation found for group_applications (3797214114206693605) -->
+    <skip />
+    <!-- no translation found for group_shortcuts (6012256992764410535) -->
+    <skip />
+    <!-- no translation found for group_widgets (1569030723286851002) -->
+    <skip />
+    <!-- no translation found for completely_out_of_space (6106288382070760318) -->
+    <skip />
+    <!-- no translation found for out_of_space (4691004494942118364) -->
+    <skip />
+    <!-- no translation found for hotseat_out_of_space (7448809638125333693) -->
+    <skip />
+    <!-- no translation found for invalid_hotseat_item (5779907847267573691) -->
+    <skip />
+    <!-- no translation found for shortcut_installed (1701742129426969556) -->
+    <skip />
+    <!-- no translation found for shortcut_uninstalled (8176767991305701821) -->
+    <skip />
+    <!-- no translation found for shortcut_duplicate (9167217446062498127) -->
+    <skip />
+    <!-- no translation found for title_select_shortcut (6680642571148153868) -->
+    <skip />
+    <!-- no translation found for title_select_application (3280812711670683644) -->
+    <skip />
+    <!-- no translation found for all_apps_button_label (9110807029020582876) -->
+    <skip />
+    <!-- no translation found for all_apps_home_button_label (252062713717058851) -->
+    <skip />
+    <!-- no translation found for delete_zone_label_workspace (4009607676751398685) -->
+    <skip />
+    <!-- no translation found for delete_zone_label_all_apps (8083826390278958980) -->
+    <skip />
+    <!-- no translation found for delete_target_label (1822697352535677073) -->
+    <skip />
+    <!-- no translation found for delete_target_uninstall_label (5100785476250872595) -->
+    <skip />
+    <!-- no translation found for info_target_label (8053346143994679532) -->
+    <skip />
+    <!-- no translation found for accessibility_search_button (1628520399424565142) -->
+    <skip />
+    <!-- no translation found for accessibility_voice_search_button (4637324840434406584) -->
+    <skip />
+    <!-- no translation found for accessibility_all_apps_button (2603132375383800483) -->
+    <skip />
+    <!-- no translation found for accessibility_delete_button (6466114477993744621) -->
+    <skip />
+    <!-- no translation found for delete_zone_label_all_apps_system_app (449755632749610895) -->
+    <skip />
+    <!-- no translation found for cab_menu_delete_app (7435191475867183689) -->
+    <skip />
+    <!-- no translation found for cab_menu_app_info (8593722221450362342) -->
+    <skip />
+    <!-- no translation found for cab_app_selection_text (374688303047985416) -->
+    <skip />
+    <!-- no translation found for cab_widget_selection_text (1833458597831541241) -->
+    <skip />
+    <!-- no translation found for cab_folder_selection_text (7999992513806132118) -->
+    <skip />
+    <!-- no translation found for cab_shortcut_selection_text (2103811025667946450) -->
+    <skip />
+    <!-- no translation found for permlab_install_shortcut (5632423390354674437) -->
+    <skip />
+    <!-- no translation found for permdesc_install_shortcut (923466509822011139) -->
+    <skip />
+    <!-- no translation found for permlab_uninstall_shortcut (864595034498083837) -->
+    <skip />
+    <!-- no translation found for permdesc_uninstall_shortcut (5134129545001836849) -->
+    <skip />
+    <!-- no translation found for permlab_read_settings (1941457408239617576) -->
+    <skip />
+    <!-- no translation found for permdesc_read_settings (5833423719057558387) -->
+    <skip />
+    <!-- no translation found for permlab_write_settings (3574213698004620587) -->
+    <skip />
+    <!-- no translation found for permdesc_write_settings (5440712911516509985) -->
+    <skip />
+    <!-- no translation found for gadget_error_text (6081085226050792095) -->
+    <skip />
+    <!-- no translation found for uninstall_system_app_text (4172046090762920660) -->
+    <skip />
+    <!-- no translation found for dream_name (1530253749244328964) -->
+    <skip />
+    <!-- no translation found for folder_hint_text (6617836969016293992) -->
+    <skip />
+    <!-- no translation found for workspace_description_format (2950174241104043327) -->
+    <skip />
+    <!-- no translation found for default_scroll_format (7475544710230993317) -->
+    <skip />
+    <!-- no translation found for workspace_scroll_format (8458889198184077399) -->
+    <skip />
+    <!-- no translation found for apps_customize_apps_scroll_format (370005296147130238) -->
+    <skip />
+    <!-- no translation found for apps_customize_widgets_scroll_format (3106209519974971521) -->
+    <skip />
+    <!-- no translation found for first_run_cling_title (2459738000155917941) -->
+    <skip />
+    <!-- no translation found for first_run_cling_description (6447072552696253358) -->
+    <skip />
+    <!-- no translation found for first_run_cling_create_screens_hint (6950729526680114157) -->
+    <skip />
+    <!-- no translation found for migration_cling_title (9181776667882933767) -->
+    <skip />
+    <!-- no translation found for migration_cling_description (2752413805582227644) -->
+    <skip />
+    <!-- no translation found for migration_cling_copy_apps (946331230090919440) -->
+    <skip />
+    <!-- no translation found for migration_cling_use_default (2626475813981258626) -->
+    <skip />
+    <!-- no translation found for workspace_cling_title (5626202359865825661) -->
+    <skip />
+    <!-- no translation found for workspace_cling_move_item (528201129978005352) -->
+    <skip />
+    <!-- no translation found for folder_cling_title (3894908818693254164) -->
+    <skip />
+    <!-- no translation found for folder_cling_create_folder (6158215559475836131) -->
+    <skip />
+    <!-- no translation found for cling_dismiss (8962359497601507581) -->
+    <skip />
+    <!-- no translation found for folder_opened (94695026776264709) -->
+    <skip />
+    <!-- no translation found for folder_tap_to_close (1884479294466410023) -->
+    <skip />
+    <!-- no translation found for folder_tap_to_rename (9191075570492871147) -->
+    <skip />
+    <!-- no translation found for folder_closed (4100806530910930934) -->
+    <skip />
+    <!-- no translation found for folder_renamed (1794088362165669656) -->
+    <skip />
+    <!-- no translation found for folder_name_format (6629239338071103179) -->
+    <skip />
+    <!-- no translation found for widget_button_text (2880537293434387943) -->
+    <skip />
+    <!-- no translation found for wallpaper_button_text (8404103075899945851) -->
+    <skip />
+    <!-- no translation found for settings_button_text (8119458837558863227) -->
+    <skip />
+    <!-- no translation found for package_state_enqueued (6227252464303085641) -->
+    <skip />
+    <!-- no translation found for package_state_downloading (4088770468458724721) -->
+    <skip />
+    <!-- no translation found for package_state_installing (7588193972189849870) -->
+    <skip />
+    <!-- no translation found for package_state_unknown (7592128424511031410) -->
+    <skip />
+    <!-- no translation found for package_state_error (7672093962724223588) -->
+    <skip />
+</resources>
diff --git a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java
index 3a252dc..0e760f9 100644
--- a/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/LoaderCursorTest.java
@@ -110,7 +110,7 @@
     public void getAppShortcutInfo_dontAllowMissing_invalidComponent() {
         initCursor(ITEM_TYPE_APPLICATION, "");
         assertTrue(mLoaderCursor.moveToNext());
-        ComponentName cn = new ComponentName(mContext.getPackageName(), "dummy-do");
+        ComponentName cn = new ComponentName(mContext.getPackageName(), "placeholder-do");
         assertNull(mLoaderCursor.getAppShortcutInfo(
                 new Intent().setComponent(cn), false /* allowMissingTarget */, true));
     }
@@ -136,7 +136,7 @@
         initCursor(ITEM_TYPE_APPLICATION, "");
         assertTrue(mLoaderCursor.moveToNext());
 
-        ComponentName cn = new ComponentName(mContext.getPackageName(), "dummy-do");
+        ComponentName cn = new ComponentName(mContext.getPackageName(), "placeholder-do");
         WorkspaceItemInfo info = Executors.MODEL_EXECUTOR.submit(() ->
                 mLoaderCursor.getAppShortcutInfo(
                         new Intent().setComponent(cn), true  /* allowMissingTarget */, true))
diff --git a/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java b/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java
index ee73b82..4184d33 100644
--- a/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java
+++ b/robolectric_tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java
@@ -44,7 +44,7 @@
     @Test
     public void testMigrateProfileId() throws Exception {
         SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase();
-        // Add some dummy data
+        // Add some mock data
         for (int i = 0; i < 5; i++) {
             ContentValues values = new ContentValues();
             values.put(Favorites._ID, i);
@@ -64,7 +64,7 @@
     @Test
     public void testChangeDefaultColumn() throws Exception {
         SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase();
-        // Add some dummy data
+        // Add some mock data
         for (int i = 0; i < 5; i++) {
             ContentValues values = new ContentValues();
             values.put(Favorites._ID, i);
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index e3cd0bd..49caa93 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -369,8 +369,10 @@
         if (allAppsHasDifferentNumColumns()) {
             allAppsIconSizePx = ResourceUtils.pxFromDp(inv.allAppsIconSize, mInfo.metrics);
             allAppsIconTextSizePx = Utilities.pxFromSp(inv.allAppsIconTextSize, mInfo.metrics);
-            allAppsCellHeightPx = getCellSize(inv.numAllAppsColumns, inv.numAllAppsColumns).y;
             allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx;
+            // We use 4 below to ensure labels are closer to their corresponding icon.
+            allAppsCellHeightPx = Math.round(allAppsIconSizePx + allAppsIconTextSizePx
+                    + (4 * allAppsIconDrawablePaddingPx));
         } else {
             allAppsIconSizePx = iconSizePx;
             allAppsIconTextSizePx = iconTextSizePx;
diff --git a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java
index f72a988..bcb5427 100644
--- a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java
+++ b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java
@@ -81,6 +81,10 @@
             return false;
         }
 
+        if (requestSimpleFuzzySearch(query)) {
+            return title.toLowerCase().contains(query);
+        }
+
         int lastType;
         int thisType = Character.UNASSIGNED;
         int nextType = Character.getType(title.codePointAt(0));
@@ -181,4 +185,17 @@
             return new StringMatcher();
         }
     }
+
+    private static boolean requestSimpleFuzzySearch(String s) {
+        for (int i = 0; i < s.length(); ) {
+            int codepoint = s.codePointAt(i);
+            i += Character.charCount(codepoint);
+            switch (Character.UnicodeScript.of(codepoint)) {
+                case HAN:
+                    //Character.UnicodeScript.HAN: use String.contains to match
+                    return true;
+            }
+        }
+        return false;
+    }
 }
diff --git a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
index a7bf1f3..1e1d093 100644
--- a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
+++ b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
@@ -216,7 +216,7 @@
         if (cn == null && (itemType == Favorites.ITEM_TYPE_SHORTCUT || hasStatusFlag(
                 FLAG_SUPPORTS_WEB_UI | FLAG_AUTOINSTALL_ICON | FLAG_RESTORED_ICON))) {
             // Legacy shortcuts and promise icons with web UI may not have a componentName but just
-            // a packageName. In that case create a dummy componentName instead of adding additional
+            // a packageName. In that case create a empty componentName instead of adding additional
             // check everywhere.
             String pkg = intent.getPackage();
             return pkg == null ? null : new ComponentName(pkg, IconCache.EMPTY_CLASS_NAME);
diff --git a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java
index bdf01f3..39709a9 100644
--- a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java
+++ b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java
@@ -68,8 +68,8 @@
 
         assertTrue(DefaultAppSearchAlgorithm.matches(getInfo("电子邮件"), "电", MATCHER));
         assertTrue(DefaultAppSearchAlgorithm.matches(getInfo("电子邮件"), "电子", MATCHER));
-        assertFalse(DefaultAppSearchAlgorithm.matches(getInfo("电子邮件"), "子", MATCHER));
-        assertFalse(DefaultAppSearchAlgorithm.matches(getInfo("电子邮件"), "邮件", MATCHER));
+        assertTrue(DefaultAppSearchAlgorithm.matches(getInfo("电子邮件"), "子", MATCHER));
+        assertTrue(DefaultAppSearchAlgorithm.matches(getInfo("电子邮件"), "邮件", MATCHER));
 
         assertFalse(DefaultAppSearchAlgorithm.matches(getInfo("Bot"), "ba", MATCHER));
         assertFalse(DefaultAppSearchAlgorithm.matches(getInfo("bot"), "ba", MATCHER));