From 0c549e742426431ba9fdcca57d0724224bf13ae2 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Wed, 22 Jul 2020 20:56:25 -0700 Subject: [PATCH] =?UTF-8?q?Update=20language=20to=20comply=20with=20Androi?= =?UTF-8?q?d=E2=80=99s=20inclusive=20language=20guidance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Test: tapas LatinIME && m Change-Id: Ic06f948c023a091e1532db826a78dd01031d7205 --- .../v402/content/probability_dict_content.cpp | 8 ++++--- .../binary_dictionary_shortcut_iterator.h | 6 ++--- .../UserHistoryDictionaryTests.java | 24 +++++++++---------- .../UserHistoryDictionaryTestsHelper.java | 2 +- .../inputmethod/latin/dicttool/Info.java | 6 ++--- .../keyboard/internal/KeyboardTextsTable.tmpl | 2 +- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/native/jni/src/dictionary/structure/backward/v402/content/probability_dict_content.cpp b/native/jni/src/dictionary/structure/backward/v402/content/probability_dict_content.cpp index 587a1c097..8485377ee 100644 --- a/native/jni/src/dictionary/structure/backward/v402/content/probability_dict_content.cpp +++ b/native/jni/src/dictionary/structure/backward/v402/content/probability_dict_content.cpp @@ -65,13 +65,15 @@ bool ProbabilityDictContent::setProbabilityEntry(const int terminalId, } const int entryPos = getEntryPos(terminalId); if (terminalId >= mSize) { - ProbabilityEntry dummyEntry; + ProbabilityEntry placeholderEntry; // Write new entry. int writingPos = getBuffer()->getTailPosition(); while (writingPos <= entryPos) { // Fulfilling with placeholder entries until writingPos. - if (!writeEntry(&dummyEntry, writingPos)) { - AKLOGE("Cannot write dummy entry. pos: %d, mSize: %d", writingPos, mSize); + if (!writeEntry(&placeholderEntry, writingPos)) { + AKLOGE("Cannot write placeholder entry. pos: %d, mSize: %d", + writingPos, + mSize); return false; } writingPos += getEntrySize(); diff --git a/native/jni/src/dictionary/utils/binary_dictionary_shortcut_iterator.h b/native/jni/src/dictionary/utils/binary_dictionary_shortcut_iterator.h index 3638f3866..45c9cd36d 100644 --- a/native/jni/src/dictionary/utils/binary_dictionary_shortcut_iterator.h +++ b/native/jni/src/dictionary/utils/binary_dictionary_shortcut_iterator.h @@ -41,12 +41,12 @@ class BinaryDictionaryShortcutIterator { } // Gets the shortcut target itself as an int string and put it to outTarget, put its length - // to outTargetLength, put whether it is allowlist to outIsWhitelist. + // to outTargetLength, put whether it is allowlist to outIsAllowed. AK_FORCE_INLINE void nextShortcutTarget( const int maxDepth, int *const outTarget, int *const outTargetLength, - bool *const outIsWhitelist) { + bool *const outIsAllowed) { mShortcutStructurePolicy->getNextShortcut(maxDepth, outTarget, outTargetLength, - outIsWhitelist, &mHasNextShortcutTarget, &mPos); + outIsAllowed, &mHasNextShortcutTarget, &mPos); } private: diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java index 68f041589..bc9881bde 100644 --- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java @@ -118,15 +118,15 @@ public class UserHistoryDictionaryTests { private void doTestRandomWords(final String testAccount) { Log.d(TAG, "This test can be used for profiling."); Log.d(TAG, "Usage: please set UserHistoryDictionary.PROFILE_SAVE_RESTORE to true."); - final Locale dummyLocale = UserHistoryDictionaryTestsHelper.getDummyLocale("random_words"); + final Locale fakeLocale = UserHistoryDictionaryTestsHelper.getFakeLocale("random_words"); final String dictName = UserHistoryDictionary.getUserHistoryDictName( - UserHistoryDictionary.NAME, dummyLocale, + UserHistoryDictionary.NAME, fakeLocale, null /* dictFile */, testAccount /* account */); final File dictFile = ExpandableBinaryDictionary.getDictFile( getContext(), dictName, null /* dictFile */); final UserHistoryDictionary dict = PersonalizationHelper.getUserHistoryDictionary( - getContext(), dummyLocale, testAccount); + getContext(), fakeLocale, testAccount); clearHistory(dict); final int numberOfWords = 1000; @@ -169,15 +169,15 @@ public class UserHistoryDictionaryTests { // Create filename suffixes for this test. for (int i = 0; i < numberOfLanguages; i++) { - final Locale dummyLocale = - UserHistoryDictionaryTestsHelper.getDummyLocale("switching_languages" + i); + final Locale fakeLocale = + UserHistoryDictionaryTestsHelper.getFakeLocale("switching_languages" + i); final String dictName = UserHistoryDictionary.getUserHistoryDictName( - UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */, + UserHistoryDictionary.NAME, fakeLocale, null /* dictFile */, testAccount /* account */); dictFiles[i] = ExpandableBinaryDictionary.getDictFile( getContext(), dictName, null /* dictFile */); dicts[i] = PersonalizationHelper.getUserHistoryDictionary(getContext(), - dummyLocale, testAccount); + fakeLocale, testAccount); clearHistory(dicts[i]); } @@ -214,19 +214,19 @@ public class UserHistoryDictionaryTests { } private void doTestAddManyWords(final String testAccount) { - final Locale dummyLocale = - UserHistoryDictionaryTestsHelper.getDummyLocale("many_random_words"); + final Locale fakeLocale = + UserHistoryDictionaryTestsHelper.getFakeLocale("many_random_words"); final String dictName = UserHistoryDictionary.getUserHistoryDictName( - UserHistoryDictionary.NAME, dummyLocale, null /* dictFile */, testAccount); + UserHistoryDictionary.NAME, fakeLocale, null /* dictFile */, testAccount); final File dictFile = ExpandableBinaryDictionary.getDictFile( getContext(), dictName, null /* dictFile */); final int numberOfWords = 10000; final Random random = new Random(123456); final UserHistoryDictionary dict = PersonalizationHelper.getUserHistoryDictionary( - getContext(), dummyLocale, testAccount); + getContext(), fakeLocale, testAccount); clearHistory(dict); assertTrue(UserHistoryDictionaryTestsHelper.addAndWriteRandomWords(dict, numberOfWords, random, true /* checksContents */, mCurrentTime)); assertDictionaryExists(dict, dictFile); } -} \ No newline at end of file +} diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTestsHelper.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTestsHelper.java index d3ea2705b..73d7e7339 100644 --- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTestsHelper.java +++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTestsHelper.java @@ -110,7 +110,7 @@ public class UserHistoryDictionaryTestsHelper { /** * Creates unique test locale for using within tests. */ - public static Locale getDummyLocale(final String name) { + public static Locale getFakeLocale(final String name) { return new Locale(TEST_LOCALE_PREFIX + name + System.currentTimeMillis()); } diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Info.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Info.java index d516d60c3..8f8c968c1 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Info.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Info.java @@ -42,7 +42,7 @@ public class Info extends Dicttool.Command { int wordCount = 0; int bigramCount = 0; int shortcutCount = 0; - int whitelistCount = 0; + int allowlistCount = 0; for (final WordProperty wordProperty : dict) { ++wordCount; if (wordProperty.mHasNgrams) { @@ -51,8 +51,8 @@ public class Info extends Dicttool.Command { } System.out.println("Words in the dictionary : " + wordCount); System.out.println("Bigram count : " + bigramCount); - System.out.println("Shortcuts : " + shortcutCount + " (out of which " + whitelistCount - + " whitelist entries)"); + System.out.println("Shortcuts : " + shortcutCount + " (out of which " + allowlistCount + + " allowlist entries)"); } private static void showWordInfo(final FusionDictionary dict, final String word) { diff --git a/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl b/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl index 6a7469ccb..5855129c5 100644 --- a/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl +++ b/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl @@ -60,7 +60,7 @@ public final class KeyboardTextsTable { if (text != null) { return text; } - // Sanity check. + // Validity check. if (index >= 0 && index < TEXTS_DEFAULT.length) { return TEXTS_DEFAULT[index]; }