Merge 24Q3 to AOSP main
Bug: 357762254
Merged-In: I755d000d2fa39bac5b7ea480baf21d1bf8b5067b
Change-Id: I9b9e1b1e3d612a4e3165e8444a058b7708c7c8af
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 624e096..c8411ef 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -18,7 +18,10 @@
<!-- Component name of default touch IME. This resource should be overlaid if a device uses an
IME other than CarLatinIME. This resource should not be empty. -->
<string name="default_touch_input_method" translatable="false">com.android.inputmethod.latin/.CarLatinIME</string>
- <!-- Component name of rotary IME. Empty if none. -->
+ <!-- Component name of rotary IME. Empty if none. The value must be different from
+ default_touch_input_method.
+ If the value is not empty, this IME will be only used in rotary mode; otherwise, touch IME
+ will be used in both touch mode and rotary mode. -->
<string name="rotary_input_method" translatable="false"></string>
<!-- Intents to launch an activity when the user nudges up, down, left, or right off the edge of
diff --git a/src/com/android/car/rotary/RotaryService.java b/src/com/android/car/rotary/RotaryService.java
index c6a84bb..c85e893 100644
--- a/src/com/android/car/rotary/RotaryService.java
+++ b/src/com/android/car/rotary/RotaryService.java
@@ -631,12 +631,13 @@
validateImeConfiguration(mDefaultTouchInputMethod);
mTouchInputMethod = mPrefs.getString(TOUCH_INPUT_METHOD_PREFIX
+ mUserManager.getUserName(), mDefaultTouchInputMethod);
- if (mTouchInputMethod.isEmpty()) {
+ // TODO(b/346437360): use a better way to initialize mTouchInputMethod.
+ if (mTouchInputMethod.isEmpty()
+ || !Utils.isInstalledIme(mTouchInputMethod, mInputMethodManager)) {
// Workaround for b/323013736.
- L.e("mTouchInputMethod shouldn't be empty!");
+ L.e("mTouchInputMethod is empty or not installed!");
mTouchInputMethod = mDefaultTouchInputMethod;
}
- validateImeConfiguration(mTouchInputMethod);
if (mRotaryInputMethod != null && mRotaryInputMethod.equals(getCurrentIme())) {
// Switch from the rotary IME to the touch IME in case Android defaults to the rotary
@@ -768,6 +769,7 @@
@Override
public void onDestroy() {
L.v("onDestroy");
+ mExecutor.shutdown();
unregisterReceiver(mAppInstallUninstallReceiver);
unregisterInputMethodObserver();
@@ -2055,7 +2057,7 @@
if (mNavigator.supportTemplateApp()) {
// Check if there is a SurfaceView node to decide whether the foreground app is an
// AAOS template app. This is done on background thread to avoid ANR (b/322324727).
- // TODO: find a better way to solve this to avoid potential race condition.
+ // TODO(b/322324727): find a better way to solve this to avoid potential race condition.
mExecutor.execute(() -> {
// If the foreground app is a client app, store its package name.
AccessibilityNodeInfo surfaceView =
diff --git a/tests/unit/src/com/android/car/rotary/NavigatorTest.java b/tests/unit/src/com/android/car/rotary/NavigatorTest.java
index 9eb82e2..03fed32 100644
--- a/tests/unit/src/com/android/car/rotary/NavigatorTest.java
+++ b/tests/unit/src/com/android/car/rotary/NavigatorTest.java
@@ -75,7 +75,8 @@
@BeforeClass
public static void oneTimeSetup() {
- sUiAutomoation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+ sUiAutomoation = InstrumentationRegistry.getInstrumentation().getUiAutomation(
+ UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES);
// FLAG_RETRIEVE_INTERACTIVE_WINDOWS is necessary to reliably access the root window.
AccessibilityServiceInfo serviceInfo = sUiAutomoation.getServiceInfo();
diff --git a/tests/unit/src/com/android/car/rotary/RotaryServiceTest.java b/tests/unit/src/com/android/car/rotary/RotaryServiceTest.java
index b1a26f7..358e4c5 100644
--- a/tests/unit/src/com/android/car/rotary/RotaryServiceTest.java
+++ b/tests/unit/src/com/android/car/rotary/RotaryServiceTest.java
@@ -100,7 +100,8 @@
@BeforeClass
public static void setUpClass() {
- sUiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+ sUiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation(
+ UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES);
// FLAG_RETRIEVE_INTERACTIVE_WINDOWS is necessary to reliably access the root window.
AccessibilityServiceInfo serviceInfo = sUiAutomation.getServiceInfo();