Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81c782dd authored by Guang Zhu's avatar Guang Zhu Committed by Android (Google) Code Review
Browse files

Merge "address use of DummyIME in UI Automator"

parents 6b4cca5a 13871486
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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 */
+5 −5
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
//

android_test {
    name: "DummyIME",
    name: "StubIME",
    srcs: ["src/**/*.java"],
    sdk_version: "current",
}
+6 −6
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
-->

<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"
@@ -30,7 +30,7 @@
                android:resource="@xml/method"/>
        </service>
        <activity android:name=".ImePreferences"
             android:label="Dummy IME Settings"
            android:label="Stub IME Settings"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
<!-- 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"
Loading