summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2023-08-14 15:42:33 -0700
committerXin Li <delphij@google.com>2023-08-14 15:42:33 -0700
commit176fd72c0fd4c5e79daf015460a52865ed890bb2 (patch)
tree5e936bd778cbd4e7f9027628dc8f7b09aadeccb1
parentd847619a2b48945465f840b8d81644fa455cc115 (diff)
parent64ce9427f8b45018f525eba6d86f6ce257cb5845 (diff)
downloadLatinIME-tmp_amf_298295554.tar.gz
Merge Android U (ab/10368041)tmp_amf_298295554
Bug: 291102124 Merged-In: I7efbfd50628298c436cb86d5d84af6cbfa7918da Change-Id: Ic95053849a83d3c13510c05d5fd03cc6863f3b65
-rw-r--r--java/AndroidManifest.xml12
-rw-r--r--java/lint-baseline.xml44
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java23
-rw-r--r--tests/AndroidTest.xml2
4 files changed, 42 insertions, 39 deletions
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index ac84c3388..633c68be3 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -54,6 +54,13 @@
<permission android:name="com.android.inputmethod.latin.HIDE_SOFT_INPUT"
android:protectionLevel="signature"/>
+ <!-- To query enabled input methods. -->
+ <queries>
+ <intent>
+ <action android:name="android.view.InputMethod" />
+ </intent>
+ </queries>
+
<application android:label="@string/english_ime_name"
android:icon="@drawable/ic_launcher_keyboard"
android:supportsRtl="true"
@@ -65,7 +72,8 @@
<service android:name="LatinIME"
android:label="@string/english_ime_name"
android:permission="android.permission.BIND_INPUT_METHOD"
- android:exported="true">
+ android:exported="true"
+ android:visibleToInstantApps="true">
<intent-filter>
<action android:name="android.view.InputMethod"/>
</intent-filter>
@@ -149,7 +157,7 @@
<activity android:name="com.android.inputmethod.dictionarypack.DownloadOverMeteredDialog"
android:theme="@style/platformActivityTheme"
android:label="@string/dictionary_install_over_metered_network_prompt"
- android:exported="true">
+ android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
diff --git a/java/lint-baseline.xml b/java/lint-baseline.xml
index 02f41f4e4..dbb81ca76 100644
--- a/java/lint-baseline.xml
+++ b/java/lint-baseline.xml
@@ -26,56 +26,36 @@
<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=" ~~~~~~~~~~~~~~~~">
+ errorLine1=" final UserManager userManager = context.getSystemService(UserManager.class);"
+ errorLine2=" ~~~~~~~~~~~~~~~~">
<location
- file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java"
- line="606"
- column="34"/>
+ file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/compat/UserManagerCompatUtils.java"
+ line="69"
+ column="49"/>
</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=" ~~~~~~~~~~~~~~~~">
+ message="Call requires API level 23 (current min is 21): `android.app.ActivityOptions#makeBasic`">
<location
file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java"
- line="804"
- column="34"/>
+ line="1842"/>
</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=" ~~~~~~~~~">
+ message="Call requires API level 23 (current min is 21): `android.content.Context#getSystemService`">
<location
file="packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/LatinIME.java"
- line="1823"
- column="33"/>
+ line="605"/>
</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=" ~~~~~~~~~~~~~~~~~~">
+ message="Call requires API level 26 (current min is 21): `android.app.ActivityOptions#setLaunchDisplayId`">
<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"/>
+ line="1842"/>
</issue>
-</issues>
+</issues> \ No newline at end of file
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 8ed3a59bf..e68b43b39 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -628,16 +628,31 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final IntentFilter newDictFilter = new IntentFilter();
newDictFilter.addAction(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION);
- registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ registerReceiver(mDictionaryPackInstallReceiver, newDictFilter,
+ Context.RECEIVER_NOT_EXPORTED);
+ } else {
+ registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
+ }
final IntentFilter dictDumpFilter = new IntentFilter();
dictDumpFilter.addAction(DictionaryDumpBroadcastReceiver.DICTIONARY_DUMP_INTENT_ACTION);
- registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter,
+ Context.RECEIVER_NOT_EXPORTED);
+ } else {
+ registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter);
+ }
final IntentFilter hideSoftInputFilter = new IntentFilter();
hideSoftInputFilter.addAction(ACTION_HIDE_SOFT_INPUT);
- registerReceiver(mHideSoftInputReceiver, hideSoftInputFilter, PERMISSION_HIDE_SOFT_INPUT,
- null /* scheduler */);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ registerReceiver(mHideSoftInputReceiver, hideSoftInputFilter,
+ PERMISSION_HIDE_SOFT_INPUT, null /* scheduler */, Context.RECEIVER_EXPORTED);
+ } else {
+ registerReceiver(mHideSoftInputReceiver, hideSoftInputFilter,
+ PERMISSION_HIDE_SOFT_INPUT, null /* scheduler */);
+ }
StatsUtils.onCreate(mSettings.getCurrent(), mRichImm);
}
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
index 41334d5a8..60e9a01e9 100644
--- a/tests/AndroidTest.xml
+++ b/tests/AndroidTest.xml
@@ -26,7 +26,7 @@
hence we cannot rely on "test-file-name" to install LatinIME.apk
-->
- <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="LatinIMETests.apk" />
</target_preparer>