Set targetSdkVersion=31 to ThemedNavBarKeyboard

With this CL, ThemedNavBarKeyboard sameple IME will have an explicitly
set targetSdkVersion=31 so that it can be installed on older version
of Android OSes.

This CL also explicitly sets "android:exported", which has been
required in AndroidManifest.xml since API 31.

Fix: 211463997
Test: Manually verified as follows
 1. Flash SQ1A.211205.008 aosp_coral-userdebug into coral
 2. make -j ThemedNavBarKeyboard
 3. adb install -r $ANDROID_PRODUCT_OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk
Change-Id: Idd88031a6b65cca58add8abe42794bc5f01b1973
This commit is contained in:
Yohei Yukawa
2021-12-20 10:34:34 -08:00
parent 1ada019953
commit f2464f70f2
3 changed files with 4 additions and 1 deletions

View File

@@ -21,6 +21,8 @@ package {
android_app {
name: "ThemedNavBarKeyboard",
srcs: ["**/*.java"],
min_sdk_version: "28",
target_sdk_version: "31",
sdk_version: "current",
dex_preopt: {
enabled: false,

View File

@@ -19,6 +19,7 @@
<application android:label="ThemedNavBarKeyboard">
<service android:name=".ThemedNavBarKeyboard"
android:exported="true"
android:label="ThemedNavBarKeyboard"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>

View File

@@ -59,7 +59,7 @@ public class ThemedNavBarKeyboard extends InputMethodService {
@Override
public void onCreate() {
super.onCreate();
if (BuildCompat.EFFECTIVE_SDK_INT > Build.VERSION_CODES.P) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// Disable contrast for extended navbar gradient.
getWindow().getWindow().setNavigationBarContrastEnforced(false);
}