Remove usage of deprecated toolbar methods am: 1033c500cf am: e37e75983e am: 108f9c2818
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/SettingsIntelligence/+/11723392
Change-Id: I14f33af953d95908f2bbe314a81e024836937efb
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/src/com/android/settings/intelligence/search/SearchFragment.java b/src/com/android/settings/intelligence/search/SearchFragment.java
index 4642b16..c76eda3 100644
--- a/src/com/android/settings/intelligence/search/SearchFragment.java
+++ b/src/com/android/settings/intelligence/search/SearchFragment.java
@@ -344,9 +344,11 @@
final Activity activity = getActivity();
if (activity != null) {
View view = activity.getCurrentFocus();
- InputMethodManager imm = (InputMethodManager)
- activity.getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
+ if (view != null) {
+ InputMethodManager imm = (InputMethodManager)
+ activity.getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
+ }
}
if (mResultsRecyclerView != null) {
diff --git a/src/com/android/settings/intelligence/search/query/SearchQueryUtils.java b/src/com/android/settings/intelligence/search/query/SearchQueryUtils.java
index d7011ee..b7ad1bd 100644
--- a/src/com/android/settings/intelligence/search/query/SearchQueryUtils.java
+++ b/src/com/android/settings/intelligence/search/query/SearchQueryUtils.java
@@ -18,6 +18,10 @@
import android.text.TextUtils;
+import com.android.settings.intelligence.search.indexing.IndexData;
+
+import java.util.Locale;
+
/**
* Utils for Query-time operations.
*/
@@ -40,12 +44,18 @@
* resultName: Abcde, query: bc, Returns NAME_NO_MATCH
* resultName: Abcde, query: xyz, Returns NAME_NO_MATCH
* resultName: Abc de, query: de, Returns 4
+ *
+ * In Japanese, normalize resultName to match normalized query.
*/
public static int getWordDifference(String resultName, String query) {
if (TextUtils.isEmpty(resultName) || TextUtils.isEmpty(query)) {
return NAME_NO_MATCH;
}
+ if (Locale.getDefault().equals(Locale.JAPAN)) {
+ resultName = IndexData.normalizeJapaneseString(resultName);
+ }
+
final char[] queryTokens = query.toLowerCase().toCharArray();
final char[] resultTokens = resultName.toLowerCase().toCharArray();
final int resultLength = resultTokens.length;