Merge "address use of DummyIME in UI Automator" am: 54bac103d2 am: 4342d200c6 am: adb2c1f51b

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1381318

Change-Id: I07055a034954023290e83d2334b0040ff00b9080
This commit is contained in:
Treehugger Robot
2020-07-31 22:42:54 +00:00
committed by Automerger Merge Worker
7 changed files with 20 additions and 20 deletions

View File

@@ -49,7 +49,7 @@ public class UiAutomationShellWrapper {
} }
try { try {
if (isSet) { if (isSet) {
am.setActivityController(new DummyActivityController(), true); am.setActivityController(new NoOpActivityController(), true);
} else { } else {
am.setActivityController(null, true); am.setActivityController(null, true);
} }
@@ -80,9 +80,9 @@ public class UiAutomationShellWrapper {
} }
/** /**
* Dummy, no interference, activity controller. * No-op, no interference, activity controller.
*/ */
private class DummyActivityController extends IActivityController.Stub { private class NoOpActivityController extends IActivityController.Stub {
@Override @Override
public boolean activityStarting(Intent intent, String pkg) throws RemoteException { public boolean activityStarting(Intent intent, String pkg) throws RemoteException {
/* do nothing and let activity proceed normally */ /* do nothing and let activity proceed normally */

View File

@@ -45,7 +45,7 @@ import java.util.List;
public class UiAutomatorTestCase extends TestCase { public class UiAutomatorTestCase extends TestCase {
private static final String DISABLE_IME = "disable_ime"; private static final String DISABLE_IME = "disable_ime";
private static final String DUMMY_IME_PACKAGE = "com.android.testing.dummyime"; private static final String STUB_IME_PACKAGE = "com.android.testing.stubime";
private static final int NOT_A_SUBTYPE_ID = -1; private static final int NOT_A_SUBTYPE_ID = -1;
private UiDevice mUiDevice; private UiDevice mUiDevice;
@@ -58,7 +58,7 @@ public class UiAutomatorTestCase extends TestCase {
super.setUp(); super.setUp();
mShouldDisableIme = "true".equals(mParams.getString(DISABLE_IME)); mShouldDisableIme = "true".equals(mParams.getString(DISABLE_IME));
if (mShouldDisableIme) { if (mShouldDisableIme) {
setDummyIme(); setStubIme();
} }
} }
@@ -128,7 +128,7 @@ public class UiAutomatorTestCase extends TestCase {
SystemClock.sleep(ms); SystemClock.sleep(ms);
} }
private void setDummyIme() { private void setStubIme() {
Context context = ActivityThread.currentApplication(); Context context = ActivityThread.currentApplication();
if (context == null) { if (context == null) {
throw new RuntimeException("ActivityThread.currentApplication() is null."); throw new RuntimeException("ActivityThread.currentApplication() is null.");
@@ -138,13 +138,13 @@ public class UiAutomatorTestCase extends TestCase {
List<InputMethodInfo> infos = im.getInputMethodList(); List<InputMethodInfo> infos = im.getInputMethodList();
String id = null; String id = null;
for (InputMethodInfo info : infos) { for (InputMethodInfo info : infos) {
if (DUMMY_IME_PACKAGE.equals(info.getComponent().getPackageName())) { if (STUB_IME_PACKAGE.equals(info.getComponent().getPackageName())) {
id = info.getId(); id = info.getId();
} }
} }
if (id == null) { if (id == null) {
throw new RuntimeException(String.format( throw new RuntimeException(String.format(
"Required testing fixture missing: IME package (%s)", DUMMY_IME_PACKAGE)); "Required testing fixture missing: IME package (%s)", STUB_IME_PACKAGE));
} }
if (context.checkSelfPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) if (context.checkSelfPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
!= PackageManager.PERMISSION_GRANTED) { != PackageManager.PERMISSION_GRANTED) {

View File

@@ -15,7 +15,7 @@
// //
android_test { android_test {
name: "DummyIME", name: "StubIME",
srcs: ["src/**/*.java"], srcs: ["src/**/*.java"],
sdk_version: "current", sdk_version: "current",
} }

View File

@@ -17,16 +17,16 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.testing.dummyime"> package="com.android.testing.stubime">
<application android:label="Dummy IME"> <application android:label="Stub IME">
<service android:name="DummyIme" <service android:name="StubIme"
android:permission="android.permission.BIND_INPUT_METHOD"> android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter> <intent-filter>
<action android:name="android.view.InputMethod" /> <action android:name="android.view.InputMethod" />
</intent-filter> </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>
<activity android:name=".ImePreferences" android:label="Dummy IME Settings"> <activity android:name=".ImePreferences" android:label="Stub IME Settings">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
</intent-filter> </intent-filter>

View File

@@ -21,9 +21,9 @@
<!-- for the Search Manager. --> <!-- for the Search Manager. -->
<input-method xmlns:android="http://schemas.android.com/apk/res/android" <input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.android.testing.dummyime.ImePreferences"> android:settingsActivity="com.android.testing.stubime.ImePreferences">
<subtype <subtype
android:label="Generic" android:label="Generic"
android:imeSubtypeLocale="en_US" android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard" /> android:imeSubtypeMode="keyboard" />
</input-method> </input-method>

View File

@@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.testing.dummyime; package com.android.testing.stubime;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
/** /**
* Dummy IME preference activity * Stub IME preference activity
*/ */
public class ImePreferences extends PreferenceActivity { public class ImePreferences extends PreferenceActivity {

View File

@@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.testing.dummyime; package com.android.testing.stubime;
import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService;
/** /**
* Dummy IME implementation that basically does nothing * Stub IME implementation that basically does nothing
*/ */
public class DummyIme extends InputMethodService { public class StubIme extends InputMethodService {
@Override @Override
public boolean onEvaluateFullscreenMode() { public boolean onEvaluateFullscreenMode() {