address use of DummyIME in UI Automator
See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Test: compile (code is not active in use) Change-Id: Ice71490ff09969f229943d6ef952a09f4e283d14
This commit is contained in:
@@ -49,7 +49,7 @@ public class UiAutomationShellWrapper {
|
||||
}
|
||||
try {
|
||||
if (isSet) {
|
||||
am.setActivityController(new DummyActivityController(), true);
|
||||
am.setActivityController(new NoOpActivityController(), true);
|
||||
} else {
|
||||
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
|
||||
public boolean activityStarting(Intent intent, String pkg) throws RemoteException {
|
||||
/* do nothing and let activity proceed normally */
|
||||
|
||||
@@ -45,7 +45,7 @@ import java.util.List;
|
||||
public class UiAutomatorTestCase extends TestCase {
|
||||
|
||||
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 UiDevice mUiDevice;
|
||||
@@ -58,7 +58,7 @@ public class UiAutomatorTestCase extends TestCase {
|
||||
super.setUp();
|
||||
mShouldDisableIme = "true".equals(mParams.getString(DISABLE_IME));
|
||||
if (mShouldDisableIme) {
|
||||
setDummyIme();
|
||||
setStubIme();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class UiAutomatorTestCase extends TestCase {
|
||||
SystemClock.sleep(ms);
|
||||
}
|
||||
|
||||
private void setDummyIme() {
|
||||
private void setStubIme() {
|
||||
Context context = ActivityThread.currentApplication();
|
||||
if (context == null) {
|
||||
throw new RuntimeException("ActivityThread.currentApplication() is null.");
|
||||
@@ -138,13 +138,13 @@ public class UiAutomatorTestCase extends TestCase {
|
||||
List<InputMethodInfo> infos = im.getInputMethodList();
|
||||
String id = null;
|
||||
for (InputMethodInfo info : infos) {
|
||||
if (DUMMY_IME_PACKAGE.equals(info.getComponent().getPackageName())) {
|
||||
if (STUB_IME_PACKAGE.equals(info.getComponent().getPackageName())) {
|
||||
id = info.getId();
|
||||
}
|
||||
}
|
||||
if (id == null) {
|
||||
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)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//
|
||||
|
||||
android_test {
|
||||
name: "DummyIME",
|
||||
name: "StubIME",
|
||||
srcs: ["src/**/*.java"],
|
||||
sdk_version: "current",
|
||||
}
|
||||
@@ -18,20 +18,20 @@
|
||||
-->
|
||||
|
||||
<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">
|
||||
<service android:name="DummyIme"
|
||||
android:permission="android.permission.BIND_INPUT_METHOD"
|
||||
android:exported="true">
|
||||
android:permission="android.permission.BIND_INPUT_METHOD"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.view.InputMethod"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.view.im"
|
||||
android:resource="@xml/method"/>
|
||||
android:resource="@xml/method"/>
|
||||
</service>
|
||||
<activity android:name=".ImePreferences"
|
||||
android:label="Dummy IME Settings"
|
||||
android:exported="true">
|
||||
android:label="Stub IME Settings"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
@@ -21,9 +21,9 @@
|
||||
<!-- for the Search Manager. -->
|
||||
|
||||
<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
|
||||
android:label="Generic"
|
||||
android:imeSubtypeLocale="en_US"
|
||||
android:imeSubtypeMode="keyboard" />
|
||||
</input-method>
|
||||
</input-method>
|
||||
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.testing.dummyime;
|
||||
package com.android.testing.stubime;
|
||||
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
/**
|
||||
* Dummy IME preference activity
|
||||
* Stub IME preference activity
|
||||
*/
|
||||
public class ImePreferences extends PreferenceActivity {
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.testing.dummyime;
|
||||
package com.android.testing.stubime;
|
||||
|
||||
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
|
||||
public boolean onEvaluateFullscreenMode() {
|
||||
Reference in New Issue
Block a user