Integrate unsubmitted cupcake change 131145:
	CTS: add test cases for telephony.CellLocation, PhoneNumberUtils,
	PhoneNumberFormattingTextWatcher, NeighboringCellInfo, ServiceState and TelephonyManager
diff --git a/tests/tests/telephony/src/android/telephony/cts/CellLocationTest.java b/tests/tests/telephony/src/android/telephony/cts/CellLocationTest.java
new file mode 100644
index 0000000..9cf1fb6
--- /dev/null
+++ b/tests/tests/telephony/src/android/telephony/cts/CellLocationTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.telephony.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.content.Context;
+import android.os.Looper;
+import android.os.cts.TestThread;
+import android.telephony.CellLocation;
+import android.telephony.PhoneStateListener;
+import android.telephony.TelephonyManager;
+import android.telephony.gsm.GsmCellLocation;
+import android.test.AndroidTestCase;
+
+@TestTargetClass(CellLocation.class)
+public class CellLocationTest extends AndroidTestCase {
+    private boolean mOnCellLocationChangedCalled;
+    private final Object mLock = new Object();
+    private TelephonyManager mTelephonyManager;
+    private Looper mLooper;
+    private PhoneStateListener mListener;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mTelephonyManager =
+                (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (mLooper != null) {
+            mLooper.quit();
+        }
+        if (mListener != null) {
+            // unregister listener
+            mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_NONE);
+        }
+        super.tearDown();
+    }
+
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getEmpty",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "requestLocationUpdate",
+        args = {}
+      )
+    })
+    public void testCellLocation() throws Throwable {
+        CellLocation cl = CellLocation.getEmpty();
+        if (cl instanceof GsmCellLocation) {
+            GsmCellLocation gcl = (GsmCellLocation) cl;
+            assertNotNull(gcl);
+            assertEquals(-1, gcl.getCid());
+            assertEquals(-1, gcl.getLac());
+        }
+
+        TestThread t = new TestThread(new Runnable() {
+            public void run() {
+                Looper.prepare();
+
+                mLooper = Looper.myLooper();
+
+                mListener = new PhoneStateListener() {
+                    @Override
+                    public void onCellLocationChanged(CellLocation location) {
+                        synchronized (mLock) {
+                            mOnCellLocationChangedCalled = true;
+                            mLock.notify();
+                        }
+                    }
+                };
+                mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_CELL_LOCATION);
+
+                Looper.loop();
+            }
+        });
+
+        t.start();
+
+        CellLocation.requestLocationUpdate();
+        synchronized (mLock) {
+            while (!mOnCellLocationChangedCalled) {
+                mLock.wait();
+            }
+        }
+        Thread.sleep(1000);
+        assertTrue(mOnCellLocationChangedCalled);
+        t.checkException();
+    }
+}
diff --git a/tests/tests/telephony/src/android/telephony/cts/NeighboringCellInfoTest.java b/tests/tests/telephony/src/android/telephony/cts/NeighboringCellInfoTest.java
new file mode 100644
index 0000000..1851d54
--- /dev/null
+++ b/tests/tests/telephony/src/android/telephony/cts/NeighboringCellInfoTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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.telephony.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.os.Parcel;
+import android.telephony.NeighboringCellInfo;
+import android.test.AndroidTestCase;
+
+@TestTargetClass(NeighboringCellInfo.class)
+public class NeighboringCellInfoTest extends AndroidTestCase{
+    private static final int RSSI = 20;
+    private static final int CID = 0x0000ffff;
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "NeighboringCellInfo",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "NeighboringCellInfo",
+            args = {int.class, int.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "NeighboringCellInfo",
+            args = {Parcel.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "getRssi",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "getCid",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "setRssi",
+            args = {int.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "setCid",
+            args = {int.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "describeContents",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "toString",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "writeToParcel",
+            args = {Parcel.class, int.class}
+        )
+    })
+    public void testNeighboringCellInfo() {
+        Parcel p = Parcel.obtain();
+        Integer[] val = { RSSI, CID };
+        p.writeArray(val);
+        new NeighboringCellInfo(p);
+        NeighboringCellInfo info = new NeighboringCellInfo(RSSI, CID);
+        assertEquals(RSSI, info.getRssi());
+        assertEquals(CID, info.getCid());
+
+        info = new NeighboringCellInfo();
+        assertEquals(NeighboringCellInfo.UNKNOWN_RSSI, info.getRssi());
+        assertEquals(NeighboringCellInfo.UNKNOWN_CID, info.getCid());
+        info.setRssi(RSSI);
+        info.setCid(CID);
+        assertEquals(RSSI, info.getRssi());
+        assertEquals(CID, info.getCid());
+
+        assertEquals(0, info.describeContents());
+        assertNotNull(info.toString());
+
+        p = Parcel.obtain();
+        info.writeToParcel(p, 0);
+        p.setDataPosition(0);
+        NeighboringCellInfo target = NeighboringCellInfo.CREATOR.createFromParcel(p);
+        assertEquals(info.getRssi(), target.getRssi());
+        assertEquals(info.getCid(), target.getCid());
+    }
+}
diff --git a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberFormattingTextWatcherTest.java b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberFormattingTextWatcherTest.java
new file mode 100644
index 0000000..b96dcd9
--- /dev/null
+++ b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberFormattingTextWatcherTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.telephony.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.telephony.PhoneNumberFormattingTextWatcher;
+import android.test.AndroidTestCase;
+import android.text.Editable;
+import android.widget.TextView;
+
+@TestTargetClass(PhoneNumberFormattingTextWatcher.class)
+public class PhoneNumberFormattingTextWatcherTest extends AndroidTestCase {
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "PhoneNumberFormattingTextWatcher",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.SUFFICIENT,
+            method = "beforeTextChanged",
+            args = {java.lang.CharSequence.class, int.class, int.class, int.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.SUFFICIENT,
+            method = "afterTextChanged",
+            args = {android.text.Editable.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.SUFFICIENT,
+            method = "onTextChanged",
+            args = {java.lang.CharSequence.class, int.class, int.class, int.class}
+        )
+    })
+    public void testPhoneNumberFormattingTextWatcher() {
+        TextView text = new TextView(getContext());
+        text.addTextChangedListener(new PhoneNumberFormattingTextWatcher());
+
+        text.setText("+15551212");
+        assertEquals("+1-555-1212", text.getText().toString());
+
+        // delete first dash and first 5
+        Editable edit = (Editable) text.getText();
+        edit.delete(2, 3);
+        assertEquals("+1-551-212", text.getText().toString());
+
+        // already formatted correctly
+        text.setText("+1-555-1212");
+        assertEquals("+1-555-1212", text.getText().toString());
+    }
+}
diff --git a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
new file mode 100644
index 0000000..37bb211
--- /dev/null
+++ b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
@@ -0,0 +1,487 @@
+/*
+ * 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.telephony.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.RemoteException;
+import android.provider.Contacts;
+import android.provider.Contacts.People;
+import android.telephony.PhoneNumberUtils;
+import android.telephony.TelephonyManager;
+import android.test.AndroidTestCase;
+import android.text.Editable;
+import android.text.SpannableStringBuilder;
+
+import java.util.Locale;
+
+@TestTargetClass(PhoneNumberUtils.class)
+public class PhoneNumberUtilsTest extends AndroidTestCase {
+    // mPhoneNumber ~ "+17005550020", length == 7.
+    private byte[] mPhoneNumber = { (byte) 0x91, (byte) 0x71, (byte) 0x00, (byte) 0x55,
+            (byte) 0x05, (byte) 0x20, (byte) 0xF0 };
+
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "extractNetworkPortion",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "extractPostDialPortion",
+        args = {String.class}
+      )
+    })
+    public void testExtractMethods() {
+
+        // Test extractNetworkPortion
+        assertNull(PhoneNumberUtils.extractNetworkPortion(null));
+        assertEquals("+17005554141", PhoneNumberUtils.extractNetworkPortion("+17005554141"));
+        assertEquals("+17005554141*#N",
+                PhoneNumberUtils.extractNetworkPortion("+1 (700).555-4141*#N"));
+        assertEquals("170055541", PhoneNumberUtils.extractNetworkPortion("1 (700).555-41,1234"));
+        assertEquals("**21**17005554141#",
+                PhoneNumberUtils.extractNetworkPortion("**21**+17005554141#"));
+
+        // Test extractPostDialPortion
+        assertNull(PhoneNumberUtils.extractPostDialPortion(null));
+        assertEquals("", PhoneNumberUtils.extractPostDialPortion("+17005554141"));
+        assertEquals(",1234", PhoneNumberUtils.extractPostDialPortion("+1 (700).555-41NN,1234"));
+        assertEquals(";1234", PhoneNumberUtils.extractPostDialPortion("+1 (700).555-41NN;1234"));
+        assertEquals(";1234,;N", PhoneNumberUtils
+                .extractPostDialPortion("+1 (700).555-41NN;1-2.34 ,;N"));
+    }
+
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "calledPartyBCDToString",
+        args = {byte[].class, int.class, int.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "toCallerIDMinMatch",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "networkPortionToCalledPartyBCD",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "calledPartyBCDFragmentToString",
+        args = {byte[].class, int.class, int.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "networkPortionToCalledPartyBCDWithLength",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "numberToCalledPartyBCD",
+        args = {String.class}
+      )
+    })
+    public void testCallMethods() {
+        // Test calledPartyBCDToString
+        assertEquals("+17005550020", PhoneNumberUtils.calledPartyBCDToString(mPhoneNumber, 0, 7));
+
+        // Test toCallerIDMinMatch
+        assertNull(PhoneNumberUtils.toCallerIDMinMatch(null));
+        assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("17005554141"));
+        assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141"));
+        assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141,1234"));
+        assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141;1234"));
+        assertEquals("NN145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-41NN"));
+        assertEquals("", PhoneNumberUtils.toCallerIDMinMatch(""));
+        assertEquals("0032", PhoneNumberUtils.toCallerIDMinMatch("2300"));
+        assertEquals("0032+", PhoneNumberUtils.toCallerIDMinMatch("+2300"));
+        assertEquals("#130#", PhoneNumberUtils.toCallerIDMinMatch("*#031#"));
+
+        // Test networkPortionToCalledPartyBCD, calledPartyBCDToString
+        byte[] bRet = PhoneNumberUtils.networkPortionToCalledPartyBCD("+17005550020");
+        assertEquals(mPhoneNumber.length, bRet.length);
+        for (int i = 0; i < mPhoneNumber.length; i++) {
+            assertEquals(mPhoneNumber[i], bRet[i]);
+        }
+        bRet = PhoneNumberUtils.networkPortionToCalledPartyBCD("7005550020");
+        assertEquals("7005550020", PhoneNumberUtils.calledPartyBCDToString(bRet, 0, bRet.length));
+
+        // Test calledPartyBCDFragmentToString
+        assertEquals("1917005550020", PhoneNumberUtils.calledPartyBCDFragmentToString(mPhoneNumber,
+                0, 7));
+
+        // Test networkPortionToCalledPartyBCDWithLength
+        bRet = PhoneNumberUtils.networkPortionToCalledPartyBCDWithLength("+17005550020");
+        assertEquals(mPhoneNumber.length + 1, bRet.length);
+        for (int i = 0; i < mPhoneNumber.length; i++) {
+            assertEquals(mPhoneNumber[i], bRet[i + 1]);
+        }
+
+        // Test numberToCalledPartyBCD
+        bRet = PhoneNumberUtils.numberToCalledPartyBCD("+17005550020");
+        assertEquals(mPhoneNumber.length, bRet.length);
+        for (int i = 0; i < mPhoneNumber.length; i++) {
+            assertEquals(mPhoneNumber[i], bRet[i]);
+        }
+    }
+
+    @TestTargetNew(
+      level = TestLevel.COMPLETE,
+      method = "compare",
+      args = {String.class, String.class}
+    )
+    public void testCompare() {
+        assertFalse(PhoneNumberUtils.compare("", ""));
+
+        assertTrue(PhoneNumberUtils.compare("911", "911"));
+        assertFalse(PhoneNumberUtils.compare("911", "18005550911"));
+
+        assertTrue(PhoneNumberUtils.compare("+17005554141", "+17005554141"));
+        assertTrue(PhoneNumberUtils.compare("+17005554141", "+1 (700).555-4141"));
+        assertTrue(PhoneNumberUtils.compare("+17005554141", "7005554141"));
+        assertTrue(PhoneNumberUtils.compare("17005554141", "5554141"));
+        assertTrue(PhoneNumberUtils.compare("+17005554141", "0017005554141"));
+        assertTrue(PhoneNumberUtils.compare("+17005554141", "**31#+17005554141"));
+        assertFalse(PhoneNumberUtils.compare("+1 999 7005554141", "+1 7005554141"));
+        assertTrue(PhoneNumberUtils.compare("011 1 7005554141", "7005554141"));
+        assertFalse(PhoneNumberUtils.compare("011 11 7005554141", "+17005554141"));
+        assertTrue(PhoneNumberUtils.compare("+44 207 792 3490", "0 207 792 3490"));
+        assertFalse(PhoneNumberUtils.compare("+44 207 792 3490", "00 207 792 3490"));
+
+        // MMI header should be ignored
+        assertFalse(PhoneNumberUtils.compare("+17005554141", "**31#17005554141"));
+        assertFalse(PhoneNumberUtils.compare("+44 207 792 3490", "+44 (0) 207 792 3490"));
+        assertFalse(PhoneNumberUtils.compare("+44 207 792 3490", "010 44 207 792 3490"));
+        assertFalse(PhoneNumberUtils.compare("+44 207 792 3490", "0011 44 207 792 3490"));
+        assertFalse(PhoneNumberUtils.compare("+7(095)9100766", "8(095)9100766"));
+        assertTrue(PhoneNumberUtils.compare("+444 207 792 3490", "0 207 792 3490"));
+    }
+
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getStrippedReversed",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getFormatTypeForLocale",
+        args = {Locale.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.PARTIAL,
+        notes = "partial, null branch is ok, non-null has a insert fail",
+        method = "getNumberFromIntent",
+        args = {Intent.class, Context.class}
+      )
+    })
+    public void testGetMethods() throws RemoteException {
+        // Test getStrippedReversed
+        assertNull(PhoneNumberUtils.getStrippedReversed(null));
+        assertEquals("14145550071", PhoneNumberUtils.getStrippedReversed("1-700-555-4141"));
+        assertEquals("14145550071", PhoneNumberUtils.getStrippedReversed("1-700-555-4141,1234"));
+        assertEquals("14145550071", PhoneNumberUtils.getStrippedReversed("1-700-555-4141;1234"));
+        assertEquals("NN145550071", PhoneNumberUtils.getStrippedReversed("1-700-555-41NN"));
+        assertEquals("", PhoneNumberUtils.getStrippedReversed(""));
+        assertEquals("#130#*+", PhoneNumberUtils.getStrippedReversed("+*#031#"));
+
+        // Test getFormatTypeForLocale
+        int formatType = PhoneNumberUtils.getFormatTypeForLocale(Locale.CHINA);
+        assertEquals(PhoneNumberUtils.FORMAT_UNKNOWN, formatType);
+        formatType = PhoneNumberUtils.getFormatTypeForLocale(Locale.US);
+        assertEquals(PhoneNumberUtils.FORMAT_NANP, formatType);
+        formatType = PhoneNumberUtils.getFormatTypeForLocale(Locale.JAPAN);
+        assertEquals(PhoneNumberUtils.FORMAT_JAPAN, formatType);
+
+        // Test getNumberFromIntent, query nothing, return null.
+        Intent intent = new Intent();
+        intent.setData(Contacts.People.CONTENT_URI);
+        Context context = getContext();
+        assertNull(PhoneNumberUtils.getNumberFromIntent(intent, context));
+
+        intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+18005555555"));
+        assertEquals("+18005555555", PhoneNumberUtils.getNumberFromIntent(intent, getContext()));
+
+        intent = new Intent(Intent.ACTION_DIAL, Uri.parse("voicemail:"));
+        TelephonyManager tm =
+                (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
+        assertEquals(tm.getVoiceMailNumber(),
+                PhoneNumberUtils.getNumberFromIntent(intent, getContext()));
+
+        ContentResolver cr = getContext().getContentResolver();
+        Uri personRecord = null;
+        Uri phoneRecord = null;
+        try {
+            // insert a contact with phone number
+            ContentValues values = new ContentValues();
+            values.put(People.NAME, "CTS test contact");
+            personRecord = cr.insert(People.CONTENT_URI, values);
+            Uri phoneUri = Uri.withAppendedPath(personRecord, People.Phones.CONTENT_DIRECTORY);
+            values.clear();
+            values.put(People.Phones.TYPE, People.Phones.TYPE_HOME);
+            values.put(People.Phones.NUMBER, "+18005552871");
+            phoneRecord = cr.insert(phoneUri, values);
+
+            intent = new Intent(Intent.ACTION_DIAL, phoneRecord);
+            assertEquals("+18005552871",
+                    PhoneNumberUtils.getNumberFromIntent(intent, getContext()));
+        } finally {
+            if (personRecord != null) {
+                cr.delete(personRecord, null, null);
+            }
+            if (phoneRecord != null) {
+                cr.delete(phoneRecord, null, null);
+            }
+        }
+    }
+
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "formatNanpNumber",
+        args = {Editable.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "convertKeypadLettersToDigits",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "stringFromStringAndTOA",
+        args = {String.class, int.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "formatJapaneseNumber",
+        args = {Editable.class}
+       ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "formatNumber",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "formatNumber",
+        args = {Editable.class, int.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "stripSeparators",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "toaFromString",
+        args = {String.class}
+      )
+    })
+    public void testFormatMethods() {
+        // Test formatNanpNumber
+        SpannableStringBuilder builderNumber = new SpannableStringBuilder();
+        builderNumber.append("8005551212");
+        PhoneNumberUtils.formatNanpNumber(builderNumber);
+        assertEquals("800-555-1212", builderNumber.toString());
+        builderNumber.clear();
+        builderNumber.append("800555121");
+        PhoneNumberUtils.formatNanpNumber(builderNumber);
+        assertEquals("800-555-121", builderNumber.toString());
+        builderNumber.clear();
+        builderNumber.append("555-1212");
+        PhoneNumberUtils.formatNanpNumber(builderNumber);
+        assertEquals("555-1212", builderNumber.toString());
+        builderNumber.clear();
+        builderNumber.append("180055512");
+        PhoneNumberUtils.formatNanpNumber(builderNumber);
+        assertEquals("1-800-555-12", builderNumber.toString());
+        builderNumber.clear();
+        builderNumber.append("+180055512");
+        PhoneNumberUtils.formatNanpNumber(builderNumber);
+        assertEquals("+1-800-555-12", builderNumber.toString());
+
+        // Test convertKeypadLettersToDigits
+        assertEquals("1-800-4664-411", PhoneNumberUtils
+                .convertKeypadLettersToDigits("1-800-GOOG-411"));
+        assertEquals("1-800-466-4411", PhoneNumberUtils
+                .convertKeypadLettersToDigits("1-800-466-4411"));
+        assertEquals("222-333-444-555-666-7777-888-9999", PhoneNumberUtils
+                .convertKeypadLettersToDigits("ABC-DEF-GHI-JKL-MNO-PQRS-TUV-WXYZ"));
+        assertEquals("222-333-444-555-666-7777-888-9999", PhoneNumberUtils
+                .convertKeypadLettersToDigits("abc-def-ghi-jkl-mno-pqrs-tuv-wxyz"));
+        assertEquals("(800) 222-3334", PhoneNumberUtils
+                .convertKeypadLettersToDigits("(800) ABC-DEFG"));
+
+        // Test stringFromStringAndTOA
+        assertNull(PhoneNumberUtils.stringFromStringAndTOA(null, 1));
+        assertEquals("+888888888", PhoneNumberUtils.stringFromStringAndTOA("888888888",
+                PhoneNumberUtils.TOA_International));
+
+        // Test formatJapaneseNumber
+        Editable jpEditNumber = Editable.Factory.getInstance().newEditable("0377777777");
+        PhoneNumberUtils.formatJapaneseNumber(jpEditNumber);
+        assertEquals("03-7777-7777", jpEditNumber.toString());
+        jpEditNumber = Editable.Factory.getInstance().newEditable("09077777777");
+        PhoneNumberUtils.formatJapaneseNumber(jpEditNumber);
+        assertEquals("090-7777-7777", jpEditNumber.toString());
+        jpEditNumber = Editable.Factory.getInstance().newEditable("0120777777");
+        PhoneNumberUtils.formatJapaneseNumber(jpEditNumber);
+        assertEquals("0120-777-777", jpEditNumber.toString());
+        jpEditNumber = Editable.Factory.getInstance().newEditable("+81377777777");
+        PhoneNumberUtils.formatJapaneseNumber(jpEditNumber);
+        assertEquals("+81-3-7777-7777", jpEditNumber.toString());
+        jpEditNumber = Editable.Factory.getInstance().newEditable("+819077777777");
+        PhoneNumberUtils.formatJapaneseNumber(jpEditNumber);
+        assertEquals("+81-90-7777-7777", jpEditNumber.toString());
+
+        // Test formatNumber(String). Only numbers begin with +1 or +81 can be formatted.
+        assertEquals("+1-888-888-888", PhoneNumberUtils.formatNumber("+1888888888"));
+        // Test formatNumber(Editable, int)
+        Editable editNumber = Editable.Factory.getInstance().newEditable("0377777777");
+        PhoneNumberUtils.formatNumber(editNumber, PhoneNumberUtils.FORMAT_UNKNOWN);
+        assertEquals("0377777777", editNumber.toString());
+        editNumber = Editable.Factory.getInstance().newEditable("+177777777");
+        PhoneNumberUtils.formatNumber(editNumber, PhoneNumberUtils.FORMAT_UNKNOWN);
+        assertEquals("+1-777-777-77", editNumber.toString());
+        editNumber = Editable.Factory.getInstance().newEditable("+8177777777");
+        PhoneNumberUtils.formatNumber(editNumber, PhoneNumberUtils.FORMAT_UNKNOWN);
+        assertEquals("+81-77-777-777", editNumber.toString());
+
+        // Test stripSeparators
+        assertEquals("+188888888", PhoneNumberUtils.stripSeparators("+188-888-888"));
+
+        // Test toaFromString
+        assertEquals(PhoneNumberUtils.TOA_International, PhoneNumberUtils
+                .toaFromString("+88888888"));
+        assertEquals(PhoneNumberUtils.TOA_Unknown, PhoneNumberUtils.toaFromString("88888888"));
+    }
+
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "is12Key",
+        args = {char.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isDialable",
+        args = {char.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isEmergencyNumber",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isGlobalPhoneNumber",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isISODigit",
+        args = {char.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isReallyDialable",
+        args = {char.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isStartsPostDial",
+        args = {char.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isWellFormedSmsAddress",
+        args = {String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isNonSeparator",
+        args = {char.class}
+      )
+    })
+    public void testJudgeMethods() {
+        // Test is12Key, isDialable, isISODigit, isReallyDialable, isStartsPostDial
+        for (char c = '0'; c <= '9'; c++) {
+            assertTrue(PhoneNumberUtils.is12Key(c));
+            assertTrue(PhoneNumberUtils.isDialable(c));
+            assertTrue(PhoneNumberUtils.isISODigit(c));
+            assertTrue(PhoneNumberUtils.isNonSeparator(c));
+            assertTrue(PhoneNumberUtils.isReallyDialable(c));
+        }
+        char c = '*';
+        assertTrue(PhoneNumberUtils.is12Key(c));
+        assertTrue(PhoneNumberUtils.isDialable(c));
+        assertTrue(PhoneNumberUtils.isNonSeparator(c));
+        assertTrue(PhoneNumberUtils.isReallyDialable(c));
+        c = '#';
+        assertTrue(PhoneNumberUtils.is12Key(c));
+        assertTrue(PhoneNumberUtils.isDialable(c));
+        assertTrue(PhoneNumberUtils.isNonSeparator(c));
+        assertTrue(PhoneNumberUtils.isReallyDialable(c));
+        c = '$';
+        assertFalse(PhoneNumberUtils.is12Key(c));
+        assertFalse(PhoneNumberUtils.isDialable(c));
+        assertFalse(PhoneNumberUtils.isDialable(c));
+        c = '+';
+        assertTrue(PhoneNumberUtils.isDialable(c));
+        assertFalse(PhoneNumberUtils.isISODigit(c));
+        assertTrue(PhoneNumberUtils.isNonSeparator(c));
+        assertTrue(PhoneNumberUtils.isReallyDialable(c));
+        c = PhoneNumberUtils.WILD;
+        assertTrue(PhoneNumberUtils.isDialable(c));
+        assertTrue(PhoneNumberUtils.isNonSeparator(c));
+        assertFalse(PhoneNumberUtils.isReallyDialable(c));
+        c = PhoneNumberUtils.WAIT;
+        assertTrue(PhoneNumberUtils.isNonSeparator(c));
+        assertTrue(PhoneNumberUtils.isStartsPostDial(c));
+        c = PhoneNumberUtils.PAUSE;
+        assertTrue(PhoneNumberUtils.isNonSeparator(c));
+        assertTrue(PhoneNumberUtils.isStartsPostDial(c));
+        c = '8';
+        assertFalse(PhoneNumberUtils.isStartsPostDial(c));
+
+        // Test isEmergencyNumber, now only know US emergency number
+        if (Locale.getDefault().getCountry().equals("US")) {
+            assertTrue(PhoneNumberUtils.isEmergencyNumber("911"));
+            assertTrue(PhoneNumberUtils.isEmergencyNumber("112"));
+            assertFalse(PhoneNumberUtils.isEmergencyNumber("119"));
+        }
+
+        // Test isGlobalPhoneNumber
+        assertTrue(PhoneNumberUtils.isGlobalPhoneNumber("+17005554141"));
+        assertFalse(PhoneNumberUtils.isGlobalPhoneNumber("android"));
+
+        // Test isWellFormedSmsAddress
+        assertTrue(PhoneNumberUtils.isWellFormedSmsAddress("+17005554141"));
+        assertFalse(PhoneNumberUtils.isWellFormedSmsAddress("android"));
+    }
+}
diff --git a/tests/tests/telephony/src/android/telephony/cts/ServiceStateTest.java b/tests/tests/telephony/src/android/telephony/cts/ServiceStateTest.java
new file mode 100644
index 0000000..56188fb
--- /dev/null
+++ b/tests/tests/telephony/src/android/telephony/cts/ServiceStateTest.java
@@ -0,0 +1,202 @@
+/*
+ * 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.telephony.cts;
+
+import android.os.Parcel;
+import android.telephony.ServiceState;
+import android.test.AndroidTestCase;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+@TestTargetClass(ServiceState.class)
+public class ServiceStateTest extends AndroidTestCase {
+    private static final String OPERATOR_ALPHA_LONG = "CtsOperatorLong";
+    private static final String OPERATOR_ALPHA_SHORT = "CtsOp";
+    private static final String OPERATOR_NUMERIC = "02871";
+
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "describeContents",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "equals",
+        args = {Object.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getIsManualSelection",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getOperatorAlphaLong",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getOperatorAlphaShort",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getOperatorNumeric",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getRoaming",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getState",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "hashCode",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "ServiceState",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "ServiceState",
+        args = {Parcel.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "ServiceState",
+        args = {ServiceState.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "copyFrom",
+        args = {ServiceState.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setIsManualSelection",
+        args = {boolean.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setOperatorName",
+        args = {String.class, String.class, String.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setRoaming",
+        args = {boolean.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setState",
+        args = {int.class}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setStateOff",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setStateOutOfService",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "toString",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "writeToParcel",
+        args = {Parcel.class, int.class}
+      )
+    })
+    public void testServiceState() {
+        ServiceState serviceState = new ServiceState();
+
+        assertEquals(0, serviceState.describeContents());
+
+        serviceState.setStateOff();
+        assertEquals(ServiceState.STATE_POWER_OFF, serviceState.getState());
+        checkOffStatus(serviceState);
+
+        serviceState.setStateOutOfService();
+        assertEquals(ServiceState.STATE_OUT_OF_SERVICE, serviceState.getState());
+        checkOffStatus(serviceState);
+
+        serviceState.setState(ServiceState.STATE_IN_SERVICE);
+        assertEquals(ServiceState.STATE_IN_SERVICE, serviceState.getState());
+
+        assertFalse(serviceState.getRoaming());
+        serviceState.setRoaming(true);
+        assertTrue(serviceState.getRoaming());
+
+        assertFalse(serviceState.getIsManualSelection());
+        serviceState.setIsManualSelection(true);
+        assertTrue(serviceState.getIsManualSelection());
+
+        serviceState.setOperatorName(OPERATOR_ALPHA_LONG, OPERATOR_ALPHA_SHORT, OPERATOR_NUMERIC);
+        assertEquals(OPERATOR_ALPHA_LONG, serviceState.getOperatorAlphaLong());
+        assertEquals(OPERATOR_ALPHA_SHORT, serviceState.getOperatorAlphaShort());
+        assertEquals(OPERATOR_NUMERIC, serviceState.getOperatorNumeric());
+
+        assertTrue(serviceState.hashCode() > 0);
+        assertNotNull(serviceState.toString());
+
+        ServiceState tempServiceState = new ServiceState(serviceState);
+        assertTrue(tempServiceState.equals(serviceState));
+
+        Parcel stateParcel = Parcel.obtain();
+        serviceState.writeToParcel(stateParcel, 0);
+        stateParcel.setDataPosition(0);
+        tempServiceState = new ServiceState(stateParcel);
+        assertTrue(tempServiceState.equals(serviceState));
+
+        MockServiceState mockServiceState = new MockServiceState();
+        mockServiceState.copyFrom(serviceState);
+        assertTrue(mockServiceState.equals(serviceState));
+    }
+
+    /**
+     * Check the ServiceState fields in STATE_OUT_OF_SERVICE or STATE_POWER_OFF
+     */
+    private void checkOffStatus(ServiceState s) {
+        assertFalse(s.getRoaming());
+        assertNull(s.getOperatorAlphaLong());
+        assertNull(s.getOperatorAlphaShort());
+        assertNull(s.getOperatorNumeric());
+        assertFalse(s.getIsManualSelection());
+    }
+
+    private class MockServiceState extends ServiceState {
+        @Override
+        protected void copyFrom(ServiceState s) {
+            super.copyFrom(s);
+        }
+    }
+}
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
new file mode 100644
index 0000000..d48ea95
--- /dev/null
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -0,0 +1,268 @@
+/*
+ * 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.telephony.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.content.Context;
+import android.os.Looper;
+import android.os.cts.TestThread;
+import android.telephony.CellLocation;
+import android.telephony.PhoneStateListener;
+import android.telephony.TelephonyManager;
+import android.test.AndroidTestCase;
+
+@TestTargetClass(TelephonyManager.class)
+public class TelephonyManagerTest extends AndroidTestCase {
+    private TelephonyManager mTelephonyManager;
+    private boolean mOnCellLocationChangedCalled = false;
+    private final Object mLock = new Object();
+    private static final int TOLERANCE = 1000;
+    private Looper mLooper;
+    private PhoneStateListener mListener;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mTelephonyManager =
+            (TelephonyManager)getContext().getSystemService(Context.TELEPHONY_SERVICE);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (mListener != null) {
+            // unregister the listener
+            mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_NONE);
+        }
+        super.tearDown();
+    }
+
+    @TestTargetNew(
+      level = TestLevel.COMPLETE,
+      method = "listen",
+      args = {PhoneStateListener.class, int.class}
+    )
+    public void testListen() throws Throwable {
+
+        // Test register
+        TestThread t = new TestThread(new Runnable() {
+            public void run() {
+                Looper.prepare();
+
+                mLooper = Looper.myLooper();
+                mListener = new PhoneStateListener() {
+                    @Override
+                    public void onCellLocationChanged(CellLocation location) {
+                        synchronized (mLock) {
+                            mOnCellLocationChangedCalled = true;
+                            mLock.notify();
+                        }
+                    }
+                };
+                mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_CELL_LOCATION);
+
+                Looper.loop();
+            }
+        });
+        t.start();
+
+        CellLocation.requestLocationUpdate();
+        synchronized (mLock) {
+            while (!mOnCellLocationChangedCalled) {
+                mLock.wait();
+            }
+        }
+        mLooper.quit();
+        assertTrue(mOnCellLocationChangedCalled);
+
+        // Test unregister
+        t = new TestThread(new Runnable() {
+            public void run() {
+                Looper.prepare();
+
+                mLooper = Looper.myLooper();
+                // unregister the listener
+                mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_NONE);
+                mOnCellLocationChangedCalled = false;
+                // unregister again, to make sure doing so does not call the listener
+                mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_NONE);
+
+                Looper.loop();
+            }
+        });
+        t.start();
+
+        CellLocation.requestLocationUpdate();
+        synchronized (mLock) {
+            while (!mOnCellLocationChangedCalled) {
+                mLock.wait(TOLERANCE);
+                break;
+            }
+        }
+        mLooper.quit();
+        assertFalse(mOnCellLocationChangedCalled);
+    }
+
+    /**
+     * The getter methods here are all related to the information about the telephony.
+     * These getters are related to concrete location, phone, service provider company, so
+     * it's no need to get details of these information, just make sure they are in right
+     * condition(>0 or not null).
+     */
+    @TestTargets({
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getNetworkType",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getPhoneType",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getVoiceMailNumber",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getSimOperatorName",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getNetworkCountryIso",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getCellLocation",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getDeviceSoftwareVersion",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getSimState",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getSimSerialNumber",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getDeviceId",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getSimOperator",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getNetworkOperatorName",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getSubscriberId",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getLine1Number",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getNetworkOperator",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getSimCountryIso",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getDataActivity",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getDataState",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getCallState",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "isNetworkRoaming",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getVoiceMailAlphaTag",
+        args = {}
+      ),
+      @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getNeighboringCellInfo",
+        args = {}
+      )
+    })
+    public void testTelephonyManager() {
+        assertTrue(mTelephonyManager.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UNKNOWN);
+        assertTrue(mTelephonyManager.getPhoneType() >= TelephonyManager.PHONE_TYPE_NONE);
+        assertTrue(mTelephonyManager.getSimState() >= TelephonyManager.SIM_STATE_UNKNOWN);
+        assertTrue(mTelephonyManager.getDataActivity() >= TelephonyManager.DATA_ACTIVITY_NONE);
+        assertTrue(mTelephonyManager.getDataState() >= TelephonyManager.DATA_DISCONNECTED);
+        assertTrue(mTelephonyManager.getCallState() >= TelephonyManager.CALL_STATE_IDLE);
+
+        // The following methods may return null. Simply call them to make sure they do not
+        // throw any exceptions.
+        mTelephonyManager.getVoiceMailNumber();
+        mTelephonyManager.getSimOperatorName();
+        mTelephonyManager.getNetworkCountryIso();
+        mTelephonyManager.getCellLocation();
+        mTelephonyManager.getSimSerialNumber();
+        mTelephonyManager.getSimOperator();
+        mTelephonyManager.getNetworkOperatorName();
+        mTelephonyManager.getSubscriberId();
+        mTelephonyManager.getLine1Number();
+        mTelephonyManager.getNetworkOperator();
+        mTelephonyManager.getSimCountryIso();
+        mTelephonyManager.getVoiceMailAlphaTag();
+        mTelephonyManager.getNeighboringCellInfo();
+        mTelephonyManager.isNetworkRoaming();
+        mTelephonyManager.getDeviceId();
+        mTelephonyManager.getDeviceSoftwareVersion();
+    }
+}