From a9f4bffbfc9802ca86a813de2bccea9572f710af Mon Sep 17 00:00:00 2001 From: yingrenw Date: Thu, 6 Jul 2017 18:37:35 +0800 Subject: [PATCH] Launcher3: Can't search out local app by Chinese Description: Chinese content type is Character.OTHER_LETTER. When key matches,it check the content type. And if type is Character.OTHER_LETTER, it doesn't support search and break. When the content type is Character.OTHER_LETTER, make it work normally. Bug: 63534074 Change-Id: I3713f24c9206fe16a8da2a23e6c90d68079dd533 --- .../launcher3/allapps/search/DefaultAppSearchAlgorithm.java | 3 ++- .../allapps/search/DefaultAppSearchAlgorithmTest.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java index 8a0fd46f7c..43033024f2 100644 --- a/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java +++ b/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithm.java @@ -132,7 +132,8 @@ public class DefaultAppSearchAlgorithm implements SearchAlgorithm { // Always a break point for a symbol return true; default: - return false; + // Always a break point at first character + return prevType == Character.UNASSIGNED; } } } diff --git a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java index 20b23b070f..58dc0c43e1 100644 --- a/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java +++ b/tests/src/com/android/launcher3/allapps/search/DefaultAppSearchAlgorithmTest.java @@ -71,6 +71,10 @@ public class DefaultAppSearchAlgorithmTest extends InstrumentationTestCase { // match lower case words assertTrue(mAlgorithm.matches(getInfo("elephant"), "e")); + assertTrue(mAlgorithm.matches(getInfo("电子邮件"), "电")); + assertTrue(mAlgorithm.matches(getInfo("电子邮件"), "电子")); + assertFalse(mAlgorithm.matches(getInfo("电子邮件"), "子")); + assertFalse(mAlgorithm.matches(getInfo("电子邮件"), "邮件")); } private AppInfo getInfo(String title) {