Fix package names and delete duplicated java files in android.text

bug: 17399678
Change-Id: Ib49ec229f2cac6ff688729e806338bccc09c9397
diff --git a/tests/src/android/text/EmojiStubActivity.java b/tests/src/android/text/EmojiStubActivity.java
deleted file mode 100644
index 8d09250..0000000
--- a/tests/src/android/text/EmojiStubActivity.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.cts;
-
-import com.android.cts.stub.R;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.webkit.WebView;
-import android.webkit.cts.NullWebViewUtils;
-
-public class EmojiStubActivity extends Activity {
-    private WebView mWebView;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        try {
-            super.onCreate(savedInstanceState);
-            setContentView(R.layout.webview_layout);
-            mWebView = (WebView) findViewById(R.id.web_page);
-        } catch (Exception e) {
-            NullWebViewUtils.determineIfWebViewAvailable(this, e);
-        }
-    }
-
-    public WebView getWebView() {
-        return mWebView;
-    }
-
-    @Override
-    public void onDestroy() {
-        if (mWebView != null) {
-            mWebView.destroy();
-        }
-        super.onDestroy();
-    }
-}
diff --git a/tests/src/android/text/format/cts/LocaleUtils.java b/tests/src/android/text/format/cts/LocaleUtils.java
deleted file mode 100644
index 131d745..0000000
--- a/tests/src/android/text/format/cts/LocaleUtils.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.format.cts;
-
-import android.content.Context;
-
-import java.util.Locale;
-
-public class LocaleUtils {
-
-    /** Return whether or not the given locale is the device's current locale. */
-    public static boolean isCurrentLocale(Context context, Locale locale) {
-        // TODO: Change the locale on the device using public API if it becomes available.
-        Locale currentLocale = context.getResources().getConfiguration().locale;
-        return locale.equals(currentLocale);
-    }
-}
diff --git a/tests/src/android/text/method/cts/KeyListenerStubActivity.java b/tests/src/android/text/method/cts/KeyListenerStubActivity.java
deleted file mode 100644
index 149ad87..0000000
--- a/tests/src/android/text/method/cts/KeyListenerStubActivity.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.method.cts;
-
-import com.android.cts.stub.R;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.text.method.BaseKeyListener;
-import android.text.method.DateKeyListener;
-import android.text.method.DateTimeKeyListener;
-import android.text.method.DigitsKeyListener;
-import android.text.method.MultiTapKeyListener;
-import android.text.method.NumberKeyListener;
-import android.text.method.QwertyKeyListener;
-import android.text.method.TextKeyListener;
-import android.text.method.TimeKeyListener;
-import android.util.Log;
-
-/**
- * This Activity is used for testing:
- * {@link DigitsKeyListener}
- * {@link BaseKeyListener}
- * {@link MultiTapKeyListener}
- * {@link NumberKeyListener}
- * {@link QwertyKeyListener}
- * {@link TextKeyListener}
- * {@link DateKeyListener}
- * {@link DateTimeKeyListener}
- * {@link TimeKeyListener}
- *
- * @see DigitsKeyListener
- * @see BaseKeyListener
- * @see MultiTapKeyListener
- * @see NumberKeyListener
- * @see QwertyKeyListener
- * @see TextKeyListener
- * @see DateKeyListener
- * @see DateTimeKeyListener
- * @see TimeKeyListener
- */
-
-public class KeyListenerStubActivity extends Activity {
-    private boolean mHasWindowFocus = false;
-    private Object mHasWindowFocusLock = new Object();
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.keylistener_layout);
-    }
-
-    @Override
-    public void onWindowFocusChanged(boolean hasFocus) {
-        super.onWindowFocusChanged(hasFocus);
-        if (!hasFocus) {
-            Log.w("KeyListenerStubActivity", "KeyListenerStubActivity lost window focus");
-        }
-        synchronized(mHasWindowFocusLock) {
-            mHasWindowFocus = hasFocus;
-            mHasWindowFocusLock.notify();
-        }
-    }
-
-    /**
-     * Blocks the calling thread until the {@link KeyListenerStubActivity} has window focus or the
-     * specified duration (in milliseconds) has passed.
-     */
-    public boolean waitForWindowFocus(long durationMillis) {
-        long elapsedMillis = SystemClock.elapsedRealtime();
-        synchronized(mHasWindowFocusLock) {
-            mHasWindowFocus = hasWindowFocus();
-            while (!mHasWindowFocus && durationMillis > 0) {
-                long newElapsedMillis = SystemClock.elapsedRealtime();
-                durationMillis -= (newElapsedMillis - elapsedMillis);
-                elapsedMillis = newElapsedMillis;
-                if (durationMillis > 0) {
-                    try {
-                        mHasWindowFocusLock.wait(durationMillis);
-                    } catch (InterruptedException e) {
-                    }
-                }
-            }
-            return mHasWindowFocus;
-        }
-    }
-}
diff --git a/tests/src/android/text/method/cts/StubActivity.java b/tests/src/android/text/method/cts/StubActivity.java
deleted file mode 100644
index f3dad52..0000000
--- a/tests/src/android/text/method/cts/StubActivity.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.method.cts;
-
-import android.app.Activity;
-import android.text.method.ArrowKeyMovementMethod;
-import android.text.method.LinkMovementMethod;
-import android.text.method.ScrollingMovementMethod;
-
-/**
- * This Activity is used for testing:
- * {@link LinkMovementMethod}
- * {@link ArrowKeyMovementMethod}
- * {@link ScrollingMovementMethod}
- *
- * The content view will be set in the test cases.
- *
- * @see LinkMovementMethodTest
- * @see ArrowKeyMovementMethodTest
- * @see ScrollingMovementMethodTest
- */
-public class StubActivity extends Activity {
-}
diff --git a/tests/src/android/text/method/cts/TextMethodUtils.java b/tests/src/android/text/method/cts/TextMethodUtils.java
deleted file mode 100644
index 0785cff..0000000
--- a/tests/src/android/text/method/cts/TextMethodUtils.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.method.cts;
-
-import android.view.KeyEvent;
-
-import junit.framework.Assert;
-
-public class TextMethodUtils {
-    /**
-     * Assert that two char arrays are equal.
-     *
-     * @param expected the expected char array.
-     * @param actual the actual char array.
-     */
-    public static void assertEquals(char[] expected, char[] actual) {
-        if (expected != actual) {
-            if (expected == null || actual == null) {
-                Assert.fail("the char arrays are not equal");
-            }
-
-            Assert.assertEquals(String.valueOf(expected), String.valueOf(actual));
-        }
-    }
-
-    /**
-     * Get an unaccepted key code.
-     *
-     * @param acceptedChars accepted chars array.
-     * @return return key code if we find unaccepted one, or return -1.
-     */
-    public static int getUnacceptedKeyCode(char[] acceptedChars) {
-        for (int keyCode = KeyEvent.KEYCODE_A; keyCode <= KeyEvent.KEYCODE_Z; keyCode++) {
-            KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode);
-            if ('\0' == event.getMatch(acceptedChars)) {
-                return keyCode;
-            }
-        }
-        return -1;
-    }
-}
diff --git a/tests/src/android/text/style/cts/MockURLSpanTestActivity.java b/tests/src/android/text/style/cts/MockURLSpanTestActivity.java
deleted file mode 100644
index 1edb3e0..0000000
--- a/tests/src/android/text/style/cts/MockURLSpanTestActivity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.style.cts;
-
-import com.android.cts.stub.R;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-/**
- * A Mock application for {@link URLSpan} test.
- */
-public class MockURLSpanTestActivity extends Activity {
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.urlspan_layout);
-    }
-}
diff --git a/tests/src/android/text/style/cts/URLSpanStubActivity.java b/tests/src/android/text/style/cts/URLSpanStubActivity.java
deleted file mode 100644
index a09a83e..0000000
--- a/tests/src/android/text/style/cts/URLSpanStubActivity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.style.cts;
-
-import com.android.cts.stub.R;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-/**
- * A minimal application for {@link URLSpan} test.
- */
-public class URLSpanStubActivity extends Activity {
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.urlspan_layout);
-    }
-}
diff --git a/tests/tests/text/AndroidManifest.xml b/tests/tests/text/AndroidManifest.xml
index 0b31354..f247f82 100644
--- a/tests/tests/text/AndroidManifest.xml
+++ b/tests/tests/text/AndroidManifest.xml
@@ -20,9 +20,8 @@
 
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
     <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-    <application>
