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

Commit 54bac103 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "address use of DummyIME in UI Automator"

parents 262d80ba 6e634c03
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",
}
+4 −4
Original line number Diff line number Diff line
@@ -17,16 +17,16 @@
-->

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