summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:15:23 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:15:23 +0000
commitf03455998932c049f18c0033a57c0f43add5e119 (patch)
tree9b27d37ecb1883198cc23bf36eccb1d7d06f2e72
parentf82d822b420ecfc54a4954e75b864525b1a5171d (diff)
parent6025b9a827ee30b5fcb12d4c54a0fb584cf533e4 (diff)
downloadLatinIME-f03455998932c049f18c0033a57c0f43add5e119.tar.gz
Snap for 8564071 from 6025b9a827ee30b5fcb12d4c54a0fb584cf533e4 to mainline-tethering-releaseaml_tet_331511160aml_tet_331511000aml_tet_331412030aml_tet_331312080aml_tet_331117000aml_tet_331012080aml_tet_330911010aml_tet_330812150
Change-Id: Ic7a0792401a570c7499bc6d32ea6ff29b94ab77d
-rw-r--r--Android.bp17
-rw-r--r--MODULE_LICENSE_APACHE20
-rw-r--r--OWNERS8
-rw-r--r--common/Android.bp9
-rw-r--r--dictionaries/sample.combined2
-rw-r--r--java/Android.bp23
-rw-r--r--java/AndroidManifest.xml193
-rw-r--r--java/lint-baseline.xml81
-rw-r--r--java/res/values/config-auto-correction-thresholds.xml2
-rw-r--r--java/res/values/emoji-categories.xml2
-rw-r--r--java/res/xml-sw600dp/key_styles_common.xml2
-rw-r--r--java/res/xml/key_styles_common.xml2
-rw-r--r--java/res/xml/prefs_screen_accounts.xml2
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java2
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java54
-rw-r--r--java/src/com/android/inputmethod/event/Event.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java2
-rw-r--r--java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java3
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java2
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java6
-rw-r--r--java/src/com/android/inputmethod/latin/InputAttributes.java2
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java55
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java36
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java2
-rw-r--r--java/src/com/android/inputmethod/latin/about/AboutPreferences.java2
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java4
-rw-r--r--java/src/com/android/inputmethod/latin/settings/CustomInputStylePreference.java2
-rw-r--r--java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java4
-rw-r--r--java/src/com/android/inputmethod/latin/utils/RecapitalizeStatus.java2
-rw-r--r--native/dicttoolkit/Android.bp10
-rw-r--r--native/jni/Android.bp15
-rw-r--r--native/jni/src/dictionary/header/header_policy.cpp2
-rw-r--r--native/jni/src/dictionary/header/header_policy.h2
-rw-r--r--native/jni/src/dictionary/structure/backward/v402/content/probability_dict_content.cpp10
-rw-r--r--native/jni/src/dictionary/structure/backward/v402/content/probability_entry.h2
-rw-r--r--native/jni/src/dictionary/structure/backward/v402/ver4_patricia_trie_node_writer.cpp2
-rw-r--r--native/jni/src/dictionary/structure/pt_common/dynamic_pt_gc_event_listeners.cpp4
-rw-r--r--native/jni/src/dictionary/structure/pt_common/shortcut/shortcut_list_reading_utils.cpp2
-rw-r--r--native/jni/src/dictionary/structure/v4/content/probability_entry.h2
-rw-r--r--native/jni/src/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp2
-rw-r--r--native/jni/src/dictionary/utils/binary_dictionary_shortcut_iterator.h6
-rw-r--r--native/jni/tests/dictionary/utils/format_utils_test.cpp12
-rw-r--r--tests/Android.bp11
-rw-r--r--tests/AndroidManifest.xml4
-rw-r--r--tests/res/raw/dummy_resource_for_testing.txt2
-rw-r--r--tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java2
-rw-r--r--tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java4
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java4
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/FusionDictionary.java2
-rw-r--r--tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java24
-rw-r--r--tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTestsHelper.java4
-rw-r--r--tools/EditTextVariations/Android.bp9
-rw-r--r--tools/EditTextVariations/AndroidManifest.xml52
-rw-r--r--tools/EditTextVariations/res/values/strings.xml4
-rw-r--r--tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditTextVariations.java101
-rw-r--r--tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditorActivity.java35
-rw-r--r--tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/NotificationUtils.java5
-rw-r--r--tools/dicttool/Android.bp9
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/Info.java6
-rw-r--r--tools/make-keyboard-text/Android.bp9
-rw-r--r--tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl2
62 files changed, 595 insertions, 290 deletions
diff --git a/Android.bp b/Android.bp
index 3abd6c19f..64845db05 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12,6 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+ name: "packages_inputmethods_LatinIME_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ ],
+ license_text: [
+ "NOTICE",
+ ],
+}
+
filegroup {
name: "dicttool_deps",
srcs: [
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb..000000000
--- a/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/OWNERS b/OWNERS
index 3d485186b..1e6b7be67 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,6 +1,2 @@
-# Recommended reviewers for general changes.
-# takaoka@google.com
-# yukawa@google.com
-#
-# Recommended reviewers for non-trivial build rule changes.
-# dwillemsen@google.com
+# Bug component: 319003
+include platform/frameworks/base:/services/core/java/com/android/server/inputmethod/OWNERS
diff --git a/common/Android.bp b/common/Android.bp
index 925eef7fd..fd5512790 100644
--- a/common/Android.bp
+++ b/common/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
java_library {
name: "latinime-common",
host_supported: true,
diff --git a/dictionaries/sample.combined b/dictionaries/sample.combined
index 4fa595e1e..9cbdd2a8a 100644
--- a/dictionaries/sample.combined
+++ b/dictionaries/sample.combined
@@ -14,7 +14,7 @@
# should not be considered a typo, but that should never be suggested
# explicitly. An entry may be made not a word by adding a `not_a_word'
# field with a value of `true'. The main reason for putting such entries
-# into the dictionary is to add shortcut targets and maybe a whitelist
+# into the dictionary is to add shortcut targets and maybe an allowlist
# replacement.
#
# Each word may or may not have any number of shortcut target lines
diff --git a/java/Android.bp b/java/Android.bp
index f41e94af0..613b45148 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -12,6 +12,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: [
+ "packages_inputmethods_LatinIME_java_license",
+ ],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+ name: "packages_inputmethods_LatinIME_java_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ ],
+ license_text: [
+ "NOTICE",
+ ],
+}
+
android_app {
name: "LatinIME",
@@ -34,8 +53,8 @@ android_app {
// Include all the resources regardless of system supported locales
aapt_include_all_resources: true,
- min_sdk_version: "14",
- target_sdk_version: "23",
+ min_sdk_version: "21",
+ target_sdk_version: "30",
sdk_version: "current",
product_specific: true,
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index 79d337310..ac84c3388 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -15,132 +15,141 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- coreApp="true"
- package="com.android.inputmethod.latin"
- android:versionCode="28">
-
- <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
-
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
- <uses-permission android:name="android.permission.GET_ACCOUNTS" />
- <uses-permission android:name="android.permission.READ_CONTACTS" />
- <uses-permission android:name="android.permission.READ_PROFILE" />
- <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
- <uses-permission android:name="android.permission.READ_SYNC_STATS" />
- <uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
- <uses-permission android:name="android.permission.USE_CREDENTIALS" />
- <uses-permission android:name="android.permission.VIBRATE" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
- <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
+ coreApp="true"
+ package="com.android.inputmethod.latin"
+ android:versionCode="30">
+
+ <uses-sdk android:minSdkVersion="21"
+ android:targetSdkVersion="30"/>
+
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
+ <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
+ <uses-permission android:name="android.permission.READ_CONTACTS"/>
+ <uses-permission android:name="android.permission.READ_PROFILE"/>
+ <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
+ <uses-permission android:name="android.permission.READ_SYNC_STATS"/>
+ <uses-permission android:name="android.permission.READ_USER_DICTIONARY"/>
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
+ <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
+ <uses-permission android:name="android.permission.VIBRATE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
+ <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY"/>
<!-- A signature-protected permission to ask AOSP Keyboard to close the software keyboard.
- To use this, add the following line into calling application's AndroidManifest.xml
+ To use this, add the following line into calling application's AndroidManifest.xml
<pre>
- {@code
+ {@code
<uses-permission android:name="com.android.inputmethod.latin.HIDE_SOFT_INPUT"/>
- }
+ }
</pre>
- then call {@link android.content.Context#sendBroadcast(Intent)} as follows:
+ then call {@link android.content.Context#sendBroadcast(Intent)} as follows:
<pre>
- {@code
- sendBroadcast(new Intent("com.android.inputmethod.latin.HIDE_SOFT_INPUT")
- .setPackage("com.android.inputmethod.latin"));
- }
+ {@code
+ sendBroadcast(new Intent("com.android.inputmethod.latin.HIDE_SOFT_INPUT")
+ .setPackage("com.android.inputmethod.latin"));
+ }
</pre> -->
<permission android:name="com.android.inputmethod.latin.HIDE_SOFT_INPUT"
- android:protectionLevel="signature" />
+ android:protectionLevel="signature"/>
<application android:label="@string/english_ime_name"
- android:icon="@drawable/ic_launcher_keyboard"
- android:supportsRtl="true"
- android:allowBackup="true"
- android:defaultToDeviceProtectedStorage="true"
- android:directBootAware="true">
+ android:icon="@drawable/ic_launcher_keyboard"
+ android:supportsRtl="true"
+ android:allowBackup="true"
+ android:defaultToDeviceProtectedStorage="true"
+ android:directBootAware="true">
<!-- Services -->
<service android:name="LatinIME"
- android:label="@string/english_ime_name"
- android:permission="android.permission.BIND_INPUT_METHOD">
+ android:label="@string/english_ime_name"
+ android:permission="android.permission.BIND_INPUT_METHOD"
+ android:exported="true">
<intent-filter>
- <action android:name="android.view.InputMethod" />
+ <action android:name="android.view.InputMethod"/>
</intent-filter>
- <meta-data android:name="android.view.im" android:resource="@xml/method" />
+ <meta-data android:name="android.view.im"
+ android:resource="@xml/method"/>
</service>
<service android:name=".spellcheck.AndroidSpellCheckerService"
- android:label="@string/spell_checker_service_name"
- android:permission="android.permission.BIND_TEXT_SERVICE">
+ android:label="@string/spell_checker_service_name"
+ android:permission="android.permission.BIND_TEXT_SERVICE"
+ android:exported="true">
<intent-filter>
- <action android:name="android.service.textservice.SpellCheckerService" />
+ <action android:name="android.service.textservice.SpellCheckerService"/>
</intent-filter>
<meta-data android:name="android.view.textservice.scs"
- android:resource="@xml/spellchecker" />
+ android:resource="@xml/spellchecker"/>
</service>
<service android:name="com.android.inputmethod.dictionarypack.DictionaryService"
- android:label="@string/dictionary_service_name">
+ android:label="@string/dictionary_service_name">
</service>
<!-- Activities -->
<activity android:name=".setup.SetupActivity"
- android:theme="@style/platformActivityTheme"
- android:label="@string/english_ime_name"
- android:icon="@drawable/ic_launcher_keyboard"
- android:launchMode="singleTask"
- android:noHistory="true">
+ android:theme="@style/platformActivityTheme"
+ android:label="@string/english_ime_name"
+ android:icon="@drawable/ic_launcher_keyboard"
+ android:launchMode="singleTask"
+ android:noHistory="true"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
- <activity
- android:name=".permissions.PermissionsActivity"
- android:theme="@android:style/Theme.Translucent.NoTitleBar"
- android:exported="false"
- android:taskAffinity="" >
+ <activity android:name=".permissions.PermissionsActivity"
+ android:theme="@android:style/Theme.Translucent.NoTitleBar"
+ android:exported="false"
+ android:taskAffinity="">
</activity>
<activity android:name=".setup.SetupWizardActivity"
- android:theme="@style/platformActivityTheme"
- android:label="@string/english_ime_name"
- android:clearTaskOnLaunch="true">
+ android:theme="@style/platformActivityTheme"
+ android:label="@string/english_ime_name"
+ android:clearTaskOnLaunch="true"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity android:name=".settings.SettingsActivity"
- android:theme="@style/platformSettingsTheme"
- android:label="@string/english_ime_settings">
+ android:theme="@style/platformSettingsTheme"
+ android:label="@string/english_ime_settings"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity android:name=".spellcheck.SpellCheckerSettingsActivity"
- android:theme="@style/platformSettingsTheme"
- android:label="@string/android_spell_checker_settings">
+ android:theme="@style/platformSettingsTheme"
+ android:label="@string/android_spell_checker_settings"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity android:name="com.android.inputmethod.dictionarypack.DictionarySettingsActivity"
- android:theme="@style/platformSettingsTheme"
- android:label="@string/dictionary_settings_title"
- android:uiOptions="splitActionBarWhenNarrow">
+ android:theme="@style/platformSettingsTheme"
+ android:label="@string/dictionary_settings_title"
+ android:uiOptions="splitActionBarWhenNarrow"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity android:name="com.android.inputmethod.dictionarypack.DownloadOverMeteredDialog"
- android:theme="@style/platformActivityTheme"
- android:label="@string/dictionary_install_over_metered_network_prompt">
+ android:theme="@style/platformActivityTheme"
+ android:label="@string/dictionary_install_over_metered_network_prompt"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
@@ -148,47 +157,51 @@
<!-- Unexported activity used for tests. -->
<activity android:name=".settings.TestFragmentActivity"
- android:exported="false" />
+ android:exported="false"/>
<!-- Broadcast receivers -->
- <receiver android:name="SystemBroadcastReceiver">
+ <receiver android:name="SystemBroadcastReceiver"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
- <action android:name="android.intent.action.BOOT_COMPLETED" />
- <action android:name="android.intent.action.USER_INITIALIZE" />
- <action android:name="android.intent.action.LOCALE_CHANGED" />
+ <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
+ <action android:name="android.intent.action.BOOT_COMPLETED"/>
+ <action android:name="android.intent.action.USER_INITIALIZE"/>
+ <action android:name="android.intent.action.LOCALE_CHANGED"/>
</intent-filter>
</receiver>
- <receiver android:name="DictionaryPackInstallBroadcastReceiver" android:exported="false">
+ <receiver android:name="DictionaryPackInstallBroadcastReceiver"
+ android:exported="false">
<intent-filter>
- <action android:name="com.android.inputmethod.dictionarypack.aosp.UNKNOWN_CLIENT" />
+ <action android:name="com.android.inputmethod.dictionarypack.aosp.UNKNOWN_CLIENT"/>
</intent-filter>
</receiver>
- <receiver android:name="com.android.inputmethod.dictionarypack.EventHandler">
+ <receiver android:name="com.android.inputmethod.dictionarypack.EventHandler"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
- <action android:name="android.intent.action.DATE_CHANGED" />
- <action android:name="com.android.inputmethod.dictionarypack.aosp.UPDATE_NOW" />
- <action android:name="com.android.inputmethod.dictionarypack.aosp.INIT_AND_UPDATE_NOW" />
+ <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
+ <action android:name="android.intent.action.DATE_CHANGED"/>
+ <action android:name="com.android.inputmethod.dictionarypack.aosp.UPDATE_NOW"/>
+ <action android:name="com.android.inputmethod.dictionarypack.aosp.INIT_AND_UPDATE_NOW"/>
</intent-filter>
</receiver>
<!-- Broadcast receiver for AccountManager#LOGIN_ACCOUNTS_CHANGED_ACTION. -->
- <receiver android:name=".accounts.AccountsChangedReceiver">
+ <receiver android:name=".accounts.AccountsChangedReceiver"
+ android:exported="true">
<intent-filter>
- <action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
+ <action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED"/>
</intent-filter>
</receiver>
<!-- Content providers -->
<provider android:name="com.android.inputmethod.dictionarypack.DictionaryProvider"
- android:grantUriPermissions="true"
- android:exported="false"
- android:authorities="@string/authority"
- android:multiprocess="false"
- android:label="@string/dictionary_provider_name">
+ android:grantUriPermissions="true"
+ android:exported="false"
+ android:authorities="@string/authority"
+ android:multiprocess="false"
+ android:label="@string/dictionary_provider_name">
</provider>
</application>
</manifest>
diff --git a/java/lint-baseline.xml b/java/lint-baseline.xml
new file mode 100644
index 000000000..02f41f4e4
--- /dev/null
+++ b/java/lint-baseline.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 23 (current min is 21): `android.graphics.Paint#hasGlyph`"
+ errorLine1=" return paint.hasGlyph(switzerland);"
+ errorLine2=" ~~~~~~~~">
+ <location
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java"
+ line="445"
+ column="26"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 23 (current min is 21): `android.graphics.Paint#hasGlyph`"
+ errorLine1=" return paint.hasGlyph(cheese);"
+ errorLine2=" ~~~~~~~~">
+ <location
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java"
+ line="461"
+ column="26"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 23 (current min is 21): `android.content.Context#getSystemService`"
+ errorLine1=" final WindowManager wm = getSystemService(WindowManager.class);"
+ errorLine2=" ~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java"
+ line="606"
+ column="34"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 23 (current min is 21): `android.content.Context#getSystemService`"
+ errorLine1=" final WindowManager wm = getSystemService(WindowManager.class);"
+ errorLine2=" ~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java"
+ line="804"
+ column="34"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 23 (current min is 21): `android.app.ActivityOptions#makeBasic`"
+ errorLine1=" ActivityOptions.makeBasic().setLaunchDisplayId(currentDisplayId).toBundle());"
+ errorLine2=" ~~~~~~~~~">
+ <location
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java"
+ line="1823"
+ column="33"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 26 (current min is 21): `android.app.ActivityOptions#setLaunchDisplayId`"
+ errorLine1=" ActivityOptions.makeBasic().setLaunchDisplayId(currentDisplayId).toBundle());"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java"
+ line="1823"
+ column="45"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 23 (current min is 21): `android.content.Context#getSystemService`"
+ errorLine1=" final UserManager userManager = context.getSystemService(UserManager.class);"
+ errorLine2=" ~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/compat/UserManagerCompatUtils.java"
+ line="69"
+ column="49"/>
+ </issue>
+
+</issues>
diff --git a/java/res/values/config-auto-correction-thresholds.xml b/java/res/values/config-auto-correction-thresholds.xml
index fc701c7ff..668f90e73 100644
--- a/java/res/values/config-auto-correction-thresholds.xml
+++ b/java/res/values/config-auto-correction-thresholds.xml
@@ -37,7 +37,7 @@
<!-- Chosen to be slightly less than the "aggressive" threshold. This is the threshold for
a mildly plausible suggestion given the input; if no "plausible" suggestion is present
for a language, it's a strong indicator the user is not typing in this language, so we
- may be more forgiving of whitelist entries in another language. -->
+ may be more forgiving of allowlist entries in another language. -->
<string name="plausibility_threshold" translatable="false">0.065</string>
<!-- The index of the auto correction threshold values array. -->
diff --git a/java/res/values/emoji-categories.xml b/java/res/values/emoji-categories.xml
index ce82a8b40..ae5ccc74a 100644
--- a/java/res/values/emoji-categories.xml
+++ b/java/res/values/emoji-categories.xml
@@ -22,7 +22,7 @@
There is another emoji code point list for JB-MR2 and KLP and later under
res/xml/values-v1[89].-->
<resources>
- <!-- Dummy codeArrays for recents emoji keyboard.
+ <!-- Placeholder codeArrays for recents emoji keyboard.
Do not remove these keys, because they are used as a template. -->
<array
name="emoji_recents"
diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml
index ea8f29250..3d25f4295 100644
--- a/java/res/xml-sw600dp/key_styles_common.xml
+++ b/java/res/xml-sw600dp/key_styles_common.xml
@@ -38,7 +38,7 @@
<include
latin:keyboardLayout="@xml/key_styles_settings" />
<!-- Functional key styles -->
- <!-- Base style for shift key. A single space is used for dummy label in moreKeys. -->
+ <!-- Base style for shift key. A single space is used for base label in moreKeys. -->
<key-style
latin:styleName="baseForShiftKeyStyle"
latin:keyActionFlags="noKeyPreview"
diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml
index d85438d99..fbc44da38 100644
--- a/java/res/xml/key_styles_common.xml
+++ b/java/res/xml/key_styles_common.xml
@@ -38,7 +38,7 @@
<include
latin:keyboardLayout="@xml/key_styles_settings" />
<!-- Functional key styles -->
- <!-- Base style for shift key. A single space is used for dummy label in moreKeys. -->
+ <!-- Base style for shift key. A single space is used for base label in moreKeys. -->
<key-style
latin:styleName="baseForShiftKeyStyle"
latin:keyActionFlags="noKeyPreview"
diff --git a/java/res/xml/prefs_screen_accounts.xml b/java/res/xml/prefs_screen_accounts.xml
index 75fff52c6..415b0b4e1 100644
--- a/java/res/xml/prefs_screen_accounts.xml
+++ b/java/res/xml/prefs_screen_accounts.xml
@@ -19,7 +19,7 @@
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:title="@string/settings_screen_accounts">
- <!-- This preference is a dummy view of the underlying preference.
+ <!-- This preference is a fake view of the underlying preference.
This isn't persisted and the summary/title is refreshed by the fragment
after inspecting the underlying account preference. -->
<Preference
diff --git a/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java b/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java
index 7d01351b4..94dd7a1c9 100644
--- a/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java
+++ b/java/src/com/android/inputmethod/dictionarypack/MetadataDbHelper.java
@@ -870,7 +870,7 @@ public class MetadataDbHelper extends SQLiteOpenHelper {
*/
public static void updateClientInfo(final Context context, final String clientId,
final ContentValues values) {
- // Sanity check the content values
+ // Validity check the content values
final String valuesClientId = values.getAsString(CLIENT_CLIENT_ID_COLUMN);
final String valuesMetadataUri = values.getAsString(CLIENT_METADATA_URI_COLUMN);
final String valuesMetadataAdditionalId =
diff --git a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
index 0517bc814..bdea3e919 100644
--- a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
+++ b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
@@ -19,9 +19,6 @@ package com.android.inputmethod.dictionarypack;
import android.app.DownloadManager;
import android.app.DownloadManager.Query;
import android.app.DownloadManager.Request;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
@@ -36,10 +33,7 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
-import com.android.inputmethod.compat.ConnectivityManagerCompatUtils;
-import com.android.inputmethod.compat.NotificationCompatUtils;
import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.common.LocaleUtils;
import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.utils.ApplicationUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;
@@ -844,54 +838,6 @@ public final class UpdateHandler {
}
/**
- * Shows the notification that informs the user a dictionary is available.
- *
- * When this notification is clicked, the dialog for downloading the dictionary
- * over a metered connection is shown.
- */
- private static void showDictionaryAvailableNotification(final Context context,
- final String clientId, final ContentValues installCandidate) {
- final String localeString = installCandidate.getAsString(MetadataDbHelper.LOCALE_COLUMN);
- final Intent intent = new Intent();
- intent.setClass(context, DownloadOverMeteredDialog.class);
- intent.putExtra(DownloadOverMeteredDialog.CLIENT_ID_KEY, clientId);
- intent.putExtra(DownloadOverMeteredDialog.WORDLIST_TO_DOWNLOAD_KEY,
- installCandidate.getAsString(MetadataDbHelper.WORDLISTID_COLUMN));
- intent.putExtra(DownloadOverMeteredDialog.SIZE_KEY,
- installCandidate.getAsInteger(MetadataDbHelper.FILESIZE_COLUMN));
- intent.putExtra(DownloadOverMeteredDialog.LOCALE_KEY, localeString);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- final PendingIntent notificationIntent = PendingIntent.getActivity(context,
- 0 /* requestCode */, intent,
- PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
- final NotificationManager notificationManager =
- (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- // None of those are expected to happen, but just in case...
- if (null == notificationIntent || null == notificationManager) return;
-
- final String language = (null == localeString) ? ""
- : LocaleUtils.constructLocaleFromString(localeString).getDisplayLanguage();
- final String titleFormat = context.getString(R.string.dict_available_notification_title);
- final String notificationTitle = String.format(titleFormat, language);
- final Notification.Builder builder = new Notification.Builder(context)
- .setAutoCancel(true)
- .setContentIntent(notificationIntent)
- .setContentTitle(notificationTitle)
- .setContentText(context.getString(R.string.dict_available_notification_description))
- .setTicker(notificationTitle)
- .setOngoing(false)
- .setOnlyAlertOnce(true)
- .setSmallIcon(R.drawable.ic_notify_dictionary);
- NotificationCompatUtils.setColor(builder,
- context.getResources().getColor(R.color.notification_accent_color));
- NotificationCompatUtils.setPriorityToLow(builder);
- NotificationCompatUtils.setVisibilityToSecret(builder);
- NotificationCompatUtils.setCategoryToRecommendation(builder);
- final Notification notification = NotificationCompatUtils.build(builder);
- notificationManager.notify(DICT_AVAILABLE_NOTIFICATION_ID, notification);
- }
-
- /**
* Installs a word list if it has never been requested.
*
* This is called when a word list is requested, and is available but not installed. It checks
diff --git a/java/src/com/android/inputmethod/event/Event.java b/java/src/com/android/inputmethod/event/Event.java
index e3b1afc53..58d878fbe 100644
--- a/java/src/com/android/inputmethod/event/Event.java
+++ b/java/src/com/android/inputmethod/event/Event.java
@@ -123,7 +123,7 @@ public class Event {
mSuggestedWordInfo = suggestedWordInfo;
mFlags = flags;
mNextEvent = next;
- // Sanity checks
+ // Validity checks
// mSuggestedWordInfo is non-null if and only if the type is SUGGESTION_PICKED
if (EVENT_TYPE_SUGGESTION_PICKED == mEventType) {
if (null == mSuggestedWordInfo) {
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 27e538cb7..faa21070e 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -100,7 +100,7 @@ public class KeyboardView extends View {
private static final float MAX_LABEL_RATIO = 0.90f;
// Main keyboard
- // TODO: Consider having a dummy keyboard object to make this @Nonnull
+ // TODO: Consider having a base keyboard object to make this @Nonnull
@Nullable
private Keyboard mKeyboard;
@Nonnull
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java
index b50c0a86a..7dfb5328c 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java
@@ -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];
}
diff --git a/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java b/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
index 60d257362..5e6e4ab25 100644
--- a/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
+++ b/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
@@ -119,8 +119,7 @@ public final class AudioAndHapticFeedbackManager {
// Go ahead with the system default
if (viewToPerformHapticFeedbackOn != null) {
viewToPerformHapticFeedbackOn.performHapticFeedback(
- HapticFeedbackConstants.KEYBOARD_TAP,
- HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
+ HapticFeedbackConstants.KEYBOARD_TAP);
}
}
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
index 1fe0a4cce..648610c86 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
@@ -523,7 +523,7 @@ public final class BinaryDictionaryFileDumper {
}
// Read from metadata file in resources to get the baseline dictionary info.
- // This ensures we start with a sane list of available dictionaries.
+ // This ensures we start with a valid list of available dictionaries.
final int metadataResourceId = context.getResources().getIdentifier("metadata",
"raw", DictionaryInfoUtils.RESOURCE_PACKAGE_NAME);
if (metadataResourceId == 0) {
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
index 60016371b..c13f0e20a 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
@@ -196,8 +196,8 @@ final public class BinaryDictionaryGetter {
}
// ## HACK ## we prevent usage of a dictionary before version 18. The reason for this is, since
- // those do not include whitelist entries, the new code with an old version of the dictionary
- // would lose whitelist functionality.
+ // those do not include allowlist entries, the new code with an old version of the dictionary
+ // would lose allowlist functionality.
private static boolean hackCanUseDictionaryFile(final File file) {
if (!SHOULD_USE_DICT_VERSION) {
return true;
@@ -211,7 +211,7 @@ final public class BinaryDictionaryGetter {
// No version in the options : the format is unexpected
return false;
}
- // Version 18 is the first one to include the whitelist
+ // Version 18 is the first one to include the allowlist.
// Obviously this is a big ## HACK ##
return Integer.parseInt(version) >= 18;
} catch (java.io.FileNotFoundException e) {
diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java
index 37effeead..86c7810f4 100644
--- a/java/src/com/android/inputmethod/latin/InputAttributes.java
+++ b/java/src/com/android/inputmethod/latin/InputAttributes.java
@@ -66,7 +66,7 @@ public final class InputAttributes {
|| InputTypeUtils.isVisiblePasswordInputType(inputType);
if (inputClass != InputType.TYPE_CLASS_TEXT) {
// If we are not looking at a TYPE_CLASS_TEXT field, the following strange
- // cases may arise, so we do a couple sanity checks for them. If it's a
+ // cases may arise, so we do a couple validity checks for them. If it's a
// TYPE_CLASS_TEXT field, these special cases cannot happen, by construction
// of the flags.
if (null == editorInfo) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 737bd0d3e..8ed3a59bf 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -16,8 +16,6 @@
package com.android.inputmethod.latin;
-import static android.view.Display.INVALID_DISPLAY;
-
import static com.android.inputmethod.latin.common.Constants.ImeOption.FORCE_ASCII;
import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROPHONE;
import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROPHONE_COMPAT;
@@ -46,6 +44,7 @@ import android.util.Log;
import android.util.PrintWriterPrinter;
import android.util.Printer;
import android.util.SparseArray;
+import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
@@ -56,12 +55,13 @@ import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodSubtype;
+import androidx.annotation.NonNull;
+
import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.compat.BuildCompatUtils;
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.compat.InputMethodServiceCompatUtils;
-import com.android.inputmethod.compat.InputMethodSubtypeCompatUtils;
import com.android.inputmethod.compat.ViewOutlineProviderCompatUtils;
import com.android.inputmethod.compat.ViewOutlineProviderCompatUtils.InsetsUpdater;
import com.android.inputmethod.dictionarypack.DictionaryPackConstants;
@@ -170,7 +170,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Used for re-initialize keyboard layout after onConfigurationChange.
@Nullable private Context mDisplayContext;
- private int mCurDisplayId = INVALID_DISPLAY;
// Object for reacting to adding/removing a dictionary pack.
private final BroadcastReceiver mDictionaryPackInstallReceiver =
@@ -604,8 +603,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
AccessibilityUtils.init(this);
mStatsUtilsManager.onCreate(this /* context */, mDictionaryFacilitator);
final WindowManager wm = getSystemService(WindowManager.class);
- mDisplayContext = createDisplayContext(wm.getDefaultDisplay());
- mCurDisplayId = wm.getDefaultDisplay().getDisplayId();
+ mDisplayContext = getDisplayContext();
KeyboardSwitcher.init(this);
super.onCreate();
@@ -795,19 +793,40 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onInitializeInterface() {
- // TODO (b/133825283): Non-activity components Resources / DisplayMetrics update when
- // moving to external display.
- // An issue in Q that non-activity components Resources / DisplayMetrics in
- // Context doesn't well updated when moving to external display.
- // Currently we do a workaround is to check if IME is moving to new display, if so,
- // create new display context and re-init keyboard layout with this context.
- final WindowManager wm = getSystemService(WindowManager.class);
- final int newDisplayId = wm.getDefaultDisplay().getDisplayId();
- if (mCurDisplayId != newDisplayId) {
- mCurDisplayId = newDisplayId;
- mDisplayContext = createDisplayContext(wm.getDefaultDisplay());
- mKeyboardSwitcher.updateKeyboardTheme(mDisplayContext);
+ mDisplayContext = getDisplayContext();
+ mKeyboardSwitcher.updateKeyboardTheme(mDisplayContext);
+ }
+
+ /**
+ * Returns the context object whose resources are adjusted to match the metrics of the display.
+ *
+ * Note that before {@link android.os.Build.VERSION_CODES#KITKAT}, there is no way to support
+ * multi-display scenarios, so the context object will just return the IME context itself.
+ *
+ * With initiating multi-display APIs from {@link android.os.Build.VERSION_CODES#KITKAT}, the
+ * context object has to return with re-creating the display context according the metrics
+ * of the display in runtime.
+ *
+ * Starts from {@link android.os.Build.VERSION_CODES#S_V2}, the returning context object has
+ * became to IME context self since it ends up capable of updating its resources internally.
+ *
+ * @see android.content.Context#createDisplayContext(Display)
+ */
+ private @NonNull Context getDisplayContext() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ // createDisplayContext is not available.
+ return this;
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2) {
+ // IME context sources is now managed by WindowProviderService from Android 12L.
+ return this;
}
+ // An issue in Q that non-activity components Resources / DisplayMetrics in
+ // Context doesn't well updated when the IME window moving to external display.
+ // Currently we do a workaround is to create new display context directly and re-init
+ // keyboard layout with this context.
+ final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
+ return createDisplayContext(wm.getDefaultDisplay());
}
@Override
diff --git a/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java b/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java
index cc589229e..941149895 100644
--- a/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java
+++ b/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java
@@ -174,35 +174,35 @@ public class RichInputMethodSubtype {
}
}
- // Dummy no language QWERTY subtype. See {@link R.xml.method}.
- private static final int SUBTYPE_ID_OF_DUMMY_NO_LANGUAGE_SUBTYPE = 0xdde0bfd3;
- private static final String EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE =
+ // Placeholer for no language QWERTY subtype. See {@link R.xml.method}.
+ private static final int SUBTYPE_ID_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE = 0xdde0bfd3;
+ private static final String EXTRA_VALUE_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE =
"KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY
+ "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
+ "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
@Nonnull
- private static final RichInputMethodSubtype DUMMY_NO_LANGUAGE_SUBTYPE =
+ private static final RichInputMethodSubtype PLACEHOLDER_NO_LANGUAGE_SUBTYPE =
new RichInputMethodSubtype(InputMethodSubtypeCompatUtils.newInputMethodSubtype(
R.string.subtype_no_language_qwerty, R.drawable.ic_ime_switcher_dark,
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
- EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE,
+ EXTRA_VALUE_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE,
false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */,
- SUBTYPE_ID_OF_DUMMY_NO_LANGUAGE_SUBTYPE));
+ SUBTYPE_ID_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE));
// Caveat: We probably should remove this when we add an Emoji subtype in {@link R.xml.method}.
- // Dummy Emoji subtype. See {@link R.xml.method}.
- private static final int SUBTYPE_ID_OF_DUMMY_EMOJI_SUBTYPE = 0xd78b2ed0;
- private static final String EXTRA_VALUE_OF_DUMMY_EMOJI_SUBTYPE =
+ // Placeholder Emoji subtype. See {@link R.xml.method}.
+ private static final int SUBTYPE_ID_OF_PLACEHOLDER_EMOJI_SUBTYPE = 0xd78b2ed0;
+ private static final String EXTRA_VALUE_OF_PLACEHOLDER_EMOJI_SUBTYPE =
"KeyboardLayoutSet=" + SubtypeLocaleUtils.EMOJI
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
@Nonnull
- private static final RichInputMethodSubtype DUMMY_EMOJI_SUBTYPE = new RichInputMethodSubtype(
+ private static final RichInputMethodSubtype PLACEHOLDER_EMOJI_SUBTYPE = new RichInputMethodSubtype(
InputMethodSubtypeCompatUtils.newInputMethodSubtype(
R.string.subtype_emoji, R.drawable.ic_ime_switcher_dark,
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
- EXTRA_VALUE_OF_DUMMY_EMOJI_SUBTYPE,
+ EXTRA_VALUE_OF_PLACEHOLDER_EMOJI_SUBTYPE,
false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */,
- SUBTYPE_ID_OF_DUMMY_EMOJI_SUBTYPE));
+ SUBTYPE_ID_OF_PLACEHOLDER_EMOJI_SUBTYPE));
private static RichInputMethodSubtype sNoLanguageSubtype;
private static RichInputMethodSubtype sEmojiSubtype;
@@ -222,9 +222,9 @@ public class RichInputMethodSubtype {
return noLanguageSubtype;
}
Log.w(TAG, "Can't find any language with QWERTY subtype");
- Log.w(TAG, "No input method subtype found; returning dummy subtype: "
- + DUMMY_NO_LANGUAGE_SUBTYPE);
- return DUMMY_NO_LANGUAGE_SUBTYPE;
+ Log.w(TAG, "No input method subtype found; returning placeholder subtype: "
+ + PLACEHOLDER_NO_LANGUAGE_SUBTYPE);
+ return PLACEHOLDER_NO_LANGUAGE_SUBTYPE;
}
@Nonnull
@@ -243,8 +243,8 @@ public class RichInputMethodSubtype {
return emojiSubtype;
}
Log.w(TAG, "Can't find emoji subtype");
- Log.w(TAG, "No input method subtype found; returning dummy subtype: "
- + DUMMY_EMOJI_SUBTYPE);
- return DUMMY_EMOJI_SUBTYPE;
+ Log.w(TAG, "No input method subtype found; returning placeholder subtype: "
+ + PLACEHOLDER_EMOJI_SUBTYPE);
+ return PLACEHOLDER_EMOJI_SUBTYPE;
}
}
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 7ccefd2dd..da23617af 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -225,7 +225,7 @@ public final class Suggest {
// TODO: now that we have personalization, we may want to re-evaluate this decision
|| !mDictionaryFacilitator.hasAtLeastOneInitializedMainDictionary()
// If the first suggestion is a shortcut we never auto-correct to it, regardless
- // of how strong it is (whitelist entries are not KIND_SHORTCUT but KIND_WHITELIST).
+ // of how strong it is (allowlist entries are not KIND_SHORTCUT but KIND_WHITELIST).
// TODO: we may want to have shortcut-only entries auto-correct in the future.
|| suggestionResults.first().isKindOf(SuggestedWordInfo.KIND_SHORTCUT)) {
hasAutoCorrection = false;
diff --git a/java/src/com/android/inputmethod/latin/about/AboutPreferences.java b/java/src/com/android/inputmethod/latin/about/AboutPreferences.java
index f60b189f1..ec7e6def5 100644
--- a/java/src/com/android/inputmethod/latin/about/AboutPreferences.java
+++ b/java/src/com/android/inputmethod/latin/about/AboutPreferences.java
@@ -19,7 +19,7 @@ package com.android.inputmethod.latin.about;
import android.app.Fragment;
/**
- * Dummy class of AboutPreferences. Never use this.
+ * Placeholer class of AboutPreferences. Never use this.
*/
public final class AboutPreferences extends Fragment {
private AboutPreferences() {
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 1dd5850f8..a7804a13f 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -805,7 +805,7 @@ public final class InputLogic {
if (SpaceState.PHANTOM == inputTransaction.mSpaceState
&& !settingsValues.isWordConnector(codePoint)) {
if (isComposingWord) {
- // Sanity check
+ // Validity check
throw new RuntimeException("Should not be composing here");
}
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
@@ -1370,7 +1370,7 @@ public final class InputLogic {
* @return whether it's fine to apply the transformation after this code point.
*/
private static boolean canBeFollowedByDoubleSpacePeriod(final int codePoint) {
- // TODO: This should probably be a blacklist rather than a whitelist.
+ // TODO: This should probably be a denylist rather than a allowlist.
// TODO: This should probably be language-dependant...
return Character.isLetterOrDigit(codePoint)
|| codePoint == Constants.CODE_SINGLE_QUOTE
diff --git a/java/src/com/android/inputmethod/latin/settings/CustomInputStylePreference.java b/java/src/com/android/inputmethod/latin/settings/CustomInputStylePreference.java
index 21ea8f859..44a98c1be 100644
--- a/java/src/com/android/inputmethod/latin/settings/CustomInputStylePreference.java
+++ b/java/src/com/android/inputmethod/latin/settings/CustomInputStylePreference.java
@@ -330,7 +330,7 @@ final class CustomInputStylePreference extends DialogPreference
R.array.predefined_layouts);
// TODO: Should filter out already existing combinations of locale and layout.
for (final String layout : predefinedKeyboardLayoutSet) {
- // This is a dummy subtype with NO_LANGUAGE, only for display.
+ // This is a placeholder for a subtype with NO_LANGUAGE, only for display.
final InputMethodSubtype subtype =
AdditionalSubtypeUtils.createDummyAdditionalSubtype(
SubtypeLocaleUtils.NO_LANGUAGE, layout);
diff --git a/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java b/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java
index 0dbc7c858..47f65499d 100644
--- a/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/CapsModeUtils.java
@@ -194,10 +194,10 @@ public final class CapsModeUtils {
// English is a special case in that "American typography" rules, which are the most common
// in English, state that a sentence terminator immediately following a quotation mark
// should be swapped with it and de-duplicated (included in the quotation mark),
- // e.g. <<Did he say, "let's go home?">>
+ // e.g. <<Did they say, "let's go home?">>
// No other language has such a rule as far as I know, instead putting inside the quotation
// mark as the exact thing quoted and handling the surrounding punctuation independently,
- // e.g. <<Did he say, "let's go home"?>>
+ // e.g. <<Did they say, "let's go home"?>>
if (spacingAndPunctuations.mUsesAmericanTypography) {
for (; j > 0; j--) {
// Here we look to go over any closing punctuation. This is because in dominant
diff --git a/java/src/com/android/inputmethod/latin/utils/RecapitalizeStatus.java b/java/src/com/android/inputmethod/latin/utils/RecapitalizeStatus.java
index a381649a4..737e33228 100644
--- a/java/src/com/android/inputmethod/latin/utils/RecapitalizeStatus.java
+++ b/java/src/com/android/inputmethod/latin/utils/RecapitalizeStatus.java
@@ -81,7 +81,7 @@ public class RecapitalizeStatus {
private static final int[] EMPTY_STORTED_SEPARATORS = {};
public RecapitalizeStatus() {
- // By default, initialize with dummy values that won't match any real recapitalize.
+ // By default, initialize with fake values that won't match any real recapitalize.
start(-1, -1, "", Locale.getDefault(), EMPTY_STORTED_SEPARATORS);
stop();
}
diff --git a/native/dicttoolkit/Android.bp b/native/dicttoolkit/Android.bp
index b214ff984..4ae250fa2 100644
--- a/native/dicttoolkit/Android.bp
+++ b/native/dicttoolkit/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
cc_defaults {
name: "dicttoolkit_defaults",
@@ -37,6 +46,7 @@ cc_defaults {
"-Wno-unused-function",
],
+ header_libs: ["jni_headers"],
local_include_dirs: ["src"],
// TODO
include_dirs: ["packages/inputmethods/LatinIME/native/jni/src"],
diff --git a/native/jni/Android.bp b/native/jni/Android.bp
index 5649fc1ea..ab14632f8 100644
--- a/native/jni/Android.bp
+++ b/native/jni/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
filegroup {
name: "LATIN_IME_CORE_SRC_FILES",
srcs: [
@@ -130,6 +139,7 @@ cc_library {
"-Wno-unused-parameter",
"-Wno-unused-function",
],
+ header_libs: ["jni_headers"],
local_include_dirs: ["src"],
srcs: [
@@ -167,6 +177,7 @@ cc_library_static {
"-Wall",
"-Werror",
],
+ header_libs: ["jni_headers"],
local_include_dirs: ["src"],
sdk_version: "14",
stl: "libc++_static",
@@ -177,7 +188,9 @@ cc_library_static {
cc_test {
name: "liblatinime_unittests",
host_supported: true,
-
+ test_options: {
+ unit_test: true,
+ },
cflags: [
"-Wno-unused-parameter",
"-Wno-unused-function",
diff --git a/native/jni/src/dictionary/header/header_policy.cpp b/native/jni/src/dictionary/header/header_policy.cpp
index d4f84d39f..173cfd982 100644
--- a/native/jni/src/dictionary/header/header_policy.cpp
+++ b/native/jni/src/dictionary/header/header_policy.cpp
@@ -105,7 +105,7 @@ bool HeaderPolicy::fillInAndWriteHeaderToBuffer(const bool updatesLastDecayedTim
&writingPos)) {
return false;
}
- // Temporarily writes a dummy header size.
+ // Temporarily writes a placeholder header size.
int headerSizeFieldPos = writingPos;
if (!HeaderReadWriteUtils::writeDictionaryHeaderSize(outBuffer, 0 /* size */,
&writingPos)) {
diff --git a/native/jni/src/dictionary/header/header_policy.h b/native/jni/src/dictionary/header/header_policy.h
index 47cc9196a..1b37575a0 100644
--- a/native/jni/src/dictionary/header/header_policy.h
+++ b/native/jni/src/dictionary/header/header_policy.h
@@ -97,7 +97,7 @@ class HeaderPolicy : public DictionaryHeaderStructurePolicy {
headerPolicy->mForgettingCurveProbabilityValuesTableId),
mCodePointTable(headerPolicy->mCodePointTable) {}
- // Temporary dummy header.
+ // Temporary placeholder header.
HeaderPolicy()
: mDictFormatVersion(FormatUtils::UNKNOWN_VERSION), mDictionaryFlags(0), mSize(0),
mAttributeMap(), mLocale(CharUtils::EMPTY_STRING), mMultiWordCostMultiplier(0.0f),
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 b167f0ab2..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 dummy entries until writingPos.
- if (!writeEntry(&dummyEntry, writingPos)) {
- AKLOGE("Cannot write dummy entry. pos: %d, mSize: %d", writingPos, mSize);
+ // Fulfilling with placeholder entries until writingPos.
+ 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/structure/backward/v402/content/probability_entry.h b/native/jni/src/dictionary/structure/backward/v402/content/probability_entry.h
index 94e36bf51..68176a457 100644
--- a/native/jni/src/dictionary/structure/backward/v402/content/probability_entry.h
+++ b/native/jni/src/dictionary/structure/backward/v402/content/probability_entry.h
@@ -38,7 +38,7 @@ class ProbabilityEntry {
: mFlags(probabilityEntry.mFlags), mProbability(probabilityEntry.mProbability),
mHistoricalInfo(probabilityEntry.mHistoricalInfo) {}
- // Dummy entry
+ // Placeholder entry
ProbabilityEntry()
: mFlags(0), mProbability(NOT_A_PROBABILITY), mHistoricalInfo() {}
diff --git a/native/jni/src/dictionary/structure/backward/v402/ver4_patricia_trie_node_writer.cpp b/native/jni/src/dictionary/structure/backward/v402/ver4_patricia_trie_node_writer.cpp
index e3ab5ec20..075dc6d01 100644
--- a/native/jni/src/dictionary/structure/backward/v402/ver4_patricia_trie_node_writer.cpp
+++ b/native/jni/src/dictionary/structure/backward/v402/ver4_patricia_trie_node_writer.cpp
@@ -339,7 +339,7 @@ bool Ver4PatriciaTrieNodeWriter::writePtNodeAndGetTerminalIdAndAdvancePosition(
const PtNodeParams *const ptNodeParams, int *const outTerminalId,
int *const ptNodeWritingPos) {
const int nodePos = *ptNodeWritingPos;
- // Write dummy flags. The Node flags are updated with appropriate flags at the last step of the
+ // Write placeholder flags. The Node flags are updated with appropriate flags at the last step of the
// PtNode writing.
if (!DynamicPtWritingUtils::writeFlagsAndAdvancePosition(mTrieBuffer,
0 /* nodeFlags */, ptNodeWritingPos)) {
diff --git a/native/jni/src/dictionary/structure/pt_common/dynamic_pt_gc_event_listeners.cpp b/native/jni/src/dictionary/structure/pt_common/dynamic_pt_gc_event_listeners.cpp
index b5e2e9dae..1b1be324b 100644
--- a/native/jni/src/dictionary/structure/pt_common/dynamic_pt_gc_event_listeners.cpp
+++ b/native/jni/src/dictionary/structure/pt_common/dynamic_pt_gc_event_listeners.cpp
@@ -76,14 +76,14 @@ bool DynamicPtGcEventListeners::TraversePolicyToUpdateBigramProbability
return true;
}
-// Writes dummy PtNode array size when the head of PtNode array is read.
+// Writes placeholder PtNode array size when the head of PtNode array is read.
bool DynamicPtGcEventListeners::TraversePolicyToPlaceAndWriteValidPtNodesToBuffer
::onDescend(const int ptNodeArrayPos) {
mValidPtNodeCount = 0;
int writingPos = mBufferToWrite->getTailPosition();
mDictPositionRelocationMap->mPtNodeArrayPositionRelocationMap.insert(
PtNodeWriter::PtNodeArrayPositionRelocationMap::value_type(ptNodeArrayPos, writingPos));
- // Writes dummy PtNode array size because arrays can have a forward link or needles PtNodes.
+ // Writes placeholder PtNode array size because arrays can have a forward link or needles PtNodes.
// This field will be updated later in onReadingPtNodeArrayTail() with actual PtNode count.
mPtNodeArraySizeFieldPos = writingPos;
return DynamicPtWritingUtils::writePtNodeArraySizeAndAdvancePosition(
diff --git a/native/jni/src/dictionary/structure/pt_common/shortcut/shortcut_list_reading_utils.cpp b/native/jni/src/dictionary/structure/pt_common/shortcut/shortcut_list_reading_utils.cpp
index 14428edd4..62ec3d85a 100644
--- a/native/jni/src/dictionary/structure/pt_common/shortcut/shortcut_list_reading_utils.cpp
+++ b/native/jni/src/dictionary/structure/pt_common/shortcut/shortcut_list_reading_utils.cpp
@@ -27,7 +27,7 @@ const ShortcutListReadingUtils::ShortcutFlags
const ShortcutListReadingUtils::ShortcutFlags
ShortcutListReadingUtils::MASK_ATTRIBUTE_PROBABILITY = 0x0F;
const int ShortcutListReadingUtils::SHORTCUT_LIST_SIZE_FIELD_SIZE = 2;
-// The numeric value of the shortcut probability that means 'whitelist'.
+// The numeric value of the shortcut probability that means 'allowlist'.
const int ShortcutListReadingUtils::WHITELIST_SHORTCUT_PROBABILITY = 15;
/* static */ ShortcutListReadingUtils::ShortcutFlags
diff --git a/native/jni/src/dictionary/structure/v4/content/probability_entry.h b/native/jni/src/dictionary/structure/v4/content/probability_entry.h
index 473354b90..8dd1fb073 100644
--- a/native/jni/src/dictionary/structure/v4/content/probability_entry.h
+++ b/native/jni/src/dictionary/structure/v4/content/probability_entry.h
@@ -34,7 +34,7 @@ class ProbabilityEntry {
: mFlags(probabilityEntry.mFlags), mProbability(probabilityEntry.mProbability),
mHistoricalInfo(probabilityEntry.mHistoricalInfo) {}
- // Dummy entry
+ // Placeholder entry
ProbabilityEntry()
: mFlags(Ver4DictConstants::FLAG_NOT_A_VALID_ENTRY), mProbability(NOT_A_PROBABILITY),
mHistoricalInfo() {}
diff --git a/native/jni/src/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp b/native/jni/src/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp
index d974b50f4..774bc02c7 100644
--- a/native/jni/src/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp
+++ b/native/jni/src/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp
@@ -286,7 +286,7 @@ bool Ver4PatriciaTrieNodeWriter::writePtNodeAndGetTerminalIdAndAdvancePosition(
const PtNodeParams *const ptNodeParams, int *const outTerminalId,
int *const ptNodeWritingPos) {
const int nodePos = *ptNodeWritingPos;
- // Write dummy flags. The Node flags are updated with appropriate flags at the last step of the
+ // Write placeholder flags. The Node flags are updated with appropriate flags at the last step of the
// PtNode writing.
if (!DynamicPtWritingUtils::writeFlagsAndAdvancePosition(mTrieBuffer,
0 /* nodeFlags */, ptNodeWritingPos)) {
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 e14805e37..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 whitelist 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/native/jni/tests/dictionary/utils/format_utils_test.cpp b/native/jni/tests/dictionary/utils/format_utils_test.cpp
index 3561bda30..34defe78c 100644
--- a/native/jni/tests/dictionary/utils/format_utils_test.cpp
+++ b/native/jni/tests/dictionary/utils/format_utils_test.cpp
@@ -57,7 +57,13 @@ TEST(FormatUtilsTest, TestDetectFormatVersion) {
{
const std::vector<uint8_t> buffer =
getBuffer(FormatUtils::MAGIC_NUMBER, FormatUtils::VERSION_2, 0, 0);
- EXPECT_EQ(FormatUtils::VERSION_2, FormatUtils::detectFormatVersion(
+ EXPECT_EQ(FormatUtils::UNKNOWN_VERSION, FormatUtils::detectFormatVersion(
+ ReadOnlyByteArrayView(buffer.data(), buffer.size())));
+ }
+ {
+ const std::vector<uint8_t> buffer =
+ getBuffer(FormatUtils::MAGIC_NUMBER, FormatUtils::VERSION_202, 0, 0);
+ EXPECT_EQ(FormatUtils::VERSION_202, FormatUtils::detectFormatVersion(
ReadOnlyByteArrayView(buffer.data(), buffer.size())));
}
{
@@ -75,7 +81,7 @@ TEST(FormatUtilsTest, TestDetectFormatVersion) {
{
const std::vector<uint8_t> buffer =
- getBuffer(FormatUtils::MAGIC_NUMBER - 1, FormatUtils::VERSION_2, 0, 0);
+ getBuffer(FormatUtils::MAGIC_NUMBER - 1, FormatUtils::VERSION_402, 0, 0);
EXPECT_EQ(FormatUtils::UNKNOWN_VERSION, FormatUtils::detectFormatVersion(
ReadOnlyByteArrayView(buffer.data(), buffer.size())));
}
@@ -87,7 +93,7 @@ TEST(FormatUtilsTest, TestDetectFormatVersion) {
}
{
const std::vector<uint8_t> buffer =
- getBuffer(FormatUtils::MAGIC_NUMBER, FormatUtils::VERSION_2, 0, 0);
+ getBuffer(FormatUtils::MAGIC_NUMBER, FormatUtils::VERSION_402, 0, 0);
EXPECT_EQ(FormatUtils::UNKNOWN_VERSION, FormatUtils::detectFormatVersion(
ReadOnlyByteArrayView(buffer.data(), buffer.size() - 1)));
}
diff --git a/tests/Android.bp b/tests/Android.bp
index 76681f669..4c5b74a91 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
android_test {
name: "LatinIMETests",
@@ -41,6 +50,6 @@ android_test {
instrumentation_for: "LatinIME",
min_sdk_version: "14",
- target_sdk_version: "21",
+ target_sdk_version: "30",
sdk_version: "current",
}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index e788e0b7c..95ddb0a2a 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -16,9 +16,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.inputmethod.latin.tests"
- android:versionCode="28">
+ android:versionCode="30">
- <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
+ <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
diff --git a/tests/res/raw/dummy_resource_for_testing.txt b/tests/res/raw/dummy_resource_for_testing.txt
index 05da86b8f..88e64fd6e 100644
--- a/tests/res/raw/dummy_resource_for_testing.txt
+++ b/tests/res/raw/dummy_resource_for_testing.txt
@@ -1,3 +1,3 @@
-/* This dummy raw resource is needed to be able to load string resources from a test APK
+/* This placeholder raw resource is needed to be able to load string resources from a test APK
* successfully. (See {@link KeySpecParserSplitTests#setUp()}.
*/
diff --git a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
index a0544d62a..e3fb30dbb 100644
--- a/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
+++ b/tests/src/com/android/inputmethod/compat/SuggestionSpanUtilsTest.java
@@ -51,7 +51,7 @@ public class SuggestionSpanUtilsTest {
}
/**
- * Helper method to create a dummy {@link SuggestedWordInfo}.
+ * Helper method to create a placeholder {@link SuggestedWordInfo}.
*
* @param kindAndFlags the kind and flags to be used to create {@link SuggestedWordInfo}.
* @param word the word to be used to create {@link SuggestedWordInfo}.
diff --git a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
index 92bff0e2e..b41c7013c 100644
--- a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
+++ b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java
@@ -36,7 +36,7 @@ import java.util.Locale;
public class SuggestedWordsTests {
/**
- * Helper method to create a dummy {@link SuggestedWordInfo} with specifying
+ * Helper method to create a placeholder {@link SuggestedWordInfo} with specifying
* {@link SuggestedWordInfo#KIND_TYPED}.
*
* @param word the word to be used to create {@link SuggestedWordInfo}.
@@ -53,7 +53,7 @@ public class SuggestedWordsTests {
}
/**
- * Helper method to create a dummy {@link SuggestedWordInfo} with specifying
+ * Helper method to create a placeholder {@link SuggestedWordInfo} with specifying
* {@link SuggestedWordInfo#KIND_CORRECTION}.
*
* @param word the word to be used to create {@link SuggestedWordInfo}.
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
index bd5136583..2ae5bf5c1 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java
@@ -446,7 +446,7 @@ public class BinaryDictEncoderUtils {
}
/**
- * Sanity-checking method.
+ * Validity-checking method.
*
* This method checks a list of PtNode arrays for juxtaposition, that is, it will do
* nothing if each node array's cached address is actually the previous node array's address
@@ -664,7 +664,7 @@ public class BinaryDictEncoderUtils {
+ "of the node : " + dictEncoder.getPosition() + " <> "
+ ptNode.mCachedAddressAfterUpdate);
}
- // Sanity checks.
+ // Validity checks.
if (DBG && ptNode.getProbability() > FormatSpec.MAX_TERMINAL_FREQUENCY) {
throw new RuntimeException("A node has a frequency > "
+ FormatSpec.MAX_TERMINAL_FREQUENCY
diff --git a/tests/src/com/android/inputmethod/latin/makedict/FusionDictionary.java b/tests/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
index 6ba1ef966..2bed44d7a 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
@@ -277,7 +277,7 @@ public final class FusionDictionary implements Iterable<WordProperty> {
}
/**
- * Sanity check for a PtNode array.
+ * Validity check for a PtNode array.
*
* This method checks that all PtNodes in a node array are ordered as expected.
* If they are, nothing happens. If they aren't, an exception is thrown.
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 4b7b9bc36..73d7e7339 100644
--- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTestsHelper.java
+++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTestsHelper.java
@@ -37,7 +37,7 @@ import java.util.Random;
public class UserHistoryDictionaryTestsHelper {
/**
- * Locale prefix for generating dummy locales for tests.
+ * Locale prefix for generating placeholder locales for tests.
*/
public static final String TEST_LOCALE_PREFIX = "test-";
@@ -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/EditTextVariations/Android.bp b/tools/EditTextVariations/Android.bp
index 94b4951a7..f6ed1561d 100644
--- a/tools/EditTextVariations/Android.bp
+++ b/tools/EditTextVariations/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
android_test {
name: "EditTextVariations",
diff --git a/tools/EditTextVariations/AndroidManifest.xml b/tools/EditTextVariations/AndroidManifest.xml
index 96c244b32..0cf6d4fcc 100644
--- a/tools/EditTextVariations/AndroidManifest.xml
+++ b/tools/EditTextVariations/AndroidManifest.xml
@@ -14,34 +14,34 @@
limitations under the License.
-->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.inputmethod.tools.edittextvariations"
- android:versionName="0.67"
- android:versionCode="67"
->
- <supports-screens android:resizeable="true" />
- <uses-sdk
- android:targetSdkVersion="27"
- android:minSdkVersion="11" />
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:allowBackup="false"
- >
- <activity
- android:name=".EditTextVariations"
- android:windowSoftInputMode="stateHidden|adjustPan"
- android:theme="@style/defaultActivityTheme"
- android:label="@string/app_name"
- >
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.inputmethod.tools.edittextvariations"
+ android:versionName="0.67"
+ android:versionCode="67">
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <supports-screens android:resizeable="true"/>
+ <uses-sdk android:targetSdkVersion="27"
+ android:minSdkVersion="11"/>
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
+ <application android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:allowBackup="false">
+ <activity android:name=".EditTextVariations"
+ android:windowSoftInputMode="stateHidden|adjustPan"
+ android:theme="@style/defaultActivityTheme"
+ android:label="@string/app_name"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
- <receiver
- android:name=".NotificationBroadcastReceiver"
- android:exported="false" />
+ <activity android:name=".EditorActivity"
+ android:windowSoftInputMode="stateHidden|adjustPan"
+ android:theme="@style/defaultActivityTheme"
+ android:label="@string/app_name"/>
+ <receiver android:name=".NotificationBroadcastReceiver"
+ android:exported="false"/>
</application>
</manifest>
diff --git a/tools/EditTextVariations/res/values/strings.xml b/tools/EditTextVariations/res/values/strings.xml
index cb896e8b6..1b42dc787 100644
--- a/tools/EditTextVariations/res/values/strings.xml
+++ b/tools/EditTextVariations/res/values/strings.xml
@@ -35,6 +35,10 @@
<string name="menu_softinput_hidden" translatable="false">Keyboard Hidden</string>
<!-- The menu title to send a notification to test direct reply. [CHAR LIMIT=20] -->
<string name="menu_direct_reply">Direct Reply</string>
+ <!-- The menu title to show a application overlay with NOT_FOCUSABLE | ALT_FOCUSABLE_IM. [CHAR LIMIT=26] -->
+ <string name="menu_show_ime_focusable_overlay">Show IME focusable overlay</string>
+ <!-- The menu title to hide a application overlay with NOT_FOCUSABLE | ALT_FOCUSABLE_IM. [CHAR LIMIT=26] -->
+ <string name="menu_hide_ime_focusable_overlay">Hide IME focusable overlay</string>
<!-- The example of custom action key label. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] -->
<string name="custom_action_label">Custom</string>
</resources>
diff --git a/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditTextVariations.java b/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditTextVariations.java
index 6eb85a528..53d08b6c9 100644
--- a/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditTextVariations.java
+++ b/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditTextVariations.java
@@ -16,18 +16,31 @@
package com.android.inputmethod.tools.edittextvariations;
+import static android.graphics.Color.BLUE;
+import static android.view.Gravity.LEFT;
+import static android.view.Gravity.TOP;
+import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+
+import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.provider.Settings;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
@@ -45,7 +58,9 @@ import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.TextView;
+import android.widget.Toast;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
@@ -61,9 +76,11 @@ public final class EditTextVariations extends Activity implements TextView.OnEdi
private static final int MENU_SOFTINPUT_VISIBLE = 4;
private static final int MENU_SOFTINPUT_HIDDEN = 5;
private static final int MENU_DIRECT_REPLY = 6;
+ private static final int MENU_TOGGLE_IME_FOCUSABLE_OVERLAY = 7;
private static final String PREF_THEME = "theme";
private static final String PREF_NAVIGATE = "navigate";
private static final String PREF_SOFTINPUT = "softinput";
+ private static final int NOTIFICATION_PERMISSION_REQUEST_CODE = 0;
private SharedPreferences prefs;
private View[] fields;
@@ -80,6 +97,9 @@ public final class EditTextVariations extends Activity implements TextView.OnEdi
private ArrayAdapter<String> mAutoCompleteAdapter;
+ private TextView mOverlayTextView;
+ private boolean mShowOverlay = true;
+
/** Called when the activity is first created. */
@SuppressLint("SetJavaScriptEnabled")
@Override
@@ -166,9 +186,12 @@ public final class EditTextVariations extends Activity implements TextView.OnEdi
if (NotificationUtils.DIRECT_REPLY_SUPPORTED) {
menu.add(Menu.NONE, MENU_DIRECT_REPLY, 5, R.string.menu_direct_reply);
}
+ menu.add(Menu.NONE, MENU_TOGGLE_IME_FOCUSABLE_OVERLAY, 6,
+ mShowOverlay ? getString(R.string.menu_show_ime_focusable_overlay)
+ : getString(R.string.menu_hide_ime_focusable_overlay));
try {
final PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
- menu.add(Menu.NONE, MENU_VERSION, 6,
+ menu.add(Menu.NONE, MENU_VERSION, 7,
getString(R.string.menu_version, pinfo.versionName))
.setEnabled(false);
} catch (NameNotFoundException e) {
@@ -199,12 +222,54 @@ public final class EditTextVariations extends Activity implements TextView.OnEdi
saveSoftInputMode(itemId == MENU_SOFTINPUT_VISIBLE);
restartActivity();
} else if (itemId == MENU_DIRECT_REPLY) {
- NotificationUtils.sendDirectReplyNotification(this);
+ final boolean needPermissionCheck = isNeedNotificationPermission()
+ && checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) !=
+ PackageManager.PERMISSION_GRANTED;
+ if (needPermissionCheck) {
+ requestPermissions(new String[] { Manifest.permission.POST_NOTIFICATIONS },
+ NOTIFICATION_PERMISSION_REQUEST_CODE);
+ } else {
+ NotificationUtils.sendDirectReplyNotification(this);
+ }
+ } else if (itemId == MENU_TOGGLE_IME_FOCUSABLE_OVERLAY) {
+ if (!Settings.canDrawOverlays(this)) {
+ Toast.makeText(this,
+ "Not allowed to show overlay.\nCheck \"Settings > "
+ + "Display over other apps\"", Toast.LENGTH_LONG).show();
+ } else {
+ toggleOverlayView(true /* needsIme */);
+ item.setTitle(mShowOverlay ? getString(R.string.menu_show_ime_focusable_overlay)
+ : getString(R.string.menu_hide_ime_focusable_overlay));
+ }
}
return true;
}
@Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+ if (requestCode == NOTIFICATION_PERMISSION_REQUEST_CODE) {
+ if (grantResults.length == 1 &&
+ grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ // Permission is granted. Continue to send the notification.
+ NotificationUtils.sendDirectReplyNotification(this);
+ } else {
+ Log.d(TAG, "POST_NOTIFICATIONS Permissions denied.");
+ Toast.makeText(this, "Required permission has denied",
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ if (mOverlayTextView != null) {
+ getWindowManager().removeView(mOverlayTextView);
+ mOverlayTextView = null;
+ }
+ }
+
+ @Override
public void onClick(final DialogInterface dialog, final int which) {
saveTheme(ThemeItem.THEME_LIST.get(which));
restartActivity();
@@ -476,4 +541,36 @@ public final class EditTextVariations extends Activity implements TextView.OnEdi
}
return text;
}
+
+ private static boolean isNeedNotificationPermission() {
+ for(Field field : Manifest.permission.class.getFields()) {
+ if (field.getName().equals("POST_NOTIFICATIONS")) {
+ Log.d(TAG, "Need notification permission.");
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void toggleOverlayView(boolean needsIme) {
+ if (mOverlayTextView == null) {
+ Context overlayContext = createDisplayContext(getDisplay())
+ .createWindowContext(TYPE_APPLICATION_OVERLAY, null /* options */);
+ int focusableFlags = FLAG_NOT_FOCUSABLE | (needsIme ? FLAG_ALT_FOCUSABLE_IM : 0);
+ final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
+ TYPE_APPLICATION_OVERLAY, FLAG_WATCH_OUTSIDE_TOUCH | focusableFlags);
+ final Rect windowBounds = getWindowManager().getCurrentWindowMetrics().getBounds();
+ params.width = windowBounds.width() / 3;
+ params.height = windowBounds.height() / 3;
+ params.gravity = TOP | LEFT;
+
+ mOverlayTextView = new TextView(overlayContext);
+ mOverlayTextView.setText("I'm an IME focusable overlay");
+ mOverlayTextView.setBackgroundColor(BLUE);
+ getWindowManager().addView(mOverlayTextView, params);
+ }
+ mOverlayTextView.setVisibility(mShowOverlay ? View.VISIBLE : View.GONE);
+ // Toggle the overlay visibility after the call.
+ mShowOverlay = !mShowOverlay;
+ }
}
diff --git a/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditorActivity.java b/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditorActivity.java
new file mode 100644
index 000000000..4fc947bff
--- /dev/null
+++ b/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/EditorActivity.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+package com.android.inputmethod.tools.edittextvariations;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+
+public final class EditorActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ LinearLayout layout = new LinearLayout(this);
+ layout.setOrientation(LinearLayout.VERTICAL);
+ EditText editText = new EditText(this);
+ editText.setHint("reply the message");
+ layout.addView(editText);
+ setContentView(layout);
+ }
+}
diff --git a/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/NotificationUtils.java b/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/NotificationUtils.java
index a9b7132eb..78d52bb00 100644
--- a/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/NotificationUtils.java
+++ b/tools/EditTextVariations/src/com/android/inputmethod/tools/edittextvariations/NotificationUtils.java
@@ -57,7 +57,7 @@ final class NotificationUtils {
synchronized (sLock) {
if (!sNotificationChannelInitialized) {
final NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
- CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
+ CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH);
channel.setDescription(CHANNEL_DESCRIPTION);
context.getSystemService(NotificationManager.class)
.createNotificationChannel(channel);
@@ -79,12 +79,15 @@ final class NotificationUtils {
final int notificationId = sNextNotificationId.getAndIncrement();
final PendingIntent pendingIntent = getReplyPendingIntent(context, notificationId);
+ final PendingIntent activityIntent = PendingIntent.getActivity(context, 0,
+ new Intent(context, EditorActivity.class), 0);
final Notification.Action action =
new Notification.Action.Builder(null, "Direct Reply Test", pendingIntent)
.addRemoteInput(remoteInput)
.build();
final Notification notification = createNotificationBuilder(context)
.setContentText("Content Title")
+ .setContentIntent(activityIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setContentText("Message from " + UserHandle.getUserHandleForUid(Process.myUid()))
.setShowWhen(true)
diff --git a/tools/dicttool/Android.bp b/tools/dicttool/Android.bp
index 83b4ed32c..48f751e78 100644
--- a/tools/dicttool/Android.bp
+++ b/tools/dicttool/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
java_binary_host {
name: "dicttool_aosp",
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/Android.bp b/tools/make-keyboard-text/Android.bp
index 4976051da..781f53f97 100644
--- a/tools/make-keyboard-text/Android.bp
+++ b/tools/make-keyboard-text/Android.bp
@@ -13,6 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
+}
+
java_binary_host {
name: "make-keyboard-text",
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];
}