-        <uses-library android:name="android.test.runner"
-            android:maxRecents="1"/>
+    <application android:maxRecents="1">
+        <uses-library android:name="android.test.runner" />
 
         <activity android:name="android.text.cts.EmojiCtsActivity"
             android:label="AvailableIntentsActivity">
diff --git a/tests/tests/text/src/android/text/cts/EmojiTest.java b/tests/tests/text/src/android/text/cts/EmojiTest.java
index 5e2ca93..cba1442d 100644
--- a/tests/tests/text/src/android/text/cts/EmojiTest.java
+++ b/tests/tests/text/src/android/text/cts/EmojiTest.java
@@ -31,7 +31,7 @@
 public class EmojiTest extends ActivityInstrumentationTestCase2<EmojiCtsActivity> {
 
     public EmojiTest() {
-        super("com.android.cts.stub", EmojiCtsActivity.class);
+        super("com.android.cts.text", EmojiCtsActivity.class);
     }
 
     protected void setUp() throws Exception {
diff --git a/tests/tests/text/src/android/text/cts/MyanmarTest.java b/tests/tests/text/src/android/text/cts/MyanmarTest.java
index 60fe608..d59f2b9 100644
--- a/tests/tests/text/src/android/text/cts/MyanmarTest.java
+++ b/tests/tests/text/src/android/text/cts/MyanmarTest.java
@@ -25,7 +25,7 @@
 public class MyanmarTest extends ActivityInstrumentationTestCase2<Activity> {
 
     public MyanmarTest() {
-        super("com.android.cts.stub", Activity.class);
+        super("com.android.cts.text", Activity.class);
     }
 
     protected void setUp() throws Exception {
diff --git a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
index 74fab00..10d08d0 100644
--- a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
@@ -56,7 +56,7 @@
     private MyMetaKeyKeyListener mMetaListener;
 
     public ArrowKeyMovementMethodTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java b/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
index 3c20988..037d60b 100644
--- a/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
+++ b/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
@@ -34,7 +34,7 @@
     private Activity mActivity;
 
     public CharacterPickerDialogTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
index a5a76af..8bb2adf 100644
--- a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
+++ b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
@@ -53,7 +53,7 @@
     protected TextView mTextView;
 
     public KeyListenerTestCase() {
-        super("com.android.cts.stub", KeyListenerCtsActivity.class);
+        super("com.android.cts.text", KeyListenerCtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
index 8027d49..336921a 100644
--- a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
@@ -56,7 +56,7 @@
     private MockClickableSpan mClickable1;
 
     public LinkMovementMethodTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
index 66e4fc8..4262a31 100644
--- a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
@@ -58,7 +58,7 @@
     private CharSequence mTransformedText;
 
     public PasswordTransformationMethodTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
index 7dabd16..dadce15 100644
--- a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
@@ -37,7 +37,7 @@
     private EditText mEditText;
 
     public ReplacementTransformationMethodTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
index f9a7d0d..c186cde 100644
--- a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
@@ -55,7 +55,7 @@
     private int mScaledTouchSlop;
 
     public ScrollingMovementMethodTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
index 89f1026..460ce3d 100644
--- a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
@@ -28,7 +28,7 @@
 public class SingleLineTransformationMethodTest
         extends ActivityInstrumentationTestCase2<CtsActivity> {
     public SingleLineTransformationMethodTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     public void testConstructor() {
diff --git a/tests/tests/text/src/android/text/method/cts/TouchTest.java b/tests/tests/text/src/android/text/method/cts/TouchTest.java
index 2d3d146..343847e 100644
--- a/tests/tests/text/src/android/text/method/cts/TouchTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TouchTest.java
@@ -43,7 +43,7 @@
     private boolean mReturnFromTouchEvent;
 
     public TouchTest() {
-        super("com.android.cts.stub", CtsActivity.class);
+        super("com.android.cts.text", CtsActivity.class);
     }
 
     @Override
diff --git a/tests/tests/text/src/android/text/style/cts/URLSpanTest.java b/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
index 832e48d..7cfe56e 100644
--- a/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
@@ -33,7 +33,7 @@
     private Activity mActivity;
 
     public URLSpanTest() {
-        super("com.android.cts.stub", URLSpanCtsActivity.class);
+        super("com.android.cts.text", URLSpanCtsActivity.class);
     }
 
     @Override