am b9de4496: am 9b5a5a0f: am eb69ddd4: am c2e35f33: (-s ours) am 932e8e5d: (-s ours) Reconcile with jb-mr1-release - do not merge

* commit 'b9de449616f5f0ab8eb6e819bb581f9c353316f9':
diff --git a/Android.mk b/Android.mk
index 9c43ee3..eb359bc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -21,6 +21,7 @@
 	$(call all-Iaidl-files-under, src/java) \
 	$(call all-logtags-files-under, src/java)
 
+LOCAL_JAVA_LIBRARIES := voip-common
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := telephony-common
 
diff --git a/CleanSpec.mk b/CleanSpec.mk
index f4475ef..c5b95a1 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -41,6 +41,9 @@
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/mockril/Android.mk b/mockril/Android.mk
deleted file mode 100644
index 3778a58..0000000
--- a/mockril/Android.mk
+++ /dev/null
@@ -1,33 +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.
-#
-#
-ifneq ($(TARGET_BUILD_PDK),true)
-
-LOCAL_PATH:=$(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := core framework
-
-LOCAL_STATIC_JAVA_LIBRARIES := librilproto-java
-
-LOCAL_MODULE := mockrilcontroller
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-endif # !PDK
\ No newline at end of file
diff --git a/mockril/src/com/android/internal/telephony/mockril/MockRilController.java b/mockril/src/com/android/internal/telephony/mockril/MockRilController.java
deleted file mode 100644
index aef9fb5..0000000
--- a/mockril/src/com/android/internal/telephony/mockril/MockRilController.java
+++ /dev/null
@@ -1,217 +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 com.android.internal.telephony.mockril;
-
-import android.os.Bundle;
-import android.telephony.Rlog;
-
-import com.android.internal.communication.MsgHeader;
-import com.android.internal.communication.Msg;
-import com.android.internal.telephony.RilChannel;
-import com.android.internal.telephony.ril_proto.RilCtrlCmds;
-import com.android.internal.telephony.ril_proto.RilCmds;
-import com.google.protobuf.micro.MessageMicro;
-
-import java.io.IOException;
-
-/**
- * Contain a list of commands to control Mock RIL. Before using these commands the devices
- * needs to be set with Mock RIL. Refer to hardware/ril/mockril/README.txt for details.
- *
- */
-public class MockRilController {
-    private static final String TAG = "MockRILController";
-    private RilChannel mRilChannel = null;
-    private Msg mMessage = null;
-
-    public MockRilController() throws IOException {
-        mRilChannel = RilChannel.makeRilChannel();
-    }
-
-    /**
-     * Close the channel after the communication is done.
-     * This method has to be called after the test is finished.
-     */
-    public void closeChannel() {
-        mRilChannel.close();
-    }
-
-    /**
-     * Send commands and return true on success
-     * @param cmd for MsgHeader
-     * @param token for MsgHeader
-     * @param status for MsgHeader
-     * @param pbData for Msg data
-     * @return true if command is sent successfully, false if it fails
-     */
-    private boolean sendCtrlCommand(int cmd, long token, int status, MessageMicro pbData) {
-        try {
-            Msg.send(mRilChannel, cmd, token, status, pbData);
-        } catch (IOException e) {
-            Rlog.v(TAG, "send command : %d failed: " + e.getStackTrace());
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Get control response
-     * @return Msg if response is received, else return null.
-     */
-    private Msg getCtrlResponse() {
-        Msg response = null;
-        try {
-            response = Msg.recv(mRilChannel);
-        } catch (IOException e) {
-            Rlog.v(TAG, "receive response for getRadioState() error: " + e.getStackTrace());
-            return null;
-        }
-        return response;
-    }
-
-    /**
-     * @return the radio state if it is valid, otherwise return -1
-     */
-    public int getRadioState() {
-        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_GET_RADIO_STATE, 0, 0, null)) {
-            return -1;
-        }
-        Msg response = getCtrlResponse();
-        if (response == null) {
-            Rlog.v(TAG, "failed to get response");
-            return -1;
-        }
-        response.printHeader(TAG);
-        RilCtrlCmds.CtrlRspRadioState resp =
-            response.getDataAs(RilCtrlCmds.CtrlRspRadioState.class);
-        int state = resp.getState();
-        if ((state >= RilCmds.RADIOSTATE_OFF) && (state <= RilCmds.RADIOSTATE_NV_READY))
-            return state;
-        else
-            return -1;
-    }
-
-    /**
-     * Set the radio state of mock ril to the given state
-     * @param state for given radio state
-     * @return true if the state is set successful, false if it fails
-     */
-    public boolean setRadioState(int state) {
-        RilCtrlCmds.CtrlReqRadioState req = new RilCtrlCmds.CtrlReqRadioState();
-        if (state < 0 || state > RilCmds.RADIOSTATE_NV_READY) {
-            Rlog.v(TAG, "the give radio state is not valid.");
-            return false;
-        }
-        req.setState(state);
-        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_RADIO_STATE, 0, 0, req)) {
-            Rlog.v(TAG, "send set radio state request failed.");
-            return false;
-        }
-        Msg response = getCtrlResponse();
-        if (response == null) {
-            Rlog.v(TAG, "failed to get response for setRadioState");
-            return false;
-        }
-        response.printHeader(TAG);
-        RilCtrlCmds.CtrlRspRadioState resp =
-            response.getDataAs(RilCtrlCmds.CtrlRspRadioState.class);
-        int curstate = resp.getState();
-        return curstate == state;
-    }
-
-    /**
-     * Start an incoming call for the given phone number
-     *
-     * @param phoneNumber is the number to show as incoming call
-     * @return true if the incoming call is started successfully, false if it fails.
-     */
-    public boolean startIncomingCall(String phoneNumber) {
-        RilCtrlCmds.CtrlReqSetMTCall req = new RilCtrlCmds.CtrlReqSetMTCall();
-
-        req.setPhoneNumber(phoneNumber);
-        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_MT_CALL, 0, 0, req)) {
-            Rlog.v(TAG, "send CMD_SET_MT_CALL request failed");
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Hang up a connection remotelly for the given call fail cause
-     *
-     * @param connectionID is the connection to be hung up
-     * @param failCause is the call fail cause defined in ril.h
-     * @return true if the hangup is successful, false if it fails
-     */
-    public boolean hangupRemote(int connectionId, int failCause) {
-        RilCtrlCmds.CtrlHangupConnRemote req = new RilCtrlCmds.CtrlHangupConnRemote();
-        req.setConnectionId(connectionId);
-        req.setCallFailCause(failCause);
-
-        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_HANGUP_CONN_REMOTE, 0, 0, req)) {
-            Rlog.v(TAG, "send CTRL_CMD_HANGUP_CONN_REMOTE request failed");
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Set call transition flag to the Mock Ril
-     *
-     * @param flag is a boolean value for the call transiton flag
-     *             true: call transition: dialing->alert, alert->active is controlled
-     *             false: call transition is automatically handled by Mock Ril
-     * @return true if the request is successful, false if it failed to set the flag
-     */
-    public boolean setCallTransitionFlag(boolean flag) {
-        RilCtrlCmds.CtrlSetCallTransitionFlag req = new RilCtrlCmds.CtrlSetCallTransitionFlag();
-
-        req.setFlag(flag);
-
-        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_CALL_TRANSITION_FLAG, 0, 0, req)) {
-            Rlog.v(TAG, "send CTRL_CMD_SET_CALL_TRANSITION_FLAG request failed");
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Set the dialing call to alert if the call transition flag is true
-     *
-     * @return true if the call transition is successful, false if it fails
-     */
-    public boolean setDialCallToAlert() {
-        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_CALL_ALERT, 0, 0, null)) {
-            Rlog.v(TAG, "send CTRL_CMD_SET_CALL_ALERT request failed");
-            return false;
-        }
-        return true;
-   }
-
-   /**
-    * Set the alert call to active if the call transition flag is true
-    *
-    * @return true if the call transition is successful, false if it fails
-    */
-   public boolean setAlertCallToActive() {
-        if (!sendCtrlCommand(RilCtrlCmds.CTRL_CMD_SET_CALL_ACTIVE, 0, 0, null)) {
-            Rlog.v(TAG, "send CTRL_CMD_SET_CALL_ACTIVE request failed");
-            return false;
-        }
-        return true;
-   }
-}
diff --git a/src/java/android/provider/Telephony.java b/src/java/android/provider/Telephony.java
index 50f3203..7d312e9 100644
--- a/src/java/android/provider/Telephony.java
+++ b/src/java/android/provider/Telephony.java
@@ -25,7 +25,6 @@
 import android.database.Cursor;
 import android.database.sqlite.SqliteWrapper;
 import android.net.Uri;
-import android.os.Environment;
 import android.telephony.SmsMessage;
 import android.text.TextUtils;
 import android.telephony.Rlog;
@@ -44,8 +43,6 @@
  */
 public final class Telephony {
     private static final String TAG = "Telephony";
-    private static final boolean DEBUG = true;
-    private static final boolean LOCAL_LOGV = false;
 
     // Constructor
     public Telephony() {
@@ -1243,7 +1240,6 @@
      */
     public static final class Threads implements ThreadsColumns {
         private static final String[] ID_PROJECTION = { BaseColumns._ID };
-        private static final String STANDARD_ENCODING = "UTF-8";
         private static final Uri THREAD_ID_CONTENT_URI = Uri.parse(
                 "content://mms-sms/threadID");
         public static final Uri CONTENT_URI = Uri.withAppendedPath(
diff --git a/src/java/android/telephony/CellBroadcastMessage.java b/src/java/android/telephony/CellBroadcastMessage.java
index 36c238d..f745ba5 100644
--- a/src/java/android/telephony/CellBroadcastMessage.java
+++ b/src/java/android/telephony/CellBroadcastMessage.java
@@ -19,7 +19,6 @@
 import android.content.ContentValues;
 import android.content.Context;
 import android.database.Cursor;
-import android.graphics.Typeface;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.provider.Telephony;
@@ -27,10 +26,7 @@
 import android.telephony.SmsCbEtwsInfo;
 import android.telephony.SmsCbLocation;
 import android.telephony.SmsCbMessage;
-import android.text.Spannable;
-import android.text.SpannableStringBuilder;
 import android.text.format.DateUtils;
-import android.text.style.StyleSpan;
 
 /**
  * Application wrapper for {@link SmsCbMessage}. This is Parcelable so that
@@ -76,10 +72,12 @@
     }
 
     /** Parcelable: no special flags. */
+    @Override
     public int describeContents() {
         return 0;
     }
 
+    @Override
     public void writeToParcel(Parcel out, int flags) {
         mSmsCbMessage.writeToParcel(out, flags);
         out.writeLong(mDeliveryTime);
@@ -88,10 +86,12 @@
 
     public static final Parcelable.Creator<CellBroadcastMessage> CREATOR
             = new Parcelable.Creator<CellBroadcastMessage>() {
+        @Override
         public CellBroadcastMessage createFromParcel(Parcel in) {
             return new CellBroadcastMessage(in);
         }
 
+        @Override
         public CellBroadcastMessage[] newArray(int size) {
             return new CellBroadcastMessage[size];
         }
diff --git a/src/java/android/telephony/SmsCbCmasInfo.java b/src/java/android/telephony/SmsCbCmasInfo.java
index 7a89d94..c912924 100644
--- a/src/java/android/telephony/SmsCbCmasInfo.java
+++ b/src/java/android/telephony/SmsCbCmasInfo.java
@@ -297,10 +297,12 @@
     /** Creator for unparcelling objects. */
     public static final Parcelable.Creator<SmsCbCmasInfo>
             CREATOR = new Parcelable.Creator<SmsCbCmasInfo>() {
+        @Override
         public SmsCbCmasInfo createFromParcel(Parcel in) {
             return new SmsCbCmasInfo(in);
         }
 
+        @Override
         public SmsCbCmasInfo[] newArray(int size) {
             return new SmsCbCmasInfo[size];
         }
diff --git a/src/java/android/telephony/SmsCbEtwsInfo.java b/src/java/android/telephony/SmsCbEtwsInfo.java
index f208fbf..286efd6 100644
--- a/src/java/android/telephony/SmsCbEtwsInfo.java
+++ b/src/java/android/telephony/SmsCbEtwsInfo.java
@@ -163,7 +163,7 @@
         time.second = second;
 
         // Timezone offset is in quarter hours.
-        return time.toMillis(true) - (long) (timezoneOffset * 15 * 60 * 1000);
+        return time.toMillis(true) - timezoneOffset * 15 * 60 * 1000;
     }
 
     /**
@@ -195,10 +195,12 @@
 
     /** Creator for unparcelling objects. */
     public static final Creator<SmsCbEtwsInfo> CREATOR = new Creator<SmsCbEtwsInfo>() {
+        @Override
         public SmsCbEtwsInfo createFromParcel(Parcel in) {
             return new SmsCbEtwsInfo(in);
         }
 
+        @Override
         public SmsCbEtwsInfo[] newArray(int size) {
             return new SmsCbEtwsInfo[size];
         }
diff --git a/src/java/android/telephony/SmsCbLocation.java b/src/java/android/telephony/SmsCbLocation.java
index 7b5bd0d..6eb72a8 100644
--- a/src/java/android/telephony/SmsCbLocation.java
+++ b/src/java/android/telephony/SmsCbLocation.java
@@ -16,10 +16,8 @@
 
 package android.telephony;
 
-import android.os.Bundle;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.telephony.gsm.GsmCellLocation;
 
 /**
  * Represents the location and geographical scope of a cell broadcast message.
diff --git a/src/java/android/telephony/SmsManager.java b/src/java/android/telephony/SmsManager.java
index e782379..f3b4735 100644
--- a/src/java/android/telephony/SmsManager.java
+++ b/src/java/android/telephony/SmsManager.java
@@ -16,6 +16,7 @@
 
 package android.telephony;
 
+import android.app.ActivityThread;
 import android.app.PendingIntent;
 import android.os.RemoteException;
 import android.os.ServiceManager;
@@ -84,7 +85,8 @@
         try {
             ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
             if (iccISms != null) {
-                iccISms.sendText(destinationAddress, scAddress, text, sentIntent, deliveryIntent);
+                iccISms.sendText(ActivityThread.currentPackageName(), destinationAddress,
+                        scAddress, text, sentIntent, deliveryIntent);
             }
         } catch (RemoteException ex) {
             // ignore it
@@ -154,7 +156,8 @@
             try {
                 ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
                 if (iccISms != null) {
-                    iccISms.sendMultipartText(destinationAddress, scAddress, parts,
+                    iccISms.sendMultipartText(ActivityThread.currentPackageName(),
+                            destinationAddress, scAddress, parts,
                             sentIntents, deliveryIntents);
                 }
             } catch (RemoteException ex) {
@@ -215,7 +218,8 @@
         try {
             ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
             if (iccISms != null) {
-                iccISms.sendData(destinationAddress, scAddress, destinationPort & 0xFFFF,
+                iccISms.sendData(ActivityThread.currentPackageName(),
+                        destinationAddress, scAddress, destinationPort & 0xFFFF,
                         data, sentIntent, deliveryIntent);
             }
         } catch (RemoteException ex) {
@@ -259,7 +263,8 @@
         try {
             ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
             if (iccISms != null) {
-                success = iccISms.copyMessageToIccEf(status, pdu, smsc);
+                success = iccISms.copyMessageToIccEf(ActivityThread.currentPackageName(),
+                        status, pdu, smsc);
             }
         } catch (RemoteException ex) {
             // ignore it
@@ -287,7 +292,8 @@
         try {
             ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
             if (iccISms != null) {
-                success = iccISms.updateMessageOnIccEf(messageIndex, STATUS_ON_ICC_FREE, pdu);
+                success = iccISms.updateMessageOnIccEf(ActivityThread.currentPackageName(),
+                        messageIndex, STATUS_ON_ICC_FREE, pdu);
             }
         } catch (RemoteException ex) {
             // ignore it
@@ -316,7 +322,8 @@
         try {
             ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
             if (iccISms != null) {
-                success = iccISms.updateMessageOnIccEf(messageIndex, newStatus, pdu);
+                success = iccISms.updateMessageOnIccEf(ActivityThread.currentPackageName(),
+                        messageIndex, newStatus, pdu);
             }
         } catch (RemoteException ex) {
             // ignore it
@@ -340,7 +347,7 @@
         try {
             ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
             if (iccISms != null) {
-                records = iccISms.getAllMessagesFromIccEf();
+                records = iccISms.getAllMessagesFromIccEf(ActivityThread.currentPackageName());
             }
         } catch (RemoteException ex) {
             // ignore it
diff --git a/src/java/android/telephony/SmsMessage.java b/src/java/android/telephony/SmsMessage.java
index c35f09e..e83d175 100644
--- a/src/java/android/telephony/SmsMessage.java
+++ b/src/java/android/telephony/SmsMessage.java
@@ -22,7 +22,6 @@
 import com.android.internal.telephony.GsmAlphabet;
 import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
 import com.android.internal.telephony.SmsConstants;
-import com.android.internal.telephony.SmsHeader;
 import com.android.internal.telephony.SmsMessageBase;
 import com.android.internal.telephony.SmsMessageBase.SubmitPduBase;
 
@@ -37,7 +36,7 @@
  * A Short Message Service message.
  */
 public class SmsMessage {
-    private static final String LOG_TAG = "SMS";
+    private static final String LOG_TAG = "SmsMessage";
 
     /**
      * SMS Class enumeration.
@@ -101,6 +100,7 @@
         public byte[] encodedScAddress; // Null if not applicable.
         public byte[] encodedMessage;
 
+        @Override
         public String toString() {
             return "SubmitPdu: encodedScAddress = "
                     + Arrays.toString(encodedScAddress)
diff --git a/src/java/android/telephony/gsm/SmsManager.java b/src/java/android/telephony/gsm/SmsManager.java
index 3b75298..5630678 100644
--- a/src/java/android/telephony/gsm/SmsManager.java
+++ b/src/java/android/telephony/gsm/SmsManager.java
@@ -219,7 +219,7 @@
      */
     @Deprecated
     public final ArrayList<android.telephony.SmsMessage> getAllMessagesFromSim() {
-        return mSmsMgrProxy.getAllMessagesFromIcc();
+        return android.telephony.SmsManager.getAllMessagesFromIcc();
     }
 
     /** Free space (TS 51.011 10.5.3).
diff --git a/src/java/android/telephony/gsm/SmsMessage.java b/src/java/android/telephony/gsm/SmsMessage.java
index 7a814c3..8d5dac7 100644
--- a/src/java/android/telephony/gsm/SmsMessage.java
+++ b/src/java/android/telephony/gsm/SmsMessage.java
@@ -16,11 +16,9 @@
 
 package android.telephony.gsm;
 
-import android.os.Parcel;
 import android.telephony.TelephonyManager;
 
 import com.android.internal.telephony.GsmAlphabet;
-import com.android.internal.telephony.EncodeException;
 import com.android.internal.telephony.SmsHeader;
 import com.android.internal.telephony.SmsMessageBase;
 import com.android.internal.telephony.SmsMessageBase.SubmitPduBase;
@@ -36,9 +34,6 @@
  */
 @Deprecated
 public class SmsMessage {
-    private static final boolean LOCAL_DEBUG = true;
-    private static final String LOG_TAG = "SMS";
-
     /**
      * SMS Class enumeration.
      * See TS 23.038.
@@ -127,6 +122,7 @@
         }
 
         /** @deprecated Use android.telephony.SmsMessage. */
+        @Override
         @Deprecated
         public String toString() {
             return "SubmitPdu: encodedScAddress = "
@@ -617,6 +613,7 @@
      * @return Specific SmsMessage.
      * @deprecated Use android.telephony.SmsMessage.
      */
+    @Deprecated
     private static final SmsMessageBase getSmsFacility(){
         int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
         if (PHONE_TYPE_CDMA == activePhone) {
diff --git a/src/java/com/android/internal/telephony/ATResponseParser.java b/src/java/com/android/internal/telephony/ATResponseParser.java
index fdb0526..1d4d7c7 100644
--- a/src/java/com/android/internal/telephony/ATResponseParser.java
+++ b/src/java/com/android/internal/telephony/ATResponseParser.java
@@ -23,16 +23,16 @@
 {
     /*************************** Instance Variables **************************/
 
-    private String line;
-    private int next = 0;
-    private int tokStart, tokEnd;
+    private String mLine;
+    private int mNext = 0;
+    private int mTokStart, mTokEnd;
 
     /***************************** Class Methods *****************************/
 
     public
     ATResponseParser (String line)
     {
-        this.line = line;
+        mLine = line;
     }
 
     public boolean
@@ -43,10 +43,10 @@
 
         nextTok();
 
-        if (tokEnd - tokStart > 1) {
+        if (mTokEnd - mTokStart > 1) {
             throw new ATParseEx();
         }
-        char c = line.charAt(tokStart);
+        char c = mLine.charAt(mTokStart);
 
         if (c == '0') return false;
         if (c ==  '1') return true;
@@ -63,8 +63,8 @@
 
         nextTok();
 
-        for (int i = tokStart ; i < tokEnd ; i++) {
-            char c = line.charAt(i);
+        for (int i = mTokStart ; i < mTokEnd ; i++) {
+            char c = mLine.charAt(i);
 
             // Yes, ASCII decimal digits only
             if (c < '0' || c > '9') {
@@ -83,63 +83,63 @@
     {
         nextTok();
 
-        return line.substring(tokStart, tokEnd);
+        return mLine.substring(mTokStart, mTokEnd);
     }
 
     public boolean
     hasMore()
     {
-        return next < line.length();
+        return mNext < mLine.length();
     }
 
     private void
     nextTok()
     {
-        int len = line.length();
+        int len = mLine.length();
 
-        if (next == 0) {
+        if (mNext == 0) {
             skipPrefix();
         }
 
-        if (next >= len) {
+        if (mNext >= len) {
             throw new ATParseEx();
         }
 
         try {
             // \s*("([^"]*)"|(.*)\s*)(,|$)
 
-            char c = line.charAt(next++);
+            char c = mLine.charAt(mNext++);
             boolean hasQuote = false;
 
             c = skipWhiteSpace(c);
 
             if (c == '"') {
-                if (next >= len) {
+                if (mNext >= len) {
                     throw new ATParseEx();
                 }
-                c = line.charAt(next++);
-                tokStart = next - 1;
-                while (c != '"' && next < len) {
-                    c = line.charAt(next++);
+                c = mLine.charAt(mNext++);
+                mTokStart = mNext - 1;
+                while (c != '"' && mNext < len) {
+                    c = mLine.charAt(mNext++);
                 }
                 if (c != '"') {
                     throw new ATParseEx();
                 }
-                tokEnd = next - 1;
-                if (next < len && line.charAt(next++) != ',') {
+                mTokEnd = mNext - 1;
+                if (mNext < len && mLine.charAt(mNext++) != ',') {
                     throw new ATParseEx();
                 }
             } else {
-                tokStart = next - 1;
-                tokEnd = tokStart;
+                mTokStart = mNext - 1;
+                mTokEnd = mTokStart;
                 while (c != ',') {
                     if (!Character.isWhitespace(c)) {
-                        tokEnd = next;
+                        mTokEnd = mNext;
                     }
-                    if (next == len) {
+                    if (mNext == len) {
                         break;
                     }
-                    c = line.charAt(next++);
+                    c = mLine.charAt(mNext++);
                 }
             }
         } catch (StringIndexOutOfBoundsException ex) {
@@ -153,9 +153,9 @@
     skipWhiteSpace (char c)
     {
         int len;
-        len = line.length();
-        while (next < len && Character.isWhitespace(c)) {
-            c = line.charAt(next++);
+        len = mLine.length();
+        while (mNext < len && Character.isWhitespace(c)) {
+            c = mLine.charAt(mNext++);
         }
 
         if (Character.isWhitespace(c)) {
@@ -170,10 +170,10 @@
     {
         // consume "^[^:]:"
 
-        next = 0;
-        int s = line.length();
-        while (next < s){
-            char c = line.charAt(next++);
+        mNext = 0;
+        int s = mLine.length();
+        while (mNext < s){
+            char c = mLine.charAt(mNext++);
 
             if (c == ':') {
                 return;
diff --git a/src/java/com/android/internal/telephony/BaseCommands.java b/src/java/com/android/internal/telephony/BaseCommands.java
index 49d3c76..8ce3873 100644
--- a/src/java/com/android/internal/telephony/BaseCommands.java
+++ b/src/java/com/android/internal/telephony/BaseCommands.java
@@ -22,21 +22,12 @@
 import android.os.Registrant;
 import android.os.Handler;
 import android.os.AsyncResult;
-import android.os.SystemProperties;
 import android.telephony.TelephonyManager;
-import android.telephony.Rlog;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /**
  * {@hide}
  */
 public abstract class BaseCommands implements CommandsInterface {
-    static final String LOG_TAG = "RILB";
-
     //***** Instance Variables
     protected Context mContext;
     protected RadioState mState = RadioState.RADIO_UNAVAILABLE;
@@ -107,10 +98,12 @@
 
     //***** CommandsInterface implementation
 
+    @Override
     public RadioState getRadioState() {
         return mState;
     }
 
+    @Override
     public void registerForRadioStateChanged(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
@@ -120,12 +113,14 @@
         }
     }
 
+    @Override
     public void unregisterForRadioStateChanged(Handler h) {
         synchronized (mStateMonitor) {
             mRadioStateChangedRegistrants.remove(h);
         }
     }
 
+    @Override
     public void registerForOn(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
@@ -137,6 +132,7 @@
             }
         }
     }
+    @Override
     public void unregisterForOn(Handler h) {
         synchronized (mStateMonitor) {
             mOnRegistrants.remove(h);
@@ -144,6 +140,7 @@
     }
 
 
+    @Override
     public void registerForAvailable(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
@@ -156,12 +153,14 @@
         }
     }
 
+    @Override
     public void unregisterForAvailable(Handler h) {
         synchronized(mStateMonitor) {
             mAvailRegistrants.remove(h);
         }
     }
 
+    @Override
     public void registerForNotAvailable(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
@@ -174,12 +173,14 @@
         }
     }
 
+    @Override
     public void unregisterForNotAvailable(Handler h) {
         synchronized (mStateMonitor) {
             mNotAvailRegistrants.remove(h);
         }
     }
 
+    @Override
     public void registerForOffOrNotAvailable(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
@@ -191,243 +192,300 @@
             }
         }
     }
+    @Override
     public void unregisterForOffOrNotAvailable(Handler h) {
         synchronized(mStateMonitor) {
             mOffOrNotAvailRegistrants.remove(h);
         }
     }
 
+    @Override
     public void registerForCallStateChanged(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
         mCallStateRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForCallStateChanged(Handler h) {
         mCallStateRegistrants.remove(h);
     }
 
+    @Override
     public void registerForVoiceNetworkStateChanged(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
         mVoiceNetworkStateRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForVoiceNetworkStateChanged(Handler h) {
         mVoiceNetworkStateRegistrants.remove(h);
     }
 
+    @Override
     public void registerForDataNetworkStateChanged(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
 
         mDataNetworkStateRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForDataNetworkStateChanged(Handler h) {
         mDataNetworkStateRegistrants.remove(h);
     }
 
+    @Override
     public void registerForVoiceRadioTechChanged(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mVoiceRadioTechChangedRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForVoiceRadioTechChanged(Handler h) {
         mVoiceRadioTechChangedRegistrants.remove(h);
     }
 
+    @Override
     public void registerForIccStatusChanged(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mIccStatusChangedRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForIccStatusChanged(Handler h) {
         mIccStatusChangedRegistrants.remove(h);
     }
 
+    @Override
     public void setOnNewGsmSms(Handler h, int what, Object obj) {
         mGsmSmsRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnNewGsmSms(Handler h) {
         mGsmSmsRegistrant.clear();
     }
 
+    @Override
     public void setOnNewCdmaSms(Handler h, int what, Object obj) {
         mCdmaSmsRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnNewCdmaSms(Handler h) {
         mCdmaSmsRegistrant.clear();
     }
 
+    @Override
     public void setOnNewGsmBroadcastSms(Handler h, int what, Object obj) {
         mGsmBroadcastSmsRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnNewGsmBroadcastSms(Handler h) {
         mGsmBroadcastSmsRegistrant.clear();
     }
 
+    @Override
     public void setOnSmsOnSim(Handler h, int what, Object obj) {
         mSmsOnSimRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnSmsOnSim(Handler h) {
         mSmsOnSimRegistrant.clear();
     }
 
+    @Override
     public void setOnSmsStatus(Handler h, int what, Object obj) {
         mSmsStatusRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnSmsStatus(Handler h) {
         mSmsStatusRegistrant.clear();
     }
 
+    @Override
     public void setOnSignalStrengthUpdate(Handler h, int what, Object obj) {
         mSignalStrengthRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnSignalStrengthUpdate(Handler h) {
         mSignalStrengthRegistrant.clear();
     }
 
+    @Override
     public void setOnNITZTime(Handler h, int what, Object obj) {
         mNITZTimeRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnNITZTime(Handler h) {
         mNITZTimeRegistrant.clear();
     }
 
+    @Override
     public void setOnUSSD(Handler h, int what, Object obj) {
         mUSSDRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnUSSD(Handler h) {
         mUSSDRegistrant.clear();
     }
 
+    @Override
     public void setOnSuppServiceNotification(Handler h, int what, Object obj) {
         mSsnRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnSuppServiceNotification(Handler h) {
         mSsnRegistrant.clear();
     }
 
+    @Override
     public void setOnCatSessionEnd(Handler h, int what, Object obj) {
         mCatSessionEndRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnCatSessionEnd(Handler h) {
         mCatSessionEndRegistrant.clear();
     }
 
+    @Override
     public void setOnCatProactiveCmd(Handler h, int what, Object obj) {
         mCatProCmdRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnCatProactiveCmd(Handler h) {
         mCatProCmdRegistrant.clear();
     }
 
+    @Override
     public void setOnCatEvent(Handler h, int what, Object obj) {
         mCatEventRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnCatEvent(Handler h) {
         mCatEventRegistrant.clear();
     }
 
+    @Override
     public void setOnCatCallSetUp(Handler h, int what, Object obj) {
         mCatCallSetUpRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnCatCallSetUp(Handler h) {
         mCatCallSetUpRegistrant.clear();
     }
 
+    @Override
     public void setOnIccSmsFull(Handler h, int what, Object obj) {
         mIccSmsFullRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnIccSmsFull(Handler h) {
         mIccSmsFullRegistrant.clear();
     }
 
+    @Override
     public void registerForIccRefresh(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mIccRefreshRegistrants.add(r);
     }
+    @Override
     public void setOnIccRefresh(Handler h, int what, Object obj) {
         registerForIccRefresh(h, what, obj);
     }
 
+    @Override
     public void setEmergencyCallbackMode(Handler h, int what, Object obj) {
         mEmergencyCallbackModeRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unregisterForIccRefresh(Handler h) {
         mIccRefreshRegistrants.remove(h);
     }
+    @Override
     public void unsetOnIccRefresh(Handler h) {
         unregisterForIccRefresh(h);
     }
 
+    @Override
     public void setOnCallRing(Handler h, int what, Object obj) {
         mRingRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnCallRing(Handler h) {
         mRingRegistrant.clear();
     }
 
+    @Override
     public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mVoicePrivacyOnRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForInCallVoicePrivacyOn(Handler h){
         mVoicePrivacyOnRegistrants.remove(h);
     }
 
+    @Override
     public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mVoicePrivacyOffRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForInCallVoicePrivacyOff(Handler h){
         mVoicePrivacyOffRegistrants.remove(h);
     }
 
+    @Override
     public void setOnRestrictedStateChanged(Handler h, int what, Object obj) {
         mRestrictedStateRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unSetOnRestrictedStateChanged(Handler h) {
         mRestrictedStateRegistrant.clear();
     }
 
+    @Override
     public void registerForDisplayInfo(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mDisplayInfoRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForDisplayInfo(Handler h) {
         mDisplayInfoRegistrants.remove(h);
     }
 
+    @Override
     public void registerForCallWaitingInfo(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mCallWaitingInfoRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForCallWaitingInfo(Handler h) {
         mCallWaitingInfoRegistrants.remove(h);
     }
 
+    @Override
     public void registerForSignalInfo(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mSignalInfoRegistrants.add(r);
@@ -441,78 +499,95 @@
         mUnsolOemHookRawRegistrant.clear();
     }
 
+    @Override
     public void unregisterForSignalInfo(Handler h) {
         mSignalInfoRegistrants.remove(h);
     }
 
+    @Override
     public void registerForCdmaOtaProvision(Handler h,int what, Object obj){
         Registrant r = new Registrant (h, what, obj);
         mOtaProvisionRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForCdmaOtaProvision(Handler h){
         mOtaProvisionRegistrants.remove(h);
     }
 
+    @Override
     public void registerForNumberInfo(Handler h,int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mNumberInfoRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForNumberInfo(Handler h){
         mNumberInfoRegistrants.remove(h);
     }
 
-     public void registerForRedirectedNumberInfo(Handler h,int what, Object obj) {
+     @Override
+    public void registerForRedirectedNumberInfo(Handler h,int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mRedirNumInfoRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForRedirectedNumberInfo(Handler h) {
         mRedirNumInfoRegistrants.remove(h);
     }
 
+    @Override
     public void registerForLineControlInfo(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mLineControlInfoRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForLineControlInfo(Handler h) {
         mLineControlInfoRegistrants.remove(h);
     }
 
+    @Override
     public void registerFoT53ClirlInfo(Handler h,int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mT53ClirInfoRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForT53ClirInfo(Handler h) {
         mT53ClirInfoRegistrants.remove(h);
     }
 
+    @Override
     public void registerForT53AudioControlInfo(Handler h,int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mT53AudCntrlInfoRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForT53AudioControlInfo(Handler h) {
         mT53AudCntrlInfoRegistrants.remove(h);
     }
 
+    @Override
     public void registerForRingbackTone(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mRingbackToneRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForRingbackTone(Handler h) {
         mRingbackToneRegistrants.remove(h);
     }
 
+    @Override
     public void registerForResendIncallMute(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
         mResendIncallMuteRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForResendIncallMute(Handler h) {
         mResendIncallMuteRegistrants.remove(h);
     }
@@ -555,11 +630,9 @@
      */
     @Override
     public void registerForRilConnected(Handler h, int what, Object obj) {
-        Rlog.d(LOG_TAG, "registerForRilConnected h=" + h + " w=" + what);
         Registrant r = new Registrant (h, what, obj);
         mRilConnectedRegistrants.add(r);
         if (mRilVersion != -1) {
-            Rlog.d(LOG_TAG, "Notifying: ril connected mRilVersion=" + mRilVersion);
             r.notifyRegistrant(new AsyncResult(null, new Integer(mRilVersion), null));
         }
     }
@@ -591,11 +664,6 @@
         RadioState oldState;
 
         synchronized (mStateMonitor) {
-            if (false) {
-                Rlog.v(LOG_TAG, "setRadioState old: " + mState
-                    + " new " + newState);
-            }
-
             oldState = mState;
             mState = newState;
 
@@ -607,25 +675,21 @@
             mRadioStateChangedRegistrants.notifyRegistrants();
 
             if (mState.isAvailable() && !oldState.isAvailable()) {
-                Rlog.d(LOG_TAG,"Notifying: radio available");
                 mAvailRegistrants.notifyRegistrants();
                 onRadioAvailable();
             }
 
             if (!mState.isAvailable() && oldState.isAvailable()) {
-                Rlog.d(LOG_TAG,"Notifying: radio not available");
                 mNotAvailRegistrants.notifyRegistrants();
             }
 
             if (mState.isOn() && !oldState.isOn()) {
-                Rlog.d(LOG_TAG,"Notifying: Radio On");
                 mOnRegistrants.notifyRegistrants();
             }
 
             if ((!mState.isOn() || !mState.isAvailable())
                 && !((!oldState.isOn() || !oldState.isAvailable()))
             ) {
-                Rlog.d(LOG_TAG,"Notifying: radio off or not available");
                 mOffOrNotAvailRegistrants.notifyRegistrants();
             }
         }
@@ -644,4 +708,9 @@
 
     @Override
     public void testingEmergencyCall() {}
+
+    @Override
+    public int getRilVersion() {
+        return mRilVersion;
+    }
 }
diff --git a/src/java/com/android/internal/telephony/Call.java b/src/java/com/android/internal/telephony/Call.java
index 2127258..b83d33e 100644
--- a/src/java/com/android/internal/telephony/Call.java
+++ b/src/java/com/android/internal/telephony/Call.java
@@ -16,6 +16,7 @@
 
 package com.android.internal.telephony;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import android.telephony.Rlog;
@@ -24,6 +25,8 @@
  * {@hide}
  */
 public abstract class Call {
+    protected final String LOG_TAG = "Call";
+
     /* Enums */
 
     public enum State {
@@ -45,8 +48,9 @@
 
     /* Instance Variables */
 
-    public State state = State.IDLE;
+    public State mState = State.IDLE;
 
+    public ArrayList<Connection> mConnections = new ArrayList<Connection>();
 
     // Flag to indicate if the current calling/caller information
     // is accurate. If false the information is known to be accurate.
@@ -54,9 +58,7 @@
     // For CDMA, during call waiting/3 way, there is no network response
     // if call waiting is answered, network timed out, dropped, 3 way
     // merged, etc.
-    protected boolean isGeneric = false;
-
-    protected final String LOG_TAG = "Call";
+    protected boolean mIsGeneric = false;
 
     /* Instance Methods */
 
@@ -85,7 +87,7 @@
      * @return true if the call contains one or more connections
      */
     public boolean hasConnections() {
-        List connections = getConnections();
+        List<Connection> connections = getConnections();
 
         if (connections == null) {
             return false;
@@ -99,7 +101,7 @@
      * @return state of class call
      */
     public State getState() {
-        return state;
+        return mState;
     }
 
     /**
@@ -118,7 +120,7 @@
      */
     public Connection
     getEarliestConnection() {
-        List l;
+        List<Connection> l;
         long time = Long.MAX_VALUE;
         Connection c;
         Connection earliest = null;
@@ -130,7 +132,7 @@
         }
 
         for (int i = 0, s = l.size() ; i < s ; i++) {
-            c = (Connection) l.get(i);
+            c = l.get(i);
             long t;
 
             t = c.getCreateTime();
@@ -146,7 +148,7 @@
 
     public long
     getEarliestCreateTime() {
-        List l;
+        List<Connection> l;
         long time = Long.MAX_VALUE;
 
         l = getConnections();
@@ -156,7 +158,7 @@
         }
 
         for (int i = 0, s = l.size() ; i < s ; i++) {
-            Connection c = (Connection) l.get(i);
+            Connection c = l.get(i);
             long t;
 
             t = c.getCreateTime();
@@ -170,14 +172,14 @@
     public long
     getEarliestConnectTime() {
         long time = Long.MAX_VALUE;
-        List l = getConnections();
+        List<Connection> l = getConnections();
 
         if (l.size() == 0) {
             return 0;
         }
 
         for (int i = 0, s = l.size() ; i < s ; i++) {
-            Connection c = (Connection) l.get(i);
+            Connection c = l.get(i);
             long t;
 
             t = c.getConnectTime();
@@ -205,7 +207,7 @@
      */
     public Connection
     getLatestConnection() {
-        List l = getConnections();
+        List<Connection> l = getConnections();
         if (l.size() == 0) {
             return null;
         }
@@ -213,7 +215,7 @@
         long time = 0;
         Connection latest = null;
         for (int i = 0, s = l.size() ; i < s ; i++) {
-            Connection c = (Connection) l.get(i);
+            Connection c = l.get(i);
             long t = c.getCreateTime();
 
             if (t > time) {
@@ -230,14 +232,14 @@
      * or not. false means accurate. Only used for CDMA.
      */
     public boolean isGeneric() {
-        return isGeneric;
+        return mIsGeneric;
     }
 
     /**
      * Set the generic instance variable
      */
     public void setGeneric(boolean generic) {
-        isGeneric = generic;
+        mIsGeneric = generic;
     }
 
     /**
diff --git a/src/java/com/android/internal/telephony/CallForwardInfo.java b/src/java/com/android/internal/telephony/CallForwardInfo.java
index 8b853b0..320e786 100644
--- a/src/java/com/android/internal/telephony/CallForwardInfo.java
+++ b/src/java/com/android/internal/telephony/CallForwardInfo.java
@@ -31,6 +31,7 @@
     public String          number;      /* "number" from TS 27.007 7.11 */
     public int             timeSeconds; /* for CF no reply only */
 
+    @Override
     public String toString() {
         return super.toString() + (status == 0 ? " not active " : " active ")
             + " reason: " + reason
diff --git a/src/java/com/android/internal/telephony/CallManager.java b/src/java/com/android/internal/telephony/CallManager.java
index 1c1799f..f32fcf0 100644
--- a/src/java/com/android/internal/telephony/CallManager.java
+++ b/src/java/com/android/internal/telephony/CallManager.java
@@ -95,7 +95,7 @@
     private final ArrayList<Call> mForegroundCalls;
 
     // empty connection list
-    private final ArrayList<Connection> emptyConnections = new ArrayList<Connection>();
+    private final ArrayList<Connection> mEmptyConnections = new ArrayList<Connection>();
 
     // default phone as the first phone registered, which is PhoneBase obj
     private Phone mDefaultPhone;
@@ -519,7 +519,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "acceptCall(" +ringingCall + " from " + ringingCall.getPhone() + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if ( hasActiveFgCall() ) {
@@ -561,7 +561,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End acceptCall(" +ringingCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
     }
 
@@ -577,7 +577,7 @@
     public void rejectCall(Call ringingCall) throws CallStateException {
         if (VDBG) {
             Rlog.d(LOG_TAG, "rejectCall(" +ringingCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         Phone ringingPhone = ringingCall.getPhone();
@@ -586,7 +586,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End rejectCall(" +ringingCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
     }
 
@@ -614,7 +614,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "switchHoldingAndActive(" +heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (hasActiveFgCall()) {
@@ -635,7 +635,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End switchHoldingAndActive(" +heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
     }
 
@@ -653,7 +653,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "hangupForegroundResumeBackground(" +heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (hasActiveFgCall()) {
@@ -672,7 +672,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End hangupForegroundResumeBackground(" +heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
     }
 
@@ -709,7 +709,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "conference(" +heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
 
@@ -724,7 +724,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End conference(" +heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
     }
@@ -745,7 +745,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, " dial(" + basePhone + ", "+ dialString + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (!canDial(phone)) {
@@ -775,7 +775,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End dial(" + basePhone + ", "+ dialString + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         return result;
@@ -875,7 +875,7 @@
     public void explicitCallTransfer(Call heldCall) throws CallStateException {
         if (VDBG) {
             Rlog.d(LOG_TAG, " explicitCallTransfer(" + heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (canTransfer(heldCall)) {
@@ -884,7 +884,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End explicitCallTransfer(" + heldCall + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
     }
@@ -928,7 +928,7 @@
     public void setMute(boolean muted) {
         if (VDBG) {
             Rlog.d(LOG_TAG, " setMute(" + muted + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (hasActiveFgCall()) {
@@ -937,7 +937,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End setMute(" + muted + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
     }
 
@@ -965,7 +965,7 @@
     public void setEchoSuppressionEnabled(boolean enabled) {
         if (VDBG) {
             Rlog.d(LOG_TAG, " setEchoSuppression(" + enabled + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (hasActiveFgCall()) {
@@ -974,7 +974,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End setEchoSuppression(" + enabled + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
     }
 
@@ -991,7 +991,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, " sendDtmf(" + c + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (hasActiveFgCall()) {
@@ -1001,7 +1001,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End sendDtmf(" + c + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
         return result;
     }
@@ -1020,7 +1020,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, " startDtmf(" + c + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (hasActiveFgCall()) {
@@ -1030,7 +1030,7 @@
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End startDtmf(" + c + ")");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         return result;
@@ -1043,14 +1043,14 @@
     public void stopDtmf() {
         if (VDBG) {
             Rlog.d(LOG_TAG, " stopDtmf()" );
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
 
         if (hasActiveFgCall()) getFgPhone().stopDtmf();
 
         if (VDBG) {
             Rlog.d(LOG_TAG, "End stopDtmf()");
-            Rlog.d(LOG_TAG, this.toString());
+            Rlog.d(LOG_TAG, toString());
         }
     }
 
@@ -1100,8 +1100,8 @@
 
     /**
      * Register for getting notifications for change in the Call State {@link Call.State}
-     * This is called PreciseCallState because the call state is more precise than the
-     * {@link Phone.State} which can be obtained using the {@link PhoneStateListener}
+     * This is called PreciseCallState because the call state is more precise than what
+     * can be obtained using the {@link PhoneStateListener}
      *
      * Resulting events will have an AsyncResult in <code>Message.obj</code>.
      * AsyncResult.userData will be set to the obj argument here.
@@ -1659,7 +1659,7 @@
         if ( fgCall != null) {
             return fgCall.getConnections();
         }
-        return emptyConnections;
+        return mEmptyConnections;
     }
 
     /**
@@ -1671,7 +1671,7 @@
         if ( bgCall != null) {
             return bgCall.getConnections();
         }
-        return emptyConnections;
+        return mEmptyConnections;
     }
 
     /**
diff --git a/src/java/com/android/internal/telephony/CallTracker.java b/src/java/com/android/internal/telephony/CallTracker.java
index efe53c9..2694a04 100644
--- a/src/java/com/android/internal/telephony/CallTracker.java
+++ b/src/java/com/android/internal/telephony/CallTracker.java
@@ -21,8 +21,6 @@
 import android.os.Message;
 import android.os.SystemProperties;
 import android.text.TextUtils;
-import android.telephony.Rlog;
-
 import com.android.internal.telephony.CommandException;
 
 import java.io.FileDescriptor;
@@ -40,11 +38,11 @@
 
     static final int POLL_DELAY_MSEC = 250;
 
-    protected int pendingOperations;
-    protected boolean needsPoll;
-    protected Message lastRelevantPoll;
+    protected int mPendingOperations;
+    protected boolean mNeedsPoll;
+    protected Message mLastRelevantPoll;
 
-    public CommandsInterface cm;
+    public CommandsInterface mCi;
 
 
     //***** Events
@@ -66,11 +64,11 @@
     protected static final int EVENT_THREE_WAY_DIAL_L2_RESULT_CDMA = 16;
 
     protected void pollCallsWhenSafe() {
-        needsPoll = true;
+        mNeedsPoll = true;
 
         if (checkNoOperationsPending()) {
-            lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
-            cm.getCurrentCalls(lastRelevantPoll);
+            mLastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
+            mCi.getCurrentCalls(mLastRelevantPoll);
         }
     }
 
@@ -105,8 +103,8 @@
      */
     protected Message
     obtainNoPollCompleteMessage(int what) {
-        pendingOperations++;
-        lastRelevantPoll = null;
+        mPendingOperations++;
+        mLastRelevantPoll = null;
         return obtainMessage(what);
     }
 
@@ -117,8 +115,8 @@
     private boolean
     checkNoOperationsPending() {
         if (DBG_POLL) log("checkNoOperationsPending: pendingOperations=" +
-                pendingOperations);
-        return pendingOperations == 0;
+                mPendingOperations);
+        return mPendingOperations == 0;
     }
 
     /**
@@ -139,7 +137,7 @@
      * To test Dial 112 take call then hang up on MO device to enter ECM
      * see RIL#processSolicited RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND
      *
-     * @param number to test if it should be remapped
+     * @param dialString to test if it should be remapped
      * @return the same number or the remapped number.
      */
     protected String checkForTestEmergencyNumber(String dialString) {
@@ -154,7 +152,7 @@
             if (values.length == 2) {
                 if (values[0].equals(
                         android.telephony.PhoneNumberUtils.stripSeparators(dialString))) {
-                    cm.testingEmergencyCall();
+                    mCi.testingEmergencyCall();
                     log("checkForTestEmergencyNumber: remap " +
                             dialString + " to " + values[1]);
                     dialString = values[1];
@@ -165,6 +163,7 @@
     }
 
     //***** Overridden from Handler
+    @Override
     public abstract void handleMessage (Message msg);
     public abstract void registerForVoiceCallStarted(Handler h, int what, Object obj);
     public abstract void unregisterForVoiceCallStarted(Handler h);
@@ -175,8 +174,8 @@
 
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("CallTracker:");
-        pw.println(" pendingOperations=" + pendingOperations);
-        pw.println(" needsPoll=" + needsPoll);
-        pw.println(" lastRelevantPoll=" + lastRelevantPoll);
+        pw.println(" mPendingOperations=" + mPendingOperations);
+        pw.println(" mNeedsPoll=" + mNeedsPoll);
+        pw.println(" mLastRelevantPoll=" + mLastRelevantPoll);
     }
 }
diff --git a/src/java/com/android/internal/telephony/CommandException.java b/src/java/com/android/internal/telephony/CommandException.java
index d1085f6..550e91c 100644
--- a/src/java/com/android/internal/telephony/CommandException.java
+++ b/src/java/com/android/internal/telephony/CommandException.java
@@ -24,7 +24,7 @@
  * {@hide}
  */
 public class CommandException extends RuntimeException {
-    private Error e;
+    private Error mError;
 
     public enum Error {
         INVALID_RESPONSE,
@@ -46,7 +46,7 @@
 
     public CommandException(Error e) {
         super(e.toString());
-        this.e = e;
+        mError = e;
     }
 
     public static CommandException
@@ -90,7 +90,7 @@
     }
 
     public Error getCommandError() {
-        return e;
+        return mError;
     }
 
 
diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java
index fc116ef..0ea8035 100644
--- a/src/java/com/android/internal/telephony/CommandsInterface.java
+++ b/src/java/com/android/internal/telephony/CommandsInterface.java
@@ -22,7 +22,6 @@
 
 import android.os.Message;
 import android.os.Handler;
-import android.telephony.Rlog;
 
 /**
  * {@hide}
@@ -1558,8 +1557,8 @@
      * is a tri-state return value as for a period of time
      * the mode may be unknown.
      *
-     * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
-     * or {@link Phone#LTE_ON_CDMA_TRUE}
+     * @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
+     * or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
      */
     public int getLteOnCdmaMode();
 
@@ -1577,4 +1576,10 @@
      * Notifiy that we are testing an emergency call
      */
     public void testingEmergencyCall();
+
+
+    /**
+     * @return version of the ril.
+     */
+    int getRilVersion();
 }
diff --git a/src/java/com/android/internal/telephony/Connection.java b/src/java/com/android/internal/telephony/Connection.java
index 8e10af5..f948885 100644
--- a/src/java/com/android/internal/telephony/Connection.java
+++ b/src/java/com/android/internal/telephony/Connection.java
@@ -25,10 +25,10 @@
 public abstract class Connection {
 
     //Caller Name Display
-    protected String cnapName;
-    protected int cnapNamePresentation  = PhoneConstants.PRESENTATION_ALLOWED;
+    protected String mCnapName;
+    protected int mCnapNamePresentation  = PhoneConstants.PRESENTATION_ALLOWED;
 
-    private static String LOG_TAG = "TelephonyConnection";
+    private static String LOG_TAG = "Connection";
 
     public enum DisconnectCause {
         NOT_DISCONNECTED,               /* has not yet disconnected */
@@ -70,7 +70,7 @@
         ERROR_UNSPECIFIED
     }
 
-    Object userData;
+    Object mUserData;
 
     /* Instance Methods */
 
@@ -88,7 +88,7 @@
      * @return cnap name or null if unavailable
      */
     public String getCnapName() {
-        return cnapName;
+        return mCnapName;
     }
 
     /**
@@ -105,8 +105,8 @@
      */
 
     public int getCnapNamePresentation() {
-       return cnapNamePresentation;
-    };
+       return mCnapNamePresentation;
+    }
 
     /**
      * @return Call that owns this Connection, or null if none
@@ -207,7 +207,7 @@
      * @return the userdata set in setUserData()
      */
     public Object getUserData() {
-        return userData;
+        return mUserData;
     }
 
     /**
@@ -215,7 +215,7 @@
      * @param userdata user can store an any userdata in the Connection object.
      */
     public void setUserData(Object userdata) {
-        this.userData = userdata;
+        mUserData = userdata;
     }
 
     /**
@@ -247,7 +247,7 @@
     }
 
     public void clearUserData(){
-        userData = null;
+        mUserData = null;
     }
 
     public abstract PostDialState getPostDialState();
diff --git a/src/java/com/android/internal/telephony/DataCallState.java b/src/java/com/android/internal/telephony/DataCallState.java
index c3a3b1d..12ebc1a 100644
--- a/src/java/com/android/internal/telephony/DataCallState.java
+++ b/src/java/com/android/internal/telephony/DataCallState.java
@@ -24,7 +24,7 @@
 import android.os.SystemProperties;
 import android.telephony.Rlog;
 
-import com.android.internal.telephony.DataConnection.FailCause;
+import com.android.internal.telephony.dataconnection.DataConnectionBase.FailCause;
 
 import java.net.Inet4Address;
 import java.net.InetAddress;
@@ -36,7 +36,7 @@
  */
 public class DataCallState {
     private final boolean DBG = true;
-    private final String LOG_TAG = "GSM";
+    private final String LOG_TAG = "DataCallState";
 
     public int version = 0;
     public int status = 0;
diff --git a/src/java/com/android/internal/telephony/DebugService.java b/src/java/com/android/internal/telephony/DebugService.java
index deba3eb..f605721 100644
--- a/src/java/com/android/internal/telephony/DebugService.java
+++ b/src/java/com/android/internal/telephony/DebugService.java
@@ -96,7 +96,7 @@
         pw.flush();
         pw.println("++++++++++++++++++++++++++++++++");
         try {
-            ((RIL)phoneBase.mCM).dump(fd, pw, args);
+            ((RIL)phoneBase.mCi).dump(fd, pw, args);
         } catch (Exception e) {
             e.printStackTrace();
         }
diff --git a/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
index 8f4ae84..636ae39 100644
--- a/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
+++ b/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
@@ -24,7 +24,6 @@
 import android.telephony.CellInfo;
 import android.telephony.ServiceState;
 import android.telephony.TelephonyManager;
-import android.telephony.Rlog;
 
 import com.android.internal.telephony.ITelephonyRegistry;
 
@@ -35,8 +34,6 @@
  */
 public class DefaultPhoneNotifier implements PhoneNotifier {
 
-    static final String LOG_TAG = "GSM";
-    private static final boolean DBG = true;
     private ITelephonyRegistry mRegistry;
 
     /*package*/
@@ -45,6 +42,7 @@
                     "telephony.registry"));
     }
 
+    @Override
     public void notifyPhoneState(Phone sender) {
         Call ringingCall = sender.getRingingCall();
         String incomingNumber = "";
@@ -58,6 +56,7 @@
         }
     }
 
+    @Override
     public void notifyServiceState(Phone sender) {
         ServiceState ss = sender.getServiceState();
         if (ss == null) {
@@ -71,6 +70,7 @@
         }
     }
 
+    @Override
     public void notifySignalStrength(Phone sender) {
         try {
             mRegistry.notifySignalStrength(sender.getSignalStrength());
@@ -79,6 +79,7 @@
         }
     }
 
+    @Override
     public void notifyMessageWaitingChanged(Phone sender) {
         try {
             mRegistry.notifyMessageWaitingChanged(sender.getMessageWaitingIndicator());
@@ -87,6 +88,7 @@
         }
     }
 
+    @Override
     public void notifyCallForwardingChanged(Phone sender) {
         try {
             mRegistry.notifyCallForwardingChanged(sender.getCallForwardingIndicator());
@@ -95,6 +97,7 @@
         }
     }
 
+    @Override
     public void notifyDataActivity(Phone sender) {
         try {
             mRegistry.notifyDataActivity(convertDataActivityState(sender.getDataActivityState()));
@@ -103,6 +106,7 @@
         }
     }
 
+    @Override
     public void notifyDataConnection(Phone sender, String reason, String apnType,
             PhoneConstants.DataState state) {
         doNotifyDataConnection(sender, reason, apnType, state);
@@ -141,6 +145,7 @@
         }
     }
 
+    @Override
     public void notifyDataConnectionFailed(Phone sender, String reason, String apnType) {
         try {
             mRegistry.notifyDataConnectionFailed(reason, apnType);
@@ -149,6 +154,7 @@
         }
     }
 
+    @Override
     public void notifyCellLocation(Phone sender) {
         Bundle data = new Bundle();
         sender.getCellLocation().fillInNotifierBundle(data);
@@ -159,6 +165,7 @@
         }
     }
 
+    @Override
     public void notifyCellInfo(Phone sender, List<CellInfo> cellInfo) {
         try {
             mRegistry.notifyCellInfo(cellInfo);
@@ -167,6 +174,7 @@
         }
     }
 
+    @Override
     public void notifyOtaspChanged(Phone sender, int otaspMode) {
         try {
             mRegistry.notifyOtaspChanged(otaspMode);
@@ -175,13 +183,9 @@
         }
     }
 
-    private void log(String s) {
-        Rlog.d(LOG_TAG, "[PhoneNotifier] " + s);
-    }
-
     /**
-     * Convert the {@link State} enum into the TelephonyManager.CALL_STATE_* constants
-     * for the public API.
+     * Convert the {@link PhoneConstants.State} enum into the TelephonyManager.CALL_STATE_*
+     * constants for the public API.
      */
     public static int convertCallState(PhoneConstants.State state) {
         switch (state) {
@@ -195,8 +199,8 @@
     }
 
     /**
-     * Convert the TelephonyManager.CALL_STATE_* constants into the {@link State} enum
-     * for the public API.
+     * Convert the TelephonyManager.CALL_STATE_* constants into the
+     * {@link PhoneConstants.State} enum for the public API.
      */
     public static PhoneConstants.State convertCallState(int state) {
         switch (state) {
@@ -210,7 +214,7 @@
     }
 
     /**
-     * Convert the {@link DataState} enum into the TelephonyManager.DATA_* constants
+     * Convert the {@link PhoneConstants.DataState} enum into the TelephonyManager.DATA_* constants
      * for the public API.
      */
     public static int convertDataState(PhoneConstants.DataState state) {
@@ -227,7 +231,7 @@
     }
 
     /**
-     * Convert the TelephonyManager.DATA_* constants into {@link DataState} enum
+     * Convert the TelephonyManager.DATA_* constants into {@link PhoneConstants.DataState} enum
      * for the public API.
      */
     public static PhoneConstants.DataState convertDataState(int state) {
@@ -244,7 +248,7 @@
     }
 
     /**
-     * Convert the {@link DataState} enum into the TelephonyManager.DATA_* constants
+     * Convert the {@link Phone.DataActivityState} enum into the TelephonyManager.DATA_* constants
      * for the public API.
      */
     public static int convertDataActivityState(Phone.DataActivityState state) {
@@ -263,7 +267,7 @@
     }
 
     /**
-     * Convert the TelephonyManager.DATA_* constants into the {@link DataState} enum
+     * Convert the TelephonyManager.DATA_* constants into the {@link Phone.DataActivityState} enum
      * for the public API.
      */
     public static Phone.DataActivityState convertDataActivityState(int state) {
diff --git a/src/java/com/android/internal/telephony/DriverCall.java b/src/java/com/android/internal/telephony/DriverCall.java
index c76be5f..a923d8f 100644
--- a/src/java/com/android/internal/telephony/DriverCall.java
+++ b/src/java/com/android/internal/telephony/DriverCall.java
@@ -15,7 +15,7 @@
  */
 
 package com.android.internal.telephony;
-//import com.android.internal.telephony.*;
+
 import android.telephony.Rlog;
 import java.lang.Comparable;
 import android.telephony.PhoneNumberUtils;
@@ -23,8 +23,8 @@
 /**
  * {@hide}
  */
-public class DriverCall implements Comparable {
-    static final String LOG_TAG = "RILB";
+public class DriverCall implements Comparable<DriverCall> {
+    static final String LOG_TAG = "DriverCall";
 
     public enum State {
         ACTIVE,
@@ -101,6 +101,7 @@
     DriverCall() {
     }
 
+    @Override
     public String
     toString() {
         return "id=" + index + ","
@@ -145,11 +146,9 @@
     //***** Comparable Implementation
 
     /** For sorting by index */
+    @Override
     public int
-    compareTo (Object o) {
-        DriverCall dc;
-
-        dc = (DriverCall)o;
+    compareTo(DriverCall dc) {
 
         if (index < dc.index) {
             return -1;
diff --git a/src/java/com/android/internal/telephony/ISms.aidl b/src/java/com/android/internal/telephony/ISms.aidl
deleted file mode 100644
index 6917b1b..0000000
--- a/src/java/com/android/internal/telephony/ISms.aidl
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
-** Copyright 2007, 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 com.android.internal.telephony;
-
-import android.app.PendingIntent;
-import com.android.internal.telephony.SmsRawData;
-
-/** Interface for applications to access the ICC phone book.
- *
- * <p>The following code snippet demonstrates a static method to
- * retrieve the ISms interface from Android:</p>
- * <pre>private static ISms getSmsInterface()
-            throws DeadObjectException {
-    IServiceManager sm = ServiceManagerNative.getDefault();
-    ISms ss;
-    ss = ISms.Stub.asInterface(sm.getService("isms"));
-    return ss;
-}
- * </pre>
- */
-
-interface ISms {
-    /**
-     * Retrieves all messages currently stored on ICC.
-     *
-     * @return list of SmsRawData of all sms on ICC
-     */
-     List<SmsRawData> getAllMessagesFromIccEf();
-
-    /**
-     * Update the specified message on the ICC.
-     *
-     * @param messageIndex record index of message to update
-     * @param newStatus new message status (STATUS_ON_ICC_READ,
-     *                  STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT,
-     *                  STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE)
-     * @param pdu the raw PDU to store
-     * @return success or not
-     *
-     */
-     boolean updateMessageOnIccEf(int messageIndex, int newStatus,
-            in byte[] pdu);
-
-    /**
-     * Copy a raw SMS PDU to the ICC.
-     *
-     * @param pdu the raw PDU to store
-     * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD,
-     *               STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
-     * @return success or not
-     *
-     */
-    boolean copyMessageToIccEf(int status, in byte[] pdu, in byte[] smsc);
-
-    /**
-     * Send a data SMS.
-     *
-     * @param smsc the SMSC to send the message through, or NULL for the
-     *  default SMSC
-     * @param data the body of the message to send
-     * @param sentIntent if not NULL this <code>PendingIntent</code> is
-     *  broadcast when the message is sucessfully sent, or failed.
-     *  The result code will be <code>Activity.RESULT_OK<code> for success,
-     *  or one of these errors:<br>
-     *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
-     *  <code>RESULT_ERROR_RADIO_OFF</code><br>
-     *  <code>RESULT_ERROR_NULL_PDU</code><br>
-     *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
-     *  the extra "errorCode" containing a radio technology specific value,
-     *  generally only useful for troubleshooting.<br>
-     *  The per-application based SMS control checks sentIntent. If sentIntent
-     *  is NULL the caller will be checked against all unknown applicaitons,
-     *  which cause smaller number of SMS to be sent in checking period.
-     * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
-     *  broadcast when the message is delivered to the recipient.  The
-     *  raw pdu of the status report is in the extended data ("pdu").
-     */
-    void sendData(in String destAddr, in String scAddr, in int destPort,
-            in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent);
-
-    /**
-     * Send an SMS.
-     *
-     * @param smsc the SMSC to send the message through, or NULL for the
-     *  default SMSC
-     * @param text the body of the message to send
-     * @param sentIntent if not NULL this <code>PendingIntent</code> is
-     *  broadcast when the message is sucessfully sent, or failed.
-     *  The result code will be <code>Activity.RESULT_OK<code> for success,
-     *  or one of these errors:<br>
-     *  <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
-     *  <code>RESULT_ERROR_RADIO_OFF</code><br>
-     *  <code>RESULT_ERROR_NULL_PDU</code><br>
-     *  For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
-     *  the extra "errorCode" containing a radio technology specific value,
-     *  generally only useful for troubleshooting.<br>
-     *  The per-application based SMS control checks sentIntent. If sentIntent
-     *  is NULL the caller will be checked against all unknown applications,
-     *  which cause smaller number of SMS to be sent in checking period.
-     * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
-     *  broadcast when the message is delivered to the recipient.  The
-     *  raw pdu of the status report is in the extended data ("pdu").
-     */
-    void sendText(in String destAddr, in String scAddr, in String text,
-            in PendingIntent sentIntent, in PendingIntent deliveryIntent);
-
-    /**
-     * Send a multi-part text based SMS.
-     *
-     * @param destinationAddress the address to send the message to
-     * @param scAddress is the service center address or null to use
-     *   the current default SMSC
-     * @param parts an <code>ArrayList</code> of strings that, in order,
-     *   comprise the original message
-     * @param sentIntents if not null, an <code>ArrayList</code> of
-     *   <code>PendingIntent</code>s (one for each message part) that is
-     *   broadcast when the corresponding message part has been sent.
-     *   The result code will be <code>Activity.RESULT_OK<code> for success,
-     *   or one of these errors:
-     *   <code>RESULT_ERROR_GENERIC_FAILURE</code>
-     *   <code>RESULT_ERROR_RADIO_OFF</code>
-     *   <code>RESULT_ERROR_NULL_PDU</code>.
-     * @param deliveryIntents if not null, an <code>ArrayList</code> of
-     *   <code>PendingIntent</code>s (one for each message part) that is
-     *   broadcast when the corresponding message part has been delivered
-     *   to the recipient.  The raw pdu of the status report is in the
-     *   extended data ("pdu").
-     */
-    void sendMultipartText(in String destinationAddress, in String scAddress,
-            in List<String> parts, in List<PendingIntent> sentIntents,
-            in List<PendingIntent> deliveryIntents);
-
-    /**
-     * Enable reception of cell broadcast (SMS-CB) messages with the given
-     * message identifier. Note that if two different clients enable the same
-     * message identifier, they must both disable it for the device to stop
-     * receiving those messages.
-     *
-     * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
-     *   C.R1001-G (3GPP2)
-     * @return true if successful, false otherwise
-     *
-     * @see #disableCellBroadcast(int)
-     */
-    boolean enableCellBroadcast(int messageIdentifier);
-
-    /**
-     * Disable reception of cell broadcast (SMS-CB) messages with the given
-     * message identifier. Note that if two different clients enable the same
-     * message identifier, they must both disable it for the device to stop
-     * receiving those messages.
-     *
-     * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or
-     *   C.R1001-G (3GPP2)
-     * @return true if successful, false otherwise
-     *
-     * @see #enableCellBroadcast(int)
-     */
-    boolean disableCellBroadcast(int messageIdentifier);
-
-    /*
-     * Enable reception of cell broadcast (SMS-CB) messages with the given
-     * message identifier range. Note that if two different clients enable
-     * a message identifier range, they must both disable it for the device
-     * to stop receiving those messages.
-     *
-     * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or
-     *   C.R1001-G (3GPP2)
-     * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
-     *   C.R1001-G (3GPP2)
-     * @return true if successful, false otherwise
-     *
-     * @see #disableCellBroadcastRange(int, int)
-     */
-    boolean enableCellBroadcastRange(int startMessageId, int endMessageId);
-
-    /**
-     * Disable reception of cell broadcast (SMS-CB) messages with the given
-     * message identifier range. Note that if two different clients enable
-     * a message identifier range, they must both disable it for the device
-     * to stop receiving those messages.
-     *
-     * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or
-     *   C.R1001-G (3GPP2)
-     * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or
-     *   C.R1001-G (3GPP2)
-     * @return true if successful, false otherwise
-     *
-     * @see #enableCellBroadcastRange(int, int)
-     */
-    boolean disableCellBroadcastRange(int startMessageId, int endMessageId);
-
-    /**
-     * Returns the premium SMS send permission for the specified package.
-     * Requires system permission.
-     */
-    int getPremiumSmsPermission(String packageName);
-
-    /**
-     * Set the SMS send permission for the specified package.
-     * Requires system permission.
-     */
-    void setPremiumSmsPermission(String packageName, int permission);
-}
diff --git a/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java b/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java
index 2bab4bb..03c4967 100644
--- a/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManager.java
@@ -25,7 +25,6 @@
 
 import com.android.internal.telephony.uicc.AdnRecord;
 import com.android.internal.telephony.uicc.AdnRecordCache;
-import com.android.internal.telephony.uicc.IccCardApplicationStatus;
 import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
 import com.android.internal.telephony.uicc.IccConstants;
 import com.android.internal.telephony.uicc.IccRecords;
@@ -40,12 +39,12 @@
 public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub {
     protected static final boolean DBG = true;
 
-    protected PhoneBase phone;
-    protected AdnRecordCache adnCache;
+    protected PhoneBase mPhone;
+    protected AdnRecordCache mAdnCache;
     protected final Object mLock = new Object();
-    protected int recordSize[];
-    protected boolean success;
-    protected List<AdnRecord> records;
+    protected int mRecordSize[];
+    protected boolean mSuccess;
+    protected List<AdnRecord> mRecords;
 
     protected static final boolean ALLOW_SIM_OP_IN_UI_THREAD = false;
 
@@ -63,13 +62,13 @@
                     ar = (AsyncResult) msg.obj;
                     synchronized (mLock) {
                         if (ar.exception == null) {
-                            recordSize = (int[])ar.result;
+                            mRecordSize = (int[])ar.result;
                             // recordSize[0]  is the record length
                             // recordSize[1]  is the total length of the EF file
                             // recordSize[2]  is the number of records in the EF file
-                            logd("GET_RECORD_SIZE Size " + recordSize[0] +
-                                    " total " + recordSize[1] +
-                                    " #record " + recordSize[2]);
+                            logd("GET_RECORD_SIZE Size " + mRecordSize[0] +
+                                    " total " + mRecordSize[1] +
+                                    " #record " + mRecordSize[2]);
                         }
                         notifyPending(ar);
                     }
@@ -77,7 +76,7 @@
                 case EVENT_UPDATE_DONE:
                     ar = (AsyncResult) msg.obj;
                     synchronized (mLock) {
-                        success = (ar.exception == null);
+                        mSuccess = (ar.exception == null);
                         notifyPending(ar);
                     }
                     break;
@@ -85,11 +84,11 @@
                     ar = (AsyncResult)msg.obj;
                     synchronized (mLock) {
                         if (ar.exception == null) {
-                            records = (List<AdnRecord>) ar.result;
+                            mRecords = (List<AdnRecord>) ar.result;
                         } else {
                             if(DBG) logd("Cannot load ADN records");
-                            if (records != null) {
-                                records.clear();
+                            if (mRecords != null) {
+                                mRecords.clear();
                             }
                         }
                         notifyPending(ar);
@@ -109,10 +108,10 @@
     };
 
     public IccPhoneBookInterfaceManager(PhoneBase phone) {
-        this.phone = phone;
+        this.mPhone = phone;
         IccRecords r = phone.mIccRecords.get();
         if (r != null) {
-            adnCache = r.getAdnCache();
+            mAdnCache = r.getAdnCache();
         }
     }
 
@@ -121,9 +120,9 @@
 
     public void updateIccRecords(IccRecords iccRecords) {
         if (iccRecords != null) {
-            adnCache = iccRecords.getAdnCache();
+            mAdnCache = iccRecords.getAdnCache();
         } else {
-            adnCache = null;
+            mAdnCache = null;
         }
     }
 
@@ -156,13 +155,14 @@
      * @param pin2 required to update EF_FDN, otherwise must be null
      * @return true for success
      */
+    @Override
     public boolean
     updateAdnRecordsInEfBySearch (int efid,
             String oldTag, String oldPhoneNumber,
             String newTag, String newPhoneNumber, String pin2) {
 
 
-        if (phone.getContext().checkCallingOrSelfPermission(
+        if (mPhone.getContext().checkCallingOrSelfPermission(
                 android.Manifest.permission.WRITE_CONTACTS)
             != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException(
@@ -178,15 +178,15 @@
 
         synchronized(mLock) {
             checkThread();
-            success = false;
+            mSuccess = false;
             AtomicBoolean status = new AtomicBoolean(false);
             Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, status);
             AdnRecord oldAdn = new AdnRecord(oldTag, oldPhoneNumber);
             AdnRecord newAdn = new AdnRecord(newTag, newPhoneNumber);
-            adnCache.updateAdnBySearch(efid, oldAdn, newAdn, pin2, response);
+            mAdnCache.updateAdnBySearch(efid, oldAdn, newAdn, pin2, response);
             waitForResult(status);
         }
-        return success;
+        return mSuccess;
     }
 
     /**
@@ -206,11 +206,12 @@
      * @param pin2 required to update EF_FDN, otherwise must be null
      * @return true for success
      */
+    @Override
     public boolean
     updateAdnRecordsInEfByIndex(int efid, String newTag,
             String newPhoneNumber, int index, String pin2) {
 
-        if (phone.getContext().checkCallingOrSelfPermission(
+        if (mPhone.getContext().checkCallingOrSelfPermission(
                 android.Manifest.permission.WRITE_CONTACTS)
                 != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException(
@@ -222,14 +223,14 @@
                 "("+ newTag + "," + newPhoneNumber + ")"+ " pin2=" + pin2);
         synchronized(mLock) {
             checkThread();
-            success = false;
+            mSuccess = false;
             AtomicBoolean status = new AtomicBoolean(false);
             Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, status);
             AdnRecord newAdn = new AdnRecord(newTag, newPhoneNumber);
-            adnCache.updateAdnByIndex(efid, newAdn, index, pin2, response);
+            mAdnCache.updateAdnByIndex(efid, newAdn, index, pin2, response);
             waitForResult(status);
         }
-        return success;
+        return mSuccess;
     }
 
     /**
@@ -241,6 +242,7 @@
      *            recordSizes[1]  is the total length of the EF file
      *            recordSizes[2]  is the number of records in the EF file
      */
+    @Override
     public abstract int[] getAdnRecordsSize(int efid);
 
     /**
@@ -252,9 +254,10 @@
      * @param efid the EF id of a ADN-like ICC
      * @return List of AdnRecord
      */
+    @Override
     public List<AdnRecord> getAdnRecordsInEf(int efid) {
 
-        if (phone.getContext().checkCallingOrSelfPermission(
+        if (mPhone.getContext().checkCallingOrSelfPermission(
                 android.Manifest.permission.READ_CONTACTS)
                 != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException(
@@ -268,10 +271,10 @@
             checkThread();
             AtomicBoolean status = new AtomicBoolean(false);
             Message response = mBaseHandler.obtainMessage(EVENT_LOAD_DONE, status);
-            adnCache.requestLoadAllAdnLike(efid, adnCache.extensionEfForEf(efid), response);
+            mAdnCache.requestLoadAllAdnLike(efid, mAdnCache.extensionEfForEf(efid), response);
             waitForResult(status);
         }
-        return records;
+        return mRecords;
     }
 
     protected void checkThread() {
@@ -298,7 +301,7 @@
     private int updateEfForIccType(int efid) {
         // Check if we are trying to read ADN records
         if (efid == IccConstants.EF_ADN) {
-            if (phone.getCurrentUiccAppType() == AppType.APPTYPE_USIM) {
+            if (mPhone.getCurrentUiccAppType() == AppType.APPTYPE_USIM) {
                 return IccConstants.EF_PBR;
             }
         }
diff --git a/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManagerProxy.java b/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManagerProxy.java
index 6810fb0..3a2fbc5 100644
--- a/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManagerProxy.java
+++ b/src/java/com/android/internal/telephony/IccPhoneBookInterfaceManagerProxy.java
@@ -16,19 +16,10 @@
 
 package com.android.internal.telephony;
 
-import android.content.pm.PackageManager;
-import android.os.AsyncResult;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
 import android.os.ServiceManager;
-import android.telephony.PhoneNumberUtils;
-import android.telephony.Rlog;
-
 import com.android.internal.telephony.uicc.AdnRecord;
 
 
-import java.util.ArrayList;
 import java.util.List;
 
 
@@ -49,30 +40,34 @@
 
     public void setmIccPhoneBookInterfaceManager(
             IccPhoneBookInterfaceManager iccPhoneBookInterfaceManager) {
-        this.mIccPhoneBookInterfaceManager = iccPhoneBookInterfaceManager;
+        mIccPhoneBookInterfaceManager = iccPhoneBookInterfaceManager;
     }
 
+    @Override
     public boolean
     updateAdnRecordsInEfBySearch (int efid,
             String oldTag, String oldPhoneNumber,
             String newTag, String newPhoneNumber,
-            String pin2) throws android.os.RemoteException {
+            String pin2) {
         return mIccPhoneBookInterfaceManager.updateAdnRecordsInEfBySearch(
                 efid, oldTag, oldPhoneNumber, newTag, newPhoneNumber, pin2);
     }
 
+    @Override
     public boolean
     updateAdnRecordsInEfByIndex(int efid, String newTag,
-            String newPhoneNumber, int index, String pin2) throws android.os.RemoteException {
+            String newPhoneNumber, int index, String pin2) {
         return mIccPhoneBookInterfaceManager.updateAdnRecordsInEfByIndex(efid,
                 newTag, newPhoneNumber, index, pin2);
     }
 
-    public int[] getAdnRecordsSize(int efid) throws android.os.RemoteException {
+    @Override
+    public int[] getAdnRecordsSize(int efid) {
         return mIccPhoneBookInterfaceManager.getAdnRecordsSize(efid);
     }
 
-    public List<AdnRecord> getAdnRecordsInEf(int efid) throws android.os.RemoteException {
+    @Override
+    public List<AdnRecord> getAdnRecordsInEf(int efid) {
         return mIccPhoneBookInterfaceManager.getAdnRecordsInEf(efid);
     }
 }
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index 10ca2cc..03ed244 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -16,9 +16,12 @@
 
 package com.android.internal.telephony;
 
+import android.Manifest;
+import android.app.AppOpsManager;
 import android.app.PendingIntent;
 import android.content.Context;
 import android.os.AsyncResult;
+import android.os.Binder;
 import android.os.Handler;
 import android.os.Message;
 import android.telephony.Rlog;
@@ -41,7 +44,7 @@
  * access Sms in Icc.
  */
 public abstract class IccSmsInterfaceManager extends ISms.Stub {
-    static final String LOG_TAG = "RIL_IccSms";
+    static final String LOG_TAG = "IccSmsInterfaceManager";
     static final boolean DBG = true;
 
     protected final Object mLock = new Object();
@@ -53,8 +56,9 @@
     protected static final int EVENT_SET_BROADCAST_ACTIVATION_DONE = 3;
     protected static final int EVENT_SET_BROADCAST_CONFIG_DONE = 4;
 
-    protected PhoneBase mPhone;
-    protected Context mContext;
+    final protected PhoneBase mPhone;
+    final protected Context mContext;
+    final protected AppOpsManager mAppOps;
     protected SMSDispatcher mDispatcher;
 
     protected Handler mHandler = new Handler() {
@@ -100,6 +104,7 @@
     protected IccSmsInterfaceManager(PhoneBase phone){
         mPhone = phone;
         mContext = phone.getContext();
+        mAppOps = (AppOpsManager)mContext.getSystemService(Context.APP_OPS_SERVICE);
     }
 
     protected void markMessagesAsRead(ArrayList<byte[]> messages) {
@@ -137,9 +142,9 @@
 
     protected void enforceReceiveAndSend(String message) {
         mContext.enforceCallingPermission(
-                "android.permission.RECEIVE_SMS", message);
+                Manifest.permission.RECEIVE_SMS, message);
         mContext.enforceCallingPermission(
-                "android.permission.SEND_SMS", message);
+                Manifest.permission.SEND_SMS, message);
     }
 
     /**
@@ -153,12 +158,17 @@
      * @return success or not
      *
      */
+    @Override
     public boolean
-    updateMessageOnIccEf(int index, int status, byte[] pdu) {
+    updateMessageOnIccEf(String callingPackage, int index, int status, byte[] pdu) {
         if (DBG) log("updateMessageOnIccEf: index=" + index +
                 " status=" + status + " ==> " +
                 "("+ Arrays.toString(pdu) + ")");
         enforceReceiveAndSend("Updating message on Icc");
+        if (mAppOps.noteOp(AppOpsManager.OP_WRITE_ICC_SMS, Binder.getCallingUid(),
+                callingPackage) != AppOpsManager.MODE_ALLOWED) {
+            return false;
+        }
         synchronized(mLock) {
             mSuccess = false;
             Message response = mHandler.obtainMessage(EVENT_UPDATE_DONE);
@@ -199,12 +209,17 @@
      * @return success or not
      *
      */
-    public boolean copyMessageToIccEf(int status, byte[] pdu, byte[] smsc) {
+    @Override
+    public boolean copyMessageToIccEf(String callingPackage, int status, byte[] pdu, byte[] smsc) {
         //NOTE smsc not used in RUIM
         if (DBG) log("copyMessageToIccEf: status=" + status + " ==> " +
                 "pdu=("+ Arrays.toString(pdu) +
                 "), smsc=(" + Arrays.toString(smsc) +")");
         enforceReceiveAndSend("Copying message to Icc");
+        if (mAppOps.noteOp(AppOpsManager.OP_WRITE_ICC_SMS, Binder.getCallingUid(),
+                callingPackage) != AppOpsManager.MODE_ALLOWED) {
+            return false;
+        }
         synchronized(mLock) {
             mSuccess = false;
             Message response = mHandler.obtainMessage(EVENT_UPDATE_DONE);
@@ -226,12 +241,17 @@
      *
      * @return list of SmsRawData of all sms on Icc
      */
-    public List<SmsRawData> getAllMessagesFromIccEf() {
+    @Override
+    public List<SmsRawData> getAllMessagesFromIccEf(String callingPackage) {
         if (DBG) log("getAllMessagesFromEF");
 
         mContext.enforceCallingPermission(
-                "android.permission.RECEIVE_SMS",
+                Manifest.permission.RECEIVE_SMS,
                 "Reading messages from Icc");
+        if (mAppOps.noteOp(AppOpsManager.OP_READ_ICC_SMS, Binder.getCallingUid(),
+                callingPackage) != AppOpsManager.MODE_ALLOWED) {
+            return new ArrayList<SmsRawData>();
+        }
         synchronized(mLock) {
 
             IccFileHandler fh = mPhone.getIccFileHandler();
@@ -280,16 +300,21 @@
      *  broadcast when the message is delivered to the recipient.  The
      *  raw pdu of the status report is in the extended data ("pdu").
      */
-    public void sendData(String destAddr, String scAddr, int destPort,
+    @Override
+    public void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
             byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
         mPhone.getContext().enforceCallingPermission(
-                "android.permission.SEND_SMS",
+                Manifest.permission.SEND_SMS,
                 "Sending SMS message");
         if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
             log("sendData: destAddr=" + destAddr + " scAddr=" + scAddr + " destPort=" +
                 destPort + " data='"+ HexDump.toHexString(data)  + "' sentIntent=" +
                 sentIntent + " deliveryIntent=" + deliveryIntent);
         }
+        if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
+                callingPackage) != AppOpsManager.MODE_ALLOWED) {
+            return;
+        }
         mDispatcher.sendData(destAddr, scAddr, destPort, data, sentIntent, deliveryIntent);
     }
 
@@ -317,16 +342,21 @@
      *  broadcast when the message is delivered to the recipient.  The
      *  raw pdu of the status report is in the extended data ("pdu").
      */
-    public void sendText(String destAddr, String scAddr,
+    @Override
+    public void sendText(String callingPackage, String destAddr, String scAddr,
             String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
         mPhone.getContext().enforceCallingPermission(
-                "android.permission.SEND_SMS",
+                Manifest.permission.SEND_SMS,
                 "Sending SMS message");
         if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
             log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr +
                 " text='"+ text + "' sentIntent=" +
                 sentIntent + " deliveryIntent=" + deliveryIntent);
         }
+        if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
+                callingPackage) != AppOpsManager.MODE_ALLOWED) {
+            return;
+        }
         mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent);
     }
 
@@ -355,10 +385,12 @@
      *   to the recipient.  The raw pdu of the status report is in the
      *   extended data ("pdu").
      */
-    public void sendMultipartText(String destAddr, String scAddr, List<String> parts,
-            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) {
+    @Override
+    public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
+            List<String> parts, List<PendingIntent> sentIntents,
+            List<PendingIntent> deliveryIntents) {
         mPhone.getContext().enforceCallingPermission(
-                "android.permission.SEND_SMS",
+                Manifest.permission.SEND_SMS,
                 "Sending SMS message");
         if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
             int i = 0;
@@ -367,14 +399,20 @@
                         ", part[" + (i++) + "]=" + part);
             }
         }
+        if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
+                callingPackage) != AppOpsManager.MODE_ALLOWED) {
+            return;
+        }
         mDispatcher.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts,
                 (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents);
     }
 
+    @Override
     public int getPremiumSmsPermission(String packageName) {
         return mDispatcher.getPremiumSmsPermission(packageName);
     }
 
+    @Override
     public void setPremiumSmsPermission(String packageName, int permission) {
         mDispatcher.setPremiumSmsPermission(packageName, permission);
     }
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
index f80aa67..eb526ae 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
@@ -26,70 +26,83 @@
 
     public IccSmsInterfaceManagerProxy(IccSmsInterfaceManager
             iccSmsInterfaceManager) {
-        this.mIccSmsInterfaceManager = iccSmsInterfaceManager;
+        mIccSmsInterfaceManager = iccSmsInterfaceManager;
         if(ServiceManager.getService("isms") == null) {
             ServiceManager.addService("isms", this);
         }
     }
 
     public void setmIccSmsInterfaceManager(IccSmsInterfaceManager iccSmsInterfaceManager) {
-        this.mIccSmsInterfaceManager = iccSmsInterfaceManager;
+        mIccSmsInterfaceManager = iccSmsInterfaceManager;
     }
 
+    @Override
     public boolean
-    updateMessageOnIccEf(int index, int status, byte[] pdu) throws android.os.RemoteException {
-         return mIccSmsInterfaceManager.updateMessageOnIccEf(index, status, pdu);
+    updateMessageOnIccEf(String callingPackage, int index, int status, byte[] pdu) {
+         return mIccSmsInterfaceManager.updateMessageOnIccEf(callingPackage, index, status, pdu);
     }
 
-    public boolean copyMessageToIccEf(int status, byte[] pdu,
-            byte[] smsc) throws android.os.RemoteException {
-        return mIccSmsInterfaceManager.copyMessageToIccEf(status, pdu, smsc);
+    @Override
+    public boolean copyMessageToIccEf(String callingPackage, int status, byte[] pdu,
+            byte[] smsc) {
+        return mIccSmsInterfaceManager.copyMessageToIccEf(callingPackage, status, pdu, smsc);
     }
 
-    public List<SmsRawData> getAllMessagesFromIccEf() throws android.os.RemoteException {
-        return mIccSmsInterfaceManager.getAllMessagesFromIccEf();
+    @Override
+    public List<SmsRawData> getAllMessagesFromIccEf(String callingPackage) {
+        return mIccSmsInterfaceManager.getAllMessagesFromIccEf(callingPackage);
     }
 
-    public void sendData(String destAddr, String scAddr, int destPort,
+    @Override
+    public void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
             byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
-        mIccSmsInterfaceManager.sendData(destAddr, scAddr, destPort, data,
+        mIccSmsInterfaceManager.sendData(callingPackage, destAddr, scAddr, destPort, data,
                 sentIntent, deliveryIntent);
     }
 
-    public void sendText(String destAddr, String scAddr,
+    @Override
+    public void sendText(String callingPackage, String destAddr, String scAddr,
             String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
-        mIccSmsInterfaceManager.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent);
+        mIccSmsInterfaceManager.sendText(callingPackage, destAddr, scAddr, text, sentIntent,
+                deliveryIntent);
     }
 
-    public void sendMultipartText(String destAddr, String scAddr,
+    @Override
+    public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
             List<String> parts, List<PendingIntent> sentIntents,
-            List<PendingIntent> deliveryIntents) throws android.os.RemoteException {
-        mIccSmsInterfaceManager.sendMultipartText(destAddr, scAddr,
+            List<PendingIntent> deliveryIntents) {
+        mIccSmsInterfaceManager.sendMultipartText(callingPackage, destAddr, scAddr,
                 parts, sentIntents, deliveryIntents);
     }
 
+    @Override
     public boolean enableCellBroadcast(int messageIdentifier) throws android.os.RemoteException {
         return mIccSmsInterfaceManager.enableCellBroadcast(messageIdentifier);
     }
 
+    @Override
     public boolean disableCellBroadcast(int messageIdentifier) throws android.os.RemoteException {
         return mIccSmsInterfaceManager.disableCellBroadcast(messageIdentifier);
     }
 
+    @Override
     public boolean enableCellBroadcastRange(int startMessageId, int endMessageId)
             throws android.os.RemoteException {
         return mIccSmsInterfaceManager.enableCellBroadcastRange(startMessageId, endMessageId);
     }
 
+    @Override
     public boolean disableCellBroadcastRange(int startMessageId, int endMessageId)
             throws android.os.RemoteException {
         return mIccSmsInterfaceManager.disableCellBroadcastRange(startMessageId, endMessageId);
     }
 
+    @Override
     public int getPremiumSmsPermission(String packageName) {
         return mIccSmsInterfaceManager.getPremiumSmsPermission(packageName);
     }
 
+    @Override
     public void setPremiumSmsPermission(String packageName, int permission) {
         mIccSmsInterfaceManager.setPremiumSmsPermission(packageName, permission);
     }
diff --git a/src/java/com/android/internal/telephony/IccUtils.java b/src/java/com/android/internal/telephony/IccUtils.java
index 795740c..2efb3ee 100644
--- a/src/java/com/android/internal/telephony/IccUtils.java
+++ b/src/java/com/android/internal/telephony/IccUtils.java
@@ -24,8 +24,6 @@
 
 import com.android.internal.telephony.GsmAlphabet;
 import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
 
 /**
  * Various methods, useful for dealing with SIM data.
@@ -118,7 +116,7 @@
     }
 
     /**
-     * Decodes a CDMA style BCD byte like {@link gsmBcdByteToInt}, but
+     * Decodes a CDMA style BCD byte like {@link #gsmBcdByteToInt}, but
      * opposite nibble format. The least significant BCD digit
      * is in the least significant nibble and the most significant
      * is in the most significant nibble.
@@ -406,7 +404,7 @@
                 bitIndex = 7;
             }
             pixels[pixelIndex++] = bitToRGB((currentByte >> bitIndex-- ) & 0x01);
-        };
+        }
 
         if (pixelIndex != numOfPixels) {
             Rlog.e(LOG_TAG, "parse end and size error");
diff --git a/src/java/com/android/internal/telephony/IntRangeManager.java b/src/java/com/android/internal/telephony/IntRangeManager.java
index cc7774d..fc6d1bd 100644
--- a/src/java/com/android/internal/telephony/IntRangeManager.java
+++ b/src/java/com/android/internal/telephony/IntRangeManager.java
@@ -52,10 +52,10 @@
      * non-contiguous IntRanges.
      */
     private class IntRange {
-        int startId;
-        int endId;
+        int mStartId;
+        int mEndId;
         // sorted by earliest start id
-        final ArrayList<ClientRange> clients;
+        final ArrayList<ClientRange> mClients;
 
         /**
          * Create a new IntRange with a single client.
@@ -64,10 +64,10 @@
          * @param client the client requesting the enabled range
          */
         IntRange(int startId, int endId, String client) {
-            this.startId = startId;
-            this.endId = endId;
-            clients = new ArrayList<ClientRange>(INITIAL_CLIENTS_ARRAY_SIZE);
-            clients.add(new ClientRange(startId, endId, client));
+            mStartId = startId;
+            mEndId = endId;
+            mClients = new ArrayList<ClientRange>(INITIAL_CLIENTS_ARRAY_SIZE);
+            mClients.add(new ClientRange(startId, endId, client));
         }
 
         /**
@@ -75,10 +75,10 @@
          * @param clientRange the initial ClientRange to add
          */
         IntRange(ClientRange clientRange) {
-            startId = clientRange.startId;
-            endId = clientRange.endId;
-            clients = new ArrayList<ClientRange>(INITIAL_CLIENTS_ARRAY_SIZE);
-            clients.add(clientRange);
+            mStartId = clientRange.mStartId;
+            mEndId = clientRange.mEndId;
+            mClients = new ArrayList<ClientRange>(INITIAL_CLIENTS_ARRAY_SIZE);
+            mClients.add(clientRange);
         }
 
         /**
@@ -92,11 +92,11 @@
          * @param numElements the number of elements to copy from the original
          */
         IntRange(IntRange intRange, int numElements) {
-            this.startId = intRange.startId;
-            this.endId = intRange.endId;
-            this.clients = new ArrayList<ClientRange>(intRange.clients.size());
+            mStartId = intRange.mStartId;
+            mEndId = intRange.mEndId;
+            mClients = new ArrayList<ClientRange>(intRange.mClients.size());
             for (int i=0; i < numElements; i++) {
-                this.clients.add(intRange.clients.get(i));
+                mClients.add(intRange.mClients.get(i));
             }
         }
 
@@ -110,18 +110,18 @@
          * @param range the new ClientRange to insert
          */
         void insert(ClientRange range) {
-            int len = clients.size();
+            int len = mClients.size();
             for (int i=0; i < len; i++) {
-                ClientRange nextRange = clients.get(i);
-                if (range.startId <= nextRange.startId) {
+                ClientRange nextRange = mClients.get(i);
+                if (range.mStartId <= nextRange.mStartId) {
                     // ignore duplicate ranges from the same client
                     if (!range.equals(nextRange)) {
-                        clients.add(i, range);
+                        mClients.add(i, range);
                     }
                     return;
                 }
             }
-            clients.add(range);    // append to end of list
+            mClients.add(range);    // append to end of list
         }
     }
 
@@ -129,23 +129,23 @@
      * The message id range for a single client.
      */
     private class ClientRange {
-        final int startId;
-        final int endId;
-        final String client;
+        final int mStartId;
+        final int mEndId;
+        final String mClient;
 
         ClientRange(int startId, int endId, String client) {
-            this.startId = startId;
-            this.endId = endId;
-            this.client = client;
+            mStartId = startId;
+            mEndId = endId;
+            mClient = client;
         }
 
         @Override
         public boolean equals(Object o) {
             if (o != null && o instanceof ClientRange) {
                 ClientRange other = (ClientRange) o;
-                return startId == other.startId &&
-                        endId == other.endId &&
-                        client.equals(other.client);
+                return mStartId == other.mStartId &&
+                        mEndId == other.mEndId &&
+                        mClient.equals(other.mClient);
             } else {
                 return false;
             }
@@ -153,7 +153,7 @@
 
         @Override
         public int hashCode() {
-            return (startId * 31 + endId) * 31 + client.hashCode();
+            return (mStartId * 31 + mEndId) * 31 + mClient.hashCode();
         }
     }
 
@@ -189,10 +189,10 @@
 
         for (int startIndex = 0; startIndex < len; startIndex++) {
             IntRange range = mRanges.get(startIndex);
-            if (startId < range.startId) {
+            if (startId < range.mStartId) {
                 // test if new range completely precedes this range
                 // note that [1, 4] and [5, 6] coalesce to [1, 6]
-                if ((endId + 1) < range.startId) {
+                if ((endId + 1) < range.mStartId) {
                     // insert new int range before previous first range
                     if (tryAddSingleRange(startId, endId, true)) {
                         mRanges.add(startIndex, new IntRange(startId, endId, client));
@@ -200,11 +200,11 @@
                     } else {
                         return false;   // failed to update radio
                     }
-                } else if (endId <= range.endId) {
+                } else if (endId <= range.mEndId) {
                     // extend the start of this range
-                    if (tryAddSingleRange(startId, range.startId - 1, true)) {
-                        range.startId = startId;
-                        range.clients.add(0, new ClientRange(startId, endId, client));
+                    if (tryAddSingleRange(startId, range.mStartId - 1, true)) {
+                        range.mStartId = startId;
+                        range.mClients.add(0, new ClientRange(startId, endId, client));
                         return true;
                     } else {
                         return false;   // failed to update radio
@@ -213,13 +213,13 @@
                     // find last range that can coalesce into the new combined range
                     for (int endIndex = startIndex+1; endIndex < len; endIndex++) {
                         IntRange endRange = mRanges.get(endIndex);
-                        if ((endId + 1) < endRange.startId) {
+                        if ((endId + 1) < endRange.mStartId) {
                             // try to add entire new range
                             if (tryAddSingleRange(startId, endId, true)) {
-                                range.startId = startId;
-                                range.endId = endId;
+                                range.mStartId = startId;
+                                range.mEndId = endId;
                                 // insert new ClientRange before existing ranges
-                                range.clients.add(0, new ClientRange(startId, endId, client));
+                                range.mClients.add(0, new ClientRange(startId, endId, client));
                                 // coalesce range with following ranges up to endIndex-1
                                 // remove each range after adding its elements, so the index
                                 // of the next range to join is always startIndex+1.
@@ -228,21 +228,21 @@
                                 int joinIndex = startIndex + 1;
                                 for (int i = joinIndex; i < endIndex; i++) {
                                     IntRange joinRange = mRanges.get(joinIndex);
-                                    range.clients.addAll(joinRange.clients);
+                                    range.mClients.addAll(joinRange.mClients);
                                     mRanges.remove(joinRange);
                                 }
                                 return true;
                             } else {
                                 return false;   // failed to update radio
                             }
-                        } else if (endId <= endRange.endId) {
+                        } else if (endId <= endRange.mEndId) {
                             // add range from start id to start of last overlapping range,
                             // values from endRange.startId to endId are already enabled
-                            if (tryAddSingleRange(startId, endRange.startId - 1, true)) {
-                                range.startId = startId;
-                                range.endId = endRange.endId;
+                            if (tryAddSingleRange(startId, endRange.mStartId - 1, true)) {
+                                range.mStartId = startId;
+                                range.mEndId = endRange.mEndId;
                                 // insert new ClientRange before existing ranges
-                                range.clients.add(0, new ClientRange(startId, endId, client));
+                                range.mClients.add(0, new ClientRange(startId, endId, client));
                                 // coalesce range with following ranges up to endIndex
                                 // remove each range after adding its elements, so the index
                                 // of the next range to join is always startIndex+1.
@@ -251,7 +251,7 @@
                                 int joinIndex = startIndex + 1;
                                 for (int i = joinIndex; i <= endIndex; i++) {
                                     IntRange joinRange = mRanges.get(joinIndex);
-                                    range.clients.addAll(joinRange.clients);
+                                    range.mClients.addAll(joinRange.mClients);
                                     mRanges.remove(joinRange);
                                 }
                                 return true;
@@ -263,10 +263,10 @@
 
                     // endId extends past all existing IntRanges: combine them all together
                     if (tryAddSingleRange(startId, endId, true)) {
-                        range.startId = startId;
-                        range.endId = endId;
+                        range.mStartId = startId;
+                        range.mEndId = endId;
                         // insert new ClientRange before existing ranges
-                        range.clients.add(0, new ClientRange(startId, endId, client));
+                        range.mClients.add(0, new ClientRange(startId, endId, client));
                         // coalesce range with following ranges up to len-1
                         // remove each range after adding its elements, so the index
                         // of the next range to join is always startIndex+1.
@@ -275,7 +275,7 @@
                         int joinIndex = startIndex + 1;
                         for (int i = joinIndex; i < len; i++) {
                             IntRange joinRange = mRanges.get(joinIndex);
-                            range.clients.addAll(joinRange.clients);
+                            range.mClients.addAll(joinRange.mClients);
                             mRanges.remove(joinRange);
                         }
                         return true;
@@ -283,8 +283,8 @@
                         return false;   // failed to update radio
                     }
                 }
-            } else if ((startId + 1) <= range.endId) {
-                if (endId <= range.endId) {
+            } else if ((startId + 1) <= range.mEndId) {
+                if (endId <= range.mEndId) {
                     // completely contained in existing range; no radio changes
                     range.insert(new ClientRange(startId, endId, client));
                     return true;
@@ -293,7 +293,7 @@
                     int endIndex = startIndex;
                     for (int testIndex = startIndex+1; testIndex < len; testIndex++) {
                         IntRange testRange = mRanges.get(testIndex);
-                        if ((endId + 1) < testRange.startId) {
+                        if ((endId + 1) < testRange.mStartId) {
                             break;
                         } else {
                             endIndex = testIndex;
@@ -303,8 +303,8 @@
                     if (endIndex == startIndex) {
                         // add range from range.endId+1 to endId,
                         // values from startId to range.endId are already enabled
-                        if (tryAddSingleRange(range.endId + 1, endId, true)) {
-                            range.endId = endId;
+                        if (tryAddSingleRange(range.mEndId + 1, endId, true)) {
+                            range.mEndId = endId;
                             range.insert(new ClientRange(startId, endId, client));
                             return true;
                         } else {
@@ -317,9 +317,9 @@
                     // if endId > endRange.endId, then enable range from range.endId+1 to endId,
                     // else enable range from range.endId+1 to endRange.startId-1, because
                     // values from endRange.startId to endId have already been added.
-                    int newRangeEndId = (endId <= endRange.endId) ? endRange.startId - 1 : endId;
-                    if (tryAddSingleRange(range.endId + 1, newRangeEndId, true)) {
-                        range.endId = endId;
+                    int newRangeEndId = (endId <= endRange.mEndId) ? endRange.mStartId - 1 : endId;
+                    if (tryAddSingleRange(range.mEndId + 1, newRangeEndId, true)) {
+                        range.mEndId = endId;
                         // insert new ClientRange in place
                         range.insert(new ClientRange(startId, endId, client));
                         // coalesce range with following ranges up to endIndex-1
@@ -330,7 +330,7 @@
                         int joinIndex = startIndex + 1;
                         for (int i = joinIndex; i < endIndex; i++) {
                             IntRange joinRange = mRanges.get(joinIndex);
-                            range.clients.addAll(joinRange.clients);
+                            range.mClients.addAll(joinRange.mClients);
                             mRanges.remove(joinRange);
                         }
                         return true;
@@ -365,18 +365,18 @@
 
         for (int i=0; i < len; i++) {
             IntRange range = mRanges.get(i);
-            if (startId < range.startId) {
+            if (startId < range.mStartId) {
                 return false;   // not found
-            } else if (endId <= range.endId) {
+            } else if (endId <= range.mEndId) {
                 // found the IntRange that encloses the client range, if any
                 // search for it in the clients list
-                ArrayList<ClientRange> clients = range.clients;
+                ArrayList<ClientRange> clients = range.mClients;
 
                 // handle common case of IntRange containing one ClientRange
                 int crLength = clients.size();
                 if (crLength == 1) {
                     ClientRange cr = clients.get(0);
-                    if (cr.startId == startId && cr.endId == endId && cr.client.equals(client)) {
+                    if (cr.mStartId == startId && cr.mEndId == endId && cr.mClient.equals(client)) {
                         // disable range in radio then remove the entire IntRange
                         if (tryAddSingleRange(startId, endId, false)) {
                             mRanges.remove(i);
@@ -398,18 +398,18 @@
 
                 for (int crIndex=0; crIndex < crLength; crIndex++) {
                     ClientRange cr = clients.get(crIndex);
-                    if (cr.startId == startId && cr.endId == endId && cr.client.equals(client)) {
+                    if (cr.mStartId == startId && cr.mEndId == endId && cr.mClient.equals(client)) {
                         // found the ClientRange to remove, check if it's the last in the list
                         if (crIndex == crLength - 1) {
-                            if (range.endId == largestEndId) {
+                            if (range.mEndId == largestEndId) {
                                 // no channels to remove from radio; return success
                                 clients.remove(crIndex);
                                 return true;
                             } else {
                                 // disable the channels at the end and lower the end id
-                                if (tryAddSingleRange(largestEndId + 1, range.endId, false)) {
+                                if (tryAddSingleRange(largestEndId + 1, range.mEndId, false)) {
                                     clients.remove(crIndex);
-                                    range.endId = largestEndId;
+                                    range.mEndId = largestEndId;
                                     return true;
                                 } else {
                                     return false;
@@ -427,15 +427,15 @@
                             // the start id of the IntRange.
                             // We know there are at least two ClientRanges in the list,
                             // so clients.get(1) should always succeed.
-                            int nextStartId = clients.get(1).startId;
-                            if (nextStartId != range.startId) {
+                            int nextStartId = clients.get(1).mStartId;
+                            if (nextStartId != range.mStartId) {
                                 startUpdate();
                                 updateStarted = true;
-                                addRange(range.startId, nextStartId - 1, false);
-                                rangeCopy.startId = nextStartId;
+                                addRange(range.mStartId, nextStartId - 1, false);
+                                rangeCopy.mStartId = nextStartId;
                             }
                             // init largestEndId
-                            largestEndId = clients.get(1).endId;
+                            largestEndId = clients.get(1).mEndId;
                         }
 
                         // go through remaining ClientRanges, creating new IntRanges when
@@ -447,20 +447,20 @@
                         IntRange currentRange = rangeCopy;
                         for (int nextIndex = crIndex + 1; nextIndex < crLength; nextIndex++) {
                             ClientRange nextCr = clients.get(nextIndex);
-                            if (nextCr.startId > largestEndId + 1) {
+                            if (nextCr.mStartId > largestEndId + 1) {
                                 if (!updateStarted) {
                                     startUpdate();
                                     updateStarted = true;
                                 }
-                                addRange(largestEndId + 1, nextCr.startId - 1, false);
-                                currentRange.endId = largestEndId;
+                                addRange(largestEndId + 1, nextCr.mStartId - 1, false);
+                                currentRange.mEndId = largestEndId;
                                 newRanges.add(currentRange);
                                 currentRange = new IntRange(nextCr);
                             } else {
-                                currentRange.clients.add(nextCr);
+                                currentRange.mClients.add(nextCr);
                             }
-                            if (nextCr.endId > largestEndId) {
-                                largestEndId = nextCr.endId;
+                            if (nextCr.mEndId > largestEndId) {
+                                largestEndId = nextCr.mEndId;
                             }
                         }
 
@@ -471,7 +471,7 @@
                                 updateStarted = true;
                             }
                             addRange(largestEndId + 1, endId, false);
-                            currentRange.endId = largestEndId;
+                            currentRange.mEndId = largestEndId;
                         }
                         newRanges.add(currentRange);
 
@@ -485,8 +485,8 @@
                         return true;
                     } else {
                         // not the ClientRange to remove; save highest end ID seen so far
-                        if (cr.endId > largestEndId) {
-                            largestEndId = cr.endId;
+                        if (cr.mEndId > largestEndId) {
+                            largestEndId = cr.mEndId;
                         }
                     }
                 }
@@ -507,20 +507,20 @@
         Iterator<IntRange> iterator = mRanges.iterator();
         if (iterator.hasNext()) {
             IntRange range = iterator.next();
-            int start = range.startId;
-            int end = range.endId;
+            int start = range.mStartId;
+            int end = range.mEndId;
             // accumulate ranges of [startId, endId]
             while (iterator.hasNext()) {
                 IntRange nextNode = iterator.next();
                 // [startIdA, endIdA], [endIdA + 1, endIdB] -> [startIdA, endIdB]
-                if (nextNode.startId <= (end + 1)) {
-                    if (nextNode.endId > end) {
-                        end = nextNode.endId;
+                if (nextNode.mStartId <= (end + 1)) {
+                    if (nextNode.mEndId > end) {
+                        end = nextNode.mEndId;
                     }
                 } else {
                     addRange(start, end, true);
-                    start = nextNode.startId;
-                    end = nextNode.endId;
+                    start = nextNode.mStartId;
+                    end = nextNode.mEndId;
                 }
             }
             // add final range
diff --git a/src/java/com/android/internal/telephony/MccTable.java b/src/java/com/android/internal/telephony/MccTable.java
index 8a2f30e..0839f2d 100644
--- a/src/java/com/android/internal/telephony/MccTable.java
+++ b/src/java/com/android/internal/telephony/MccTable.java
@@ -42,30 +42,31 @@
 {
     static final String LOG_TAG = "MccTable";
 
-    static ArrayList<MccEntry> table;
+    static ArrayList<MccEntry> sTable;
 
     static class MccEntry implements Comparable<MccEntry>
     {
-        int mcc;
-        String iso;
-        int smallestDigitsMnc;
-        String language;
+        int mMcc;
+        String mIso;
+        int mSmallestDigitsMnc;
+        String mLanguage;
 
         MccEntry(int mnc, String iso, int smallestDigitsMCC) {
             this(mnc, iso, smallestDigitsMCC, null);
         }
 
         MccEntry(int mnc, String iso, int smallestDigitsMCC, String language) {
-            this.mcc = mnc;
-            this.iso = iso;
-            this.smallestDigitsMnc = smallestDigitsMCC;
-            this.language = language;
+            mMcc = mnc;
+            mIso = iso;
+            mSmallestDigitsMnc = smallestDigitsMCC;
+            mLanguage = language;
         }
 
 
+        @Override
         public int compareTo(MccEntry o)
         {
-            return mcc - o.mcc;
+            return mMcc - o.mMcc;
         }
     }
 
@@ -78,12 +79,12 @@
 
         m = new MccEntry(mcc, null, 0);
 
-        index = Collections.binarySearch(table, m);
+        index = Collections.binarySearch(sTable, m);
 
         if (index < 0) {
             return null;
         } else {
-            return table.get(index);
+            return sTable.get(index);
         }
     }
 
@@ -96,14 +97,14 @@
         MccEntry entry;
 
         entry = entryForMcc(mcc);
-        if (entry == null || entry.iso == null) {
+        if (entry == null || entry.mIso == null) {
             return null;
         } else {
             Locale locale;
-            if (entry.language == null) {
-                locale = new Locale(entry.iso);
+            if (entry.mLanguage == null) {
+                locale = new Locale(entry.mIso);
             } else {
-                locale = new Locale(entry.language, entry.iso);
+                locale = new Locale(entry.mLanguage, entry.mIso);
             }
             String[] tz = TimeZoneNames.forLocale(locale);
             if (tz.length == 0) return null;
@@ -126,7 +127,7 @@
         if (entry == null) {
             return "";
         } else {
-            return entry.iso;
+            return entry.mIso;
         }
     }
 
@@ -143,7 +144,7 @@
         if (entry == null) {
             return null;
         } else {
-            return entry.language;
+            return entry.mLanguage;
         }
     }
 
@@ -162,7 +163,7 @@
         if (entry == null) {
             return 2;
         } else {
-            return entry.smallestDigitsMnc;
+            return entry.mSmallestDigitsMnc;
         }
     }
 
@@ -313,7 +314,7 @@
     }
 
     static {
-        table = new ArrayList<MccEntry>(240);
+        sTable = new ArrayList<MccEntry>(240);
 
 
         /*
@@ -331,242 +332,242 @@
          *
          */
 
-		table.add(new MccEntry(202,"gr",2));	//Greece
-		table.add(new MccEntry(204,"nl",2,"nl"));	//Netherlands (Kingdom of the)
-		table.add(new MccEntry(206,"be",2));	//Belgium
-		table.add(new MccEntry(208,"fr",2,"fr"));	//France
-		table.add(new MccEntry(212,"mc",2));	//Monaco (Principality of)
-		table.add(new MccEntry(213,"ad",2));	//Andorra (Principality of)
-		table.add(new MccEntry(214,"es",2,"es"));	//Spain
-		table.add(new MccEntry(216,"hu",2));	//Hungary (Republic of)
-		table.add(new MccEntry(218,"ba",2));	//Bosnia and Herzegovina
-		table.add(new MccEntry(219,"hr",2));	//Croatia (Republic of)
-		table.add(new MccEntry(220,"rs",2));	//Serbia and Montenegro
-		table.add(new MccEntry(222,"it",2,"it"));	//Italy
-		table.add(new MccEntry(225,"va",2,"it"));	//Vatican City State
-		table.add(new MccEntry(226,"ro",2));	//Romania
-		table.add(new MccEntry(228,"ch",2,"de"));	//Switzerland (Confederation of)
-		table.add(new MccEntry(230,"cz",2,"cs"));	//Czech Republic
-		table.add(new MccEntry(231,"sk",2));	//Slovak Republic
-		table.add(new MccEntry(232,"at",2,"de"));	//Austria
-		table.add(new MccEntry(234,"gb",2,"en"));	//United Kingdom of Great Britain and Northern Ireland
-		table.add(new MccEntry(235,"gb",2,"en"));	//United Kingdom of Great Britain and Northern Ireland
-		table.add(new MccEntry(238,"dk",2));	//Denmark
-		table.add(new MccEntry(240,"se",2));	//Sweden
-		table.add(new MccEntry(242,"no",2));	//Norway
-		table.add(new MccEntry(244,"fi",2));	//Finland
-		table.add(new MccEntry(246,"lt",2));	//Lithuania (Republic of)
-		table.add(new MccEntry(247,"lv",2));	//Latvia (Republic of)
-		table.add(new MccEntry(248,"ee",2));	//Estonia (Republic of)
-		table.add(new MccEntry(250,"ru",2));	//Russian Federation
-		table.add(new MccEntry(255,"ua",2));	//Ukraine
-		table.add(new MccEntry(257,"by",2));	//Belarus (Republic of)
-		table.add(new MccEntry(259,"md",2));	//Moldova (Republic of)
-		table.add(new MccEntry(260,"pl",2));	//Poland (Republic of)
-		table.add(new MccEntry(262,"de",2,"de"));	//Germany (Federal Republic of)
-		table.add(new MccEntry(266,"gi",2));	//Gibraltar
-		table.add(new MccEntry(268,"pt",2));	//Portugal
-		table.add(new MccEntry(270,"lu",2));	//Luxembourg
-		table.add(new MccEntry(272,"ie",2,"en"));	//Ireland
-		table.add(new MccEntry(274,"is",2));	//Iceland
-		table.add(new MccEntry(276,"al",2));	//Albania (Republic of)
-		table.add(new MccEntry(278,"mt",2));	//Malta
-		table.add(new MccEntry(280,"cy",2));	//Cyprus (Republic of)
-		table.add(new MccEntry(282,"ge",2));	//Georgia
-		table.add(new MccEntry(283,"am",2));	//Armenia (Republic of)
-		table.add(new MccEntry(284,"bg",2));	//Bulgaria (Republic of)
-		table.add(new MccEntry(286,"tr",2));	//Turkey
-		table.add(new MccEntry(288,"fo",2));	//Faroe Islands
-                table.add(new MccEntry(289,"ge",2));    //Abkhazia (Georgia)
-		table.add(new MccEntry(290,"gl",2));	//Greenland (Denmark)
-		table.add(new MccEntry(292,"sm",2));	//San Marino (Republic of)
-		table.add(new MccEntry(293,"si",2));	//Slovenia (Republic of)
-                table.add(new MccEntry(294,"mk",2));   //The Former Yugoslav Republic of Macedonia
-		table.add(new MccEntry(295,"li",2));	//Liechtenstein (Principality of)
-                table.add(new MccEntry(297,"me",2));    //Montenegro (Republic of)
-		table.add(new MccEntry(302,"ca",3,""));	//Canada
-		table.add(new MccEntry(308,"pm",2));	//Saint Pierre and Miquelon (Collectivit territoriale de la Rpublique franaise)
-		table.add(new MccEntry(310,"us",3,"en"));	//United States of America
-		table.add(new MccEntry(311,"us",3,"en"));	//United States of America
-		table.add(new MccEntry(312,"us",3,"en"));	//United States of America
-		table.add(new MccEntry(313,"us",3,"en"));	//United States of America
-		table.add(new MccEntry(314,"us",3,"en"));	//United States of America
-		table.add(new MccEntry(315,"us",3,"en"));	//United States of America
-		table.add(new MccEntry(316,"us",3,"en"));	//United States of America
-		table.add(new MccEntry(330,"pr",2));	//Puerto Rico
-		table.add(new MccEntry(332,"vi",2));	//United States Virgin Islands
-		table.add(new MccEntry(334,"mx",3));	//Mexico
-		table.add(new MccEntry(338,"jm",3));	//Jamaica
-		table.add(new MccEntry(340,"gp",2));	//Guadeloupe (French Department of)
-		table.add(new MccEntry(342,"bb",3));	//Barbados
-		table.add(new MccEntry(344,"ag",3));	//Antigua and Barbuda
-		table.add(new MccEntry(346,"ky",3));	//Cayman Islands
-		table.add(new MccEntry(348,"vg",3));	//British Virgin Islands
-		table.add(new MccEntry(350,"bm",2));	//Bermuda
-		table.add(new MccEntry(352,"gd",2));	//Grenada
-		table.add(new MccEntry(354,"ms",2));	//Montserrat
-		table.add(new MccEntry(356,"kn",2));	//Saint Kitts and Nevis
-		table.add(new MccEntry(358,"lc",2));	//Saint Lucia
-		table.add(new MccEntry(360,"vc",2));	//Saint Vincent and the Grenadines
-		table.add(new MccEntry(362,"ai",2));	//Netherlands Antilles
-		table.add(new MccEntry(363,"aw",2));	//Aruba
-		table.add(new MccEntry(364,"bs",2));	//Bahamas (Commonwealth of the)
-		table.add(new MccEntry(365,"ai",3));	//Anguilla
-		table.add(new MccEntry(366,"dm",2));	//Dominica (Commonwealth of)
-		table.add(new MccEntry(368,"cu",2));	//Cuba
-		table.add(new MccEntry(370,"do",2));	//Dominican Republic
-		table.add(new MccEntry(372,"ht",2));	//Haiti (Republic of)
-		table.add(new MccEntry(374,"tt",2));	//Trinidad and Tobago
-		table.add(new MccEntry(376,"tc",2));	//Turks and Caicos Islands
-		table.add(new MccEntry(400,"az",2));	//Azerbaijani Republic
-		table.add(new MccEntry(401,"kz",2));	//Kazakhstan (Republic of)
-		table.add(new MccEntry(402,"bt",2));	//Bhutan (Kingdom of)
-		table.add(new MccEntry(404,"in",2));	//India (Republic of)
-		table.add(new MccEntry(405,"in",2));	//India (Republic of)
-		table.add(new MccEntry(410,"pk",2));	//Pakistan (Islamic Republic of)
-		table.add(new MccEntry(412,"af",2));	//Afghanistan
-		table.add(new MccEntry(413,"lk",2));	//Sri Lanka (Democratic Socialist Republic of)
-		table.add(new MccEntry(414,"mm",2));	//Myanmar (Union of)
-		table.add(new MccEntry(415,"lb",2));	//Lebanon
-		table.add(new MccEntry(416,"jo",2));	//Jordan (Hashemite Kingdom of)
-		table.add(new MccEntry(417,"sy",2));	//Syrian Arab Republic
-		table.add(new MccEntry(418,"iq",2));	//Iraq (Republic of)
-		table.add(new MccEntry(419,"kw",2));	//Kuwait (State of)
-		table.add(new MccEntry(420,"sa",2));	//Saudi Arabia (Kingdom of)
-		table.add(new MccEntry(421,"ye",2));	//Yemen (Republic of)
-		table.add(new MccEntry(422,"om",2));	//Oman (Sultanate of)
-                table.add(new MccEntry(423,"ps",2));    //Palestine
-		table.add(new MccEntry(424,"ae",2));	//United Arab Emirates
-		table.add(new MccEntry(425,"il",2));	//Israel (State of)
-		table.add(new MccEntry(426,"bh",2));	//Bahrain (Kingdom of)
-		table.add(new MccEntry(427,"qa",2));	//Qatar (State of)
-		table.add(new MccEntry(428,"mn",2));	//Mongolia
-		table.add(new MccEntry(429,"np",2));	//Nepal
-		table.add(new MccEntry(430,"ae",2));	//United Arab Emirates
-		table.add(new MccEntry(431,"ae",2));	//United Arab Emirates
-		table.add(new MccEntry(432,"ir",2));	//Iran (Islamic Republic of)
-		table.add(new MccEntry(434,"uz",2));	//Uzbekistan (Republic of)
-		table.add(new MccEntry(436,"tj",2));	//Tajikistan (Republic of)
-		table.add(new MccEntry(437,"kg",2));	//Kyrgyz Republic
-		table.add(new MccEntry(438,"tm",2));	//Turkmenistan
-		table.add(new MccEntry(440,"jp",2,"ja"));	//Japan
-		table.add(new MccEntry(441,"jp",2,"ja"));	//Japan
-		table.add(new MccEntry(450,"kr",2,"ko"));	//Korea (Republic of)
-		table.add(new MccEntry(452,"vn",2));	//Viet Nam (Socialist Republic of)
-		table.add(new MccEntry(454,"hk",2));	//"Hong Kong, China"
-		table.add(new MccEntry(455,"mo",2));	//"Macao, China"
-		table.add(new MccEntry(456,"kh",2));	//Cambodia (Kingdom of)
-		table.add(new MccEntry(457,"la",2));	//Lao People's Democratic Republic
-		table.add(new MccEntry(460,"cn",2,"zh"));	//China (People's Republic of)
-		table.add(new MccEntry(461,"cn",2,"zh"));	//China (People's Republic of)
-		table.add(new MccEntry(466,"tw",2));	//"Taiwan, China"
-		table.add(new MccEntry(467,"kp",2));	//Democratic People's Republic of Korea
-		table.add(new MccEntry(470,"bd",2));	//Bangladesh (People's Republic of)
-		table.add(new MccEntry(472,"mv",2));	//Maldives (Republic of)
-		table.add(new MccEntry(502,"my",2));	//Malaysia
-		table.add(new MccEntry(505,"au",2,"en"));	//Australia
-		table.add(new MccEntry(510,"id",2));	//Indonesia (Republic of)
-		table.add(new MccEntry(514,"tl",2));	//Democratic Republic of Timor-Leste
-		table.add(new MccEntry(515,"ph",2));	//Philippines (Republic of the)
-		table.add(new MccEntry(520,"th",2));	//Thailand
-		table.add(new MccEntry(525,"sg",2,"en"));	//Singapore (Republic of)
-		table.add(new MccEntry(528,"bn",2));	//Brunei Darussalam
-		table.add(new MccEntry(530,"nz",2, "en"));	//New Zealand
-		table.add(new MccEntry(534,"mp",2));	//Northern Mariana Islands (Commonwealth of the)
-		table.add(new MccEntry(535,"gu",2));	//Guam
-		table.add(new MccEntry(536,"nr",2));	//Nauru (Republic of)
-		table.add(new MccEntry(537,"pg",2));	//Papua New Guinea
-		table.add(new MccEntry(539,"to",2));	//Tonga (Kingdom of)
-		table.add(new MccEntry(540,"sb",2));	//Solomon Islands
-		table.add(new MccEntry(541,"vu",2));	//Vanuatu (Republic of)
-		table.add(new MccEntry(542,"fj",2));	//Fiji (Republic of)
-		table.add(new MccEntry(543,"wf",2));	//Wallis and Futuna (Territoire franais d'outre-mer)
-		table.add(new MccEntry(544,"as",2));	//American Samoa
-		table.add(new MccEntry(545,"ki",2));	//Kiribati (Republic of)
-		table.add(new MccEntry(546,"nc",2));	//New Caledonia (Territoire franais d'outre-mer)
-		table.add(new MccEntry(547,"pf",2));	//French Polynesia (Territoire franais d'outre-mer)
-		table.add(new MccEntry(548,"ck",2));	//Cook Islands
-		table.add(new MccEntry(549,"ws",2));	//Samoa (Independent State of)
-		table.add(new MccEntry(550,"fm",2));	//Micronesia (Federated States of)
-		table.add(new MccEntry(551,"mh",2));	//Marshall Islands (Republic of the)
-		table.add(new MccEntry(552,"pw",2));	//Palau (Republic of)
-		table.add(new MccEntry(602,"eg",2));	//Egypt (Arab Republic of)
-		table.add(new MccEntry(603,"dz",2));	//Algeria (People's Democratic Republic of)
-		table.add(new MccEntry(604,"ma",2));	//Morocco (Kingdom of)
-		table.add(new MccEntry(605,"tn",2));	//Tunisia
-		table.add(new MccEntry(606,"ly",2));	//Libya (Socialist People's Libyan Arab Jamahiriya)
-		table.add(new MccEntry(607,"gm",2));	//Gambia (Republic of the)
-		table.add(new MccEntry(608,"sn",2));	//Senegal (Republic of)
-		table.add(new MccEntry(609,"mr",2));	//Mauritania (Islamic Republic of)
-		table.add(new MccEntry(610,"ml",2));	//Mali (Republic of)
-		table.add(new MccEntry(611,"gn",2));	//Guinea (Republic of)
-		table.add(new MccEntry(612,"ci",2));	//Cte d'Ivoire (Republic of)
-		table.add(new MccEntry(613,"bf",2));	//Burkina Faso
-		table.add(new MccEntry(614,"ne",2));	//Niger (Republic of the)
-		table.add(new MccEntry(615,"tg",2));	//Togolese Republic
-		table.add(new MccEntry(616,"bj",2));	//Benin (Republic of)
-		table.add(new MccEntry(617,"mu",2));	//Mauritius (Republic of)
-		table.add(new MccEntry(618,"lr",2));	//Liberia (Republic of)
-		table.add(new MccEntry(619,"sl",2));	//Sierra Leone
-		table.add(new MccEntry(620,"gh",2));	//Ghana
-		table.add(new MccEntry(621,"ng",2));	//Nigeria (Federal Republic of)
-		table.add(new MccEntry(622,"td",2));	//Chad (Republic of)
-		table.add(new MccEntry(623,"cf",2));	//Central African Republic
-		table.add(new MccEntry(624,"cm",2));	//Cameroon (Republic of)
-		table.add(new MccEntry(625,"cv",2));	//Cape Verde (Republic of)
-		table.add(new MccEntry(626,"st",2));	//Sao Tome and Principe (Democratic Republic of)
-		table.add(new MccEntry(627,"gq",2));	//Equatorial Guinea (Republic of)
-		table.add(new MccEntry(628,"ga",2));	//Gabonese Republic
-		table.add(new MccEntry(629,"cg",2));	//Congo (Republic of the)
-		table.add(new MccEntry(630,"cg",2));	//Democratic Republic of the Congo
-		table.add(new MccEntry(631,"ao",2));	//Angola (Republic of)
-		table.add(new MccEntry(632,"gw",2));	//Guinea-Bissau (Republic of)
-		table.add(new MccEntry(633,"sc",2));	//Seychelles (Republic of)
-		table.add(new MccEntry(634,"sd",2));	//Sudan (Republic of the)
-		table.add(new MccEntry(635,"rw",2));	//Rwanda (Republic of)
-		table.add(new MccEntry(636,"et",2));	//Ethiopia (Federal Democratic Republic of)
-		table.add(new MccEntry(637,"so",2));	//Somali Democratic Republic
-		table.add(new MccEntry(638,"dj",2));	//Djibouti (Republic of)
-		table.add(new MccEntry(639,"ke",2));	//Kenya (Republic of)
-		table.add(new MccEntry(640,"tz",2));	//Tanzania (United Republic of)
-		table.add(new MccEntry(641,"ug",2));	//Uganda (Republic of)
-		table.add(new MccEntry(642,"bi",2));	//Burundi (Republic of)
-		table.add(new MccEntry(643,"mz",2));	//Mozambique (Republic of)
-		table.add(new MccEntry(645,"zm",2));	//Zambia (Republic of)
-		table.add(new MccEntry(646,"mg",2));	//Madagascar (Republic of)
-		table.add(new MccEntry(647,"re",2));	//Reunion (French Department of)
-		table.add(new MccEntry(648,"zw",2));	//Zimbabwe (Republic of)
-		table.add(new MccEntry(649,"na",2));	//Namibia (Republic of)
-		table.add(new MccEntry(650,"mw",2));	//Malawi
-		table.add(new MccEntry(651,"ls",2));	//Lesotho (Kingdom of)
-		table.add(new MccEntry(652,"bw",2));	//Botswana (Republic of)
-		table.add(new MccEntry(653,"sz",2));	//Swaziland (Kingdom of)
-		table.add(new MccEntry(654,"km",2));	//Comoros (Union of the)
-		table.add(new MccEntry(655,"za",2,"en"));	//South Africa (Republic of)
-		table.add(new MccEntry(657,"er",2));	//Eritrea
-		table.add(new MccEntry(702,"bz",2));	//Belize
-		table.add(new MccEntry(704,"gt",2));	//Guatemala (Republic of)
-		table.add(new MccEntry(706,"sv",2));	//El Salvador (Republic of)
-		table.add(new MccEntry(708,"hn",3));	//Honduras (Republic of)
-		table.add(new MccEntry(710,"ni",2));	//Nicaragua
-		table.add(new MccEntry(712,"cr",2));	//Costa Rica
-		table.add(new MccEntry(714,"pa",2));	//Panama (Republic of)
-		table.add(new MccEntry(716,"pe",2));	//Peru
-		table.add(new MccEntry(722,"ar",3));	//Argentine Republic
-		table.add(new MccEntry(724,"br",2));	//Brazil (Federative Republic of)
-		table.add(new MccEntry(730,"cl",2));	//Chile
-		table.add(new MccEntry(732,"co",3));	//Colombia (Republic of)
-		table.add(new MccEntry(734,"ve",2));	//Venezuela (Bolivarian Republic of)
-		table.add(new MccEntry(736,"bo",2));	//Bolivia (Republic of)
-		table.add(new MccEntry(738,"gy",2));	//Guyana
-		table.add(new MccEntry(740,"ec",2));	//Ecuador
-		table.add(new MccEntry(742,"gf",2));	//French Guiana (French Department of)
-		table.add(new MccEntry(744,"py",2));	//Paraguay (Republic of)
-		table.add(new MccEntry(746,"sr",2));	//Suriname (Republic of)
-		table.add(new MccEntry(748,"uy",2));	//Uruguay (Eastern Republic of)
-		table.add(new MccEntry(750,"fk",2));	//Falkland Islands (Malvinas)
+		sTable.add(new MccEntry(202,"gr",2));	//Greece
+		sTable.add(new MccEntry(204,"nl",2,"nl"));	//Netherlands (Kingdom of the)
+		sTable.add(new MccEntry(206,"be",2));	//Belgium
+		sTable.add(new MccEntry(208,"fr",2,"fr"));	//France
+		sTable.add(new MccEntry(212,"mc",2));	//Monaco (Principality of)
+		sTable.add(new MccEntry(213,"ad",2));	//Andorra (Principality of)
+		sTable.add(new MccEntry(214,"es",2,"es"));	//Spain
+		sTable.add(new MccEntry(216,"hu",2));	//Hungary (Republic of)
+		sTable.add(new MccEntry(218,"ba",2));	//Bosnia and Herzegovina
+		sTable.add(new MccEntry(219,"hr",2));	//Croatia (Republic of)
+		sTable.add(new MccEntry(220,"rs",2));	//Serbia and Montenegro
+		sTable.add(new MccEntry(222,"it",2,"it"));	//Italy
+		sTable.add(new MccEntry(225,"va",2,"it"));	//Vatican City State
+		sTable.add(new MccEntry(226,"ro",2));	//Romania
+		sTable.add(new MccEntry(228,"ch",2,"de"));	//Switzerland (Confederation of)
+		sTable.add(new MccEntry(230,"cz",2,"cs"));	//Czech Republic
+		sTable.add(new MccEntry(231,"sk",2));	//Slovak Republic
+		sTable.add(new MccEntry(232,"at",2,"de"));	//Austria
+		sTable.add(new MccEntry(234,"gb",2,"en"));	//United Kingdom of Great Britain and Northern Ireland
+		sTable.add(new MccEntry(235,"gb",2,"en"));	//United Kingdom of Great Britain and Northern Ireland
+		sTable.add(new MccEntry(238,"dk",2));	//Denmark
+		sTable.add(new MccEntry(240,"se",2));	//Sweden
+		sTable.add(new MccEntry(242,"no",2));	//Norway
+		sTable.add(new MccEntry(244,"fi",2));	//Finland
+		sTable.add(new MccEntry(246,"lt",2));	//Lithuania (Republic of)
+		sTable.add(new MccEntry(247,"lv",2));	//Latvia (Republic of)
+		sTable.add(new MccEntry(248,"ee",2));	//Estonia (Republic of)
+		sTable.add(new MccEntry(250,"ru",2));	//Russian Federation
+		sTable.add(new MccEntry(255,"ua",2));	//Ukraine
+		sTable.add(new MccEntry(257,"by",2));	//Belarus (Republic of)
+		sTable.add(new MccEntry(259,"md",2));	//Moldova (Republic of)
+		sTable.add(new MccEntry(260,"pl",2));	//Poland (Republic of)
+		sTable.add(new MccEntry(262,"de",2,"de"));	//Germany (Federal Republic of)
+		sTable.add(new MccEntry(266,"gi",2));	//Gibraltar
+		sTable.add(new MccEntry(268,"pt",2));	//Portugal
+		sTable.add(new MccEntry(270,"lu",2));	//Luxembourg
+		sTable.add(new MccEntry(272,"ie",2,"en"));	//Ireland
+		sTable.add(new MccEntry(274,"is",2));	//Iceland
+		sTable.add(new MccEntry(276,"al",2));	//Albania (Republic of)
+		sTable.add(new MccEntry(278,"mt",2));	//Malta
+		sTable.add(new MccEntry(280,"cy",2));	//Cyprus (Republic of)
+		sTable.add(new MccEntry(282,"ge",2));	//Georgia
+		sTable.add(new MccEntry(283,"am",2));	//Armenia (Republic of)
+		sTable.add(new MccEntry(284,"bg",2));	//Bulgaria (Republic of)
+		sTable.add(new MccEntry(286,"tr",2));	//Turkey
+		sTable.add(new MccEntry(288,"fo",2));	//Faroe Islands
+                sTable.add(new MccEntry(289,"ge",2));    //Abkhazia (Georgia)
+		sTable.add(new MccEntry(290,"gl",2));	//Greenland (Denmark)
+		sTable.add(new MccEntry(292,"sm",2));	//San Marino (Republic of)
+		sTable.add(new MccEntry(293,"si",2));	//Slovenia (Republic of)
+                sTable.add(new MccEntry(294,"mk",2));   //The Former Yugoslav Republic of Macedonia
+		sTable.add(new MccEntry(295,"li",2));	//Liechtenstein (Principality of)
+                sTable.add(new MccEntry(297,"me",2));    //Montenegro (Republic of)
+		sTable.add(new MccEntry(302,"ca",3,""));	//Canada
+		sTable.add(new MccEntry(308,"pm",2));	//Saint Pierre and Miquelon (Collectivit territoriale de la Rpublique franaise)
+		sTable.add(new MccEntry(310,"us",3,"en"));	//United States of America
+		sTable.add(new MccEntry(311,"us",3,"en"));	//United States of America
+		sTable.add(new MccEntry(312,"us",3,"en"));	//United States of America
+		sTable.add(new MccEntry(313,"us",3,"en"));	//United States of America
+		sTable.add(new MccEntry(314,"us",3,"en"));	//United States of America
+		sTable.add(new MccEntry(315,"us",3,"en"));	//United States of America
+		sTable.add(new MccEntry(316,"us",3,"en"));	//United States of America
+		sTable.add(new MccEntry(330,"pr",2));	//Puerto Rico
+		sTable.add(new MccEntry(332,"vi",2));	//United States Virgin Islands
+		sTable.add(new MccEntry(334,"mx",3));	//Mexico
+		sTable.add(new MccEntry(338,"jm",3));	//Jamaica
+		sTable.add(new MccEntry(340,"gp",2));	//Guadeloupe (French Department of)
+		sTable.add(new MccEntry(342,"bb",3));	//Barbados
+		sTable.add(new MccEntry(344,"ag",3));	//Antigua and Barbuda
+		sTable.add(new MccEntry(346,"ky",3));	//Cayman Islands
+		sTable.add(new MccEntry(348,"vg",3));	//British Virgin Islands
+		sTable.add(new MccEntry(350,"bm",2));	//Bermuda
+		sTable.add(new MccEntry(352,"gd",2));	//Grenada
+		sTable.add(new MccEntry(354,"ms",2));	//Montserrat
+		sTable.add(new MccEntry(356,"kn",2));	//Saint Kitts and Nevis
+		sTable.add(new MccEntry(358,"lc",2));	//Saint Lucia
+		sTable.add(new MccEntry(360,"vc",2));	//Saint Vincent and the Grenadines
+		sTable.add(new MccEntry(362,"ai",2));	//Netherlands Antilles
+		sTable.add(new MccEntry(363,"aw",2));	//Aruba
+		sTable.add(new MccEntry(364,"bs",2));	//Bahamas (Commonwealth of the)
+		sTable.add(new MccEntry(365,"ai",3));	//Anguilla
+		sTable.add(new MccEntry(366,"dm",2));	//Dominica (Commonwealth of)
+		sTable.add(new MccEntry(368,"cu",2));	//Cuba
+		sTable.add(new MccEntry(370,"do",2));	//Dominican Republic
+		sTable.add(new MccEntry(372,"ht",2));	//Haiti (Republic of)
+		sTable.add(new MccEntry(374,"tt",2));	//Trinidad and Tobago
+		sTable.add(new MccEntry(376,"tc",2));	//Turks and Caicos Islands
+		sTable.add(new MccEntry(400,"az",2));	//Azerbaijani Republic
+		sTable.add(new MccEntry(401,"kz",2));	//Kazakhstan (Republic of)
+		sTable.add(new MccEntry(402,"bt",2));	//Bhutan (Kingdom of)
+		sTable.add(new MccEntry(404,"in",2));	//India (Republic of)
+		sTable.add(new MccEntry(405,"in",2));	//India (Republic of)
+		sTable.add(new MccEntry(410,"pk",2));	//Pakistan (Islamic Republic of)
+		sTable.add(new MccEntry(412,"af",2));	//Afghanistan
+		sTable.add(new MccEntry(413,"lk",2));	//Sri Lanka (Democratic Socialist Republic of)
+		sTable.add(new MccEntry(414,"mm",2));	//Myanmar (Union of)
+		sTable.add(new MccEntry(415,"lb",2));	//Lebanon
+		sTable.add(new MccEntry(416,"jo",2));	//Jordan (Hashemite Kingdom of)
+		sTable.add(new MccEntry(417,"sy",2));	//Syrian Arab Republic
+		sTable.add(new MccEntry(418,"iq",2));	//Iraq (Republic of)
+		sTable.add(new MccEntry(419,"kw",2));	//Kuwait (State of)
+		sTable.add(new MccEntry(420,"sa",2));	//Saudi Arabia (Kingdom of)
+		sTable.add(new MccEntry(421,"ye",2));	//Yemen (Republic of)
+		sTable.add(new MccEntry(422,"om",2));	//Oman (Sultanate of)
+                sTable.add(new MccEntry(423,"ps",2));    //Palestine
+		sTable.add(new MccEntry(424,"ae",2));	//United Arab Emirates
+		sTable.add(new MccEntry(425,"il",2));	//Israel (State of)
+		sTable.add(new MccEntry(426,"bh",2));	//Bahrain (Kingdom of)
+		sTable.add(new MccEntry(427,"qa",2));	//Qatar (State of)
+		sTable.add(new MccEntry(428,"mn",2));	//Mongolia
+		sTable.add(new MccEntry(429,"np",2));	//Nepal
+		sTable.add(new MccEntry(430,"ae",2));	//United Arab Emirates
+		sTable.add(new MccEntry(431,"ae",2));	//United Arab Emirates
+		sTable.add(new MccEntry(432,"ir",2));	//Iran (Islamic Republic of)
+		sTable.add(new MccEntry(434,"uz",2));	//Uzbekistan (Republic of)
+		sTable.add(new MccEntry(436,"tj",2));	//Tajikistan (Republic of)
+		sTable.add(new MccEntry(437,"kg",2));	//Kyrgyz Republic
+		sTable.add(new MccEntry(438,"tm",2));	//Turkmenistan
+		sTable.add(new MccEntry(440,"jp",2,"ja"));	//Japan
+		sTable.add(new MccEntry(441,"jp",2,"ja"));	//Japan
+		sTable.add(new MccEntry(450,"kr",2,"ko"));	//Korea (Republic of)
+		sTable.add(new MccEntry(452,"vn",2));	//Viet Nam (Socialist Republic of)
+		sTable.add(new MccEntry(454,"hk",2));	//"Hong Kong, China"
+		sTable.add(new MccEntry(455,"mo",2));	//"Macao, China"
+		sTable.add(new MccEntry(456,"kh",2));	//Cambodia (Kingdom of)
+		sTable.add(new MccEntry(457,"la",2));	//Lao People's Democratic Republic
+		sTable.add(new MccEntry(460,"cn",2,"zh"));	//China (People's Republic of)
+		sTable.add(new MccEntry(461,"cn",2,"zh"));	//China (People's Republic of)
+		sTable.add(new MccEntry(466,"tw",2));	//"Taiwan, China"
+		sTable.add(new MccEntry(467,"kp",2));	//Democratic People's Republic of Korea
+		sTable.add(new MccEntry(470,"bd",2));	//Bangladesh (People's Republic of)
+		sTable.add(new MccEntry(472,"mv",2));	//Maldives (Republic of)
+		sTable.add(new MccEntry(502,"my",2));	//Malaysia
+		sTable.add(new MccEntry(505,"au",2,"en"));	//Australia
+		sTable.add(new MccEntry(510,"id",2));	//Indonesia (Republic of)
+		sTable.add(new MccEntry(514,"tl",2));	//Democratic Republic of Timor-Leste
+		sTable.add(new MccEntry(515,"ph",2));	//Philippines (Republic of the)
+		sTable.add(new MccEntry(520,"th",2));	//Thailand
+		sTable.add(new MccEntry(525,"sg",2,"en"));	//Singapore (Republic of)
+		sTable.add(new MccEntry(528,"bn",2));	//Brunei Darussalam
+		sTable.add(new MccEntry(530,"nz",2, "en"));	//New Zealand
+		sTable.add(new MccEntry(534,"mp",2));	//Northern Mariana Islands (Commonwealth of the)
+		sTable.add(new MccEntry(535,"gu",2));	//Guam
+		sTable.add(new MccEntry(536,"nr",2));	//Nauru (Republic of)
+		sTable.add(new MccEntry(537,"pg",2));	//Papua New Guinea
+		sTable.add(new MccEntry(539,"to",2));	//Tonga (Kingdom of)
+		sTable.add(new MccEntry(540,"sb",2));	//Solomon Islands
+		sTable.add(new MccEntry(541,"vu",2));	//Vanuatu (Republic of)
+		sTable.add(new MccEntry(542,"fj",2));	//Fiji (Republic of)
+		sTable.add(new MccEntry(543,"wf",2));	//Wallis and Futuna (Territoire franais d'outre-mer)
+		sTable.add(new MccEntry(544,"as",2));	//American Samoa
+		sTable.add(new MccEntry(545,"ki",2));	//Kiribati (Republic of)
+		sTable.add(new MccEntry(546,"nc",2));	//New Caledonia (Territoire franais d'outre-mer)
+		sTable.add(new MccEntry(547,"pf",2));	//French Polynesia (Territoire franais d'outre-mer)
+		sTable.add(new MccEntry(548,"ck",2));	//Cook Islands
+		sTable.add(new MccEntry(549,"ws",2));	//Samoa (Independent State of)
+		sTable.add(new MccEntry(550,"fm",2));	//Micronesia (Federated States of)
+		sTable.add(new MccEntry(551,"mh",2));	//Marshall Islands (Republic of the)
+		sTable.add(new MccEntry(552,"pw",2));	//Palau (Republic of)
+		sTable.add(new MccEntry(602,"eg",2));	//Egypt (Arab Republic of)
+		sTable.add(new MccEntry(603,"dz",2));	//Algeria (People's Democratic Republic of)
+		sTable.add(new MccEntry(604,"ma",2));	//Morocco (Kingdom of)
+		sTable.add(new MccEntry(605,"tn",2));	//Tunisia
+		sTable.add(new MccEntry(606,"ly",2));	//Libya (Socialist People's Libyan Arab Jamahiriya)
+		sTable.add(new MccEntry(607,"gm",2));	//Gambia (Republic of the)
+		sTable.add(new MccEntry(608,"sn",2));	//Senegal (Republic of)
+		sTable.add(new MccEntry(609,"mr",2));	//Mauritania (Islamic Republic of)
+		sTable.add(new MccEntry(610,"ml",2));	//Mali (Republic of)
+		sTable.add(new MccEntry(611,"gn",2));	//Guinea (Republic of)
+		sTable.add(new MccEntry(612,"ci",2));	//Cte d'Ivoire (Republic of)
+		sTable.add(new MccEntry(613,"bf",2));	//Burkina Faso
+		sTable.add(new MccEntry(614,"ne",2));	//Niger (Republic of the)
+		sTable.add(new MccEntry(615,"tg",2));	//Togolese Republic
+		sTable.add(new MccEntry(616,"bj",2));	//Benin (Republic of)
+		sTable.add(new MccEntry(617,"mu",2));	//Mauritius (Republic of)
+		sTable.add(new MccEntry(618,"lr",2));	//Liberia (Republic of)
+		sTable.add(new MccEntry(619,"sl",2));	//Sierra Leone
+		sTable.add(new MccEntry(620,"gh",2));	//Ghana
+		sTable.add(new MccEntry(621,"ng",2));	//Nigeria (Federal Republic of)
+		sTable.add(new MccEntry(622,"td",2));	//Chad (Republic of)
+		sTable.add(new MccEntry(623,"cf",2));	//Central African Republic
+		sTable.add(new MccEntry(624,"cm",2));	//Cameroon (Republic of)
+		sTable.add(new MccEntry(625,"cv",2));	//Cape Verde (Republic of)
+		sTable.add(new MccEntry(626,"st",2));	//Sao Tome and Principe (Democratic Republic of)
+		sTable.add(new MccEntry(627,"gq",2));	//Equatorial Guinea (Republic of)
+		sTable.add(new MccEntry(628,"ga",2));	//Gabonese Republic
+		sTable.add(new MccEntry(629,"cg",2));	//Congo (Republic of the)
+		sTable.add(new MccEntry(630,"cg",2));	//Democratic Republic of the Congo
+		sTable.add(new MccEntry(631,"ao",2));	//Angola (Republic of)
+		sTable.add(new MccEntry(632,"gw",2));	//Guinea-Bissau (Republic of)
+		sTable.add(new MccEntry(633,"sc",2));	//Seychelles (Republic of)
+		sTable.add(new MccEntry(634,"sd",2));	//Sudan (Republic of the)
+		sTable.add(new MccEntry(635,"rw",2));	//Rwanda (Republic of)
+		sTable.add(new MccEntry(636,"et",2));	//Ethiopia (Federal Democratic Republic of)
+		sTable.add(new MccEntry(637,"so",2));	//Somali Democratic Republic
+		sTable.add(new MccEntry(638,"dj",2));	//Djibouti (Republic of)
+		sTable.add(new MccEntry(639,"ke",2));	//Kenya (Republic of)
+		sTable.add(new MccEntry(640,"tz",2));	//Tanzania (United Republic of)
+		sTable.add(new MccEntry(641,"ug",2));	//Uganda (Republic of)
+		sTable.add(new MccEntry(642,"bi",2));	//Burundi (Republic of)
+		sTable.add(new MccEntry(643,"mz",2));	//Mozambique (Republic of)
+		sTable.add(new MccEntry(645,"zm",2));	//Zambia (Republic of)
+		sTable.add(new MccEntry(646,"mg",2));	//Madagascar (Republic of)
+		sTable.add(new MccEntry(647,"re",2));	//Reunion (French Department of)
+		sTable.add(new MccEntry(648,"zw",2));	//Zimbabwe (Republic of)
+		sTable.add(new MccEntry(649,"na",2));	//Namibia (Republic of)
+		sTable.add(new MccEntry(650,"mw",2));	//Malawi
+		sTable.add(new MccEntry(651,"ls",2));	//Lesotho (Kingdom of)
+		sTable.add(new MccEntry(652,"bw",2));	//Botswana (Republic of)
+		sTable.add(new MccEntry(653,"sz",2));	//Swaziland (Kingdom of)
+		sTable.add(new MccEntry(654,"km",2));	//Comoros (Union of the)
+		sTable.add(new MccEntry(655,"za",2,"en"));	//South Africa (Republic of)
+		sTable.add(new MccEntry(657,"er",2));	//Eritrea
+		sTable.add(new MccEntry(702,"bz",2));	//Belize
+		sTable.add(new MccEntry(704,"gt",2));	//Guatemala (Republic of)
+		sTable.add(new MccEntry(706,"sv",2));	//El Salvador (Republic of)
+		sTable.add(new MccEntry(708,"hn",3));	//Honduras (Republic of)
+		sTable.add(new MccEntry(710,"ni",2));	//Nicaragua
+		sTable.add(new MccEntry(712,"cr",2));	//Costa Rica
+		sTable.add(new MccEntry(714,"pa",2));	//Panama (Republic of)
+		sTable.add(new MccEntry(716,"pe",2));	//Peru
+		sTable.add(new MccEntry(722,"ar",3));	//Argentine Republic
+		sTable.add(new MccEntry(724,"br",2));	//Brazil (Federative Republic of)
+		sTable.add(new MccEntry(730,"cl",2));	//Chile
+		sTable.add(new MccEntry(732,"co",3));	//Colombia (Republic of)
+		sTable.add(new MccEntry(734,"ve",2));	//Venezuela (Bolivarian Republic of)
+		sTable.add(new MccEntry(736,"bo",2));	//Bolivia (Republic of)
+		sTable.add(new MccEntry(738,"gy",2));	//Guyana
+		sTable.add(new MccEntry(740,"ec",2));	//Ecuador
+		sTable.add(new MccEntry(742,"gf",2));	//French Guiana (French Department of)
+		sTable.add(new MccEntry(744,"py",2));	//Paraguay (Republic of)
+		sTable.add(new MccEntry(746,"sr",2));	//Suriname (Republic of)
+		sTable.add(new MccEntry(748,"uy",2));	//Uruguay (Eastern Republic of)
+		sTable.add(new MccEntry(750,"fk",2));	//Falkland Islands (Malvinas)
         //table.add(new MccEntry(901,"",2));	//"International Mobile, shared code"
 
-        Collections.sort(table);
+        Collections.sort(sTable);
     }
 }
diff --git a/src/java/com/android/internal/telephony/OperatorInfo.java b/src/java/com/android/internal/telephony/OperatorInfo.java
index 1999cb3..49c96a9 100644
--- a/src/java/com/android/internal/telephony/OperatorInfo.java
+++ b/src/java/com/android/internal/telephony/OperatorInfo.java
@@ -30,31 +30,31 @@
         FORBIDDEN;
     }
 
-    private String operatorAlphaLong;
-    private String operatorAlphaShort;
-    private String operatorNumeric;
+    private String mOperatorAlphaLong;
+    private String mOperatorAlphaShort;
+    private String mOperatorNumeric;
 
-    private State state = State.UNKNOWN;
+    private State mState = State.UNKNOWN;
 
 
     public String
     getOperatorAlphaLong() {
-        return operatorAlphaLong;
+        return mOperatorAlphaLong;
     }
 
     public String
     getOperatorAlphaShort() {
-        return operatorAlphaShort;
+        return mOperatorAlphaShort;
     }
 
     public String
     getOperatorNumeric() {
-        return operatorNumeric;
+        return mOperatorNumeric;
     }
 
     public State
     getState() {
-        return state;
+        return mState;
     }
 
     OperatorInfo(String operatorAlphaLong,
@@ -62,11 +62,11 @@
                 String operatorNumeric,
                 State state) {
 
-        this.operatorAlphaLong = operatorAlphaLong;
-        this.operatorAlphaShort = operatorAlphaShort;
-        this.operatorNumeric = operatorNumeric;
+        mOperatorAlphaLong = operatorAlphaLong;
+        mOperatorAlphaShort = operatorAlphaShort;
+        mOperatorNumeric = operatorNumeric;
 
-        this.state = state;
+        mState = state;
     }
 
 
@@ -97,11 +97,12 @@
     }
 
 
+    @Override
     public String toString() {
-        return "OperatorInfo " + operatorAlphaLong
-                + "/" + operatorAlphaShort
-                + "/" + operatorNumeric
-                + "/" + state;
+        return "OperatorInfo " + mOperatorAlphaLong
+                + "/" + mOperatorAlphaShort
+                + "/" + mOperatorNumeric
+                + "/" + mState;
     }
 
     /**
@@ -112,6 +113,7 @@
      * NetworkQueryService to fix 1128695.
      */
 
+    @Override
     public int describeContents() {
         return 0;
     }
@@ -120,11 +122,12 @@
      * Implement the Parcelable interface.
      * Method to serialize a OperatorInfo object.
      */
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
-        dest.writeString(operatorAlphaLong);
-        dest.writeString(operatorAlphaShort);
-        dest.writeString(operatorNumeric);
-        dest.writeSerializable(state);
+        dest.writeString(mOperatorAlphaLong);
+        dest.writeString(mOperatorAlphaShort);
+        dest.writeString(mOperatorNumeric);
+        dest.writeSerializable(mState);
     }
 
     /**
@@ -133,6 +136,7 @@
      */
     public static final Creator<OperatorInfo> CREATOR =
         new Creator<OperatorInfo>() {
+            @Override
             public OperatorInfo createFromParcel(Parcel in) {
                 OperatorInfo opInfo = new OperatorInfo(
                         in.readString(), /*operatorAlphaLong*/
@@ -142,6 +146,7 @@
                 return opInfo;
             }
 
+            @Override
             public OperatorInfo[] newArray(int size) {
                 return new OperatorInfo[size];
             }
diff --git a/src/java/com/android/internal/telephony/Phone.java b/src/java/com/android/internal/telephony/Phone.java
index fbce476..13c99ea 100644
--- a/src/java/com/android/internal/telephony/Phone.java
+++ b/src/java/com/android/internal/telephony/Phone.java
@@ -21,14 +21,12 @@
 import android.net.LinkProperties;
 import android.os.Handler;
 import android.os.Message;
-import android.os.SystemProperties;
 import android.telephony.CellInfo;
 import android.telephony.CellLocation;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
 
-import com.android.internal.telephony.DataConnection;
 import com.android.internal.telephony.test.SimulatedRadioControl;
 import com.android.internal.telephony.uicc.IsimRecords;
 import com.android.internal.telephony.uicc.UsimServiceTable;
@@ -62,11 +60,11 @@
          * </ul>
          */
         NONE, DATAIN, DATAOUT, DATAINANDOUT, DORMANT;
-    };
+    }
 
     enum SuppService {
       UNKNOWN, SWITCH, SEPARATE, TRANSFER, CONFERENCE, REJECT, HANGUP;
-    };
+    }
 
     // "Features" accessible through the connectivity manager
     static final String FEATURE_ENABLE_MMS = "enableMMS";
@@ -300,7 +298,7 @@
     /**
      * Register for getting notifications for change in the Call State {@link Call.State}
      * This is called PreciseCallState because the call state is more precise than the
-     * {@link Phone.State} which can be obtained using the {@link PhoneStateListener}
+     * {@link PhoneConstants.State} which can be obtained using the {@link PhoneStateListener}
      *
      * Resulting events will have an AsyncResult in <code>Message.obj</code>.
      * AsyncResult.userData will be set to the obj argument here.
@@ -543,7 +541,7 @@
     void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj);
 
     /**
-     * Unegister for notifications when a sInCall VoicePrivacy is disabled
+     * Unregister for notifications when a sInCall VoicePrivacy is disabled
      *
      * @param h Handler to be removed from the registrant list.
      */
@@ -559,7 +557,7 @@
     void registerForCdmaOtaStatusChange(Handler h, int what, Object obj);
 
     /**
-     * Unegister for notifications when CDMA OTA Provision status change
+     * Unregister for notifications when CDMA OTA Provision status change
      * @param h Handler to be removed from the registrant list.
      */
     void unregisterForCdmaOtaStatusChange(Handler h);
@@ -1255,7 +1253,7 @@
 
     /**
      * If this is a simulated phone interface, returns a SimulatedRadioControl.
-     * @ return A SimulatedRadioControl if this is a simulated interface;
+     * @return SimulatedRadioControl if this is a simulated interface;
      * otherwise, null.
      */
     SimulatedRadioControl getSimulatedRadioControl();
@@ -1263,7 +1261,7 @@
     /**
      * Enables the specified APN type. Only works for "special" APN types,
      * i.e., not the default APN.
-     * @param type The desired APN type. Cannot be {@link #APN_TYPE_DEFAULT}.
+     * @param type The desired APN type. Cannot be {@link PhoneConstants#APN_TYPE_DEFAULT}.
      * @return <code>APN_ALREADY_ACTIVE</code> if the current APN
      * services the requested type.<br/>
      * <code>APN_TYPE_NOT_AVAILABLE</code> if the carrier does not
@@ -1278,10 +1276,10 @@
     /**
      * Disables the specified APN type, and switches back to the default APN,
      * if necessary. Switching to the default APN will not happen if default
-     * data traffic has been explicitly disabled via a call to {@link #disableDataConnectivity}.
+     * data traffic has been explicitly disabled via a call to ITelephony#disableDataConnectivity.
      * <p/>Only works for "special" APN types,
      * i.e., not the default APN.
-     * @param type The desired APN type. Cannot be {@link #APN_TYPE_DEFAULT}.
+     * @param type The desired APN type. Cannot be {@link PhoneConstants#APN_TYPE_DEFAULT}.
      * @return <code>APN_ALREADY_ACTIVE</code> if the default APN
      * is already active.<br/>
      * <code>APN_REQUEST_STARTED</code> if the request to switch to the default
@@ -1645,7 +1643,8 @@
      * is a tri-state return value as for a period of time
      * the mode may be unknown.
      *
-     * @return {@link #LTE_ON_CDMA_UNKNOWN}, {@link #LTE_ON_CDMA_FALSE} or {@link #LTE_ON_CDMA_TRUE}
+     * @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
+     * or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
      */
     public int getLteOnCdmaMode();
 
diff --git a/src/java/com/android/internal/telephony/PhoneBase.java b/src/java/com/android/internal/telephony/PhoneBase.java
index c62f72f..145cbea 100644
--- a/src/java/com/android/internal/telephony/PhoneBase.java
+++ b/src/java/com/android/internal/telephony/PhoneBase.java
@@ -16,10 +16,7 @@
 
 package com.android.internal.telephony;
 
-import android.app.ActivityManagerNative;
-import android.app.IActivityManager;
 import android.content.Context;
-import android.content.res.Configuration;
 import android.content.SharedPreferences;
 import android.net.LinkCapabilities;
 import android.net.LinkProperties;
@@ -39,21 +36,18 @@
 import android.telephony.Rlog;
 
 import com.android.internal.R;
+import com.android.internal.telephony.dataconnection.DataConnectionTrackerBase;
 import com.android.internal.telephony.test.SimulatedRadioControl;
 import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
 import com.android.internal.telephony.uicc.IccFileHandler;
 import com.android.internal.telephony.uicc.IccRecords;
 import com.android.internal.telephony.uicc.IsimRecords;
-import com.android.internal.telephony.uicc.SIMRecords;
 import com.android.internal.telephony.uicc.UiccCardApplication;
 import com.android.internal.telephony.uicc.UiccController;
 import com.android.internal.telephony.uicc.UsimServiceTable;
-import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
-
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.List;
-import java.util.Locale;
 import java.util.concurrent.atomic.AtomicReference;
 
 
@@ -70,9 +64,7 @@
  */
 
 public abstract class PhoneBase extends Handler implements Phone {
-    private static final String LOG_TAG = "PHONE";
-    private static final boolean LOCAL_DEBUG = true;
-
+    private static final String LOG_TAG = "PhoneBase";
     // Key used to read and write the saved network selection numeric value
     public static final String NETWORK_SELECTION_KEY = "network_selection_key";
     // Key used to read and write the saved network selection operator name
@@ -128,9 +120,9 @@
     public static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key";
 
     /* Instance Variables */
-    public CommandsInterface mCM;
+    public CommandsInterface mCi;
     boolean mDnsCheckDisabled;
-    public DataConnectionTracker mDataConnectionTracker;
+    public DataConnectionTrackerBase mDataConnectionTracker;
     boolean mDoesRilSendMultipleCallRing;
     int mCallRingContinueToken;
     int mCallRingDelay;
@@ -222,10 +214,10 @@
      */
     protected PhoneBase(PhoneNotifier notifier, Context context, CommandsInterface ci,
             boolean unitTestMode) {
-        this.mNotifier = notifier;
-        this.mContext = context;
+        mNotifier = notifier;
+        mContext = context;
         mLooper = Looper.myLooper();
-        mCM = ci;
+        mCi = ci;
 
         setPropertiesByCarrier();
 
@@ -233,7 +225,7 @@
 
         SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
         mDnsCheckDisabled = sp.getBoolean(DNS_SERVER_CHECK_DISABLED_KEY, false);
-        mCM.setOnCallRing(this, EVENT_CALL_RING, null);
+        mCi.setOnCallRing(this, EVENT_CALL_RING, null);
 
         /* "Voice capable" means that this device supports circuit-switched
         * (i.e. voice) phone calls over the telephony network, and is allowed
@@ -269,9 +261,10 @@
         mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);
     }
 
+    @Override
     public void dispose() {
         synchronized(PhoneProxy.lockForRadioTechnologyChange) {
-            mCM.unSetOnCallRing(this);
+            mCi.unSetOnCallRing(this);
             // Must cleanup all connectionS and needs to use sendMessage!
             mDataConnectionTracker.cleanUpAllConnections(null);
             mIsTheCurrentActivePhone = false;
@@ -282,6 +275,7 @@
         }
     }
 
+    @Override
     public void removeReferences() {
         mSmsStorageMonitor = null;
         mSmsUsageMonitor = null;
@@ -337,6 +331,7 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public Context getContext() {
         return mContext;
     }
@@ -349,6 +344,7 @@
      * Useful for lab testing environment.
      * @param b true disables the check, false enables.
      */
+    @Override
     public void disableDnsCheck(boolean b) {
         mDnsCheckDisabled = b;
         SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
@@ -360,11 +356,13 @@
     /**
      * Returns true if the DNS check is currently disabled.
      */
+    @Override
     public boolean isDnsCheckDisabled() {
         return mDnsCheckDisabled;
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForPreciseCallStateChanged(Handler h, int what, Object obj) {
         checkCorrectThread(h);
 
@@ -372,6 +370,7 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForPreciseCallStateChanged(Handler h) {
         mPreciseCallStateRegistrants.remove(h);
     }
@@ -386,6 +385,7 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForUnknownConnection(Handler h, int what, Object obj) {
         checkCorrectThread(h);
 
@@ -393,11 +393,13 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForUnknownConnection(Handler h) {
         mUnknownConnectionRegistrants.remove(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForNewRingingConnection(
             Handler h, int what, Object obj) {
         checkCorrectThread(h);
@@ -406,31 +408,37 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForNewRingingConnection(Handler h) {
         mNewRingingConnectionRegistrants.remove(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj){
-        mCM.registerForInCallVoicePrivacyOn(h,what,obj);
+        mCi.registerForInCallVoicePrivacyOn(h,what,obj);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForInCallVoicePrivacyOn(Handler h){
-        mCM.unregisterForInCallVoicePrivacyOn(h);
+        mCi.unregisterForInCallVoicePrivacyOn(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj){
-        mCM.registerForInCallVoicePrivacyOff(h,what,obj);
+        mCi.registerForInCallVoicePrivacyOff(h,what,obj);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForInCallVoicePrivacyOff(Handler h){
-        mCM.unregisterForInCallVoicePrivacyOff(h);
+        mCi.unregisterForInCallVoicePrivacyOff(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForIncomingRing(
             Handler h, int what, Object obj) {
         checkCorrectThread(h);
@@ -439,11 +447,13 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForIncomingRing(Handler h) {
         mIncomingRingRegistrants.remove(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForDisconnect(Handler h, int what, Object obj) {
         checkCorrectThread(h);
 
@@ -451,11 +461,13 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForDisconnect(Handler h) {
         mDisconnectRegistrants.remove(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForSuppServiceFailed(Handler h, int what, Object obj) {
         checkCorrectThread(h);
 
@@ -463,11 +475,13 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForSuppServiceFailed(Handler h) {
         mSuppServiceFailedRegistrants.remove(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForMmiInitiate(Handler h, int what, Object obj) {
         checkCorrectThread(h);
 
@@ -475,11 +489,13 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForMmiInitiate(Handler h) {
         mMmiRegistrants.remove(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForMmiComplete(Handler h, int what, Object obj) {
         checkCorrectThread(h);
 
@@ -487,6 +503,7 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForMmiComplete(Handler h) {
         checkCorrectThread(h);
 
@@ -513,18 +530,20 @@
 
         // set to auto if the id is empty, otherwise select the network.
         if (TextUtils.isEmpty(networkSelection)) {
-            mCM.setNetworkSelectionModeAutomatic(response);
+            mCi.setNetworkSelectionModeAutomatic(response);
         } else {
-            mCM.setNetworkSelectionModeManual(networkSelection, response);
+            mCi.setNetworkSelectionModeManual(networkSelection, response);
         }
     }
 
     // Inherited documentation suffices.
+    @Override
     public void setUnitTestMode(boolean f) {
         mUnitTestMode = f;
     }
 
     // Inherited documentation suffices.
+    @Override
     public boolean getUnitTestMode() {
         return mUnitTestMode;
     }
@@ -541,6 +560,7 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForServiceStateChanged(
             Handler h, int what, Object obj) {
         checkCorrectThread(h);
@@ -549,30 +569,36 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForServiceStateChanged(Handler h) {
         mServiceStateRegistrants.remove(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForRingbackTone(Handler h, int what, Object obj) {
-        mCM.registerForRingbackTone(h,what,obj);
+        mCi.registerForRingbackTone(h,what,obj);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForRingbackTone(Handler h) {
-        mCM.unregisterForRingbackTone(h);
+        mCi.unregisterForRingbackTone(h);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void registerForResendIncallMute(Handler h, int what, Object obj) {
-        mCM.registerForResendIncallMute(h,what,obj);
+        mCi.registerForResendIncallMute(h,what,obj);
     }
 
     // Inherited documentation suffices.
+    @Override
     public void unregisterForResendIncallMute(Handler h) {
-        mCM.unregisterForResendIncallMute(h);
+        mCi.unregisterForResendIncallMute(h);
     }
 
+    @Override
     public void setEchoSuppressionEnabled(boolean enabled) {
         // no need for regular phone
     }
@@ -589,6 +615,7 @@
     }
 
     // Inherited documentation suffices.
+    @Override
     public SimulatedRadioControl getSimulatedRadioControl() {
         return mSimulatedRadioControl;
     }
@@ -653,6 +680,7 @@
     /**
      * Get state
      */
+    @Override
     public abstract PhoneConstants.State getState();
 
     /**
@@ -702,7 +730,7 @@
     @Override
     public String getIccSerialNumber() {
         IccRecords r = mIccRecords.get();
-        return (r != null) ? r.iccid : "";
+        return (r != null) ? r.iccId : "";
     }
 
     @Override
@@ -734,8 +762,9 @@
     /**
      *  Query the status of the CDMA roaming preference
      */
+    @Override
     public void queryCdmaRoamingPreference(Message response) {
-        mCM.queryCdmaRoamingPreference(response);
+        mCi.queryCdmaRoamingPreference(response);
     }
 
     /**
@@ -754,70 +783,85 @@
     /**
      *  Set the status of the CDMA roaming preference
      */
+    @Override
     public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
-        mCM.setCdmaRoamingPreference(cdmaRoamingType, response);
+        mCi.setCdmaRoamingPreference(cdmaRoamingType, response);
     }
 
     /**
      *  Set the status of the CDMA subscription mode
      */
+    @Override
     public void setCdmaSubscription(int cdmaSubscriptionType, Message response) {
-        mCM.setCdmaSubscriptionSource(cdmaSubscriptionType, response);
+        mCi.setCdmaSubscriptionSource(cdmaSubscriptionType, response);
     }
 
     /**
      *  Set the preferred Network Type: Global, CDMA only or GSM/UMTS only
      */
+    @Override
     public void setPreferredNetworkType(int networkType, Message response) {
-        mCM.setPreferredNetworkType(networkType, response);
+        mCi.setPreferredNetworkType(networkType, response);
     }
 
+    @Override
     public void getPreferredNetworkType(Message response) {
-        mCM.getPreferredNetworkType(response);
+        mCi.getPreferredNetworkType(response);
     }
 
+    @Override
     public void getSmscAddress(Message result) {
-        mCM.getSmscAddress(result);
+        mCi.getSmscAddress(result);
     }
 
+    @Override
     public void setSmscAddress(String address, Message result) {
-        mCM.setSmscAddress(address, result);
+        mCi.setSmscAddress(address, result);
     }
 
+    @Override
     public void setTTYMode(int ttyMode, Message onComplete) {
-        mCM.setTTYMode(ttyMode, onComplete);
+        mCi.setTTYMode(ttyMode, onComplete);
     }
 
+    @Override
     public void queryTTYMode(Message onComplete) {
-        mCM.queryTTYMode(onComplete);
+        mCi.queryTTYMode(onComplete);
     }
 
+    @Override
     public void enableEnhancedVoicePrivacy(boolean enable, Message onComplete) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("enableEnhancedVoicePrivacy");
     }
 
+    @Override
     public void getEnhancedVoicePrivacy(Message onComplete) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("getEnhancedVoicePrivacy");
     }
 
+    @Override
     public void setBandMode(int bandMode, Message response) {
-        mCM.setBandMode(bandMode, response);
+        mCi.setBandMode(bandMode, response);
     }
 
+    @Override
     public void queryAvailableBandMode(Message response) {
-        mCM.queryAvailableBandMode(response);
+        mCi.queryAvailableBandMode(response);
     }
 
+    @Override
     public void invokeOemRilRequestRaw(byte[] data, Message response) {
-        mCM.invokeOemRilRequestRaw(data, response);
+        mCi.invokeOemRilRequestRaw(data, response);
     }
 
+    @Override
     public void invokeOemRilRequestStrings(String[] strings, Message response) {
-        mCM.invokeOemRilRequestStrings(strings, response);
+        mCi.invokeOemRilRequestStrings(strings, response);
     }
 
+    @Override
     public void notifyDataActivity() {
         mNotifier.notifyDataActivity(this);
     }
@@ -875,11 +919,14 @@
         return false;
     }
 
+    @Override
     public abstract String getPhoneName();
 
+    @Override
     public abstract int getPhoneType();
 
     /** @hide */
+    @Override
     public int getVoiceMessageCount(){
         return 0;
     }
@@ -887,6 +934,7 @@
     /**
      * Returns the CDMA ERI icon index to display
      */
+    @Override
     public int getCdmaEriIconIndex() {
         logUnexpectedCdmaMethodCall("getCdmaEriIconIndex");
         return -1;
@@ -897,6 +945,7 @@
      * 0 - ON
      * 1 - FLASHING
      */
+    @Override
     public int getCdmaEriIconMode() {
         logUnexpectedCdmaMethodCall("getCdmaEriIconMode");
         return -1;
@@ -905,54 +954,64 @@
     /**
      * Returns the CDMA ERI text,
      */
+    @Override
     public String getCdmaEriText() {
         logUnexpectedCdmaMethodCall("getCdmaEriText");
         return "GSM nw, no ERI";
     }
 
+    @Override
     public String getCdmaMin() {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("getCdmaMin");
         return null;
     }
 
+    @Override
     public boolean isMinInfoReady() {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("isMinInfoReady");
         return false;
     }
 
+    @Override
     public String getCdmaPrlVersion(){
         //  This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("getCdmaPrlVersion");
         return null;
     }
 
+    @Override
     public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("sendBurstDtmf");
     }
 
+    @Override
     public void exitEmergencyCallbackMode() {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("exitEmergencyCallbackMode");
     }
 
+    @Override
     public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("registerForCdmaOtaStatusChange");
     }
 
+    @Override
     public void unregisterForCdmaOtaStatusChange(Handler h) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("unregisterForCdmaOtaStatusChange");
     }
 
+    @Override
     public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("registerForSubscriptionInfoReady");
     }
 
+    @Override
     public void unregisterForSubscriptionInfoReady(Handler h) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("unregisterForSubscriptionInfoReady");
@@ -962,6 +1021,7 @@
      * Returns true if OTA Service Provisioning needs to be performed.
      * If not overridden return false.
      */
+    @Override
     public boolean needsOtaServiceProvisioning() {
         return false;
     }
@@ -970,124 +1030,153 @@
      * Return true if number is an OTASP number.
      * If not overridden return false.
      */
+    @Override
     public  boolean isOtaSpNumber(String dialStr) {
         return false;
     }
 
+    @Override
     public void registerForCallWaiting(Handler h, int what, Object obj){
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("registerForCallWaiting");
     }
 
+    @Override
     public void unregisterForCallWaiting(Handler h){
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("unregisterForCallWaiting");
     }
 
+    @Override
     public void registerForEcmTimerReset(Handler h, int what, Object obj) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("registerForEcmTimerReset");
     }
 
+    @Override
     public void unregisterForEcmTimerReset(Handler h) {
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
         logUnexpectedCdmaMethodCall("unregisterForEcmTimerReset");
     }
 
+    @Override
     public void registerForSignalInfo(Handler h, int what, Object obj) {
-        mCM.registerForSignalInfo(h, what, obj);
+        mCi.registerForSignalInfo(h, what, obj);
     }
 
+    @Override
     public void unregisterForSignalInfo(Handler h) {
-        mCM.unregisterForSignalInfo(h);
+        mCi.unregisterForSignalInfo(h);
     }
 
+    @Override
     public void registerForDisplayInfo(Handler h, int what, Object obj) {
-        mCM.registerForDisplayInfo(h, what, obj);
+        mCi.registerForDisplayInfo(h, what, obj);
     }
 
-     public void unregisterForDisplayInfo(Handler h) {
-         mCM.unregisterForDisplayInfo(h);
+     @Override
+    public void unregisterForDisplayInfo(Handler h) {
+         mCi.unregisterForDisplayInfo(h);
      }
 
+    @Override
     public void registerForNumberInfo(Handler h, int what, Object obj) {
-        mCM.registerForNumberInfo(h, what, obj);
+        mCi.registerForNumberInfo(h, what, obj);
     }
 
+    @Override
     public void unregisterForNumberInfo(Handler h) {
-        mCM.unregisterForNumberInfo(h);
+        mCi.unregisterForNumberInfo(h);
     }
 
+    @Override
     public void registerForRedirectedNumberInfo(Handler h, int what, Object obj) {
-        mCM.registerForRedirectedNumberInfo(h, what, obj);
+        mCi.registerForRedirectedNumberInfo(h, what, obj);
     }
 
+    @Override
     public void unregisterForRedirectedNumberInfo(Handler h) {
-        mCM.unregisterForRedirectedNumberInfo(h);
+        mCi.unregisterForRedirectedNumberInfo(h);
     }
 
+    @Override
     public void registerForLineControlInfo(Handler h, int what, Object obj) {
-        mCM.registerForLineControlInfo( h, what, obj);
+        mCi.registerForLineControlInfo( h, what, obj);
     }
 
+    @Override
     public void unregisterForLineControlInfo(Handler h) {
-        mCM.unregisterForLineControlInfo(h);
+        mCi.unregisterForLineControlInfo(h);
     }
 
+    @Override
     public void registerFoT53ClirlInfo(Handler h, int what, Object obj) {
-        mCM.registerFoT53ClirlInfo(h, what, obj);
+        mCi.registerFoT53ClirlInfo(h, what, obj);
     }
 
+    @Override
     public void unregisterForT53ClirInfo(Handler h) {
-        mCM.unregisterForT53ClirInfo(h);
+        mCi.unregisterForT53ClirInfo(h);
     }
 
+    @Override
     public void registerForT53AudioControlInfo(Handler h, int what, Object obj) {
-        mCM.registerForT53AudioControlInfo( h, what, obj);
+        mCi.registerForT53AudioControlInfo( h, what, obj);
     }
 
+    @Override
     public void unregisterForT53AudioControlInfo(Handler h) {
-        mCM.unregisterForT53AudioControlInfo(h);
+        mCi.unregisterForT53AudioControlInfo(h);
     }
 
-     public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
+     @Override
+    public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
          // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
          logUnexpectedCdmaMethodCall("setOnEcbModeExitResponse");
      }
 
-     public void unsetOnEcbModeExitResponse(Handler h){
+     @Override
+    public void unsetOnEcbModeExitResponse(Handler h){
         // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
          logUnexpectedCdmaMethodCall("unsetOnEcbModeExitResponse");
      }
 
+    @Override
     public String[] getActiveApnTypes() {
         return mDataConnectionTracker.getActiveApnTypes();
     }
 
+    @Override
     public String getActiveApnHost(String apnType) {
         return mDataConnectionTracker.getActiveApnString(apnType);
     }
 
+    @Override
     public LinkProperties getLinkProperties(String apnType) {
         return mDataConnectionTracker.getLinkProperties(apnType);
     }
 
+    @Override
     public LinkCapabilities getLinkCapabilities(String apnType) {
         return mDataConnectionTracker.getLinkCapabilities(apnType);
     }
 
+    @Override
     public int enableApnType(String type) {
         return mDataConnectionTracker.enableApnType(type);
     }
 
+    @Override
     public int disableApnType(String type) {
         return mDataConnectionTracker.disableApnType(type);
     }
 
+    @Override
     public boolean isDataConnectivityPossible() {
         return isDataConnectivityPossible(PhoneConstants.APN_TYPE_DEFAULT);
     }
 
+    @Override
     public boolean isDataConnectivityPossible(String apnType) {
         return ((mDataConnectionTracker != null) &&
                 (mDataConnectionTracker.isDataPossible(apnType)));
@@ -1134,6 +1223,7 @@
         }
     }
 
+    @Override
     public boolean isCspPlmnEnabled() {
         // This function should be overridden by the class GSMPhone.
         // Not implemented in CDMAPhone.
@@ -1141,15 +1231,18 @@
         return false;
     }
 
+    @Override
     public IsimRecords getIsimRecords() {
         Rlog.e(LOG_TAG, "getIsimRecords() is only supported on LTE devices");
         return null;
     }
 
+    @Override
     public void requestIsimAuthentication(String nonce, Message result) {
         Rlog.e(LOG_TAG, "requestIsimAuthentication() is only supported on LTE devices");
     }
 
+    @Override
     public String getMsisdn() {
         logUnexpectedGsmMethodCall("getMsisdn");
         return null;
@@ -1164,6 +1257,7 @@
                 "called, CDMAPhone inactive.");
     }
 
+    @Override
     public PhoneConstants.DataState getDataConnectionState() {
         return getDataConnectionState(PhoneConstants.APN_TYPE_DEFAULT);
     }
@@ -1191,7 +1285,7 @@
      */
     @Override
     public int getLteOnCdmaMode() {
-        return mCM.getLteOnCdmaMode();
+        return mCi.getLteOnCdmaMode();
     }
 
     /**
@@ -1221,7 +1315,7 @@
 
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("PhoneBase:");
-        pw.println(" mCM=" + mCM);
+        pw.println(" mCi=" + mCi);
         pw.println(" mDnsCheckDisabled=" + mDnsCheckDisabled);
         pw.println(" mDataConnectionTracker=" + mDataConnectionTracker);
         pw.println(" mDoesRilSendMultipleCallRing=" + mDoesRilSendMultipleCallRing);
diff --git a/src/java/com/android/internal/telephony/PhoneFactory.java b/src/java/com/android/internal/telephony/PhoneFactory.java
index c0641d5..b7a2b77 100644
--- a/src/java/com/android/internal/telephony/PhoneFactory.java
+++ b/src/java/com/android/internal/telephony/PhoneFactory.java
@@ -22,8 +22,6 @@
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 import android.telephony.Rlog;
-import android.os.SystemProperties;
-
 import com.android.internal.telephony.cdma.CDMAPhone;
 import com.android.internal.telephony.cdma.CDMALTEPhone;
 import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
@@ -36,7 +34,7 @@
  * {@hide}
  */
 public class PhoneFactory {
-    static final String LOG_TAG = "PHONE";
+    static final String LOG_TAG = "PhoneFactory";
     static final int SOCKET_OPEN_RETRY_MILLIS = 2 * 1000;
     static final int SOCKET_OPEN_MAX_RETRY = 3;
 
@@ -50,7 +48,7 @@
     static private Looper sLooper;
     static private Context sContext;
 
-    static final int preferredCdmaSubscription =
+    static final int sPreferredCdmaSubscription =
                          CdmaSubscriptionSourceManager.PREFERRED_CDMA_SUBSCRIPTION;
 
     //***** Class Methods
@@ -130,7 +128,7 @@
                         //Get cdmaSubscription mode from Settings.System
                         cdmaSubscription = Settings.Global.getInt(context.getContentResolver(),
                                 Settings.Global.PREFERRED_CDMA_SUBSCRIPTION,
-                                preferredCdmaSubscription);
+                                sPreferredCdmaSubscription);
                         Rlog.i(LOG_TAG, "lteOnCdma not set, using PREFERRED_CDMA_SUBSCRIPTION");
                         break;
                 }
diff --git a/src/java/com/android/internal/telephony/PhoneProxy.java b/src/java/com/android/internal/telephony/PhoneProxy.java
index 300529b..bd322b3 100644
--- a/src/java/com/android/internal/telephony/PhoneProxy.java
+++ b/src/java/com/android/internal/telephony/PhoneProxy.java
@@ -33,8 +33,6 @@
 import android.telephony.SignalStrength;
 import android.telephony.Rlog;
 
-import com.android.internal.telephony.cdma.CDMAPhone;
-import com.android.internal.telephony.gsm.GSMPhone;
 import com.android.internal.telephony.test.SimulatedRadioControl;
 import com.android.internal.telephony.uicc.IccCardProxy;
 import com.android.internal.telephony.uicc.IsimRecords;
@@ -62,7 +60,7 @@
     private static final int EVENT_REQUEST_VOICE_RADIO_TECH_DONE = 3;
     private static final int EVENT_RIL_CONNECTED = 4;
 
-    private static final String LOG_TAG = "PHONE";
+    private static final String LOG_TAG = "PhoneProxy";
 
     //***** Class Methods
     public PhoneProxy(PhoneBase phone) {
@@ -74,7 +72,7 @@
         mIccPhoneBookInterfaceManagerProxy = new IccPhoneBookInterfaceManagerProxy(
                 phone.getIccPhoneBookInterfaceManager());
         mPhoneSubInfoProxy = new PhoneSubInfoProxy(phone.getPhoneSubInfo());
-        mCommandsInterface = ((PhoneBase)mActivePhone).mCM;
+        mCommandsInterface = ((PhoneBase)mActivePhone).mCi;
 
         mCommandsInterface.registerForRilConnected(this, EVENT_RIL_CONNECTED, null);
         mCommandsInterface.registerForOn(this, EVENT_RADIO_ON, null);
@@ -96,7 +94,7 @@
         case EVENT_RADIO_ON:
             /* Proactively query voice radio technologies */
             mCommandsInterface.getVoiceRadioTechnology(
-                    this.obtainMessage(EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
+                    obtainMessage(EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
             break;
 
         case EVENT_RIL_CONNECTED:
@@ -135,10 +133,6 @@
         Rlog.d(LOG_TAG, "[PhoneProxy] " + msg);
     }
 
-    private void logw(String msg) {
-        Rlog.w(LOG_TAG, "[PhoneProxy] " + msg);
-    }
-
     private void loge(String msg) {
         Rlog.e(LOG_TAG, "[PhoneProxy] " + msg);
     }
@@ -205,9 +199,9 @@
                 mActivePhone.getIccSmsInterfaceManager());
         mIccPhoneBookInterfaceManagerProxy.setmIccPhoneBookInterfaceManager(mActivePhone
                 .getIccPhoneBookInterfaceManager());
-        mPhoneSubInfoProxy.setmPhoneSubInfo(this.mActivePhone.getPhoneSubInfo());
+        mPhoneSubInfoProxy.setmPhoneSubInfo(mActivePhone.getPhoneSubInfo());
 
-        mCommandsInterface = ((PhoneBase)mActivePhone).mCM;
+        mCommandsInterface = ((PhoneBase)mActivePhone).mCi;
         mIccCardProxy.setVoiceRadioTech(newVoiceRadioTech);
 
         // Send an Intent to the PhoneApp that we had a radio technology change
@@ -260,10 +254,12 @@
         oldPhone = null;
     }
 
+    @Override
     public ServiceState getServiceState() {
         return mActivePhone.getServiceState();
     }
 
+    @Override
     public CellLocation getCellLocation() {
         return mActivePhone.getCellLocation();
     }
@@ -276,354 +272,441 @@
         return mActivePhone.getAllCellInfo();
     }
 
+    @Override
     public PhoneConstants.DataState getDataConnectionState() {
         return mActivePhone.getDataConnectionState(PhoneConstants.APN_TYPE_DEFAULT);
     }
 
+    @Override
     public PhoneConstants.DataState getDataConnectionState(String apnType) {
         return mActivePhone.getDataConnectionState(apnType);
     }
 
+    @Override
     public DataActivityState getDataActivityState() {
         return mActivePhone.getDataActivityState();
     }
 
+    @Override
     public Context getContext() {
         return mActivePhone.getContext();
     }
 
+    @Override
     public void disableDnsCheck(boolean b) {
         mActivePhone.disableDnsCheck(b);
     }
 
+    @Override
     public boolean isDnsCheckDisabled() {
         return mActivePhone.isDnsCheckDisabled();
     }
 
+    @Override
     public PhoneConstants.State getState() {
         return mActivePhone.getState();
     }
 
+    @Override
     public String getPhoneName() {
         return mActivePhone.getPhoneName();
     }
 
+    @Override
     public int getPhoneType() {
         return mActivePhone.getPhoneType();
     }
 
+    @Override
     public String[] getActiveApnTypes() {
         return mActivePhone.getActiveApnTypes();
     }
 
+    @Override
     public String getActiveApnHost(String apnType) {
         return mActivePhone.getActiveApnHost(apnType);
     }
 
+    @Override
     public LinkProperties getLinkProperties(String apnType) {
         return mActivePhone.getLinkProperties(apnType);
     }
 
+    @Override
     public LinkCapabilities getLinkCapabilities(String apnType) {
         return mActivePhone.getLinkCapabilities(apnType);
     }
 
+    @Override
     public SignalStrength getSignalStrength() {
         return mActivePhone.getSignalStrength();
     }
 
+    @Override
     public void registerForUnknownConnection(Handler h, int what, Object obj) {
         mActivePhone.registerForUnknownConnection(h, what, obj);
     }
 
+    @Override
     public void unregisterForUnknownConnection(Handler h) {
         mActivePhone.unregisterForUnknownConnection(h);
     }
 
+    @Override
     public void registerForPreciseCallStateChanged(Handler h, int what, Object obj) {
         mActivePhone.registerForPreciseCallStateChanged(h, what, obj);
     }
 
+    @Override
     public void unregisterForPreciseCallStateChanged(Handler h) {
         mActivePhone.unregisterForPreciseCallStateChanged(h);
     }
 
+    @Override
     public void registerForNewRingingConnection(Handler h, int what, Object obj) {
         mActivePhone.registerForNewRingingConnection(h, what, obj);
     }
 
+    @Override
     public void unregisterForNewRingingConnection(Handler h) {
         mActivePhone.unregisterForNewRingingConnection(h);
     }
 
+    @Override
     public void registerForIncomingRing(Handler h, int what, Object obj) {
         mActivePhone.registerForIncomingRing(h, what, obj);
     }
 
+    @Override
     public void unregisterForIncomingRing(Handler h) {
         mActivePhone.unregisterForIncomingRing(h);
     }
 
+    @Override
     public void registerForDisconnect(Handler h, int what, Object obj) {
         mActivePhone.registerForDisconnect(h, what, obj);
     }
 
+    @Override
     public void unregisterForDisconnect(Handler h) {
         mActivePhone.unregisterForDisconnect(h);
     }
 
+    @Override
     public void registerForMmiInitiate(Handler h, int what, Object obj) {
         mActivePhone.registerForMmiInitiate(h, what, obj);
     }
 
+    @Override
     public void unregisterForMmiInitiate(Handler h) {
         mActivePhone.unregisterForMmiInitiate(h);
     }
 
+    @Override
     public void registerForMmiComplete(Handler h, int what, Object obj) {
         mActivePhone.registerForMmiComplete(h, what, obj);
     }
 
+    @Override
     public void unregisterForMmiComplete(Handler h) {
         mActivePhone.unregisterForMmiComplete(h);
     }
 
+    @Override
     public List<? extends MmiCode> getPendingMmiCodes() {
         return mActivePhone.getPendingMmiCodes();
     }
 
+    @Override
     public void sendUssdResponse(String ussdMessge) {
         mActivePhone.sendUssdResponse(ussdMessge);
     }
 
+    @Override
     public void registerForServiceStateChanged(Handler h, int what, Object obj) {
         mActivePhone.registerForServiceStateChanged(h, what, obj);
     }
 
+    @Override
     public void unregisterForServiceStateChanged(Handler h) {
         mActivePhone.unregisterForServiceStateChanged(h);
     }
 
+    @Override
     public void registerForSuppServiceNotification(Handler h, int what, Object obj) {
         mActivePhone.registerForSuppServiceNotification(h, what, obj);
     }
 
+    @Override
     public void unregisterForSuppServiceNotification(Handler h) {
         mActivePhone.unregisterForSuppServiceNotification(h);
     }
 
+    @Override
     public void registerForSuppServiceFailed(Handler h, int what, Object obj) {
         mActivePhone.registerForSuppServiceFailed(h, what, obj);
     }
 
+    @Override
     public void unregisterForSuppServiceFailed(Handler h) {
         mActivePhone.unregisterForSuppServiceFailed(h);
     }
 
+    @Override
     public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj){
         mActivePhone.registerForInCallVoicePrivacyOn(h,what,obj);
     }
 
+    @Override
     public void unregisterForInCallVoicePrivacyOn(Handler h){
         mActivePhone.unregisterForInCallVoicePrivacyOn(h);
     }
 
+    @Override
     public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj){
         mActivePhone.registerForInCallVoicePrivacyOff(h,what,obj);
     }
 
+    @Override
     public void unregisterForInCallVoicePrivacyOff(Handler h){
         mActivePhone.unregisterForInCallVoicePrivacyOff(h);
     }
 
+    @Override
     public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
         mActivePhone.registerForCdmaOtaStatusChange(h,what,obj);
     }
 
+    @Override
     public void unregisterForCdmaOtaStatusChange(Handler h) {
          mActivePhone.unregisterForCdmaOtaStatusChange(h);
     }
 
+    @Override
     public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
         mActivePhone.registerForSubscriptionInfoReady(h, what, obj);
     }
 
+    @Override
     public void unregisterForSubscriptionInfoReady(Handler h) {
         mActivePhone.unregisterForSubscriptionInfoReady(h);
     }
 
+    @Override
     public void registerForEcmTimerReset(Handler h, int what, Object obj) {
         mActivePhone.registerForEcmTimerReset(h,what,obj);
     }
 
+    @Override
     public void unregisterForEcmTimerReset(Handler h) {
         mActivePhone.unregisterForEcmTimerReset(h);
     }
 
+    @Override
     public void registerForRingbackTone(Handler h, int what, Object obj) {
         mActivePhone.registerForRingbackTone(h,what,obj);
     }
 
+    @Override
     public void unregisterForRingbackTone(Handler h) {
         mActivePhone.unregisterForRingbackTone(h);
     }
 
+    @Override
     public void registerForResendIncallMute(Handler h, int what, Object obj) {
         mActivePhone.registerForResendIncallMute(h,what,obj);
     }
 
+    @Override
     public void unregisterForResendIncallMute(Handler h) {
         mActivePhone.unregisterForResendIncallMute(h);
     }
 
+    @Override
     public boolean getIccRecordsLoaded() {
         return mIccCardProxy.getIccRecordsLoaded();
     }
 
+    @Override
     public IccCard getIccCard() {
         return mIccCardProxy;
     }
 
+    @Override
     public void acceptCall() throws CallStateException {
         mActivePhone.acceptCall();
     }
 
+    @Override
     public void rejectCall() throws CallStateException {
         mActivePhone.rejectCall();
     }
 
+    @Override
     public void switchHoldingAndActive() throws CallStateException {
         mActivePhone.switchHoldingAndActive();
     }
 
+    @Override
     public boolean canConference() {
         return mActivePhone.canConference();
     }
 
+    @Override
     public void conference() throws CallStateException {
         mActivePhone.conference();
     }
 
+    @Override
     public void enableEnhancedVoicePrivacy(boolean enable, Message onComplete) {
         mActivePhone.enableEnhancedVoicePrivacy(enable, onComplete);
     }
 
+    @Override
     public void getEnhancedVoicePrivacy(Message onComplete) {
         mActivePhone.getEnhancedVoicePrivacy(onComplete);
     }
 
+    @Override
     public boolean canTransfer() {
         return mActivePhone.canTransfer();
     }
 
+    @Override
     public void explicitCallTransfer() throws CallStateException {
         mActivePhone.explicitCallTransfer();
     }
 
+    @Override
     public void clearDisconnected() {
         mActivePhone.clearDisconnected();
     }
 
+    @Override
     public Call getForegroundCall() {
         return mActivePhone.getForegroundCall();
     }
 
+    @Override
     public Call getBackgroundCall() {
         return mActivePhone.getBackgroundCall();
     }
 
+    @Override
     public Call getRingingCall() {
         return mActivePhone.getRingingCall();
     }
 
+    @Override
     public Connection dial(String dialString) throws CallStateException {
         return mActivePhone.dial(dialString);
     }
 
+    @Override
     public Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException {
         return mActivePhone.dial(dialString, uusInfo);
     }
 
+    @Override
     public boolean handlePinMmi(String dialString) {
         return mActivePhone.handlePinMmi(dialString);
     }
 
+    @Override
     public boolean handleInCallMmiCommands(String command) throws CallStateException {
         return mActivePhone.handleInCallMmiCommands(command);
     }
 
+    @Override
     public void sendDtmf(char c) {
         mActivePhone.sendDtmf(c);
     }
 
+    @Override
     public void startDtmf(char c) {
         mActivePhone.startDtmf(c);
     }
 
+    @Override
     public void stopDtmf() {
         mActivePhone.stopDtmf();
     }
 
+    @Override
     public void setRadioPower(boolean power) {
         mActivePhone.setRadioPower(power);
     }
 
+    @Override
     public boolean getMessageWaitingIndicator() {
         return mActivePhone.getMessageWaitingIndicator();
     }
 
+    @Override
     public boolean getCallForwardingIndicator() {
         return mActivePhone.getCallForwardingIndicator();
     }
 
+    @Override
     public String getLine1Number() {
         return mActivePhone.getLine1Number();
     }
 
+    @Override
     public String getCdmaMin() {
         return mActivePhone.getCdmaMin();
     }
 
+    @Override
     public boolean isMinInfoReady() {
         return mActivePhone.isMinInfoReady();
     }
 
+    @Override
     public String getCdmaPrlVersion() {
         return mActivePhone.getCdmaPrlVersion();
     }
 
+    @Override
     public String getLine1AlphaTag() {
         return mActivePhone.getLine1AlphaTag();
     }
 
+    @Override
     public void setLine1Number(String alphaTag, String number, Message onComplete) {
         mActivePhone.setLine1Number(alphaTag, number, onComplete);
     }
 
+    @Override
     public String getVoiceMailNumber() {
         return mActivePhone.getVoiceMailNumber();
     }
 
      /** @hide */
+    @Override
     public int getVoiceMessageCount(){
         return mActivePhone.getVoiceMessageCount();
     }
 
+    @Override
     public String getVoiceMailAlphaTag() {
         return mActivePhone.getVoiceMailAlphaTag();
     }
 
+    @Override
     public void setVoiceMailNumber(String alphaTag,String voiceMailNumber,
             Message onComplete) {
         mActivePhone.setVoiceMailNumber(alphaTag, voiceMailNumber, onComplete);
     }
 
+    @Override
     public void getCallForwardingOption(int commandInterfaceCFReason,
             Message onComplete) {
         mActivePhone.getCallForwardingOption(commandInterfaceCFReason,
                 onComplete);
     }
 
+    @Override
     public void setCallForwardingOption(int commandInterfaceCFReason,
             int commandInterfaceCFAction, String dialingNumber,
             int timerSeconds, Message onComplete) {
@@ -631,228 +714,284 @@
             commandInterfaceCFAction, dialingNumber, timerSeconds, onComplete);
     }
 
+    @Override
     public void getOutgoingCallerIdDisplay(Message onComplete) {
         mActivePhone.getOutgoingCallerIdDisplay(onComplete);
     }
 
+    @Override
     public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
             Message onComplete) {
         mActivePhone.setOutgoingCallerIdDisplay(commandInterfaceCLIRMode,
                 onComplete);
     }
 
+    @Override
     public void getCallWaiting(Message onComplete) {
         mActivePhone.getCallWaiting(onComplete);
     }
 
+    @Override
     public void setCallWaiting(boolean enable, Message onComplete) {
         mActivePhone.setCallWaiting(enable, onComplete);
     }
 
+    @Override
     public void getAvailableNetworks(Message response) {
         mActivePhone.getAvailableNetworks(response);
     }
 
+    @Override
     public void setNetworkSelectionModeAutomatic(Message response) {
         mActivePhone.setNetworkSelectionModeAutomatic(response);
     }
 
+    @Override
     public void selectNetworkManually(OperatorInfo network, Message response) {
         mActivePhone.selectNetworkManually(network, response);
     }
 
+    @Override
     public void setPreferredNetworkType(int networkType, Message response) {
         mActivePhone.setPreferredNetworkType(networkType, response);
     }
 
+    @Override
     public void getPreferredNetworkType(Message response) {
         mActivePhone.getPreferredNetworkType(response);
     }
 
+    @Override
     public void getNeighboringCids(Message response) {
         mActivePhone.getNeighboringCids(response);
     }
 
+    @Override
     public void setOnPostDialCharacter(Handler h, int what, Object obj) {
         mActivePhone.setOnPostDialCharacter(h, what, obj);
     }
 
+    @Override
     public void setMute(boolean muted) {
         mActivePhone.setMute(muted);
     }
 
+    @Override
     public boolean getMute() {
         return mActivePhone.getMute();
     }
 
+    @Override
     public void setEchoSuppressionEnabled(boolean enabled) {
         mActivePhone.setEchoSuppressionEnabled(enabled);
     }
 
+    @Override
     public void invokeOemRilRequestRaw(byte[] data, Message response) {
         mActivePhone.invokeOemRilRequestRaw(data, response);
     }
 
+    @Override
     public void invokeOemRilRequestStrings(String[] strings, Message response) {
         mActivePhone.invokeOemRilRequestStrings(strings, response);
     }
 
+    @Override
     public void getDataCallList(Message response) {
         mActivePhone.getDataCallList(response);
     }
 
+    @Override
     public void updateServiceLocation() {
         mActivePhone.updateServiceLocation();
     }
 
+    @Override
     public void enableLocationUpdates() {
         mActivePhone.enableLocationUpdates();
     }
 
+    @Override
     public void disableLocationUpdates() {
         mActivePhone.disableLocationUpdates();
     }
 
+    @Override
     public void setUnitTestMode(boolean f) {
         mActivePhone.setUnitTestMode(f);
     }
 
+    @Override
     public boolean getUnitTestMode() {
         return mActivePhone.getUnitTestMode();
     }
 
+    @Override
     public void setBandMode(int bandMode, Message response) {
         mActivePhone.setBandMode(bandMode, response);
     }
 
+    @Override
     public void queryAvailableBandMode(Message response) {
         mActivePhone.queryAvailableBandMode(response);
     }
 
+    @Override
     public boolean getDataRoamingEnabled() {
         return mActivePhone.getDataRoamingEnabled();
     }
 
+    @Override
     public void setDataRoamingEnabled(boolean enable) {
         mActivePhone.setDataRoamingEnabled(enable);
     }
 
+    @Override
     public void queryCdmaRoamingPreference(Message response) {
         mActivePhone.queryCdmaRoamingPreference(response);
     }
 
+    @Override
     public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
         mActivePhone.setCdmaRoamingPreference(cdmaRoamingType, response);
     }
 
+    @Override
     public void setCdmaSubscription(int cdmaSubscriptionType, Message response) {
         mActivePhone.setCdmaSubscription(cdmaSubscriptionType, response);
     }
 
+    @Override
     public SimulatedRadioControl getSimulatedRadioControl() {
         return mActivePhone.getSimulatedRadioControl();
     }
 
+    @Override
     public int enableApnType(String type) {
         return mActivePhone.enableApnType(type);
     }
 
+    @Override
     public int disableApnType(String type) {
         return mActivePhone.disableApnType(type);
     }
 
+    @Override
     public boolean isDataConnectivityPossible() {
         return mActivePhone.isDataConnectivityPossible(PhoneConstants.APN_TYPE_DEFAULT);
     }
 
+    @Override
     public boolean isDataConnectivityPossible(String apnType) {
         return mActivePhone.isDataConnectivityPossible(apnType);
     }
 
+    @Override
     public String getDeviceId() {
         return mActivePhone.getDeviceId();
     }
 
+    @Override
     public String getDeviceSvn() {
         return mActivePhone.getDeviceSvn();
     }
 
+    @Override
     public String getSubscriberId() {
         return mActivePhone.getSubscriberId();
     }
 
+    @Override
     public String getIccSerialNumber() {
         return mActivePhone.getIccSerialNumber();
     }
 
+    @Override
     public String getEsn() {
         return mActivePhone.getEsn();
     }
 
+    @Override
     public String getMeid() {
         return mActivePhone.getMeid();
     }
 
+    @Override
     public String getMsisdn() {
         return mActivePhone.getMsisdn();
     }
 
+    @Override
     public String getImei() {
         return mActivePhone.getImei();
     }
 
+    @Override
     public PhoneSubInfo getPhoneSubInfo(){
         return mActivePhone.getPhoneSubInfo();
     }
 
+    @Override
     public IccSmsInterfaceManager getIccSmsInterfaceManager(){
         return mActivePhone.getIccSmsInterfaceManager();
     }
 
+    @Override
     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(){
         return mActivePhone.getIccPhoneBookInterfaceManager();
     }
 
+    @Override
     public void setTTYMode(int ttyMode, Message onComplete) {
         mActivePhone.setTTYMode(ttyMode, onComplete);
     }
 
+    @Override
     public void queryTTYMode(Message onComplete) {
         mActivePhone.queryTTYMode(onComplete);
     }
 
+    @Override
     public void activateCellBroadcastSms(int activate, Message response) {
         mActivePhone.activateCellBroadcastSms(activate, response);
     }
 
+    @Override
     public void getCellBroadcastSmsConfig(Message response) {
         mActivePhone.getCellBroadcastSmsConfig(response);
     }
 
+    @Override
     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response) {
         mActivePhone.setCellBroadcastSmsConfig(configValuesArray, response);
     }
 
+    @Override
     public void notifyDataActivity() {
          mActivePhone.notifyDataActivity();
     }
 
+    @Override
     public void getSmscAddress(Message result) {
         mActivePhone.getSmscAddress(result);
     }
 
+    @Override
     public void setSmscAddress(String address, Message result) {
         mActivePhone.setSmscAddress(address, result);
     }
 
+    @Override
     public int getCdmaEriIconIndex() {
         return mActivePhone.getCdmaEriIconIndex();
     }
 
+    @Override
     public String getCdmaEriText() {
         return mActivePhone.getCdmaEriText();
     }
 
+    @Override
     public int getCdmaEriIconMode() {
         return mActivePhone.getCdmaEriIconMode();
     }
@@ -861,102 +1000,127 @@
         return mActivePhone;
     }
 
+    @Override
     public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete){
         mActivePhone.sendBurstDtmf(dtmfString, on, off, onComplete);
     }
 
+    @Override
     public void exitEmergencyCallbackMode(){
         mActivePhone.exitEmergencyCallbackMode();
     }
 
+    @Override
     public boolean needsOtaServiceProvisioning(){
         return mActivePhone.needsOtaServiceProvisioning();
     }
 
+    @Override
     public boolean isOtaSpNumber(String dialStr){
         return mActivePhone.isOtaSpNumber(dialStr);
     }
 
+    @Override
     public void registerForCallWaiting(Handler h, int what, Object obj){
         mActivePhone.registerForCallWaiting(h,what,obj);
     }
 
+    @Override
     public void unregisterForCallWaiting(Handler h){
         mActivePhone.unregisterForCallWaiting(h);
     }
 
+    @Override
     public void registerForSignalInfo(Handler h, int what, Object obj) {
         mActivePhone.registerForSignalInfo(h,what,obj);
     }
 
+    @Override
     public void unregisterForSignalInfo(Handler h) {
         mActivePhone.unregisterForSignalInfo(h);
     }
 
+    @Override
     public void registerForDisplayInfo(Handler h, int what, Object obj) {
         mActivePhone.registerForDisplayInfo(h,what,obj);
     }
 
+    @Override
     public void unregisterForDisplayInfo(Handler h) {
         mActivePhone.unregisterForDisplayInfo(h);
     }
 
+    @Override
     public void registerForNumberInfo(Handler h, int what, Object obj) {
         mActivePhone.registerForNumberInfo(h, what, obj);
     }
 
+    @Override
     public void unregisterForNumberInfo(Handler h) {
         mActivePhone.unregisterForNumberInfo(h);
     }
 
+    @Override
     public void registerForRedirectedNumberInfo(Handler h, int what, Object obj) {
         mActivePhone.registerForRedirectedNumberInfo(h, what, obj);
     }
 
+    @Override
     public void unregisterForRedirectedNumberInfo(Handler h) {
         mActivePhone.unregisterForRedirectedNumberInfo(h);
     }
 
+    @Override
     public void registerForLineControlInfo(Handler h, int what, Object obj) {
         mActivePhone.registerForLineControlInfo( h, what, obj);
     }
 
+    @Override
     public void unregisterForLineControlInfo(Handler h) {
         mActivePhone.unregisterForLineControlInfo(h);
     }
 
+    @Override
     public void registerFoT53ClirlInfo(Handler h, int what, Object obj) {
         mActivePhone.registerFoT53ClirlInfo(h, what, obj);
     }
 
+    @Override
     public void unregisterForT53ClirInfo(Handler h) {
         mActivePhone.unregisterForT53ClirInfo(h);
     }
 
+    @Override
     public void registerForT53AudioControlInfo(Handler h, int what, Object obj) {
         mActivePhone.registerForT53AudioControlInfo( h, what, obj);
     }
 
+    @Override
     public void unregisterForT53AudioControlInfo(Handler h) {
         mActivePhone.unregisterForT53AudioControlInfo(h);
     }
 
+    @Override
     public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
         mActivePhone.setOnEcbModeExitResponse(h,what,obj);
     }
 
+    @Override
     public void unsetOnEcbModeExitResponse(Handler h){
         mActivePhone.unsetOnEcbModeExitResponse(h);
     }
 
+    @Override
     public boolean isCspPlmnEnabled() {
         return mActivePhone.isCspPlmnEnabled();
     }
 
+    @Override
     public IsimRecords getIsimRecords() {
         return mActivePhone.getIsimRecords();
     }
 
+    @Override
     public void requestIsimAuthentication(String nonce, Message response) {
         mActivePhone.requestIsimAuthentication(nonce, response);
     }
@@ -979,12 +1143,14 @@
         return mActivePhone.getUsimServiceTable();
     }
 
+    @Override
     public void dispose() {
         mCommandsInterface.unregisterForOn(this);
         mCommandsInterface.unregisterForVoiceRadioTechChanged(this);
         mCommandsInterface.unregisterForRilConnected(this);
     }
 
+    @Override
     public void removeReferences() {
         mActivePhone = null;
         mCommandsInterface = null;
diff --git a/src/java/com/android/internal/telephony/PhoneStateIntentReceiver.java b/src/java/com/android/internal/telephony/PhoneStateIntentReceiver.java
index 40f0c34..9dad3cc 100644
--- a/src/java/com/android/internal/telephony/PhoneStateIntentReceiver.java
+++ b/src/java/com/android/internal/telephony/PhoneStateIntentReceiver.java
@@ -37,15 +37,13 @@
  */
 @Deprecated
 public final class PhoneStateIntentReceiver extends BroadcastReceiver {
-    private static final String LOG_TAG = "PHONE";
+    private static final String LOG_TAG = "PhoneStatIntentReceiver";
     private static final boolean DBG = false;
 
     private static final int NOTIF_PHONE    = 1 << 0;
     private static final int NOTIF_SERVICE  = 1 << 1;
     private static final int NOTIF_SIGNAL   = 1 << 2;
 
-    private static final int NOTIF_MAX      = 1 << 5;
-
     PhoneConstants.State mPhoneState = PhoneConstants.State.IDLE;
     ServiceState mServiceState = new ServiceState();
     SignalStrength mSignalStrength = new SignalStrength();
@@ -56,7 +54,6 @@
     private int mWants;
     private int mPhoneStateEventWhat;
     private int mServiceStateEventWhat;
-    private int mLocationEventWhat;
     private int mAsuEventWhat;
 
     public PhoneStateIntentReceiver() {
@@ -177,7 +174,7 @@
                 if (DBG) Rlog.d(LOG_TAG, "onReceiveIntent: ACTION_PHONE_STATE_CHANGED, state="
                                + intent.getStringExtra(PhoneConstants.STATE_KEY));
                 String phoneState = intent.getStringExtra(PhoneConstants.STATE_KEY);
-                mPhoneState = (PhoneConstants.State) Enum.valueOf(
+                mPhoneState = Enum.valueOf(
                         PhoneConstants.State.class, phoneState);
 
                 if (mTarget != null && getNotifyPhoneCallState()) {
diff --git a/src/java/com/android/internal/telephony/PhoneSubInfo.java b/src/java/com/android/internal/telephony/PhoneSubInfo.java
index cbab817..6effe76 100755
--- a/src/java/com/android/internal/telephony/PhoneSubInfo.java
+++ b/src/java/com/android/internal/telephony/PhoneSubInfo.java
@@ -27,7 +27,10 @@
 import com.android.internal.telephony.uicc.IsimRecords;
 
 public class PhoneSubInfo extends IPhoneSubInfo.Stub {
-    static final String LOG_TAG = "PHONE";
+    static final String LOG_TAG = "PhoneSubInfo";
+    private static final boolean DBG = true;
+    private static final boolean VDBG = false; // STOPSHIP if true
+
     private Phone mPhone;
     private Context mContext;
     private static final String READ_PHONE_STATE =
@@ -46,18 +49,20 @@
     public void dispose() {
     }
 
+    @Override
     protected void finalize() {
         try {
             super.finalize();
         } catch (Throwable throwable) {
-            Rlog.e(LOG_TAG, "Error while finalizing:", throwable);
+            loge("Error while finalizing:", throwable);
         }
-        Rlog.d(LOG_TAG, "PhoneSubInfo finalized");
+        if (DBG) log("PhoneSubInfo finalized");
     }
 
     /**
      * Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones.
      */
+    @Override
     public String getDeviceId() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
         return mPhone.getDeviceId();
@@ -67,6 +72,7 @@
      * Retrieves the software version number for the device, e.g., IMEI/SV
      * for GSM phones.
      */
+    @Override
     public String getDeviceSvn() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
         return mPhone.getDeviceSvn();
@@ -75,6 +81,7 @@
     /**
      * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones.
      */
+    @Override
     public String getSubscriberId() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
         return mPhone.getSubscriberId();
@@ -83,6 +90,7 @@
     /**
      * Retrieves the serial number of the ICC, if applicable.
      */
+    @Override
     public String getIccSerialNumber() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
         return mPhone.getIccSerialNumber();
@@ -91,6 +99,7 @@
     /**
      * Retrieves the phone number string for line 1.
      */
+    @Override
     public String getLine1Number() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
         return mPhone.getLine1Number();
@@ -99,14 +108,16 @@
     /**
      * Retrieves the alpha identifier for line 1.
      */
+    @Override
     public String getLine1AlphaTag() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
-        return (String) mPhone.getLine1AlphaTag();
+        return mPhone.getLine1AlphaTag();
     }
 
     /**
      * Retrieves the MSISDN string.
      */
+    @Override
     public String getMsisdn() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
         return mPhone.getMsisdn();
@@ -115,10 +126,11 @@
     /**
      * Retrieves the voice mail number.
      */
+    @Override
     public String getVoiceMailNumber() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
         String number = PhoneNumberUtils.extractNetworkPortion(mPhone.getVoiceMailNumber());
-        Rlog.d(LOG_TAG, "VM: PhoneSubInfo.getVoiceMailNUmber: "); // + number);
+        if (VDBG) log("VM: PhoneSubInfo.getVoiceMailNUmber: " + number);
         return number;
     }
 
@@ -127,26 +139,29 @@
      *
      * @hide
      */
+    @Override
     public String getCompleteVoiceMailNumber() {
         mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED,
                 "Requires CALL_PRIVILEGED");
         String number = mPhone.getVoiceMailNumber();
-        Rlog.d(LOG_TAG, "VM: PhoneSubInfo.getCompleteVoiceMailNUmber: "); // + number);
+        if (VDBG) log("VM: PhoneSubInfo.getCompleteVoiceMailNUmber: " + number);
         return number;
     }
 
     /**
      * Retrieves the alpha identifier associated with the voice mail number.
      */
+    @Override
     public String getVoiceMailAlphaTag() {
         mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
-        return (String) mPhone.getVoiceMailAlphaTag();
+        return mPhone.getVoiceMailAlphaTag();
     }
 
     /**
      * Returns the IMS private user identity (IMPI) that was loaded from the ISIM.
      * @return the IMPI, or null if not present or not loaded
      */
+    @Override
     public String getIsimImpi() {
         mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE,
                 "Requires READ_PRIVILEGED_PHONE_STATE");
@@ -162,6 +177,7 @@
      * Returns the IMS home network domain name that was loaded from the ISIM.
      * @return the IMS domain name, or null if not present or not loaded
      */
+    @Override
     public String getIsimDomain() {
         mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE,
                 "Requires READ_PRIVILEGED_PHONE_STATE");
@@ -178,6 +194,7 @@
      * @return an array of IMPU strings, with one IMPU per string, or null if
      *      not present or not loaded
      */
+    @Override
     public String[] getIsimImpu() {
         mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE,
                 "Requires READ_PRIVILEGED_PHONE_STATE");
@@ -189,6 +206,15 @@
         }
     }
 
+    private void log(String s) {
+        Rlog.d(LOG_TAG, s);
+    }
+
+    private void loge(String s, Throwable e) {
+        Rlog.e(LOG_TAG, s, e);
+    }
+
+    @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
                 != PackageManager.PERMISSION_GRANTED) {
@@ -202,5 +228,4 @@
         pw.println("  Phone Type = " + mPhone.getPhoneName());
         pw.println("  Device ID = " + mPhone.getDeviceId());
     }
-
 }
diff --git a/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java b/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java
index bd130de..3c13b97 100755
--- a/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java
+++ b/src/java/com/android/internal/telephony/PhoneSubInfoProxy.java
@@ -19,8 +19,6 @@
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 
-import android.content.pm.PackageManager;
-import android.os.Binder;
 import android.os.ServiceManager;
 
 
@@ -35,13 +33,15 @@
     }
 
     public void setmPhoneSubInfo(PhoneSubInfo phoneSubInfo) {
-        this.mPhoneSubInfo = phoneSubInfo;
+        mPhoneSubInfo = phoneSubInfo;
     }
 
+    @Override
     public String getDeviceId() {
         return mPhoneSubInfo.getDeviceId();
     }
 
+    @Override
     public String getDeviceSvn() {
         return mPhoneSubInfo.getDeviceSvn();
     }
@@ -49,6 +49,7 @@
     /**
      * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones.
      */
+    @Override
     public String getSubscriberId() {
         return mPhoneSubInfo.getSubscriberId();
     }
@@ -56,6 +57,7 @@
     /**
      * Retrieves the serial number of the ICC, if applicable.
      */
+    @Override
     public String getIccSerialNumber() {
         return mPhoneSubInfo.getIccSerialNumber();
     }
@@ -63,6 +65,7 @@
     /**
      * Retrieves the phone number string for line 1.
      */
+    @Override
     public String getLine1Number() {
         return mPhoneSubInfo.getLine1Number();
     }
@@ -70,6 +73,7 @@
     /**
      * Retrieves the alpha identifier for line 1.
      */
+    @Override
     public String getLine1AlphaTag() {
         return mPhoneSubInfo.getLine1AlphaTag();
     }
@@ -77,6 +81,7 @@
     /**
      * Retrieves the MSISDN Number.
      */
+    @Override
     public String getMsisdn() {
         return mPhoneSubInfo.getMsisdn();
     }
@@ -84,6 +89,7 @@
     /**
      * Retrieves the voice mail number.
      */
+    @Override
     public String getVoiceMailNumber() {
         return mPhoneSubInfo.getVoiceMailNumber();
     }
@@ -91,6 +97,7 @@
     /**
      * Retrieves the complete voice mail number.
      */
+    @Override
     public String getCompleteVoiceMailNumber() {
         return mPhoneSubInfo.getCompleteVoiceMailNumber();
     }
@@ -98,6 +105,7 @@
     /**
      * Retrieves the alpha identifier associated with the voice mail number.
      */
+    @Override
     public String getVoiceMailAlphaTag() {
         return mPhoneSubInfo.getVoiceMailAlphaTag();
     }
@@ -106,6 +114,7 @@
      * Returns the IMS private user identity (IMPI) that was loaded from the ISIM.
      * @return the IMPI, or null if not present or not loaded
      */
+    @Override
     public String getIsimImpi() {
         return mPhoneSubInfo.getIsimImpi();
     }
@@ -114,6 +123,7 @@
      * Returns the IMS home network domain name that was loaded from the ISIM.
      * @return the IMS domain name, or null if not present or not loaded
      */
+    @Override
     public String getIsimDomain() {
         return mPhoneSubInfo.getIsimDomain();
     }
@@ -123,10 +133,12 @@
      * @return an array of IMPU strings, with one IMPU per string, or null if
      *      not present or not loaded
      */
+    @Override
     public String[] getIsimImpu() {
         return mPhoneSubInfo.getIsimImpu();
     }
 
+    @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         mPhoneSubInfo.dump(fd, pw, args);
     }
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 9c6f90e..c1e4bec 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -43,11 +43,11 @@
 import android.os.PowerManager.WakeLock;
 import android.telephony.NeighboringCellInfo;
 import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
 import android.telephony.SignalStrength;
 import android.telephony.SmsManager;
 import android.telephony.SmsMessage;
 import android.text.TextUtils;
-import android.telephony.Rlog;
 
 import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
 import com.android.internal.telephony.gsm.SuppServiceNotification;
@@ -59,6 +59,7 @@
 import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
 import com.android.internal.telephony.cdma.CdmaInformationRecords;
 import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
+import com.android.internal.telephony.dataconnection.DataConnectionBase;
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
@@ -74,7 +75,7 @@
  * {@hide}
  */
 class RILRequest {
-    static final String LOG_TAG = "RILJ";
+    static final String LOG_TAG = "RilRequest";
 
     //***** Class Variables
     static int sNextSerial = 0;
@@ -88,7 +89,7 @@
     int mSerial;
     int mRequest;
     Message mResult;
-    Parcel mp;
+    Parcel mParcel;
     RILRequest mNext;
 
     /**
@@ -119,15 +120,15 @@
         }
         rr.mRequest = request;
         rr.mResult = result;
-        rr.mp = Parcel.obtain();
+        rr.mParcel = Parcel.obtain();
 
         if (result != null && result.getTarget() == null) {
             throw new NullPointerException("Message target must not be null");
         }
 
         // first elements in any RIL Parcel
-        rr.mp.writeInt(request);
-        rr.mp.writeInt(rr.mSerial);
+        rr.mParcel.writeInt(request);
+        rr.mParcel.writeInt(rr.mSerial);
 
         return rr;
     }
@@ -140,7 +141,7 @@
     void release() {
         synchronized (sPoolSync) {
             if (sPoolSize < MAX_POOL_SIZE) {
-                this.mNext = sPool;
+                mNext = sPool;
                 sPool = this;
                 sPoolSize++;
                 mResult = null;
@@ -192,9 +193,9 @@
             mResult.sendToTarget();
         }
 
-        if (mp != null) {
-            mp.recycle();
-            mp = null;
+        if (mParcel != null) {
+            mParcel.recycle();
+            mParcel = null;
         }
     }
 }
@@ -206,9 +207,9 @@
  * {@hide}
  */
 public final class RIL extends BaseCommands implements CommandsInterface {
-    static final String LOG_TAG = "RILJ";
+    static final String RILJ_LOG_TAG = "RILJ";
     static final boolean RILJ_LOGD = true;
-    static final boolean RILJ_LOGV = false; // STOP SHIP if true
+    static final boolean RILJ_LOGV = false; // STOPSHIP if true
 
     /**
      * Wake lock timeout should be longer than the longest timeout in
@@ -273,7 +274,7 @@
             } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
                 sendScreenState(false);
             } else {
-                Rlog.w(LOG_TAG, "RIL received unexpected Intent: " + intent.getAction());
+                Rlog.w(RILJ_LOG_TAG, "RIL received unexpected Intent: " + intent.getAction());
             }
         }
     };
@@ -287,6 +288,7 @@
         byte[] dataLength = new byte[4];
 
         //***** Runnable implementation
+        @Override
         public void
         run() {
             //setup if needed
@@ -332,9 +334,9 @@
 
                         byte[] data;
 
-                        data = rr.mp.marshall();
-                        rr.mp.recycle();
-                        rr.mp = null;
+                        data = rr.mParcel.marshall();
+                        rr.mParcel.recycle();
+                        rr.mParcel = null;
 
                         if (data.length > RIL_MAX_COMMAND_BYTES) {
                             throw new RuntimeException(
@@ -347,12 +349,12 @@
                         dataLength[2] = (byte)((data.length >> 8) & 0xff);
                         dataLength[3] = (byte)((data.length) & 0xff);
 
-                        //Rlog.v(LOG_TAG, "writing packet: " + data.length + " bytes");
+                        //Rlog.v(RILJ_LOG_TAG, "writing packet: " + data.length + " bytes");
 
                         s.getOutputStream().write(dataLength);
                         s.getOutputStream().write(data);
                     } catch (IOException ex) {
-                        Rlog.e(LOG_TAG, "IOException", ex);
+                        Rlog.e(RILJ_LOG_TAG, "IOException", ex);
                         req = findAndRemoveRequestFromList(rr.mSerial);
                         // make sure this request has not already been handled,
                         // eg, if RILReceiver cleared the list.
@@ -361,7 +363,7 @@
                             rr.release();
                         }
                     } catch (RuntimeException exc) {
-                        Rlog.e(LOG_TAG, "Uncaught exception ", exc);
+                        Rlog.e(RILJ_LOG_TAG, "Uncaught exception ", exc);
                         req = findAndRemoveRequestFromList(rr.mSerial);
                         // make sure this request has not already been handled,
                         // eg, if RILReceiver cleared the list.
@@ -397,7 +399,7 @@
                             // Note: Keep mRequestList so that delayed response
                             // can still be handled when response finally comes.
                             if (mRequestMessagesWaiting != 0) {
-                                Rlog.d(LOG_TAG, "NOTE: mReqWaiting is NOT 0 but"
+                                Rlog.d(RILJ_LOG_TAG, "NOTE: mReqWaiting is NOT 0 but"
                                         + mRequestMessagesWaiting + " at TIMEOUT, reset!"
                                         + " There still msg waitng for response");
 
@@ -406,12 +408,12 @@
                                 if (RILJ_LOGD) {
                                     synchronized (mRequestList) {
                                         int count = mRequestList.size();
-                                        Rlog.d(LOG_TAG, "WAKE_LOCK_TIMEOUT " +
+                                        Rlog.d(RILJ_LOG_TAG, "WAKE_LOCK_TIMEOUT " +
                                                 " mRequestList=" + count);
 
                                         for (int i = 0; i < count; i++) {
                                             rr = mRequestList.get(i);
-                                            Rlog.d(LOG_TAG, i + ": [" + rr.mSerial + "] "
+                                            Rlog.d(RILJ_LOG_TAG, i + ": [" + rr.mSerial + "] "
                                                     + requestToString(rr.mRequest));
                                         }
                                     }
@@ -425,7 +427,7 @@
                             // should already sent out (i.e.
                             // mRequestMessagesPending is 0 )while TIMEOUT occurs.
                             if (mRequestMessagesPending != 0) {
-                                Rlog.e(LOG_TAG, "ERROR: mReqPending is NOT 0 but"
+                                Rlog.e(RILJ_LOG_TAG, "ERROR: mReqPending is NOT 0 but"
                                         + mRequestMessagesPending + " at TIMEOUT, reset!");
                                 mRequestMessagesPending = 0;
 
@@ -465,7 +467,7 @@
             countRead = is.read(buffer, offset, remaining);
 
             if (countRead < 0 ) {
-                Rlog.e(LOG_TAG, "Hit EOS reading message length");
+                Rlog.e(RILJ_LOG_TAG, "Hit EOS reading message length");
                 return -1;
             }
 
@@ -485,7 +487,7 @@
             countRead = is.read(buffer, offset, remaining);
 
             if (countRead < 0 ) {
-                Rlog.e(LOG_TAG, "Hit EOS reading message.  messageLength=" + messageLength
+                Rlog.e(RILJ_LOG_TAG, "Hit EOS reading message.  messageLength=" + messageLength
                         + " remaining=" + remaining);
                 return -1;
             }
@@ -504,6 +506,7 @@
             buffer = new byte[RIL_MAX_COMMAND_BYTES];
         }
 
+        @Override
         public void
         run() {
             int retryCount = 0;
@@ -530,12 +533,12 @@
                     // or after the 8th time
 
                     if (retryCount == 8) {
-                        Rlog.e (LOG_TAG,
+                        Rlog.e (RILJ_LOG_TAG,
                             "Couldn't find '" + SOCKET_NAME_RIL
                             + "' socket after " + retryCount
                             + " times, continuing to retry silently");
                     } else if (retryCount > 0 && retryCount < 8) {
-                        Rlog.i (LOG_TAG,
+                        Rlog.i (RILJ_LOG_TAG,
                             "Couldn't find '" + SOCKET_NAME_RIL
                             + "' socket; retrying after timeout");
                     }
@@ -552,7 +555,7 @@
                 retryCount = 0;
 
                 mSocket = s;
-                Rlog.i(LOG_TAG, "Connected to '" + SOCKET_NAME_RIL + "' socket");
+                Rlog.i(RILJ_LOG_TAG, "Connected to '" + SOCKET_NAME_RIL + "' socket");
 
                 int length = 0;
                 try {
@@ -572,20 +575,20 @@
                         p.unmarshall(buffer, 0, length);
                         p.setDataPosition(0);
 
-                        //Rlog.v(LOG_TAG, "Read packet: " + length + " bytes");
+                        //Rlog.v(RILJ_LOG_TAG, "Read packet: " + length + " bytes");
 
                         processResponse(p);
                         p.recycle();
                     }
                 } catch (java.io.IOException ex) {
-                    Rlog.i(LOG_TAG, "'" + SOCKET_NAME_RIL + "' socket closed",
+                    Rlog.i(RILJ_LOG_TAG, "'" + SOCKET_NAME_RIL + "' socket closed",
                           ex);
                 } catch (Throwable tr) {
-                    Rlog.e(LOG_TAG, "Uncaught exception read length=" + length +
+                    Rlog.e(RILJ_LOG_TAG, "Uncaught exception read length=" + length +
                         "Exception:" + tr.toString());
                 }
 
-                Rlog.i(LOG_TAG, "Disconnected from '" + SOCKET_NAME_RIL
+                Rlog.i(RILJ_LOG_TAG, "Disconnected from '" + SOCKET_NAME_RIL
                       + "' socket");
 
                 setRadioState (RadioState.RADIO_UNAVAILABLE);
@@ -601,7 +604,7 @@
                 // Clear request list on close
                 clearRequestList(RADIO_NOT_AVAILABLE, false);
             }} catch (Throwable tr) {
-                Rlog.e(LOG_TAG,"Uncaught exception", tr);
+                Rlog.e(RILJ_LOG_TAG,"Uncaught exception", tr);
             }
 
             /* We're disconnected so we don't know the ril version */
@@ -624,7 +627,7 @@
         mPhoneType = RILConstants.NO_PHONE;
 
         PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
-        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
+        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, RILJ_LOG_TAG);
         mWakeLock.setReferenceCounted(false);
         mWakeLockTimeout = SystemProperties.getInt(TelephonyProperties.PROPERTY_WAKE_LOCK_TIMEOUT,
                 DEFAULT_WAKE_LOCK_TIMEOUT);
@@ -658,6 +661,7 @@
 
     //***** CommandsInterface implementation
 
+    @Override
     public void getVoiceRadioTechnology(Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_VOICE_RADIO_TECH, result);
 
@@ -680,6 +684,7 @@
         }
     }
 
+    @Override
     public void
     getIccCardStatus(Message result) {
         //Note: This RIL request has not been renamed to ICC,
@@ -704,9 +709,9 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(2);
-        rr.mp.writeString(pin);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(2);
+        rr.mParcel.writeString(pin);
+        rr.mParcel.writeString(aid);
 
         send(rr);
     }
@@ -724,10 +729,10 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(3);
-        rr.mp.writeString(puk);
-        rr.mp.writeString(newPin);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(3);
+        rr.mParcel.writeString(puk);
+        rr.mParcel.writeString(newPin);
+        rr.mParcel.writeString(aid);
 
         send(rr);
     }
@@ -745,9 +750,9 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(2);
-        rr.mp.writeString(pin);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(2);
+        rr.mParcel.writeString(pin);
+        rr.mParcel.writeString(aid);
 
         send(rr);
     }
@@ -765,10 +770,10 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(3);
-        rr.mp.writeString(puk);
-        rr.mp.writeString(newPin2);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(3);
+        rr.mParcel.writeString(puk);
+        rr.mParcel.writeString(newPin2);
+        rr.mParcel.writeString(aid);
 
         send(rr);
     }
@@ -786,10 +791,10 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(3);
-        rr.mp.writeString(oldPin);
-        rr.mp.writeString(newPin);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(3);
+        rr.mParcel.writeString(oldPin);
+        rr.mParcel.writeString(newPin);
+        rr.mParcel.writeString(aid);
 
         send(rr);
     }
@@ -807,40 +812,43 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(3);
-        rr.mp.writeString(oldPin2);
-        rr.mp.writeString(newPin2);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(3);
+        rr.mParcel.writeString(oldPin2);
+        rr.mParcel.writeString(newPin2);
+        rr.mParcel.writeString(aid);
 
         send(rr);
     }
 
+    @Override
     public void
     changeBarringPassword(String facility, String oldPwd, String newPwd, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CHANGE_BARRING_PASSWORD, result);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(3);
-        rr.mp.writeString(facility);
-        rr.mp.writeString(oldPwd);
-        rr.mp.writeString(newPwd);
+        rr.mParcel.writeInt(3);
+        rr.mParcel.writeString(facility);
+        rr.mParcel.writeString(oldPwd);
+        rr.mParcel.writeString(newPwd);
 
         send(rr);
     }
 
+    @Override
     public void
     supplyNetworkDepersonalization(String netpin, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, result);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeInt(1);
-        rr.mp.writeString(netpin);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeString(netpin);
 
         send(rr);
     }
 
+    @Override
     public void
     getCurrentCalls (Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_CURRENT_CALLS, result);
@@ -850,11 +858,13 @@
         send(rr);
     }
 
+    @Override
     @Deprecated public void
     getPDPContextList(Message result) {
         getDataCallList(result);
     }
 
+    @Override
     public void
     getDataCallList(Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_DATA_CALL_LIST, result);
@@ -864,26 +874,28 @@
         send(rr);
     }
 
+    @Override
     public void
     dial (String address, int clirMode, Message result) {
         dial(address, clirMode, null, result);
     }
 
+    @Override
     public void
     dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
 
-        rr.mp.writeString(address);
-        rr.mp.writeInt(clirMode);
-        rr.mp.writeInt(0); // UUS information is absent
+        rr.mParcel.writeString(address);
+        rr.mParcel.writeInt(clirMode);
+        rr.mParcel.writeInt(0); // UUS information is absent
 
         if (uusInfo == null) {
-            rr.mp.writeInt(0); // UUS information is absent
+            rr.mParcel.writeInt(0); // UUS information is absent
         } else {
-            rr.mp.writeInt(1); // UUS information is present
-            rr.mp.writeInt(uusInfo.getType());
-            rr.mp.writeInt(uusInfo.getDcs());
-            rr.mp.writeByteArray(uusInfo.getUserData());
+            rr.mParcel.writeInt(1); // UUS information is present
+            rr.mParcel.writeInt(uusInfo.getType());
+            rr.mParcel.writeInt(uusInfo.getDcs());
+            rr.mParcel.writeByteArray(uusInfo.getUserData());
         }
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
@@ -891,17 +903,19 @@
         send(rr);
     }
 
+    @Override
     public void
     getIMSI(Message result) {
         getIMSIForApp(null, result);
     }
 
+    @Override
     public void
     getIMSIForApp(String aid, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMSI, result);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeString(aid);
 
         if (RILJ_LOGD) riljLog(rr.serialString() +
                               "> getIMSI: " + requestToString(rr.mRequest)
@@ -910,6 +924,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getIMEI(Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMEI, result);
@@ -919,6 +934,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getIMEISV(Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMEISV, result);
@@ -929,6 +945,7 @@
     }
 
 
+    @Override
     public void
     hangupConnection (int gsmIndex, Message result) {
         if (RILJ_LOGD) riljLog("hangupConnection: gsmIndex=" + gsmIndex);
@@ -938,12 +955,13 @@
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " +
                 gsmIndex);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(gsmIndex);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(gsmIndex);
 
         send(rr);
     }
 
+    @Override
     public void
     hangupWaitingOrBackground (Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND,
@@ -954,6 +972,7 @@
         send(rr);
     }
 
+    @Override
     public void
     hangupForegroundResumeBackground (Message result) {
         RILRequest rr
@@ -965,6 +984,7 @@
         send(rr);
     }
 
+    @Override
     public void
     switchWaitingOrHoldingAndActive (Message result) {
         RILRequest rr
@@ -976,6 +996,7 @@
         send(rr);
     }
 
+    @Override
     public void
     conference (Message result) {
         RILRequest rr
@@ -987,22 +1008,25 @@
     }
 
 
+    @Override
     public void setPreferredVoicePrivacy(boolean enable, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE,
                 result);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(enable ? 1:0);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(enable ? 1:0);
 
         send(rr);
     }
 
+    @Override
     public void getPreferredVoicePrivacy(Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE,
                 result);
         send(rr);
     }
 
+    @Override
     public void
     separateConnection (int gsmIndex, Message result) {
         RILRequest rr
@@ -1011,12 +1035,13 @@
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                             + " " + gsmIndex);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(gsmIndex);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(gsmIndex);
 
         send(rr);
     }
 
+    @Override
     public void
     acceptCall (Message result) {
         RILRequest rr
@@ -1027,6 +1052,7 @@
         send(rr);
     }
 
+    @Override
     public void
     rejectCall (Message result) {
         RILRequest rr
@@ -1037,6 +1063,7 @@
         send(rr);
     }
 
+    @Override
     public void
     explicitCallTransfer (Message result) {
         RILRequest rr
@@ -1047,6 +1074,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getLastCallFailCause (Message result) {
         RILRequest rr
@@ -1060,6 +1088,8 @@
     /**
      * @deprecated
      */
+    @Deprecated
+    @Override
     public void
     getLastPdpFailCause (Message result) {
         getLastDataCallFailCause (result);
@@ -1068,6 +1098,7 @@
     /**
      * The preferred new alternative to getLastPdpFailCause
      */
+    @Override
     public void
     getLastDataCallFailCause (Message result) {
         RILRequest rr
@@ -1078,6 +1109,7 @@
         send(rr);
     }
 
+    @Override
     public void
     setMute (boolean enableMute, Message response) {
         RILRequest rr
@@ -1086,12 +1118,13 @@
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                             + " " + enableMute);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(enableMute ? 1 : 0);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(enableMute ? 1 : 0);
 
         send(rr);
     }
 
+    @Override
     public void
     getMute (Message response) {
         RILRequest rr
@@ -1102,6 +1135,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getSignalStrength (Message result) {
         RILRequest rr
@@ -1112,6 +1146,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getVoiceRegistrationState (Message result) {
         RILRequest rr
@@ -1122,6 +1157,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getDataRegistrationState (Message result) {
         RILRequest rr
@@ -1132,6 +1168,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getOperator(Message result) {
         RILRequest rr
@@ -1142,6 +1179,7 @@
         send(rr);
     }
 
+    @Override
     public void
     sendDtmf(char c, Message result) {
         RILRequest rr
@@ -1149,11 +1187,12 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeString(Character.toString(c));
+        rr.mParcel.writeString(Character.toString(c));
 
         send(rr);
     }
 
+    @Override
     public void
     startDtmf(char c, Message result) {
         RILRequest rr
@@ -1161,11 +1200,12 @@
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeString(Character.toString(c));
+        rr.mParcel.writeString(Character.toString(c));
 
         send(rr);
     }
 
+    @Override
     public void
     stopDtmf(Message result) {
         RILRequest rr
@@ -1176,14 +1216,15 @@
         send(rr);
     }
 
+    @Override
     public void
     sendBurstDtmf(String dtmfString, int on, int off, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_BURST_DTMF, result);
 
-        rr.mp.writeInt(3);
-        rr.mp.writeString(dtmfString);
-        rr.mp.writeString(Integer.toString(on));
-        rr.mp.writeString(Integer.toString(off));
+        rr.mParcel.writeInt(3);
+        rr.mParcel.writeString(dtmfString);
+        rr.mParcel.writeString(Integer.toString(on));
+        rr.mParcel.writeString(Integer.toString(off));
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " : " + dtmfString);
@@ -1191,20 +1232,22 @@
         send(rr);
     }
 
+    @Override
     public void
     sendSMS (String smscPDU, String pdu, Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SEND_SMS, result);
 
-        rr.mp.writeInt(2);
-        rr.mp.writeString(smscPDU);
-        rr.mp.writeString(pdu);
+        rr.mParcel.writeInt(2);
+        rr.mParcel.writeString(smscPDU);
+        rr.mParcel.writeString(pdu);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
         send(rr);
     }
 
+    @Override
     public void
     sendCdmaSms(byte[] pdu, Message result) {
         int address_nbr_of_digits;
@@ -1217,30 +1260,30 @@
                 = RILRequest.obtain(RIL_REQUEST_CDMA_SEND_SMS, result);
 
         try {
-            rr.mp.writeInt(dis.readInt()); //teleServiceId
-            rr.mp.writeByte((byte) dis.readInt()); //servicePresent
-            rr.mp.writeInt(dis.readInt()); //serviceCategory
-            rr.mp.writeInt(dis.read()); //address_digit_mode
-            rr.mp.writeInt(dis.read()); //address_nbr_mode
-            rr.mp.writeInt(dis.read()); //address_ton
-            rr.mp.writeInt(dis.read()); //address_nbr_plan
+            rr.mParcel.writeInt(dis.readInt()); //teleServiceId
+            rr.mParcel.writeByte((byte) dis.readInt()); //servicePresent
+            rr.mParcel.writeInt(dis.readInt()); //serviceCategory
+            rr.mParcel.writeInt(dis.read()); //address_digit_mode
+            rr.mParcel.writeInt(dis.read()); //address_nbr_mode
+            rr.mParcel.writeInt(dis.read()); //address_ton
+            rr.mParcel.writeInt(dis.read()); //address_nbr_plan
             address_nbr_of_digits = (byte) dis.read();
-            rr.mp.writeByte((byte) address_nbr_of_digits);
+            rr.mParcel.writeByte((byte) address_nbr_of_digits);
             for(int i=0; i < address_nbr_of_digits; i++){
-                rr.mp.writeByte(dis.readByte()); // address_orig_bytes[i]
+                rr.mParcel.writeByte(dis.readByte()); // address_orig_bytes[i]
             }
-            rr.mp.writeInt(dis.read()); //subaddressType
-            rr.mp.writeByte((byte) dis.read()); //subaddr_odd
+            rr.mParcel.writeInt(dis.read()); //subaddressType
+            rr.mParcel.writeByte((byte) dis.read()); //subaddr_odd
             subaddr_nbr_of_digits = (byte) dis.read();
-            rr.mp.writeByte((byte) subaddr_nbr_of_digits);
+            rr.mParcel.writeByte((byte) subaddr_nbr_of_digits);
             for(int i=0; i < subaddr_nbr_of_digits; i++){
-                rr.mp.writeByte(dis.readByte()); //subaddr_orig_bytes[i]
+                rr.mParcel.writeByte(dis.readByte()); //subaddr_orig_bytes[i]
             }
 
             bearerDataLength = dis.read();
-            rr.mp.writeInt(bearerDataLength);
+            rr.mParcel.writeInt(bearerDataLength);
             for(int i=0; i < bearerDataLength; i++){
-                rr.mp.writeByte(dis.readByte()); //bearerData[i]
+                rr.mParcel.writeByte(dis.readByte()); //bearerData[i]
             }
         }catch (IOException ex){
             if (RILJ_LOGD) riljLog("sendSmsCdma: conversion from input stream to object failed: "
@@ -1252,71 +1295,67 @@
         send(rr);
     }
 
+    @Override
     public void deleteSmsOnSim(int index, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_DELETE_SMS_ON_SIM,
                 response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(index);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(index);
 
-        if (false) {
-            if (RILJ_LOGD) riljLog(rr.serialString() + "> "
-                    + requestToString(rr.mRequest)
-                    + " " + index);
-        }
+        if (RILJ_LOGV) riljLog(rr.serialString() + "> "
+                + requestToString(rr.mRequest)
+                + " " + index);
 
         send(rr);
     }
 
+    @Override
     public void deleteSmsOnRuim(int index, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM,
                 response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(index);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(index);
 
-        if (false) {
-            if (RILJ_LOGD) riljLog(rr.serialString() + "> "
-                    + requestToString(rr.mRequest)
-                    + " " + index);
-        }
+        if (RILJ_LOGV) riljLog(rr.serialString() + "> "
+                + requestToString(rr.mRequest)
+                + " " + index);
 
         send(rr);
     }
 
+    @Override
     public void writeSmsToSim(int status, String smsc, String pdu, Message response) {
         status = translateStatus(status);
 
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_WRITE_SMS_TO_SIM,
                 response);
 
-        rr.mp.writeInt(status);
-        rr.mp.writeString(pdu);
-        rr.mp.writeString(smsc);
+        rr.mParcel.writeInt(status);
+        rr.mParcel.writeString(pdu);
+        rr.mParcel.writeString(smsc);
 
-        if (false) {
-            if (RILJ_LOGD) riljLog(rr.serialString() + "> "
-                    + requestToString(rr.mRequest)
-                    + " " + status);
-        }
+        if (RILJ_LOGV) riljLog(rr.serialString() + "> "
+                + requestToString(rr.mRequest)
+                + " " + status);
 
         send(rr);
     }
 
+    @Override
     public void writeSmsToRuim(int status, String pdu, Message response) {
         status = translateStatus(status);
 
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM,
                 response);
 
-        rr.mp.writeInt(status);
-        rr.mp.writeString(pdu);
+        rr.mParcel.writeInt(status);
+        rr.mParcel.writeString(pdu);
 
-        if (false) {
-            if (RILJ_LOGD) riljLog(rr.serialString() + "> "
-                    + requestToString(rr.mRequest)
-                    + " " + status);
-        }
+        if (RILJ_LOGV) riljLog(rr.serialString() + "> "
+                + requestToString(rr.mRequest)
+                + " " + status);
 
         send(rr);
     }
@@ -1341,6 +1380,7 @@
         return 1;
     }
 
+    @Override
     public void
     setupDataCall(String radioTechnology, String profile, String apn,
             String user, String password, String authType, String protocol,
@@ -1348,15 +1388,15 @@
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SETUP_DATA_CALL, result);
 
-        rr.mp.writeInt(7);
+        rr.mParcel.writeInt(7);
 
-        rr.mp.writeString(radioTechnology);
-        rr.mp.writeString(profile);
-        rr.mp.writeString(apn);
-        rr.mp.writeString(user);
-        rr.mp.writeString(password);
-        rr.mp.writeString(authType);
-        rr.mp.writeString(protocol);
+        rr.mParcel.writeString(radioTechnology);
+        rr.mParcel.writeString(profile);
+        rr.mParcel.writeString(apn);
+        rr.mParcel.writeString(user);
+        rr.mParcel.writeString(password);
+        rr.mParcel.writeString(authType);
+        rr.mParcel.writeString(protocol);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> "
                 + requestToString(rr.mRequest) + " " + radioTechnology + " "
@@ -1366,14 +1406,15 @@
         send(rr);
     }
 
+    @Override
     public void
     deactivateDataCall(int cid, int reason, Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_DEACTIVATE_DATA_CALL, result);
 
-        rr.mp.writeInt(2);
-        rr.mp.writeString(Integer.toString(cid));
-        rr.mp.writeString(Integer.toString(reason));
+        rr.mParcel.writeInt(2);
+        rr.mParcel.writeString(Integer.toString(cid));
+        rr.mParcel.writeString(Integer.toString(reason));
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " +
                 requestToString(rr.mRequest) + " " + cid + " " + reason);
@@ -1381,12 +1422,13 @@
         send(rr);
     }
 
+    @Override
     public void
     setRadioPower(boolean on, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_RADIO_POWER, result);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(on ? 1 : 0);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(on ? 1 : 0);
 
         if (RILJ_LOGD) {
             riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -1396,13 +1438,14 @@
         send(rr);
     }
 
+    @Override
     public void
     setSuppServiceNotifications(boolean enable, Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, result);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(enable ? 1 : 0);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(enable ? 1 : 0);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> "
                 + requestToString(rr.mRequest));
@@ -1410,14 +1453,15 @@
         send(rr);
     }
 
+    @Override
     public void
     acknowledgeLastIncomingGsmSms(boolean success, int cause, Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SMS_ACKNOWLEDGE, result);
 
-        rr.mp.writeInt(2);
-        rr.mp.writeInt(success ? 1 : 0);
-        rr.mp.writeInt(cause);
+        rr.mParcel.writeInt(2);
+        rr.mParcel.writeInt(success ? 1 : 0);
+        rr.mParcel.writeInt(cause);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " " + success + " " + cause);
@@ -1425,14 +1469,15 @@
         send(rr);
     }
 
+    @Override
     public void
     acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, result);
 
-        rr.mp.writeInt(success ? 0 : 1); //RIL_CDMA_SMS_ErrorClass
+        rr.mParcel.writeInt(success ? 0 : 1); //RIL_CDMA_SMS_ErrorClass
         // cause code according to X.S004-550E
-        rr.mp.writeInt(cause);
+        rr.mParcel.writeInt(cause);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " " + success + " " + cause);
@@ -1440,14 +1485,15 @@
         send(rr);
     }
 
+    @Override
     public void
     acknowledgeIncomingGsmSmsWithPdu(boolean success, String ackPdu, Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, result);
 
-        rr.mp.writeInt(2);
-        rr.mp.writeString(success ? "1" : "0");
-        rr.mp.writeString(ackPdu);
+        rr.mParcel.writeInt(2);
+        rr.mParcel.writeString(success ? "1" : "0");
+        rr.mParcel.writeString(ackPdu);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + ' ' + success + " [" + ackPdu + ']');
@@ -1455,11 +1501,13 @@
         send(rr);
     }
 
+    @Override
     public void
     iccIO (int command, int fileid, String path, int p1, int p2, int p3,
             String data, String pin2, Message result) {
         iccIOForApp(command, fileid, path, p1, p2, p3, data, pin2, null, result);
     }
+    @Override
     public void
     iccIOForApp (int command, int fileid, String path, int p1, int p2, int p3,
             String data, String pin2, String aid, Message result) {
@@ -1468,15 +1516,15 @@
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SIM_IO, result);
 
-        rr.mp.writeInt(command);
-        rr.mp.writeInt(fileid);
-        rr.mp.writeString(path);
-        rr.mp.writeInt(p1);
-        rr.mp.writeInt(p2);
-        rr.mp.writeInt(p3);
-        rr.mp.writeString(data);
-        rr.mp.writeString(pin2);
-        rr.mp.writeString(aid);
+        rr.mParcel.writeInt(command);
+        rr.mParcel.writeInt(fileid);
+        rr.mParcel.writeString(path);
+        rr.mParcel.writeInt(p1);
+        rr.mParcel.writeInt(p2);
+        rr.mParcel.writeInt(p3);
+        rr.mParcel.writeString(data);
+        rr.mParcel.writeString(pin2);
+        rr.mParcel.writeString(aid);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> iccIO: "
                 + requestToString(rr.mRequest)
@@ -1489,6 +1537,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getCLIR(Message result) {
         RILRequest rr
@@ -1499,15 +1548,16 @@
         send(rr);
     }
 
+    @Override
     public void
     setCLIR(int clirMode, Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SET_CLIR, result);
 
         // count ints
-        rr.mp.writeInt(1);
+        rr.mParcel.writeInt(1);
 
-        rr.mp.writeInt(clirMode);
+        rr.mParcel.writeInt(clirMode);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                     + " " + clirMode);
@@ -1515,13 +1565,14 @@
         send(rr);
     }
 
+    @Override
     public void
     queryCallWaiting(int serviceClass, Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_QUERY_CALL_WAITING, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(serviceClass);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(serviceClass);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                     + " " + serviceClass);
@@ -1529,14 +1580,15 @@
         send(rr);
     }
 
+    @Override
     public void
     setCallWaiting(boolean enable, int serviceClass, Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SET_CALL_WAITING, response);
 
-        rr.mp.writeInt(2);
-        rr.mp.writeInt(enable ? 1 : 0);
-        rr.mp.writeInt(serviceClass);
+        rr.mParcel.writeInt(2);
+        rr.mParcel.writeInt(enable ? 1 : 0);
+        rr.mParcel.writeInt(serviceClass);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " " + enable + ", " + serviceClass);
@@ -1544,6 +1596,7 @@
         send(rr);
     }
 
+    @Override
     public void
     setNetworkSelectionModeAutomatic(Message response) {
         RILRequest rr
@@ -1555,6 +1608,7 @@
         send(rr);
     }
 
+    @Override
     public void
     setNetworkSelectionModeManual(String operatorNumeric, Message response) {
         RILRequest rr
@@ -1564,11 +1618,12 @@
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                     + " " + operatorNumeric);
 
-        rr.mp.writeString(operatorNumeric);
+        rr.mParcel.writeString(operatorNumeric);
 
         send(rr);
     }
 
+    @Override
     public void
     getNetworkSelectionMode(Message response) {
         RILRequest rr
@@ -1580,6 +1635,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getAvailableNetworks(Message response) {
         RILRequest rr
@@ -1591,18 +1647,19 @@
         send(rr);
     }
 
+    @Override
     public void
     setCallForward(int action, int cfReason, int serviceClass,
                 String number, int timeSeconds, Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SET_CALL_FORWARD, response);
 
-        rr.mp.writeInt(action);
-        rr.mp.writeInt(cfReason);
-        rr.mp.writeInt(serviceClass);
-        rr.mp.writeInt(PhoneNumberUtils.toaFromString(number));
-        rr.mp.writeString(number);
-        rr.mp.writeInt (timeSeconds);
+        rr.mParcel.writeInt(action);
+        rr.mParcel.writeInt(cfReason);
+        rr.mParcel.writeInt(serviceClass);
+        rr.mParcel.writeInt(PhoneNumberUtils.toaFromString(number));
+        rr.mParcel.writeString(number);
+        rr.mParcel.writeInt (timeSeconds);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                     + " " + action + " " + cfReason + " " + serviceClass
@@ -1611,18 +1668,19 @@
         send(rr);
     }
 
+    @Override
     public void
     queryCallForwardStatus(int cfReason, int serviceClass,
                 String number, Message response) {
         RILRequest rr
             = RILRequest.obtain(RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, response);
 
-        rr.mp.writeInt(2); // 2 is for query action, not in used anyway
-        rr.mp.writeInt(cfReason);
-        rr.mp.writeInt(serviceClass);
-        rr.mp.writeInt(PhoneNumberUtils.toaFromString(number));
-        rr.mp.writeString(number);
-        rr.mp.writeInt (0);
+        rr.mParcel.writeInt(2); // 2 is for query action, not in used anyway
+        rr.mParcel.writeInt(cfReason);
+        rr.mParcel.writeInt(serviceClass);
+        rr.mParcel.writeInt(PhoneNumberUtils.toaFromString(number));
+        rr.mParcel.writeString(number);
+        rr.mParcel.writeInt (0);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " " + cfReason + " " + serviceClass);
@@ -1630,6 +1688,7 @@
         send(rr);
     }
 
+    @Override
     public void
     queryCLIP(Message response) {
         RILRequest rr
@@ -1641,6 +1700,7 @@
     }
 
 
+    @Override
     public void
     getBasebandVersion (Message response) {
         RILRequest rr
@@ -1669,13 +1729,13 @@
                                                  + " " + appId + "]");
 
         // count strings
-        rr.mp.writeInt(4);
+        rr.mParcel.writeInt(4);
 
-        rr.mp.writeString(facility);
-        rr.mp.writeString(password);
+        rr.mParcel.writeString(facility);
+        rr.mParcel.writeString(password);
 
-        rr.mp.writeString(Integer.toString(serviceClass));
-        rr.mp.writeString(appId);
+        rr.mParcel.writeString(Integer.toString(serviceClass));
+        rr.mParcel.writeString(appId);
 
         send(rr);
     }
@@ -1700,19 +1760,20 @@
                                                         + " " + serviceClass + " " + appId + "]");
 
         // count strings
-        rr.mp.writeInt(5);
+        rr.mParcel.writeInt(5);
 
-        rr.mp.writeString(facility);
+        rr.mParcel.writeString(facility);
         lockString = (lockState)?"1":"0";
-        rr.mp.writeString(lockString);
-        rr.mp.writeString(password);
-        rr.mp.writeString(Integer.toString(serviceClass));
-        rr.mp.writeString(appId);
+        rr.mParcel.writeString(lockString);
+        rr.mParcel.writeString(password);
+        rr.mParcel.writeString(Integer.toString(serviceClass));
+        rr.mParcel.writeString(appId);
 
         send(rr);
 
     }
 
+    @Override
     public void
     sendUSSD (String ussdString, Message response) {
         RILRequest rr
@@ -1725,12 +1786,13 @@
                                    + " " + logUssdString);
         }
 
-        rr.mp.writeString(ussdString);
+        rr.mParcel.writeString(ussdString);
 
         send(rr);
     }
 
     // inherited javadoc suffices
+    @Override
     public void cancelPendingUssd (Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_CANCEL_USSD, response);
@@ -1742,6 +1804,7 @@
     }
 
 
+    @Override
     public void resetRadio(Message result) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_RESET_RADIO, result);
@@ -1751,6 +1814,7 @@
         send(rr);
     }
 
+    @Override
     public void invokeOemRilRequestRaw(byte[] data, Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_OEM_HOOK_RAW, response);
@@ -1758,19 +1822,20 @@
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                + "[" + IccUtils.bytesToHexString(data) + "]");
 
-        rr.mp.writeByteArray(data);
+        rr.mParcel.writeByteArray(data);
 
         send(rr);
 
     }
 
+    @Override
     public void invokeOemRilRequestStrings(String[] strings, Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_OEM_HOOK_STRINGS, response);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeStringArray(strings);
+        rr.mParcel.writeStringArray(strings);
 
         send(rr);
     }
@@ -1781,12 +1846,13 @@
      * @param bandMode one of BM_*_BAND
      * @param response is callback message
      */
+    @Override
     public void setBandMode (int bandMode, Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_SET_BAND_MODE, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(bandMode);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(bandMode);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                  + " " + bandMode);
@@ -1801,6 +1867,7 @@
      *        ((AsyncResult)response.obj).result  is an int[] with every
      *        element representing one avialable BM_*_BAND
      */
+    @Override
     public void queryAvailableBandMode (Message response) {
         RILRequest rr
                 = RILRequest.obtain(RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE,
@@ -1814,32 +1881,35 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendTerminalResponse(String contents, Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, response);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeString(contents);
+        rr.mParcel.writeString(contents);
         send(rr);
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendEnvelope(String contents, Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, response);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
-        rr.mp.writeString(contents);
+        rr.mParcel.writeString(contents);
         send(rr);
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendEnvelopeWithStatus(String contents, Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, response);
@@ -1847,13 +1917,14 @@
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + '[' + contents + ']');
 
-        rr.mp.writeString(contents);
+        rr.mParcel.writeString(contents);
         send(rr);
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void handleCallSetupRequestFromSim(
             boolean accept, Message response) {
 
@@ -1865,7 +1936,7 @@
 
         int[] param = new int[1];
         param[0] = accept ? 1 : 0;
-        rr.mp.writeIntArray(param);
+        rr.mParcel.writeIntArray(param);
         send(rr);
     }
 
@@ -1882,12 +1953,13 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setPreferredNetworkType(int networkType , Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(networkType);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(networkType);
 
         mSetPreferredNetworkType = networkType;
         mPreferredNetworkType = networkType;
@@ -1901,6 +1973,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void getPreferredNetworkType(Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, response);
@@ -1913,6 +1986,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void getNeighboringCids(Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, response);
@@ -1925,10 +1999,11 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setLocationUpdates(boolean enable, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_LOCATION_UPDATES, response);
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(enable ? 1 : 0);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(enable ? 1 : 0);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> "
                 + requestToString(rr.mRequest) + ": " + enable);
@@ -1939,6 +2014,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void getSmscAddress(Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_SMSC_ADDRESS, result);
 
@@ -1950,10 +2026,11 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setSmscAddress(String address, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_SMSC_ADDRESS, result);
 
-        rr.mp.writeString(address);
+        rr.mParcel.writeString(address);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " : " + address);
@@ -1964,10 +2041,11 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void reportSmsMemoryStatus(boolean available, Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, result);
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(available ? 1 : 0);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(available ? 1 : 0);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> "
                 + requestToString(rr.mRequest) + ": " + available);
@@ -1978,6 +2056,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void reportStkServiceIsRunning(Message result) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, result);
 
@@ -1989,6 +2068,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void getGsmBroadcastConfig(Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GSM_GET_BROADCAST_CONFIG, response);
 
@@ -2000,18 +2080,19 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GSM_SET_BROADCAST_CONFIG, response);
 
         int numOfConfig = config.length;
-        rr.mp.writeInt(numOfConfig);
+        rr.mParcel.writeInt(numOfConfig);
 
         for(int i = 0; i < numOfConfig; i++) {
-            rr.mp.writeInt(config[i].getFromServiceId());
-            rr.mp.writeInt(config[i].getToServiceId());
-            rr.mp.writeInt(config[i].getFromCodeScheme());
-            rr.mp.writeInt(config[i].getToCodeScheme());
-            rr.mp.writeInt(config[i].isSelected() ? 1 : 0);
+            rr.mParcel.writeInt(config[i].getFromServiceId());
+            rr.mParcel.writeInt(config[i].getToServiceId());
+            rr.mParcel.writeInt(config[i].getFromCodeScheme());
+            rr.mParcel.writeInt(config[i].getToCodeScheme());
+            rr.mParcel.writeInt(config[i].isSelected() ? 1 : 0);
         }
 
         if (RILJ_LOGD) {
@@ -2028,11 +2109,12 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setGsmBroadcastActivation(boolean activate, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_GSM_BROADCAST_ACTIVATION, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(activate ? 0 : 1);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(activate ? 0 : 1);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
@@ -2043,8 +2125,8 @@
 
     private void sendScreenState(boolean on) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_SCREEN_STATE, null);
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(on ? 1 : 0);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(on ? 1 : 0);
 
         if (RILJ_LOGD) riljLog(rr.serialString()
                 + "> " + requestToString(rr.mRequest) + ": " + on);
@@ -2052,6 +2134,7 @@
         send(rr);
     }
 
+    @Override
     protected void
     onRadioAvailable() {
         // In case screen state was lost (due to process crash),
@@ -2156,7 +2239,7 @@
         synchronized (mRequestList) {
             int count = mRequestList.size();
             if (RILJ_LOGD && loggable) {
-                Rlog.d(LOG_TAG, "WAKE_LOCK_TIMEOUT " +
+                Rlog.d(RILJ_LOG_TAG, "WAKE_LOCK_TIMEOUT " +
                         " mReqPending=" + mRequestMessagesPending +
                         " mRequestList=" + count);
             }
@@ -2164,7 +2247,7 @@
             for (int i = 0; i < count ; i++) {
                 rr = mRequestList.get(i);
                 if (RILJ_LOGD && loggable) {
-                    Rlog.d(LOG_TAG, i + ": [" + rr.mSerial + "] " +
+                    Rlog.d(RILJ_LOG_TAG, i + ": [" + rr.mSerial + "] " +
                             requestToString(rr.mRequest));
                 }
                 rr.onError(error, null);
@@ -2205,7 +2288,7 @@
         rr = findAndRemoveRequestFromList(serial);
 
         if (rr == null) {
-            Rlog.w(LOG_TAG, "Unexpected solicited response! sn: "
+            Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: "
                             + serial + " error: " + error);
             return;
         }
@@ -2343,7 +2426,7 @@
             }} catch (Throwable tr) {
                 // Exceptions here usually mean invalid RIL responses
 
-                Rlog.w(LOG_TAG, rr.serialString() + "< "
+                Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< "
                         + requestToString(rr.mRequest)
                         + " exception, possible invalid RIL response", tr);
 
@@ -2523,7 +2606,7 @@
                 throw new RuntimeException("Unrecognized unsol response: " + response);
             //break; (implied)
         }} catch (Throwable tr) {
-            Rlog.e(LOG_TAG, "Exception processing unsol response: " + response +
+            Rlog.e(RILJ_LOG_TAG, "Exception processing unsol response: " + response +
                 "Exception:" + tr.toString());
             return;
         }
@@ -2794,7 +2877,7 @@
                 try {
                     listInfoRecs = (ArrayList<CdmaInformationRecords>)ret;
                 } catch (ClassCastException e) {
-                    Rlog.e(LOG_TAG, "Unexpected exception casting to listInfoRecs", e);
+                    Rlog.e(RILJ_LOG_TAG, "Unexpected exception casting to listInfoRecs", e);
                     break;
                 }
 
@@ -2973,7 +3056,7 @@
 
         response = p.readStringArray();
 
-        if (false) {
+        if (RILJ_LOGV) {
             num = p.readInt();
 
             response = new String[num];
@@ -3167,7 +3250,7 @@
             dataCall.active = p.readInt();
             dataCall.type = p.readString();
             dataCall.ifname = p.readString();
-            if ((dataCall.status == DataConnection.FailCause.NONE.getErrorCode()) &&
+            if ((dataCall.status == DataConnectionBase.FailCause.NONE.getErrorCode()) &&
                     TextUtils.isEmpty(dataCall.ifname)) {
               throw new RuntimeException("getDataCallState, no ifname");
             }
@@ -3421,7 +3504,8 @@
         CdmaCallWaitingNotification notification = new CdmaCallWaitingNotification();
 
         notification.number = p.readString();
-        notification.numberPresentation = notification.presentationFromCLIP(p.readInt());
+        notification.numberPresentation =
+                CdmaCallWaitingNotification.presentationFromCLIP(p.readInt());
         notification.name = p.readString();
         notification.namePresentation = notification.numberPresentation;
         notification.isPresent = p.readInt();
@@ -3664,11 +3748,11 @@
     }
 
     private void riljLog(String msg) {
-        Rlog.d(LOG_TAG, msg);
+        Rlog.d(RILJ_LOG_TAG, msg);
     }
 
     private void riljLogv(String msg) {
-        Rlog.v(LOG_TAG, msg);
+        Rlog.v(RILJ_LOG_TAG, msg);
     }
 
     private void unsljLog(int response) {
@@ -3689,6 +3773,7 @@
 
 
     // ***** Methods for CDMA support
+    @Override
     public void
     getDeviceIdentity(Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_DEVICE_IDENTITY, response);
@@ -3698,6 +3783,7 @@
         send(rr);
     }
 
+    @Override
     public void
     getCDMASubscription(Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SUBSCRIPTION, response);
@@ -3716,6 +3802,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void queryCdmaRoamingPreference(Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, response);
@@ -3728,12 +3815,13 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(cdmaRoamingType);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(cdmaRoamingType);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " : " + cdmaRoamingType);
@@ -3744,12 +3832,13 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setCdmaSubscriptionSource(int cdmaSubscription , Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(cdmaSubscription);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(cdmaSubscription);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " : " + cdmaSubscription);
@@ -3773,6 +3862,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void queryTTYMode(Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_QUERY_TTY_MODE, response);
@@ -3785,12 +3875,13 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setTTYMode(int ttyMode, Message response) {
         RILRequest rr = RILRequest.obtain(
                 RILConstants.RIL_REQUEST_SET_TTY_MODE, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(ttyMode);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(ttyMode);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " : " + ttyMode);
@@ -3801,11 +3892,12 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void
     sendCDMAFeatureCode(String FeatureCode, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_FLASH, response);
 
-        rr.mp.writeString(FeatureCode);
+        rr.mParcel.writeString(FeatureCode);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                 + " : " + FeatureCode);
@@ -3813,12 +3905,14 @@
         send(rr);
     }
 
+    @Override
     public void getCdmaBroadcastConfig(Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG, response);
 
         send(rr);
     }
 
+    @Override
     public void setCdmaBroadcastConfig(CdmaSmsBroadcastConfigInfo[] configs, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG, response);
 
@@ -3835,11 +3929,11 @@
         }
 
         CdmaSmsBroadcastConfigInfo[] rilConfigs = processedConfigs.toArray(configs);
-        rr.mp.writeInt(rilConfigs.length);
+        rr.mParcel.writeInt(rilConfigs.length);
         for(int i = 0; i < rilConfigs.length; i++) {
-            rr.mp.writeInt(rilConfigs[i].getFromServiceCategory());
-            rr.mp.writeInt(rilConfigs[i].getLanguage());
-            rr.mp.writeInt(rilConfigs[i].isSelected() ? 1 : 0);
+            rr.mParcel.writeInt(rilConfigs[i].getFromServiceCategory());
+            rr.mParcel.writeInt(rilConfigs[i].getLanguage());
+            rr.mParcel.writeInt(rilConfigs[i].isSelected() ? 1 : 0);
         }
 
         if (RILJ_LOGD) {
@@ -3853,11 +3947,12 @@
         send(rr);
     }
 
+    @Override
     public void setCdmaBroadcastActivation(boolean activate, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_BROADCAST_ACTIVATION, response);
 
-        rr.mp.writeInt(1);
-        rr.mp.writeInt(activate ? 0 :1);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(activate ? 0 :1);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
@@ -3867,6 +3962,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void exitEmergencyCallbackMode(Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, response);
 
@@ -3875,10 +3971,11 @@
         send(rr);
     }
 
+    @Override
     public void requestIsimAuthentication(String nonce, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_ISIM_AUTHENTICATION, response);
 
-        rr.mp.writeString(nonce);
+        rr.mParcel.writeString(nonce);
 
         if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
 
diff --git a/src/java/com/android/internal/telephony/RestrictedState.java b/src/java/com/android/internal/telephony/RestrictedState.java
index ad2b88d..1c377e7 100644
--- a/src/java/com/android/internal/telephony/RestrictedState.java
+++ b/src/java/com/android/internal/telephony/RestrictedState.java
@@ -16,8 +16,6 @@
 
 package com.android.internal.telephony;
 
-import android.telephony.ServiceState;
-
 public class RestrictedState {
 
     /**
diff --git a/src/java/com/android/internal/telephony/RetryManager.java b/src/java/com/android/internal/telephony/RetryManager.java
index 7d9dc9c..c0222e9 100644
--- a/src/java/com/android/internal/telephony/RetryManager.java
+++ b/src/java/com/android/internal/telephony/RetryManager.java
@@ -73,7 +73,7 @@
  * {@hide}
  */
 public class RetryManager {
-    static public final String LOG_TAG = "GSM";
+    static public final String LOG_TAG = "RetryManager";
     static public final boolean DBG = true;
     static public final boolean VDBG = false;
 
@@ -106,7 +106,7 @@
     private int mRetryCount;
 
     /** Random number generator */
-    private Random rng = new Random();
+    private Random mRng = new Random();
 
     private String mConfig;
 
@@ -115,6 +115,7 @@
         if (VDBG) log("constructor");
     }
 
+    @Override
     public String toString() {
         String ret = "RetryManager: forever=" + mRetryForever + ", maxRetry=" + mMaxRetryCount +
                 ", retry=" + mRetryCount + ",\n    " + mConfig;
@@ -400,7 +401,7 @@
         if (randomTime == 0) {
             return 0;
         } else {
-            return rng.nextInt(randomTime);
+            return mRng.nextInt(randomTime);
         }
     }
 
diff --git a/src/java/com/android/internal/telephony/SMSDispatcher.java b/src/java/com/android/internal/telephony/SMSDispatcher.java
index a13f30e..b02e24b 100644
--- a/src/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/SMSDispatcher.java
@@ -16,8 +16,10 @@
 
 package com.android.internal.telephony;
 
+import android.Manifest;
 import android.app.Activity;
 import android.app.AlertDialog;
+import android.app.AppOpsManager;
 import android.app.PendingIntent;
 import android.app.PendingIntent.CanceledException;
 import android.content.BroadcastReceiver;
@@ -59,7 +61,6 @@
 import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
-import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.android.internal.R;
@@ -82,15 +83,17 @@
 import static android.telephony.SmsManager.RESULT_ERROR_RADIO_OFF;
 
 public abstract class SMSDispatcher extends Handler {
-    static final String TAG = "SMS";    // accessed from inner class
+    static final String TAG = "SMSDispatcher";    // accessed from inner class
+    static final boolean DBG = false;
     private static final String SEND_NEXT_MSG_EXTRA = "SendNextMsg";
 
     /** Permission required to receive SMS and SMS-CB messages. */
-    public static final String RECEIVE_SMS_PERMISSION = "android.permission.RECEIVE_SMS";
+    public static final String RECEIVE_SMS_PERMISSION = Manifest.permission.RECEIVE_SMS;
 
-    /** Permission required to receive ETWS and CMAS emergency broadcasts. */
+    /** Permission required to receive ETWS and CMAS emergency broadcasts.
+     *  XXX this permission is declared in the Mms app...  wha?!? */
     public static final String RECEIVE_EMERGENCY_BROADCAST_PERMISSION =
-            "android.permission.RECEIVE_EMERGENCY_BROADCAST";
+            Manifest.permission.RECEIVE_EMERGENCY_BROADCAST;
 
     /** Permission required to send SMS to short codes without user confirmation. */
     private static final String SEND_SMS_NO_CONFIRMATION_PERMISSION =
@@ -145,7 +148,7 @@
     protected final Phone mPhone;
     protected final Context mContext;
     protected final ContentResolver mResolver;
-    protected final CommandsInterface mCm;
+    protected final CommandsInterface mCi;
     protected final SmsStorageMonitor mStorageMonitor;
     protected final TelephonyManager mTelephonyManager;
 
@@ -209,7 +212,7 @@
         mWapPush = new WapPushOverSms(phone, this);
         mContext = phone.getContext();
         mResolver = mContext.getContentResolver();
-        mCm = phone.mCM;
+        mCi = phone.mCi;
         mStorageMonitor = storageMonitor;
         mUsageMonitor = usageMonitor;
         mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
@@ -295,9 +298,7 @@
         switch (msg.what) {
         case EVENT_NEW_SMS:
             // A new SMS has been received by the device
-            if (false) {
-                Rlog.d(TAG, "New SMS Message Received");
-            }
+            if (DBG) Rlog.d(TAG, "New SMS Message Received");
 
             SmsMessage sms;
 
@@ -386,12 +387,13 @@
      *
      * @param intent intent to broadcast
      * @param permission Receivers are required to have this permission
+     * @param appOp App op that is being performed when dispatching to a receiver
      */
-    public void dispatch(Intent intent, String permission) {
+    public void dispatch(Intent intent, String permission, int appOp) {
         // Hold a wake lock for WAKE_LOCK_TIMEOUT seconds, enough to give any
         // receivers time to take their own wake locks.
         mWakeLock.acquire(WAKE_LOCK_TIMEOUT);
-        mContext.sendOrderedBroadcast(intent, permission, mResultReceiver,
+        mContext.sendOrderedBroadcast(intent, permission, appOp, mResultReceiver,
                 this, Activity.RESULT_OK, null, null);
     }
 
@@ -401,13 +403,15 @@
      *
      * @param intent intent to broadcast
      * @param permission Receivers are required to have this permission
+     * @param appOp App op that is being performed when dispatching to a receiver
      * @param resultReceiver the result receiver to use
      */
-    public void dispatch(Intent intent, String permission, BroadcastReceiver resultReceiver) {
+    public void dispatch(Intent intent, String permission, int appOp,
+            BroadcastReceiver resultReceiver) {
         // Hold a wake lock for WAKE_LOCK_TIMEOUT seconds, enough to give any
         // receivers time to take their own wake locks.
         mWakeLock.acquire(WAKE_LOCK_TIMEOUT);
-        mContext.sendOrderedBroadcast(intent, permission, resultReceiver,
+        mContext.sendOrderedBroadcast(intent, permission, appOp, resultReceiver,
                 this, Activity.RESULT_OK, null, null);
     }
 
@@ -425,16 +429,13 @@
         PendingIntent sentIntent = tracker.mSentIntent;
 
         if (ar.result != null) {
-            tracker.mMessageRef = ((SmsResponse)ar.result).messageRef;
+            tracker.mMessageRef = ((SmsResponse)ar.result).mMessageRef;
         } else {
             Rlog.d(TAG, "SmsResponse was null");
         }
 
         if (ar.exception == null) {
-            if (false) {
-                Rlog.d(TAG, "SMS send complete. Broadcasting "
-                        + "intent: " + sentIntent);
-            }
+            if (DBG) Rlog.d(TAG, "SMS send complete. Broadcasting intent: " + sentIntent);
 
             if (tracker.mDeliveryIntent != null) {
                 // Expecting a status report.  Add it to the list.
@@ -457,9 +458,7 @@
                 } catch (CanceledException ex) {}
             }
         } else {
-            if (false) {
-                Rlog.d(TAG, "SMS send failed");
-            }
+            if (DBG) Rlog.d(TAG, "SMS send failed");
 
             int ss = mPhone.getServiceState().getState();
 
@@ -490,7 +489,7 @@
                 try {
                     Intent fillIn = new Intent();
                     if (ar.result != null) {
-                        fillIn.putExtra("errorCode", ((SmsResponse)ar.result).errorCode);
+                        fillIn.putExtra("errorCode", ((SmsResponse)ar.result).mErrorCode);
                     }
                     if (mRemainingMessages > -1) {
                         mRemainingMessages--;
@@ -531,7 +530,7 @@
      * Dispatches an incoming SMS messages.
      *
      * @param sms the incoming message from the phone
-     * @return a result code from {@link Telephony.Sms.Intents}, or
+     * @return a result code from {@link android.provider.Telephony.Sms.Intents}, or
      *         {@link Activity#RESULT_OK} if the message has been broadcast
      *         to applications
      */
@@ -542,7 +541,7 @@
      * {@link #dispatchMessage(SmsMessageBase)} if no format-specific handling is required.
      *
      * @param sms
-     * @return
+     * @return {@link Activity#RESULT_OK} on success
      */
     protected int dispatchNormalMessage(SmsMessageBase sms) {
         SmsHeader smsHeader = sms.getUserDataHeader();
@@ -580,7 +579,7 @@
      * If this is the last part send the parts out to the application, otherwise
      * the part is stored for later processing. Handles both 3GPP concatenated messages
      * as well as 3GPP2 format WAP push messages processed by
-     * {@link com.android.internal.telephony.cdma.CdmaSMSDispatcher#processCdmaWapPdu}.
+     * com.android.internal.telephony.cdma.CdmaSMSDispatcher#processCdmaWapPdu.
      *
      * @param pdu the message PDU, or the datagram portion of a CDMA WDP datagram segment
      * @param address the originating address
@@ -592,7 +591,7 @@
      * @param destPort the destination port for the message, or -1 for no destination port
      * @param isCdmaWapPush true if pdu is a CDMA WDP datagram segment and not an SM PDU
      *
-     * @return a result code from {@link Telephony.Sms.Intents}, or
+     * @return a result code from {@link android.provider.Telephony.Sms.Intents}, or
      *         {@link Activity#RESULT_OK} if the message has been broadcast
      *         to applications
      */
@@ -737,7 +736,7 @@
         Intent intent = new Intent(Intents.SMS_RECEIVED_ACTION);
         intent.putExtra("pdus", pdus);
         intent.putExtra("format", getFormat());
-        dispatch(intent, RECEIVE_SMS_PERMISSION);
+        dispatch(intent, RECEIVE_SMS_PERMISSION, AppOpsManager.OP_RECEIVE_SMS);
     }
 
     /**
@@ -751,7 +750,7 @@
         Intent intent = new Intent(Intents.DATA_SMS_RECEIVED_ACTION, uri);
         intent.putExtra("pdus", pdus);
         intent.putExtra("format", getFormat());
-        dispatch(intent, RECEIVE_SMS_PERMISSION);
+        dispatch(intent, RECEIVE_SMS_PERMISSION, AppOpsManager.OP_RECEIVE_SMS);
     }
 
     /**
@@ -1048,7 +1047,7 @@
                     networkCountryIso = mTelephonyManager.getSimCountryIso();
                 }
 
-                smsCategory = mUsageMonitor.mergeShortCodeCategories(smsCategory,
+                smsCategory = SmsUsageMonitor.mergeShortCodeCategories(smsCategory,
                         mUsageMonitor.checkDestination(tracker.mDestAddress, networkCountryIso));
             }
 
@@ -1304,7 +1303,7 @@
             Intent intent = new Intent(Intents.SMS_REJECTED_ACTION);
             intent.putExtra("result", result);
             mWakeLock.acquire(WAKE_LOCK_TIMEOUT);
-            mContext.sendBroadcast(intent, "android.permission.RECEIVE_SMS");
+            mContext.sendBroadcast(intent, Manifest.permission.RECEIVE_SMS);
         }
         acknowledgeLastIncomingSms(success, result, response);
     }
@@ -1341,7 +1340,7 @@
          * @return true if the tracker holds a multi-part SMS; false otherwise
          */
         protected boolean isMultipart() {
-            HashMap map = mData;
+            HashMap<String, Object> map = mData;
             return map.containsKey("parts");
         }
     }
@@ -1454,12 +1453,13 @@
             Intent intent = new Intent(Intents.SMS_EMERGENCY_CB_RECEIVED_ACTION);
             intent.putExtra("message", message);
             Rlog.d(TAG, "Dispatching emergency SMS CB");
-            dispatch(intent, RECEIVE_EMERGENCY_BROADCAST_PERMISSION);
+            dispatch(intent, RECEIVE_EMERGENCY_BROADCAST_PERMISSION,
+                    AppOpsManager.OP_RECEIVE_EMERGECY_SMS);
         } else {
             Intent intent = new Intent(Intents.SMS_CB_RECEIVED_ACTION);
             intent.putExtra("message", message);
             Rlog.d(TAG, "Dispatching SMS CB");
-            dispatch(intent, RECEIVE_SMS_PERMISSION);
+            dispatch(intent, RECEIVE_SMS_PERMISSION, AppOpsManager.OP_RECEIVE_SMS);
         }
     }
 }
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
index d4710cb..86777c6 100644
--- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -16,14 +16,11 @@
 
 package com.android.internal.telephony;
 
-import android.content.Context;
 import android.os.AsyncResult;
 import android.os.Handler;
-import android.os.Looper;
 import android.os.Message;
 import android.os.Registrant;
 import android.os.RegistrantList;
-import android.os.SystemClock;
 import android.telephony.CellInfo;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
@@ -33,6 +30,7 @@
 import java.io.PrintWriter;
 import java.util.List;
 
+import com.android.internal.telephony.dataconnection.DataConnectionTrackerBase;
 import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
 import com.android.internal.telephony.uicc.IccRecords;
 import com.android.internal.telephony.uicc.UiccCardApplication;
@@ -43,15 +41,15 @@
  */
 public abstract class ServiceStateTracker extends Handler {
 
-    protected CommandsInterface cm;
+    protected CommandsInterface mCi;
     protected UiccController mUiccController = null;
     protected UiccCardApplication mUiccApplcation = null;
     protected IccRecords mIccRecords = null;
 
     protected PhoneBase mPhoneBase;
 
-    public ServiceState ss = new ServiceState();
-    protected ServiceState newSS = new ServiceState();
+    public ServiceState mSS = new ServiceState();
+    protected ServiceState mNewSS = new ServiceState();
 
     protected CellInfo mLastCellInfo = null;
 
@@ -75,21 +73,15 @@
      * and ignore stale responses.  The value is a count-down of
      * expected responses in this pollingContext.
      */
-    protected int[] pollingContext;
+    protected int[] mPollingContext;
     protected boolean mDesiredPowerState;
 
     /**
-     *  Values correspond to ServiceState.RIL_RADIO_TECHNOLOGY_ definitions.
-     */
-    protected int mRilRadioTechnology = 0;
-    protected int mNewRilRadioTechnology = 0;
-
-    /**
      * By default, strength polling is enabled.  However, if we're
      * getting unsolicited signal strength updates from the radio, set
      * value to true and don't bother polling any more.
      */
-    protected boolean dontPollSignalStrength = false;
+    protected boolean mDontPollSignalStrength = false;
 
     protected RegistrantList mRoamingOnRegistrants = new RegistrantList();
     protected RegistrantList mRoamingOffRegistrants = new RegistrantList();
@@ -192,14 +184,14 @@
     protected ServiceStateTracker(PhoneBase phoneBase, CommandsInterface ci, CellInfo cellInfo) {
         mPhoneBase = phoneBase;
         mCellInfo = cellInfo;
-        cm = ci;
+        mCi = ci;
         mUiccController = UiccController.getInstance();
         mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);
-        cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
+        mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
     }
 
     public void dispose() {
-        cm.unSetOnSignalStrengthUpdate(this);
+        mCi.unSetOnSignalStrengthUpdate(this);
         mUiccController.unregisterForIccChanged(this);
     }
 
@@ -236,7 +228,7 @@
         Registrant r = new Registrant(h, what, obj);
         mRoamingOnRegistrants.add(r);
 
-        if (ss.getRoaming()) {
+        if (mSS.getRoaming()) {
             r.notifyRegistrant();
         }
     }
@@ -257,7 +249,7 @@
         Registrant r = new Registrant(h, what, obj);
         mRoamingOffRegistrants.add(r);
 
-        if (!ss.getRoaming()) {
+        if (!mSS.getRoaming()) {
             r.notifyRegistrant();
         }
     }
@@ -276,7 +268,7 @@
      * on failure.
      */
     public void reRegisterNetwork(Message onComplete) {
-        cm.getPreferredNetworkType(
+        mCi.getPreferredNetworkType(
                 obtainMessage(EVENT_GET_PREFERRED_NETWORK_TYPE, onComplete));
     }
 
@@ -303,26 +295,26 @@
     public void enableSingleLocationUpdate() {
         if (mWantSingleLocationUpdate || mWantContinuousLocationUpdates) return;
         mWantSingleLocationUpdate = true;
-        cm.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
+        mCi.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
     }
 
     public void enableLocationUpdates() {
         if (mWantSingleLocationUpdate || mWantContinuousLocationUpdates) return;
         mWantContinuousLocationUpdates = true;
-        cm.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
+        mCi.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
     }
 
     protected void disableSingleLocationUpdate() {
         mWantSingleLocationUpdate = false;
         if (!mWantSingleLocationUpdate && !mWantContinuousLocationUpdates) {
-            cm.setLocationUpdates(false, null);
+            mCi.setLocationUpdates(false, null);
         }
     }
 
     public void disableLocationUpdates() {
         mWantContinuousLocationUpdates = false;
         if (!mWantSingleLocationUpdate && !mWantContinuousLocationUpdates) {
-            cm.setLocationUpdates(false, null);
+            mCi.setLocationUpdates(false, null);
         }
     }
 
@@ -411,7 +403,7 @@
         Registrant r = new Registrant(h, what, obj);
 
         mNetworkAttachedRegistrants.add(r);
-        if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
+        if (mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) {
             r.notifyRegistrant();
         }
     }
@@ -462,7 +454,7 @@
      *
      * Hang up the existing voice calls to decrease call drop rate.
      */
-    public void powerOffRadioSafely(DataConnectionTracker dcTracker) {
+    public void powerOffRadioSafely(DataConnectionTrackerBase dcTracker) {
         synchronized (this) {
             if (!mPendingRadioPowerOffAfterDataOff) {
                 // To minimize race conditions we call cleanUpAllConnections on
@@ -539,7 +531,7 @@
     /** Cancel a pending (if any) pollState() operation */
     protected void cancelPollState() {
         // This will effectively cancel the rest of the poll requests.
-        pollingContext = new int[1];
+        mPollingContext = new int[1];
     }
 
     /**
@@ -617,15 +609,13 @@
 
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("ServiceStateTracker:");
-        pw.println(" ss=" + ss);
-        pw.println(" newSS=" + newSS);
+        pw.println(" mSS=" + mSS);
+        pw.println(" mNewSS=" + mNewSS);
         pw.println(" mCellInfo=" + mCellInfo);
         pw.println(" mRestrictedState=" + mRestrictedState);
-        pw.println(" pollingContext=" + pollingContext);
+        pw.println(" mPollingContext=" + mPollingContext);
         pw.println(" mDesiredPowerState=" + mDesiredPowerState);
-        pw.println(" mRilRadioTechnology=" + mRilRadioTechnology);
-        pw.println(" mNewRilRadioTechnology=" + mNewRilRadioTechnology);
-        pw.println(" dontPollSignalStrength=" + dontPollSignalStrength);
+        pw.println(" mDontPollSignalStrength=" + mDontPollSignalStrength);
         pw.println(" mPendingRadioPowerOffAfterDataOff=" + mPendingRadioPowerOffAfterDataOff);
         pw.println(" mPendingRadioPowerOffAfterDataOffTag=" + mPendingRadioPowerOffAfterDataOffTag);
     }
diff --git a/src/java/com/android/internal/telephony/SmsMessageBase.java b/src/java/com/android/internal/telephony/SmsMessageBase.java
index 22d8cd8..b027b1e 100644
--- a/src/java/com/android/internal/telephony/SmsMessageBase.java
+++ b/src/java/com/android/internal/telephony/SmsMessageBase.java
@@ -27,70 +27,69 @@
  * {@hide}
  */
 public abstract class SmsMessageBase {
-    private static final String LOG_TAG = "SMS";
-
     /** {@hide} The address of the SMSC. May be null */
-    protected String scAddress;
+    protected String mScAddress;
 
     /** {@hide} The address of the sender */
-    protected SmsAddress originatingAddress;
+    protected SmsAddress mOriginatingAddress;
 
     /** {@hide} The message body as a string. May be null if the message isn't text */
-    protected String messageBody;
+    protected String mMessageBody;
 
     /** {@hide} */
-    protected String pseudoSubject;
+    protected String mPseudoSubject;
 
     /** {@hide} Non-null if this is an email gateway message */
-    protected String emailFrom;
+    protected String mEmailFrom;
 
     /** {@hide} Non-null if this is an email gateway message */
-    protected String emailBody;
+    protected String mEmailBody;
 
     /** {@hide} */
-    protected boolean isEmail;
+    protected boolean mIsEmail;
 
     /** {@hide} */
-    protected long scTimeMillis;
+    protected long mScTimeMillis;
 
     /** {@hide} The raw PDU of the message */
     protected byte[] mPdu;
 
     /** {@hide} The raw bytes for the user data section of the message */
-    protected byte[] userData;
+    protected byte[] mUserData;
 
     /** {@hide} */
-    protected SmsHeader userDataHeader;
+    protected SmsHeader mUserDataHeader;
 
     // "Message Waiting Indication Group"
     // 23.038 Section 4
     /** {@hide} */
-    protected boolean isMwi;
+    protected boolean mIsMwi;
 
     /** {@hide} */
-    protected boolean mwiSense;
+    protected boolean mMwiSense;
 
     /** {@hide} */
-    protected boolean mwiDontStore;
+    protected boolean mMwiDontStore;
 
     /**
      * Indicates status for messages stored on the ICC.
      */
-    protected int statusOnIcc = -1;
+    protected int mStatusOnIcc = -1;
 
     /**
      * Record index of message in the EF.
      */
-    protected int indexOnIcc = -1;
+    protected int mIndexOnIcc = -1;
 
     /** TP-Message-Reference - Message Reference of sent message. @hide */
-    public int messageRef;
+    public int mMessageRef;
 
     // TODO(): This class is duplicated in SmsMessage.java. Refactor accordingly.
     public static abstract class SubmitPduBase  {
         public byte[] encodedScAddress; // Null if not applicable.
         public byte[] encodedMessage;
 
+        @Override
         public String toString() {
             return "SubmitPdu: encodedScAddress = "
                     + Arrays.toString(encodedScAddress)
@@ -104,7 +103,7 @@
      * or null if there is none.
      */
     public String getServiceCenterAddress() {
-        return scAddress;
+        return mScAddress;
     }
 
     /**
@@ -112,11 +111,11 @@
      * form or null if unavailable
      */
     public String getOriginatingAddress() {
-        if (originatingAddress == null) {
+        if (mOriginatingAddress == null) {
             return null;
         }
 
-        return originatingAddress.getAddressString();
+        return mOriginatingAddress.getAddressString();
     }
 
     /**
@@ -125,8 +124,8 @@
      * unavailable.
      */
     public String getDisplayOriginatingAddress() {
-        if (isEmail) {
-            return emailFrom;
+        if (mIsEmail) {
+            return mEmailFrom;
         } else {
             return getOriginatingAddress();
         }
@@ -137,7 +136,7 @@
      * @return message body is there is one, otherwise null
      */
     public String getMessageBody() {
-        return messageBody;
+        return mMessageBody;
     }
 
     /**
@@ -150,8 +149,8 @@
      * an email gateway. Returns null if message body unavailable.
      */
     public String getDisplayMessageBody() {
-        if (isEmail) {
-            return emailBody;
+        if (mIsEmail) {
+            return mEmailBody;
         } else {
             return getMessageBody();
         }
@@ -162,14 +161,14 @@
      * if not present
      */
     public String getPseudoSubject() {
-        return pseudoSubject == null ? "" : pseudoSubject;
+        return mPseudoSubject == null ? "" : mPseudoSubject;
     }
 
     /**
      * Returns the service centre timestamp in currentTimeMillis() format
      */
     public long getTimestampMillis() {
-        return scTimeMillis;
+        return mScTimeMillis;
     }
 
     /**
@@ -179,7 +178,7 @@
      *         sender / subject / parsed body are available
      */
     public boolean isEmail() {
-        return isEmail;
+        return mIsEmail;
     }
 
     /**
@@ -187,7 +186,7 @@
      *         null otherwise
      */
     public String getEmailBody() {
-        return emailBody;
+        return mEmailBody;
     }
 
     /**
@@ -195,7 +194,7 @@
      *         the gateway. null otherwise
      */
     public String getEmailFrom() {
-        return emailFrom;
+        return mEmailFrom;
     }
 
     /**
@@ -240,7 +239,7 @@
      * present.
      */
     public byte[] getUserData() {
-        return userData;
+        return mUserData;
     }
 
     /**
@@ -249,7 +248,7 @@
      * {@hide}
      */
     public SmsHeader getUserDataHeader() {
-        return userDataHeader;
+        return mUserDataHeader;
     }
 
     /**
@@ -300,7 +299,7 @@
      *         SmsManager.STATUS_ON_ICC_UNSENT
      */
     public int getStatusOnIcc() {
-        return statusOnIcc;
+        return mStatusOnIcc;
     }
 
     /**
@@ -309,13 +308,13 @@
      *         SmsMessage was not created from a ICC SMS EF record.
      */
     public int getIndexOnIcc() {
-        return indexOnIcc;
+        return mIndexOnIcc;
     }
 
     protected void parseMessageBody() {
         // originatingAddress could be null if this message is from a status
         // report.
-        if (originatingAddress != null && originatingAddress.couldBeEmailGateway()) {
+        if (mOriginatingAddress != null && mOriginatingAddress.couldBeEmailGateway()) {
             extractEmailAddressFromMessageBody();
         }
     }
@@ -340,11 +339,11 @@
          * -or-
          * 2. [x@y][ ]/[body]
          */
-         String[] parts = messageBody.split("( /)|( )", 2);
+         String[] parts = mMessageBody.split("( /)|( )", 2);
          if (parts.length < 2) return;
-         emailFrom = parts[0];
-         emailBody = parts[1];
-         isEmail = Telephony.Mms.isEmailAddress(emailFrom);
+         mEmailFrom = parts[0];
+         mEmailBody = parts[1];
+         mIsEmail = Telephony.Mms.isEmailAddress(mEmailFrom);
     }
 
 }
diff --git a/src/java/com/android/internal/telephony/SmsRawData.java b/src/java/com/android/internal/telephony/SmsRawData.java
deleted file mode 100644
index 891d942..0000000
--- a/src/java/com/android/internal/telephony/SmsRawData.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-** Copyright 2007, 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 com.android.internal.telephony;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- *  A parcelable holder class of byte[] for ISms aidl implementation
- */
-public class SmsRawData implements Parcelable {
-    byte[] data;
-
-    //Static Methods
-    public static final Parcelable.Creator<SmsRawData> CREATOR
-            = new Parcelable.Creator<SmsRawData> (){
-        public SmsRawData createFromParcel(Parcel source) {
-            int size;
-            size = source.readInt();
-            byte[] data = new byte[size];
-            source.readByteArray(data);
-            return new SmsRawData(data);
-        }
-
-        public SmsRawData[] newArray(int size) {
-            return new SmsRawData[size];
-        }
-    };
-
-    // Constructor
-    public SmsRawData(byte[] data) {
-        this.data = data;
-    }
-
-    public byte[] getBytes() {
-        return data;
-    }
-
-    public int describeContents() {
-        return 0;
-    }
-
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeInt(data.length);
-        dest.writeByteArray(data);
-    }
-}
diff --git a/src/java/com/android/internal/telephony/SmsResponse.java b/src/java/com/android/internal/telephony/SmsResponse.java
index a7c2840..40f71e7 100644
--- a/src/java/com/android/internal/telephony/SmsResponse.java
+++ b/src/java/com/android/internal/telephony/SmsResponse.java
@@ -23,25 +23,26 @@
  */
 public class SmsResponse {
     /** Message reference of the just-sent SMS. */
-    int messageRef;
+    int mMessageRef;
     /** ackPdu for the just-sent SMS. */
-    String ackPdu;
+    String mAckPdu;
     /**
      * errorCode: See 3GPP 27.005, 3.2.5 for GSM/UMTS,
      * 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA, -1 if unknown or not applicable.
      */
-    int errorCode;
+    int mErrorCode;
 
     public SmsResponse(int messageRef, String ackPdu, int errorCode) {
-        this.messageRef = messageRef;
-        this.ackPdu = ackPdu;
-        this.errorCode = errorCode;
+        mMessageRef = messageRef;
+        mAckPdu = ackPdu;
+        mErrorCode = errorCode;
     }
 
+    @Override
     public String toString() {
-        String ret = "{ messageRef = " + messageRef
-                        + ", errorCode = " + errorCode
-                        + ", ackPdu = " + ackPdu
+        String ret = "{ mMessageRef = " + mMessageRef
+                        + ", mErrorCode = " + mErrorCode
+                        + ", mAckPdu = " + mAckPdu
                         + "}";
         return ret;
     }
diff --git a/src/java/com/android/internal/telephony/SmsStorageMonitor.java b/src/java/com/android/internal/telephony/SmsStorageMonitor.java
index 6a9283f..b30afe0 100644
--- a/src/java/com/android/internal/telephony/SmsStorageMonitor.java
+++ b/src/java/com/android/internal/telephony/SmsStorageMonitor.java
@@ -54,7 +54,7 @@
 
     private boolean mReportMemoryStatusPending;
 
-    final CommandsInterface mCm;                            // accessed from inner class
+    final CommandsInterface mCi;                            // accessed from inner class
     boolean mStorageAvailable = true;                       // accessed from inner class
 
     /**
@@ -69,12 +69,12 @@
      */
     public SmsStorageMonitor(PhoneBase phone) {
         mContext = phone.getContext();
-        mCm = phone.mCM;
+        mCi = phone.mCi;
 
         createWakelock();
 
-        mCm.setOnIccSmsFull(this, EVENT_ICC_FULL, null);
-        mCm.registerForOn(this, EVENT_RADIO_ON, null);
+        mCi.setOnIccSmsFull(this, EVENT_ICC_FULL, null);
+        mCi.registerForOn(this, EVENT_RADIO_ON, null);
 
         // Register for device storage intents.  Use these to notify the RIL
         // that storage for SMS is or is not available.
@@ -85,8 +85,8 @@
     }
 
     public void dispose() {
-        mCm.unSetOnIccSmsFull(this);
-        mCm.unregisterForOn(this);
+        mCi.unSetOnIccSmsFull(this);
+        mCi.unregisterForOn(this);
         mContext.unregisterReceiver(mResultReceiver);
     }
 
@@ -118,7 +118,7 @@
                 if (mReportMemoryStatusPending) {
                     Rlog.v(TAG, "Sending pending memory status report : mStorageAvailable = "
                             + mStorageAvailable);
-                    mCm.reportSmsMemoryStatus(mStorageAvailable,
+                    mCi.reportSmsMemoryStatus(mStorageAvailable,
                             obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
                 }
                 break;
@@ -152,10 +152,10 @@
         public void onReceive(Context context, Intent intent) {
             if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_FULL)) {
                 mStorageAvailable = false;
-                mCm.reportSmsMemoryStatus(false, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
+                mCi.reportSmsMemoryStatus(false, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
             } else if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_NOT_FULL)) {
                 mStorageAvailable = true;
-                mCm.reportSmsMemoryStatus(true, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
+                mCi.reportSmsMemoryStatus(true, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
             }
         }
     };
diff --git a/src/java/com/android/internal/telephony/SmsUsageMonitor.java b/src/java/com/android/internal/telephony/SmsUsageMonitor.java
index 359069c..aa9f4e5 100644
--- a/src/java/com/android/internal/telephony/SmsUsageMonitor.java
+++ b/src/java/com/android/internal/telephony/SmsUsageMonitor.java
@@ -24,7 +24,6 @@
 import android.database.ContentObserver;
 import android.os.Binder;
 import android.os.Handler;
-import android.os.Message;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.UserHandle;
@@ -39,7 +38,6 @@
 
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
 import org.xmlpull.v1.XmlSerializer;
 
 import java.io.File;
@@ -48,7 +46,6 @@
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.IOException;
-import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.HashMap;
@@ -128,9 +125,6 @@
     /** Notice when the enabled setting changes - can be changed through gservices */
     private final AtomicBoolean mCheckEnabled = new AtomicBoolean(true);
 
-    /** Cached short code regex patterns from secure settings for {@link #mCurrentCountry}. */
-    private String mSettingsShortCodePatterns;
-
     /** Handler for responding to content observer updates. */
     private final SettingsObserverHandler mSettingsObserverHandler;
 
diff --git a/src/java/com/android/internal/telephony/TelephonyCapabilities.java b/src/java/com/android/internal/telephony/TelephonyCapabilities.java
index f374f41..bbef33e 100644
--- a/src/java/com/android/internal/telephony/TelephonyCapabilities.java
+++ b/src/java/com/android/internal/telephony/TelephonyCapabilities.java
@@ -163,7 +163,7 @@
      * (Abbreviated Dialing Numbers).
      *
      * Currently this returns true when the phone type is GSM
-     * ({@link Phone#PHONE_TYPE_GSM}).
+     * ({@link PhoneConstants#PHONE_TYPE_GSM}).
      *
      * This is using int for an argument for letting apps outside
      * Phone process access to it, while other methods in this class is
diff --git a/src/java/com/android/internal/telephony/UUSInfo.java b/src/java/com/android/internal/telephony/UUSInfo.java
index 801b845..300887c 100644
--- a/src/java/com/android/internal/telephony/UUSInfo.java
+++ b/src/java/com/android/internal/telephony/UUSInfo.java
@@ -56,45 +56,45 @@
 
     public static final int UUS_DCS_IA5c = 4; /* IA5 characters */
 
-    private int uusType;
+    private int mUusType;
 
-    private int uusDcs;
+    private int mUusDcs;
 
-    private byte[] uusData;
+    private byte[] mUusData;
 
     public UUSInfo() {
-        this.uusType = UUS_TYPE1_IMPLICIT;
-        this.uusDcs = UUS_DCS_IA5c;
-        this.uusData = null;
+        mUusType = UUS_TYPE1_IMPLICIT;
+        mUusDcs = UUS_DCS_IA5c;
+        mUusData = null;
     }
 
     public UUSInfo(int uusType, int uusDcs, byte[] uusData) {
-        this.uusType = uusType;
-        this.uusDcs = uusDcs;
-        this.uusData = uusData;
+        mUusType = uusType;
+        mUusDcs = uusDcs;
+        mUusData = uusData;
     }
 
     public int getDcs() {
-        return uusDcs;
+        return mUusDcs;
     }
 
     public void setDcs(int uusDcs) {
-        this.uusDcs = uusDcs;
+        mUusDcs = uusDcs;
     }
 
     public int getType() {
-        return uusType;
+        return mUusType;
     }
 
     public void setType(int uusType) {
-        this.uusType = uusType;
+        mUusType = uusType;
     }
 
     public byte[] getUserData() {
-        return uusData;
+        return mUusData;
     }
 
     public void setUserData(byte[] uusData) {
-        this.uusData = uusData;
+        mUusData = uusData;
     }
 }
diff --git a/src/java/com/android/internal/telephony/WapPushOverSms.java b/src/java/com/android/internal/telephony/WapPushOverSms.java
index ef74e1e..8558b2e 100755
--- a/src/java/com/android/internal/telephony/WapPushOverSms.java
+++ b/src/java/com/android/internal/telephony/WapPushOverSms.java
@@ -18,11 +18,11 @@
 package com.android.internal.telephony;
 
 import android.app.Activity;
+import android.app.AppOpsManager;
 import android.content.Context;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.ServiceConnection;
-import android.provider.Telephony;
 import android.provider.Telephony.Sms.Intents;
 import android.telephony.Rlog;
 import android.os.IBinder;
@@ -37,17 +37,12 @@
  */
 public class WapPushOverSms {
     private static final String LOG_TAG = "WAP PUSH";
+    private static final boolean DBG = false;
 
     private final Context mContext;
     private WspTypeDecoder pduDecoder;
     private SMSDispatcher mSmsDispatcher;
 
-    /**
-     * Hold the wake lock for 5 seconds, which should be enough time for
-     * any receiver(s) to grab its own wake lock.
-     */
-    private final int WAKE_LOCK_TIMEOUT = 5000;
-
     private final int BIND_RETRY_INTERVAL = 1000;
     /**
      * A handle to WapPushManager interface
@@ -61,15 +56,17 @@
             mOwner = ownerContext;
         }
 
+        @Override
         public void onServiceConnected(ComponentName name, IBinder service) {
             mWapPushMan = IWapPushManager.Stub.asInterface(service);
-            if (false) Rlog.v(LOG_TAG, "wappush manager connected to " +
+            if (DBG) Rlog.v(LOG_TAG, "wappush manager connected to " +
                     mOwner.hashCode());
         }
 
+        @Override
         public void onServiceDisconnected(ComponentName name) {
             mWapPushMan = null;
-            if (false) Rlog.v(LOG_TAG, "wappush manager disconnected.");
+            if (DBG) Rlog.v(LOG_TAG, "wappush manager disconnected.");
             // Detach the previous binder
             mOwner.unbindService(mWapConn);
             // WapPushManager must be always attached.
@@ -97,6 +94,7 @@
 
             final ServiceConnection wapPushConnection = this;
             new Thread() {
+                @Override
                 public void run() {
                     while (mWapPushMan == null) {
                         mOwner.bindService(new Intent(IWapPushManager.class.getName()),
@@ -104,7 +102,7 @@
                         try {
                             Thread.sleep(BIND_RETRY_INTERVAL);
                         } catch (InterruptedException e) {
-                            if (false) Rlog.v(LOG_TAG, "sleep interrupted.");
+                            if (DBG) Rlog.v(LOG_TAG, "sleep interrupted.");
                         }
                     }
                 }
@@ -132,13 +130,13 @@
      * wap-230-wsp-20010705-a section 8 for details on the WAP PDU format.
      *
      * @param pdu The WAP PDU, made up of one or more SMS PDUs
-     * @return a result code from {@link Telephony.Sms.Intents}, or
+     * @return a result code from {@link android.provider.Telephony.Sms.Intents}, or
      *         {@link Activity#RESULT_OK} if the message has been broadcast
      *         to applications
      */
     public int dispatchWapPdu(byte[] pdu) {
 
-        if (false) Rlog.d(LOG_TAG, "Rx: " + IccUtils.bytesToHexString(pdu));
+        if (DBG) Rlog.d(LOG_TAG, "Rx: " + IccUtils.bytesToHexString(pdu));
 
         int index = 0;
         int transactionId = pdu[index++] & 0xFF;
@@ -147,7 +145,7 @@
 
         if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) &&
                 (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) {
-            if (false) Rlog.w(LOG_TAG, "Received non-PUSH WAP PDU. Type = " + pduType);
+            if (DBG) Rlog.w(LOG_TAG, "Received non-PUSH WAP PDU. Type = " + pduType);
             return Intents.RESULT_SMS_HANDLED;
         }
 
@@ -160,7 +158,7 @@
          * So it will be encoded in no more than 5 octets.
          */
         if (pduDecoder.decodeUintvarInteger(index) == false) {
-            if (false) Rlog.w(LOG_TAG, "Received PDU. Header Length error.");
+            if (DBG) Rlog.w(LOG_TAG, "Received PDU. Header Length error.");
             return Intents.RESULT_SMS_GENERIC_ERROR;
         }
         headerLength = (int)pduDecoder.getValue32();
@@ -181,7 +179,7 @@
          * Length = Uintvar-integer
          */
         if (pduDecoder.decodeContentType(index) == false) {
-            if (false) Rlog.w(LOG_TAG, "Received PDU. Header Content-Type error.");
+            if (DBG) Rlog.w(LOG_TAG, "Received PDU. Header Content-Type error.");
             return Intents.RESULT_SMS_GENERIC_ERROR;
         }
 
@@ -218,14 +216,14 @@
 
             String contentType = ((mimeType == null) ?
                                   Long.toString(binaryContentType) : mimeType);
-            if (false) Rlog.v(LOG_TAG, "appid found: " + wapAppId + ":" + contentType);
+            if (DBG) Rlog.v(LOG_TAG, "appid found: " + wapAppId + ":" + contentType);
 
             try {
                 boolean processFurther = true;
                 IWapPushManager wapPushMan = mWapConn.getWapPushManager();
 
                 if (wapPushMan == null) {
-                    if (false) Rlog.w(LOG_TAG, "wap push manager not found!");
+                    if (DBG) Rlog.w(LOG_TAG, "wap push manager not found!");
                 } else {
                     Intent intent = new Intent();
                     intent.putExtra("transactionId", transactionId);
@@ -236,7 +234,7 @@
                             pduDecoder.getContentParameters());
 
                     int procRet = wapPushMan.processMessage(wapAppId, contentType, intent);
-                    if (false) Rlog.v(LOG_TAG, "procRet:" + procRet);
+                    if (DBG) Rlog.v(LOG_TAG, "procRet:" + procRet);
                     if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0
                         && (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) {
                         processFurther = false;
@@ -246,22 +244,25 @@
                     return Intents.RESULT_SMS_HANDLED;
                 }
             } catch (RemoteException e) {
-                if (false) Rlog.w(LOG_TAG, "remote func failed...");
+                if (DBG) Rlog.w(LOG_TAG, "remote func failed...");
             }
         }
-        if (false) Rlog.v(LOG_TAG, "fall back to existing handler");
+        if (DBG) Rlog.v(LOG_TAG, "fall back to existing handler");
 
         if (mimeType == null) {
-            if (false) Rlog.w(LOG_TAG, "Header Content-Type error.");
+            if (DBG) Rlog.w(LOG_TAG, "Header Content-Type error.");
             return Intents.RESULT_SMS_GENERIC_ERROR;
         }
 
         String permission;
+        int appOp;
 
         if (mimeType.equals(WspTypeDecoder.CONTENT_TYPE_B_MMS)) {
-            permission = "android.permission.RECEIVE_MMS";
+            permission = android.Manifest.permission.RECEIVE_MMS;
+            appOp = AppOpsManager.OP_RECEIVE_MMS;
         } else {
-            permission = "android.permission.RECEIVE_WAP_PUSH";
+            permission = android.Manifest.permission.RECEIVE_WAP_PUSH;
+            appOp = AppOpsManager.OP_RECEIVE_WAP_PUSH;
         }
 
         Intent intent = new Intent(Intents.WAP_PUSH_RECEIVED_ACTION);
@@ -272,7 +273,7 @@
         intent.putExtra("data", intentData);
         intent.putExtra("contentTypeParameters", pduDecoder.getContentParameters());
 
-        mSmsDispatcher.dispatch(intent, permission);
+        mSmsDispatcher.dispatch(intent, permission, appOp);
 
         return Activity.RESULT_OK;
     }
diff --git a/src/java/com/android/internal/telephony/WspTypeDecoder.java b/src/java/com/android/internal/telephony/WspTypeDecoder.java
index a19546a..281488a 100755
--- a/src/java/com/android/internal/telephony/WspTypeDecoder.java
+++ b/src/java/com/android/internal/telephony/WspTypeDecoder.java
@@ -196,15 +196,15 @@
     public static final String CONTENT_TYPE_B_MMS = "application/vnd.wap.mms-message";
     public static final String CONTENT_TYPE_B_PUSH_SYNCML_NOTI = "application/vnd.syncml.notification";
 
-    byte[] wspData;
-    int    dataLength;
-    long   unsigned32bit;
-    String stringValue;
+    byte[] mWspData;
+    int    mDataLength;
+    long   mUnsigned32bit;
+    String mStringValue;
 
-    HashMap<String, String> contentParameters;
+    HashMap<String, String> mContentParameters;
 
     public WspTypeDecoder(byte[] pdu) {
-        wspData = pdu;
+        mWspData = pdu;
     }
 
     /**
@@ -218,14 +218,14 @@
      */
     public boolean decodeTextString(int startIndex) {
         int index = startIndex;
-        while (wspData[index] != 0) {
+        while (mWspData[index] != 0) {
             index++;
         }
-        dataLength = index - startIndex + 1;
-        if (wspData[startIndex] == 127) {
-            stringValue = new String(wspData, startIndex + 1, dataLength - 2);
+        mDataLength = index - startIndex + 1;
+        if (mWspData[startIndex] == 127) {
+            mStringValue = new String(mWspData, startIndex + 1, mDataLength - 2);
         } else {
-            stringValue = new String(wspData, startIndex, dataLength - 1);
+            mStringValue = new String(mWspData, startIndex, mDataLength - 1);
         }
         return true;
     }
@@ -241,11 +241,11 @@
      */
     public boolean decodeTokenText(int startIndex) {
         int index = startIndex;
-        while (wspData[index] != 0) {
+        while (mWspData[index] != 0) {
             index++;
         }
-        dataLength = index - startIndex + 1;
-        stringValue = new String(wspData, startIndex, dataLength - 1);
+        mDataLength = index - startIndex + 1;
+        mStringValue = new String(mWspData, startIndex, mDataLength - 1);
 
         return true;
     }
@@ -260,11 +260,11 @@
      *         length of data in pdu can be retrieved by getDecodedDataLength() method
      */
     public boolean decodeShortInteger(int startIndex) {
-        if ((wspData[startIndex] & 0x80) == 0) {
+        if ((mWspData[startIndex] & 0x80) == 0) {
             return false;
         }
-        unsigned32bit = wspData[startIndex] & 0x7f;
-        dataLength = 1;
+        mUnsigned32bit = mWspData[startIndex] & 0x7f;
+        mDataLength = 1;
         return true;
     }
 
@@ -278,16 +278,16 @@
      *         length of data in pdu can be retrieved by getDecodedDataLength() method
      */
     public boolean decodeLongInteger(int startIndex) {
-        int lengthMultiOctet = wspData[startIndex] & 0xff;
+        int lengthMultiOctet = mWspData[startIndex] & 0xff;
 
         if (lengthMultiOctet > WAP_PDU_SHORT_LENGTH_MAX) {
             return false;
         }
-        unsigned32bit = 0;
+        mUnsigned32bit = 0;
         for (int i = 1; i <= lengthMultiOctet; i++) {
-            unsigned32bit = (unsigned32bit << 8) | (wspData[startIndex + i] & 0xff);
+            mUnsigned32bit = (mUnsigned32bit << 8) | (mWspData[startIndex + i] & 0xff);
         }
-        dataLength = 1 + lengthMultiOctet;
+        mDataLength = 1 + lengthMultiOctet;
         return true;
     }
 
@@ -319,16 +319,16 @@
     public boolean decodeUintvarInteger(int startIndex) {
         int index = startIndex;
 
-        unsigned32bit = 0;
-        while ((wspData[index] & 0x80) != 0) {
+        mUnsigned32bit = 0;
+        while ((mWspData[index] & 0x80) != 0) {
             if ((index - startIndex) >= 4) {
                 return false;
             }
-            unsigned32bit = (unsigned32bit << 7) | (wspData[index] & 0x7f);
+            mUnsigned32bit = (mUnsigned32bit << 7) | (mWspData[index] & 0x7f);
             index++;
         }
-        unsigned32bit = (unsigned32bit << 7) | (wspData[index] & 0x7f);
-        dataLength = index - startIndex + 1;
+        mUnsigned32bit = (mUnsigned32bit << 7) | (mWspData[index] & 0x7f);
+        mDataLength = index - startIndex + 1;
         return true;
     }
 
@@ -342,15 +342,15 @@
      *         length of data in pdu can be retrieved by getDecodedDataLength() method
      */
     public boolean decodeValueLength(int startIndex) {
-        if ((wspData[startIndex] & 0xff) > WAP_PDU_LENGTH_QUOTE) {
+        if ((mWspData[startIndex] & 0xff) > WAP_PDU_LENGTH_QUOTE) {
             return false;
         }
-        if (wspData[startIndex] < WAP_PDU_LENGTH_QUOTE) {
-            unsigned32bit = wspData[startIndex];
-            dataLength = 1;
+        if (mWspData[startIndex] < WAP_PDU_LENGTH_QUOTE) {
+            mUnsigned32bit = mWspData[startIndex];
+            mDataLength = 1;
         } else {
             decodeUintvarInteger(startIndex + 1);
-            dataLength++;
+            mDataLength++;
         }
         return true;
     }
@@ -367,17 +367,17 @@
      */
     public boolean decodeExtensionMedia(int startIndex) {
         int index = startIndex;
-        dataLength = 0;
-        stringValue = null;
-        int length = wspData.length;
+        mDataLength = 0;
+        mStringValue = null;
+        int length = mWspData.length;
         boolean rtrn = index < length;
 
-        while (index < length && wspData[index] != 0) {
+        while (index < length && mWspData[index] != 0) {
             index++;
         }
 
-        dataLength = index - startIndex + 1;
-        stringValue = new String(wspData, startIndex, dataLength - 1);
+        mDataLength = index - startIndex + 1;
+        mStringValue = new String(mWspData, startIndex, mDataLength - 1);
 
         return rtrn;
     }
@@ -393,7 +393,7 @@
      */
     public boolean decodeConstrainedEncoding(int startIndex) {
         if (decodeShortInteger(startIndex) == true) {
-            stringValue = null;
+            mStringValue = null;
             return true;
         }
         return decodeExtensionMedia(startIndex);
@@ -414,7 +414,7 @@
      */
     public boolean decodeContentType(int startIndex) {
         int mediaPrefixLength;
-        contentParameters = new HashMap<String, String>();
+        mContentParameters = new HashMap<String, String>();
 
         try {
             if (decodeValueLength(startIndex) == false) {
@@ -424,35 +424,35 @@
                 }
                 return found;
             }
-            int headersLength = (int) unsigned32bit;
+            int headersLength = (int) mUnsigned32bit;
             mediaPrefixLength = getDecodedDataLength();
             if (decodeIntegerValue(startIndex + mediaPrefixLength) == true) {
-                dataLength += mediaPrefixLength;
-                int readLength = dataLength;
-                stringValue = null;
+                mDataLength += mediaPrefixLength;
+                int readLength = mDataLength;
+                mStringValue = null;
                 expandWellKnownMimeType();
-                long wellKnownValue = unsigned32bit;
-                String mimeType = stringValue;
-                if (readContentParameters(startIndex + dataLength,
-                        (headersLength - (dataLength - mediaPrefixLength)), 0)) {
-                    dataLength += readLength;
-                    unsigned32bit = wellKnownValue;
-                    stringValue = mimeType;
+                long wellKnownValue = mUnsigned32bit;
+                String mimeType = mStringValue;
+                if (readContentParameters(startIndex + mDataLength,
+                        (headersLength - (mDataLength - mediaPrefixLength)), 0)) {
+                    mDataLength += readLength;
+                    mUnsigned32bit = wellKnownValue;
+                    mStringValue = mimeType;
                     return true;
                 }
                 return false;
             }
             if (decodeExtensionMedia(startIndex + mediaPrefixLength) == true) {
-                dataLength += mediaPrefixLength;
-                int readLength = dataLength;
+                mDataLength += mediaPrefixLength;
+                int readLength = mDataLength;
                 expandWellKnownMimeType();
-                long wellKnownValue = unsigned32bit;
-                String mimeType = stringValue;
-                if (readContentParameters(startIndex + dataLength,
-                        (headersLength - (dataLength - mediaPrefixLength)), 0)) {
-                    dataLength += readLength;
-                    unsigned32bit = wellKnownValue;
-                    stringValue = mimeType;
+                long wellKnownValue = mUnsigned32bit;
+                String mimeType = mStringValue;
+                if (readContentParameters(startIndex + mDataLength,
+                        (headersLength - (mDataLength - mediaPrefixLength)), 0)) {
+                    mDataLength += readLength;
+                    mUnsigned32bit = wellKnownValue;
+                    mStringValue = mimeType;
                     return true;
                 }
             }
@@ -468,17 +468,17 @@
         int totalRead = 0;
 
         if (leftToRead > 0) {
-            byte nextByte = wspData[startIndex];
+            byte nextByte = mWspData[startIndex];
             String value = null;
             String param = null;
             if ((nextByte & 0x80) == 0x00 && nextByte > 31) { // untyped
                 decodeTokenText(startIndex);
-                param = stringValue;
-                totalRead += dataLength;
+                param = mStringValue;
+                totalRead += mDataLength;
             } else { // typed
                 if (decodeIntegerValue(startIndex)) {
-                    totalRead += dataLength;
-                    int wellKnownParameterValue = (int) unsigned32bit;
+                    totalRead += mDataLength;
+                    int wellKnownParameterValue = (int) mUnsigned32bit;
                     param = WELL_KNOWN_PARAMETERS.get(wellKnownParameterValue);
                     if (param == null) {
                         param = "unassigned/0x" + Long.toHexString(wellKnownParameterValue);
@@ -486,9 +486,9 @@
                     // special case for the "Q" parameter, value is a uintvar
                     if (wellKnownParameterValue == Q_VALUE) {
                         if (decodeUintvarInteger(startIndex + totalRead)) {
-                            totalRead += dataLength;
-                            value = String.valueOf(unsigned32bit);
-                            contentParameters.put(param, value);
+                            totalRead += mDataLength;
+                            value = String.valueOf(mUnsigned32bit);
+                            mContentParameters.put(param, value);
                             return readContentParameters(startIndex + totalRead, leftToRead
                                                             - totalRead, accumulator + totalRead);
                         } else {
@@ -501,27 +501,27 @@
             }
 
             if (decodeNoValue(startIndex + totalRead)) {
-                totalRead += dataLength;
+                totalRead += mDataLength;
                 value = null;
             } else if (decodeIntegerValue(startIndex + totalRead)) {
-                totalRead += dataLength;
-                int intValue = (int) unsigned32bit;
+                totalRead += mDataLength;
+                int intValue = (int) mUnsigned32bit;
                 value = String.valueOf(intValue);
             } else {
                 decodeTokenText(startIndex + totalRead);
-                totalRead += dataLength;
-                value = stringValue;
+                totalRead += mDataLength;
+                value = mStringValue;
                 if (value.startsWith("\"")) {
                     // quoted string, so remove the quote
                     value = value.substring(1);
                 }
             }
-            contentParameters.put(param, value);
+            mContentParameters.put(param, value);
             return readContentParameters(startIndex + totalRead, leftToRead - totalRead,
                                             accumulator + totalRead);
 
         } else {
-            dataLength = accumulator;
+            mDataLength = accumulator;
             return true;
         }
     }
@@ -534,8 +534,8 @@
      * @return true if and only if the next byte is 0x00
      */
     private boolean decodeNoValue(int startIndex) {
-        if (wspData[startIndex] == 0) {
-            dataLength = 1;
+        if (mWspData[startIndex] == 0) {
+            mDataLength = 1;
             return true;
         } else {
             return false;
@@ -548,11 +548,11 @@
      * Sets unsigned32bit to -1 if stringValue is already populated
      */
     private void expandWellKnownMimeType() {
-        if (stringValue == null) {
-            int binaryContentType = (int) unsigned32bit;
-            stringValue = WELL_KNOWN_MIME_TYPES.get(binaryContentType);
+        if (mStringValue == null) {
+            int binaryContentType = (int) mUnsigned32bit;
+            mStringValue = WELL_KNOWN_MIME_TYPES.get(binaryContentType);
         } else {
-            unsigned32bit = -1;
+            mUnsigned32bit = -1;
         }
     }
 
@@ -594,7 +594,7 @@
      */
     public boolean decodeXWapApplicationId(int startIndex) {
         if (decodeIntegerValue(startIndex) == true) {
-            stringValue = null;
+            mStringValue = null;
             return true;
         }
         return decodeTextString(startIndex);
@@ -622,7 +622,7 @@
                     int fieldValue = (int) getValue32();
 
                     if (fieldValue == PARAMETER_ID_X_WAP_APPLICATION_ID) {
-                        unsigned32bit = index + 1;
+                        mUnsigned32bit = index + 1;
                         return true;
                     }
                 } else {
@@ -642,9 +642,9 @@
                         (NUL character)
                  * 128 - 255 It is an encoded 7-bit value; this header has no more data
                  */
-                byte val = wspData[index];
+                byte val = mWspData[index];
                 if (0 <= val && val <= WAP_PDU_SHORT_LENGTH_MAX) {
-                    index += wspData[index] + 1;
+                    index += mWspData[index] + 1;
                 } else if (val == WAP_PDU_LENGTH_QUOTE) {
                     if (index + 1 >= endIndex) return false;
                     index++;
@@ -694,21 +694,21 @@
      * The data length of latest operation.
      */
     public int getDecodedDataLength() {
-        return dataLength;
+        return mDataLength;
     }
 
     /**
      * The 32-bits result of latest operation.
      */
     public long getValue32() {
-        return unsigned32bit;
+        return mUnsigned32bit;
     }
 
     /**
      * The String result of latest operation.
      */
     public String getValueString() {
-        return stringValue;
+        return mStringValue;
     }
 
     /**
@@ -722,6 +722,6 @@
      *
      */
     public HashMap<String, String> getContentParameters() {
-        return contentParameters;
+        return mContentParameters;
     }
 }
diff --git a/src/java/com/android/internal/telephony/cat/CatCmdMessage.java b/src/java/com/android/internal/telephony/cat/CatCmdMessage.java
index 9284d03..4e06f60 100644
--- a/src/java/com/android/internal/telephony/cat/CatCmdMessage.java
+++ b/src/java/com/android/internal/telephony/cat/CatCmdMessage.java
@@ -51,11 +51,11 @@
     }
 
     CatCmdMessage(CommandParams cmdParams) {
-        mCmdDet = cmdParams.cmdDet;
+        mCmdDet = cmdParams.mCmdDet;
         switch(getCmdType()) {
         case SET_UP_MENU:
         case SELECT_ITEM:
-            mMenu = ((SelectItemParams) cmdParams).menu;
+            mMenu = ((SelectItemParams) cmdParams).mMenu;
             break;
         case DISPLAY_TEXT:
         case SET_UP_IDLE_MODE_TEXT:
@@ -63,37 +63,42 @@
         case SEND_SMS:
         case SEND_SS:
         case SEND_USSD:
-            mTextMsg = ((DisplayTextParams) cmdParams).textMsg;
+            mTextMsg = ((DisplayTextParams) cmdParams).mTextMsg;
             break;
         case GET_INPUT:
         case GET_INKEY:
-            mInput = ((GetInputParams) cmdParams).input;
+            mInput = ((GetInputParams) cmdParams).mInput;
             break;
         case LAUNCH_BROWSER:
-            mTextMsg = ((LaunchBrowserParams) cmdParams).confirmMsg;
+            mTextMsg = ((LaunchBrowserParams) cmdParams).mConfirmMsg;
             mBrowserSettings = new BrowserSettings();
-            mBrowserSettings.url = ((LaunchBrowserParams) cmdParams).url;
-            mBrowserSettings.mode = ((LaunchBrowserParams) cmdParams).mode;
+            mBrowserSettings.url = ((LaunchBrowserParams) cmdParams).mUrl;
+            mBrowserSettings.mode = ((LaunchBrowserParams) cmdParams).mMode;
             break;
         case PLAY_TONE:
             PlayToneParams params = (PlayToneParams) cmdParams;
-            mToneSettings = params.settings;
-            mTextMsg = params.textMsg;
+            mToneSettings = params.mSettings;
+            mTextMsg = params.mTextMsg;
             break;
         case GET_CHANNEL_STATUS:
-            mTextMsg = ((CallSetupParams) cmdParams).confirmMsg;
+            mTextMsg = ((CallSetupParams) cmdParams).mConfirmMsg;
             break;
         case SET_UP_CALL:
             mCallSettings = new CallSettings();
-            mCallSettings.confirmMsg = ((CallSetupParams) cmdParams).confirmMsg;
-            mCallSettings.callMsg = ((CallSetupParams) cmdParams).callMsg;
+            mCallSettings.confirmMsg = ((CallSetupParams) cmdParams).mConfirmMsg;
+            mCallSettings.callMsg = ((CallSetupParams) cmdParams).mCallMsg;
             break;
         case OPEN_CHANNEL:
         case CLOSE_CHANNEL:
         case RECEIVE_DATA:
         case SEND_DATA:
             BIPClientParams param = (BIPClientParams) cmdParams;
-            mTextMsg = param.textMsg;
+            mTextMsg = param.mTextMsg;
+            break;
+        case PROVIDE_LOCAL_INFORMATION:
+        case REFRESH:
+        case SET_UP_EVENT_LIST:
+        default:
             break;
         }
     }
@@ -117,9 +122,12 @@
             mCallSettings.confirmMsg = in.readParcelable(null);
             mCallSettings.callMsg = in.readParcelable(null);
             break;
+        default:
+            break;
         }
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeParcelable(mCmdDet, 0);
         dest.writeParcelable(mTextMsg, 0);
@@ -137,19 +145,24 @@
             dest.writeParcelable(mCallSettings.confirmMsg, 0);
             dest.writeParcelable(mCallSettings.callMsg, 0);
             break;
+        default:
+            break;
         }
     }
 
     public static final Parcelable.Creator<CatCmdMessage> CREATOR = new Parcelable.Creator<CatCmdMessage>() {
+        @Override
         public CatCmdMessage createFromParcel(Parcel in) {
             return new CatCmdMessage(in);
         }
 
+        @Override
         public CatCmdMessage[] newArray(int size) {
             return new CatCmdMessage[size];
         }
     };
 
+    @Override
     public int describeContents() {
         return 0;
     }
diff --git a/src/java/com/android/internal/telephony/cat/CatResponseMessage.java b/src/java/com/android/internal/telephony/cat/CatResponseMessage.java
index 15309e4..a3fc04e 100644
--- a/src/java/com/android/internal/telephony/cat/CatResponseMessage.java
+++ b/src/java/com/android/internal/telephony/cat/CatResponseMessage.java
@@ -17,44 +17,44 @@
 package com.android.internal.telephony.cat;
 
 public class CatResponseMessage {
-        CommandDetails cmdDet = null;
-        ResultCode resCode  = ResultCode.OK;
-        int usersMenuSelection = 0;
-        String usersInput  = null;
-        boolean usersYesNoSelection = false;
-        boolean usersConfirm = false;
-        boolean includeAdditionalInfo = false;
-        int additionalInfo = 0;
+        CommandDetails mCmdDet = null;
+        ResultCode mResCode  = ResultCode.OK;
+        int mUsersMenuSelection = 0;
+        String mUsersInput  = null;
+        boolean mUsersYesNoSelection = false;
+        boolean mUsersConfirm = false;
+        boolean mIncludeAdditionalInfo = false;
+        int mAdditionalInfo = 0;
         public CatResponseMessage(CatCmdMessage cmdMsg) {
-            this.cmdDet = cmdMsg.mCmdDet;
+            mCmdDet = cmdMsg.mCmdDet;
         }
 
         public void setResultCode(ResultCode resCode) {
-            this.resCode = resCode;
+            mResCode = resCode;
         }
 
         public void setMenuSelection(int selection) {
-            this.usersMenuSelection = selection;
+            mUsersMenuSelection = selection;
         }
 
         public void setInput(String input) {
-            this.usersInput = input;
+            mUsersInput = input;
         }
 
         public void setYesNo(boolean yesNo) {
-            usersYesNoSelection = yesNo;
+            mUsersYesNoSelection = yesNo;
         }
 
         public void setConfirmation(boolean confirm) {
-            usersConfirm = confirm;
+            mUsersConfirm = confirm;
         }
 
         public void setAdditionalInfo(int info) {
-            this.includeAdditionalInfo = true;
-            this.additionalInfo = info;
+            mIncludeAdditionalInfo = true;
+            mAdditionalInfo = info;
         }
 
         CommandDetails getCmdDetails() {
-            return cmdDet;
+            return mCmdDet;
         }
     }
diff --git a/src/java/com/android/internal/telephony/cat/CatService.java b/src/java/com/android/internal/telephony/cat/CatService.java
index f84fba2..e027410 100644
--- a/src/java/com/android/internal/telephony/cat/CatService.java
+++ b/src/java/com/android/internal/telephony/cat/CatService.java
@@ -49,9 +49,9 @@
     }
 
     RilMessage(RilMessage other) {
-        this.mId = other.mId;
-        this.mData = other.mData;
-        this.mResCode = other.mResCode;
+        mId = other.mId;
+        mData = other.mData;
+        mResCode = other.mResCode;
     }
 }
 
@@ -62,6 +62,7 @@
  * {@hide}
  */
 public class CatService extends Handler implements AppInterface {
+    private static final boolean DBG = false;
 
     // Class members
     private static IccRecords mIccRecords;
@@ -94,12 +95,8 @@
     private static final int MSG_ID_ICC_RECORDS_LOADED       = 20;
 
     private static final int DEV_ID_KEYPAD      = 0x01;
-    private static final int DEV_ID_DISPLAY     = 0x02;
-    private static final int DEV_ID_EARPIECE    = 0x03;
     private static final int DEV_ID_UICC        = 0x81;
     private static final int DEV_ID_TERMINAL    = 0x82;
-    private static final int DEV_ID_NETWORK     = 0x83;
-
     static final String STK_DEFAULT = "Defualt Message";
 
     /* Intentionally private for singleton */
@@ -143,9 +140,10 @@
         mCmdIf.unSetOnCatEvent(this);
         mCmdIf.unSetOnCatCallSetUp(this);
 
-        this.removeCallbacksAndMessages(null);
+        removeCallbacksAndMessages(null);
     }
 
+    @Override
     protected void finalize() {
         CatLog.d(this, "Service finalized");
     }
@@ -186,7 +184,7 @@
                     // for proactive commands that couldn't be decoded
                     // successfully respond with the code generated by the
                     // message decoder.
-                    sendTerminalResponse(cmdParams.cmdDet, rilMsg.mResCode,
+                    sendTerminalResponse(cmdParams.mCmdDet, rilMsg.mResCode,
                             false, 0, null);
                 }
             }
@@ -226,43 +224,43 @@
                 } else {
                     mMenuCmd = cmdMsg;
                 }
-                sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
+                sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);
                 break;
             case DISPLAY_TEXT:
                 // when application is not required to respond, send an immediate response.
                 if (!cmdMsg.geTextMessage().responseNeeded) {
-                    sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
+                    sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);
                 }
                 break;
             case REFRESH:
                 // ME side only handles refresh commands which meant to remove IDLE
                 // MODE TEXT.
-                cmdParams.cmdDet.typeOfCommand = CommandType.SET_UP_IDLE_MODE_TEXT.value();
+                cmdParams.mCmdDet.typeOfCommand = CommandType.SET_UP_IDLE_MODE_TEXT.value();
                 break;
             case SET_UP_IDLE_MODE_TEXT:
-                sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
+                sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);
                 break;
             case PROVIDE_LOCAL_INFORMATION:
                 ResponseData resp;
-                switch (cmdParams.cmdDet.commandQualifier) {
+                switch (cmdParams.mCmdDet.commandQualifier) {
                     case CommandParamsFactory.DTTZ_SETTING:
                         resp = new DTTZResponseData(null);
-                        sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, resp);
+                        sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, resp);
                         break;
                     case CommandParamsFactory.LANGUAGE_SETTING:
                         resp = new LanguageResponseData(Locale.getDefault().getLanguage());
-                        sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, resp);
+                        sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, resp);
                         break;
                     default:
-                        sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
+                        sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);
                 }
                 // No need to start STK app here.
                 return;
             case LAUNCH_BROWSER:
-                if ((((LaunchBrowserParams) cmdParams).confirmMsg.text != null)
-                        && (((LaunchBrowserParams) cmdParams).confirmMsg.text.equals(STK_DEFAULT))) {
+                if ((((LaunchBrowserParams) cmdParams).mConfirmMsg.text != null)
+                        && (((LaunchBrowserParams) cmdParams).mConfirmMsg.text.equals(STK_DEFAULT))) {
                     message = mContext.getText(com.android.internal.R.string.launchBrowserDefault);
-                    ((LaunchBrowserParams) cmdParams).confirmMsg.text = message.toString();
+                    ((LaunchBrowserParams) cmdParams).mConfirmMsg.text = message.toString();
                 }
                 break;
             case SELECT_ITEM:
@@ -273,19 +271,19 @@
             case SEND_SMS:
             case SEND_SS:
             case SEND_USSD:
-                if ((((DisplayTextParams)cmdParams).textMsg.text != null)
-                        && (((DisplayTextParams)cmdParams).textMsg.text.equals(STK_DEFAULT))) {
+                if ((((DisplayTextParams)cmdParams).mTextMsg.text != null)
+                        && (((DisplayTextParams)cmdParams).mTextMsg.text.equals(STK_DEFAULT))) {
                     message = mContext.getText(com.android.internal.R.string.sending);
-                    ((DisplayTextParams)cmdParams).textMsg.text = message.toString();
+                    ((DisplayTextParams)cmdParams).mTextMsg.text = message.toString();
                 }
                 break;
             case PLAY_TONE:
                 break;
             case SET_UP_CALL:
-                if ((((CallSetupParams) cmdParams).confirmMsg.text != null)
-                        && (((CallSetupParams) cmdParams).confirmMsg.text.equals(STK_DEFAULT))) {
+                if ((((CallSetupParams) cmdParams).mConfirmMsg.text != null)
+                        && (((CallSetupParams) cmdParams).mConfirmMsg.text.equals(STK_DEFAULT))) {
                     message = mContext.getText(com.android.internal.R.string.SetupCallDefault);
-                    ((CallSetupParams) cmdParams).confirmMsg.text = message.toString();
+                    ((CallSetupParams) cmdParams).mConfirmMsg.text = message.toString();
                 }
                 break;
             case OPEN_CHANNEL:
@@ -293,11 +291,11 @@
             case RECEIVE_DATA:
             case SEND_DATA:
                 BIPClientParams cmd = (BIPClientParams) cmdParams;
-                if (cmd.bHasAlphaId && (cmd.textMsg.text == null)) {
+                if (cmd.mHasAlphaId && (cmd.mTextMsg.text == null)) {
                     CatLog.d(this, "cmd " + cmdParams.getCommandType() + " with null alpha id");
                     // If alpha length is zero, we just respond with OK.
                     if (isProactiveCmd) {
-                        sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
+                        sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);
                     }
                     return;
                 }
@@ -305,7 +303,7 @@
                 if (!mStkAppInstalled) {
                     CatLog.d(this, "No STK application found.");
                     if (isProactiveCmd) {
-                        sendTerminalResponse(cmdParams.cmdDet,
+                        sendTerminalResponse(cmdParams.mCmdDet,
                                              ResultCode.BEYOND_TERMINAL_CAPABILITY,
                                              false, 0, null);
                         return;
@@ -321,7 +319,7 @@
                     ((cmdParams.getCommandType() == CommandType.CLOSE_CHANNEL) ||
                      (cmdParams.getCommandType() == CommandType.RECEIVE_DATA) ||
                      (cmdParams.getCommandType() == CommandType.SEND_DATA))) {
-                    sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
+                    sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);
                 }
                 break;
             default:
@@ -405,7 +403,7 @@
 
         byte[] rawData = buf.toByteArray();
         String hexString = IccUtils.bytesToHexString(rawData);
-        if (false) {
+        if (DBG) {
             CatLog.d(this, "TERMINAL RESPONSE: " + hexString);
         }
 
@@ -506,56 +504,11 @@
         mCmdIf.sendEnvelope(hexString, null);
     }
 
-    private void eventDownload(int event, int sourceId, int destinationId,
-            byte[] additionalInfo, boolean oneShot) {
-
-        ByteArrayOutputStream buf = new ByteArrayOutputStream();
-
-        // tag
-        int tag = BerTlv.BER_EVENT_DOWNLOAD_TAG;
-        buf.write(tag);
-
-        // length
-        buf.write(0x00); // place holder, assume length < 128.
-
-        // event list
-        tag = 0x80 | ComprehensionTlvTag.EVENT_LIST.value();
-        buf.write(tag);
-        buf.write(0x01); // length
-        buf.write(event); // event value
-
-        // device identities
-        tag = 0x80 | ComprehensionTlvTag.DEVICE_IDENTITIES.value();
-        buf.write(tag);
-        buf.write(0x02); // length
-        buf.write(sourceId); // source device id
-        buf.write(destinationId); // destination device id
-
-        // additional information
-        if (additionalInfo != null) {
-            for (byte b : additionalInfo) {
-                buf.write(b);
-            }
-        }
-
-        byte[] rawData = buf.toByteArray();
-
-        // write real length
-        int len = rawData.length - 2; // minus (tag + length)
-        rawData[1] = (byte) len;
-
-        String hexString = IccUtils.bytesToHexString(rawData);
-
-        mCmdIf.sendEnvelope(hexString, null);
-    }
-
     /**
      * Used for instantiating/updating the Service from the GsmPhone or CdmaPhone constructor.
      *
      * @param ci CommandsInterface object
-     * @param ir IccRecords object
      * @param context phone app context
-     * @param fh Icc file handler
      * @param ic Icc card
      * @return The only Service object in the system
      */
@@ -659,18 +612,19 @@
         }
     }
 
+    @Override
     public synchronized void onCmdResponse(CatResponseMessage resMsg) {
         if (resMsg == null) {
             return;
         }
         // queue a response message.
-        Message msg = this.obtainMessage(MSG_ID_RESPONSE, resMsg);
+        Message msg = obtainMessage(MSG_ID_RESPONSE, resMsg);
         msg.sendToTarget();
     }
 
     private boolean validateResponse(CatResponseMessage resMsg) {
         if (mCurrntCmd != null) {
-            return (resMsg.cmdDet.compareTo(mCurrntCmd.mCmdDet));
+            return (resMsg.mCmdDet.compareTo(mCurrntCmd.mCmdDet));
         }
         return false;
     }
@@ -706,7 +660,7 @@
         CommandDetails cmdDet = resMsg.getCmdDetails();
         AppInterface.CommandType type = AppInterface.CommandType.fromInt(cmdDet.typeOfCommand);
 
-        switch (resMsg.resCode) {
+        switch (resMsg.mResCode) {
         case HELP_INFO_REQUIRED:
             helpRequired = true;
             // fall through
@@ -723,11 +677,11 @@
         case TERMINAL_CRNTLY_UNABLE_TO_PROCESS:
             switch (type) {
             case SET_UP_MENU:
-                helpRequired = resMsg.resCode == ResultCode.HELP_INFO_REQUIRED;
-                sendMenuSelection(resMsg.usersMenuSelection, helpRequired);
+                helpRequired = resMsg.mResCode == ResultCode.HELP_INFO_REQUIRED;
+                sendMenuSelection(resMsg.mUsersMenuSelection, helpRequired);
                 return;
             case SELECT_ITEM:
-                resp = new SelectItemResponseData(resMsg.usersMenuSelection);
+                resp = new SelectItemResponseData(resMsg.mUsersMenuSelection);
                 break;
             case GET_INPUT:
             case GET_INKEY:
@@ -736,24 +690,26 @@
                     // when help is requested there is no need to send the text
                     // string object.
                     if (!helpRequired) {
-                        resp = new GetInkeyInputResponseData(resMsg.usersInput,
+                        resp = new GetInkeyInputResponseData(resMsg.mUsersInput,
                                 input.ucs2, input.packed);
                     }
                 } else {
                     resp = new GetInkeyInputResponseData(
-                            resMsg.usersYesNoSelection);
+                            resMsg.mUsersYesNoSelection);
                 }
                 break;
             case DISPLAY_TEXT:
             case LAUNCH_BROWSER:
                 break;
             case SET_UP_CALL:
-                mCmdIf.handleCallSetupRequestFromSim(resMsg.usersConfirm, null);
+                mCmdIf.handleCallSetupRequestFromSim(resMsg.mUsersConfirm, null);
                 // No need to send terminal response for SET UP CALL. The user's
                 // confirmation result is send back using a dedicated ril message
                 // invoked by the CommandInterface call above.
                 mCurrntCmd = null;
                 return;
+            default:
+                break;
             }
             break;
         case BACKWARD_MOVE_BY_USER:
@@ -777,8 +733,8 @@
         default:
             return;
         }
-        sendTerminalResponse(cmdDet, resMsg.resCode, resMsg.includeAdditionalInfo,
-                resMsg.additionalInfo, resp);
+        sendTerminalResponse(cmdDet, resMsg.mResCode, resMsg.mIncludeAdditionalInfo,
+                resMsg.mAdditionalInfo, resp);
         mCurrntCmd = null;
     }
 
diff --git a/src/java/com/android/internal/telephony/cat/CommandDetails.java b/src/java/com/android/internal/telephony/cat/CommandDetails.java
index 3e7f722..aaa9d68 100644
--- a/src/java/com/android/internal/telephony/cat/CommandDetails.java
+++ b/src/java/com/android/internal/telephony/cat/CommandDetails.java
@@ -24,7 +24,7 @@
 }
 
 /**
- * Class for Command Detailes object of proactive commands from SIM.
+ * Class for Command Details object of proactive commands from SIM.
  * {@hide}
  */
 class CommandDetails extends ValueObject implements Parcelable {
@@ -33,6 +33,7 @@
     public int typeOfCommand;
     public int commandQualifier;
 
+    @Override
     public ComprehensionTlvTag getTag() {
         return ComprehensionTlvTag.COMMAND_DETAILS;
     }
@@ -54,6 +55,7 @@
         commandQualifier = in.readInt();
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeInt(compRequired ? 1 : 0);
         dest.writeInt(commandNumber);
@@ -63,15 +65,18 @@
 
     public static final Parcelable.Creator<CommandDetails> CREATOR =
                                 new Parcelable.Creator<CommandDetails>() {
+        @Override
         public CommandDetails createFromParcel(Parcel in) {
             return new CommandDetails(in);
         }
 
+        @Override
         public CommandDetails[] newArray(int size) {
             return new CommandDetails[size];
         }
     };
 
+    @Override
     public int describeContents() {
         return 0;
     }
@@ -89,6 +94,7 @@
     public int sourceId;
     public int destinationId;
 
+    @Override
     ComprehensionTlvTag getTag() {
         return ComprehensionTlvTag.DEVICE_IDENTITIES;
     }
@@ -99,6 +105,7 @@
     int recordNumber;
     boolean selfExplanatory;
 
+    @Override
     ComprehensionTlvTag getTag() {
         return ComprehensionTlvTag.ICON_ID;
     }
@@ -109,6 +116,7 @@
     int [] recordNumbers;
     boolean selfExplanatory;
 
+    @Override
     ComprehensionTlvTag getTag() {
         return ComprehensionTlvTag.ITEM_ICON_ID_LIST;
     }
diff --git a/src/java/com/android/internal/telephony/cat/CommandParams.java b/src/java/com/android/internal/telephony/cat/CommandParams.java
index 79f6ad2..cf206bb 100644
--- a/src/java/com/android/internal/telephony/cat/CommandParams.java
+++ b/src/java/com/android/internal/telephony/cat/CommandParams.java
@@ -23,35 +23,36 @@
  *
  */
 class CommandParams {
-    CommandDetails cmdDet;
+    CommandDetails mCmdDet;
 
     CommandParams(CommandDetails cmdDet) {
-        this.cmdDet = cmdDet;
+        mCmdDet = cmdDet;
     }
 
     AppInterface.CommandType getCommandType() {
-        return AppInterface.CommandType.fromInt(cmdDet.typeOfCommand);
+        return AppInterface.CommandType.fromInt(mCmdDet.typeOfCommand);
     }
 
     boolean setIcon(Bitmap icon) { return true; }
 
     @Override
     public String toString() {
-        return cmdDet.toString();
+        return mCmdDet.toString();
     }
 }
 
 class DisplayTextParams extends CommandParams {
-    TextMessage textMsg;
+    TextMessage mTextMsg;
 
     DisplayTextParams(CommandDetails cmdDet, TextMessage textMsg) {
         super(cmdDet);
-        this.textMsg = textMsg;
+        mTextMsg = textMsg;
     }
 
+    @Override
     boolean setIcon(Bitmap icon) {
-        if (icon != null && textMsg != null) {
-            textMsg.icon = icon;
+        if (icon != null && mTextMsg != null) {
+            mTextMsg.icon = icon;
             return true;
         }
         return false;
@@ -59,21 +60,22 @@
 }
 
 class LaunchBrowserParams extends CommandParams {
-    TextMessage confirmMsg;
-    LaunchBrowserMode mode;
-    String url;
+    TextMessage mConfirmMsg;
+    LaunchBrowserMode mMode;
+    String mUrl;
 
     LaunchBrowserParams(CommandDetails cmdDet, TextMessage confirmMsg,
             String url, LaunchBrowserMode mode) {
         super(cmdDet);
-        this.confirmMsg = confirmMsg;
-        this.mode = mode;
-        this.url = url;
+        mConfirmMsg = confirmMsg;
+        mMode = mode;
+        mUrl = url;
     }
 
+    @Override
     boolean setIcon(Bitmap icon) {
-        if (icon != null && confirmMsg != null) {
-            confirmMsg.icon = icon;
+        if (icon != null && mConfirmMsg != null) {
+            mConfirmMsg.icon = icon;
             return true;
         }
         return false;
@@ -81,19 +83,20 @@
 }
 
 class PlayToneParams extends CommandParams {
-    TextMessage textMsg;
-    ToneSettings settings;
+    TextMessage mTextMsg;
+    ToneSettings mSettings;
 
     PlayToneParams(CommandDetails cmdDet, TextMessage textMsg,
             Tone tone, Duration duration, boolean vibrate) {
         super(cmdDet);
-        this.textMsg = textMsg;
-        this.settings = new ToneSettings(duration, tone, vibrate);
+        mTextMsg = textMsg;
+        mSettings = new ToneSettings(duration, tone, vibrate);
     }
 
+    @Override
     boolean setIcon(Bitmap icon) {
-        if (icon != null && textMsg != null) {
-            textMsg.icon = icon;
+        if (icon != null && mTextMsg != null) {
+            mTextMsg.icon = icon;
             return true;
         }
         return false;
@@ -101,25 +104,26 @@
 }
 
 class CallSetupParams extends CommandParams {
-    TextMessage confirmMsg;
-    TextMessage callMsg;
+    TextMessage mConfirmMsg;
+    TextMessage mCallMsg;
 
     CallSetupParams(CommandDetails cmdDet, TextMessage confirmMsg,
             TextMessage callMsg) {
         super(cmdDet);
-        this.confirmMsg = confirmMsg;
-        this.callMsg = callMsg;
+        mConfirmMsg = confirmMsg;
+        mCallMsg = callMsg;
     }
 
+    @Override
     boolean setIcon(Bitmap icon) {
         if (icon == null) {
             return false;
         }
-        if (confirmMsg != null && confirmMsg.icon == null) {
-            confirmMsg.icon = icon;
+        if (mConfirmMsg != null && mConfirmMsg.icon == null) {
+            mConfirmMsg.icon = icon;
             return true;
-        } else if (callMsg != null && callMsg.icon == null) {
-            callMsg.icon = icon;
+        } else if (mCallMsg != null && mCallMsg.icon == null) {
+            mCallMsg.icon = icon;
             return true;
         }
         return false;
@@ -127,21 +131,22 @@
 }
 
 class SelectItemParams extends CommandParams {
-    Menu menu = null;
-    boolean loadTitleIcon = false;
+    Menu mMenu = null;
+    boolean mLoadTitleIcon = false;
 
     SelectItemParams(CommandDetails cmdDet, Menu menu, boolean loadTitleIcon) {
         super(cmdDet);
-        this.menu = menu;
-        this.loadTitleIcon = loadTitleIcon;
+        mMenu = menu;
+        mLoadTitleIcon = loadTitleIcon;
     }
 
+    @Override
     boolean setIcon(Bitmap icon) {
-        if (icon != null && menu != null) {
-            if (loadTitleIcon && menu.titleIcon == null) {
-                menu.titleIcon = icon;
+        if (icon != null && mMenu != null) {
+            if (mLoadTitleIcon && mMenu.titleIcon == null) {
+                mMenu.titleIcon = icon;
             } else {
-                for (Item item : menu.items) {
+                for (Item item : mMenu.items) {
                     if (item.icon != null) {
                         continue;
                     }
@@ -156,16 +161,17 @@
 }
 
 class GetInputParams extends CommandParams {
-    Input input = null;
+    Input mInput = null;
 
     GetInputParams(CommandDetails cmdDet, Input input) {
         super(cmdDet);
-        this.input = input;
+        mInput = input;
     }
 
+    @Override
     boolean setIcon(Bitmap icon) {
-        if (icon != null && input != null) {
-            input.icon = icon;
+        if (icon != null && mInput != null) {
+            mInput.icon = icon;
         }
         return true;
     }
@@ -180,18 +186,19 @@
  * the details of proactive commands procedures and their structures.
  */
 class BIPClientParams extends CommandParams {
-    TextMessage textMsg;
-    boolean bHasAlphaId;
+    TextMessage mTextMsg;
+    boolean mHasAlphaId;
 
     BIPClientParams(CommandDetails cmdDet, TextMessage textMsg, boolean has_alpha_id) {
         super(cmdDet);
-        this.textMsg = textMsg;
-        this.bHasAlphaId = has_alpha_id;
+        mTextMsg = textMsg;
+        mHasAlphaId = has_alpha_id;
     }
 
+    @Override
     boolean setIcon(Bitmap icon) {
-        if (icon != null && textMsg != null) {
-            textMsg.icon = icon;
+        if (icon != null && mTextMsg != null) {
+            mTextMsg.icon = icon;
             return true;
         }
         return false;
diff --git a/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java b/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java
index 6e3b19f..0a21c28 100644
--- a/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java
+++ b/src/java/com/android/internal/telephony/cat/CommandParamsFactory.java
@@ -663,33 +663,6 @@
     }
 
     /**
-     * Processes SET_UP_EVENT_LIST proactive command from the SIM card.
-     *
-     * @param cmdDet Command Details object retrieved.
-     * @param ctlvs List of ComprehensionTlv objects following Command Details
-     *        object and Device Identities object within the proactive command
-     * @return true if the command is processing is pending and additional
-     *         asynchronous processing is required.
-     */
-    private boolean processSetUpEventList(CommandDetails cmdDet,
-            List<ComprehensionTlv> ctlvs) {
-
-        CatLog.d(this, "process SetUpEventList");
-        //
-        // ComprehensionTlv ctlv = searchForTag(ComprehensionTlvTag.EVENT_LIST,
-        // ctlvs);
-        // if (ctlv != null) {
-        // try {
-        // byte[] rawValue = ctlv.getRawValue();
-        // int valueIndex = ctlv.getValueIndex();
-        // int valueLen = ctlv.getLength();
-        //
-        // } catch (IndexOutOfBoundsException e) {}
-        // }
-        return true;
-    }
-
-    /**
      * Processes LAUNCH_BROWSER proactive command from the SIM card.
      *
      * @param cmdDet Command Details container object.
@@ -943,7 +916,7 @@
 
         if (iconId != null) {
             mIconLoadState = LOAD_SINGLE_ICON;
-            mIconLoader.loadIcon(iconId.recordNumber, this.obtainMessage(MSG_ID_LOAD_ICON_DONE));
+            mIconLoader.loadIcon(iconId.recordNumber, obtainMessage(MSG_ID_LOAD_ICON_DONE));
             return true;
         }
         return false;
diff --git a/src/java/com/android/internal/telephony/cat/Duration.java b/src/java/com/android/internal/telephony/cat/Duration.java
index e8cd404..e437f6e 100644
--- a/src/java/com/android/internal/telephony/cat/Duration.java
+++ b/src/java/com/android/internal/telephony/cat/Duration.java
@@ -58,20 +58,24 @@
         timeUnit = TimeUnit.values()[in.readInt()];
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeInt(timeInterval);
         dest.writeInt(timeUnit.ordinal());
     }
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
     public static final Parcelable.Creator<Duration> CREATOR = new Parcelable.Creator<Duration>() {
+        @Override
         public Duration createFromParcel(Parcel in) {
             return new Duration(in);
         }
 
+        @Override
         public Duration[] newArray(int size) {
             return new Duration[size];
         }
diff --git a/src/java/com/android/internal/telephony/cat/IconLoader.java b/src/java/com/android/internal/telephony/cat/IconLoader.java
index c339f5e..b7319a2 100644
--- a/src/java/com/android/internal/telephony/cat/IconLoader.java
+++ b/src/java/com/android/internal/telephony/cat/IconLoader.java
@@ -25,8 +25,6 @@
 import android.os.HandlerThread;
 import android.os.Looper;
 import android.os.Message;
-import android.telephony.Rlog;
-
 import java.util.HashMap;
 
 /**
@@ -144,11 +142,11 @@
             case EVENT_READ_ICON_DONE:
                 ar = (AsyncResult) msg.obj;
                 byte[] rawData = ((byte[]) ar.result);
-                if (mId.codingScheme == ImageDescriptor.CODING_SCHEME_BASIC) {
+                if (mId.mCodingScheme == ImageDescriptor.CODING_SCHEME_BASIC) {
                     mCurrentIcon = parseToBnW(rawData, rawData.length);
                     mIconsCache.put(mRecordNumber, mCurrentIcon);
                     postIcon();
-                } else if (mId.codingScheme == ImageDescriptor.CODING_SCHEME_COLOUR) {
+                } else if (mId.mCodingScheme == ImageDescriptor.CODING_SCHEME_COLOUR) {
                     mIconData = rawData;
                     readClut();
                 }
@@ -173,7 +171,7 @@
      * Handles Image descriptor parsing and required processing. This is the
      * first step required to handle retrieving icons from the SIM.
      *
-     * @param data byte [] containing Image Instance descriptor as defined in
+     * @param rawData byte [] containing Image Instance descriptor as defined in
      * TS 51.011.
      */
     private boolean handleImageDescriptor(byte[] rawData) {
@@ -184,11 +182,11 @@
         return true;
     }
 
-    // Start reading colour lookup table from SIM card.
+    // Start reading color lookup table from SIM card.
     private void readClut() {
         int length = mIconData[3] * CLUT_ENTRY_SIZE;
-        Message msg = this.obtainMessage(EVENT_READ_CLUT_DONE);
-        mSimFH.loadEFImgTransparent(mId.imageId,
+        Message msg = obtainMessage(EVENT_READ_CLUT_DONE);
+        mSimFH.loadEFImgTransparent(mId.mImageId,
                 mIconData[CLUT_LOCATION_OFFSET],
                 mIconData[CLUT_LOCATION_OFFSET + 1], length, msg);
     }
@@ -200,14 +198,14 @@
             postIcon();
             return;
         }
-        Message msg = this.obtainMessage(EVENT_READ_EF_IMG_RECOED_DONE);
+        Message msg = obtainMessage(EVENT_READ_EF_IMG_RECOED_DONE);
         mSimFH.loadEFImgLinearFixed(mRecordNumber, msg);
     }
 
     // Start reading icon bytes array from SIM card.
     private void readIconData() {
-        Message msg = this.obtainMessage(EVENT_READ_ICON_DONE);
-        mSimFH.loadEFImgTransparent(mId.imageId, 0, 0, mId.length ,msg);
+        Message msg = obtainMessage(EVENT_READ_ICON_DONE);
+        mSimFH.loadEFImgTransparent(mId.mImageId, 0, 0, mId.mLength ,msg);
     }
 
     // When all is done pass icon back to caller.
diff --git a/src/java/com/android/internal/telephony/cat/ImageDescriptor.java b/src/java/com/android/internal/telephony/cat/ImageDescriptor.java
index 711d977..139a4e0 100644
--- a/src/java/com/android/internal/telephony/cat/ImageDescriptor.java
+++ b/src/java/com/android/internal/telephony/cat/ImageDescriptor.java
@@ -21,13 +21,13 @@
  */
 public class ImageDescriptor {
     // members
-    int width;
-    int height;
-    int codingScheme;
-    int imageId;
-    int highOffset;
-    int lowOffset;
-    int length;
+    int mWidth;
+    int mHeight;
+    int mCodingScheme;
+    int mImageId;
+    int mHighOffset;
+    int mLowOffset;
+    int mLength;
 
     // constants
     static final int CODING_SCHEME_BASIC = 0x11;
@@ -37,13 +37,13 @@
     // ID_LENGTH substituted by IccFileHandlerBase.GET_RESPONSE_EF_IMG_SIZE_BYTES
 
     ImageDescriptor() {
-        width = 0;
-        height = 0;
-        codingScheme = 0;
-        imageId = 0;
-        highOffset = 0;
-        lowOffset = 0;
-        length = 0;
+        mWidth = 0;
+        mHeight = 0;
+        mCodingScheme = 0;
+        mImageId = 0;
+        mHighOffset = 0;
+        mLowOffset = 0;
+        mLength = 0;
     }
 
     /**
@@ -56,18 +56,18 @@
     static ImageDescriptor parse(byte[] rawData, int valueIndex) {
         ImageDescriptor d = new ImageDescriptor();
         try {
-            d.width = rawData[valueIndex++] & 0xff;
-            d.height = rawData[valueIndex++] & 0xff;
-            d.codingScheme = rawData[valueIndex++] & 0xff;
+            d.mWidth = rawData[valueIndex++] & 0xff;
+            d.mHeight = rawData[valueIndex++] & 0xff;
+            d.mCodingScheme = rawData[valueIndex++] & 0xff;
 
             // parse image id
-            d.imageId = (rawData[valueIndex++] & 0xff) << 8;
-            d.imageId |= rawData[valueIndex++] & 0xff;
+            d.mImageId = (rawData[valueIndex++] & 0xff) << 8;
+            d.mImageId |= rawData[valueIndex++] & 0xff;
             // parse offset
-            d.highOffset = (rawData[valueIndex++] & 0xff); // high byte offset
-            d.lowOffset = rawData[valueIndex++] & 0xff; // low byte offset
+            d.mHighOffset = (rawData[valueIndex++] & 0xff); // high byte offset
+            d.mLowOffset = rawData[valueIndex++] & 0xff; // low byte offset
 
-            d.length = ((rawData[valueIndex++] & 0xff) << 8 | (rawData[valueIndex++] & 0xff));
+            d.mLength = ((rawData[valueIndex++] & 0xff) << 8 | (rawData[valueIndex++] & 0xff));
         } catch (IndexOutOfBoundsException e) {
             CatLog.d("ImageDescripter", "parse; failed parsing image descriptor");
             d = null;
diff --git a/src/java/com/android/internal/telephony/cat/Input.java b/src/java/com/android/internal/telephony/cat/Input.java
index 13a5ad4..48705d1 100644
--- a/src/java/com/android/internal/telephony/cat/Input.java
+++ b/src/java/com/android/internal/telephony/cat/Input.java
@@ -68,10 +68,12 @@
         duration = in.readParcelable(null);
     }
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeString(text);
         dest.writeString(defaultText);
@@ -88,10 +90,12 @@
     }
 
     public static final Parcelable.Creator<Input> CREATOR = new Parcelable.Creator<Input>() {
+        @Override
         public Input createFromParcel(Parcel in) {
             return new Input(in);
         }
 
+        @Override
         public Input[] newArray(int size) {
             return new Input[size];
         }
diff --git a/src/java/com/android/internal/telephony/cat/Item.java b/src/java/com/android/internal/telephony/cat/Item.java
index d4702bb..f2513b6 100644
--- a/src/java/com/android/internal/telephony/cat/Item.java
+++ b/src/java/com/android/internal/telephony/cat/Item.java
@@ -45,10 +45,12 @@
         icon = in.readParcelable(null);
     }
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeInt(id);
         dest.writeString(text);
@@ -56,15 +58,18 @@
     }
 
     public static final Parcelable.Creator<Item> CREATOR = new Parcelable.Creator<Item>() {
+        @Override
         public Item createFromParcel(Parcel in) {
             return new Item(in);
         }
 
+        @Override
         public Item[] newArray(int size) {
             return new Item[size];
         }
     };
 
+    @Override
     public String toString() {
         return text;
     }
diff --git a/src/java/com/android/internal/telephony/cat/Menu.java b/src/java/com/android/internal/telephony/cat/Menu.java
index 7bbae01..a3cbbdf 100644
--- a/src/java/com/android/internal/telephony/cat/Menu.java
+++ b/src/java/com/android/internal/telephony/cat/Menu.java
@@ -72,10 +72,12 @@
         presentationType = PresentationType.values()[in.readInt()];
     }
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeString(title);
         dest.writeParcelable(titleIcon, flags);
@@ -94,10 +96,12 @@
     }
 
     public static final Parcelable.Creator<Menu> CREATOR = new Parcelable.Creator<Menu>() {
+        @Override
         public Menu createFromParcel(Parcel in) {
             return new Menu(in);
         }
 
+        @Override
         public Menu[] newArray(int size) {
             return new Menu[size];
         }
diff --git a/src/java/com/android/internal/telephony/cat/ResponseData.java b/src/java/com/android/internal/telephony/cat/ResponseData.java
index 814ec0d..2d2e257 100644
--- a/src/java/com/android/internal/telephony/cat/ResponseData.java
+++ b/src/java/com/android/internal/telephony/cat/ResponseData.java
@@ -48,11 +48,11 @@
 
 class SelectItemResponseData extends ResponseData {
     // members
-    private int id;
+    private int mId;
 
     public SelectItemResponseData(int id) {
         super();
-        this.id = id;
+        mId = id;
     }
 
     @Override
@@ -61,7 +61,7 @@
         int tag = 0x80 | ComprehensionTlvTag.ITEM_ID.value();
         buf.write(tag); // tag
         buf.write(1); // length
-        buf.write(id); // identifier of item chosen
+        buf.write(mId); // identifier of item chosen
     }
 }
 
@@ -79,19 +79,19 @@
 
     public GetInkeyInputResponseData(String inData, boolean ucs2, boolean packed) {
         super();
-        this.mIsUcs2 = ucs2;
-        this.mIsPacked = packed;
-        this.mInData = inData;
-        this.mIsYesNo = false;
+        mIsUcs2 = ucs2;
+        mIsPacked = packed;
+        mInData = inData;
+        mIsYesNo = false;
     }
 
     public GetInkeyInputResponseData(boolean yesNoResponse) {
         super();
-        this.mIsUcs2 = false;
-        this.mIsPacked = false;
-        this.mInData = "";
-        this.mIsYesNo = true;
-        this.mYesNoResponse = yesNoResponse;
+        mIsUcs2 = false;
+        mIsPacked = false;
+        mInData = "";
+        mIsYesNo = true;
+        mYesNoResponse = yesNoResponse;
     }
 
     @Override
@@ -160,11 +160,11 @@
 // See TS 31.111 section 6.4.15/ETSI TS 102 223
 // TS 31.124 section 27.22.4.15 for test spec
 class LanguageResponseData extends ResponseData {
-    private String lang;
+    private String mLang;
 
     public LanguageResponseData(String lang) {
         super();
-        this.lang = lang;
+        mLang = lang;
     }
 
     @Override
@@ -179,8 +179,8 @@
 
         byte[] data;
 
-        if (lang != null && lang.length() > 0) {
-            data = GsmAlphabet.stringToGsm8BitPacked(lang);
+        if (mLang != null && mLang.length() > 0) {
+            data = GsmAlphabet.stringToGsm8BitPacked(mLang);
         }
         else {
             data = new byte[0];
@@ -198,11 +198,11 @@
 // See TS 31.111 section 6.4.15/ETSI TS 102 223
 // TS 31.124 section 27.22.4.15 for test spec
 class DTTZResponseData extends ResponseData {
-    private Calendar calendar;
+    private Calendar mCalendar;
 
     public DTTZResponseData(Calendar cal) {
         super();
-        calendar = cal;
+        mCalendar = cal;
     }
 
     @Override
@@ -219,26 +219,26 @@
 
         data[0] = 0x07; // Write length of DTTZ data
 
-        if (calendar == null) {
-            calendar = Calendar.getInstance();
+        if (mCalendar == null) {
+            mCalendar = Calendar.getInstance();
         }
         // Fill year byte
-        data[1] = byteToBCD(calendar.get(java.util.Calendar.YEAR) % 100);
+        data[1] = byteToBCD(mCalendar.get(java.util.Calendar.YEAR) % 100);
 
         // Fill month byte
-        data[2] = byteToBCD(calendar.get(java.util.Calendar.MONTH) + 1);
+        data[2] = byteToBCD(mCalendar.get(java.util.Calendar.MONTH) + 1);
 
         // Fill day byte
-        data[3] = byteToBCD(calendar.get(java.util.Calendar.DATE));
+        data[3] = byteToBCD(mCalendar.get(java.util.Calendar.DATE));
 
         // Fill hour byte
-        data[4] = byteToBCD(calendar.get(java.util.Calendar.HOUR_OF_DAY));
+        data[4] = byteToBCD(mCalendar.get(java.util.Calendar.HOUR_OF_DAY));
 
         // Fill minute byte
-        data[5] = byteToBCD(calendar.get(java.util.Calendar.MINUTE));
+        data[5] = byteToBCD(mCalendar.get(java.util.Calendar.MINUTE));
 
         // Fill second byte
-        data[6] = byteToBCD(calendar.get(java.util.Calendar.SECOND));
+        data[6] = byteToBCD(mCalendar.get(java.util.Calendar.SECOND));
 
         String tz = SystemProperties.get("persist.sys.timezone", "");
         if (TextUtils.isEmpty(tz)) {
diff --git a/src/java/com/android/internal/telephony/cat/ResultCode.java b/src/java/com/android/internal/telephony/cat/ResultCode.java
index 8544175..f001c7e 100644
--- a/src/java/com/android/internal/telephony/cat/ResultCode.java
+++ b/src/java/com/android/internal/telephony/cat/ResultCode.java
@@ -19,7 +19,7 @@
 
 /**
  * Enumeration for the return code in TERMINAL RESPONSE.
- * To get the actual return code for each enum value, call {@link #code() code}
+ * To get the actual return code for each enum value, call {@link #value}
  * method.
  *
  * {@hide}
diff --git a/src/java/com/android/internal/telephony/cat/ResultException.java b/src/java/com/android/internal/telephony/cat/ResultException.java
index 84879c2..5175b83 100644
--- a/src/java/com/android/internal/telephony/cat/ResultException.java
+++ b/src/java/com/android/internal/telephony/cat/ResultException.java
@@ -45,6 +45,8 @@
                 throw new AssertionError(
                         "For result code, " + result +
                         ", additional information must be given!");
+            default:
+                break;
         }
 
         mResult = result;
diff --git a/src/java/com/android/internal/telephony/cat/TextMessage.java b/src/java/com/android/internal/telephony/cat/TextMessage.java
index 5ffd076..515f6c5 100644
--- a/src/java/com/android/internal/telephony/cat/TextMessage.java
+++ b/src/java/com/android/internal/telephony/cat/TextMessage.java
@@ -44,10 +44,12 @@
         duration = in.readParcelable(null);
     }
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeString(title);
         dest.writeString(text);
@@ -60,10 +62,12 @@
     }
 
     public static final Parcelable.Creator<TextMessage> CREATOR = new Parcelable.Creator<TextMessage>() {
+        @Override
         public TextMessage createFromParcel(Parcel in) {
             return new TextMessage(in);
         }
 
+        @Override
         public TextMessage[] newArray(int size) {
             return new TextMessage[size];
         }
diff --git a/src/java/com/android/internal/telephony/cat/Tone.java b/src/java/com/android/internal/telephony/cat/Tone.java
index 27b4489..eea7fed 100644
--- a/src/java/com/android/internal/telephony/cat/Tone.java
+++ b/src/java/com/android/internal/telephony/cat/Tone.java
@@ -170,19 +170,23 @@
         mValue = in.readInt();
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeInt(ordinal());
     }
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
     public static final Parcelable.Creator<Tone> CREATOR = new Parcelable.Creator<Tone>() {
+        @Override
         public Tone createFromParcel(Parcel in) {
             return Tone.values()[in.readInt()];
         }
 
+        @Override
         public Tone[] newArray(int size) {
             return new Tone[size];
         }
diff --git a/src/java/com/android/internal/telephony/cat/ToneSettings.java b/src/java/com/android/internal/telephony/cat/ToneSettings.java
index 6375afb..61c1573 100644
--- a/src/java/com/android/internal/telephony/cat/ToneSettings.java
+++ b/src/java/com/android/internal/telephony/cat/ToneSettings.java
@@ -40,10 +40,12 @@
         vibrate = in.readInt() == 1;
     }
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeParcelable(duration, 0);
         dest.writeParcelable(tone, 0);
@@ -51,10 +53,12 @@
     }
 
     public static final Parcelable.Creator<ToneSettings> CREATOR = new Parcelable.Creator<ToneSettings>() {
+        @Override
         public ToneSettings createFromParcel(Parcel in) {
             return new ToneSettings(in);
         }
 
+        @Override
         public ToneSettings[] newArray(int size) {
             return new ToneSettings[size];
         }
diff --git a/src/java/com/android/internal/telephony/cat/ValueParser.java b/src/java/com/android/internal/telephony/cat/ValueParser.java
index 5b1ae91..6f655ed 100644
--- a/src/java/com/android/internal/telephony/cat/ValueParser.java
+++ b/src/java/com/android/internal/telephony/cat/ValueParser.java
@@ -29,7 +29,7 @@
     /**
      * Search for a Command Details object from a list.
      *
-     * @param ctlvs List of ComprehensionTlv objects used for search
+     * @param ctlv List of ComprehensionTlv objects used for search
      * @return An CtlvCommandDetails object found from the objects. If no
      *         Command Details object is found, ResultException is thrown.
      * @throws ResultException
@@ -54,7 +54,7 @@
     /**
      * Search for a Device Identities object from a list.
      *
-     * @param ctlvs List of ComprehensionTlv objects used for search
+     * @param ctlv List of ComprehensionTlv objects used for search
      * @return An CtlvDeviceIdentities object found from the objects. If no
      *         Command Details object is found, ResultException is thrown.
      * @throws ResultException
diff --git a/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java b/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
index 632a24c..988f36a 100644
--- a/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
+++ b/src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
@@ -29,7 +29,6 @@
 
 import com.android.internal.telephony.CommandsInterface;
 import com.android.internal.telephony.OperatorInfo;
-import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.PhoneNotifier;
 import com.android.internal.telephony.PhoneProxy;
@@ -46,8 +45,7 @@
 import java.io.PrintWriter;
 
 public class CDMALTEPhone extends CDMAPhone {
-    static final String LOG_TAG = "CDMA";
-
+    static final String LOG_LTE_TAG = "CDMALTEPhone";
     private static final boolean DBG = true;
 
     /** Secondary SMSDispatcher for 3GPP format messages. */
@@ -133,7 +131,7 @@
 
                 case CONNECTED:
                 case DISCONNECTING:
-                    if (mCT.state != PhoneConstants.State.IDLE &&
+                    if (mCT.mState != PhoneConstants.State.IDLE &&
                             !mSST.isConcurrentVoiceAndDataAllowed()) {
                         ret = PhoneConstants.DataState.SUSPENDED;
                     } else {
@@ -141,7 +139,6 @@
                     }
                     break;
 
-                case INITING:
                 case CONNECTING:
                 case SCANNING:
                     ret = PhoneConstants.DataState.CONNECTING;
@@ -167,7 +164,7 @@
         // get the message
         Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
 
-        mCM.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
+        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
     }
 
     /**
@@ -177,7 +174,7 @@
         // look for our wrapper within the asyncresult, skip the rest if it
         // is null.
         if (!(ar.userObj instanceof NetworkSelectMessage)) {
-            Rlog.e(LOG_TAG, "unexpected result from user object.");
+            loge("unexpected result from user object.");
             return;
         }
 
@@ -200,7 +197,7 @@
 
         // commit and log the result.
         if (! editor.commit()) {
-            Rlog.e(LOG_TAG, "failed to commit network selection preference");
+            loge("failed to commit network selection preference");
         }
 
     }
@@ -218,7 +215,7 @@
                 mContext.getContentResolver().insert(uri, map);
                 return true;
             } catch (SQLException e) {
-                Rlog.e(LOG_TAG, "[CDMALTEPhone] Can't store current operator ret false", e);
+                loge("Can't store current operator ret false", e);
             }
         } else {
             if (DBG) log("updateCurrentCarrierInProvider mIccRecords == null ret false");
@@ -254,12 +251,12 @@
 
     @Override
     public void getAvailableNetworks(Message response) {
-        mCM.getAvailableNetworks(response);
+        mCi.getAvailableNetworks(response);
     }
 
     @Override
     public void requestIsimAuthentication(String nonce, Message result) {
-        mCM.requestIsimAuthentication(nonce, result);
+        mCi.requestIsimAuthentication(nonce, result);
     }
 
     @Override
@@ -302,9 +299,17 @@
 
     @Override
     protected void log(String s) {
-            Rlog.d(LOG_TAG, "[CDMALTEPhone] " + s);
+            Rlog.d(LOG_LTE_TAG, s);
     }
 
+    protected void loge(String s) {
+            Rlog.e(LOG_LTE_TAG, s);
+    }
+
+    protected void loge(String s, Throwable e) {
+        Rlog.e(LOG_LTE_TAG, s, e);
+}
+
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("CDMALTEPhone extends:");
diff --git a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
index 1465a17..b304e81 100755
--- a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -37,23 +37,19 @@
 import android.telephony.CellLocation;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.ServiceState;
-import android.telephony.SignalStrength;
 import android.text.TextUtils;
 import android.telephony.Rlog;
 
-import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.CallTracker;
 import com.android.internal.telephony.CommandException;
 import com.android.internal.telephony.CommandsInterface;
 import com.android.internal.telephony.Connection;
-import com.android.internal.telephony.IccCard;
 import com.android.internal.telephony.IccPhoneBookInterfaceManager;
 import com.android.internal.telephony.IccSmsInterfaceManager;
 import com.android.internal.telephony.MccTable;
 import com.android.internal.telephony.MmiCode;
 import com.android.internal.telephony.OperatorInfo;
-import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneBase;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.PhoneNotifier;
@@ -63,16 +59,12 @@
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.telephony.UUSInfo;
-import com.android.internal.telephony.cat.CatService;
+import com.android.internal.telephony.dataconnection.DataConnectionTracker;
 import com.android.internal.telephony.uicc.IccException;
-import com.android.internal.telephony.uicc.IccFileHandler;
 import com.android.internal.telephony.uicc.IccRecords;
 import com.android.internal.telephony.uicc.RuimRecords;
-import com.android.internal.telephony.uicc.UiccCard;
 import com.android.internal.telephony.uicc.UiccCardApplication;
 import com.android.internal.telephony.uicc.UiccController;
-import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
-
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -88,7 +80,7 @@
  * {@hide}
  */
 public class CDMAPhone extends PhoneBase {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "CDMAPhone";
     private static final boolean DBG = true;
     private static final boolean VDBG = false; /* STOP SHIP if true */
 
@@ -163,23 +155,23 @@
     }
 
     protected void init(Context context, PhoneNotifier notifier) {
-        mCM.setPhoneType(PhoneConstants.PHONE_TYPE_CDMA);
+        mCi.setPhoneType(PhoneConstants.PHONE_TYPE_CDMA);
         mCT = new CdmaCallTracker(this);
-        mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(context, mCM, this,
+        mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(context, mCi, this,
                 EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
         mSMS = new CdmaSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
-        mDataConnectionTracker = new CdmaDataConnectionTracker (this);
+        mDataConnectionTracker = new DataConnectionTracker (this);
         mRuimPhoneBookInterfaceManager = new RuimPhoneBookInterfaceManager(this);
         mRuimSmsInterfaceManager = new RuimSmsInterfaceManager(this, mSMS);
         mSubInfo = new PhoneSubInfo(this);
         mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML);
 
-        mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
-        mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
-        mCM.registerForOn(this, EVENT_RADIO_ON, null);
-        mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
+        mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
+        mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
+        mCi.registerForOn(this, EVENT_RADIO_ON, null);
+        mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
         mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
-        mCM.setEmergencyCallbackMode(this, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);
+        mCi.setEmergencyCallbackMode(this, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);
 
         PowerManager pm
             = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
@@ -194,7 +186,7 @@
         mIsPhoneInEcmState = inEcm.equals("true");
         if (mIsPhoneInEcmState) {
             // Send a message which will invoke handleExitEmergencyCallbackMode
-            mCM.exitEmergencyCallbackMode(obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE));
+            mCi.exitEmergencyCallbackMode(obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE));
         }
 
         // get the string that specifies the carrier OTA Sp number
@@ -229,11 +221,11 @@
 
             //Unregister from all former registered events
             unregisterForRuimRecordEvents();
-            mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
-            mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
-            mCM.unregisterForOn(this); //EVENT_RADIO_ON
+            mCi.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
+            mCi.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
+            mCi.unregisterForOn(this); //EVENT_RADIO_ON
             mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
-            mCM.unSetOnSuppServiceNotification(this);
+            mCi.unSetOnSuppServiceNotification(this);
             removeCallbacks(mExitEcmRunnable);
 
             mPendingMmis.clear();
@@ -273,64 +265,79 @@
         }
     }
 
+    @Override
     public ServiceState getServiceState() {
-        return mSST.ss;
+        return mSST.mSS;
     }
 
+    @Override
     public CallTracker getCallTracker() {
         return mCT;
     }
 
+    @Override
     public PhoneConstants.State getState() {
-        return mCT.state;
+        return mCT.mState;
     }
 
+    @Override
     public ServiceStateTracker getServiceStateTracker() {
         return mSST;
     }
 
+    @Override
     public String getPhoneName() {
         return "CDMA";
     }
 
+    @Override
     public int getPhoneType() {
         return PhoneConstants.PHONE_TYPE_CDMA;
     }
 
+    @Override
     public boolean canTransfer() {
         Rlog.e(LOG_TAG, "canTransfer: not possible in CDMA");
         return false;
     }
 
+    @Override
     public CdmaCall getRingingCall() {
-        return mCT.ringingCall;
+        return mCT.mRingingCall;
     }
 
+    @Override
     public void setMute(boolean muted) {
         mCT.setMute(muted);
     }
 
+    @Override
     public boolean getMute() {
         return mCT.getMute();
     }
 
-    public void conference() throws CallStateException {
+    @Override
+    public void conference() {
         // three way calls in CDMA will be handled by feature codes
         Rlog.e(LOG_TAG, "conference: not possible in CDMA");
     }
 
+    @Override
     public void enableEnhancedVoicePrivacy(boolean enable, Message onComplete) {
-        this.mCM.setPreferredVoicePrivacy(enable, onComplete);
+        mCi.setPreferredVoicePrivacy(enable, onComplete);
     }
 
+    @Override
     public void getEnhancedVoicePrivacy(Message onComplete) {
-        this.mCM.getPreferredVoicePrivacy(onComplete);
+        mCi.getPreferredVoicePrivacy(onComplete);
     }
 
+    @Override
     public void clearDisconnected() {
         mCT.clearDisconnected();
     }
 
+    @Override
     public DataActivityState getDataActivityState() {
         DataActivityState ret = DataActivityState.NONE;
 
@@ -352,11 +359,16 @@
                 case DORMANT:
                     ret = DataActivityState.DORMANT;
                 break;
+
+                default:
+                    ret = DataActivityState.NONE;
+                break;
             }
         }
         return ret;
     }
 
+    @Override
     public Connection
     dial (String dialString) throws CallStateException {
         // Need to make sure dialString gets parsed properly
@@ -364,29 +376,35 @@
         return mCT.dial(newDialString);
     }
 
+    @Override
     public Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException {
         throw new CallStateException("Sending UUS information NOT supported in CDMA!");
     }
 
+    @Override
     public boolean
     getMessageWaitingIndicator() {
         return (getVoiceMessageCount() > 0);
     }
 
+    @Override
     public List<? extends MmiCode>
     getPendingMmiCodes() {
         return mPendingMmis;
     }
 
+    @Override
     public void registerForSuppServiceNotification(
             Handler h, int what, Object obj) {
         Rlog.e(LOG_TAG, "method registerForSuppServiceNotification is NOT supported in CDMA!");
     }
 
+    @Override
     public CdmaCall getBackgroundCall() {
-        return mCT.backgroundCall;
+        return mCT.mBackgroundCall;
     }
 
+    @Override
     public boolean handleInCallMmiCommands(String dialString) {
         Rlog.e(LOG_TAG, "method handleInCallMmiCommands is NOT supported in CDMA!");
         return false;
@@ -401,64 +419,78 @@
                 .isAlive());
     }
 
+    @Override
     public void
     setNetworkSelectionModeAutomatic(Message response) {
         Rlog.e(LOG_TAG, "method setNetworkSelectionModeAutomatic is NOT supported in CDMA!");
     }
 
+    @Override
     public void unregisterForSuppServiceNotification(Handler h) {
         Rlog.e(LOG_TAG, "method unregisterForSuppServiceNotification is NOT supported in CDMA!");
     }
 
+    @Override
     public void
     acceptCall() throws CallStateException {
         mCT.acceptCall();
     }
 
+    @Override
     public void
     rejectCall() throws CallStateException {
         mCT.rejectCall();
     }
 
+    @Override
     public void
     switchHoldingAndActive() throws CallStateException {
         mCT.switchWaitingOrHoldingAndActive();
     }
 
+    @Override
     public String getLine1Number() {
         return mSST.getMdnNumber();
     }
 
+    @Override
     public String getCdmaPrlVersion(){
         return mSST.getPrlVersion();
     }
 
+    @Override
     public String getCdmaMin() {
         return mSST.getCdmaMin();
     }
 
+    @Override
     public boolean isMinInfoReady() {
         return mSST.isMinInfoReady();
     }
 
+    @Override
     public void getCallWaiting(Message onComplete) {
-        mCM.queryCallWaiting(CommandsInterface.SERVICE_CLASS_VOICE, onComplete);
+        mCi.queryCallWaiting(CommandsInterface.SERVICE_CLASS_VOICE, onComplete);
     }
 
+    @Override
     public void
     setRadioPower(boolean power) {
         mSST.setRadioPower(power);
     }
 
+    @Override
     public String getEsn() {
         return mEsn;
     }
 
+    @Override
     public String getMeid() {
         return mMeid;
     }
 
     //returns MEID or ESN in CDMA
+    @Override
     public String getDeviceId() {
         String id = getMeid();
         if ((id == null) || id.matches("^0*$")) {
@@ -468,43 +500,52 @@
         return id;
     }
 
+    @Override
     public String getDeviceSvn() {
         Rlog.d(LOG_TAG, "getDeviceSvn(): return 0");
         return "0";
     }
 
+    @Override
     public String getSubscriberId() {
         return mSST.getImsi();
     }
 
+    @Override
     public String getImei() {
         Rlog.e(LOG_TAG, "IMEI is not available in CDMA");
         return null;
     }
 
+    @Override
     public boolean canConference() {
         Rlog.e(LOG_TAG, "canConference: not possible in CDMA");
         return false;
     }
 
+    @Override
     public CellLocation getCellLocation() {
-        return mSST.cellLoc;
+        return mSST.mCellLoc;
     }
 
+    @Override
     public CdmaCall getForegroundCall() {
-        return mCT.foregroundCall;
+        return mCT.mForegroundCall;
     }
 
+    @Override
     public void
     selectNetworkManually(OperatorInfo network,
             Message response) {
         Rlog.e(LOG_TAG, "selectNetworkManually: not possible in CDMA");
     }
 
+    @Override
     public void setOnPostDialCharacter(Handler h, int what, Object obj) {
         mPostDialHandler = new Registrant(h, what, obj);
     }
 
+    @Override
     public boolean handlePinMmi(String dialString) {
         CdmaMmiCode mmi = CdmaMmiCode.newFromDialString(dialString, this);
 
@@ -537,54 +578,67 @@
         }
     }
 
+    @Override
     public void setLine1Number(String alphaTag, String number, Message onComplete) {
         Rlog.e(LOG_TAG, "setLine1Number: not possible in CDMA");
     }
 
+    @Override
     public void setCallWaiting(boolean enable, Message onComplete) {
         Rlog.e(LOG_TAG, "method setCallWaiting is NOT supported in CDMA!");
     }
 
+    @Override
     public void updateServiceLocation() {
         mSST.enableSingleLocationUpdate();
     }
 
+    @Override
     public void setDataRoamingEnabled(boolean enable) {
         mDataConnectionTracker.setDataOnRoamingEnabled(enable);
     }
 
+    @Override
     public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
-        mCM.registerForCdmaOtaProvision(h, what, obj);
+        mCi.registerForCdmaOtaProvision(h, what, obj);
     }
 
+    @Override
     public void unregisterForCdmaOtaStatusChange(Handler h) {
-        mCM.unregisterForCdmaOtaProvision(h);
+        mCi.unregisterForCdmaOtaProvision(h);
     }
 
+    @Override
     public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
         mSST.registerForSubscriptionInfoReady(h, what, obj);
     }
 
+    @Override
     public void unregisterForSubscriptionInfoReady(Handler h) {
         mSST.unregisterForSubscriptionInfoReady(h);
     }
 
+    @Override
     public void setOnEcbModeExitResponse(Handler h, int what, Object obj) {
         mEcmExitRespRegistrant = new Registrant (h, what, obj);
     }
 
+    @Override
     public void unsetOnEcbModeExitResponse(Handler h) {
         mEcmExitRespRegistrant.clear();
     }
 
+    @Override
     public void registerForCallWaiting(Handler h, int what, Object obj) {
         mCT.registerForCallWaiting(h, what, obj);
     }
 
+    @Override
     public void unregisterForCallWaiting(Handler h) {
         mCT.unregisterForCallWaiting(h);
     }
 
+    @Override
     public void
     getNeighboringCids(Message response) {
         /*
@@ -603,6 +657,7 @@
         }
     }
 
+    @Override
     public PhoneConstants.DataState getDataConnectionState(String apnType) {
         PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED;
 
@@ -627,7 +682,7 @@
 
                 case CONNECTED:
                 case DISCONNECTING:
-                    if ( mCT.state != PhoneConstants.State.IDLE
+                    if ( mCT.mState != PhoneConstants.State.IDLE
                             && !mSST.isConcurrentVoiceAndDataAllowed()) {
                         ret = PhoneConstants.DataState.SUSPENDED;
                     } else {
@@ -635,7 +690,6 @@
                     }
                 break;
 
-                case INITING:
                 case CONNECTING:
                 case SCANNING:
                     ret = PhoneConstants.DataState.CONNECTING;
@@ -647,34 +701,39 @@
         return ret;
     }
 
+    @Override
     public void sendUssdResponse(String ussdMessge) {
         Rlog.e(LOG_TAG, "sendUssdResponse: not possible in CDMA");
     }
 
+    @Override
     public void sendDtmf(char c) {
         if (!PhoneNumberUtils.is12Key(c)) {
             Rlog.e(LOG_TAG,
                     "sendDtmf called with invalid character '" + c + "'");
         } else {
-            if (mCT.state ==  PhoneConstants.State.OFFHOOK) {
-                mCM.sendDtmf(c, null);
+            if (mCT.mState ==  PhoneConstants.State.OFFHOOK) {
+                mCi.sendDtmf(c, null);
             }
         }
     }
 
+    @Override
     public void startDtmf(char c) {
         if (!PhoneNumberUtils.is12Key(c)) {
             Rlog.e(LOG_TAG,
                     "startDtmf called with invalid character '" + c + "'");
         } else {
-            mCM.startDtmf(c, null);
+            mCi.startDtmf(c, null);
         }
     }
 
+    @Override
     public void stopDtmf() {
-        mCM.stopDtmf(null);
+        mCi.stopDtmf(null);
     }
 
+    @Override
     public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete) {
         boolean check = true;
         for (int itr = 0;itr < dtmfString.length(); itr++) {
@@ -685,35 +744,42 @@
                 break;
             }
         }
-        if ((mCT.state ==  PhoneConstants.State.OFFHOOK)&&(check)) {
-            mCM.sendBurstDtmf(dtmfString, on, off, onComplete);
+        if ((mCT.mState ==  PhoneConstants.State.OFFHOOK)&&(check)) {
+            mCi.sendBurstDtmf(dtmfString, on, off, onComplete);
         }
      }
 
+    @Override
     public void getAvailableNetworks(Message response) {
         Rlog.e(LOG_TAG, "getAvailableNetworks: not possible in CDMA");
     }
 
+    @Override
     public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete) {
         Rlog.e(LOG_TAG, "setOutgoingCallerIdDisplay: not possible in CDMA");
     }
 
+    @Override
     public void enableLocationUpdates() {
         mSST.enableLocationUpdates();
     }
 
+    @Override
     public void disableLocationUpdates() {
         mSST.disableLocationUpdates();
     }
 
+    @Override
     public void getDataCallList(Message response) {
-        mCM.getDataCallList(response);
+        mCi.getDataCallList(response);
     }
 
+    @Override
     public boolean getDataRoamingEnabled() {
         return mDataConnectionTracker.getDataOnRoamingEnabled();
     }
 
+    @Override
     public void setVoiceMailNumber(String alphaTag,
                                    String voiceMailNumber,
                                    Message onComplete) {
@@ -726,6 +792,7 @@
         }
     }
 
+    @Override
     public String getVoiceMailNumber() {
         String number = null;
         SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
@@ -744,6 +811,7 @@
     /* Returns Number of Voicemails
      * @hide
      */
+    @Override
     public int getVoiceMessageCount() {
         IccRecords r = mIccRecords.get();
         int voicemailCount =  (r != null) ? r.getVoiceMessageCount() : 0;
@@ -757,6 +825,7 @@
         return voicemailCount;
     }
 
+    @Override
     public String getVoiceMailAlphaTag() {
         // TODO: Where can we get this value has to be clarified with QC.
         String ret = "";//TODO: Remove = "", if we know where to get this value.
@@ -771,10 +840,12 @@
         return ret;
     }
 
+    @Override
     public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) {
         Rlog.e(LOG_TAG, "getCallForwardingOption: not possible in CDMA");
     }
 
+    @Override
     public void setCallForwardingOption(int commandInterfaceCFAction,
             int commandInterfaceCFReason,
             String dialingNumber,
@@ -783,36 +854,42 @@
         Rlog.e(LOG_TAG, "setCallForwardingOption: not possible in CDMA");
     }
 
+    @Override
     public void
     getOutgoingCallerIdDisplay(Message onComplete) {
         Rlog.e(LOG_TAG, "getOutgoingCallerIdDisplay: not possible in CDMA");
     }
 
+    @Override
     public boolean
     getCallForwardingIndicator() {
         Rlog.e(LOG_TAG, "getCallForwardingIndicator: not possible in CDMA");
         return false;
     }
 
+    @Override
     public void explicitCallTransfer() {
         Rlog.e(LOG_TAG, "explicitCallTransfer: not possible in CDMA");
     }
 
+    @Override
     public String getLine1AlphaTag() {
         Rlog.e(LOG_TAG, "getLine1AlphaTag: not possible in CDMA");
         return null;
     }
 
     /**
-     * Notify any interested party of a Phone state change  {@link PhoneConstants.State}
+     * Notify any interested party of a Phone state change
+     * {@link com.android.internal.telephony.PhoneConstants.State}
      */
     /*package*/ void notifyPhoneStateChanged() {
         mNotifier.notifyPhoneState(this);
     }
 
     /**
-     * Notify registrants of a change in the call state. This notifies changes in {@link Call.State}
-     * Use this when changes in the precise call state are needed, else use notifyPhoneStateChanged.
+     * Notify registrants of a change in the call state. This notifies changes in
+     * {@link com.android.internal.telephony.Call.State}. Use this when changes
+     * in the precise call state are needed, else use notifyPhoneStateChanged.
      */
     /*package*/ void notifyPreciseCallStateChanged() {
         /* we'd love it if this was package-scoped*/
@@ -840,10 +917,12 @@
         mUnknownConnectionRegistrants.notifyResult(this);
     }
 
+    @Override
     public boolean isInEmergencyCall() {
         return mCT.isInEmergencyCall();
     }
 
+    @Override
     public boolean isInEcm() {
         return mIsPhoneInEcmState;
     }
@@ -862,7 +941,7 @@
             mWakeLock.release();
         }
         // Send a message which will invoke handleExitEmergencyCallbackMode
-        mCM.exitEmergencyCallbackMode(obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE));
+        mCi.exitEmergencyCallbackMode(obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE));
     }
 
     private void handleEnterEmergencyCallbackMode(Message msg) {
@@ -940,10 +1019,12 @@
      * @param what User-defined message code
      * @param obj placed in Message.obj
      */
+    @Override
     public void registerForEcmTimerReset(Handler h, int what, Object obj) {
         mEcmTimerResetRegistrants.addUnique(h, what, obj);
     }
 
+    @Override
     public void unregisterForEcmTimerReset(Handler h) {
         mEcmTimerResetRegistrants.remove(h);
     }
@@ -955,9 +1036,9 @@
 
         switch(msg.what) {
             case EVENT_RADIO_AVAILABLE: {
-                mCM.getBasebandVersion(obtainMessage(EVENT_GET_BASEBAND_VERSION_DONE));
+                mCi.getBasebandVersion(obtainMessage(EVENT_GET_BASEBAND_VERSION_DONE));
 
-                mCM.getDeviceIdentity(obtainMessage(EVENT_GET_DEVICE_IDENTITY_DONE));
+                mCi.getDeviceIdentity(obtainMessage(EVENT_GET_DEVICE_IDENTITY_DONE));
             }
             break;
 
@@ -1121,6 +1202,7 @@
     /**
      * Retrieves the PhoneSubInfo of the CDMAPhone
      */
+    @Override
     public PhoneSubInfo getPhoneSubInfo() {
         return mSubInfo;
     }
@@ -1128,6 +1210,7 @@
     /**
      * Retrieves the IccSmsInterfaceManager of the CDMAPhone
      */
+    @Override
     public IccSmsInterfaceManager getIccSmsInterfaceManager() {
         return mRuimSmsInterfaceManager;
     }
@@ -1135,6 +1218,7 @@
     /**
      * Retrieves the IccPhoneBookInterfaceManager of the CDMAPhone
      */
+    @Override
     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager() {
         return mRuimPhoneBookInterfaceManager;
     }
@@ -1152,6 +1236,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public final void setSystemProperty(String property, String value) {
         super.setSystemProperty(property, value);
     }
@@ -1162,6 +1247,7 @@
      * @param activate 0 = activate, 1 = deactivate
      * @param response Callback message is empty on completion
      */
+    @Override
     public void activateCellBroadcastSms(int activate, Message response) {
         Rlog.e(LOG_TAG, "[CDMAPhone] activateCellBroadcastSms() is obsolete; use SmsManager");
         response.sendToTarget();
@@ -1172,6 +1258,7 @@
      *
      * @param response Callback message is empty on completion
      */
+    @Override
     public void getCellBroadcastSmsConfig(Message response) {
         Rlog.e(LOG_TAG, "[CDMAPhone] getCellBroadcastSmsConfig() is obsolete; use SmsManager");
         response.sendToTarget();
@@ -1182,6 +1269,7 @@
      *
      * @param response Callback message is empty on completion
      */
+    @Override
     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response) {
         Rlog.e(LOG_TAG, "[CDMAPhone] setCellBroadcastSmsConfig() is obsolete; use SmsManager");
         response.sendToTarget();
@@ -1269,11 +1357,11 @@
         boolean isOtaSpNum = false;
         try {
             // Get how many number of system selection code ranges
-            int selRc = Integer.parseInt((String)sch[1]);
+            int selRc = Integer.parseInt(sch[1]);
             for (int i = 0; i < selRc; i++) {
                 if (!TextUtils.isEmpty(sch[i+2]) && !TextUtils.isEmpty(sch[i+3])) {
-                    int selMin = Integer.parseInt((String)sch[i+2]);
-                    int selMax = Integer.parseInt((String)sch[i+3]);
+                    int selMin = Integer.parseInt(sch[i+2]);
+                    int selMax = Integer.parseInt(sch[i+3]);
                     // Check if the selection code extracted from the dial string falls
                     // within any of the range pairs specified in the schema.
                     if ((sysSelCodeInt >= selMin) && (sysSelCodeInt <= selMax)) {
@@ -1337,8 +1425,8 @@
                         }
                     }
                 } else if (!TextUtils.isEmpty(sch[0]) && sch[0].equals("FC")) {
-                    int fcLen =  Integer.parseInt((String)sch[1]);
-                    String fc = (String)sch[2];
+                    int fcLen =  Integer.parseInt(sch[1]);
+                    String fc = sch[2];
                     if (dialStr.regionMatches(0,fc,0,fcLen)) {
                         isOtaSpNum = true;
                     } else {
@@ -1509,7 +1597,7 @@
 
     protected void log(String s) {
         if (DBG)
-            Rlog.d(LOG_TAG, "[CDMAPhone] " + s);
+            Rlog.d(LOG_TAG, s);
     }
 
     @Override
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaCall.java b/src/java/com/android/internal/telephony/cdma/CdmaCall.java
index 4ad61bb..4f7047a 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaCall.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaCall.java
@@ -16,7 +16,6 @@
 
 package com.android.internal.telephony.cdma;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import com.android.internal.telephony.Call;
@@ -24,7 +23,6 @@
 import com.android.internal.telephony.Connection;
 import com.android.internal.telephony.DriverCall;
 import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.Call.State;
 
 /**
  * {@hide}
@@ -32,9 +30,7 @@
 public final class CdmaCall extends Call {
     /*************************** Instance Variables **************************/
 
-    /*package*/ ArrayList<Connection> connections = new ArrayList<Connection>();
-    /*package*/ State state = State.IDLE;
-    /*package*/ CdmaCallTracker owner;
+    /*package*/ CdmaCallTracker mOwner;
 
     /***************************** Class Methods *****************************/
 
@@ -55,61 +51,61 @@
     /****************************** Constructors *****************************/
     /*package*/
     CdmaCall (CdmaCallTracker owner) {
-        this.owner = owner;
+        mOwner = owner;
     }
 
     public void dispose() {
     }
 
     /************************** Overridden from Call *************************/
+    @Override
     public List<Connection>
     getConnections() {
         // FIXME should return Collections.unmodifiableList();
-        return connections;
+        return mConnections;
     }
 
-    public State
-    getState() {
-        return state;
-    }
-
+    @Override
     public Phone
     getPhone() {
-        return owner.phone;
+        return mOwner.mPhone;
     }
 
+    @Override
     public boolean isMultiparty() {
-        return connections.size() > 1;
+        return mConnections.size() > 1;
     }
 
     /** Please note: if this is the foreground call and a
      *  background call exists, the background call will be resumed
      *  because an AT+CHLD=1 will be sent
      */
+    @Override
     public void
     hangup() throws CallStateException {
-        owner.hangup(this);
+        mOwner.hangup(this);
     }
 
+    @Override
     public String
     toString() {
-        return state.toString();
+        return mState.toString();
     }
 
     //***** Called from CdmaConnection
 
     /*package*/ void
     attach(Connection conn, DriverCall dc) {
-        connections.add(conn);
+        mConnections.add(conn);
 
-        state = stateFromDCState (dc.state);
+        mState = stateFromDCState (dc.state);
     }
 
     /*package*/ void
     attachFake(Connection conn, State state) {
-        connections.add(conn);
+        mConnections.add(conn);
 
-        this.state = state;
+        mState = state;
     }
 
     /**
@@ -117,13 +113,13 @@
      */
     void
     connectionDisconnected(CdmaConnection conn) {
-        if (state != State.DISCONNECTED) {
+        if (mState != State.DISCONNECTED) {
             /* If only disconnected connections remain, we are disconnected*/
 
             boolean hasOnlyDisconnectedConnections = true;
 
-            for (int i = 0, s = connections.size()  ; i < s; i ++) {
-                if (connections.get(i).getState()
+            for (int i = 0, s = mConnections.size()  ; i < s; i ++) {
+                if (mConnections.get(i).getState()
                     != State.DISCONNECTED
                 ) {
                     hasOnlyDisconnectedConnections = false;
@@ -132,7 +128,7 @@
             }
 
             if (hasOnlyDisconnectedConnections) {
-                state = State.DISCONNECTED;
+                mState = State.DISCONNECTED;
             }
         }
     }
@@ -140,10 +136,10 @@
 
     /*package*/ void
     detach(CdmaConnection conn) {
-        connections.remove(conn);
+        mConnections.remove(conn);
 
-        if (connections.size() == 0) {
-            state = State.IDLE;
+        if (mConnections.size() == 0) {
+            mState = State.IDLE;
         }
     }
 
@@ -154,8 +150,8 @@
 
         newState = stateFromDCState(dc.state);
 
-        if (newState != state) {
-            state = newState;
+        if (newState != mState) {
+            mState = newState;
             changed = true;
         }
 
@@ -168,7 +164,7 @@
      */
     /*package*/ boolean
     isFull() {
-        return connections.size() == CdmaCallTracker.MAX_CONNECTIONS_PER_CALL;
+        return mConnections.size() == CdmaCallTracker.MAX_CONNECTIONS_PER_CALL;
     }
 
     //***** Called from CdmaCallTracker
@@ -181,28 +177,28 @@
      */
     void
     onHangupLocal() {
-        for (int i = 0, s = connections.size(); i < s; i++) {
-            CdmaConnection cn = (CdmaConnection)connections.get(i);
+        for (int i = 0, s = mConnections.size(); i < s; i++) {
+            CdmaConnection cn = (CdmaConnection)mConnections.get(i);
 
             cn.onHangupLocal();
         }
-        state = State.DISCONNECTING;
+        mState = State.DISCONNECTING;
     }
 
     /**
      * Called when it's time to clean up disconnected Connection objects
      */
    void clearDisconnected() {
-        for (int i = connections.size() - 1 ; i >= 0 ; i--) {
-        CdmaConnection cn = (CdmaConnection)connections.get(i);
+        for (int i = mConnections.size() - 1 ; i >= 0 ; i--) {
+        CdmaConnection cn = (CdmaConnection)mConnections.get(i);
 
             if (cn.getState() == State.DISCONNECTED) {
-                connections.remove(i);
+                mConnections.remove(i);
             }
         }
 
-        if (connections.size() == 0) {
-            state = State.IDLE;
+        if (mConnections.size() == 0) {
+            mState = State.IDLE;
         }
     }
 }
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index 8ec5633..600380e 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -45,7 +45,7 @@
  * {@hide}
  */
 public final class CdmaCallTracker extends CallTracker {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "CdmaCallTracker";
 
     private static final boolean REPEAT_POLLING = false;
 
@@ -58,31 +58,31 @@
 
     //***** Instance Variables
 
-    CdmaConnection connections[] = new CdmaConnection[MAX_CONNECTIONS];
-    RegistrantList voiceCallEndedRegistrants = new RegistrantList();
-    RegistrantList voiceCallStartedRegistrants = new RegistrantList();
-    RegistrantList callWaitingRegistrants =  new RegistrantList();
+    CdmaConnection mConnections[] = new CdmaConnection[MAX_CONNECTIONS];
+    RegistrantList mVoiceCallEndedRegistrants = new RegistrantList();
+    RegistrantList mVoiceCallStartedRegistrants = new RegistrantList();
+    RegistrantList mCallWaitingRegistrants =  new RegistrantList();
 
 
     // connections dropped during last poll
-    ArrayList<CdmaConnection> droppedDuringPoll
+    ArrayList<CdmaConnection> mDroppedDuringPoll
         = new ArrayList<CdmaConnection>(MAX_CONNECTIONS);
 
-    CdmaCall ringingCall = new CdmaCall(this);
+    CdmaCall mRingingCall = new CdmaCall(this);
     // A call that is ringing or (call) waiting
-    CdmaCall foregroundCall = new CdmaCall(this);
-    CdmaCall backgroundCall = new CdmaCall(this);
+    CdmaCall mForegroundCall = new CdmaCall(this);
+    CdmaCall mBackgroundCall = new CdmaCall(this);
 
-    CdmaConnection pendingMO;
-    boolean hangupPendingMO;
-    boolean pendingCallInEcm=false;
+    CdmaConnection mPendingMO;
+    boolean mHangupPendingMO;
+    boolean mPendingCallInEcm=false;
     boolean mIsInEmergencyCall = false;
-    CDMAPhone phone;
+    CDMAPhone mPhone;
 
-    boolean desiredMute = false;    // false = mute off
+    boolean mDesiredMute = false;    // false = mute off
 
-    int pendingCallClirMode;
-    PhoneConstants.State state = PhoneConstants.State.IDLE;
+    int mPendingCallClirMode;
+    PhoneConstants.State mState = PhoneConstants.State.IDLE;
 
     private boolean mIsEcmTimerCanceled = false;
 
@@ -94,21 +94,21 @@
 
     //***** Constructors
     CdmaCallTracker(CDMAPhone phone) {
-        this.phone = phone;
-        cm = phone.mCM;
-        cm.registerForCallStateChanged(this, EVENT_CALL_STATE_CHANGE, null);
-        cm.registerForOn(this, EVENT_RADIO_AVAILABLE, null);
-        cm.registerForNotAvailable(this, EVENT_RADIO_NOT_AVAILABLE, null);
-        cm.registerForCallWaitingInfo(this, EVENT_CALL_WAITING_INFO_CDMA, null);
-        foregroundCall.setGeneric(false);
+        mPhone = phone;
+        mCi = phone.mCi;
+        mCi.registerForCallStateChanged(this, EVENT_CALL_STATE_CHANGE, null);
+        mCi.registerForOn(this, EVENT_RADIO_AVAILABLE, null);
+        mCi.registerForNotAvailable(this, EVENT_RADIO_NOT_AVAILABLE, null);
+        mCi.registerForCallWaitingInfo(this, EVENT_CALL_WAITING_INFO_CDMA, null);
+        mForegroundCall.setGeneric(false);
     }
 
     public void dispose() {
-        cm.unregisterForCallStateChanged(this);
-        cm.unregisterForOn(this);
-        cm.unregisterForNotAvailable(this);
-        cm.unregisterForCallWaitingInfo(this);
-        for(CdmaConnection c : connections) {
+        mCi.unregisterForCallStateChanged(this);
+        mCi.unregisterForOn(this);
+        mCi.unregisterForNotAvailable(this);
+        mCi.unregisterForCallWaitingInfo(this);
+        for(CdmaConnection c : mConnections) {
             try {
                 if(c != null) hangup(c);
             } catch (CallStateException ex) {
@@ -117,7 +117,7 @@
         }
 
         try {
-            if(pendingMO != null) hangup(pendingMO);
+            if(mPendingMO != null) hangup(mPendingMO);
         } catch (CallStateException ex) {
             Rlog.e(LOG_TAG, "unexpected error on hangup during dispose");
         }
@@ -134,49 +134,38 @@
     //***** Instance Methods
 
     //***** Public Methods
+    @Override
     public void registerForVoiceCallStarted(Handler h, int what, Object obj) {
         Registrant r = new Registrant(h, what, obj);
-        voiceCallStartedRegistrants.add(r);
+        mVoiceCallStartedRegistrants.add(r);
         // Notify if in call when registering
-        if (state != PhoneConstants.State.IDLE) {
+        if (mState != PhoneConstants.State.IDLE) {
             r.notifyRegistrant(new AsyncResult(null, null, null));
         }
     }
+    @Override
     public void unregisterForVoiceCallStarted(Handler h) {
-        voiceCallStartedRegistrants.remove(h);
+        mVoiceCallStartedRegistrants.remove(h);
     }
 
+    @Override
     public void registerForVoiceCallEnded(Handler h, int what, Object obj) {
         Registrant r = new Registrant(h, what, obj);
-        voiceCallEndedRegistrants.add(r);
+        mVoiceCallEndedRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForVoiceCallEnded(Handler h) {
-        voiceCallEndedRegistrants.remove(h);
+        mVoiceCallEndedRegistrants.remove(h);
     }
 
     public void registerForCallWaiting(Handler h, int what, Object obj) {
         Registrant r = new Registrant (h, what, obj);
-        callWaitingRegistrants.add(r);
+        mCallWaitingRegistrants.add(r);
     }
 
     public void unregisterForCallWaiting(Handler h) {
-        callWaitingRegistrants.remove(h);
-    }
-
-    private void
-    fakeHoldForegroundBeforeDial() {
-        List<Connection> connCopy;
-
-        // We need to make a copy here, since fakeHoldBeforeDial()
-        // modifies the lists, and we don't want to reverse the order
-        connCopy = (List<Connection>) foregroundCall.connections.clone();
-
-        for (int i = 0, s = connCopy.size() ; i < s ; i++) {
-            CdmaConnection conn = (CdmaConnection)connCopy.get(i);
-
-            conn.fakeHoldBeforeDial();
-        }
+        mCallWaitingRegistrants.remove(h);
     }
 
     /**
@@ -194,33 +183,33 @@
         String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
         boolean isPhoneInEcmMode = inEcm.equals("true");
         boolean isEmergencyCall =
-                PhoneNumberUtils.isLocalEmergencyNumber(dialString, phone.getContext());
+                PhoneNumberUtils.isLocalEmergencyNumber(dialString, mPhone.getContext());
 
         // Cancel Ecm timer if a second emergency call is originating in Ecm mode
         if (isPhoneInEcmMode && isEmergencyCall) {
-            handleEcmTimer(phone.CANCEL_ECM_TIMER);
+            handleEcmTimer(CDMAPhone.CANCEL_ECM_TIMER);
         }
 
         // We are initiating a call therefore even if we previously
         // didn't know the state (i.e. Generic was true) we now know
         // and therefore can set Generic to false.
-        foregroundCall.setGeneric(false);
+        mForegroundCall.setGeneric(false);
 
         // The new call must be assigned to the foreground call.
         // That call must be idle, so place anything that's
         // there on hold
-        if (foregroundCall.getState() == CdmaCall.State.ACTIVE) {
+        if (mForegroundCall.getState() == CdmaCall.State.ACTIVE) {
             return dialThreeWay(dialString);
         }
 
-        pendingMO = new CdmaConnection(phone.getContext(), checkForTestEmergencyNumber(dialString),
-                this, foregroundCall);
-        hangupPendingMO = false;
+        mPendingMO = new CdmaConnection(mPhone.getContext(), checkForTestEmergencyNumber(dialString),
+                this, mForegroundCall);
+        mHangupPendingMO = false;
 
-        if (pendingMO.address == null || pendingMO.address.length() == 0
-            || pendingMO.address.indexOf(PhoneNumberUtils.WILD) >= 0) {
+        if (mPendingMO.mAddress == null || mPendingMO.mAddress.length() == 0
+            || mPendingMO.mAddress.indexOf(PhoneNumberUtils.WILD) >= 0) {
             // Phone number is invalid
-            pendingMO.cause = Connection.DisconnectCause.INVALID_NUMBER;
+            mPendingMO.mCause = Connection.DisconnectCause.INVALID_NUMBER;
 
             // handlePollCalls() will notice this call not present
             // and will mark it as dropped.
@@ -234,19 +223,19 @@
 
             // In Ecm mode, if another emergency call is dialed, Ecm mode will not exit.
             if(!isPhoneInEcmMode || (isPhoneInEcmMode && isEmergencyCall)) {
-                cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
+                mCi.dial(mPendingMO.mAddress, clirMode, obtainCompleteMessage());
             } else {
-                phone.exitEmergencyCallbackMode();
-                phone.setOnEcbModeExitResponse(this,EVENT_EXIT_ECM_RESPONSE_CDMA, null);
-                pendingCallClirMode=clirMode;
-                pendingCallInEcm=true;
+                mPhone.exitEmergencyCallbackMode();
+                mPhone.setOnEcbModeExitResponse(this,EVENT_EXIT_ECM_RESPONSE_CDMA, null);
+                mPendingCallClirMode=clirMode;
+                mPendingCallInEcm=true;
             }
         }
 
         updatePhoneState();
-        phone.notifyPreciseCallStateChanged();
+        mPhone.notifyPreciseCallStateChanged();
 
-        return pendingMO;
+        return mPendingMO;
     }
 
 
@@ -257,35 +246,35 @@
 
     private Connection
     dialThreeWay (String dialString) {
-        if (!foregroundCall.isIdle()) {
+        if (!mForegroundCall.isIdle()) {
             // Check data call
             disableDataCallInEmergencyCall(dialString);
 
             // Attach the new connection to foregroundCall
-            pendingMO = new CdmaConnection(phone.getContext(),
-                                checkForTestEmergencyNumber(dialString), this, foregroundCall);
-            cm.sendCDMAFeatureCode(pendingMO.address,
+            mPendingMO = new CdmaConnection(mPhone.getContext(),
+                                checkForTestEmergencyNumber(dialString), this, mForegroundCall);
+            mCi.sendCDMAFeatureCode(mPendingMO.mAddress,
                 obtainMessage(EVENT_THREE_WAY_DIAL_L2_RESULT_CDMA));
-            return pendingMO;
+            return mPendingMO;
         }
         return null;
     }
 
     void
     acceptCall() throws CallStateException {
-        if (ringingCall.getState() == CdmaCall.State.INCOMING) {
+        if (mRingingCall.getState() == CdmaCall.State.INCOMING) {
             Rlog.i("phone", "acceptCall: incoming...");
             // Always unmute when answering a new call
             setMute(false);
-            cm.acceptCall(obtainCompleteMessage());
-        } else if (ringingCall.getState() == CdmaCall.State.WAITING) {
-            CdmaConnection cwConn = (CdmaConnection)(ringingCall.getLatestConnection());
+            mCi.acceptCall(obtainCompleteMessage());
+        } else if (mRingingCall.getState() == CdmaCall.State.WAITING) {
+            CdmaConnection cwConn = (CdmaConnection)(mRingingCall.getLatestConnection());
 
             // Since there is no network response for supplimentary
             // service for CDMA, we assume call waiting is answered.
             // ringing Call state change to idle is in CdmaCall.detach
             // triggered by updateParent.
-            cwConn.updateParent(ringingCall, foregroundCall);
+            cwConn.updateParent(mRingingCall, mForegroundCall);
             cwConn.onConnectedInOrOut();
             updatePhoneState();
             switchWaitingOrHoldingAndActive();
@@ -298,8 +287,8 @@
     rejectCall () throws CallStateException {
         // AT+CHLD=0 means "release held or UDUB"
         // so if the phone isn't ringing, this could hang up held
-        if (ringingCall.getState().isRinging()) {
-            cm.rejectCall(obtainCompleteMessage());
+        if (mRingingCall.getState().isRinging()) {
+            mCi.rejectCall(obtainCompleteMessage());
         } else {
             throw new CallStateException("phone not ringing");
         }
@@ -308,28 +297,28 @@
     void
     switchWaitingOrHoldingAndActive() throws CallStateException {
         // Should we bother with this check?
-        if (ringingCall.getState() == CdmaCall.State.INCOMING) {
+        if (mRingingCall.getState() == CdmaCall.State.INCOMING) {
             throw new CallStateException("cannot be in the incoming state");
-        } else if (foregroundCall.getConnections().size() > 1) {
+        } else if (mForegroundCall.getConnections().size() > 1) {
             flashAndSetGenericTrue();
         } else {
             // Send a flash command to CDMA network for putting the other party on hold.
             // For CDMA networks which do not support this the user would just hear a beep
             // from the network. For CDMA networks which do support it will put the other
             // party on hold.
-            cm.sendCDMAFeatureCode("", obtainMessage(EVENT_SWITCH_RESULT));
+            mCi.sendCDMAFeatureCode("", obtainMessage(EVENT_SWITCH_RESULT));
         }
     }
 
     void
-    conference() throws CallStateException {
+    conference() {
         // Should we be checking state?
         flashAndSetGenericTrue();
     }
 
     void
-    explicitCallTransfer() throws CallStateException {
-        cm.explicitCallTransfer(obtainCompleteMessage(EVENT_ECT_RESULT));
+    explicitCallTransfer() {
+        mCi.explicitCallTransfer(obtainCompleteMessage(EVENT_ECT_RESULT));
     }
 
     void
@@ -337,31 +326,31 @@
         internalClearDisconnected();
 
         updatePhoneState();
-        phone.notifyPreciseCallStateChanged();
+        mPhone.notifyPreciseCallStateChanged();
     }
 
     boolean
     canConference() {
-        return foregroundCall.getState() == CdmaCall.State.ACTIVE
-                && backgroundCall.getState() == CdmaCall.State.HOLDING
-                && !backgroundCall.isFull()
-                && !foregroundCall.isFull();
+        return mForegroundCall.getState() == CdmaCall.State.ACTIVE
+                && mBackgroundCall.getState() == CdmaCall.State.HOLDING
+                && !mBackgroundCall.isFull()
+                && !mForegroundCall.isFull();
     }
 
     boolean
     canDial() {
         boolean ret;
-        int serviceState = phone.getServiceState().getState();
+        int serviceState = mPhone.getServiceState().getState();
         String disableCall = SystemProperties.get(
                 TelephonyProperties.PROPERTY_DISABLE_CALL, "false");
 
         ret = (serviceState != ServiceState.STATE_POWER_OFF)
-                && pendingMO == null
-                && !ringingCall.isRinging()
+                && mPendingMO == null
+                && !mRingingCall.isRinging()
                 && !disableCall.equals("true")
-                && (!foregroundCall.getState().isAlive()
-                    || (foregroundCall.getState() == CdmaCall.State.ACTIVE)
-                    || !backgroundCall.getState().isAlive());
+                && (!mForegroundCall.getState().isAlive()
+                    || (mForegroundCall.getState() == CdmaCall.State.ACTIVE)
+                    || !mBackgroundCall.getState().isAlive());
 
         if (!ret) {
             log(String.format("canDial is false\n" +
@@ -374,12 +363,12 @@
                               "   ||!backgroundCall.getState().isAlive())::=%s)",
                     serviceState,
                     serviceState != ServiceState.STATE_POWER_OFF,
-                    pendingMO == null,
-                    !ringingCall.isRinging(),
+                    mPendingMO == null,
+                    !mRingingCall.isRinging(),
                     !disableCall.equals("true"),
-                    !foregroundCall.getState().isAlive(),
-                    foregroundCall.getState() == CdmaCall.State.ACTIVE,
-                    !backgroundCall.getState().isAlive()));
+                    !mForegroundCall.getState().isAlive(),
+                    mForegroundCall.getState() == CdmaCall.State.ACTIVE,
+                    !mBackgroundCall.getState().isAlive()));
         }
         return ret;
     }
@@ -394,9 +383,9 @@
 
     private void
     internalClearDisconnected() {
-        ringingCall.clearDisconnected();
-        foregroundCall.clearDisconnected();
-        backgroundCall.clearDisconnected();
+        mRingingCall.clearDisconnected();
+        mForegroundCall.clearDisconnected();
+        mBackgroundCall.clearDisconnected();
     }
 
     /**
@@ -414,30 +403,30 @@
      */
     private Message
     obtainCompleteMessage(int what) {
-        pendingOperations++;
-        lastRelevantPoll = null;
-        needsPoll = true;
+        mPendingOperations++;
+        mLastRelevantPoll = null;
+        mNeedsPoll = true;
 
         if (DBG_POLL) log("obtainCompleteMessage: pendingOperations=" +
-                pendingOperations + ", needsPoll=" + needsPoll);
+                mPendingOperations + ", needsPoll=" + mNeedsPoll);
 
         return obtainMessage(what);
     }
 
     private void
     operationComplete() {
-        pendingOperations--;
+        mPendingOperations--;
 
         if (DBG_POLL) log("operationComplete: pendingOperations=" +
-                pendingOperations + ", needsPoll=" + needsPoll);
+                mPendingOperations + ", needsPoll=" + mNeedsPoll);
 
-        if (pendingOperations == 0 && needsPoll) {
-            lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
-            cm.getCurrentCalls(lastRelevantPoll);
-        } else if (pendingOperations < 0) {
+        if (mPendingOperations == 0 && mNeedsPoll) {
+            mLastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
+            mCi.getCurrentCalls(mLastRelevantPoll);
+        } else if (mPendingOperations < 0) {
             // this should never happen
             Rlog.e(LOG_TAG,"CdmaCallTracker.pendingOperations < 0");
-            pendingOperations = 0;
+            mPendingOperations = 0;
         }
     }
 
@@ -445,34 +434,35 @@
 
     private void
     updatePhoneState() {
-        PhoneConstants.State oldState = state;
+        PhoneConstants.State oldState = mState;
 
-        if (ringingCall.isRinging()) {
-            state = PhoneConstants.State.RINGING;
-        } else if (pendingMO != null ||
-                !(foregroundCall.isIdle() && backgroundCall.isIdle())) {
-            state = PhoneConstants.State.OFFHOOK;
+        if (mRingingCall.isRinging()) {
+            mState = PhoneConstants.State.RINGING;
+        } else if (mPendingMO != null ||
+                !(mForegroundCall.isIdle() && mBackgroundCall.isIdle())) {
+            mState = PhoneConstants.State.OFFHOOK;
         } else {
-            state = PhoneConstants.State.IDLE;
+            mState = PhoneConstants.State.IDLE;
         }
 
-        if (state == PhoneConstants.State.IDLE && oldState != state) {
-            voiceCallEndedRegistrants.notifyRegistrants(
+        if (mState == PhoneConstants.State.IDLE && oldState != mState) {
+            mVoiceCallEndedRegistrants.notifyRegistrants(
                 new AsyncResult(null, null, null));
-        } else if (oldState == PhoneConstants.State.IDLE && oldState != state) {
-            voiceCallStartedRegistrants.notifyRegistrants (
+        } else if (oldState == PhoneConstants.State.IDLE && oldState != mState) {
+            mVoiceCallStartedRegistrants.notifyRegistrants (
                     new AsyncResult(null, null, null));
         }
         if (Phone.DEBUG_PHONE) {
-            log("update phone state, old=" + oldState + " new="+ state);
+            log("update phone state, old=" + oldState + " new="+ mState);
         }
-        if (state != oldState) {
-            phone.notifyPhoneStateChanged();
+        if (mState != oldState) {
+            mPhone.notifyPhoneStateChanged();
         }
     }
 
     // ***** Overwritten from CallTracker
 
+    @Override
     protected void
     handlePollCalls(AsyncResult ar) {
         List polledCalls;
@@ -497,8 +487,8 @@
         boolean unknownConnectionAppeared = false;
 
         for (int i = 0, curDC = 0, dcSize = polledCalls.size()
-                ; i < connections.length; i++) {
-            CdmaConnection conn = connections[i];
+                ; i < mConnections.length; i++) {
+            CdmaConnection conn = mConnections[i];
             DriverCall dc = null;
 
             // polledCall list is sparse
@@ -517,28 +507,28 @@
 
             if (conn == null && dc != null) {
                 // Connection appeared in CLCC response that we don't know about
-                if (pendingMO != null && pendingMO.compareTo(dc)) {
+                if (mPendingMO != null && mPendingMO.compareTo(dc)) {
 
-                    if (DBG_POLL) log("poll: pendingMO=" + pendingMO);
+                    if (DBG_POLL) log("poll: pendingMO=" + mPendingMO);
 
                     // It's our pending mobile originating call
-                    connections[i] = pendingMO;
-                    pendingMO.index = i;
-                    pendingMO.update(dc);
-                    pendingMO = null;
+                    mConnections[i] = mPendingMO;
+                    mPendingMO.mIndex = i;
+                    mPendingMO.update(dc);
+                    mPendingMO = null;
 
                     // Someone has already asked to hangup this call
-                    if (hangupPendingMO) {
-                        hangupPendingMO = false;
+                    if (mHangupPendingMO) {
+                        mHangupPendingMO = false;
                         // Re-start Ecm timer when an uncompleted emergency call ends
                         if (mIsEcmTimerCanceled) {
-                            handleEcmTimer(phone.RESTART_ECM_TIMER);
+                            handleEcmTimer(CDMAPhone.RESTART_ECM_TIMER);
                         }
 
                         try {
                             if (Phone.DEBUG_PHONE) log(
                                     "poll: hangupPendingMO, hangup conn " + i);
-                            hangup(connections[i]);
+                            hangup(mConnections[i]);
                         } catch (CallStateException ex) {
                             Rlog.e(LOG_TAG, "unexpected error on hangup");
                         }
@@ -549,7 +539,7 @@
                     }
                 } else {
                     if (Phone.DEBUG_PHONE) {
-                        log("pendingMo=" + pendingMO + ", dc=" + dc);
+                        log("pendingMo=" + mPendingMO + ", dc=" + dc);
                     }
                     // find if the MT call is a new ring or unknown connection
                     newRinging = checkMtFindNewRinging(dc,i);
@@ -564,39 +554,39 @@
                 // we need to clean up the foregroundCall and ringingCall.
                 // Loop through foreground call connections as
                 // it contains the known logical connections.
-                int count = foregroundCall.connections.size();
+                int count = mForegroundCall.mConnections.size();
                 for (int n = 0; n < count; n++) {
                     if (Phone.DEBUG_PHONE) log("adding fgCall cn " + n + " to droppedDuringPoll");
-                    CdmaConnection cn = (CdmaConnection)foregroundCall.connections.get(n);
-                    droppedDuringPoll.add(cn);
+                    CdmaConnection cn = (CdmaConnection)mForegroundCall.mConnections.get(n);
+                    mDroppedDuringPoll.add(cn);
                 }
-                count = ringingCall.connections.size();
+                count = mRingingCall.mConnections.size();
                 // Loop through ringing call connections as
                 // it may contain the known logical connections.
                 for (int n = 0; n < count; n++) {
                     if (Phone.DEBUG_PHONE) log("adding rgCall cn " + n + " to droppedDuringPoll");
-                    CdmaConnection cn = (CdmaConnection)ringingCall.connections.get(n);
-                    droppedDuringPoll.add(cn);
+                    CdmaConnection cn = (CdmaConnection)mRingingCall.mConnections.get(n);
+                    mDroppedDuringPoll.add(cn);
                 }
-                foregroundCall.setGeneric(false);
-                ringingCall.setGeneric(false);
+                mForegroundCall.setGeneric(false);
+                mRingingCall.setGeneric(false);
 
                 // Re-start Ecm timer when the connected emergency call ends
                 if (mIsEcmTimerCanceled) {
-                    handleEcmTimer(phone.RESTART_ECM_TIMER);
+                    handleEcmTimer(CDMAPhone.RESTART_ECM_TIMER);
                 }
                 // If emergency call is not going through while dialing
                 checkAndEnableDataCallAfterEmergencyCallDropped();
 
                 // Dropped connections are removed from the CallTracker
                 // list but kept in the Call list
-                connections[i] = null;
+                mConnections[i] = null;
             } else if (conn != null && dc != null) { /* implicit conn.compareTo(dc) */
                 // Call collision case
-                if (conn.isIncoming != dc.isMT) {
+                if (conn.mIsIncoming != dc.isMT) {
                     if (dc.isMT == true){
                         // Mt call takes precedence than Mo,drops Mo
-                        droppedDuringPoll.add(conn);
+                        mDroppedDuringPoll.add(conn);
                         // find if the MT call is a new ring or unknown connection
                         newRinging = checkMtFindNewRinging(dc,i);
                         if (newRinging == null) {
@@ -640,56 +630,56 @@
         // This is the first poll after an ATD.
         // We expect the pending call to appear in the list
         // If it does not, we land here
-        if (pendingMO != null) {
+        if (mPendingMO != null) {
             Rlog.d(LOG_TAG,"Pending MO dropped before poll fg state:"
-                            + foregroundCall.getState());
+                            + mForegroundCall.getState());
 
-            droppedDuringPoll.add(pendingMO);
-            pendingMO = null;
-            hangupPendingMO = false;
-            if( pendingCallInEcm) {
-                pendingCallInEcm = false;
+            mDroppedDuringPoll.add(mPendingMO);
+            mPendingMO = null;
+            mHangupPendingMO = false;
+            if( mPendingCallInEcm) {
+                mPendingCallInEcm = false;
             }
         }
 
         if (newRinging != null) {
-            phone.notifyNewRingingConnection(newRinging);
+            mPhone.notifyNewRingingConnection(newRinging);
         }
 
         // clear the "local hangup" and "missed/rejected call"
         // cases from the "dropped during poll" list
         // These cases need no "last call fail" reason
-        for (int i = droppedDuringPoll.size() - 1; i >= 0 ; i--) {
-            CdmaConnection conn = droppedDuringPoll.get(i);
+        for (int i = mDroppedDuringPoll.size() - 1; i >= 0 ; i--) {
+            CdmaConnection conn = mDroppedDuringPoll.get(i);
 
             if (conn.isIncoming() && conn.getConnectTime() == 0) {
                 // Missed or rejected call
                 Connection.DisconnectCause cause;
-                if (conn.cause == Connection.DisconnectCause.LOCAL) {
+                if (conn.mCause == Connection.DisconnectCause.LOCAL) {
                     cause = Connection.DisconnectCause.INCOMING_REJECTED;
                 } else {
                     cause = Connection.DisconnectCause.INCOMING_MISSED;
                 }
 
                 if (Phone.DEBUG_PHONE) {
-                    log("missed/rejected call, conn.cause=" + conn.cause);
+                    log("missed/rejected call, conn.cause=" + conn.mCause);
                     log("setting cause to " + cause);
                 }
-                droppedDuringPoll.remove(i);
+                mDroppedDuringPoll.remove(i);
                 conn.onDisconnect(cause);
-            } else if (conn.cause == Connection.DisconnectCause.LOCAL) {
+            } else if (conn.mCause == Connection.DisconnectCause.LOCAL) {
                 // Local hangup
-                droppedDuringPoll.remove(i);
+                mDroppedDuringPoll.remove(i);
                 conn.onDisconnect(Connection.DisconnectCause.LOCAL);
-            } else if (conn.cause == Connection.DisconnectCause.INVALID_NUMBER) {
-                droppedDuringPoll.remove(i);
+            } else if (conn.mCause == Connection.DisconnectCause.INVALID_NUMBER) {
+                mDroppedDuringPoll.remove(i);
                 conn.onDisconnect(Connection.DisconnectCause.INVALID_NUMBER);
             }
         }
 
         // Any non-local disconnects: determine cause
-        if (droppedDuringPoll.size() > 0) {
-            cm.getLastCallFailCause(
+        if (mDroppedDuringPoll.size() > 0) {
+            mCi.getLastCallFailCause(
                 obtainNoPollCompleteMessage(EVENT_GET_LAST_CALL_FAIL_CAUSE));
         }
 
@@ -709,11 +699,11 @@
         updatePhoneState();
 
         if (unknownConnectionAppeared) {
-            phone.notifyUnknownConnection();
+            mPhone.notifyUnknownConnection();
         }
 
         if (hasNonHangupStateChanged || newRinging != null) {
-            phone.notifyPreciseCallStateChanged();
+            mPhone.notifyPreciseCallStateChanged();
         }
 
         //dumpState();
@@ -722,19 +712,19 @@
     //***** Called from CdmaConnection
     /*package*/ void
     hangup (CdmaConnection conn) throws CallStateException {
-        if (conn.owner != this) {
+        if (conn.mOwner != this) {
             throw new CallStateException ("CdmaConnection " + conn
                                     + "does not belong to CdmaCallTracker " + this);
         }
 
-        if (conn == pendingMO) {
+        if (conn == mPendingMO) {
             // We're hanging up an outgoing call that doesn't have it's
             // GSM index assigned yet
 
             if (Phone.DEBUG_PHONE) log("hangup: set hangupPendingMO to true");
-            hangupPendingMO = true;
-        } else if ((conn.getCall() == ringingCall)
-                && (ringingCall.getState() == CdmaCall.State.WAITING)) {
+            mHangupPendingMO = true;
+        } else if ((conn.getCall() == mRingingCall)
+                && (mRingingCall.getState() == CdmaCall.State.WAITING)) {
             // Handle call waiting hang up case.
             //
             // The ringingCall state will change to IDLE in CdmaCall.detach
@@ -748,11 +738,11 @@
             // is not called here. Instead, conn.onLocalDisconnect() is called.
             conn.onLocalDisconnect();
             updatePhoneState();
-            phone.notifyPreciseCallStateChanged();
+            mPhone.notifyPreciseCallStateChanged();
             return;
         } else {
             try {
-                cm.hangupConnection (conn.getCDMAIndex(), obtainCompleteMessage());
+                mCi.hangupConnection (conn.getCDMAIndex(), obtainCompleteMessage());
             } catch (CallStateException ex) {
                 // Ignore "connection not found"
                 // Call may have hung up already
@@ -766,12 +756,12 @@
 
     /*package*/ void
     separate (CdmaConnection conn) throws CallStateException {
-        if (conn.owner != this) {
+        if (conn.mOwner != this) {
             throw new CallStateException ("CdmaConnection " + conn
                                     + "does not belong to CdmaCallTracker " + this);
         }
         try {
-            cm.separateConnection (conn.getCDMAIndex(),
+            mCi.separateConnection (conn.getCDMAIndex(),
                 obtainCompleteMessage(EVENT_SEPARATE_RESULT));
         } catch (CallStateException ex) {
             // Ignore "connection not found"
@@ -785,13 +775,13 @@
 
     /*package*/ void
     setMute(boolean mute) {
-        desiredMute = mute;
-        cm.setMute(desiredMute, null);
+        mDesiredMute = mute;
+        mCi.setMute(mDesiredMute, null);
     }
 
     /*package*/ boolean
     getMute() {
-        return desiredMute;
+        return mDesiredMute;
     }
 
 
@@ -803,10 +793,10 @@
             throw new CallStateException("no connections in call");
         }
 
-        if (call == ringingCall) {
+        if (call == mRingingCall) {
             if (Phone.DEBUG_PHONE) log("(ringing) hangup waiting or background");
-            cm.hangupWaitingOrBackground(obtainCompleteMessage());
-        } else if (call == foregroundCall) {
+            mCi.hangupWaitingOrBackground(obtainCompleteMessage());
+        } else if (call == mForegroundCall) {
             if (call.isDialingOrAlerting()) {
                 if (Phone.DEBUG_PHONE) {
                     log("(foregnd) hangup dialing or alerting...");
@@ -815,8 +805,8 @@
             } else {
                 hangupForegroundResumeBackground();
             }
-        } else if (call == backgroundCall) {
-            if (ringingCall.isRinging()) {
+        } else if (call == mBackgroundCall) {
+            if (mRingingCall.isRinging()) {
                 if (Phone.DEBUG_PHONE) {
                     log("hangup all conns in background call");
                 }
@@ -830,28 +820,28 @@
         }
 
         call.onHangupLocal();
-        phone.notifyPreciseCallStateChanged();
+        mPhone.notifyPreciseCallStateChanged();
     }
 
     /* package */
     void hangupWaitingOrBackground() {
         if (Phone.DEBUG_PHONE) log("hangupWaitingOrBackground");
-        cm.hangupWaitingOrBackground(obtainCompleteMessage());
+        mCi.hangupWaitingOrBackground(obtainCompleteMessage());
     }
 
     /* package */
     void hangupForegroundResumeBackground() {
         if (Phone.DEBUG_PHONE) log("hangupForegroundResumeBackground");
-        cm.hangupForegroundResumeBackground(obtainCompleteMessage());
+        mCi.hangupForegroundResumeBackground(obtainCompleteMessage());
     }
 
     void hangupConnectionByIndex(CdmaCall call, int index)
             throws CallStateException {
-        int count = call.connections.size();
+        int count = call.mConnections.size();
         for (int i = 0; i < count; i++) {
-            CdmaConnection cn = (CdmaConnection)call.connections.get(i);
+            CdmaConnection cn = (CdmaConnection)call.mConnections.get(i);
             if (cn.getCDMAIndex() == index) {
-                cm.hangupConnection(index, obtainCompleteMessage());
+                mCi.hangupConnection(index, obtainCompleteMessage());
                 return;
             }
         }
@@ -859,12 +849,12 @@
         throw new CallStateException("no gsm index found");
     }
 
-    void hangupAllConnections(CdmaCall call) throws CallStateException{
+    void hangupAllConnections(CdmaCall call) {
         try {
-            int count = call.connections.size();
+            int count = call.mConnections.size();
             for (int i = 0; i < count; i++) {
-                CdmaConnection cn = (CdmaConnection)call.connections.get(i);
-                cm.hangupConnection(cn.getCDMAIndex(), obtainCompleteMessage());
+                CdmaConnection cn = (CdmaConnection)call.mConnections.get(i);
+                mCi.hangupConnection(cn.getCDMAIndex(), obtainCompleteMessage());
             }
         } catch (CallStateException ex) {
             Rlog.e(LOG_TAG, "hangupConnectionByIndex caught " + ex);
@@ -874,9 +864,9 @@
     /* package */
     CdmaConnection getConnectionByIndex(CdmaCall call, int index)
             throws CallStateException {
-        int count = call.connections.size();
+        int count = call.mConnections.size();
         for (int i = 0; i < count; i++) {
-            CdmaConnection cn = (CdmaConnection)call.connections.get(i);
+            CdmaConnection cn = (CdmaConnection)call.mConnections.get(i);
             if (cn.getCDMAIndex() == index) {
                 return cn;
             }
@@ -885,28 +875,14 @@
         return null;
     }
 
-    private void flashAndSetGenericTrue() throws CallStateException {
-        cm.sendCDMAFeatureCode("", obtainMessage(EVENT_SWITCH_RESULT));
+    private void flashAndSetGenericTrue() {
+        mCi.sendCDMAFeatureCode("", obtainMessage(EVENT_SWITCH_RESULT));
 
         // Set generic to true because in CDMA it is not known what
         // the status of the call is after a call waiting is answered,
         // 3 way call merged or a switch between calls.
-        foregroundCall.setGeneric(true);
-        phone.notifyPreciseCallStateChanged();
-    }
-
-    private Phone.SuppService getFailedService(int what) {
-        switch (what) {
-            case EVENT_SWITCH_RESULT:
-                return Phone.SuppService.SWITCH;
-            case EVENT_CONFERENCE_RESULT:
-                return Phone.SuppService.CONFERENCE;
-            case EVENT_SEPARATE_RESULT:
-                return Phone.SuppService.SEPARATE;
-            case EVENT_ECT_RESULT:
-                return Phone.SuppService.TRANSFER;
-        }
-        return Phone.SuppService.UNKNOWN;
+        mForegroundCall.setGeneric(true);
+        mPhone.notifyPreciseCallStateChanged();
     }
 
     private void handleRadioNotAvailable() {
@@ -917,8 +893,8 @@
     }
 
     private void notifyCallWaitingInfo(CdmaCallWaitingNotification obj) {
-        if (callWaitingRegistrants != null) {
-            callWaitingRegistrants.notifyRegistrants(new AsyncResult(null, obj, null));
+        if (mCallWaitingRegistrants != null) {
+            mCallWaitingRegistrants.notifyRegistrants(new AsyncResult(null, obj, null));
         }
     }
 
@@ -929,13 +905,13 @@
         // not reliable anymore since it means either
         // call waiting is connected or 3 way call is
         // dialed before, so set generic.
-        if (foregroundCall.connections.size() > 1 ) {
-            foregroundCall.setGeneric(true);
+        if (mForegroundCall.mConnections.size() > 1 ) {
+            mForegroundCall.setGeneric(true);
         }
 
         // Create a new CdmaConnection which attaches itself to ringingCall.
-        ringingCall.setGeneric(false);
-        new CdmaConnection(phone.getContext(), cw, this, ringingCall);
+        mRingingCall.setGeneric(false);
+        new CdmaConnection(mPhone.getContext(), cw, this, mRingingCall);
         updatePhoneState();
 
         // Finally notify application
@@ -943,6 +919,7 @@
     }
     //****** Overridden from Handler
 
+    @Override
     public void
     handleMessage (Message msg) {
         AsyncResult ar;
@@ -952,11 +929,11 @@
                 Rlog.d(LOG_TAG, "Event EVENT_POLL_CALLS_RESULT Received");
                 ar = (AsyncResult)msg.obj;
 
-                if(msg == lastRelevantPoll) {
+                if(msg == mLastRelevantPoll) {
                     if(DBG_POLL) log(
                             "handle EVENT_POLL_CALL_RESULT: set needsPoll=F");
-                    needsPoll = false;
-                    lastRelevantPoll = null;
+                    mNeedsPoll = false;
+                    mLastRelevantPoll = null;
                     handlePollCalls((AsyncResult)msg.obj);
                 }
             }
@@ -988,18 +965,18 @@
                     causeCode = ((int[])ar.result)[0];
                 }
 
-                for (int i = 0, s =  droppedDuringPoll.size()
+                for (int i = 0, s =  mDroppedDuringPoll.size()
                         ; i < s ; i++
                 ) {
-                    CdmaConnection conn = droppedDuringPoll.get(i);
+                    CdmaConnection conn = mDroppedDuringPoll.get(i);
 
                     conn.onRemoteDisconnect(causeCode);
                 }
 
                 updatePhoneState();
 
-                phone.notifyPreciseCallStateChanged();
-                droppedDuringPoll.clear();
+                mPhone.notifyPreciseCallStateChanged();
+                mDroppedDuringPoll.clear();
             break;
 
             case EVENT_REPOLL_AFTER_DELAY:
@@ -1017,11 +994,11 @@
 
             case EVENT_EXIT_ECM_RESPONSE_CDMA:
                //no matter the result, we still do the same here
-               if (pendingCallInEcm) {
-                   cm.dial(pendingMO.address, pendingCallClirMode, obtainCompleteMessage());
-                   pendingCallInEcm = false;
+               if (mPendingCallInEcm) {
+                   mCi.dial(mPendingMO.mAddress, mPendingCallClirMode, obtainCompleteMessage());
+                   mPendingCallInEcm = false;
                }
-               phone.unsetOnEcbModeExitResponse(this);
+               mPhone.unsetOnEcbModeExitResponse(this);
             break;
 
             case EVENT_CALL_WAITING_INFO_CDMA:
@@ -1036,8 +1013,8 @@
                 ar = (AsyncResult)msg.obj;
                 if (ar.exception == null) {
                     // Assume 3 way call is connected
-                    pendingMO.onConnectedInOrOut();
-                    pendingMO = null;
+                    mPendingMO.onConnectedInOrOut();
+                    mPendingMO = null;
                 }
             break;
 
@@ -1051,7 +1028,7 @@
      * Handle Ecm timer to be canceled or re-started
      */
     private void handleEcmTimer(int action) {
-        phone.handleTimerInEmergencyCallbackMode(action);
+        mPhone.handleTimerInEmergencyCallbackMode(action);
         switch(action) {
         case CDMAPhone.CANCEL_ECM_TIMER: mIsEcmTimerCanceled = true; break;
         case CDMAPhone.RESTART_ECM_TIMER: mIsEcmTimerCanceled = false; break;
@@ -1064,10 +1041,10 @@
      * Disable data call when emergency call is connected
      */
     private void disableDataCallInEmergencyCall(String dialString) {
-        if (PhoneNumberUtils.isLocalEmergencyNumber(dialString, phone.getContext())) {
+        if (PhoneNumberUtils.isLocalEmergencyNumber(dialString, mPhone.getContext())) {
             if (Phone.DEBUG_PHONE) log("disableDataCallInEmergencyCall");
             mIsInEmergencyCall = true;
-            phone.mDataConnectionTracker.setInternalDataEnabled(false);
+            mPhone.mDataConnectionTracker.setInternalDataEnabled(false);
         }
     }
 
@@ -1084,7 +1061,7 @@
             }
             if (inEcm.compareTo("false") == 0) {
                 // Re-initiate data connection
-                phone.mDataConnectionTracker.setInternalDataEnabled(true);
+                mPhone.mDataConnectionTracker.setInternalDataEnabled(true);
             }
         }
     }
@@ -1097,10 +1074,10 @@
 
         Connection newRinging = null;
 
-        connections[i] = new CdmaConnection(phone.getContext(), dc, this, i);
+        mConnections[i] = new CdmaConnection(mPhone.getContext(), dc, this, i);
         // it's a ringing call
-        if (connections[i].getCall() == ringingCall) {
-            newRinging = connections[i];
+        if (mConnections[i].getCall() == mRingingCall) {
+            newRinging = mConnections[i];
             if (Phone.DEBUG_PHONE) log("Notify new ring " + dc);
         } else {
             // Something strange happened: a call which is neither
@@ -1112,10 +1089,10 @@
             // it won't appear as a Missed Call.
             if (dc.state != DriverCall.State.ALERTING
                 && dc.state != DriverCall.State.DIALING) {
-                connections[i].onConnectedInOrOut();
+                mConnections[i].onConnectedInOrOut();
                 if (dc.state == DriverCall.State.HOLDING) {
                     // We've transitioned into HOLDING
-                    connections[i].onStartedHolding();
+                    mConnections[i].onStartedHolding();
                 }
             }
         }
@@ -1132,6 +1109,7 @@
         return mIsInEmergencyCall;
     }
 
+    @Override
     protected void log(String msg) {
         Rlog.d(LOG_TAG, "[CdmaCallTracker] " + msg);
     }
@@ -1140,28 +1118,28 @@
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("GsmCallTracker extends:");
         super.dump(fd, pw, args);
-        pw.println("droppedDuringPoll: length=" + connections.length);
-        for(int i=0; i < connections.length; i++) {
-            pw.printf(" connections[%d]=%s\n", i, connections[i]);
+        pw.println("droppedDuringPoll: length=" + mConnections.length);
+        for(int i=0; i < mConnections.length; i++) {
+            pw.printf(" mConnections[%d]=%s\n", i, mConnections[i]);
         }
-        pw.println(" voiceCallEndedRegistrants=" + voiceCallEndedRegistrants);
-        pw.println(" voiceCallStartedRegistrants=" + voiceCallStartedRegistrants);
-        pw.println(" callWaitingRegistrants=" + callWaitingRegistrants);
-        pw.println("droppedDuringPoll: size=" + droppedDuringPoll.size());
-        for(int i = 0; i < droppedDuringPoll.size(); i++) {
-            pw.printf( " droppedDuringPoll[%d]=%s\n", i, droppedDuringPoll.get(i));
+        pw.println(" mVoiceCallEndedRegistrants=" + mVoiceCallEndedRegistrants);
+        pw.println(" mVoiceCallStartedRegistrants=" + mVoiceCallStartedRegistrants);
+        pw.println(" mCallWaitingRegistrants=" + mCallWaitingRegistrants);
+        pw.println("droppedDuringPoll: size=" + mDroppedDuringPoll.size());
+        for(int i = 0; i < mDroppedDuringPoll.size(); i++) {
+            pw.printf( " mDroppedDuringPoll[%d]=%s\n", i, mDroppedDuringPoll.get(i));
         }
-        pw.println(" ringingCall=" + ringingCall);
-        pw.println(" foregroundCall=" + foregroundCall);
-        pw.println(" backgroundCall=" + backgroundCall);
-        pw.println(" pendingMO=" + pendingMO);
-        pw.println(" hangupPendingMO=" + hangupPendingMO);
-        pw.println(" pendingCallInEcm=" + pendingCallInEcm);
+        pw.println(" mRingingCall=" + mRingingCall);
+        pw.println(" mForegroundCall=" + mForegroundCall);
+        pw.println(" mBackgroundCall=" + mBackgroundCall);
+        pw.println(" mPendingMO=" + mPendingMO);
+        pw.println(" mHangupPendingMO=" + mHangupPendingMO);
+        pw.println(" mPendingCallInEcm=" + mPendingCallInEcm);
         pw.println(" mIsInEmergencyCall=" + mIsInEmergencyCall);
-        pw.println(" phone=" + phone);
-        pw.println(" desiredMute=" + desiredMute);
-        pw.println(" pendingCallClirMode=" + pendingCallClirMode);
-        pw.println(" state=" + state);
+        pw.println(" mPhone=" + mPhone);
+        pw.println(" mDesiredMute=" + mDesiredMute);
+        pw.println(" mPendingCallClirMode=" + mPendingCallClirMode);
+        pw.println(" mState=" + mState);
         pw.println(" mIsEcmTimerCanceled=" + mIsEcmTimerCanceled);
     }
 }
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java b/src/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java
index 1d50c8b..81dec16 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java
@@ -17,7 +17,6 @@
 package com.android.internal.telephony.cdma;
 
 import android.telephony.Rlog;
-import com.android.internal.telephony.Connection;
 import com.android.internal.telephony.PhoneConstants;
 
 /**
@@ -26,7 +25,7 @@
  * {@hide}
  */
 public class CdmaCallWaitingNotification {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "CdmaCallWaitingNotification";
     public String number = null;
     public int numberPresentation = 0;
     public String name = null;
@@ -38,6 +37,7 @@
     public int alertPitch = 0;
     public int signal = 0;
 
+    @Override
     public String toString()
     {
         return super.toString() + "Call Waiting Notification  "
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaConnection.java b/src/java/com/android/internal/telephony/cdma/CdmaConnection.java
index 29ed9cb..ac19a81 100755
--- a/src/java/com/android/internal/telephony/cdma/CdmaConnection.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaConnection.java
@@ -39,47 +39,48 @@
  * {@hide}
  */
 public class CdmaConnection extends Connection {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "CdmaConnection";
+    private static final boolean VDBG = false;
 
     //***** Instance Variables
 
-    CdmaCallTracker owner;
-    CdmaCall parent;
+    CdmaCallTracker mOwner;
+    CdmaCall mParent;
 
 
-    String address;             // MAY BE NULL!!!
-    String dialString;          // outgoing calls only
-    String postDialString;      // outgoing calls only
-    boolean isIncoming;
-    boolean disconnected;
-    int index;          // index in CdmaCallTracker.connections[], -1 if unassigned
+    String mAddress;             // MAY BE NULL!!!
+    String mDialString;          // outgoing calls only
+    String mPostDialString;      // outgoing calls only
+    boolean mIsIncoming;
+    boolean mDisconnected;
+    int mIndex;          // index in CdmaCallTracker.connections[], -1 if unassigned
 
     /*
      * These time/timespan values are based on System.currentTimeMillis(),
      * i.e., "wall clock" time.
      */
-    long createTime;
-    long connectTime;
-    long disconnectTime;
+    long mCreateTime;
+    long mConnectTime;
+    long mDisconnectTime;
 
     /*
      * These time/timespan values are based on SystemClock.elapsedRealTime(),
      * i.e., time since boot.  They are appropriate for comparison and
      * calculating deltas.
      */
-    long connectTimeReal;
-    long duration;
-    long holdingStartTime;  // The time when the Connection last transitioned
+    long mConnectTimeReal;
+    long mDuration;
+    long mHoldingStartTime;  // The time when the Connection last transitioned
                             // into HOLDING
 
-    int nextPostDialChar;       // index into postDialString
+    int mNextPostDialChar;       // index into postDialString
 
-    DisconnectCause cause = DisconnectCause.NOT_DISCONNECTED;
-    PostDialState postDialState = PostDialState.NOT_STARTED;
-    int numberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
+    DisconnectCause mCause = DisconnectCause.NOT_DISCONNECTED;
+    PostDialState mPostDialState = PostDialState.NOT_STARTED;
+    int mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
 
 
-    Handler h;
+    Handler mHandler;
 
     private PowerManager.WakeLock mPartialWakeLock;
 
@@ -98,6 +99,7 @@
     class MyHandler extends Handler {
         MyHandler(Looper l) {super(l);}
 
+        @Override
         public void
         handleMessage(Message msg) {
 
@@ -122,21 +124,21 @@
         createWakeLock(context);
         acquireWakeLock();
 
-        owner = ct;
-        h = new MyHandler(owner.getLooper());
+        mOwner = ct;
+        mHandler = new MyHandler(mOwner.getLooper());
 
-        address = dc.number;
+        mAddress = dc.number;
 
-        isIncoming = dc.isMT;
-        createTime = System.currentTimeMillis();
-        cnapName = dc.name;
-        cnapNamePresentation = dc.namePresentation;
-        numberPresentation = dc.numberPresentation;
+        mIsIncoming = dc.isMT;
+        mCreateTime = System.currentTimeMillis();
+        mCnapName = dc.name;
+        mCnapNamePresentation = dc.namePresentation;
+        mNumberPresentation = dc.numberPresentation;
 
-        this.index = index;
+        mIndex = index;
 
-        parent = parentFromDCState (dc.state);
-        parent.attach(this, dc);
+        mParent = parentFromDCState (dc.state);
+        mParent.attach(this, dc);
     }
 
     /** This is an MO call/three way call, created when dialing */
@@ -145,30 +147,30 @@
         createWakeLock(context);
         acquireWakeLock();
 
-        owner = ct;
-        h = new MyHandler(owner.getLooper());
+        mOwner = ct;
+        mHandler = new MyHandler(mOwner.getLooper());
 
-        this.dialString = dialString;
+        mDialString = dialString;
         Rlog.d(LOG_TAG, "[CDMAConn] CdmaConnection: dialString=" + dialString);
         dialString = formatDialString(dialString);
         Rlog.d(LOG_TAG, "[CDMAConn] CdmaConnection:formated dialString=" + dialString);
 
-        this.address = PhoneNumberUtils.extractNetworkPortionAlt(dialString);
-        this.postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
+        mAddress = PhoneNumberUtils.extractNetworkPortionAlt(dialString);
+        mPostDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
 
-        index = -1;
+        mIndex = -1;
 
-        isIncoming = false;
-        cnapName = null;
-        cnapNamePresentation = PhoneConstants.PRESENTATION_ALLOWED;
-        numberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
-        createTime = System.currentTimeMillis();
+        mIsIncoming = false;
+        mCnapName = null;
+        mCnapNamePresentation = PhoneConstants.PRESENTATION_ALLOWED;
+        mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
+        mCreateTime = System.currentTimeMillis();
 
         if (parent != null) {
-            this.parent = parent;
+            mParent = parent;
 
             //for the three way call case, not change parent state
-            if (parent.state == CdmaCall.State.ACTIVE) {
+            if (parent.mState == CdmaCall.State.ACTIVE) {
                 parent.attachFake(this, CdmaCall.State.ACTIVE);
             } else {
                 parent.attachFake(this, CdmaCall.State.DIALING);
@@ -182,17 +184,17 @@
         createWakeLock(context);
         acquireWakeLock();
 
-        owner = ct;
-        h = new MyHandler(owner.getLooper());
-        address = cw.number;
-        numberPresentation = cw.numberPresentation;
-        cnapName = cw.name;
-        cnapNamePresentation = cw.namePresentation;
-        index = -1;
-        isIncoming = true;
-        createTime = System.currentTimeMillis();
-        connectTime = 0;
-        this.parent = parent;
+        mOwner = ct;
+        mHandler = new MyHandler(mOwner.getLooper());
+        mAddress = cw.number;
+        mNumberPresentation = cw.numberPresentation;
+        mCnapName = cw.name;
+        mCnapNamePresentation = cw.namePresentation;
+        mIndex = -1;
+        mIsIncoming = true;
+        mCreateTime = System.currentTimeMillis();
+        mConnectTime = 0;
+        mParent = parent;
         parent.attachFake(this, CdmaCall.State.WAITING);
     }
 
@@ -211,99 +213,114 @@
         //
         // We assume we know when MO calls are created (since we created them)
         // and therefore don't need to compare the phone number anyway.
-        if (! (isIncoming || c.isMT)) return true;
+        if (! (mIsIncoming || c.isMT)) return true;
 
         // ... but we can compare phone numbers on MT calls, and we have
         // no control over when they begin, so we might as well
 
         String cAddress = PhoneNumberUtils.stringFromStringAndTOA(c.number, c.TOA);
-        return isIncoming == c.isMT && equalsHandlesNulls(address, cAddress);
+        return mIsIncoming == c.isMT && equalsHandlesNulls(mAddress, cAddress);
     }
 
 
+    @Override
     public String getOrigDialString(){
-        return dialString;
+        return mDialString;
     }
 
+    @Override
     public String getAddress() {
-        return address;
+        return mAddress;
     }
 
+    @Override
     public CdmaCall getCall() {
-        return parent;
+        return mParent;
     }
 
+    @Override
     public long getCreateTime() {
-        return createTime;
+        return mCreateTime;
     }
 
+    @Override
     public long getConnectTime() {
-        return connectTime;
+        return mConnectTime;
     }
 
+    @Override
     public long getDisconnectTime() {
-        return disconnectTime;
+        return mDisconnectTime;
     }
 
+    @Override
     public long getDurationMillis() {
-        if (connectTimeReal == 0) {
+        if (mConnectTimeReal == 0) {
             return 0;
-        } else if (duration == 0) {
-            return SystemClock.elapsedRealtime() - connectTimeReal;
+        } else if (mDuration == 0) {
+            return SystemClock.elapsedRealtime() - mConnectTimeReal;
         } else {
-            return duration;
+            return mDuration;
         }
     }
 
+    @Override
     public long getHoldDurationMillis() {
         if (getState() != CdmaCall.State.HOLDING) {
             // If not holding, return 0
             return 0;
         } else {
-            return SystemClock.elapsedRealtime() - holdingStartTime;
+            return SystemClock.elapsedRealtime() - mHoldingStartTime;
         }
     }
 
+    @Override
     public DisconnectCause getDisconnectCause() {
-        return cause;
+        return mCause;
     }
 
+    @Override
     public boolean isIncoming() {
-        return isIncoming;
+        return mIsIncoming;
     }
 
+    @Override
     public CdmaCall.State getState() {
-        if (disconnected) {
+        if (mDisconnected) {
             return CdmaCall.State.DISCONNECTED;
         } else {
             return super.getState();
         }
     }
 
+    @Override
     public void hangup() throws CallStateException {
-        if (!disconnected) {
-            owner.hangup(this);
+        if (!mDisconnected) {
+            mOwner.hangup(this);
         } else {
             throw new CallStateException ("disconnected");
         }
     }
 
+    @Override
     public void separate() throws CallStateException {
-        if (!disconnected) {
-            owner.separate(this);
+        if (!mDisconnected) {
+            mOwner.separate(this);
         } else {
             throw new CallStateException ("disconnected");
         }
     }
 
+    @Override
     public PostDialState getPostDialState() {
-        return postDialState;
+        return mPostDialState;
     }
 
+    @Override
     public void proceedAfterWaitChar() {
-        if (postDialState != PostDialState.WAIT) {
+        if (mPostDialState != PostDialState.WAIT) {
             Rlog.w(LOG_TAG, "CdmaConnection.proceedAfterWaitChar(): Expected "
-                + "getPostDialState() to be WAIT but was " + postDialState);
+                + "getPostDialState() to be WAIT but was " + mPostDialState);
             return;
         }
 
@@ -312,53 +329,32 @@
         processNextPostDialChar();
     }
 
+    @Override
     public void proceedAfterWildChar(String str) {
-        if (postDialState != PostDialState.WILD) {
+        if (mPostDialState != PostDialState.WILD) {
             Rlog.w(LOG_TAG, "CdmaConnection.proceedAfterWaitChar(): Expected "
-                + "getPostDialState() to be WILD but was " + postDialState);
+                + "getPostDialState() to be WILD but was " + mPostDialState);
             return;
         }
 
         setPostDialState(PostDialState.STARTED);
 
-        if (false) {
-            boolean playedTone = false;
-            int len = (str != null ? str.length() : 0);
+        // make a new postDialString, with the wild char replacement string
+        // at the beginning, followed by the remaining postDialString.
 
-            for (int i=0; i<len; i++) {
-                char c = str.charAt(i);
-                Message msg = null;
-
-                if (i == len-1) {
-                    msg = h.obtainMessage(EVENT_DTMF_DONE);
-                }
-
-                if (PhoneNumberUtils.is12Key(c)) {
-                    owner.cm.sendDtmf(c, msg);
-                    playedTone = true;
-                }
-            }
-
-            if (!playedTone) {
-                processNextPostDialChar();
-            }
-        } else {
-            // make a new postDialString, with the wild char replacement string
-            // at the beginning, followed by the remaining postDialString.
-
-            StringBuilder buf = new StringBuilder(str);
-            buf.append(postDialString.substring(nextPostDialChar));
-            postDialString = buf.toString();
-            nextPostDialChar = 0;
-            if (Phone.DEBUG_PHONE) {
-                log("proceedAfterWildChar: new postDialString is " +
-                        postDialString);
-            }
-
-            processNextPostDialChar();
+        StringBuilder buf = new StringBuilder(str);
+        buf.append(mPostDialString.substring(mNextPostDialChar));
+        mPostDialString = buf.toString();
+        mNextPostDialChar = 0;
+        if (Phone.DEBUG_PHONE) {
+            log("proceedAfterWildChar: new postDialString is " +
+                    mPostDialString);
         }
+
+        processNextPostDialChar();
     }
 
+    @Override
     public void cancelPostDial() {
         setPostDialState(PostDialState.CANCELLED);
     }
@@ -370,7 +366,7 @@
      */
     void
     onHangupLocal() {
-        cause = DisconnectCause.LOCAL;
+        mCause = DisconnectCause.LOCAL;
     }
 
     DisconnectCause
@@ -414,7 +410,7 @@
             case CallFailCause.ERROR_UNSPECIFIED:
             case CallFailCause.NORMAL_CLEARING:
             default:
-                CDMAPhone phone = owner.phone;
+                CDMAPhone phone = mOwner.mPhone;
                 int serviceState = phone.getServiceState().getState();
                 UiccCardApplication app = UiccController
                         .getInstance()
@@ -445,17 +441,16 @@
     /** Called when the radio indicates the connection has been disconnected */
     /*package*/ void
     onDisconnect(DisconnectCause cause) {
-        this.cause = cause;
+        mCause = cause;
 
-        if (!disconnected) {
+        if (!mDisconnected) {
             doDisconnect();
-            if (false) Rlog.d(LOG_TAG,
-                    "[CDMAConn] onDisconnect: cause=" + cause);
+            if (VDBG) Rlog.d(LOG_TAG, "onDisconnect: cause=" + cause);
 
-            owner.phone.notifyDisconnect(this);
+            mOwner.mPhone.notifyDisconnect(this);
 
-            if (parent != null) {
-                parent.connectionDisconnected(this);
+            if (mParent != null) {
+                mParent.connectionDisconnected(this);
             }
         }
         releaseWakeLock();
@@ -464,13 +459,12 @@
     /** Called when the call waiting connection has been hung up */
     /*package*/ void
     onLocalDisconnect() {
-        if (!disconnected) {
+        if (!mDisconnected) {
             doDisconnect();
-            if (false) Rlog.d(LOG_TAG,
-                    "[CDMAConn] onLoalDisconnect" );
+            if (VDBG) Rlog.d(LOG_TAG, "onLoalDisconnect" );
 
-            if (parent != null) {
-                parent.detach(this);
+            if (mParent != null) {
+                mParent.detach(this);
             }
         }
         releaseWakeLock();
@@ -486,39 +480,39 @@
 
         newParent = parentFromDCState(dc.state);
 
-        if (Phone.DEBUG_PHONE) log("parent= " +parent +", newParent= " + newParent);
+        if (Phone.DEBUG_PHONE) log("parent= " +mParent +", newParent= " + newParent);
 
-        if (!equalsHandlesNulls(address, dc.number)) {
+        if (!equalsHandlesNulls(mAddress, dc.number)) {
             if (Phone.DEBUG_PHONE) log("update: phone # changed!");
-            address = dc.number;
+            mAddress = dc.number;
             changed = true;
         }
 
         // A null cnapName should be the same as ""
         if (TextUtils.isEmpty(dc.name)) {
-            if (!TextUtils.isEmpty(cnapName)) {
+            if (!TextUtils.isEmpty(mCnapName)) {
                 changed = true;
-                cnapName = "";
+                mCnapName = "";
             }
-        } else if (!dc.name.equals(cnapName)) {
+        } else if (!dc.name.equals(mCnapName)) {
             changed = true;
-            cnapName = dc.name;
+            mCnapName = dc.name;
         }
 
-        if (Phone.DEBUG_PHONE) log("--dssds----"+cnapName);
-        cnapNamePresentation = dc.namePresentation;
-        numberPresentation = dc.numberPresentation;
+        if (Phone.DEBUG_PHONE) log("--dssds----"+mCnapName);
+        mCnapNamePresentation = dc.namePresentation;
+        mNumberPresentation = dc.numberPresentation;
 
-        if (newParent != parent) {
-            if (parent != null) {
-                parent.detach(this);
+        if (newParent != mParent) {
+            if (mParent != null) {
+                mParent.detach(this);
             }
             newParent.attach(this, dc);
-            parent = newParent;
+            mParent = newParent;
             changed = true;
         } else {
             boolean parentStateChange;
-            parentStateChange = parent.update (this, dc);
+            parentStateChange = mParent.update (this, dc);
             changed = changed || parentStateChange;
         }
 
@@ -551,20 +545,20 @@
      */
     void
     fakeHoldBeforeDial() {
-        if (parent != null) {
-            parent.detach(this);
+        if (mParent != null) {
+            mParent.detach(this);
         }
 
-        parent = owner.backgroundCall;
-        parent.attachFake(this, CdmaCall.State.HOLDING);
+        mParent = mOwner.mBackgroundCall;
+        mParent.attachFake(this, CdmaCall.State.HOLDING);
 
         onStartedHolding();
     }
 
     /*package*/ int
     getCDMAIndex() throws CallStateException {
-        if (index >= 0) {
-            return index + 1;
+        if (mIndex >= 0) {
+            return mIndex + 1;
         } else {
             throw new CallStateException ("CDMA connection index not assigned");
         }
@@ -575,17 +569,17 @@
      */
     void
     onConnectedInOrOut() {
-        connectTime = System.currentTimeMillis();
-        connectTimeReal = SystemClock.elapsedRealtime();
-        duration = 0;
+        mConnectTime = System.currentTimeMillis();
+        mConnectTimeReal = SystemClock.elapsedRealtime();
+        mDuration = 0;
 
         // bug #678474: incoming call interpreted as missed call, even though
         // it sounds like the user has picked up the call.
         if (Phone.DEBUG_PHONE) {
-            log("onConnectedInOrOut: connectTime=" + connectTime);
+            log("onConnectedInOrOut: connectTime=" + mConnectTime);
         }
 
-        if (!isIncoming) {
+        if (!mIsIncoming) {
             // outgoing calls only
             processNextPostDialChar();
         } else {
@@ -597,15 +591,15 @@
 
     private void
     doDisconnect() {
-       index = -1;
-       disconnectTime = System.currentTimeMillis();
-       duration = SystemClock.elapsedRealtime() - connectTimeReal;
-       disconnected = true;
+       mIndex = -1;
+       mDisconnectTime = System.currentTimeMillis();
+       mDuration = SystemClock.elapsedRealtime() - mConnectTimeReal;
+       mDisconnected = true;
     }
 
     /*package*/ void
     onStartedHolding() {
-        holdingStartTime = SystemClock.elapsedRealtime();
+        mHoldingStartTime = SystemClock.elapsedRealtime();
     }
     /**
      * Performs the appropriate action for a post-dial char, but does not
@@ -615,14 +609,14 @@
     private boolean
     processPostDialChar(char c) {
         if (PhoneNumberUtils.is12Key(c)) {
-            owner.cm.sendDtmf(c, h.obtainMessage(EVENT_DTMF_DONE));
+            mOwner.mCi.sendDtmf(c, mHandler.obtainMessage(EVENT_DTMF_DONE));
         } else if (c == PhoneNumberUtils.PAUSE) {
             setPostDialState(PostDialState.PAUSE);
 
             // Upon occurrences of the separator, the UE shall
             // pause again for 2 seconds before sending any
             // further DTMF digits.
-            h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE),
+            mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_PAUSE_DONE),
                                             PAUSE_DELAY_MILLIS);
         } else if (c == PhoneNumberUtils.WAIT) {
             setPostDialState(PostDialState.WAIT);
@@ -635,15 +629,16 @@
         return true;
     }
 
+    @Override
     public String getRemainingPostDialString() {
-        if (postDialState == PostDialState.CANCELLED
-                || postDialState == PostDialState.COMPLETE
-                || postDialString == null
-                || postDialString.length() <= nextPostDialChar) {
+        if (mPostDialState == PostDialState.CANCELLED
+                || mPostDialState == PostDialState.COMPLETE
+                || mPostDialString == null
+                || mPostDialString.length() <= mNextPostDialChar) {
             return "";
         }
 
-        String subStr = postDialString.substring(nextPostDialChar);
+        String subStr = mPostDialString.substring(mNextPostDialChar);
         if (subStr != null) {
             int wIndex = subStr.indexOf(PhoneNumberUtils.WAIT);
             int pIndex = subStr.indexOf(PhoneNumberUtils.PAUSE);
@@ -663,7 +658,7 @@
                 oldParent.detach(this);
             }
             newParent.attachFake(this, CdmaCall.State.ACTIVE);
-            parent = newParent;
+            mParent = newParent;
         }
     }
 
@@ -686,14 +681,14 @@
         char c = 0;
         Registrant postDialHandler;
 
-        if (postDialState == PostDialState.CANCELLED) {
+        if (mPostDialState == PostDialState.CANCELLED) {
             releaseWakeLock();
             //Rlog.v("CDMA", "##### processNextPostDialChar: postDialState == CANCELLED, bail");
             return;
         }
 
-        if (postDialString == null ||
-                postDialString.length() <= nextPostDialChar) {
+        if (mPostDialString == null ||
+                mPostDialString.length() <= mNextPostDialChar) {
             setPostDialState(PostDialState.COMPLETE);
 
             // We were holding a wake lock until pause-dial was complete, so give it up now
@@ -706,27 +701,27 @@
 
             setPostDialState(PostDialState.STARTED);
 
-            c = postDialString.charAt(nextPostDialChar++);
+            c = mPostDialString.charAt(mNextPostDialChar++);
 
             isValid = processPostDialChar(c);
 
             if (!isValid) {
                 // Will call processNextPostDialChar
-                h.obtainMessage(EVENT_NEXT_POST_DIAL).sendToTarget();
+                mHandler.obtainMessage(EVENT_NEXT_POST_DIAL).sendToTarget();
                 // Don't notify application
                 Rlog.e("CDMA", "processNextPostDialChar: c=" + c + " isn't valid!");
                 return;
             }
         }
 
-        postDialHandler = owner.phone.mPostDialHandler;
+        postDialHandler = mOwner.mPhone.mPostDialHandler;
 
         Message notifyMessage;
 
         if (postDialHandler != null &&
                 (notifyMessage = postDialHandler.messageForRegistrant()) != null) {
             // The AsyncResult.result is the Connection object
-            PostDialState state = postDialState;
+            PostDialState state = mPostDialState;
             AsyncResult ar = AsyncResult.forMessage(notifyMessage);
             ar.result = this;
             ar.userObj = state;
@@ -744,9 +739,9 @@
      */
     private boolean
     isConnectingInOrOut() {
-        return parent == null || parent == owner.ringingCall
-            || parent.state == CdmaCall.State.DIALING
-            || parent.state == CdmaCall.State.ALERTING;
+        return mParent == null || mParent == mOwner.mRingingCall
+            || mParent.mState == CdmaCall.State.DIALING
+            || mParent.mState == CdmaCall.State.ALERTING;
     }
 
     private CdmaCall
@@ -755,16 +750,16 @@
             case ACTIVE:
             case DIALING:
             case ALERTING:
-                return owner.foregroundCall;
+                return mOwner.mForegroundCall;
             //break;
 
             case HOLDING:
-                return owner.backgroundCall;
+                return mOwner.mBackgroundCall;
             //break;
 
             case INCOMING:
             case WAITING:
-                return owner.ringingCall;
+                return mOwner.mRingingCall;
             //break;
 
             default:
@@ -783,18 +778,18 @@
                 s == PostDialState.PAUSE) {
             synchronized (mPartialWakeLock) {
                 if (mPartialWakeLock.isHeld()) {
-                    h.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
+                    mHandler.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
                 } else {
                     acquireWakeLock();
                 }
-                Message msg = h.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
-                h.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
+                Message msg = mHandler.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
+                mHandler.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
             }
         } else {
-            h.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
+            mHandler.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
             releaseWakeLock();
         }
-        postDialState = s;
+        mPostDialState = s;
     }
 
     private void createWakeLock(Context context) {
@@ -939,7 +934,7 @@
 
     @Override
     public int getNumberPresentation() {
-        return numberPresentation;
+        return mNumberPresentation;
     }
 
     @Override
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaDataConnection.java b/src/java/com/android/internal/telephony/cdma/CdmaDataConnection.java
deleted file mode 100644
index a041974..0000000
--- a/src/java/com/android/internal/telephony/cdma/CdmaDataConnection.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2006 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 com.android.internal.telephony.cdma;
-
-import android.os.Message;
-import android.telephony.Rlog;
-
-import com.android.internal.telephony.DataConnection;
-import com.android.internal.telephony.DataConnectionTracker;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.RILConstants;
-import com.android.internal.telephony.RetryManager;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
-/**
- * {@hide}
- */
-public class CdmaDataConnection extends DataConnection {
-
-    private static final String LOG_TAG = "CDMA";
-
-    // ***** Constructor
-    private CdmaDataConnection(CDMAPhone phone, String name, int id, RetryManager rm,
-            DataConnectionTracker dct) {
-        super(phone, name, id, rm, dct);
-    }
-
-    /**
-     * Create the connection object
-     *
-     * @param phone the Phone
-     * @param id the connection id
-     * @param rm the RetryManager
-     * @return CdmaDataConnection that was created.
-     */
-    static CdmaDataConnection makeDataConnection(CDMAPhone phone, int id, RetryManager rm,
-            DataConnectionTracker dct) {
-        CdmaDataConnection cdmaDc = new CdmaDataConnection(phone,
-                "CdmaDC-" + mCount.incrementAndGet(), id, rm, dct);
-        cdmaDc.start();
-        if (DBG) cdmaDc.log("Made " + cdmaDc.getName());
-        return cdmaDc;
-    }
-
-    /**
-     * Begin setting up a data connection, calls setupDataCall
-     * and the ConnectionParams will be returned with the
-     * EVENT_SETUP_DATA_CONNECTION_DONE AsyncResul.userObj.
-     *
-     * @param cp is the connection parameters
-     */
-    @Override
-    protected void onConnect(ConnectionParams cp) {
-        if (DBG) log("CdmaDataConnection Connecting...");
-
-        mApn = cp.apn;
-        createTime = -1;
-        lastFailTime = -1;
-        lastFailCause = FailCause.NONE;
-        int dataProfile;
-        if ((cp.apn != null) && (cp.apn.types.length > 0) && (cp.apn.types[0] != null) &&
-                (cp.apn.types[0].equals(PhoneConstants.APN_TYPE_DUN))) {
-            if (DBG) log("CdmaDataConnection using DUN");
-            dataProfile = RILConstants.DATA_PROFILE_TETHERED;
-        } else {
-            dataProfile = RILConstants.DATA_PROFILE_DEFAULT;
-        }
-
-        // msg.obj will be returned in AsyncResult.userObj;
-        Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
-        msg.obj = cp;
-        phone.mCM.setupDataCall(
-                Integer.toString(getRilRadioTechnology(RILConstants.SETUP_DATA_TECH_CDMA)),
-                Integer.toString(dataProfile),
-                null, null, null,
-                Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP),
-                RILConstants.SETUP_DATA_PROTOCOL_IP, msg);
-    }
-
-    @Override
-    public String toString() {
-        return "State=" + getCurrentState().getName() + " create=" + createTime + " lastFail="
-                + lastFailTime + " lastFasilCause=" + lastFailCause;
-    }
-
-    @Override
-    protected boolean isDnsOk(String[] domainNameServers) {
-        if (NULL_IP.equals(domainNameServers[0])
-                && NULL_IP.equals(domainNameServers[1])
-                && !phone.isDnsCheckDisabled()) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    @Override
-    protected void log(String s) {
-        Rlog.d(LOG_TAG, "[" + getName() + "] " + s);
-    }
-
-    @Override
-    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-        pw.println("CdmaDataConnection extends:");
-        super.dump(fd, pw, args);
-    }
-}
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
deleted file mode 100644
index 0e68125..0000000
--- a/src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ /dev/null
@@ -1,975 +0,0 @@
-/*
- * Copyright (C) 2006 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 com.android.internal.telephony.cdma;
-
-import android.app.AlarmManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.os.AsyncResult;
-import android.os.Message;
-import android.os.SystemClock;
-import android.os.SystemProperties;
-import android.telephony.ServiceState;
-import android.telephony.TelephonyManager;
-import android.telephony.cdma.CdmaCellLocation;
-import android.text.TextUtils;
-import android.util.EventLog;
-import android.telephony.Rlog;
-
-import com.android.internal.telephony.ApnSetting;
-import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.DataCallState;
-import com.android.internal.telephony.DataConnection.FailCause;
-import com.android.internal.telephony.DataConnection;
-import com.android.internal.telephony.DataConnectionAc;
-import com.android.internal.telephony.DataConnectionTracker;
-import com.android.internal.telephony.DctConstants;
-import com.android.internal.telephony.EventLogTags;
-import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.RetryManager;
-import com.android.internal.telephony.RILConstants;
-import com.android.internal.telephony.uicc.IccRecords;
-import com.android.internal.telephony.uicc.UiccCard;
-import com.android.internal.telephony.uicc.UiccController;
-import com.android.internal.util.AsyncChannel;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-/**
- * {@hide}
- */
-public final class CdmaDataConnectionTracker extends DataConnectionTracker {
-    protected final String LOG_TAG = "CDMA";
-
-    private CDMAPhone mCdmaPhone;
-    private CdmaSubscriptionSourceManager mCdmaSSM;
-
-    /** The DataConnection being setup */
-    private CdmaDataConnection mPendingDataConnection;
-
-    private boolean mPendingRestartRadio = false;
-    private static final int TIME_DELAYED_TO_RESTART_RADIO =
-            SystemProperties.getInt("ro.cdma.timetoradiorestart", 60000);
-
-    /**
-     * Pool size of CdmaDataConnection objects.
-     */
-    private static final int DATA_CONNECTION_POOL_SIZE = 1;
-
-    private static final String INTENT_RECONNECT_ALARM =
-        "com.android.internal.telephony.cdma-reconnect";
-
-    private static final String INTENT_DATA_STALL_ALARM =
-        "com.android.internal.telephony.cdma-data-stall";
-
-    private static final String[] mSupportedApnTypes = {
-            PhoneConstants.APN_TYPE_DEFAULT,
-            PhoneConstants.APN_TYPE_MMS,
-            PhoneConstants.APN_TYPE_DUN,
-            PhoneConstants.APN_TYPE_HIPRI };
-
-    private static final String[] mDefaultApnTypes = {
-            PhoneConstants.APN_TYPE_DEFAULT,
-            PhoneConstants.APN_TYPE_MMS,
-            PhoneConstants.APN_TYPE_HIPRI };
-
-    private String[] mDunApnTypes = {
-            PhoneConstants.APN_TYPE_DUN };
-
-    private static final int mDefaultApnId = DctConstants.APN_DEFAULT_ID;
-
-    /* Constructor */
-
-    CdmaDataConnectionTracker(CDMAPhone p) {
-        super(p);
-        mCdmaPhone = p;
-
-        p.mCM.registerForAvailable (this, DctConstants.EVENT_RADIO_AVAILABLE, null);
-        p.mCM.registerForOffOrNotAvailable(this, DctConstants.EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
-        p.mCM.registerForDataNetworkStateChanged (this, DctConstants.EVENT_DATA_STATE_CHANGED, null);
-        p.mCT.registerForVoiceCallEnded (this, DctConstants.EVENT_VOICE_CALL_ENDED, null);
-        p.mCT.registerForVoiceCallStarted (this, DctConstants.EVENT_VOICE_CALL_STARTED, null);
-        p.mSST.registerForDataConnectionAttached(this, DctConstants.EVENT_TRY_SETUP_DATA, null);
-        p.mSST.registerForDataConnectionDetached(this, DctConstants.EVENT_CDMA_DATA_DETACHED, null);
-        p.mSST.registerForRoamingOn(this, DctConstants.EVENT_ROAMING_ON, null);
-        p.mSST.registerForRoamingOff(this, DctConstants.EVENT_ROAMING_OFF, null);
-        p.mCM.registerForCdmaOtaProvision(this, DctConstants.EVENT_CDMA_OTA_PROVISION, null);
-        mCdmaSSM = CdmaSubscriptionSourceManager.getInstance (p.getContext(), p.mCM, this,
-                DctConstants.EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
-
-        mDataConnectionTracker = this;
-
-        createAllDataConnectionList();
-        broadcastMessenger();
-
-        Context c = mCdmaPhone.getContext();
-        String[] t = c.getResources().getStringArray(
-                com.android.internal.R.array.config_cdma_dun_supported_types);
-        if (t != null && t.length > 0) {
-            ArrayList<String> temp = new ArrayList<String>();
-            for(int i=0; i< t.length; i++) {
-                if (!PhoneConstants.APN_TYPE_DUN.equalsIgnoreCase(t[i])) {
-                    temp.add(t[i]);
-                }
-            }
-            temp.add(0,PhoneConstants.APN_TYPE_DUN);
-            mDunApnTypes = temp.toArray(t);
-        }
-
-    }
-
-    @Override
-    public void dispose() {
-        cleanUpConnection(true, null, false);
-
-        super.dispose();
-
-        // Unregister from all events
-        mPhone.mCM.unregisterForAvailable(this);
-        mPhone.mCM.unregisterForOffOrNotAvailable(this);
-        IccRecords r = mIccRecords.get();
-        if (r != null) { r.unregisterForRecordsLoaded(this);}
-        mPhone.mCM.unregisterForDataNetworkStateChanged(this);
-        mCdmaPhone.mCT.unregisterForVoiceCallEnded(this);
-        mCdmaPhone.mCT.unregisterForVoiceCallStarted(this);
-        mCdmaPhone.mSST.unregisterForDataConnectionAttached(this);
-        mCdmaPhone.mSST.unregisterForDataConnectionDetached(this);
-        mCdmaPhone.mSST.unregisterForRoamingOn(this);
-        mCdmaPhone.mSST.unregisterForRoamingOff(this);
-        mCdmaSSM.dispose(this);
-        mPhone.mCM.unregisterForCdmaOtaProvision(this);
-
-        destroyAllDataConnectionList();
-    }
-
-    @Override
-    protected void finalize() {
-        if(DBG) log("CdmaDataConnectionTracker finalized");
-    }
-
-    @Override
-    protected String getActionIntentReconnectAlarm() {
-        return INTENT_RECONNECT_ALARM;
-    }
-
-    @Override
-    protected String getActionIntentDataStallAlarm() {
-        return INTENT_DATA_STALL_ALARM;
-    }
-
-    @Override
-    protected void restartDataStallAlarm() {}
-
-    @Override
-    protected void setState(DctConstants.State s) {
-        if (DBG) log ("setState: " + s);
-        if (mState != s) {
-            EventLog.writeEvent(EventLogTags.CDMA_DATA_STATE_CHANGE,
-                    mState.toString(), s.toString());
-            mState = s;
-        }
-    }
-
-    @Override
-    public synchronized DctConstants.State getState(String apnType) {
-        return mState;
-    }
-
-    @Override
-    public DctConstants.State getOverallState() {
-        return mState;
-    }
-
-    @Override
-    protected boolean isApnTypeAvailable(String type) {
-        for (String s : mSupportedApnTypes) {
-            if (TextUtils.equals(type, s)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    protected boolean isDataAllowed() {
-        final boolean internalDataEnabled;
-        synchronized (mDataEnabledLock) {
-            internalDataEnabled = mInternalDataEnabled;
-        }
-
-        int psState = mCdmaPhone.mSST.getCurrentDataConnectionState();
-        boolean roaming = (mPhone.getServiceState().getRoaming() && !getDataOnRoamingEnabled());
-        boolean desiredPowerState = mCdmaPhone.mSST.getDesiredPowerState();
-        boolean subscriptionFromNv = (mCdmaSSM.getCdmaSubscriptionSource()
-                                       == CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_NV);
-
-        IccRecords r = mIccRecords.get();
-        boolean allowed =
-                    (psState == ServiceState.STATE_IN_SERVICE ||
-                            mAutoAttachOnCreation) &&
-                    (subscriptionFromNv ||
-                            (r != null && r.getRecordsLoaded())) &&
-                    (mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed() ||
-                            mPhone.getState() ==PhoneConstants.State.IDLE) &&
-                    !roaming &&
-                    internalDataEnabled &&
-                    desiredPowerState &&
-                    !mPendingRestartRadio &&
-                    ((mPhone.getLteOnCdmaMode() ==PhoneConstants.LTE_ON_CDMA_TRUE) ||
-                            !mCdmaPhone.needsOtaServiceProvisioning());
-        if (!allowed && DBG) {
-            String reason = "";
-            if (!((psState == ServiceState.STATE_IN_SERVICE) || mAutoAttachOnCreation)) {
-                reason += " - psState= " + psState;
-            }
-            if (!subscriptionFromNv &&
-                    !(r != null && r.getRecordsLoaded())) {
-                reason += " - RUIM not loaded";
-            }
-            if (!(mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed() ||
-                    mPhone.getState() ==PhoneConstants.State.IDLE)) {
-                reason += " - concurrentVoiceAndData not allowed and state= " + mPhone.getState();
-            }
-            if (roaming) reason += " - Roaming";
-            if (!internalDataEnabled) reason += " - mInternalDataEnabled= false";
-            if (!desiredPowerState) reason += " - desiredPowerState= false";
-            if (mPendingRestartRadio) reason += " - mPendingRestartRadio= true";
-            if (mCdmaPhone.needsOtaServiceProvisioning()) reason += " - needs Provisioning";
-            log("Data not allowed due to" + reason);
-        }
-        return allowed;
-    }
-
-    @Override
-    protected boolean isDataPossible(String apnType) {
-        boolean possible = isDataAllowed() && !(getAnyDataEnabled() &&
-                mState == DctConstants.State.FAILED);
-        if (!possible && DBG && isDataAllowed()) {
-            log("Data not possible.  No coverage: dataState = " + mState);
-        }
-        return possible;
-    }
-
-    private boolean trySetupData(String reason) {
-        if (DBG) log("***trySetupData due to " + (reason == null ? "(unspecified)" : reason));
-
-        if (mPhone.getSimulatedRadioControl() != null) {
-            // Assume data is connected on the simulator
-            // FIXME  this can be improved
-            setState(DctConstants.State.CONNECTED);
-            notifyDataConnection(reason);
-            notifyOffApnsOfAvailability(reason);
-
-            log("(fix?) We're on the simulator; assuming data is connected");
-            return true;
-        }
-
-        int psState = mCdmaPhone.mSST.getCurrentDataConnectionState();
-        boolean roaming = mPhone.getServiceState().getRoaming();
-        boolean desiredPowerState = mCdmaPhone.mSST.getDesiredPowerState();
-
-        if ((mState == DctConstants.State.IDLE || mState == DctConstants.State.SCANNING) &&
-                isDataAllowed() && getAnyDataEnabled() && !isEmergency()) {
-            boolean retValue = setupData(reason);
-            notifyOffApnsOfAvailability(reason);
-            return retValue;
-        } else {
-            notifyOffApnsOfAvailability(reason);
-            return false;
-        }
-    }
-
-    /**
-     * Cleanup the CDMA data connection (only one is supported)
-     *
-     * @param tearDown true if the underlying DataConnection should be disconnected.
-     * @param reason for the clean up.
-     * @param doAll Set RefCount to 0 and tear down data call even if
-     *              multiple APN types are associated with it.
-     */
-    private void cleanUpConnection(boolean tearDown, String reason, boolean doAll) {
-        if (DBG) log("cleanUpConnection: reason: " + reason);
-
-        // Clear the reconnect alarm, if set.
-        if (mReconnectIntent != null) {
-            AlarmManager am =
-                (AlarmManager) mPhone.getContext().getSystemService(Context.ALARM_SERVICE);
-            am.cancel(mReconnectIntent);
-            mReconnectIntent = null;
-        }
-
-        setState(DctConstants.State.DISCONNECTING);
-        notifyOffApnsOfAvailability(reason);
-
-        boolean notificationDeferred = false;
-        for (DataConnection conn : mDataConnections.values()) {
-            if(conn != null) {
-                DataConnectionAc dcac =
-                    mDataConnectionAsyncChannels.get(conn.getDataConnectionId());
-                if (tearDown) {
-                    if (doAll) {
-                        if (DBG) log("cleanUpConnection: teardown, conn.tearDownAll");
-                        conn.tearDownAll(reason, obtainMessage(DctConstants.EVENT_DISCONNECT_DONE,
-                                conn.getDataConnectionId(), 0, reason));
-                    } else {
-                        if (DBG) log("cleanUpConnection: teardown, conn.tearDown");
-                        conn.tearDown(reason, obtainMessage(DctConstants.EVENT_DISCONNECT_DONE,
-                                conn.getDataConnectionId(), 0, reason));
-                    }
-                    notificationDeferred = true;
-                } else {
-                    if (DBG) log("cleanUpConnection: !tearDown, call conn.resetSynchronously");
-                    if (dcac != null) {
-                        dcac.resetSync();
-                    }
-                    notificationDeferred = false;
-                }
-            }
-        }
-
-        stopNetStatPoll();
-        stopDataStallAlarm();
-
-        if (!notificationDeferred) {
-            if (DBG) log("cleanupConnection: !notificationDeferred");
-            gotoIdleAndNotifyDataConnection(reason);
-        }
-    }
-
-    private CdmaDataConnection findFreeDataConnection() {
-        for (DataConnectionAc dcac : mDataConnectionAsyncChannels.values()) {
-            if (dcac.isInactiveSync()) {
-                log("found free GsmDataConnection");
-                return (CdmaDataConnection) dcac.dataConnection;
-            }
-        }
-        log("NO free CdmaDataConnection");
-        return null;
-    }
-
-    private boolean setupData(String reason) {
-        CdmaDataConnection conn = findFreeDataConnection();
-
-        if (conn == null) {
-            if (DBG) log("setupData: No free CdmaDataConnection found!");
-            return false;
-        }
-
-        /** TODO: We probably want the connection being setup to a parameter passed around */
-        mPendingDataConnection = conn;
-        String[] types;
-        int apnId;
-        if (mRequestedApnType.equals(PhoneConstants.APN_TYPE_DUN)) {
-            types = mDunApnTypes;
-            apnId = DctConstants.APN_DUN_ID;
-        } else {
-            types = mDefaultApnTypes;
-            apnId = mDefaultApnId;
-        }
-        mActiveApn = new ApnSetting(apnId, "", "", "", "", "", "", "", "", "",
-                                    "", 0, types, "IP", "IP", true, 0);
-        if (DBG) log("call conn.bringUp mActiveApn=" + mActiveApn);
-
-        Message msg = obtainMessage();
-        msg.what = DctConstants.EVENT_DATA_SETUP_COMPLETE;
-        msg.obj = reason;
-        conn.bringUp(msg, mActiveApn);
-
-        setState(DctConstants.State.INITING);
-        notifyDataConnection(reason);
-        return true;
-    }
-
-    private void notifyDefaultData(String reason) {
-        setState(DctConstants.State.CONNECTED);
-        notifyDataConnection(reason);
-        startNetStatPoll();
-        startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
-        mDataConnections.get(0).resetRetryCount();
-    }
-
-    @Override
-    protected void restartRadio() {
-        if (DBG) log("Cleanup connection and wait " +
-                (TIME_DELAYED_TO_RESTART_RADIO / 1000) + "s to restart radio");
-        cleanUpAllConnections(null);
-        sendEmptyMessageDelayed(DctConstants.EVENT_RESTART_RADIO, TIME_DELAYED_TO_RESTART_RADIO);
-        mPendingRestartRadio = true;
-    }
-
-    /**
-     * Returns true if the last fail cause is something that
-     * seems like it deserves an error notification.
-     * Transient errors are ignored
-     */
-    private boolean
-    shouldPostNotification(FailCause cause) {
-        return (cause != FailCause.UNKNOWN);
-    }
-
-    /**
-     * Return true if data connection need to be setup after disconnected due to
-     * reason.
-     *
-     * @param reason the reason why data is disconnected
-     * @return true if try setup data connection is need for this reason
-     */
-    private boolean retryAfterDisconnected(String reason) {
-        boolean retry = true;
-
-        if ( Phone.REASON_RADIO_TURNED_OFF.equals(reason) ) {
-            retry = false;
-        }
-        return retry;
-    }
-
-    private void reconnectAfterFail(FailCause lastFailCauseCode, String reason, int retryOverride) {
-        if (mState == DctConstants.State.FAILED) {
-            /**
-             * For now With CDMA we never try to reconnect on
-             * error and instead just continue to retry
-             * at the last time until the state is changed.
-             * TODO: Make this configurable?
-             */
-            int nextReconnectDelay = retryOverride;
-            if (nextReconnectDelay < 0) {
-                nextReconnectDelay = mDataConnections.get(0).getRetryTimer();
-                mDataConnections.get(0).increaseRetryCount();
-            }
-            startAlarmForReconnect(nextReconnectDelay, reason);
-
-            if (!shouldPostNotification(lastFailCauseCode)) {
-                log("NOT Posting Data Connection Unavailable notification "
-                                + "-- likely transient error");
-            } else {
-                notifyNoData(lastFailCauseCode);
-            }
-        }
-    }
-
-    private void startAlarmForReconnect(int delay, String reason) {
-
-        log("Data Connection activate failed. Scheduling next attempt for "
-                + (delay / 1000) + "s");
-
-        AlarmManager am =
-            (AlarmManager) mPhone.getContext().getSystemService(Context.ALARM_SERVICE);
-        Intent intent = new Intent(INTENT_RECONNECT_ALARM);
-        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON, reason);
-        mReconnectIntent = PendingIntent.getBroadcast(
-                mPhone.getContext(), 0, intent, 0);
-        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
-                SystemClock.elapsedRealtime() + delay, mReconnectIntent);
-
-    }
-
-    private void notifyNoData(FailCause lastFailCauseCode) {
-        setState(DctConstants.State.FAILED);
-        notifyOffApnsOfAvailability(null);
-    }
-
-    protected void gotoIdleAndNotifyDataConnection(String reason) {
-        if (DBG) log("gotoIdleAndNotifyDataConnection: reason=" + reason);
-        setState(DctConstants.State.IDLE);
-        notifyDataConnection(reason);
-        mActiveApn = null;
-    }
-
-    protected void onRecordsLoaded() {
-        if (mState == DctConstants.State.FAILED) {
-            cleanUpAllConnections(null);
-        }
-        sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, Phone.REASON_SIM_LOADED));
-    }
-
-    protected void onNVReady() {
-        if (mState == DctConstants.State.FAILED) {
-            cleanUpAllConnections(null);
-        }
-        sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA));
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onEnableNewApn() {
-        // No mRequestedApnType check; only one connection is supported
-        cleanUpConnection(true, Phone.REASON_APN_SWITCHED, false);
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected boolean onTrySetupData(String reason) {
-        return trySetupData(reason);
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onRoamingOff() {
-        if (mUserDataEnabled == false) return;
-
-        if (getDataOnRoamingEnabled() == false) {
-            notifyOffApnsOfAvailability(Phone.REASON_ROAMING_OFF);
-            trySetupData(Phone.REASON_ROAMING_OFF);
-        } else {
-            notifyDataConnection(Phone.REASON_ROAMING_OFF);
-        }
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onRoamingOn() {
-        if (mUserDataEnabled == false) return;
-
-        if (getDataOnRoamingEnabled()) {
-            trySetupData(Phone.REASON_ROAMING_ON);
-            notifyDataConnection(Phone.REASON_ROAMING_ON);
-        } else {
-            if (DBG) log("Tear down data connection on roaming.");
-            cleanUpAllConnections(null);
-            notifyOffApnsOfAvailability(Phone.REASON_ROAMING_ON);
-        }
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onRadioAvailable() {
-        if (mPhone.getSimulatedRadioControl() != null) {
-            // Assume data is connected on the simulator
-            // FIXME  this can be improved
-            setState(DctConstants.State.CONNECTED);
-            notifyDataConnection(null);
-
-            log("We're on the simulator; assuming data is connected");
-        }
-
-        notifyOffApnsOfAvailability(null);
-
-        if (mState != DctConstants.State.IDLE) {
-            cleanUpAllConnections(null);
-        }
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onRadioOffOrNotAvailable() {
-        mDataConnections.get(0).resetRetryCount();
-
-        if (mPhone.getSimulatedRadioControl() != null) {
-            // Assume data is connected on the simulator
-            // FIXME  this can be improved
-            log("We're on the simulator; assuming radio off is meaningless");
-        } else {
-            if (DBG) log("Radio is off and clean up all connection");
-            cleanUpAllConnections(null);
-        }
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onDataSetupComplete(AsyncResult ar) {
-        String reason = null;
-        if (ar.userObj instanceof String) {
-            reason = (String) ar.userObj;
-        }
-
-        if (isDataSetupCompleteOk(ar)) {
-            // Everything is setup
-            notifyDefaultData(reason);
-        } else {
-            FailCause cause = (FailCause) (ar.result);
-            if(DBG) log("Data Connection setup failed " + cause);
-
-            // No try for permanent failure
-            if (cause.isPermanentFail()) {
-                notifyNoData(cause);
-                return;
-            }
-
-            int retryOverride = -1;
-            if (ar.exception instanceof DataConnection.CallSetupException) {
-                retryOverride =
-                    ((DataConnection.CallSetupException)ar.exception).getRetryOverride();
-            }
-            if (retryOverride == RILConstants.MAX_INT) {
-                if (DBG) log("No retry is suggested.");
-            } else {
-                startDelayedRetry(cause, reason, retryOverride);
-            }
-        }
-    }
-
-    /**
-     * Called when DctConstants.EVENT_DISCONNECT_DONE is received.
-     */
-    @Override
-    protected void onDisconnectDone(int connId, AsyncResult ar) {
-        if(DBG) log("EVENT_DISCONNECT_DONE connId=" + connId);
-        String reason = null;
-        if (ar.userObj instanceof String) {
-            reason = (String) ar.userObj;
-        }
-        setState(DctConstants.State.IDLE);
-
-        // Since the pending request to turn off or restart radio will be processed here,
-        // remove the pending event to restart radio from the message queue.
-        if (mPendingRestartRadio) removeMessages(DctConstants.EVENT_RESTART_RADIO);
-
-        // Process the pending request to turn off radio in ServiceStateTracker first.
-        // If radio is turned off in ServiceStateTracker, ignore the pending event to restart radio.
-        CdmaServiceStateTracker ssTracker = mCdmaPhone.mSST;
-        if (ssTracker.processPendingRadioPowerOffAfterDataOff()) {
-            mPendingRestartRadio = false;
-        } else {
-            onRestartRadio();
-        }
-
-        notifyDataConnection(reason);
-        mActiveApn = null;
-        if (retryAfterDisconnected(reason)) {
-          // Wait a bit before trying, so we're not tying up RIL command channel.
-          startAlarmForReconnect(APN_DELAY_MILLIS, reason);
-      }
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onVoiceCallStarted() {
-        if (mState == DctConstants.State.CONNECTED &&
-                !mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed()) {
-            stopNetStatPoll();
-            stopDataStallAlarm();
-            notifyDataConnection(Phone.REASON_VOICE_CALL_STARTED);
-            notifyOffApnsOfAvailability(Phone.REASON_VOICE_CALL_STARTED);
-        }
-    }
-
-    /**
-     * @override com.android.internal.telephony.DataConnectionTracker
-     */
-    @Override
-    protected void onVoiceCallEnded() {
-        if (mState == DctConstants.State.CONNECTED) {
-            if (!mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed()) {
-                startNetStatPoll();
-                startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
-                notifyDataConnection(Phone.REASON_VOICE_CALL_ENDED);
-            } else {
-                // clean slate after call end.
-                resetPollStats();
-            }
-            notifyOffApnsOfAvailability(Phone.REASON_VOICE_CALL_ENDED);
-        } else {
-            mDataConnections.get(0).resetRetryCount();
-            // in case data setup was attempted when we were on a voice call
-            trySetupData(Phone.REASON_VOICE_CALL_ENDED);
-        }
-    }
-
-    @Override
-    protected void onCleanUpConnection(boolean tearDown, int apnId, String reason) {
-        // No apnId check; only one connection is supported
-        cleanUpConnection(tearDown, reason, (apnId == DctConstants.APN_DUN_ID));
-    }
-
-    @Override
-    protected void onCleanUpAllConnections(String cause) {
-        // Only one CDMA connection is supported
-        cleanUpConnection(true, cause, false);
-    }
-
-    private void createAllDataConnectionList() {
-        CdmaDataConnection dataConn;
-
-        String retryConfig = SystemProperties.get("ro.cdma.data_retry_config");
-        for (int i = 0; i < DATA_CONNECTION_POOL_SIZE; i++) {
-            RetryManager rm = new RetryManager();
-            if (!rm.configure(retryConfig)) {
-                if (!rm.configure(DEFAULT_DATA_RETRY_CONFIG)) {
-                    // Should never happen, log an error and default to a simple linear sequence.
-                    log("Could not configure using DEFAULT_DATA_RETRY_CONFIG="
-                            + DEFAULT_DATA_RETRY_CONFIG);
-                    rm.configure(20, 2000, 1000);
-                }
-            }
-
-            int id = mUniqueIdGenerator.getAndIncrement();
-            dataConn = CdmaDataConnection.makeDataConnection(mCdmaPhone, id, rm, this);
-            mDataConnections.put(id, dataConn);
-            DataConnectionAc dcac = new DataConnectionAc(dataConn, LOG_TAG);
-            int status = dcac.fullyConnectSync(mPhone.getContext(), this, dataConn.getHandler());
-            if (status == AsyncChannel.STATUS_SUCCESSFUL) {
-                log("Fully connected");
-                mDataConnectionAsyncChannels.put(dcac.dataConnection.getDataConnectionId(), dcac);
-            } else {
-                log("Could not connect to dcac.dataConnection=" + dcac.dataConnection +
-                        " status=" + status);
-            }
-
-        }
-    }
-
-    private void destroyAllDataConnectionList() {
-        if(mDataConnections != null) {
-            mDataConnections.clear();
-        }
-    }
-
-    private void onCdmaDataDetached() {
-        if (mState == DctConstants.State.CONNECTED) {
-            startNetStatPoll();
-            startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
-            notifyDataConnection(Phone.REASON_CDMA_DATA_DETACHED);
-        } else {
-            if (mState == DctConstants.State.FAILED) {
-                cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED, false);
-                mDataConnections.get(0).resetRetryCount();
-
-                CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation());
-                EventLog.writeEvent(EventLogTags.CDMA_DATA_SETUP_FAILED,
-                        loc != null ? loc.getBaseStationId() : -1,
-                        TelephonyManager.getDefault().getNetworkType());
-            }
-            trySetupData(Phone.REASON_CDMA_DATA_DETACHED);
-        }
-    }
-
-    private void onCdmaOtaProvision(AsyncResult ar) {
-        if (ar.exception != null) {
-            int [] otaPrivision = (int [])ar.result;
-            if ((otaPrivision != null) && (otaPrivision.length > 1)) {
-                switch (otaPrivision[0]) {
-                case Phone.CDMA_OTA_PROVISION_STATUS_COMMITTED:
-                case Phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED:
-                    mDataConnections.get(0).resetRetryCount();
-                    break;
-                default:
-                    break;
-                }
-            }
-        }
-    }
-
-    private void onRestartRadio() {
-        if (mPendingRestartRadio) {
-            log("************TURN OFF RADIO**************");
-            mPhone.mCM.setRadioPower(false, null);
-            /* Note: no need to call setRadioPower(true).  Assuming the desired
-             * radio power state is still ON (as tracked by ServiceStateTracker),
-             * ServiceStateTracker will call setRadioPower when it receives the
-             * RADIO_STATE_CHANGED notification for the power off.  And if the
-             * desired power state has changed in the interim, we don't want to
-             * override it with an unconditional power on.
-             */
-            mPendingRestartRadio = false;
-        }
-    }
-
-    private void writeEventLogCdmaDataDrop() {
-        CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation());
-        EventLog.writeEvent(EventLogTags.CDMA_DATA_DROP,
-                loc != null ? loc.getBaseStationId() : -1,
-                TelephonyManager.getDefault().getNetworkType());
-    }
-
-    protected void onDataStateChanged(AsyncResult ar) {
-        ArrayList<DataCallState> dataCallStates = (ArrayList<DataCallState>)(ar.result);
-
-        if (ar.exception != null) {
-            // This is probably "radio not available" or something
-            // of that sort. If so, the whole connection is going
-            // to come down soon anyway
-            return;
-        }
-
-        if (mState == DctConstants.State.CONNECTED) {
-            boolean isActiveOrDormantConnectionPresent = false;
-            int connectionState = DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE;
-
-            // Check for an active or dormant connection element in
-            // the DATA_CALL_LIST array
-            for (int index = 0; index < dataCallStates.size(); index++) {
-                connectionState = dataCallStates.get(index).active;
-                if (connectionState != DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE) {
-                    isActiveOrDormantConnectionPresent = true;
-                    break;
-                }
-            }
-
-            if (!isActiveOrDormantConnectionPresent) {
-                // No active or dormant connection
-                log("onDataStateChanged: No active connection"
-                        + "state is CONNECTED, disconnecting/cleanup");
-                writeEventLogCdmaDataDrop();
-                cleanUpConnection(true, null, false);
-                return;
-            }
-
-            switch (connectionState) {
-                case DATA_CONNECTION_ACTIVE_PH_LINK_UP:
-                    log("onDataStateChanged: active=LINK_ACTIVE && CONNECTED, ignore");
-                    mActivity = DctConstants.Activity.NONE;
-                    mPhone.notifyDataActivity();
-                    startNetStatPoll();
-                    startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
-                    break;
-
-                case DATA_CONNECTION_ACTIVE_PH_LINK_DOWN:
-                    log("onDataStateChanged active=LINK_DOWN && CONNECTED, dormant");
-                    mActivity = DctConstants.Activity.DORMANT;
-                    mPhone.notifyDataActivity();
-                    stopNetStatPoll();
-                    stopDataStallAlarm();
-                    break;
-
-                default:
-                    log("onDataStateChanged: IGNORE unexpected DataCallState.active="
-                            + connectionState);
-            }
-        } else {
-            // TODO: Do we need to do anything?
-            log("onDataStateChanged: not connected, state=" + mState + " ignoring");
-        }
-    }
-
-    private void startDelayedRetry(FailCause cause, String reason, int retryOverride) {
-        notifyNoData(cause);
-        reconnectAfterFail(cause, reason, retryOverride);
-    }
-
-    @Override
-    public void handleMessage (Message msg) {
-        if (DBG) log("CdmaDCT handleMessage msg=" + msg);
-
-        if (!mPhone.mIsTheCurrentActivePhone || mIsDisposed) {
-            log("Ignore CDMA msgs since CDMA phone is inactive");
-            return;
-        }
-
-        switch (msg.what) {
-            case DctConstants.EVENT_RECORDS_LOADED:
-                onRecordsLoaded();
-                break;
-
-            case DctConstants.EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED:
-                if(mCdmaSSM.getCdmaSubscriptionSource() ==
-                       CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_NV) {
-                    onNVReady();
-                }
-                break;
-
-            case DctConstants.EVENT_CDMA_DATA_DETACHED:
-                onCdmaDataDetached();
-                break;
-
-            case DctConstants.EVENT_DATA_STATE_CHANGED:
-                onDataStateChanged((AsyncResult) msg.obj);
-                break;
-
-            case DctConstants.EVENT_CDMA_OTA_PROVISION:
-                onCdmaOtaProvision((AsyncResult) msg.obj);
-                break;
-
-            case DctConstants.EVENT_RESTART_RADIO:
-                if (DBG) log("EVENT_RESTART_RADIO");
-                onRestartRadio();
-                break;
-
-            default:
-                // handle the message in the super class DataConnectionTracker
-                super.handleMessage(msg);
-                break;
-        }
-    }
-
-    @Override
-    protected void onUpdateIcc() {
-        if (mUiccController == null ) {
-            return;
-        }
-
-        IccRecords newIccRecords = mUiccController.getIccRecords(UiccController.APP_FAM_3GPP2);
-
-        IccRecords r = mIccRecords.get();
-        if (r != newIccRecords) {
-            if (r != null) {
-                log("Removing stale icc objects.");
-                r.unregisterForRecordsLoaded(this);
-                mIccRecords.set(null);
-            }
-            if (newIccRecords != null) {
-                log("New records found");
-                mIccRecords.set(newIccRecords);
-                newIccRecords.registerForRecordsLoaded(
-                        this, DctConstants.EVENT_RECORDS_LOADED, null);
-            }
-        }
-    }
-
-    @Override
-    public boolean isDisconnected() {
-        return ((mState == DctConstants.State.IDLE) || (mState == DctConstants.State.FAILED));
-    }
-
-    @Override
-    protected boolean isConnected() {
-        return (mState == DctConstants.State.CONNECTED);
-    }
-
-    @Override
-    protected void log(String s) {
-        Rlog.d(LOG_TAG, "[CdmaDCT] " + s);
-    }
-
-    @Override
-    protected void loge(String s) {
-        Rlog.e(LOG_TAG, "[CdmaDCT] " + s);
-    }
-
-    @Override
-    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-        pw.println("CdmaDataConnectionTracker extends:");
-        super.dump(fd, pw, args);
-        pw.println(" mCdmaPhone=" + mCdmaPhone);
-        pw.println(" mCdmaSSM=" + mCdmaSSM);
-        pw.println(" mPendingDataConnection=" + mPendingDataConnection);
-        pw.println(" mPendingRestartRadio=" + mPendingRestartRadio);
-        pw.println(" mSupportedApnTypes=" + mSupportedApnTypes);
-        pw.println(" mDefaultApnTypes=" + mDefaultApnTypes);
-        pw.println(" mDunApnTypes=" + mDunApnTypes);
-        pw.println(" mDefaultApnId=" + mDefaultApnId);
-    }
-}
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java b/src/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java
index ce6530a..981dec6 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java
@@ -15,7 +15,7 @@
  */
 
 package com.android.internal.telephony.cdma;
-import static com.android.internal.telephony.RILConstants.*;
+
 import android.os.Parcel;
 
 public final class CdmaInformationRecords {
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
index 9a84303..c3f3b31 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -16,12 +16,11 @@
 
 package com.android.internal.telephony.cdma;
 
-import com.android.internal.telephony.PhoneBase;
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.telephony.MccTable;
 import com.android.internal.telephony.EventLogTags;
-import com.android.internal.telephony.RILConstants;
-import com.android.internal.telephony.IccCard;
+import com.android.internal.telephony.uicc.RuimRecords;
+import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
 
 import android.telephony.CellInfo;
 import android.telephony.CellInfoLte;
@@ -36,15 +35,9 @@
 import android.os.SystemClock;
 import android.os.SystemProperties;
 
-import android.text.TextUtils;
 import android.telephony.Rlog;
 import android.util.EventLog;
 
-import com.android.internal.telephony.gsm.GsmDataConnectionTracker;
-import com.android.internal.telephony.uicc.RuimRecords;
-import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
-import com.android.internal.telephony.IccCardConstants;
-
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -54,8 +47,6 @@
     private CDMALTEPhone mCdmaLtePhone;
     private final CellInfoLte mCellInfoLte;
 
-    private ServiceState  mLteSS;  // The last LTE state from Voice Registration
-
     private CellIdentityLte mNewCellIdentityLte = new CellIdentityLte();
     private CellIdentityLte mLasteCellIdentityLte = new CellIdentityLte();
 
@@ -64,7 +55,6 @@
         mCdmaLtePhone = phone;
         mCellInfoLte = (CellInfoLte) mCellInfo;
 
-        mLteSS = new ServiceState();
         ((CellInfoLte)mCellInfo).setCellSignalStrength(new CellSignalStrengthLte());
         ((CellInfoLte)mCellInfo).setCellIdentity(new CellIdentityLte());
 
@@ -88,7 +78,7 @@
                 mMdn = ruim.getMdn();
                 mMin = ruim.getMin();
                 parseSidNid(ruim.getSid(), ruim.getNid());
-                mPrlVersion = ruim.getPrlVersion();;
+                mPrlVersion = ruim.getPrlVersion();
                 mIsMinInfoReady = true;
                 updateOtaspState();
             }
@@ -103,16 +93,6 @@
     }
 
     /**
-     * Set the cdmaSS for EVENT_POLL_STATE_REGISTRATION_CDMA
-     */
-    @Override
-    protected void setCdmaTechnology(int radioTechnology) {
-        // Called on voice registration state response.
-        // Just record new CDMA radio technology
-        newSS.setRadioTechnology(radioTechnology);
-    }
-
-    /**
      * Handle the result of one of the pollState()-related requests
      */
     @Override
@@ -148,11 +128,11 @@
                     String operatorNumeric = null;
 
                     try {
-                        operatorNumeric = mLteSS.getOperatorNumeric();
+                        operatorNumeric = mNewSS.getOperatorNumeric();
                         mcc = Integer.parseInt(operatorNumeric.substring(0,3));
                     } catch (Exception e) {
                         try {
-                            operatorNumeric = ss.getOperatorNumeric();
+                            operatorNumeric = mSS.getOperatorNumeric();
                             mcc = Integer.parseInt(operatorNumeric.substring(0,3));
                         } catch (Exception ex) {
                             loge("handlePollStateResultMessage: bad mcc operatorNumeric=" +
@@ -208,8 +188,14 @@
                 }
             }
 
-            mLteSS.setRadioTechnology(type);
-            mLteSS.setState(regCodeToServiceState(regState));
+            mNewSS.setRilDataRadioTechnology(type);
+            int dataRegState = regCodeToServiceState(regState);
+            mNewSS.setDataRegState(dataRegState);
+            if (DBG) {
+                log("handlPollStateResultMessage: CdmaLteSST setDataRegState=" + dataRegState
+                        + " regState=" + regState
+                        + " dataRadioTechnology=" + type);
+            }
         } else {
             super.handlePollStateResultMessage(what, ar);
         }
@@ -217,14 +203,13 @@
 
     @Override
     protected void pollState() {
-        pollingContext = new int[1];
-        pollingContext[0] = 0;
+        mPollingContext = new int[1];
+        mPollingContext[0] = 0;
 
-        switch (cm.getRadioState()) {
+        switch (mCi.getRadioState()) {
             case RADIO_UNAVAILABLE:
-                newSS.setStateOutOfService();
-                mLteSS.setStateOutOfService();
-                newCellLoc.setStateInvalid();
+                mNewSS.setStateOutOfService();
+                mNewCellLoc.setStateInvalid();
                 setSignalStrengthDefaultValues();
                 mGotCountryCode = false;
 
@@ -232,9 +217,8 @@
                 break;
 
             case RADIO_OFF:
-                newSS.setStateOff();
-                mLteSS.setStateOff();
-                newCellLoc.setStateInvalid();
+                mNewSS.setStateOff();
+                mNewCellLoc.setStateInvalid();
                 setSignalStrengthDefaultValues();
                 mGotCountryCode = false;
 
@@ -246,107 +230,74 @@
                 // down the responses which are allowed to arrive
                 // out-of-order.
 
-                pollingContext[0]++;
+                mPollingContext[0]++;
                 // RIL_REQUEST_OPERATOR is necessary for CDMA
-                cm.getOperator(obtainMessage(EVENT_POLL_STATE_OPERATOR_CDMA, pollingContext));
+                mCi.getOperator(obtainMessage(EVENT_POLL_STATE_OPERATOR_CDMA, mPollingContext));
 
-                pollingContext[0]++;
+                mPollingContext[0]++;
                 // RIL_REQUEST_VOICE_REGISTRATION_STATE is necessary for CDMA
-                cm.getVoiceRegistrationState(obtainMessage(EVENT_POLL_STATE_REGISTRATION_CDMA,
-                        pollingContext));
+                mCi.getVoiceRegistrationState(obtainMessage(EVENT_POLL_STATE_REGISTRATION_CDMA,
+                        mPollingContext));
 
-                pollingContext[0]++;
+                mPollingContext[0]++;
                 // RIL_REQUEST_DATA_REGISTRATION_STATE
-                cm.getDataRegistrationState(obtainMessage(EVENT_POLL_STATE_GPRS,
-                                            pollingContext));
+                mCi.getDataRegistrationState(obtainMessage(EVENT_POLL_STATE_GPRS,
+                                            mPollingContext));
                 break;
         }
     }
 
     @Override
     protected void pollStateDone() {
-        // determine data RadioTechnology from both LET and CDMA SS
-        if (mLteSS.getState() == ServiceState.STATE_IN_SERVICE) {
-            //in LTE service
-            mNewRilRadioTechnology = mLteSS.getRilRadioTechnology();
-            mNewDataConnectionState = mLteSS.getState();
-            newSS.setRadioTechnology(mNewRilRadioTechnology);
-            log("pollStateDone LTE/eHRPD STATE_IN_SERVICE mNewRilRadioTechnology = " +
-                    mNewRilRadioTechnology);
-        } else {
-            // LTE out of service, get CDMA Service State
-            mNewRilRadioTechnology = newSS.getRilRadioTechnology();
-            mNewDataConnectionState = radioTechnologyToDataServiceState(mNewRilRadioTechnology);
-            log("pollStateDone CDMA STATE_IN_SERVICE mNewRilRadioTechnology = " +
-                    mNewRilRadioTechnology + " mNewDataConnectionState = " +
-                    mNewDataConnectionState);
-        }
+        log("pollStateDone: lte 1 ss=[" + mSS + "] newSS=[" + mNewSS + "]");
 
-        // TODO: Add proper support for LTE Only, we should be looking at
-        //       the preferred network mode, to know when newSS state should
-        //       be coming from mLteSs state. This was needed to pass a VZW
-        //       LTE Only test.
-        //
-        // If CDMA service is OOS, double check if the device is running with LTE only
-        // mode. If that is the case, derive the service state from LTE side.
-        // To set in LTE only mode, sqlite3 /data/data/com.android.providers.settings/
-        // databases/settings.db "update secure set value='11' where name='preferred_network_mode'"
-        if (newSS.getState() == ServiceState.STATE_OUT_OF_SERVICE) {
-            int networkMode = android.provider.Settings.Global.getInt(phone.getContext()
-                                  .getContentResolver(),
-                                  android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
-                                  RILConstants.PREFERRED_NETWORK_MODE);
-            if (networkMode == RILConstants.NETWORK_MODE_LTE_ONLY) {
-                if (DBG) log("pollState: LTE Only mode");
-                newSS.setState(mLteSS.getState());
-            }
-        }
+        boolean hasRegistered = mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
+                && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
 
-        if (DBG) log("pollStateDone: oldSS=[" + ss + "] newSS=[" + newSS + "]");
-
-        boolean hasRegistered = ss.getState() != ServiceState.STATE_IN_SERVICE
-                && newSS.getState() == ServiceState.STATE_IN_SERVICE;
-
-        boolean hasDeregistered = ss.getState() == ServiceState.STATE_IN_SERVICE
-                && newSS.getState() != ServiceState.STATE_IN_SERVICE;
+        boolean hasDeregistered = mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE
+                && mNewSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE;
 
         boolean hasCdmaDataConnectionAttached =
-            mDataConnectionState != ServiceState.STATE_IN_SERVICE
-                && mNewDataConnectionState == ServiceState.STATE_IN_SERVICE;
+            mSS.getDataRegState() != ServiceState.STATE_IN_SERVICE
+                && mNewSS.getDataRegState() == ServiceState.STATE_IN_SERVICE;
 
         boolean hasCdmaDataConnectionDetached =
-            mDataConnectionState == ServiceState.STATE_IN_SERVICE
-                && mNewDataConnectionState != ServiceState.STATE_IN_SERVICE;
+                mSS.getDataRegState() == ServiceState.STATE_IN_SERVICE
+                && mNewSS.getDataRegState() != ServiceState.STATE_IN_SERVICE;
 
         boolean hasCdmaDataConnectionChanged =
-            mDataConnectionState != mNewDataConnectionState;
+            mSS.getDataRegState() != mNewSS.getDataRegState();
 
-        boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
+        boolean hasVoiceRadioTechnologyChanged = mSS.getRilVoiceRadioTechnology()
+                != mNewSS.getRilVoiceRadioTechnology();
 
-        boolean hasChanged = !newSS.equals(ss);
+        boolean hasDataRadioTechnologyChanged = mSS.getRilDataRadioTechnology()
+                != mNewSS.getRilDataRadioTechnology();
 
-        boolean hasRoamingOn = !ss.getRoaming() && newSS.getRoaming();
+        boolean hasChanged = !mNewSS.equals(mSS);
 
-        boolean hasRoamingOff = ss.getRoaming() && !newSS.getRoaming();
+        boolean hasRoamingOn = !mSS.getRoaming() && mNewSS.getRoaming();
 
-        boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
+        boolean hasRoamingOff = mSS.getRoaming() && !mNewSS.getRoaming();
+
+        boolean hasLocationChanged = !mNewCellLoc.equals(mCellLoc);
 
         boolean has4gHandoff =
-                mNewDataConnectionState == ServiceState.STATE_IN_SERVICE &&
-                (((mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
-                  (mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) ||
-                 ((mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD) &&
-                  (mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE)));
+                mNewSS.getDataRegState() == ServiceState.STATE_IN_SERVICE &&
+                (((mSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
+                  (mNewSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) ||
+                 ((mSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD) &&
+                  (mNewSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE)));
 
         boolean hasMultiApnSupport =
-                (((mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) ||
-                  (mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) &&
-                 ((mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
-                  (mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)));
+                (((mNewSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) ||
+                  (mNewSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) &&
+                 ((mSS.getRilDataRadioTechnology() != ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
+                  (mSS.getRilDataRadioTechnology() != ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)));
 
         boolean hasLostMultiApnSupport =
-            ((mNewRilRadioTechnology >= ServiceState.RIL_RADIO_TECHNOLOGY_IS95A) &&
-             (mNewRilRadioTechnology <= ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A));
+            ((mNewSS.getRilDataRadioTechnology() >= ServiceState.RIL_RADIO_TECHNOLOGY_IS95A) &&
+             (mNewSS.getRilDataRadioTechnology() <= ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A));
 
         if (DBG) {
             log("pollStateDone:"
@@ -355,7 +306,8 @@
                 + " hasCdmaDataConnectionAttached=" + hasCdmaDataConnectionAttached
                 + " hasCdmaDataConnectionDetached=" + hasCdmaDataConnectionDetached
                 + " hasCdmaDataConnectionChanged=" + hasCdmaDataConnectionChanged
-                + " hasRadioTechnologyChanged = " + hasRadioTechnologyChanged
+                + " hasVoiceRadioTechnologyChanged= " + hasVoiceRadioTechnologyChanged
+                + " hasDataRadioTechnologyChanged=" + hasDataRadioTechnologyChanged
                 + " hasChanged=" + hasChanged
                 + " hasRoamingOn=" + hasRoamingOn
                 + " hasRoamingOff=" + hasRoamingOff
@@ -365,47 +317,28 @@
                 + " hasLostMultiApnSupport=" + hasLostMultiApnSupport);
         }
         // Add an event log when connection state changes
-        if (ss.getState() != newSS.getState()
-                || mDataConnectionState != mNewDataConnectionState) {
-            EventLog.writeEvent(EventLogTags.CDMA_SERVICE_STATE_CHANGE, ss.getState(),
-                    mDataConnectionState, newSS.getState(), mNewDataConnectionState);
+        if (mSS.getVoiceRegState() != mNewSS.getVoiceRegState()
+                || mSS.getDataRegState() != mNewSS.getDataRegState()) {
+            EventLog.writeEvent(EventLogTags.CDMA_SERVICE_STATE_CHANGE, mSS.getVoiceRegState(),
+                    mSS.getDataRegState(), mNewSS.getVoiceRegState(), mNewSS.getDataRegState());
         }
 
         ServiceState tss;
-        tss = ss;
-        ss = newSS;
-        newSS = tss;
+        tss = mSS;
+        mSS = mNewSS;
+        mNewSS = tss;
         // clean slate for next time
-        newSS.setStateOutOfService();
-        mLteSS.setStateOutOfService();
+        mNewSS.setStateOutOfService();
 
-        if ((hasMultiApnSupport)
-                && (phone.mDataConnectionTracker instanceof CdmaDataConnectionTracker)) {
-            if (DBG) log("GsmDataConnectionTracker Created");
-            phone.mDataConnectionTracker.dispose();
-            phone.mDataConnectionTracker = new GsmDataConnectionTracker(mCdmaLtePhone);
-        }
+        CdmaCellLocation tcl = mCellLoc;
+        mCellLoc = mNewCellLoc;
+        mNewCellLoc = tcl;
 
-        if ((hasLostMultiApnSupport)
-                && (phone.mDataConnectionTracker instanceof GsmDataConnectionTracker)) {
-            if (DBG)log("GsmDataConnectionTracker disposed");
-            phone.mDataConnectionTracker.dispose();
-            phone.mDataConnectionTracker = new CdmaDataConnectionTracker(phone);
-        }
+        mNewSS.setStateOutOfService(); // clean slate for next time
 
-        CdmaCellLocation tcl = cellLoc;
-        cellLoc = newCellLoc;
-        newCellLoc = tcl;
-
-        mDataConnectionState = mNewDataConnectionState;
-        mRilRadioTechnology = mNewRilRadioTechnology;
-        mNewRilRadioTechnology = 0;
-
-        newSS.setStateOutOfService(); // clean slate for next time
-
-        if (hasRadioTechnologyChanged) {
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
-                    ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
+        if (hasVoiceRadioTechnologyChanged) {
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
+                    ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology()));
         }
 
         if (hasRegistered) {
@@ -413,13 +346,13 @@
         }
 
         if (hasChanged) {
-            if (phone.isEriFileLoaded()) {
+            if (mPhone.isEriFileLoaded()) {
                 String eriText;
                 // Now the CDMAPhone sees the new ServiceState so it can get the
                 // new ERI text
-                if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
-                    eriText = phone.getCdmaEriText();
-                } else if (ss.getState() == ServiceState.STATE_POWER_OFF) {
+                if (mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) {
+                    eriText = mPhone.getCdmaEriText();
+                } else if (mSS.getVoiceRegState() == ServiceState.STATE_POWER_OFF) {
                     eriText = (mIccRecords != null) ? mIccRecords.getServiceProviderName() : null;
                     if (TextUtils.isEmpty(eriText)) {
                         // Sets operator alpha property by retrieving from
@@ -429,40 +362,40 @@
                 } else {
                     // Note that ServiceState.STATE_OUT_OF_SERVICE is valid used
                     // for mRegistrationState 0,2,3 and 4
-                    eriText = phone.getContext()
+                    eriText = mPhone.getContext()
                             .getText(com.android.internal.R.string.roamingTextSearching).toString();
                 }
-                ss.setOperatorAlphaLong(eriText);
+                mSS.setOperatorAlphaLong(eriText);
             }
 
             if (mUiccApplcation != null && mUiccApplcation.getState() == AppState.APPSTATE_READY &&
                     mIccRecords != null) {
                 // SIM is found on the device. If ERI roaming is OFF, and SID/NID matches
-                // one configfured in SIM, use operator name  from CSIM record.
+                // one configured in SIM, use operator name  from CSIM record.
                 boolean showSpn =
                     ((RuimRecords)mIccRecords).getCsimSpnDisplayCondition();
-                int iconIndex = ss.getCdmaEriIconIndex();
+                int iconIndex = mSS.getCdmaEriIconIndex();
 
                 if (showSpn && (iconIndex == EriInfo.ROAMING_INDICATOR_OFF) &&
-                    isInHomeSidNid(ss.getSystemId(), ss.getNetworkId()) &&
+                    isInHomeSidNid(mSS.getSystemId(), mSS.getNetworkId()) &&
                     mIccRecords != null) {
-                    ss.setOperatorAlphaLong(mIccRecords.getServiceProviderName());
+                    mSS.setOperatorAlphaLong(mIccRecords.getServiceProviderName());
                 }
             }
 
             String operatorNumeric;
 
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
-                    ss.getOperatorAlphaLong());
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
+                    mSS.getOperatorAlphaLong());
 
             String prevOperatorNumeric =
                     SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
-            operatorNumeric = ss.getOperatorNumeric();
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
+            operatorNumeric = mSS.getOperatorNumeric();
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
 
             if (operatorNumeric == null) {
                 if (DBG) log("operatorNumeric is null");
-                phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
+                mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
                 mGotCountryCode = false;
             } else {
                 String isoCountryCode = "";
@@ -476,21 +409,21 @@
                     loge("countryCodeForMcc error" + ex);
                 }
 
-                phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
+                mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
                         isoCountryCode);
                 mGotCountryCode = true;
 
-                if (shouldFixTimeZoneNow(phone, operatorNumeric, prevOperatorNumeric,
+                if (shouldFixTimeZoneNow(mPhone, operatorNumeric, prevOperatorNumeric,
                         mNeedFixZone)) {
                     fixTimeZone(isoCountryCode);
                 }
             }
 
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
-                    ss.getRoaming() ? "true" : "false");
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
+                    mSS.getRoaming() ? "true" : "false");
 
             updateSpnDisplay();
-            phone.notifyServiceStateChanged(ss);
+            mPhone.notifyServiceStateChanged(mSS);
         }
 
         if (hasCdmaDataConnectionAttached || has4gHandoff) {
@@ -501,8 +434,9 @@
             mDetachedRegistrants.notifyRegistrants();
         }
 
-        if ((hasCdmaDataConnectionChanged || hasRadioTechnologyChanged)) {
-            phone.notifyDataConnection(null);
+        if ((hasCdmaDataConnectionChanged || hasDataRadioTechnologyChanged)) {
+            log("pollStateDone: call notifyDataConnection");
+            mPhone.notifyDataConnection(null);
         }
 
         if (hasRoamingOn) {
@@ -514,7 +448,7 @@
         }
 
         if (hasLocationChanged) {
-            phone.notifyLocationChanged();
+            mPhone.notifyLocationChanged();
         }
 
         ArrayList<CellInfo> arrayCi = new ArrayList<CellInfo>();
@@ -525,7 +459,7 @@
             if (hasRegistered || hasDeregistered || cidChanged) {
                 // TODO: Handle the absence of LteCellIdentity
                 long timeStamp = SystemClock.elapsedRealtime() * 1000;
-                boolean registered = ss.getState() == ServiceState.STATE_IN_SERVICE;
+                boolean registered = mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
                 mLasteCellIdentityLte = mNewCellIdentityLte;
 
                 cil.setRegisterd(registered);
@@ -544,13 +478,13 @@
 
     @Override
     protected boolean onSignalStrengthResult(AsyncResult ar, boolean isGsm) {
-        if (mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
+        if (mSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
             isGsm = true;
         }
         boolean ssChanged = super.onSignalStrengthResult(ar, isGsm);
 
         synchronized (mCellInfo) {
-            if (mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
+            if (mSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
                 mCellInfoLte.setTimeStamp(SystemClock.elapsedRealtime() * 1000);
                 mCellInfoLte.setTimeStampType(CellInfo.TIMESTAMP_TYPE_JAVA_RIL);
                 mCellInfoLte.getCellSignalStrength()
@@ -567,11 +501,11 @@
 
     @Override
     public boolean isConcurrentVoiceAndDataAllowed() {
-        // For non-LTE, look at the CSS indicator to check on SV capability
-        if (mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
+        // For non-LTE, look at the CSS indicator to check on Concurrent V & D capability
+        if (mSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
             return true;
         } else {
-            return ss.getCssIndicator() == 1;
+            return mSS.getCssIndicator() == 1;
         }
     }
 
@@ -632,6 +566,5 @@
         pw.println("CdmaLteServiceStateTracker extends:");
         super.dump(fd, pw, args);
         pw.println(" mCdmaLtePhone=" + mCdmaLtePhone);
-        pw.println(" mLteSS=" + mLteSS);
     }
 }
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java b/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java
index eaf5d01..4c58709 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java
@@ -36,7 +36,7 @@
  *
  */
 public final class CdmaMmiCode  extends Handler implements MmiCode {
-    static final String LOG_TAG = "CDMA_MMI";
+    static final String LOG_TAG = "CdmaMmiCode";
 
     // Constants
 
@@ -52,18 +52,18 @@
 
     // Instance Variables
 
-    CDMAPhone phone;
-    Context context;
+    CDMAPhone mPhone;
+    Context mContext;
 
-    String action;              // ACTION_REGISTER
-    String sc;                  // Service Code
-    String sia, sib, sic;       // Service Info a,b,c
-    String poundString;         // Entire MMI string up to and including #
-    String dialingNumber;
-    String pwd;                 // For password registration
+    String mAction;              // ACTION_REGISTER
+    String mSc;                  // Service Code
+    String mSia, mSib, mSic;     // Service Info a,b,c
+    String mPoundString;         // Entire MMI string up to and including #
+    String mDialingNumber;
+    String mPwd;                 // For password registration
 
-    State state = State.PENDING;
-    CharSequence message;
+    State mState = State.PENDING;
+    CharSequence mMessage;
 
     // Class Variables
 
@@ -107,14 +107,14 @@
         // Is this formatted like a standard supplementary service code?
         if (m.matches()) {
             ret = new CdmaMmiCode(phone);
-            ret.poundString = makeEmptyNull(m.group(MATCH_GROUP_POUND_STRING));
-            ret.action = makeEmptyNull(m.group(MATCH_GROUP_ACTION));
-            ret.sc = makeEmptyNull(m.group(MATCH_GROUP_SERVICE_CODE));
-            ret.sia = makeEmptyNull(m.group(MATCH_GROUP_SIA));
-            ret.sib = makeEmptyNull(m.group(MATCH_GROUP_SIB));
-            ret.sic = makeEmptyNull(m.group(MATCH_GROUP_SIC));
-            ret.pwd = makeEmptyNull(m.group(MATCH_GROUP_PWD_CONFIRM));
-            ret.dialingNumber = makeEmptyNull(m.group(MATCH_GROUP_DIALING_NUMBER));
+            ret.mPoundString = makeEmptyNull(m.group(MATCH_GROUP_POUND_STRING));
+            ret.mAction = makeEmptyNull(m.group(MATCH_GROUP_ACTION));
+            ret.mSc = makeEmptyNull(m.group(MATCH_GROUP_SERVICE_CODE));
+            ret.mSia = makeEmptyNull(m.group(MATCH_GROUP_SIA));
+            ret.mSib = makeEmptyNull(m.group(MATCH_GROUP_SIB));
+            ret.mSic = makeEmptyNull(m.group(MATCH_GROUP_SIC));
+            ret.mPwd = makeEmptyNull(m.group(MATCH_GROUP_PWD_CONFIRM));
+            ret.mDialingNumber = makeEmptyNull(m.group(MATCH_GROUP_DIALING_NUMBER));
 
         }
 
@@ -137,34 +137,38 @@
 
     CdmaMmiCode (CDMAPhone phone) {
         super(phone.getHandler().getLooper());
-        this.phone = phone;
-        this.context = phone.getContext();
+        mPhone = phone;
+        mContext = phone.getContext();
     }
 
     // MmiCode implementation
 
+    @Override
     public State
     getState() {
-        return state;
+        return mState;
     }
 
+    @Override
     public CharSequence
     getMessage() {
-        return message;
+        return mMessage;
     }
 
     // inherited javadoc suffices
+    @Override
     public void
     cancel() {
         // Complete or failed cannot be cancelled
-        if (state == State.COMPLETE || state == State.FAILED) {
+        if (mState == State.COMPLETE || mState == State.FAILED) {
             return;
         }
 
-        state = State.CANCELLED;
-        phone.onMMIDone (this);
+        mState = State.CANCELLED;
+        mPhone.onMMIDone (this);
     }
 
+    @Override
     public boolean isCancelable() {
         return false;
     }
@@ -175,13 +179,14 @@
      * @return true if the Service Code is PIN/PIN2/PUK/PUK2-related
      */
     boolean isPukCommand() {
-        return sc != null && sc.equals(SC_PUK);
+        return mSc != null && mSc.equals(SC_PUK);
      }
 
     boolean isRegister() {
-        return action != null && action.equals(ACTION_REGISTER);
+        return mAction != null && mAction.equals(ACTION_REGISTER);
     }
 
+    @Override
     public boolean isUssdRequest() {
         Rlog.w(LOG_TAG, "isUssdRequest is not implemented in CdmaMmiCode");
         return false;
@@ -195,18 +200,18 @@
                 // sia = old PUK
                 // sib = new PIN
                 // sic = new PIN
-                String oldPinOrPuk = sia;
-                String newPin = sib;
+                String oldPinOrPuk = mSia;
+                String newPin = mSib;
                 int pinLen = newPin.length();
                 if (isRegister()) {
-                    if (!newPin.equals(sic)) {
+                    if (!newPin.equals(mSic)) {
                         // password mismatch; return error
                         handlePasswordError(com.android.internal.R.string.mismatchPin);
                     } else if (pinLen < 4 || pinLen > 8 ) {
                         // invalid length
                         handlePasswordError(com.android.internal.R.string.invalidPin);
                     } else {
-                        phone.mCM.supplyIccPuk(oldPinOrPuk, newPin,
+                        mPhone.mCi.supplyIccPuk(oldPinOrPuk, newPin,
                                 obtainMessage(EVENT_SET_COMPLETE, this));
                     }
                 } else {
@@ -216,21 +221,22 @@
                 throw new RuntimeException ("Invalid or Unsupported MMI Code");
             }
         } catch (RuntimeException exc) {
-            state = State.FAILED;
-            message = context.getText(com.android.internal.R.string.mmiError);
-            phone.onMMIDone(this);
+            mState = State.FAILED;
+            mMessage = mContext.getText(com.android.internal.R.string.mmiError);
+            mPhone.onMMIDone(this);
         }
     }
 
     private void handlePasswordError(int res) {
-        state = State.FAILED;
+        mState = State.FAILED;
         StringBuilder sb = new StringBuilder(getScString());
         sb.append("\n");
-        sb.append(context.getText(res));
-        message = sb;
-        phone.onMMIDone(this);
+        sb.append(mContext.getText(res));
+        mMessage = sb;
+        mPhone.onMMIDone(this);
     }
 
+    @Override
     public void
     handleMessage (Message msg) {
         AsyncResult ar;
@@ -245,9 +251,9 @@
     // Private instance methods
 
     private CharSequence getScString() {
-        if (sc != null) {
+        if (mSc != null) {
             if (isPukCommand()) {
-                return context.getText(com.android.internal.R.string.PinMmi);
+                return mContext.getText(com.android.internal.R.string.PinMmi);
             }
         }
 
@@ -260,37 +266,37 @@
         sb.append("\n");
 
         if (ar.exception != null) {
-            state = State.FAILED;
+            mState = State.FAILED;
             if (ar.exception instanceof CommandException) {
                 CommandException.Error err = ((CommandException)(ar.exception)).getCommandError();
                 if (err == CommandException.Error.PASSWORD_INCORRECT) {
                     if (isPukCommand()) {
-                        sb.append(context.getText(
+                        sb.append(mContext.getText(
                                 com.android.internal.R.string.badPuk));
                     } else {
-                        sb.append(context.getText(
+                        sb.append(mContext.getText(
                                 com.android.internal.R.string.passwordIncorrect));
                     }
                 } else {
-                    sb.append(context.getText(
+                    sb.append(mContext.getText(
                             com.android.internal.R.string.mmiError));
                 }
             } else {
-                sb.append(context.getText(
+                sb.append(mContext.getText(
                         com.android.internal.R.string.mmiError));
             }
         } else if (isRegister()) {
-            state = State.COMPLETE;
-            sb.append(context.getText(
+            mState = State.COMPLETE;
+            sb.append(mContext.getText(
                     com.android.internal.R.string.serviceRegistered));
         } else {
-            state = State.FAILED;
-            sb.append(context.getText(
+            mState = State.FAILED;
+            sb.append(mContext.getText(
                     com.android.internal.R.string.mmiError));
         }
 
-        message = sb;
-        phone.onMMIDone(this);
+        mMessage = sb;
+        mPhone.onMMIDone(this);
     }
 
 }
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
index 8473113..fac36b0 100755
--- a/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -18,21 +18,18 @@
 
 
 import android.app.Activity;
+import android.app.AppOpsManager;
 import android.app.PendingIntent;
 import android.app.PendingIntent.CanceledException;
 import android.content.BroadcastReceiver;
-import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.res.Resources;
-import android.database.Cursor;
-import android.database.SQLException;
 import android.os.Bundle;
 import android.os.Message;
 import android.os.SystemProperties;
 import android.preference.PreferenceManager;
-import android.provider.Telephony;
 import android.provider.Telephony.Sms.Intents;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.SmsCbMessage;
@@ -65,7 +62,8 @@
 
 
 final class CdmaSMSDispatcher extends SMSDispatcher {
-    private static final String TAG = "CDMA";
+    private static final String TAG = "CdmaSMSDispatcher";
+    private static final boolean VDBG = false;
 
     private byte[] mLastDispatchedSmsFingerprint;
     private byte[] mLastAcknowledgedSmsFingerprint;
@@ -76,12 +74,12 @@
     CdmaSMSDispatcher(CDMAPhone phone, SmsStorageMonitor storageMonitor,
             SmsUsageMonitor usageMonitor) {
         super(phone, storageMonitor, usageMonitor);
-        mCm.setOnNewCdmaSms(this, EVENT_NEW_SMS, null);
+        mCi.setOnNewCdmaSms(this, EVENT_NEW_SMS, null);
     }
 
     @Override
     public void dispose() {
-        mCm.unSetOnNewCdmaSms(this);
+        mCi.unSetOnNewCdmaSms(this);
     }
 
     @Override
@@ -92,7 +90,7 @@
     private void handleCdmaStatusReport(SmsMessage sms) {
         for (int i = 0, count = deliveryPendingList.size(); i < count; i++) {
             SmsTracker tracker = deliveryPendingList.get(i);
-            if (tracker.mMessageRef == sms.messageRef) {
+            if (tracker.mMessageRef == sms.mMessageRef) {
                 // Found it.  Remove from list and broadcast.
                 deliveryPendingList.remove(i);
                 PendingIntent intent = tracker.mDeliveryIntent;
@@ -123,7 +121,7 @@
         Intent intent = new Intent(Intents.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION);
         intent.putExtra("sender", sms.getOriginatingAddress());
         intent.putParcelableArrayListExtra("program_data", programDataList);
-        dispatch(intent, RECEIVE_SMS_PERMISSION, mScpResultsReceiver);
+        dispatch(intent, RECEIVE_SMS_PERMISSION, AppOpsManager.OP_RECEIVE_SMS, mScpResultsReceiver);
     }
 
     /** {@inheritDoc} */
@@ -193,7 +191,7 @@
             handleServiceCategoryProgramData(sms);
             handled = true;
         } else if ((sms.getUserData() == null)) {
-            if (false) {
+            if (VDBG) {
                 Rlog.d(TAG, "Received SMS without user data");
             }
             handled = true;
@@ -212,7 +210,7 @@
         }
 
         if (SmsEnvelope.TELESERVICE_WAP == teleService) {
-            return processCdmaWapPdu(sms.getUserData(), sms.messageRef,
+            return processCdmaWapPdu(sms.getUserData(), sms.mMessageRef,
                     sms.getOriginatingAddress());
         }
 
@@ -234,7 +232,7 @@
      * WDP segments are gathered until a datagram completes and gets dispatched.
      *
      * @param pdu The WAP-WDP PDU segment
-     * @return a result code from {@link Telephony.Sms.Intents}, or
+     * @return a result code from {@link android.provider.Telephony.Sms.Intents}, or
      *         {@link Activity#RESULT_OK} if the message has been broadcast
      *         to applications
      */
@@ -343,7 +341,7 @@
                     sentIntent.send(SmsManager.RESULT_ERROR_NO_SERVICE);
                 } catch (CanceledException ex) {}
             }
-            if (false) {
+            if (VDBG) {
                 Rlog.d(TAG, "Block SMS in Emergency Callback mode");
             }
             return;
@@ -360,7 +358,7 @@
         byte pdu[] = (byte[]) map.get("pdu");
 
         Message reply = obtainMessage(EVENT_SEND_SMS_COMPLETE, tracker);
-        mCm.sendCdmaSms(pdu, reply);
+        mCi.sendCdmaSms(pdu, reply);
     }
 
     /** {@inheritDoc} */
@@ -372,7 +370,7 @@
         }
 
         int causeCode = resultToCause(result);
-        mCm.acknowledgeLastIncomingCdmaSms(success, causeCode, response);
+        mCi.acknowledgeLastIncomingCdmaSms(success, causeCode, response);
 
         if (causeCode == 0) {
             mLastAcknowledgedSmsFingerprint = mLastDispatchedSmsFingerprint;
@@ -490,7 +488,7 @@
                 dos.write(encodedBearerData.length);
                 dos.write(encodedBearerData, 0, encodedBearerData.length);
                 // Ignore the RIL response. TODO: implement retry if SMS send fails.
-                mCm.sendCdmaSms(baos.toByteArray(), null);
+                mCi.sendCdmaSms(baos.toByteArray(), null);
             } catch (IOException e) {
                 Rlog.e(TAG, "exception creating SCP results PDU", e);
             } finally {
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 5909ec2..70a7892 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -18,18 +18,15 @@
 
 import com.android.internal.telephony.CommandException;
 import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.DataConnectionTracker;
+import com.android.internal.telephony.dataconnection.DataConnectionTrackerBase;
 import com.android.internal.telephony.EventLogTags;
-import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.MccTable;
 import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.RILConstants;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.ServiceStateTracker;
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.telephony.CommandsInterface.RadioState;
-import com.android.internal.telephony.uicc.UiccCard;
 import com.android.internal.telephony.uicc.UiccCardApplication;
 import com.android.internal.telephony.uicc.UiccController;
 
@@ -48,7 +45,6 @@
 import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.provider.Settings;
-import android.provider.Settings.Secure;
 import android.provider.Settings.SettingNotFoundException;
 import android.telephony.CellInfo;
 import android.telephony.CellInfoCdma;
@@ -72,11 +68,11 @@
  * {@hide}
  */
 public class CdmaServiceStateTracker extends ServiceStateTracker {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "CdmaSST";
 
-    CDMAPhone phone;
-    CdmaCellLocation cellLoc;
-    CdmaCellLocation newCellLoc;
+    CDMAPhone mPhone;
+    CdmaCellLocation mCellLoc;
+    CdmaCellLocation mNewCellLoc;
 
     // Min values used to by getOtasp()
     private static final String UNACTIVATED_MIN2_VALUE = "000000";
@@ -103,10 +99,8 @@
     /**
      * Initially assume no data connection.
      */
-    protected int mDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
-    protected int mNewDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
     protected int mRegistrationState = -1;
-    protected RegistrantList cdmaForSubscriptionInfoReadyRegistrants = new RegistrantList();
+    protected RegistrantList mCdmaForSubscriptionInfoReadyRegistrants = new RegistrantList();
 
     /**
      * Sometimes we get the NITZ time before we know what country we
@@ -136,15 +130,15 @@
     protected String mPrlVersion;
     protected boolean mIsMinInfoReady = false;
 
-    private boolean isEriTextLoaded = false;
-    protected boolean isSubscriptionFromRuim = false;
+    private boolean mIsEriTextLoaded = false;
+    protected boolean mIsSubscriptionFromRuim = false;
     private CdmaSubscriptionSourceManager mCdmaSSM;
 
     /* Used only for debugging purposes. */
     private String mRegistrationDeniedReason;
 
-    private ContentResolver cr;
-    private String currentCarrier = null;
+    private ContentResolver mCr;
+    private String mCurrentCarrier = null;
 
     private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) {
         @Override
@@ -167,40 +161,40 @@
     }
 
     protected CdmaServiceStateTracker(CDMAPhone phone, CellInfo cellInfo) {
-        super(phone, phone.mCM, cellInfo);
+        super(phone, phone.mCi, cellInfo);
 
-        this.phone = phone;
-        cr = phone.getContext().getContentResolver();
-        cellLoc = new CdmaCellLocation();
-        newCellLoc = new CdmaCellLocation();
+        mPhone = phone;
+        mCr = phone.getContext().getContentResolver();
+        mCellLoc = new CdmaCellLocation();
+        mNewCellLoc = new CdmaCellLocation();
 
-        mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(phone.getContext(), cm, this,
+        mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(phone.getContext(), mCi, this,
                 EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
-        isSubscriptionFromRuim = (mCdmaSSM.getCdmaSubscriptionSource() ==
+        mIsSubscriptionFromRuim = (mCdmaSSM.getCdmaSubscriptionSource() ==
                           CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM);
 
         PowerManager powerManager =
                 (PowerManager)phone.getContext().getSystemService(Context.POWER_SERVICE);
         mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_TAG);
 
-        cm.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null);
+        mCi.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null);
 
-        cm.registerForVoiceNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED_CDMA, null);
-        cm.setOnNITZTime(this, EVENT_NITZ_TIME, null);
+        mCi.registerForVoiceNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED_CDMA, null);
+        mCi.setOnNITZTime(this, EVENT_NITZ_TIME, null);
 
-        cm.registerForCdmaPrlChanged(this, EVENT_CDMA_PRL_VERSION_CHANGED, null);
+        mCi.registerForCdmaPrlChanged(this, EVENT_CDMA_PRL_VERSION_CHANGED, null);
         phone.registerForEriFileLoaded(this, EVENT_ERI_FILE_LOADED, null);
-        cm.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null);
+        mCi.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null);
 
         // System setting property AIRPLANE_MODE_ON is set in Settings.
-        int airplaneMode = Settings.System.getInt(cr, Settings.System.AIRPLANE_MODE_ON, 0);
+        int airplaneMode = Settings.Global.getInt(mCr, Settings.Global.AIRPLANE_MODE_ON, 0);
         mDesiredPowerState = ! (airplaneMode > 0);
 
-        cr.registerContentObserver(
-                Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
+        mCr.registerContentObserver(
+                Settings.Global.getUriFor(Settings.Global.AUTO_TIME), true,
                 mAutoTimeObserver);
-        cr.registerContentObserver(
-            Settings.System.getUriFor(Settings.System.AUTO_TIME_ZONE), true,
+        mCr.registerContentObserver(
+            Settings.Global.getUriFor(Settings.Global.AUTO_TIME_ZONE), true,
             mAutoTimeZoneObserver);
         setSignalStrengthDefaultValues();
     }
@@ -209,17 +203,17 @@
     public void dispose() {
         checkCorrectThread();
         // Unregister for all events.
-        cm.unregisterForRadioStateChanged(this);
-        cm.unregisterForVoiceNetworkStateChanged(this);
-        cm.unregisterForCdmaOtaProvision(this);
-        phone.unregisterForEriFileLoaded(this);
+        mCi.unregisterForRadioStateChanged(this);
+        mCi.unregisterForVoiceNetworkStateChanged(this);
+        mCi.unregisterForCdmaOtaProvision(this);
+        mPhone.unregisterForEriFileLoaded(this);
         if (mUiccApplcation != null) {mUiccApplcation.unregisterForReady(this);}
         if (mIccRecords != null) {mIccRecords.unregisterForRecordsLoaded(this);}
-        cm.unSetOnNITZTime(this);
-        cr.unregisterContentObserver(mAutoTimeObserver);
-        cr.unregisterContentObserver(mAutoTimeZoneObserver);
+        mCi.unSetOnNITZTime(this);
+        mCr.unregisterContentObserver(mAutoTimeObserver);
+        mCr.unregisterContentObserver(mAutoTimeZoneObserver);
         mCdmaSSM.dispose(this);
-        cm.unregisterForCdmaPrlChanged(this);
+        mCi.unregisterForCdmaPrlChanged(this);
         super.dispose();
     }
 
@@ -236,7 +230,7 @@
      */
     public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
         Registrant r = new Registrant(h, what, obj);
-        cdmaForSubscriptionInfoReadyRegistrants.add(r);
+        mCdmaForSubscriptionInfoReadyRegistrants.add(r);
 
         if (isMinInfoReady()) {
             r.notifyRegistrant();
@@ -244,7 +238,7 @@
     }
 
     public void unregisterForSubscriptionInfoReady(Handler h) {
-        cdmaForSubscriptionInfoReadyRegistrants.remove(h);
+        mCdmaForSubscriptionInfoReadyRegistrants.remove(h);
     }
 
     /**
@@ -253,13 +247,13 @@
      */
     private void saveCdmaSubscriptionSource(int source) {
         log("Storing cdma subscription source: " + source);
-        Settings.Global.putInt(phone.getContext().getContentResolver(),
+        Settings.Global.putInt(mPhone.getContext().getContentResolver(),
                 Settings.Global.CDMA_SUBSCRIPTION_MODE,
                 source );
     }
 
     private void getSubscriptionInfoAndStartPollingThreads() {
-        cm.getCDMASubscription(obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
+        mCi.getCDMASubscription(obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
 
         // Get Registration Information
         pollState();
@@ -271,7 +265,7 @@
         int[] ints;
         String[] strings;
 
-        if (!phone.mIsTheCurrentActivePhone) {
+        if (!mPhone.mIsTheCurrentActivePhone) {
             loge("Received message " + msg + "[" + msg.what + "]" +
                     " while being destroyed. Ignoring.");
             return;
@@ -286,7 +280,7 @@
             // TODO: Consider calling setCurrentPreferredNetworkType as we do in GsmSST.
             // cm.setCurrentPreferredNetworkType();
 
-            if (phone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
+            if (mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
                 // Subscription will be read from SIM I/O
                 if (DBG) log("Receive EVENT_RUIM_READY");
                 pollState();
@@ -294,7 +288,7 @@
                 if (DBG) log("Receive EVENT_RUIM_READY and Send Request getCDMASubscription.");
                 getSubscriptionInfoAndStartPollingThreads();
             }
-            phone.prepareEri();
+            mPhone.prepareEri();
             break;
 
         case EVENT_NV_READY:
@@ -305,7 +299,7 @@
             break;
 
         case EVENT_RADIO_STATE_CHANGED:
-            if(cm.getRadioState() == RadioState.RADIO_ON) {
+            if(mCi.getRadioState() == RadioState.RADIO_ON) {
                 handleCdmaSubscriptionSource(mCdmaSSM.getCdmaSubscriptionSource());
 
                 // Signal strength polling stops when radio is off.
@@ -324,7 +318,7 @@
             // This callback is called when signal strength is polled
             // all by itself.
 
-            if (!(cm.getRadioState().isOn())) {
+            if (!(mCi.getRadioState().isOn())) {
                 // Polling will continue when radio turns back on.
                 return;
             }
@@ -372,9 +366,9 @@
                     }
                 }
 
-                cellLoc.setCellLocationData(baseStationId, baseStationLatitude,
+                mCellLoc.setCellLocationData(baseStationId, baseStationLatitude,
                         baseStationLongitude, systemId, networkId);
-                phone.notifyLocationChanged();
+                mPhone.notifyLocationChanged();
             }
 
             // Release any temporary cell lock, which could have been
@@ -384,6 +378,7 @@
 
         case EVENT_POLL_STATE_REGISTRATION_CDMA:
         case EVENT_POLL_STATE_OPERATOR_CDMA:
+        case EVENT_POLL_STATE_GPRS:
             ar = (AsyncResult) msg.obj;
             handlePollStateResult(msg.what, ar);
             break;
@@ -404,7 +399,7 @@
                     mIsMinInfoReady = true;
 
                     updateOtaspState();
-                    if (!isSubscriptionFromRuim && mIccRecords != null) {
+                    if (!mIsSubscriptionFromRuim && mIccRecords != null) {
                         if (DBG) {
                             log("GET_CDMA_SUBSCRIPTION set imsi in mIccRecords");
                         }
@@ -427,7 +422,7 @@
         case EVENT_POLL_SIGNAL_STRENGTH:
             // Just poll signal strength...not part of pollState()
 
-            cm.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));
+            mCi.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));
             break;
 
         case EVENT_NITZ_TIME:
@@ -446,7 +441,7 @@
 
             // The radio is telling us about signal strength changes,
             // so we don't have to ask it.
-            dontPollSignalStrength = true;
+            mDontPollSignalStrength = true;
 
             onSignalStrengthResult(ar, false);
             break;
@@ -459,7 +454,7 @@
             ar = (AsyncResult) msg.obj;
 
             if (ar.exception == null) {
-                cm.getVoiceRegistrationState(obtainMessage(EVENT_GET_LOC_DONE_CDMA, null));
+                mCi.getVoiceRegistrationState(obtainMessage(EVENT_GET_LOC_DONE_CDMA, null));
             }
             break;
 
@@ -477,7 +472,7 @@
                 if (otaStatus == Phone.CDMA_OTA_PROVISION_STATUS_COMMITTED
                     || otaStatus == Phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED) {
                     if (DBG) log("EVENT_OTA_PROVISION_STATUS_CHANGE: Complete, Reload MDN");
-                    cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
+                    mCi.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
                 }
             }
             break;
@@ -500,10 +495,10 @@
 
     private void handleCdmaSubscriptionSource(int newSubscriptionSource) {
         log("Subscription Source : " + newSubscriptionSource);
-        isSubscriptionFromRuim =
+        mIsSubscriptionFromRuim =
             (newSubscriptionSource == CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM);
         saveCdmaSubscriptionSource(newSubscriptionSource);
-        if (!isSubscriptionFromRuim) {
+        if (!mIsSubscriptionFromRuim) {
             // NV is ready when subscription source is NV
             sendMessage(obtainMessage(EVENT_NV_READY));
         }
@@ -513,10 +508,10 @@
     protected void setPowerStateToDesired() {
         // If we want it on and it's off, turn it on
         if (mDesiredPowerState
-            && cm.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
-            cm.setRadioPower(true, null);
-        } else if (!mDesiredPowerState && cm.getRadioState().isOn()) {
-            DataConnectionTracker dcTracker = phone.mDataConnectionTracker;
+            && mCi.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
+            mCi.setRadioPower(true, null);
+        } else if (!mDesiredPowerState && mCi.getRadioState().isOn()) {
+            DataConnectionTrackerBase dcTracker = mPhone.mDataConnectionTracker;
 
             // If it's on and available and we want it off gracefully
             powerOffRadioSafely(dcTracker);
@@ -526,7 +521,7 @@
     @Override
     protected void updateSpnDisplay() {
         // mOperatorAlphaLong contains the ERI text
-        String plmn = ss.getOperatorAlphaLong();
+        String plmn = mSS.getOperatorAlphaLong();
         if (!TextUtils.equals(plmn, mCurPlmn)) {
             // Allow A blank plmn, "" to set showPlmn to true. Previously, we
             // would set showPlmn to true only if plmn was not empty, i.e. was not
@@ -543,7 +538,7 @@
             intent.putExtra(TelephonyIntents.EXTRA_SPN, "");
             intent.putExtra(TelephonyIntents.EXTRA_SHOW_PLMN, showPlmn);
             intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn);
-            phone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
+            mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
         }
 
         mCurPlmn = plmn;
@@ -551,16 +546,7 @@
 
     @Override
     protected Phone getPhone() {
-        return phone;
-    }
-
-    /**
-    * Determine data network type based on radio technology.
-    */
-    protected void setCdmaTechnology(int radioTech){
-        mNewDataConnectionState = radioTechnologyToDataServiceState(radioTech);
-        newSS.setRadioTechnology(radioTech);
-        mNewRilRadioTechnology = radioTech;
+        return mPhone;
     }
 
     /**
@@ -570,142 +556,181 @@
         int ints[];
         String states[];
         switch (what) {
-        case EVENT_POLL_STATE_REGISTRATION_CDMA: // Handle RIL_REQUEST_REGISTRATION_STATE.
-            states = (String[])ar.result;
-
-            int registrationState = 4;     //[0] registrationState
-            int radioTechnology = -1;      //[3] radioTechnology
-            int baseStationId = -1;        //[4] baseStationId
-            //[5] baseStationLatitude
-            int baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG;
-            //[6] baseStationLongitude
-            int baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
-            int cssIndicator = 0;          //[7] init with 0, because it is treated as a boolean
-            int systemId = 0;              //[8] systemId
-            int networkId = 0;             //[9] networkId
-            int roamingIndicator = -1;     //[10] Roaming indicator
-            int systemIsInPrl = 0;         //[11] Indicates if current system is in PRL
-            int defaultRoamingIndicator = 0;  //[12] Is default roaming indicator from PRL
-            int reasonForDenial = 0;       //[13] Denial reason if registrationState = 3
-
-            if (states.length >= 14) {
-                try {
-                    if (states[0] != null) {
-                        registrationState = Integer.parseInt(states[0]);
-                    }
-                    if (states[3] != null) {
-                        radioTechnology = Integer.parseInt(states[3]);
-                    }
-                    if (states[4] != null) {
-                        baseStationId = Integer.parseInt(states[4]);
-                    }
-                    if (states[5] != null) {
-                        baseStationLatitude = Integer.parseInt(states[5]);
-                    }
-                    if (states[6] != null) {
-                        baseStationLongitude = Integer.parseInt(states[6]);
-                    }
-                    // Some carriers only return lat-lngs of 0,0
-                    if (baseStationLatitude == 0 && baseStationLongitude == 0) {
-                        baseStationLatitude  = CdmaCellLocation.INVALID_LAT_LONG;
-                        baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
-                    }
-                    if (states[7] != null) {
-                        cssIndicator = Integer.parseInt(states[7]);
-                    }
-                    if (states[8] != null) {
-                        systemId = Integer.parseInt(states[8]);
-                    }
-                    if (states[9] != null) {
-                        networkId = Integer.parseInt(states[9]);
-                    }
-                    if (states[10] != null) {
-                        roamingIndicator = Integer.parseInt(states[10]);
-                    }
-                    if (states[11] != null) {
-                        systemIsInPrl = Integer.parseInt(states[11]);
-                    }
-                    if (states[12] != null) {
-                        defaultRoamingIndicator = Integer.parseInt(states[12]);
-                    }
-                    if (states[13] != null) {
-                        reasonForDenial = Integer.parseInt(states[13]);
-                    }
-                } catch (NumberFormatException ex) {
-                    loge("EVENT_POLL_STATE_REGISTRATION_CDMA: error parsing: " + ex);
+            case EVENT_POLL_STATE_GPRS: {
+                states = (String[])ar.result;
+                if (DBG) {
+                    log("handlePollStateResultMessage: EVENT_POLL_STATE_GPRS states.length=" +
+                            states.length + " states=" + states);
                 }
-            } else {
-                throw new RuntimeException("Warning! Wrong number of parameters returned from "
-                                     + "RIL_REQUEST_REGISTRATION_STATE: expected 14 or more "
-                                     + "strings and got " + states.length + " strings");
-            }
 
-            mRegistrationState = registrationState;
-            // When registration state is roaming and TSB58
-            // roaming indicator is not in the carrier-specified
-            // list of ERIs for home system, mCdmaRoaming is true.
-            mCdmaRoaming =
-                    regCodeIsRoaming(registrationState) && !isRoamIndForHomeSystem(states[10]);
-            newSS.setState (regCodeToServiceState(registrationState));
+                int regState = ServiceState.RIL_REG_STATE_UNKNOWN;
+                int dataRadioTechnology = 0;
 
-            setCdmaTechnology(radioTechnology);
-
-            newSS.setCssIndicator(cssIndicator);
-            newSS.setSystemAndNetworkId(systemId, networkId);
-            mRoamingIndicator = roamingIndicator;
-            mIsInPrl = (systemIsInPrl == 0) ? false : true;
-            mDefaultRoamingIndicator = defaultRoamingIndicator;
-
-
-            // Values are -1 if not available.
-            newCellLoc.setCellLocationData(baseStationId, baseStationLatitude,
-                    baseStationLongitude, systemId, networkId);
-
-            if (reasonForDenial == 0) {
-                mRegistrationDeniedReason = ServiceStateTracker.REGISTRATION_DENIED_GEN;
-            } else if (reasonForDenial == 1) {
-                mRegistrationDeniedReason = ServiceStateTracker.REGISTRATION_DENIED_AUTH;
-            } else {
-                mRegistrationDeniedReason = "";
-            }
-
-            if (mRegistrationState == 3) {
-                if (DBG) log("Registration denied, " + mRegistrationDeniedReason);
-            }
-            break;
-
-        case EVENT_POLL_STATE_OPERATOR_CDMA: // Handle RIL_REQUEST_OPERATOR
-            String opNames[] = (String[])ar.result;
-
-            if (opNames != null && opNames.length >= 3) {
-                // If the NUMERIC field isn't valid use PROPERTY_CDMA_HOME_OPERATOR_NUMERIC
-                if ((opNames[2] == null) || (opNames[2].length() < 5)
-                        || ("00000".equals(opNames[2]))) {
-                    opNames[2] = SystemProperties.get(
-                            CDMAPhone.PROPERTY_CDMA_HOME_OPERATOR_NUMERIC, "00000");
-                    if (DBG) {
-                        log("RIL_REQUEST_OPERATOR.response[2], the numeric, " +
-                                " is bad. Using SystemProperties '" +
-                                        CDMAPhone.PROPERTY_CDMA_HOME_OPERATOR_NUMERIC +
-                                "'= " + opNames[2]);
+                if (states.length > 0) {
+                    try {
+                        regState = Integer.parseInt(states[0]);
+    
+                        // states[3] (if present) is the current radio technology
+                        if (states.length >= 4 && states[3] != null) {
+                            dataRadioTechnology = Integer.parseInt(states[3]);
+                        }
+                    } catch (NumberFormatException ex) {
+                        loge("handlePollStateResultMessage: error parsing GprsRegistrationState: "
+                                        + ex);
                     }
                 }
 
-                if (!isSubscriptionFromRuim) {
-                    // In CDMA in case on NV, the ss.mOperatorAlphaLong is set later with the
-                    // ERI text, so here it is ignored what is coming from the modem.
-                    newSS.setOperatorName(null, opNames[1], opNames[2]);
+                int dataRegState = regCodeToServiceState(regState);
+                mNewSS.setDataRegState(dataRegState);
+                mNewSS.setRilDataRadioTechnology(dataRadioTechnology);
+                if (DBG) {
+                    log("handlPollStateResultMessage: cdma setDataRegState=" + dataRegState
+                            + " regState=" + regState
+                            + " dataRadioTechnology=" + dataRadioTechnology);
+                }
+                break;
+            }
+
+            case EVENT_POLL_STATE_REGISTRATION_CDMA: // Handle RIL_REQUEST_REGISTRATION_STATE.
+                states = (String[])ar.result;
+
+                int registrationState = 4;     //[0] registrationState
+                int radioTechnology = -1;      //[3] radioTechnology
+                int baseStationId = -1;        //[4] baseStationId
+                //[5] baseStationLatitude
+                int baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG;
+                //[6] baseStationLongitude
+                int baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
+                int cssIndicator = 0;          //[7] init with 0, because it is treated as a boolean
+                int systemId = 0;              //[8] systemId
+                int networkId = 0;             //[9] networkId
+                int roamingIndicator = -1;     //[10] Roaming indicator
+                int systemIsInPrl = 0;         //[11] Indicates if current system is in PRL
+                int defaultRoamingIndicator = 0;  //[12] Is default roaming indicator from PRL
+                int reasonForDenial = 0;       //[13] Denial reason if registrationState = 3
+
+                if (states.length >= 14) {
+                    try {
+                        if (states[0] != null) {
+                            registrationState = Integer.parseInt(states[0]);
+                        }
+                        if (states[3] != null) {
+                            radioTechnology = Integer.parseInt(states[3]);
+                        }
+                        if (states[4] != null) {
+                            baseStationId = Integer.parseInt(states[4]);
+                        }
+                        if (states[5] != null) {
+                            baseStationLatitude = Integer.parseInt(states[5]);
+                        }
+                        if (states[6] != null) {
+                            baseStationLongitude = Integer.parseInt(states[6]);
+                        }
+                        // Some carriers only return lat-lngs of 0,0
+                        if (baseStationLatitude == 0 && baseStationLongitude == 0) {
+                            baseStationLatitude  = CdmaCellLocation.INVALID_LAT_LONG;
+                            baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
+                        }
+                        if (states[7] != null) {
+                            cssIndicator = Integer.parseInt(states[7]);
+                        }
+                        if (states[8] != null) {
+                            systemId = Integer.parseInt(states[8]);
+                        }
+                        if (states[9] != null) {
+                            networkId = Integer.parseInt(states[9]);
+                        }
+                        if (states[10] != null) {
+                            roamingIndicator = Integer.parseInt(states[10]);
+                        }
+                        if (states[11] != null) {
+                            systemIsInPrl = Integer.parseInt(states[11]);
+                        }
+                        if (states[12] != null) {
+                            defaultRoamingIndicator = Integer.parseInt(states[12]);
+                        }
+                        if (states[13] != null) {
+                            reasonForDenial = Integer.parseInt(states[13]);
+                        }
+                    } catch (NumberFormatException ex) {
+                        loge("EVENT_POLL_STATE_REGISTRATION_CDMA: error parsing: " + ex);
+                    }
                 } else {
-                    newSS.setOperatorName(opNames[0], opNames[1], opNames[2]);
+                    throw new RuntimeException("Warning! Wrong number of parameters returned from "
+                                         + "RIL_REQUEST_REGISTRATION_STATE: expected 14 or more "
+                                         + "strings and got " + states.length + " strings");
                 }
-            } else {
-                if (DBG) log("EVENT_POLL_STATE_OPERATOR_CDMA: error parsing opNames");
-            }
-            break;
-        default:
-            loge("handlePollStateResultMessage: RIL response handle in wrong phone!"
-                    + " Expected CDMA RIL request and get GSM RIL request.");
-        break;
+
+                mRegistrationState = registrationState;
+                // When registration state is roaming and TSB58
+                // roaming indicator is not in the carrier-specified
+                // list of ERIs for home system, mCdmaRoaming is true.
+                mCdmaRoaming =
+                        regCodeIsRoaming(registrationState) && !isRoamIndForHomeSystem(states[10]);
+                mNewSS.setState (regCodeToServiceState(registrationState));
+
+                mNewSS.setRilVoiceRadioTechnology(radioTechnology);
+
+                mNewSS.setCssIndicator(cssIndicator);
+                mNewSS.setSystemAndNetworkId(systemId, networkId);
+                mRoamingIndicator = roamingIndicator;
+                mIsInPrl = (systemIsInPrl == 0) ? false : true;
+                mDefaultRoamingIndicator = defaultRoamingIndicator;
+
+
+                // Values are -1 if not available.
+                mNewCellLoc.setCellLocationData(baseStationId, baseStationLatitude,
+                        baseStationLongitude, systemId, networkId);
+
+                if (reasonForDenial == 0) {
+                    mRegistrationDeniedReason = ServiceStateTracker.REGISTRATION_DENIED_GEN;
+                } else if (reasonForDenial == 1) {
+                    mRegistrationDeniedReason = ServiceStateTracker.REGISTRATION_DENIED_AUTH;
+                } else {
+                    mRegistrationDeniedReason = "";
+                }
+    
+                if (mRegistrationState == 3) {
+                    if (DBG) log("Registration denied, " + mRegistrationDeniedReason);
+                }
+                break;
+
+            case EVENT_POLL_STATE_OPERATOR_CDMA: // Handle RIL_REQUEST_OPERATOR
+                String opNames[] = (String[])ar.result;
+    
+                if (opNames != null && opNames.length >= 3) {
+                    // If the NUMERIC field isn't valid use PROPERTY_CDMA_HOME_OPERATOR_NUMERIC
+                    if ((opNames[2] == null) || (opNames[2].length() < 5)
+                            || ("00000".equals(opNames[2]))) {
+                        opNames[2] = SystemProperties.get(
+                                CDMAPhone.PROPERTY_CDMA_HOME_OPERATOR_NUMERIC, "00000");
+                        if (DBG) {
+                            log("RIL_REQUEST_OPERATOR.response[2], the numeric, " +
+                                    " is bad. Using SystemProperties '" +
+                                            CDMAPhone.PROPERTY_CDMA_HOME_OPERATOR_NUMERIC +
+                                    "'= " + opNames[2]);
+                        }
+                    }
+
+                    if (!mIsSubscriptionFromRuim) {
+                        // In CDMA in case on NV, the ss.mOperatorAlphaLong is set later with the
+                        // ERI text, so here it is ignored what is coming from the modem.
+                        mNewSS.setOperatorName(null, opNames[1], opNames[2]);
+                    } else {
+                        mNewSS.setOperatorName(opNames[0], opNames[1], opNames[2]);
+                    }
+                } else {
+                    if (DBG) log("EVENT_POLL_STATE_OPERATOR_CDMA: error parsing opNames");
+                }
+                break;
+
+            
+            default:
+    
+                
+                loge("handlePollStateResultMessage: RIL response handle in wrong phone!"
+                        + " Expected CDMA RIL request and get GSM RIL request.");
+                break;
         }
     }
 
@@ -715,7 +740,7 @@
     @Override
     protected void handlePollStateResult(int what, AsyncResult ar) {
         // Ignore stale requests from last poll.
-        if (ar.userObj != pollingContext) return;
+        if (ar.userObj != mPollingContext) return;
 
         if (ar.exception != null) {
             CommandException.Error err=null;
@@ -730,7 +755,7 @@
                 return;
             }
 
-            if (!cm.getRadioState().isOn()) {
+            if (!mCi.getRadioState().isOn()) {
                 // Radio has crashed or turned off.
                 cancelPollState();
                 return;
@@ -747,61 +772,61 @@
                     + "Probably malformed RIL response." + ex);
         }
 
-        pollingContext[0]--;
+        mPollingContext[0]--;
 
-        if (pollingContext[0] == 0) {
+        if (mPollingContext[0] == 0) {
             boolean namMatch = false;
-            if (!isSidsAllZeros() && isHomeSid(newSS.getSystemId())) {
+            if (!isSidsAllZeros() && isHomeSid(mNewSS.getSystemId())) {
                 namMatch = true;
             }
 
             // Setting SS Roaming (general)
-            if (isSubscriptionFromRuim) {
-                newSS.setRoaming(isRoamingBetweenOperators(mCdmaRoaming, newSS));
+            if (mIsSubscriptionFromRuim) {
+                mNewSS.setRoaming(isRoamingBetweenOperators(mCdmaRoaming, mNewSS));
             } else {
-                newSS.setRoaming(mCdmaRoaming);
+                mNewSS.setRoaming(mCdmaRoaming);
             }
 
             // Setting SS CdmaRoamingIndicator and CdmaDefaultRoamingIndicator
-            newSS.setCdmaDefaultRoamingIndicator(mDefaultRoamingIndicator);
-            newSS.setCdmaRoamingIndicator(mRoamingIndicator);
+            mNewSS.setCdmaDefaultRoamingIndicator(mDefaultRoamingIndicator);
+            mNewSS.setCdmaRoamingIndicator(mRoamingIndicator);
             boolean isPrlLoaded = true;
             if (TextUtils.isEmpty(mPrlVersion)) {
                 isPrlLoaded = false;
             }
             if (!isPrlLoaded) {
-                newSS.setCdmaRoamingIndicator(EriInfo.ROAMING_INDICATOR_OFF);
+                mNewSS.setCdmaRoamingIndicator(EriInfo.ROAMING_INDICATOR_OFF);
             } else if (!isSidsAllZeros()) {
                 if (!namMatch && !mIsInPrl) {
                     // Use default
-                    newSS.setCdmaRoamingIndicator(mDefaultRoamingIndicator);
+                    mNewSS.setCdmaRoamingIndicator(mDefaultRoamingIndicator);
                 } else if (namMatch && !mIsInPrl) {
-                    newSS.setCdmaRoamingIndicator(EriInfo.ROAMING_INDICATOR_FLASH);
+                    mNewSS.setCdmaRoamingIndicator(EriInfo.ROAMING_INDICATOR_FLASH);
                 } else if (!namMatch && mIsInPrl) {
                     // Use the one from PRL/ERI
-                    newSS.setCdmaRoamingIndicator(mRoamingIndicator);
+                    mNewSS.setCdmaRoamingIndicator(mRoamingIndicator);
                 } else {
                     // It means namMatch && mIsInPrl
                     if ((mRoamingIndicator <= 2)) {
-                        newSS.setCdmaRoamingIndicator(EriInfo.ROAMING_INDICATOR_OFF);
+                        mNewSS.setCdmaRoamingIndicator(EriInfo.ROAMING_INDICATOR_OFF);
                     } else {
                         // Use the one from PRL/ERI
-                        newSS.setCdmaRoamingIndicator(mRoamingIndicator);
+                        mNewSS.setCdmaRoamingIndicator(mRoamingIndicator);
                     }
                 }
             }
 
-            int roamingIndicator = newSS.getCdmaRoamingIndicator();
-            newSS.setCdmaEriIconIndex(phone.mEriManager.getCdmaEriIconIndex(roamingIndicator,
+            int roamingIndicator = mNewSS.getCdmaRoamingIndicator();
+            mNewSS.setCdmaEriIconIndex(mPhone.mEriManager.getCdmaEriIconIndex(roamingIndicator,
                     mDefaultRoamingIndicator));
-            newSS.setCdmaEriIconMode(phone.mEriManager.getCdmaEriIconMode(roamingIndicator,
+            mNewSS.setCdmaEriIconMode(mPhone.mEriManager.getCdmaEriIconMode(roamingIndicator,
                     mDefaultRoamingIndicator));
 
             // NOTE: Some operator may require overriding mCdmaRoaming
             // (set by the modem), depending on the mRoamingIndicator.
 
             if (DBG) {
-                log("Set CDMA Roaming Indicator to: " + newSS.getCdmaRoamingIndicator()
+                log("Set CDMA Roaming Indicator to: " + mNewSS.getCdmaRoamingIndicator()
                     + ". mCdmaRoaming = " + mCdmaRoaming + ", isPrlLoaded = " + isPrlLoaded
                     + ". namMatch = " + namMatch + " , mIsInPrl = " + mIsInPrl
                     + ", mRoamingIndicator = " + mRoamingIndicator
@@ -826,14 +851,13 @@
      */
     protected void
     pollState() {
-        pollingContext = new int[1];
-        pollingContext[0] = 0;
+        mPollingContext = new int[1];
+        mPollingContext[0] = 0;
 
-        switch (cm.getRadioState()) {
+        switch (mCi.getRadioState()) {
         case RADIO_UNAVAILABLE:
-            newSS.setStateOutOfService();
-            mNewDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
-            newCellLoc.setStateInvalid();
+            mNewSS.setStateOutOfService();
+            mNewCellLoc.setStateInvalid();
             setSignalStrengthDefaultValues();
             mGotCountryCode = false;
 
@@ -841,9 +865,8 @@
             break;
 
         case RADIO_OFF:
-            newSS.setStateOff();
-            mNewDataConnectionState = ServiceState.STATE_POWER_OFF;
-            newCellLoc.setStateInvalid();
+            mNewSS.setStateOff();
+            mNewCellLoc.setStateInvalid();
             setSignalStrengthDefaultValues();
             mGotCountryCode = false;
 
@@ -855,16 +878,20 @@
             // down the responses which are allowed to arrive
             // out-of-order.
 
-            pollingContext[0]++;
+            mPollingContext[0]++;
             // RIL_REQUEST_OPERATOR is necessary for CDMA
-            cm.getOperator(
-                    obtainMessage(EVENT_POLL_STATE_OPERATOR_CDMA, pollingContext));
+            mCi.getOperator(
+                    obtainMessage(EVENT_POLL_STATE_OPERATOR_CDMA, mPollingContext));
 
-            pollingContext[0]++;
+            mPollingContext[0]++;
             // RIL_REQUEST_VOICE_REGISTRATION_STATE is necessary for CDMA
-            cm.getVoiceRegistrationState(
-                    obtainMessage(EVENT_POLL_STATE_REGISTRATION_CDMA, pollingContext));
+            mCi.getVoiceRegistrationState(
+                    obtainMessage(EVENT_POLL_STATE_REGISTRATION_CDMA, mPollingContext));
 
+            mPollingContext[0]++;
+            // RIL_REQUEST_DATA_REGISTRATION_STATE
+            mCi.getDataRegistrationState(obtainMessage(EVENT_POLL_STATE_GPRS,
+                                        mPollingContext));
             break;
         }
     }
@@ -930,66 +957,62 @@
     }
 
     protected void pollStateDone() {
-        if (DBG) log("pollStateDone: oldSS=[" + ss + "] newSS=[" + newSS + "]");
+        if (DBG) log("pollStateDone: cdma oldSS=[" + mSS + "] newSS=[" + mNewSS + "]");
 
         boolean hasRegistered =
-            ss.getState() != ServiceState.STATE_IN_SERVICE
-            && newSS.getState() == ServiceState.STATE_IN_SERVICE;
+            mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
+            && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
 
         boolean hasDeregistered =
-            ss.getState() == ServiceState.STATE_IN_SERVICE
-            && newSS.getState() != ServiceState.STATE_IN_SERVICE;
+            mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE
+            && mNewSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE;
 
         boolean hasCdmaDataConnectionAttached =
-            mDataConnectionState != ServiceState.STATE_IN_SERVICE
-            && mNewDataConnectionState == ServiceState.STATE_IN_SERVICE;
+            mSS.getDataRegState() != ServiceState.STATE_IN_SERVICE
+            && mNewSS.getDataRegState() == ServiceState.STATE_IN_SERVICE;
 
         boolean hasCdmaDataConnectionDetached =
-            mDataConnectionState == ServiceState.STATE_IN_SERVICE
-            && mNewDataConnectionState != ServiceState.STATE_IN_SERVICE;
+            mSS.getDataRegState() == ServiceState.STATE_IN_SERVICE
+            && mNewSS.getDataRegState() != ServiceState.STATE_IN_SERVICE;
 
         boolean hasCdmaDataConnectionChanged =
-                       mDataConnectionState != mNewDataConnectionState;
+                       mSS.getDataRegState() != mNewSS.getDataRegState();
 
-        boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
+        boolean hasRadioTechnologyChanged =
+                mSS.getRilVoiceRadioTechnology() != mNewSS.getRilVoiceRadioTechnology();
 
-        boolean hasChanged = !newSS.equals(ss);
+        boolean hasChanged = !mNewSS.equals(mSS);
 
-        boolean hasRoamingOn = !ss.getRoaming() && newSS.getRoaming();
+        boolean hasRoamingOn = !mSS.getRoaming() && mNewSS.getRoaming();
 
-        boolean hasRoamingOff = ss.getRoaming() && !newSS.getRoaming();
+        boolean hasRoamingOff = mSS.getRoaming() && !mNewSS.getRoaming();
 
-        boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
+        boolean hasLocationChanged = !mNewCellLoc.equals(mCellLoc);
 
         // Add an event log when connection state changes
-        if (ss.getState() != newSS.getState() ||
-                mDataConnectionState != mNewDataConnectionState) {
+        if (mSS.getVoiceRegState() != mNewSS.getVoiceRegState() ||
+                mSS.getDataRegState() != mNewSS.getDataRegState()) {
             EventLog.writeEvent(EventLogTags.CDMA_SERVICE_STATE_CHANGE,
-                    ss.getState(), mDataConnectionState,
-                    newSS.getState(), mNewDataConnectionState);
+                    mSS.getVoiceRegState(), mSS.getDataRegState(),
+                    mNewSS.getVoiceRegState(), mNewSS.getDataRegState());
         }
 
         ServiceState tss;
-        tss = ss;
-        ss = newSS;
-        newSS = tss;
+        tss = mSS;
+        mSS = mNewSS;
+        mNewSS = tss;
         // clean slate for next time
-        newSS.setStateOutOfService();
+        mNewSS.setStateOutOfService();
 
-        CdmaCellLocation tcl = cellLoc;
-        cellLoc = newCellLoc;
-        newCellLoc = tcl;
+        CdmaCellLocation tcl = mCellLoc;
+        mCellLoc = mNewCellLoc;
+        mNewCellLoc = tcl;
 
-        mDataConnectionState = mNewDataConnectionState;
-        mRilRadioTechnology = mNewRilRadioTechnology;
-        // this new state has been applied - forget it until we get a new new state
-        mNewRilRadioTechnology = 0;
-
-        newSS.setStateOutOfService(); // clean slate for next time
+        mNewSS.setStateOutOfService(); // clean slate for next time
 
         if (hasRadioTechnologyChanged) {
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
-                    ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
+                    ServiceState.rilRadioTechnologyToString(mSS.getRilVoiceRadioTechnology()));
         }
 
         if (hasRegistered) {
@@ -997,33 +1020,33 @@
         }
 
         if (hasChanged) {
-            if ((cm.getRadioState().isOn()) && (!isSubscriptionFromRuim)) {
+            if ((mCi.getRadioState().isOn()) && (!mIsSubscriptionFromRuim)) {
                 String eriText;
                 // Now the CDMAPhone sees the new ServiceState so it can get the new ERI text
-                if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
-                    eriText = phone.getCdmaEriText();
+                if (mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) {
+                    eriText = mPhone.getCdmaEriText();
                 } else {
                     // Note that ServiceState.STATE_OUT_OF_SERVICE is valid used for
                     // mRegistrationState 0,2,3 and 4
-                    eriText = phone.getContext().getText(
+                    eriText = mPhone.getContext().getText(
                             com.android.internal.R.string.roamingTextSearching).toString();
                 }
-                ss.setOperatorAlphaLong(eriText);
+                mSS.setOperatorAlphaLong(eriText);
             }
 
             String operatorNumeric;
 
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
-                    ss.getOperatorAlphaLong());
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
+                    mSS.getOperatorAlphaLong());
 
             String prevOperatorNumeric =
                     SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
-            operatorNumeric = ss.getOperatorNumeric();
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
+            operatorNumeric = mSS.getOperatorNumeric();
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
 
             if (operatorNumeric == null) {
                 if (DBG) log("operatorNumeric is null");
-                phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
+                mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
                 mGotCountryCode = false;
             } else {
                 String isoCountryCode = "";
@@ -1037,21 +1060,21 @@
                     loge("pollStateDone: countryCodeForMcc error" + ex);
                 }
 
-                phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
+                mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
                         isoCountryCode);
                 mGotCountryCode = true;
 
-                if (shouldFixTimeZoneNow(phone, operatorNumeric, prevOperatorNumeric,
+                if (shouldFixTimeZoneNow(mPhone, operatorNumeric, prevOperatorNumeric,
                         mNeedFixZone)) {
                     fixTimeZone(isoCountryCode);
                 }
             }
 
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
-                    ss.getRoaming() ? "true" : "false");
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
+                    mSS.getRoaming() ? "true" : "false");
 
             updateSpnDisplay();
-            phone.notifyServiceStateChanged(ss);
+            mPhone.notifyServiceStateChanged(mSS);
         }
 
         if (hasCdmaDataConnectionAttached) {
@@ -1063,7 +1086,7 @@
         }
 
         if (hasCdmaDataConnectionChanged || hasRadioTechnologyChanged) {
-            phone.notifyDataConnection(null);
+            mPhone.notifyDataConnection(null);
         }
 
         if (hasRoamingOn) {
@@ -1075,7 +1098,7 @@
         }
 
         if (hasLocationChanged) {
-            phone.notifyLocationChanged();
+            mPhone.notifyLocationChanged();
         }
         // TODO: Add CdmaCellIdenity updating, see CdmaLteServiceStateTracker.
     }
@@ -1121,7 +1144,7 @@
      */
     private void
     queueNextSignalStrengthPoll() {
-        if (dontPollSignalStrength) {
+        if (mDontPollSignalStrength) {
             // The radio is telling us about signal strength changes
             // we don't have to ask it
             return;
@@ -1181,8 +1204,9 @@
         }
     }
 
+    @Override
     public int getCurrentDataConnectionState() {
-        return mDataConnectionState;
+        return mSS.getDataRegState();
     }
 
     /**
@@ -1402,9 +1426,9 @@
                      */
                     long gained = c.getTimeInMillis() - System.currentTimeMillis();
                     long timeSinceLastUpdate = SystemClock.elapsedRealtime() - mSavedAtTime;
-                    int nitzUpdateSpacing = Settings.Global.getInt(cr,
+                    int nitzUpdateSpacing = Settings.Global.getInt(mCr,
                             Settings.Global.NITZ_UPDATE_SPACING, mNitzUpdateSpacing);
-                    int nitzUpdateDiff = Settings.Global.getInt(cr,
+                    int nitzUpdateDiff = Settings.Global.getInt(mCr,
                             Settings.Global.NITZ_UPDATE_DIFF, mNitzUpdateDiff);
 
                     if ((mSavedAtTime == 0) || (timeSinceLastUpdate > nitzUpdateSpacing)
@@ -1444,7 +1468,7 @@
 
     private boolean getAutoTime() {
         try {
-            return Settings.System.getInt(cr, Settings.System.AUTO_TIME) > 0;
+            return Settings.Global.getInt(mCr, Settings.Global.AUTO_TIME) > 0;
         } catch (SettingNotFoundException snfe) {
             return true;
         }
@@ -1452,7 +1476,7 @@
 
     private boolean getAutoTimeZone() {
         try {
-            return Settings.System.getInt(cr, Settings.System.AUTO_TIME_ZONE) > 0;
+            return Settings.Global.getInt(mCr, Settings.Global.AUTO_TIME_ZONE) > 0;
         } catch (SettingNotFoundException snfe) {
             return true;
         }
@@ -1471,12 +1495,12 @@
     private void setAndBroadcastNetworkSetTimeZone(String zoneId) {
         if (DBG) log("setAndBroadcastNetworkSetTimeZone: setTimeZone=" + zoneId);
         AlarmManager alarm =
-            (AlarmManager) phone.getContext().getSystemService(Context.ALARM_SERVICE);
+            (AlarmManager) mPhone.getContext().getSystemService(Context.ALARM_SERVICE);
         alarm.setTimeZone(zoneId);
         Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE);
         intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
         intent.putExtra("time-zone", zoneId);
-        phone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
+        mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
     }
 
     /**
@@ -1491,11 +1515,11 @@
         Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME);
         intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
         intent.putExtra("time", time);
-        phone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
+        mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
     }
 
     private void revertToNitzTime() {
-        if (Settings.System.getInt(cr, Settings.System.AUTO_TIME, 0) == 0) {
+        if (Settings.Global.getInt(mCr, Settings.Global.AUTO_TIME, 0) == 0) {
             return;
         }
         if (DBG) {
@@ -1508,8 +1532,8 @@
     }
 
     private void revertToNitzTimeZone() {
-        if (Settings.System.getInt(phone.getContext().getContentResolver(),
-                Settings.System.AUTO_TIME_ZONE, 0) == 0) {
+        if (Settings.Global.getInt(mPhone.getContext().getContentResolver(),
+                Settings.Global.AUTO_TIME_ZONE, 0) == 0) {
             return;
         }
         if (DBG) log("revertToNitzTimeZone: tz='" + mSavedTimeZone);
@@ -1547,6 +1571,7 @@
      * @return true if phone is camping on a technology
      * that could support voice and data simultaneously.
      */
+    @Override
     public boolean isConcurrentVoiceAndDataAllowed() {
         // Note: it needs to be confirmed which CDMA network types
         // can support voice and data calls concurrently.
@@ -1615,10 +1640,10 @@
     @Override
     protected void hangupAndPowerOff() {
         // hang up all active voice calls
-        phone.mCT.ringingCall.hangupIfAlive();
-        phone.mCT.backgroundCall.hangupIfAlive();
-        phone.mCT.foregroundCall.hangupIfAlive();
-        cm.setRadioPower(false, null);
+        mPhone.mCT.mRingingCall.hangupIfAlive();
+        mPhone.mCT.mBackgroundCall.hangupIfAlive();
+        mPhone.mCT.mForegroundCall.hangupIfAlive();
+        mCi.setRadioPower(false, null);
     }
 
     protected void parseSidNid (String sidStr, String nidStr) {
@@ -1655,16 +1680,16 @@
         mCurrentOtaspMode = otaspMode;
 
         // Notify apps subscription info is ready
-        if (cdmaForSubscriptionInfoReadyRegistrants != null) {
+        if (mCdmaForSubscriptionInfoReadyRegistrants != null) {
             if (DBG) log("CDMA_SUBSCRIPTION: call notifyRegistrants()");
-            cdmaForSubscriptionInfoReadyRegistrants.notifyRegistrants();
+            mCdmaForSubscriptionInfoReadyRegistrants.notifyRegistrants();
         }
         if (oldOtaspMode != mCurrentOtaspMode) {
             if (DBG) {
                 log("CDMA_SUBSCRIPTION: call notifyOtaspChanged old otaspMode=" +
                     oldOtaspMode + " new otaspMode=" + mCurrentOtaspMode);
             }
-            phone.notifyOtaspChanged(mCurrentOtaspMode);
+            mPhone.notifyOtaspChanged(mCurrentOtaspMode);
         }
     }
 
@@ -1691,7 +1716,7 @@
                 log("New card found");
                 mUiccApplcation = newUiccApplication;
                 mIccRecords = mUiccApplcation.getIccRecords();
-                if (isSubscriptionFromRuim) {
+                if (mIsSubscriptionFromRuim) {
                     mUiccApplcation.registerForReady(this, EVENT_RUIM_READY, null);
                     if (mIccRecords != null) {
                         mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
@@ -1723,16 +1748,16 @@
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("CdmaServiceStateTracker extends:");
         super.dump(fd, pw, args);
-        pw.println(" phone=" + phone);
-        pw.println(" cellLoc=" + cellLoc);
-        pw.println(" newCellLoc=" + newCellLoc);
+        pw.println(" mPhone=" + mPhone);
+        pw.println(" mSS=" + mSS);
+        pw.println(" mNewSS=" + mNewSS);
+        pw.println(" mCellLoc=" + mCellLoc);
+        pw.println(" mNewCellLoc=" + mNewCellLoc);
         pw.println(" mCurrentOtaspMode=" + mCurrentOtaspMode);
         pw.println(" mCdmaRoaming=" + mCdmaRoaming);
         pw.println(" mRoamingIndicator=" + mRoamingIndicator);
         pw.println(" mIsInPrl=" + mIsInPrl);
         pw.println(" mDefaultRoamingIndicator=" + mDefaultRoamingIndicator);
-        pw.println(" mDataConnectionState=" + mDataConnectionState);
-        pw.println(" mNewDataConnectionState=" + mNewDataConnectionState);
         pw.println(" mRegistrationState=" + mRegistrationState);
         pw.println(" mNeedFixZone=" + mNeedFixZone);
         pw.println(" mZoneOffset=" + mZoneOffset);
@@ -1750,10 +1775,10 @@
         pw.println(" mMin=" + mMin);
         pw.println(" mPrlVersion=" + mPrlVersion);
         pw.println(" mIsMinInfoReady=" + mIsMinInfoReady);
-        pw.println(" isEriTextLoaded=" + isEriTextLoaded);
-        pw.println(" isSubscriptionFromRuim=" + isSubscriptionFromRuim);
+        pw.println(" mIsEriTextLoaded=" + mIsEriTextLoaded);
+        pw.println(" mIsSubscriptionFromRuim=" + mIsSubscriptionFromRuim);
         pw.println(" mCdmaSSM=" + mCdmaSSM);
         pw.println(" mRegistrationDeniedReason=" + mRegistrationDeniedReason);
-        pw.println(" currentCarrier=" + currentCarrier);
+        pw.println(" mCurrentCarrier=" + mCurrentCarrier);
     }
 }
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaSubscriptionSourceManager.java b/src/java/com/android/internal/telephony/cdma/CdmaSubscriptionSourceManager.java
index 972d3c3..f607afc 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaSubscriptionSourceManager.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaSubscriptionSourceManager.java
@@ -19,8 +19,6 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.RILConstants;
-
 import android.content.Context;
 import android.os.AsyncResult;
 import android.os.Handler;
@@ -34,7 +32,7 @@
  * Class that handles the CDMA subscription source changed events from RIL
  */
 public class CdmaSubscriptionSourceManager extends Handler {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "CdmaSSM";
     private static final int EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 1;
     private static final int EVENT_GET_CDMA_SUBSCRIPTION_SOURCE     = 2;
     private static final int EVENT_RADIO_ON                         = 3;
@@ -49,7 +47,7 @@
     private static int sReferenceCount = 0;
 
     // ***** Instance Variables
-    private CommandsInterface mCM;
+    private CommandsInterface mCi;
     private Context mContext;
     private RegistrantList mCdmaSubscriptionSourceChangedRegistrants = new RegistrantList();
 
@@ -59,9 +57,9 @@
     // Constructor
     private CdmaSubscriptionSourceManager(Context context, CommandsInterface ci) {
         mContext = context;
-        mCM = ci;
-        mCM.registerForCdmaSubscriptionChanged(this, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
-        mCM.registerForOn(this, EVENT_RADIO_ON, null);
+        mCi = ci;
+        mCi.registerForCdmaSubscriptionChanged(this, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
+        mCi.registerForOn(this, EVENT_RADIO_ON, null);
         int subscriptionSource = getDefaultCdmaSubscriptionSource();
         mCdmaSubscriptionSource.set(subscriptionSource);
     }
@@ -77,7 +75,7 @@
             if (null == sInstance) {
                 sInstance = new CdmaSubscriptionSourceManager(context, ci);
             }
-            sInstance.sReferenceCount++;
+            CdmaSubscriptionSourceManager.sReferenceCount++;
         }
         sInstance.registerForCdmaSubscriptionSourceChanged(h, what, obj);
         return sInstance;
@@ -91,8 +89,8 @@
         synchronized (sReferenceCountMonitor) {
             sReferenceCount--;
             if (sReferenceCount <= 0) {
-                mCM.unregisterForCdmaSubscriptionChanged(this);
-                mCM.unregisterForOn(this);
+                mCi.unregisterForCdmaSubscriptionChanged(this);
+                mCi.unregisterForOn(this);
                 sInstance = null;
             }
         }
@@ -115,7 +113,7 @@
             }
             break;
             case EVENT_RADIO_ON: {
-                mCM.getCdmaSubscriptionSource(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_SOURCE));
+                mCi.getCdmaSubscriptionSource(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_SOURCE));
             }
             break;
             default:
@@ -182,15 +180,11 @@
     }
 
     private void log(String s) {
-        Rlog.d(LOG_TAG, "[CdmaSSM] " + s);
-    }
-
-    private void loge(String s) {
-        Rlog.e(LOG_TAG, "[CdmaSSM] " + s);
+        Rlog.d(LOG_TAG, s);
     }
 
     private void logw(String s) {
-        Rlog.w(LOG_TAG, "[CdmaSSM] " + s);
+        Rlog.w(LOG_TAG, s);
     }
 
 }
diff --git a/src/java/com/android/internal/telephony/cdma/EriInfo.java b/src/java/com/android/internal/telephony/cdma/EriInfo.java
index 3e5d37e..3e9680b 100644
--- a/src/java/com/android/internal/telephony/cdma/EriInfo.java
+++ b/src/java/com/android/internal/telephony/cdma/EriInfo.java
@@ -25,21 +25,21 @@
     public static final int ROAMING_ICON_MODE_NORMAL    = 0;
     public static final int ROAMING_ICON_MODE_FLASH     = 1;
 
-    public int mRoamingIndicator;
-    public int mIconIndex;
-    public int mIconMode;
-    public String mEriText;
-    public int mCallPromptId;
-    public int mAlertId;
+    public int roamingIndicator;
+    public int iconIndex;
+    public int iconMode;
+    public String eriText;
+    public int callPromptId;
+    public int alertId;
 
     public EriInfo (int roamingIndicator, int iconIndex, int iconMode, String eriText,
             int callPromptId, int alertId) {
 
-        this.mRoamingIndicator = roamingIndicator;
-        this.mIconIndex = iconIndex;
-        this.mIconMode = iconMode;
-        this.mEriText = eriText;
-        this.mCallPromptId = callPromptId;
-        this.mAlertId = alertId;
+        this.roamingIndicator = roamingIndicator;
+        this.iconIndex = iconIndex;
+        this.iconMode = iconMode;
+        this.eriText = eriText;
+        this.callPromptId = callPromptId;
+        this.alertId = alertId;
     }
 }
diff --git a/src/java/com/android/internal/telephony/cdma/EriManager.java b/src/java/com/android/internal/telephony/cdma/EriManager.java
index bb1707c..c213a52 100644
--- a/src/java/com/android/internal/telephony/cdma/EriManager.java
+++ b/src/java/com/android/internal/telephony/cdma/EriManager.java
@@ -19,11 +19,9 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.content.res.XmlResourceParser;
-import android.os.Message;
 import android.telephony.Rlog;
 import android.util.Xml;
 
-import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneBase;
 import com.android.internal.util.XmlUtils;
 
@@ -44,38 +42,38 @@
 
     class EriFile {
 
-        public int mVersionNumber;                      // File version number
-        public int mNumberOfEriEntries;                 // Number of entries
-        public int mEriFileType;                        // Eri Phase 0/1
-        //public int mNumberOfIconImages;               // reserved for future use
-        //public int mIconImageType;                    // reserved for future use
-        public String[] mCallPromptId;                  // reserved for future use
-        public HashMap<Integer, EriInfo> mRoamIndTable; // Roaming Indicator Table
+        int mVersionNumber;                      // File version number
+        int mNumberOfEriEntries;                 // Number of entries
+        int mEriFileType;                        // Eri Phase 0/1
+        //int mNumberOfIconImages;               // reserved for future use
+        //int mIconImageType;                    // reserved for future use
+        String[] mCallPromptId;                  // reserved for future use
+        HashMap<Integer, EriInfo> mRoamIndTable; // Roaming Indicator Table
 
-        public EriFile() {
-            this.mVersionNumber = -1;
-            this.mNumberOfEriEntries = 0;
-            this.mEriFileType = -1;
-            this.mCallPromptId = new String[] { "", "", "" };
-            this.mRoamIndTable = new HashMap<Integer, EriInfo>();
+        EriFile() {
+            mVersionNumber = -1;
+            mNumberOfEriEntries = 0;
+            mEriFileType = -1;
+            mCallPromptId = new String[] { "", "", "" };
+            mRoamIndTable = new HashMap<Integer, EriInfo>();
         }
     }
 
     class EriDisplayInformation {
-        public int mEriIconIndex;
-        public int mEriIconMode;
-        public String mEriIconText;
+        int mEriIconIndex;
+        int mEriIconMode;
+        String mEriIconText;
 
-        public EriDisplayInformation(int eriIconIndex, int eriIconMode, String eriIconText) {
+        EriDisplayInformation(int eriIconIndex, int eriIconMode, String eriIconText) {
             mEriIconIndex = eriIconIndex;
             mEriIconMode = eriIconMode;
             mEriIconText = eriIconText;
         }
 
 //        public void setParameters(int eriIconIndex, int eriIconMode, String eriIconText){
-//            this.mEriIconIndex = eriIconIndex;
-//            this.mEriIconMode = eriIconMode;
-//            this.mEriIconText = eriIconText;
+//            mEriIconIndex = eriIconIndex;
+//            mEriIconMode = eriIconMode;
+//            mEriIconText = eriIconText;
 //        }
 
         @Override
@@ -89,26 +87,24 @@
     private static final boolean DBG = true;
     private static final boolean VDBG = false;
 
-    public static final int ERI_FROM_XML          = 0;
-    public static final int ERI_FROM_FILE_SYSTEM  = 1;
-    public static final int ERI_FROM_MODEM        = 2;
+    static final int ERI_FROM_XML          = 0;
+    static final int ERI_FROM_FILE_SYSTEM  = 1;
+    static final int ERI_FROM_MODEM        = 2;
 
-    private PhoneBase mPhone;
     private Context mContext;
     private int mEriFileSource = ERI_FROM_XML;
-    private boolean isEriFileLoaded;
+    private boolean mIsEriFileLoaded;
     private EriFile mEriFile;
 
     public EriManager(PhoneBase phone, Context context, int eriFileSource) {
-        this.mPhone = phone;
-        this.mContext = context;
-        this.mEriFileSource = eriFileSource;
-        this.mEriFile = new EriFile();
+        mContext = context;
+        mEriFileSource = eriFileSource;
+        mEriFile = new EriFile();
     }
 
     public void dispose() {
         mEriFile = new EriFile();
-        isEriFileLoaded = false;
+        mIsEriFileLoaded = false;
     }
 
 
@@ -221,7 +217,7 @@
             }
 
             if (DBG) Rlog.d(LOG_TAG, "loadEriFileFromXml: eri parsing successful, file loaded");
-            isEriFileLoaded = true;
+            mIsEriFileLoaded = true;
 
         } catch (Exception e) {
             Rlog.e(LOG_TAG, "Got exception while loading ERI file.", e);
@@ -268,7 +264,7 @@
      *
      */
     public boolean isEriFileLoaded() {
-        return isEriFileLoaded;
+        return mIsEriFileLoaded;
     }
 
     /**
@@ -287,14 +283,14 @@
         EriDisplayInformation ret;
 
         // Carrier can use eri.xml to customize any built-in roaming display indications
-        if (isEriFileLoaded) {
+        if (mIsEriFileLoaded) {
             EriInfo eriInfo = getEriInfo(roamInd);
             if (eriInfo != null) {
                 if (VDBG) Rlog.v(LOG_TAG, "ERI roamInd " + roamInd + " found in ERI file");
                 ret = new EriDisplayInformation(
-                        eriInfo.mIconIndex,
-                        eriInfo.mIconMode,
-                        eriInfo.mEriText);
+                        eriInfo.iconIndex,
+                        eriInfo.iconMode,
+                        eriInfo.eriText);
                 return ret;
             }
         }
@@ -396,7 +392,7 @@
 
         // Handling the non standard Enhanced Roaming Indicator (roamInd > 63)
         default:
-            if (!isEriFileLoaded) {
+            if (!mIsEriFileLoaded) {
                 // ERI file NOT loaded
                 if (DBG) Rlog.d(LOG_TAG, "ERI File not loaded");
                 if(defRoamInd > 2) {
@@ -460,16 +456,16 @@
                             Rlog.v(LOG_TAG, "ERI defRoamInd " + defRoamInd + " found in ERI file");
                         }
                         ret = new EriDisplayInformation(
-                                defEriInfo.mIconIndex,
-                                defEriInfo.mIconMode,
-                                defEriInfo.mEriText);
+                                defEriInfo.iconIndex,
+                                defEriInfo.iconMode,
+                                defEriInfo.eriText);
                     }
                 } else {
                     if (VDBG) Rlog.v(LOG_TAG, "ERI roamInd " + roamInd + " found in ERI file");
                     ret = new EriDisplayInformation(
-                            eriInfo.mIconIndex,
-                            eriInfo.mIconMode,
-                            eriInfo.mEriText);
+                            eriInfo.iconIndex,
+                            eriInfo.iconMode,
+                            eriInfo.eriText);
                 }
             }
             break;
diff --git a/src/java/com/android/internal/telephony/cdma/RuimPhoneBookInterfaceManager.java b/src/java/com/android/internal/telephony/cdma/RuimPhoneBookInterfaceManager.java
index 75b2f59..af18324 100644
--- a/src/java/com/android/internal/telephony/cdma/RuimPhoneBookInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/cdma/RuimPhoneBookInterfaceManager.java
@@ -31,17 +31,19 @@
 
 
 public class RuimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "RuimPhoneBookIM";
 
     public RuimPhoneBookInterfaceManager(CDMAPhone phone) {
         super(phone);
         //NOTE service "simphonebook" added by IccSmsInterfaceManagerProxy
     }
 
+    @Override
     public void dispose() {
         super.dispose();
     }
 
+    @Override
     protected void finalize() {
         try {
             super.finalize();
@@ -51,17 +53,18 @@
         if(DBG) Rlog.d(LOG_TAG, "RuimPhoneBookInterfaceManager finalized");
     }
 
+    @Override
     public int[] getAdnRecordsSize(int efid) {
         if (DBG) logd("getAdnRecordsSize: efid=" + efid);
         synchronized(mLock) {
             checkThread();
-            recordSize = new int[3];
+            mRecordSize = new int[3];
 
             //Using mBaseHandler, no difference in EVENT_GET_SIZE_DONE handling
             AtomicBoolean status = new AtomicBoolean(false);
             Message response = mBaseHandler.obtainMessage(EVENT_GET_SIZE_DONE, status);
 
-            IccFileHandler fh = phone.getIccFileHandler();
+            IccFileHandler fh = mPhone.getIccFileHandler();
             //IccFileHandler can be null if there is no icc card present.
             if (fh != null) {
                 fh.getEFLinearRecordSize(efid, response);
@@ -69,13 +72,15 @@
             }
         }
 
-        return recordSize;
+        return mRecordSize;
     }
 
+    @Override
     protected void logd(String msg) {
         Rlog.d(LOG_TAG, "[RuimPbInterfaceManager] " + msg);
     }
 
+    @Override
     protected void loge(String msg) {
         Rlog.e(LOG_TAG, "[RuimPbInterfaceManager] " + msg);
     }
diff --git a/src/java/com/android/internal/telephony/cdma/RuimSmsInterfaceManager.java b/src/java/com/android/internal/telephony/cdma/RuimSmsInterfaceManager.java
index 0679470..68ad423 100644
--- a/src/java/com/android/internal/telephony/cdma/RuimSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/cdma/RuimSmsInterfaceManager.java
@@ -34,7 +34,7 @@
  * access Sms in Ruim.
  */
 public class RuimSmsInterfaceManager extends IccSmsInterfaceManager {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "RuimSmsIM";
     static final boolean DBG = true;
 
     private CdmaBroadcastRangeManager mCdmaBroadcastRangeManager =
@@ -48,6 +48,7 @@
     public void dispose() {
     }
 
+    @Override
     protected void finalize() {
         try {
             super.finalize();
@@ -57,24 +58,29 @@
         if(DBG) Rlog.d(LOG_TAG, "RuimSmsInterfaceManager finalized");
     }
 
+    @Override
     protected void deleteSms(int index, Message response) {
-        mPhone.mCM.deleteSmsOnRuim(index, response);
+        mPhone.mCi.deleteSmsOnRuim(index, response);
     }
 
+    @Override
     protected void writeSms(int status, byte[] pdu, byte[] smsc, Message response) {
         //NOTE smsc not used in RUIM
-        mPhone.mCM.writeSmsToRuim(status, IccUtils.bytesToHexString(pdu),
+        mPhone.mCi.writeSmsToRuim(status, IccUtils.bytesToHexString(pdu),
                 response);
     }
 
+    @Override
     public boolean enableCellBroadcast(int messageIdentifier) {
         return enableCellBroadcastRange(messageIdentifier, messageIdentifier);
     }
 
+    @Override
     public boolean disableCellBroadcast(int messageIdentifier) {
         return disableCellBroadcastRange(messageIdentifier, messageIdentifier);
     }
 
+    @Override
     public boolean enableCellBroadcastRange(int startMessageId, int endMessageId) {
         if (DBG) log("enableCellBroadcastRange");
 
@@ -102,6 +108,7 @@
         return true;
     }
 
+    @Override
     public boolean disableCellBroadcastRange(int startMessageId, int endMessageId) {
         if (DBG) log("disableCellBroadcastRange");
 
@@ -138,6 +145,7 @@
          * followed by zero or more calls to {@link #addRange} followed by
          * a call to {@link #finishUpdate}.
          */
+        @Override
         protected void startUpdate() {
             mConfigList.clear();
         }
@@ -148,6 +156,7 @@
          * @param startId the first id included in the range
          * @param endId the last id included in the range
          */
+        @Override
         protected void addRange(int startId, int endId, boolean selected) {
             mConfigList.add(new CdmaSmsBroadcastConfigInfo(startId, endId,
                         1, selected));
@@ -158,6 +167,7 @@
          * previous call to {@link #startUpdate}.
          * @return true if successful, false otherwise
          */
+        @Override
         protected boolean finishUpdate() {
             if (mConfigList.isEmpty()) {
                 return true;
@@ -177,7 +187,7 @@
             Message response = mHandler.obtainMessage(EVENT_SET_BROADCAST_CONFIG_DONE);
 
             mSuccess = false;
-            mPhone.mCM.setCdmaBroadcastConfig(configs, response);
+            mPhone.mCi.setCdmaBroadcastConfig(configs, response);
 
             try {
                 mLock.wait();
@@ -197,7 +207,7 @@
             Message response = mHandler.obtainMessage(EVENT_SET_BROADCAST_ACTIVATION_DONE);
 
             mSuccess = false;
-            mPhone.mCM.setCdmaBroadcastActivation(activate, response);
+            mPhone.mCi.setCdmaBroadcastActivation(activate, response);
 
             try {
                 mLock.wait();
@@ -209,6 +219,7 @@
         return mSuccess;
     }
 
+    @Override
     protected void log(String msg) {
         Rlog.d(LOG_TAG, "[RuimSmsInterfaceManager] " + msg);
     }
diff --git a/src/java/com/android/internal/telephony/cdma/SignalToneUtil.java b/src/java/com/android/internal/telephony/cdma/SignalToneUtil.java
index 5fedc52..f702a09 100644
--- a/src/java/com/android/internal/telephony/cdma/SignalToneUtil.java
+++ b/src/java/com/android/internal/telephony/cdma/SignalToneUtil.java
@@ -17,8 +17,6 @@
 package com.android.internal.telephony.cdma;
 
 import java.util.HashMap;
-import java.util.HashSet;
-import android.telephony.Rlog;
 import android.media.ToneGenerator;
 
 public class SignalToneUtil {
@@ -36,7 +34,7 @@
     static public final int IS95_CONST_IR_ALERT_HIGH = 1;
     static public final int IS95_CONST_IR_ALERT_LOW = 2;
 
-    // Based on 3GPP2 C.S0005-E, seciton 3.7.5.5 Signal,
+    // Based on 3GPP2 C.S0005-E, section 3.7.5.5 Signal,
     // set TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN to 0 to avoid
     // the alert pitch to be involved in hash calculation for
     // signal type other than IS54B.
@@ -79,7 +77,7 @@
     static public final int IS95_CONST_IR_SIG_TONE_ABBR_ALRT = 0;
 
     // Hashmap to map signalInfo To AudioTone
-    static private HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
+    static private HashMap<Integer, Integer> mHm = new HashMap<Integer, Integer>();
 
     private static Integer signalParamHash(int signalType, int alertPitch, int signal) {
         if ((signalType < 0) || (signalType > 256) || (alertPitch > 256) ||
@@ -99,7 +97,7 @@
     }
 
     public static int getAudioToneFromSignalInfo(int signalType, int alertPitch, int signal) {
-        Integer result = hm.get(signalParamHash(signalType, alertPitch, signal));
+        Integer result = mHm.get(signalParamHash(signalType, alertPitch, signal));
         if (result == null) {
             return CDMA_INVALID_TONE;
         }
@@ -109,180 +107,180 @@
     static {
 
         /* SIGNAL_TYPE_ISDN */
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_NORMAL), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                         IS95_CONST_IR_SIG_ISDN_INTGRP),
                         ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_SP_PRI), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_PAT_3), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT3);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_PING), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_PAT_5), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT5);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_PAT_6), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT6);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_PAT_7), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT7);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_ISDN_OFF), ToneGenerator.TONE_CDMA_SIGNAL_OFF);
 
         /* SIGNAL_TYPE_TONE */
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_DIAL), ToneGenerator.TONE_CDMA_DIAL_TONE_LITE);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_RING), ToneGenerator.TONE_CDMA_NETWORK_USA_RINGBACK);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_INT), ToneGenerator.TONE_SUP_INTERCEPT);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_ABB_INT), ToneGenerator.TONE_SUP_INTERCEPT_ABBREV);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_REORDER), ToneGenerator.TONE_CDMA_REORDER);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_ABB_RE), ToneGenerator.TONE_CDMA_ABBR_REORDER);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_BUSY), ToneGenerator.TONE_CDMA_NETWORK_BUSY);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_CONFIRM), ToneGenerator.TONE_SUP_CONFIRM);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_ANSWER), ToneGenerator.TONE_CDMA_ANSWER);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_CALL_W), ToneGenerator.TONE_CDMA_NETWORK_CALLWAITING);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_PIP), ToneGenerator.TONE_CDMA_PIP);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_TONE_NO_TONE), ToneGenerator.TONE_CDMA_SIGNAL_OFF);
 
         /* SIGNAL_TYPE_IS54B */
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_L), ToneGenerator.TONE_CDMA_HIGH_L);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_L), ToneGenerator.TONE_CDMA_MED_L);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_L), ToneGenerator.TONE_CDMA_LOW_L);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_SS), ToneGenerator.TONE_CDMA_HIGH_SS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_SS), ToneGenerator.TONE_CDMA_MED_SS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_SS), ToneGenerator.TONE_CDMA_LOW_SS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_SSL), ToneGenerator.TONE_CDMA_HIGH_SSL);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_SSL), ToneGenerator.TONE_CDMA_MED_SSL);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_SSL), ToneGenerator.TONE_CDMA_LOW_SSL);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_SS_2), ToneGenerator.TONE_CDMA_HIGH_SS_2);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_SS_2), ToneGenerator.TONE_CDMA_MED_SS_2);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_SS_2), ToneGenerator.TONE_CDMA_LOW_SS_2);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_SLS), ToneGenerator.TONE_CDMA_HIGH_SLS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_SLS), ToneGenerator.TONE_CDMA_MED_SLS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_SLS), ToneGenerator.TONE_CDMA_LOW_SLS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_S_X4), ToneGenerator.TONE_CDMA_HIGH_S_X4);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_S_X4), ToneGenerator.TONE_CDMA_MED_S_X4);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_S_X4), ToneGenerator.TONE_CDMA_LOW_S_X4);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_PBX_L), ToneGenerator.TONE_CDMA_HIGH_PBX_L);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_PBX_L), ToneGenerator.TONE_CDMA_MED_PBX_L);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_PBX_L), ToneGenerator.TONE_CDMA_LOW_PBX_L);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_PBX_SS), ToneGenerator.TONE_CDMA_HIGH_PBX_SS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_PBX_SS), ToneGenerator.TONE_CDMA_MED_PBX_SS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_PBX_SS), ToneGenerator.TONE_CDMA_LOW_PBX_SS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_PBX_SSL), ToneGenerator.TONE_CDMA_HIGH_PBX_SSL);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_PBX_SSL), ToneGenerator.TONE_CDMA_MED_PBX_SSL);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_PBX_SSL), ToneGenerator.TONE_CDMA_LOW_PBX_SSL);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_PBX_SLS), ToneGenerator.TONE_CDMA_HIGH_PBX_SLS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_PBX_SLS), ToneGenerator.TONE_CDMA_MED_PBX_SLS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_PBX_SLS), ToneGenerator.TONE_CDMA_LOW_PBX_SLS);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH,
                 IS95_CONST_IR_SIG_IS54B_PBX_S_X4), ToneGenerator.TONE_CDMA_HIGH_PBX_S_X4);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED,
                 IS95_CONST_IR_SIG_IS54B_PBX_S_X4), ToneGenerator.TONE_CDMA_MED_PBX_S_X4);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW,
                 IS95_CONST_IR_SIG_IS54B_PBX_S_X4), ToneGenerator.TONE_CDMA_LOW_PBX_S_X4);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN,
                 IS95_CONST_IR_SIG_IS54B_NO_TONE), ToneGenerator.TONE_CDMA_SIGNAL_OFF);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_USR_DEFD_ALERT,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_USR_DEFD_ALERT,
                 TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, IS95_CONST_IR_SIG_TONE_ABBR_ALRT),
                 ToneGenerator.TONE_CDMA_ABBR_ALERT);
 
-        hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_USR_DEFD_ALERT,
+        mHm.put(signalParamHash(IS95_CONST_IR_SIGNAL_USR_DEFD_ALERT,
                 TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, IS95_CONST_IR_SIG_TONE_NO_TONE),
                 ToneGenerator.TONE_CDMA_ABBR_ALERT);
 
diff --git a/src/java/com/android/internal/telephony/cdma/SmsMessage.java b/src/java/com/android/internal/telephony/cdma/SmsMessage.java
index 4777cbb..4300d2a 100644
--- a/src/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/src/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -46,7 +46,6 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.List;
 
 /**
  * TODO(cleanup): these constants are disturbing... are they not just
@@ -69,8 +68,9 @@
  *
  */
 public class SmsMessage extends SmsMessageBase {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "SmsMessage";
     static private final String LOGGABLE_TAG = "CDMA:SMS";
+    private static final boolean VDBG = false;
 
     private final static byte TELESERVICE_IDENTIFIER                    = 0x00;
     private final static byte SERVICE_CATEGORY                          = 0x01;
@@ -209,7 +209,7 @@
         // link the the filled objects to the SMS
         env.origAddress = addr;
         env.origSubaddress = subaddr;
-        msg.originatingAddress = addr;
+        msg.mOriginatingAddress = addr;
         msg.mEnvelope = env;
 
         // create byte stream representation for transportation through the layers.
@@ -232,7 +232,7 @@
         try {
             SmsMessage msg = new SmsMessage();
 
-            msg.indexOnIcc = index;
+            msg.mIndexOnIcc = index;
 
             // First byte is status: RECEIVED_READ, RECEIVED_UNREAD, STORED_SENT,
             // or STORED_UNSENT
@@ -241,7 +241,7 @@
                 Rlog.w(LOG_TAG, "SMS parsing failed: Trying to parse a free record");
                 return null;
             } else {
-                msg.statusOnIcc = data[0] & 0x07;
+                msg.mStatusOnIcc = data[0] & 0x07;
             }
 
             // Second byte is the MSG_LEN, length of the message
@@ -369,6 +369,7 @@
     /**
      * Note: This function is a GSM specific functionality which is not supported in CDMA mode.
      */
+    @Override
     public int getProtocolIdentifier() {
         Rlog.w(LOG_TAG, "getProtocolIdentifier: is not supported in CDMA mode.");
         // (3GPP TS 23.040): "no interworking, but SME to SME protocol":
@@ -378,6 +379,7 @@
     /**
      * Note: This function is a GSM specific functionality which is not supported in CDMA mode.
      */
+    @Override
     public boolean isReplace() {
         Rlog.w(LOG_TAG, "isReplace: is not supported in CDMA mode.");
         return false;
@@ -387,6 +389,7 @@
      * {@inheritDoc}
      * Note: This function is a GSM specific functionality which is not supported in CDMA mode.
      */
+    @Override
     public boolean isCphsMwiMessage() {
         Rlog.w(LOG_TAG, "isCphsMwiMessage: is not supported in CDMA mode.");
         return false;
@@ -395,6 +398,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isMWIClearMessage() {
         return ((mBearerData != null) && (mBearerData.numberOfMessages == 0));
     }
@@ -402,6 +406,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isMWISetMessage() {
         return ((mBearerData != null) && (mBearerData.numberOfMessages > 0));
     }
@@ -409,6 +414,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isMwiDontStore() {
         return ((mBearerData != null) &&
                 (mBearerData.numberOfMessages > 0) &&
@@ -420,11 +426,13 @@
      * For not interfering with status codes from GSM, this status code is
      * shifted to the bits 31-16.
      */
+    @Override
     public int getStatus() {
         return (status << 16);
     }
 
     /** Return true iff the bearer data message type is DELIVERY_ACK. */
+    @Override
     public boolean isStatusReportMessage() {
         return (mBearerData.messageType == BearerData.MESSAGE_TYPE_DELIVERY_ACK);
     }
@@ -432,6 +440,7 @@
     /**
      * Note: This function is a GSM specific functionality which is not supported in CDMA mode.
      */
+    @Override
     public boolean isReplyPathPresent() {
         Rlog.w(LOG_TAG, "isReplyPathPresent: is not supported in CDMA mode.");
         return false;
@@ -524,7 +533,7 @@
         }
 
         // link the filled objects to this SMS
-        originatingAddress = addr;
+        mOriginatingAddress = addr;
         env.origAddress = addr;
         mEnvelope = env;
         mPdu = pdu;
@@ -660,7 +669,7 @@
         }
 
         // link the filled objects to this SMS
-        originatingAddress = addr;
+        mOriginatingAddress = addr;
         env.origAddress = addr;
         env.origSubaddress = subAddr;
         mEnvelope = env;
@@ -680,7 +689,7 @@
             if (mEnvelope.bearerData != null) {
                 mBearerData.numberOfMessages = 0x000000FF & mEnvelope.bearerData[0];
             }
-            if (false) {
+            if (VDBG) {
                 Rlog.d(LOG_TAG, "parseSms: get MWI " +
                       Integer.toString(mBearerData.numberOfMessages));
             }
@@ -692,24 +701,24 @@
                       HexDump.toHexString(mEnvelope.bearerData) + "'");
             Rlog.d(LOG_TAG, "MT (decoded) BearerData = " + mBearerData);
         }
-        messageRef = mBearerData.messageId;
+        mMessageRef = mBearerData.messageId;
         if (mBearerData.userData != null) {
-            userData = mBearerData.userData.payload;
-            userDataHeader = mBearerData.userData.userDataHeader;
-            messageBody = mBearerData.userData.payloadStr;
+            mUserData = mBearerData.userData.payload;
+            mUserDataHeader = mBearerData.userData.userDataHeader;
+            mMessageBody = mBearerData.userData.payloadStr;
         }
 
-        if (originatingAddress != null) {
-            originatingAddress.address = new String(originatingAddress.origBytes);
-            if (false) Rlog.v(LOG_TAG, "SMS originating address: "
-                    + originatingAddress.address);
+        if (mOriginatingAddress != null) {
+            mOriginatingAddress.address = new String(mOriginatingAddress.origBytes);
+            if (VDBG) Rlog.v(LOG_TAG, "SMS originating address: "
+                    + mOriginatingAddress.address);
         }
 
         if (mBearerData.msgCenterTimeStamp != null) {
-            scTimeMillis = mBearerData.msgCenterTimeStamp.toMillis(true);
+            mScTimeMillis = mBearerData.msgCenterTimeStamp.toMillis(true);
         }
 
-        if (false) Rlog.d(LOG_TAG, "SMS SC timestamp: " + scTimeMillis);
+        if (VDBG) Rlog.d(LOG_TAG, "SMS SC timestamp: " + mScTimeMillis);
 
         // Message Type (See 3GPP2 C.S0015-B, v2, 4.5.1)
         if (mBearerData.messageType == BearerData.MESSAGE_TYPE_DELIVERY_ACK) {
@@ -722,7 +731,7 @@
             // indicate successful delivery (status == 0).
             if (! mBearerData.messageStatusSet) {
                 Rlog.d(LOG_TAG, "DELIVERY_ACK message without msgStatus (" +
-                        (userData == null ? "also missing" : "does have") +
+                        (mUserData == null ? "also missing" : "does have") +
                         " userData).");
                 status = 0;
             } else {
@@ -733,11 +742,11 @@
             throw new RuntimeException("Unsupported message type: " + mBearerData.messageType);
         }
 
-        if (messageBody != null) {
-            if (false) Rlog.v(LOG_TAG, "SMS message body: '" + messageBody + "'");
+        if (mMessageBody != null) {
+            if (VDBG) Rlog.v(LOG_TAG, "SMS message body: '" + mMessageBody + "'");
             parseMessageBody();
-        } else if ((userData != null) && (false)) {
-            Rlog.v(LOG_TAG, "SMS payload: '" + IccUtils.bytesToHexString(userData) + "'");
+        } else if ((mUserData != null) && VDBG) {
+            Rlog.v(LOG_TAG, "SMS payload: '" + IccUtils.bytesToHexString(mUserData) + "'");
         }
     }
 
diff --git a/src/java/com/android/internal/telephony/cdma/TtyIntent.java b/src/java/com/android/internal/telephony/cdma/TtyIntent.java
index 4907aa9..bc23918 100644
--- a/src/java/com/android/internal/telephony/cdma/TtyIntent.java
+++ b/src/java/com/android/internal/telephony/cdma/TtyIntent.java
@@ -18,9 +18,6 @@
 
 public class TtyIntent {
 
-    private static final String TAG = "TtyIntent";
-
-
     /** Event for TTY mode change */
 
     /**
diff --git a/src/java/com/android/internal/telephony/cdma/sms/BearerData.java b/src/java/com/android/internal/telephony/cdma/sms/BearerData.java
index c6a1d5c..49a1d5d 100644
--- a/src/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/src/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -38,7 +38,7 @@
  * An object to encode and decode CDMA SMS bearer data.
  */
 public final class BearerData {
-    private final static String LOG_TAG = "SMS";
+    private final static String LOG_TAG = "BearerData";
 
     /**
      * Bearer Data Subparameter Identifiers
@@ -411,7 +411,7 @@
         StringBuilder builder = new StringBuilder();
         builder.append("BearerData ");
         builder.append("{ messageType=" + messageType);
-        builder.append(", messageId=" + (int)messageId);
+        builder.append(", messageId=" + messageId);
         builder.append(", priority=" + (priorityIndicatorSet ? priority : "unset"));
         builder.append(", privacy=" + (privacyIndicatorSet ? privacy : "unset"));
         builder.append(", alert=" + (alertIndicatorSet ? alert : "unset"));
@@ -959,8 +959,7 @@
    }
 
     private static boolean decodeMessageId(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 3 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1119,11 +1118,7 @@
     private static String decodeShiftJis(byte[] data, int offset, int numFields)
         throws CodingException
     {
-        try {
-            return new String(data, offset, numFields - offset, "Shift_JIS");
-        } catch (java.io.UnsupportedEncodingException ex) {
-            throw new CodingException("Shift_JIS decode failed: " + ex);
-        }
+        return decodeCharset(data, offset, numFields, 1, "Shift_JIS");
     }
 
     private static void decodeUserDataPayload(UserData userData, boolean hasUserDataHeader)
@@ -1304,8 +1299,7 @@
     }
 
     private static boolean decodeReplyOption(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1328,8 +1322,7 @@
     }
 
     private static boolean decodeMsgCount(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1348,8 +1341,7 @@
     }
 
     private static boolean decodeDepositIndex(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 2 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1435,8 +1427,7 @@
     }
 
     private static boolean decodeMsgStatus(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1457,8 +1448,7 @@
     }
 
     private static boolean decodeMsgCenterTimeStamp(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 6 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1477,8 +1467,7 @@
     }
 
     private static boolean decodeValidityAbs(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 6 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1497,8 +1486,7 @@
     }
 
     private static boolean decodeDeferredDeliveryAbs(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 6 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1518,8 +1506,7 @@
     }
 
     private static boolean decodeValidityRel(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1539,8 +1526,7 @@
     }
 
     private static boolean decodeDeferredDeliveryRel(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1560,8 +1546,7 @@
     }
 
     private static boolean decodePrivacyIndicator(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1582,8 +1567,7 @@
     }
 
     private static boolean decodeLanguageIndicator(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1603,8 +1587,7 @@
     }
 
     private static boolean decodeDisplayMode(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1625,8 +1608,7 @@
     }
 
     private static boolean decodePriorityIndicator(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1647,8 +1629,7 @@
     }
 
     private static boolean decodeMsgDeliveryAlert(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
@@ -1669,8 +1650,7 @@
     }
 
     private static boolean decodeUserResponseCode(BearerData bData, BitwiseInputStream inStream)
-        throws BitwiseInputStream.AccessException, CodingException
-    {
+        throws BitwiseInputStream.AccessException {
         final int EXPECTED_PARAM_SIZE = 1 * 8;
         boolean decodeSuccess = false;
         int paramBits = inStream.read(8) * 8;
diff --git a/src/java/com/android/internal/telephony/ApnContext.java b/src/java/com/android/internal/telephony/dataconnection/ApnContext.java
similarity index 86%
rename from src/java/com/android/internal/telephony/ApnContext.java
rename to src/java/com/android/internal/telephony/dataconnection/ApnContext.java
index b6083ad..a7c4af5 100644
--- a/src/java/com/android/internal/telephony/ApnContext.java
+++ b/src/java/com/android/internal/telephony/dataconnection/ApnContext.java
@@ -14,10 +14,13 @@
  * limitations under the License.
  */
 
-package com.android.internal.telephony;
+package com.android.internal.telephony.dataconnection;
 
 import android.telephony.Rlog;
 
+import com.android.internal.telephony.DctConstants;
+import com.android.internal.telephony.Phone;
+
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -44,7 +47,7 @@
 
     private ApnSetting mApnSetting;
 
-    DataConnection mDataConnection;
+    DataConnectionBase mDataConnection;
 
     DataConnectionAc mDataConnectionAc;
 
@@ -77,11 +80,11 @@
         return mApnType;
     }
 
-    public synchronized DataConnection getDataConnection() {
+    public synchronized DataConnectionBase getDataConnection() {
         return mDataConnection;
     }
 
-    public synchronized void setDataConnection(DataConnection dc) {
+    public synchronized void setDataConnection(DataConnectionBase dc) {
         if (DBG) {
             log("setDataConnection: old dc=" + mDataConnection + " new dc=" + dc + " this=" + this);
         }
@@ -95,14 +98,14 @@
 
     public synchronized void setDataConnectionAc(DataConnectionAc dcac) {
         if (DBG) {
-            log("setDataConnectionAc: old dcac=" + mDataConnectionAc + " new dcac=" + dcac);
+            log("setDataConnectionAc: old dcac=" + mDataConnectionAc + " new dcac=" + dcac
+                    + " this=" + this);
         }
-        if (dcac != null) {
-            dcac.addApnContextSync(this);
-        } else {
-            if (mDataConnectionAc != null) {
-                mDataConnectionAc.removeApnContextSync(this);
-            }
+        if ((dcac == null) && (mDataConnectionAc != null) &&
+                (mDataConnectionAc.dataConnection != null)) {
+            // TODO: This tearDown should be done by caller, but for now we'll do it
+            if (DBG) log("setDataConnection: call tearDown");
+            mDataConnectionAc.dataConnection.tearDown(this, "", null);
         }
         mDataConnectionAc = dcac;
     }
@@ -190,7 +193,7 @@
             log("setRetryCount: " + retryCount);
         }
         mRetryCount = retryCount;
-        DataConnection dc = mDataConnection;
+        DataConnectionBase dc = mDataConnection;
         if (dc != null) {
             dc.setRetryCount(retryCount);
         }
@@ -231,7 +234,9 @@
         // We don't print mDataConnection because its recursive.
         return "{mApnType=" + mApnType + " mState=" + getState() + " mWaitingApns=" + mWaitingApns +
                 " mWaitingApnsPermanentFailureCountDown=" + mWaitingApnsPermanentFailureCountDown +
-                " mApnSetting=" + mApnSetting + " mDataConnectionAc=" + mDataConnectionAc +
+                " mApnSetting=" + mApnSetting +
+                " mDataConnection=" + ((mDataConnection != null)
+                                            ? mDataConnection.toStringSimple() : "null") +
                 " mReason=" + mReason + " mRetryCount=" + mRetryCount +
                 " mDataEnabled=" + mDataEnabled + " mDependencyMet=" + mDependencyMet + "}";
     }
diff --git a/src/java/com/android/internal/telephony/ApnSetting.java b/src/java/com/android/internal/telephony/dataconnection/ApnSetting.java
similarity index 96%
rename from src/java/com/android/internal/telephony/ApnSetting.java
rename to src/java/com/android/internal/telephony/dataconnection/ApnSetting.java
index b84c69c..0289bda 100755
--- a/src/java/com/android/internal/telephony/ApnSetting.java
+++ b/src/java/com/android/internal/telephony/dataconnection/ApnSetting.java
@@ -14,7 +14,10 @@
  * limitations under the License.
  */
 
-package com.android.internal.telephony;
+package com.android.internal.telephony.dataconnection;
+
+import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.RILConstants;
 
 /**
  * This class represents a apn setting for create PDP link
@@ -95,8 +98,6 @@
      *
      * Note that the strings generated by toString() do not contain the username
      * and password and thus cannot be read by this method.
-     *
-     * @see ApnSettingTest
      */
     public static ApnSetting fromString(String data) {
         if (data == null) return null;
@@ -152,6 +153,7 @@
                 a[9],a[4],a[5],authType,typeArray,protocol,roamingProtocol,carrierEnabled,bearer);
     }
 
+    @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("[ApnSettingV2] ")
@@ -193,8 +195,9 @@
 
     // TODO - if we have this function we should also have hashCode.
     // Also should handle changes in type order and perhaps case-insensitivity
+    @Override
     public boolean equals(Object o) {
         if (o instanceof ApnSetting == false) return false;
-        return (this.toString().equals(o.toString()));
+        return (toString().equals(o.toString()));
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/GsmDataConnection.java b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
similarity index 71%
rename from src/java/com/android/internal/telephony/gsm/GsmDataConnection.java
rename to src/java/com/android/internal/telephony/dataconnection/DataConnection.java
index af36f8e..0858931 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmDataConnection.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
@@ -14,15 +14,13 @@
  * limitations under the License.
  */
 
-package com.android.internal.telephony.gsm;
+package com.android.internal.telephony.dataconnection;
 
 import android.os.Message;
 import android.telephony.Rlog;
 import android.util.Patterns;
 import android.text.TextUtils;
 
-import com.android.internal.telephony.DataConnection;
-import com.android.internal.telephony.DataConnectionTracker;
 import com.android.internal.telephony.PhoneBase;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.RILConstants;
@@ -34,15 +32,13 @@
 /**
  * {@hide}
  */
-public class GsmDataConnection extends DataConnection {
-
-    private static final String LOG_TAG = "GSM";
+public class DataConnection extends DataConnectionBase {
 
     //***** Instance Variables
     protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT;
     //***** Constructor
-    private GsmDataConnection(PhoneBase phone, String name, int id, RetryManager rm,
-            DataConnectionTracker dct) {
+    private DataConnection(PhoneBase phone, String name, int id, RetryManager rm,
+            DataConnectionTrackerBase dct) {
         super(phone, name, id, rm, dct);
     }
 
@@ -52,12 +48,12 @@
      * @param phone the Phone
      * @param id the connection id
      * @param rm the RetryManager
-     * @return GsmDataConnection that was created.
+     * @return DataConnection that was created.
      */
-    static GsmDataConnection makeDataConnection(PhoneBase phone, int id, RetryManager rm,
-            DataConnectionTracker dct) {
-        GsmDataConnection gsmDc = new GsmDataConnection(phone,
-                "GsmDC-" + mCount.incrementAndGet(), id, rm, dct);
+    static DataConnection makeDataConnection(PhoneBase phone, int id, RetryManager rm,
+            DataConnectionTrackerBase dct) {
+        DataConnection gsmDc = new DataConnection(phone,
+                "DC-" + mCount.incrementAndGet(), id, rm, dct);
         gsmDc.start();
         if (DBG) gsmDc.log("Made " + gsmDc.getName());
         return gsmDc;
@@ -73,15 +69,15 @@
     @Override
     protected
     void onConnect(ConnectionParams cp) {
-        mApn = cp.apn;
+        mApn = cp.mApnContext.getApnSetting();
 
-        if (DBG) log("Connecting to carrier: '" + mApn.carrier
-                + "' APN: '" + mApn.apn
-                + "' proxy: '" + mApn.proxy + "' port: '" + mApn.port);
+        if (DBG) log("onConnect: carrier='" + mApn.carrier
+                + "' APN='" + mApn.apn
+                + "' proxy='" + mApn.proxy + "' port='" + mApn.port + "'");
 
-        createTime = -1;
-        lastFailTime = -1;
-        lastFailCause = FailCause.NONE;
+        mCreateTime = -1;
+        mLastFailTime = -1;
+        mLastFailCause = FailCause.NONE;
 
         // msg.obj will be returned in AsyncResult.userObj;
         Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
@@ -94,14 +90,14 @@
         }
 
         String protocol;
-        if (phone.getServiceState().getRoaming()) {
+        if (mPhone.getServiceState().getRoaming()) {
             protocol = mApn.roamingProtocol;
         } else {
             protocol = mApn.protocol;
         }
 
-        phone.mCM.setupDataCall(
-                Integer.toString(getRilRadioTechnology(RILConstants.SETUP_DATA_TECH_GSM)),
+        mPhone.mCi.setupDataCall(
+                Integer.toString(getRilRadioTechnology()),
                 Integer.toString(mProfileId),
                 mApn.apn, mApn.user, mApn.password,
                 Integer.toString(authType),
@@ -116,18 +112,24 @@
         return mProfileId;
     }
 
+    /** Doesn't print mApnList of ApnContext's which would be recursive */
+    @Override
+    public String toStringSimple() {
+        return getName() + ": State=" + getCurrentState().getName() +
+                " apnSetting=" + mApn + " RefCount=" + mApnList.size() +
+                " cid=" + mCid + " create=" + mCreateTime + " lastFail=" + mLastFailTime +
+                " lastFailCause=" + mLastFailCause;
+    }
+
     @Override
     public String toString() {
-        return "{" + getName() + ": State=" + getCurrentState().getName() +
-                " apnSetting=" + mApn + " apnList= " + mApnList + " RefCount=" + mRefCount +
-                " cid=" + cid + " create=" + createTime + " lastFail=" + lastFailTime +
-                " lastFailCause=" + lastFailCause + "}";
+        return "{" + toStringSimple() + " mApnList=" + mApnList + "}";
     }
 
     @Override
     protected boolean isDnsOk(String[] domainNameServers) {
         if (NULL_IP.equals(domainNameServers[0]) && NULL_IP.equals(domainNameServers[1])
-                && !phone.isDnsCheckDisabled()) {
+                && !mPhone.isDnsCheckDisabled()) {
             // Work around a race condition where QMI does not fill in DNS:
             // Deactivate PDP and let DataConnectionTracker retry.
             // Do not apply the race condition workaround for MMS APN
@@ -147,7 +149,7 @@
 
     @Override
     protected void log(String s) {
-        Rlog.d(LOG_TAG, "[" + getName() + "] " + s);
+        Rlog.d(getName(), s);
     }
 
     private boolean isIpAddress(String address) {
@@ -158,7 +160,7 @@
 
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-        pw.println("GsmDataConnection extends:");
+        pw.println("DataConnection extends:");
         super.dump(fd, pw, args);
         pw.println(" mProfileId=" + mProfileId);
     }
diff --git a/src/java/com/android/internal/telephony/DataConnectionAc.java b/src/java/com/android/internal/telephony/dataconnection/DataConnectionAc.java
similarity index 85%
rename from src/java/com/android/internal/telephony/DataConnectionAc.java
rename to src/java/com/android/internal/telephony/dataconnection/DataConnectionAc.java
index 2cd64e1..245223b 100644
--- a/src/java/com/android/internal/telephony/DataConnectionAc.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DataConnectionAc.java
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-package com.android.internal.telephony;
+package com.android.internal.telephony.dataconnection;
 
-import com.android.internal.telephony.DataConnection.UpdateLinkPropertyResult;
+import com.android.internal.telephony.DataCallState;
+import com.android.internal.telephony.dataconnection.DataConnectionBase.UpdateLinkPropertyResult;
 import com.android.internal.util.AsyncChannel;
 import com.android.internal.util.Protocol;
 
@@ -36,7 +37,7 @@
     private static final boolean DBG = false;
     private String mLogTag;
 
-    public DataConnection dataConnection;
+    public DataConnectionBase dataConnection;
 
     public static final int BASE = Protocol.BASE_DATA_CONNECTION_AC;
 
@@ -67,20 +68,14 @@
     public static final int REQ_GET_REFCOUNT = BASE + 16;
     public static final int RSP_GET_REFCOUNT = BASE + 17;
 
-    public static final int REQ_ADD_APNCONTEXT = BASE + 18;
-    public static final int RSP_ADD_APNCONTEXT = BASE + 19;
+    public static final int REQ_GET_APNCONTEXT_LIST = BASE + 18;
+    public static final int RSP_GET_APNCONTEXT_LIST = BASE + 19;
 
-    public static final int REQ_REMOVE_APNCONTEXT = BASE + 20;
-    public static final int RSP_REMOVE_APNCONTEXT = BASE + 21;
+    public static final int REQ_SET_RECONNECT_INTENT = BASE + 20;
+    public static final int RSP_SET_RECONNECT_INTENT = BASE + 21;
 
-    public static final int REQ_GET_APNCONTEXT_LIST = BASE + 22;
-    public static final int RSP_GET_APNCONTEXT_LIST = BASE + 23;
-
-    public static final int REQ_SET_RECONNECT_INTENT = BASE + 24;
-    public static final int RSP_SET_RECONNECT_INTENT = BASE + 25;
-
-    public static final int REQ_GET_RECONNECT_INTENT = BASE + 26;
-    public static final int RSP_GET_RECONNECT_INTENT = BASE + 27;
+    public static final int REQ_GET_RECONNECT_INTENT = BASE + 22;
+    public static final int RSP_GET_RECONNECT_INTENT = BASE + 23;
 
     private static final int CMD_TO_STRING_COUNT = RSP_GET_RECONNECT_INTENT - BASE + 1;
     private static String[] sCmdToString = new String[CMD_TO_STRING_COUNT];
@@ -107,10 +102,6 @@
         sCmdToString[RSP_RESET - BASE] = "RSP_RESET";
         sCmdToString[REQ_GET_REFCOUNT - BASE] = "REQ_GET_REFCOUNT";
         sCmdToString[RSP_GET_REFCOUNT - BASE] = "RSP_GET_REFCOUNT";
-        sCmdToString[REQ_ADD_APNCONTEXT - BASE] = "REQ_ADD_APNCONTEXT";
-        sCmdToString[RSP_ADD_APNCONTEXT - BASE] = "RSP_ADD_APNCONTEXT";
-        sCmdToString[REQ_REMOVE_APNCONTEXT - BASE] = "REQ_REMOVE_APNCONTEXT";
-        sCmdToString[RSP_REMOVE_APNCONTEXT - BASE] = "RSP_REMOVE_APNCONTEXT";
         sCmdToString[REQ_GET_APNCONTEXT_LIST - BASE] = "REQ_GET_APNCONTEXT_LIST";
         sCmdToString[RSP_GET_APNCONTEXT_LIST - BASE] = "RSP_GET_APNCONTEXT_LIST";
         sCmdToString[REQ_SET_RECONNECT_INTENT - BASE] = "REQ_SET_RECONNECT_INTENT";
@@ -147,7 +138,7 @@
         }
     }
 
-    public DataConnectionAc(DataConnection dc, String logTag) {
+    public DataConnectionAc(DataConnectionBase dc, String logTag) {
         dataConnection = dc;
         mLogTag = logTag;
     }
@@ -437,53 +428,7 @@
     }
 
     /**
-     * Request to add ApnContext association.
-     * Response RSP_ADD_APNCONTEXT when complete.
-     */
-    public void reqAddApnContext(ApnContext apnContext) {
-        Message response = sendMessageSynchronously(REQ_ADD_APNCONTEXT, apnContext);
-        if (DBG) log("reqAddApnContext");
-    }
-
-    /**
-     * Add ApnContext association synchronoulsy.
-     *
-     * @param ApnContext to associate
-     */
-    public void addApnContextSync(ApnContext apnContext) {
-        Message response = sendMessageSynchronously(REQ_ADD_APNCONTEXT, apnContext);
-        if ((response != null) && (response.what == RSP_ADD_APNCONTEXT)) {
-            if (DBG) log("addApnContext ok");
-        } else {
-            log("addApnContext error response=" + response);
-        }
-    }
-
-    /**
-     * Request to remove ApnContext association.
-     * Response RSP_REMOVE_APNCONTEXT when complete.
-     */
-    public void reqRemomveApnContext(ApnContext apnContext) {
-        Message response = sendMessageSynchronously(REQ_REMOVE_APNCONTEXT, apnContext);
-        if (DBG) log("reqRemomveApnContext");
-    }
-
-    /**
-     * Remove ApnContext associateion.
-     *
-     * @param ApnContext to dissociate
-     */
-    public void removeApnContextSync(ApnContext apnContext) {
-        Message response = sendMessageSynchronously(REQ_REMOVE_APNCONTEXT, apnContext);
-        if ((response != null) && (response.what == RSP_REMOVE_APNCONTEXT)) {
-            if (DBG) log("removeApnContext ok");
-        } else {
-            log("removeApnContext error response=" + response);
-        }
-    }
-
-    /**
-     * Request to retrive ApnContext List associated with DC.
+     * Request the ApnContext List associated with DC.
      * Response RSP_GET_APNCONTEXT_LIST when complete.
      */
     public void reqGetApnList(ApnContext apnContext) {
@@ -494,7 +439,7 @@
     /**
      * Retrieve Collection of ApnContext from the response message.
      *
-     * @param Message sent from DC in response to REQ_GET_APNCONTEXT_LIST.
+     * @param response sent from DC in response to REQ_GET_APNCONTEXT_LIST.
      * @return Collection of ApnContext
      */
     public Collection<ApnContext> rspApnList(Message response) {
@@ -533,7 +478,7 @@
     /**
      * Set pending reconnect intent to DC synchronously.
      *
-     * @param PendingIntent to set.
+     * @param intent to set.
      */
     public void setReconnectIntentSync(PendingIntent intent) {
         Message response = sendMessageSynchronously(REQ_SET_RECONNECT_INTENT, intent);
@@ -556,7 +501,7 @@
     /**
      * Retrieve reconnect intent from response message from DC.
      *
-     * @param Message which contains the reconnect intent.
+     * @param response which contains the reconnect intent.
      * @return PendingIntent from the response.
      */
     public PendingIntent rspReconnectIntent(Message response) {
diff --git a/src/java/com/android/internal/telephony/DataConnection.java b/src/java/com/android/internal/telephony/dataconnection/DataConnectionBase.java
similarity index 71%
rename from src/java/com/android/internal/telephony/DataConnection.java
rename to src/java/com/android/internal/telephony/dataconnection/DataConnectionBase.java
index 43b89d0..f0d1e09 100644
--- a/src/java/com/android/internal/telephony/DataConnection.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DataConnectionBase.java
@@ -14,16 +14,26 @@
  * limitations under the License.
  */
 
-package com.android.internal.telephony;
+package com.android.internal.telephony.dataconnection;
 
 
-import com.android.internal.telephony.DataCallState.SetupResult;
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.DataCallState;
+import com.android.internal.telephony.DctConstants;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneBase;
+import com.android.internal.telephony.RILConstants;
+import com.android.internal.telephony.RetryManager;
 import com.android.internal.util.AsyncChannel;
 import com.android.internal.util.Protocol;
 import com.android.internal.util.State;
 import com.android.internal.util.StateMachine;
 
 import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
 import android.net.LinkCapabilities;
 import android.net.LinkProperties;
 import android.net.ProxyProperties;
@@ -31,12 +41,12 @@
 import android.os.Message;
 import android.os.SystemProperties;
 import android.text.TextUtils;
+import android.telephony.Rlog;
 import android.util.TimeUtils;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -44,11 +54,10 @@
 /**
  * {@hide}
  *
- * DataConnection StateMachine.
+ * DataConnectionBase StateMachine.
  *
  * This is an abstract base class for representing a single data connection.
- * Instances of this class such as <code>CdmaDataConnection</code> and
- * <code>GsmDataConnection</code>, * represent a connection via the cellular network.
+ * Instances of this class such represent a connection via the cellular network.
  * There may be multiple data connections and all of them are managed by the
  * <code>DataConnectionTracker</code>.
  *
@@ -62,9 +71,11 @@
  *
  * The other public methods are provided for debugging.
  */
-public abstract class DataConnection extends StateMachine {
+public abstract class DataConnectionBase extends StateMachine {
+    protected static final String LOG_TAG = "DCBase";
     protected static final boolean DBG = true;
-    protected static final boolean VDBG = false;
+    protected static final boolean VDBG = true;
+    protected static final boolean DBG_FAILURE = SystemProperties.getInt("ro.debuggable", 0) == 1;
 
     protected static AtomicInteger mCount = new AtomicInteger(0);
     protected AsyncChannel mAc;
@@ -72,33 +83,36 @@
     protected List<ApnContext> mApnList = null;
     PendingIntent mReconnectIntent = null;
 
-    private DataConnectionTracker mDataConnectionTracker = null;
+    private DataConnectionTrackerBase mDataConnectionTracker = null;
 
     /**
      * Used internally for saving connecting parameters.
      */
     protected static class ConnectionParams {
-        public ConnectionParams(ApnSetting apn, Message onCompletedMsg) {
-            this.apn = apn;
-            this.onCompletedMsg = onCompletedMsg;
+        ConnectionParams(ApnContext apnContext, Message onCompletedMsg) {
+            mApnContext = apnContext;
+            mOnCompletedMsg = onCompletedMsg;
         }
 
-        public int tag;
-        public ApnSetting apn;
-        public Message onCompletedMsg;
+        int mTheTag;
+        ApnContext mApnContext;
+        Message mOnCompletedMsg;
     }
 
     /**
      * Used internally for saving disconnecting parameters.
      */
     protected static class DisconnectParams {
-        public DisconnectParams(String reason, Message onCompletedMsg) {
-            this.reason = reason;
-            this.onCompletedMsg = onCompletedMsg;
+        DisconnectParams(ApnContext apnContext, String reason, Message onCompletedMsg) {
+            mApnContext = apnContext;
+            mReason = reason;
+            mOnCompletedMsg = onCompletedMsg;
         }
-        public int tag;
-        public String reason;
-        public Message onCompletedMsg;
+
+        int mTheTag;
+        ApnContext mApnContext;
+        String mReason;
+        Message mOnCompletedMsg;
     }
 
     /**
@@ -156,7 +170,7 @@
             mErrorCode = errorCode;
         }
 
-        int getErrorCode() {
+        public int getErrorCode() {
             return mErrorCode;
         }
 
@@ -192,6 +206,173 @@
         }
     }
 
+    /**
+     * Static logging for DataConnection
+     */
+    private static void sDcLog(String s) {
+        Rlog.d(LOG_TAG, "[DC] " + s);
+    }
+
+    // Debugging INTENT with are two targets, com.android.internal.telephony.DC which
+    // is for all DataConnections and com.android.internal.telephony.<NameDC-X> where
+    // NameDc-X is a particular DC such as GsmDC-1.
+    protected static final String INTENT_BASE = DataConnectionBase.class.getPackage().getName();
+    protected static String sActionFailBringUp;
+    protected String mActionFailBringUp;
+
+    // The FailBringUp class
+    public static class FailBringUp {
+        protected static final String ACTION_FAIL_BRINGUP = "action_fail_bringup";
+
+        // counter with its --ei option name and default value
+        public static final String COUNTER = "counter";
+        public static final int DEFAULT_COUNTER = 1;
+        public int counter;
+
+        // failCause with its --ei option name and default value
+        public static final String FAIL_CAUSE = "fail_cause";
+        public static final FailCause DEFAULT_FAIL_CAUSE = FailCause.ERROR_UNSPECIFIED;
+        public FailCause failCause;
+
+        // suggestedRetryTime with its --ei option name and default value
+        public static final String SUGGESTED_RETRY_TIME = "suggested_retry_time";
+        public static final int DEFAULT_SUGGESTED_RETRY_TIME = -1;
+        public int suggestedRetryTime;
+
+        // Get the Extra Intent parameters
+        public void getEiParameters(Intent intent, String s) {
+            if (DBG) sDcLog(s + ".getEiParameters: action=" + intent.getAction());
+            counter = intent.getIntExtra(FailBringUp.COUNTER,
+                    FailBringUp.DEFAULT_COUNTER);
+            failCause = FailCause.fromInt(
+                    intent.getIntExtra(FailBringUp.FAIL_CAUSE,
+                            FailBringUp.DEFAULT_FAIL_CAUSE.getErrorCode()));
+            suggestedRetryTime =
+                    intent.getIntExtra(FailBringUp.SUGGESTED_RETRY_TIME,
+                            FailBringUp.DEFAULT_SUGGESTED_RETRY_TIME);
+            if (DBG) {
+                sDcLog(s + ".getEiParameters: " + this);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return "{counter=" + counter +
+                    " failCause=" + failCause +
+                    " suggestedRetryTime=" + suggestedRetryTime + "}";
+
+        }
+    }
+
+    // This is the static FailBringUp used to cause all DC's to "fail" a bringUp.
+    // Here is an example that sets counter to 2 and cause to -3 for all instances:
+    //
+    // adb shell am broadcast \
+    //  -a com.android.internal.telephony.DC.action_fail_bringup \
+    //  --ei counter 2 --ei fail_cause -3
+    //
+    // Also you can add a suggested retry time if desired:
+    //  --ei suggested_retry_time 5000
+    protected static FailBringUp sFailBringUp = new FailBringUp();
+
+    // The static intent receiver one for all instances.
+    protected static BroadcastReceiver sIntentReceiver = new BroadcastReceiver ()
+    {
+        @Override
+        public void onReceive(Context context, Intent intent)
+        {
+            String action = intent.getAction();
+            if (DBG) sDcLog("sIntentReceiver.onReceive: action=" + action);
+            if (action.equals(sActionFailBringUp)) {
+                sFailBringUp.getEiParameters(intent, "sFailBringUp");
+            } else {
+                if (DBG) sDcLog("onReceive: unknown action=" + action);
+            }
+        }
+    };
+
+    // This is the per instance FailBringUP used to cause one DC to "fail" a bringUp.
+    // Here is an example that sets counter to 2 and cause to -3 for GsmDC-2:
+    //
+    // adb shell am broadcast \
+    //  -a com.android.internal.telephony.GsmDC-2.action_fail_bringup \
+    //  --ei counter 2 --ei fail_cause -3
+    //
+    // Also you can add a suggested retry time if desired:
+    //  --ei suggested_retry_time 5000
+    protected FailBringUp mFailBringUp = new FailBringUp();
+
+    protected BroadcastReceiver mIntentReceiver = new BroadcastReceiver ()
+    {
+        @Override
+        public void onReceive(Context context, Intent intent)
+        {
+            String action = intent.getAction();
+            if (DBG) log("mIntentReceiver.onReceive: action=" + action);
+            if (DBG_FAILURE && action.equals(mActionFailBringUp)) {
+                mFailBringUp.getEiParameters(intent, "mFailBringUp");
+            } else {
+                if (DBG) log("onReceive: unknown action=" + action);
+            }
+        }
+    };
+
+    /**
+     * Do the on connect or fake it if an error
+     */
+    protected void doOnConnect(ConnectionParams cp) {
+        // Check if we should fake an error.
+        if (sFailBringUp.counter  > 0) {
+            DataCallState response = new DataCallState();
+            response.version = mPhone.mCi.getRilVersion();
+            response.status = sFailBringUp.failCause.getErrorCode();
+            response.cid = 0;
+            response.active = 0;
+            response.type = "";
+            response.ifname = "";
+            response.addresses = new String[0];
+            response.dnses = new String[0];
+            response.gateways = new String[0];
+            response.suggestedRetryTime = sFailBringUp.suggestedRetryTime;
+
+            Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
+            AsyncResult.forMessage(msg, response, null);
+            sendMessage(msg);
+            if (DBG) {
+                log("doOnConnect: sFailBringUp.counter=" + sFailBringUp.counter +
+                        " send error response=" + response);
+            }
+            sFailBringUp.counter -= 1;
+            return;
+        }
+        if (mFailBringUp.counter > 0) {
+            DataCallState response = new DataCallState();
+            response.version = mPhone.mCi.getRilVersion();
+            response.status = mFailBringUp.failCause.getErrorCode();
+            response.cid = 0;
+            response.active = 0;
+            response.type = "";
+            response.ifname = "";
+            response.addresses = new String[0];
+            response.dnses = new String[0];
+            response.gateways = new String[0];
+            response.suggestedRetryTime = mFailBringUp.suggestedRetryTime;
+
+            Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
+            AsyncResult.forMessage(msg, response, null);
+            sendMessage(msg);
+            if (DBG) {
+                log("doOnConnect: mFailBringUp.counter=" + mFailBringUp.counter +
+                        " send error response=" + response);
+            }
+            mFailBringUp.counter -= 1;
+            return;
+        }
+
+        // Else do the normal onConnection
+        onConnect(cp);
+    }
+
     public static class CallSetupException extends Exception {
         private int mRetryOverride = -1;
 
@@ -241,42 +422,69 @@
     //***** Member Variables
     protected ApnSetting mApn;
     protected int mTag;
-    protected PhoneBase phone;
+    protected PhoneBase mPhone;
     protected int mRilVersion = -1;
-    protected int cid;
+    protected int mCid;
     protected LinkProperties mLinkProperties = new LinkProperties();
     protected LinkCapabilities mCapabilities = new LinkCapabilities();
-    protected long createTime;
-    protected long lastFailTime;
-    protected FailCause lastFailCause;
+    protected long mCreateTime;
+    protected long mLastFailTime;
+    protected FailCause mLastFailCause;
     protected int mRetryOverride = -1;
     protected static final String NULL_IP = "0.0.0.0";
-    protected int mRefCount;
-    Object userData;
+    Object mUserData;
 
     //***** Abstract methods
     @Override
     public abstract String toString();
 
+    // A Non recursive toString
+    public String toStringSimple() {
+        return toString();
+    }
+
     protected abstract void onConnect(ConnectionParams cp);
 
     protected abstract boolean isDnsOk(String[] domainNameServers);
 
-    protected abstract void log(String s);
-
    //***** Constructor
-    protected DataConnection(PhoneBase phone, String name, int id, RetryManager rm,
-            DataConnectionTracker dct) {
+    protected DataConnectionBase(PhoneBase phone, String name, int id, RetryManager rm,
+            DataConnectionTrackerBase dct) {
         super(name);
-        setLogRecSize(100);
-        if (DBG) log("DataConnection constructor E");
-        this.phone = phone;
-        this.mDataConnectionTracker = dct;
+        setLogRecSize(300);
+        setLogOnlyTransitions(true);
+        if (DBG) log("DataConnectionBase constructor E");
+        mPhone = phone;
+        mDataConnectionTracker = dct;
         mId = id;
         mRetryMgr = rm;
-        this.cid = -1;
+        mCid = -1;
 
-        setDbg(false);
+        if (DBG_FAILURE) {
+            IntentFilter filter;
+
+            synchronized (DataConnectionBase.class) {
+                // Register the static Intent receiver once
+                if (sActionFailBringUp == null) {
+                    sActionFailBringUp = INTENT_BASE + ".DC." +
+                            FailBringUp.ACTION_FAIL_BRINGUP;
+
+                    filter = new IntentFilter();
+                    filter.addAction(sActionFailBringUp);
+                    phone.getContext().registerReceiver(sIntentReceiver, filter, null, phone);
+                    log("DataConnectionBase: register sActionFailBringUp=" + sActionFailBringUp);
+                }
+            }
+
+            // Register the per instance Intent receiver
+            mActionFailBringUp = INTENT_BASE + "." + getName() + "." +
+                    FailBringUp.ACTION_FAIL_BRINGUP;
+            filter = new IntentFilter();
+            filter.addAction(mActionFailBringUp);
+            phone.getContext().registerReceiver(mIntentReceiver, filter, null, phone);
+            log("DataConnectionBase: register mActionFailBringUp=" + mActionFailBringUp);
+        }
+
         addState(mDefaultState);
             addState(mInactiveState, mDefaultState);
             addState(mActivatingState, mDefaultState);
@@ -286,7 +494,7 @@
         setInitialState(mInactiveState);
 
         mApnList = new ArrayList<ApnContext>();
-        if (DBG) log("DataConnection constructor X");
+        if (DBG) log("DataConnectionBase constructor X");
     }
 
     /**
@@ -303,11 +511,11 @@
         mReconnectIntent = null;
         mDataConnectionTracker = null;
         mApn = null;
-        phone = null;
+        mPhone = null;
         mLinkProperties = null;
         mCapabilities = null;
-        lastFailCause = null;
-        userData = null;
+        mLastFailCause = null;
+        mUserData = null;
     }
 
     /**
@@ -320,16 +528,16 @@
         int discReason = RILConstants.DEACTIVATE_REASON_NONE;
         if ((o != null) && (o instanceof DisconnectParams)) {
             DisconnectParams dp = (DisconnectParams)o;
-            Message m = dp.onCompletedMsg;
-            if (TextUtils.equals(dp.reason, Phone.REASON_RADIO_TURNED_OFF)) {
+            Message m = dp.mOnCompletedMsg;
+            if (TextUtils.equals(dp.mReason, Phone.REASON_RADIO_TURNED_OFF)) {
                 discReason = RILConstants.DEACTIVATE_REASON_RADIO_OFF;
-            } else if (TextUtils.equals(dp.reason, Phone.REASON_PDP_RESET)) {
+            } else if (TextUtils.equals(dp.mReason, Phone.REASON_PDP_RESET)) {
                 discReason = RILConstants.DEACTIVATE_REASON_PDP_RESET;
             }
         }
-        if (phone.mCM.getRadioState().isOn()) {
+        if (mPhone.mCi.getRadioState().isOn()) {
             if (DBG) log("tearDownData radio is on, call deactivateDataCall");
-            phone.mCM.deactivateDataCall(cid, discReason, obtainMessage(EVENT_DEACTIVATE_DONE, o));
+            mPhone.mCi.deactivateDataCall(mCid, discReason, obtainMessage(EVENT_DEACTIVATE_DONE, o));
         } else {
             if (DBG) log("tearDownData radio is off sendMessage EVENT_DEACTIVATE_DONE immediately");
             AsyncResult ar = new AsyncResult(o, null, null);
@@ -344,20 +552,20 @@
      * @param cause
      */
     private void notifyConnectCompleted(ConnectionParams cp, FailCause cause) {
-        Message connectionCompletedMsg = cp.onCompletedMsg;
+        Message connectionCompletedMsg = cp.mOnCompletedMsg;
         if (connectionCompletedMsg == null) {
             return;
         }
 
         long timeStamp = System.currentTimeMillis();
-        connectionCompletedMsg.arg1 = cid;
+        connectionCompletedMsg.arg1 = mCid;
 
         if (cause == FailCause.NONE) {
-            createTime = timeStamp;
+            mCreateTime = timeStamp;
             AsyncResult.forMessage(connectionCompletedMsg);
         } else {
-            lastFailCause = cause;
-            lastFailTime = timeStamp;
+            mLastFailCause = cause;
+            mLastFailTime = timeStamp;
             AsyncResult.forMessage(connectionCompletedMsg, cause,
                                    new CallSetupException(mRetryOverride));
         }
@@ -377,13 +585,13 @@
         ApnContext alreadySent = null;
         String reason = null;
 
-        if (dp.onCompletedMsg != null) {
+        if (dp.mOnCompletedMsg != null) {
             // Get ApnContext, but only valid on GSM devices this is a string on CDMA devices.
-            Message msg = dp.onCompletedMsg;
+            Message msg = dp.mOnCompletedMsg;
             if (msg.obj instanceof ApnContext) {
                 alreadySent = (ApnContext)msg.obj;
             }
-            reason = dp.reason;
+            reason = dp.mReason;
             if (VDBG) {
                 log(String.format("msg=%s msg.obj=%s", msg.toString(),
                     ((msg.obj instanceof String) ? (String) msg.obj : "<no-reason>")));
@@ -405,12 +613,12 @@
         if (DBG) log("NotifyDisconnectCompleted DisconnectParams=" + dp);
     }
 
-    protected int getRilRadioTechnology(int defaultRilRadioTechnology) {
+    protected int getRilRadioTechnology() {
         int rilRadioTechnology;
-        if (mRilVersion < 6) {
-            rilRadioTechnology = defaultRilRadioTechnology;
+        if (mApn.bearer > 0) {
+            rilRadioTechnology = mApn.bearer + 2;
         } else {
-            rilRadioTechnology = phone.getServiceState().getRilRadioTechnology() + 2;
+            rilRadioTechnology = mPhone.getServiceState().getRilDataRadioTechnology() + 2;
         }
         return rilRadioTechnology;
     }
@@ -418,7 +626,7 @@
     /*
      * **************************************************************************
      * Begin Members and methods owned by DataConnectionTracker but stored
-     * in a DataConnection because there is one per connection.
+     * in a DataConnectionBase because there is one per connection.
      * **************************************************************************
      */
 
@@ -525,14 +733,14 @@
     protected void clearSettings() {
         if (DBG) log("clearSettings");
 
-        createTime = -1;
-        lastFailTime = -1;
-        lastFailCause = FailCause.NONE;
+        mCreateTime = -1;
+        mLastFailTime = -1;
+        mLastFailCause = FailCause.NONE;
         mRetryOverride = -1;
-        mRefCount = 0;
-        cid = -1;
+        mCid = -1;
 
         mLinkProperties = new LinkProperties();
+        mApnList.clear();
         mApn = null;
     }
 
@@ -564,9 +772,9 @@
                 result = DataCallState.SetupResult.ERR_RilError;
                 result.mFailCause = FailCause.fromInt(response.status);
             }
-        } else if (cp.tag != mTag) {
+        } else if (cp.mTheTag != mTag) {
             if (DBG) {
-                log("BUG: onSetupConnectionCompleted is stale cp.tag=" + cp.tag + ", mtag=" + mTag);
+                log("BUG: onSetupConnectionCompleted is stale cp.tag=" + cp.mTheTag + ", mtag=" + mTag);
             }
             result = DataCallState.SetupResult.ERR_Stale;
         } else if (response.status != 0) {
@@ -574,7 +782,7 @@
             result.mFailCause = FailCause.fromInt(response.status);
         } else {
             if (DBG) log("onSetupConnectionCompleted received DataCallState: " + response);
-            cid = response.cid;
+            mCid = response.cid;
             result = updateLinkProperty(response).setupResult;
         }
 
@@ -646,11 +854,11 @@
     private class DcDefaultState extends State {
         @Override
         public void enter() {
-            phone.mCM.registerForRilConnected(getHandler(), EVENT_RIL_CONNECTED, null);
+            mPhone.mCi.registerForRilConnected(getHandler(), EVENT_RIL_CONNECTED, null);
         }
         @Override
         public void exit() {
-            phone.mCM.unregisterForRilConnected(getHandler());
+            mPhone.mCi.unregisterForRilConnected(getHandler());
             shutDown();
         }
         @Override
@@ -658,6 +866,10 @@
             boolean retVal = HANDLED;
             AsyncResult ar;
 
+            if (VDBG) {
+                log("DcDefault msg=0x" + Integer.toHexString(msg.what)
+                        + " RefCount=" + mApnList.size());
+            }
             switch (msg.what) {
                 case AsyncChannel.CMD_CHANNEL_FULL_CONNECTION: {
                     if (mAc != null) {
@@ -685,8 +897,8 @@
                     break;
                 }
                 case DataConnectionAc.REQ_GET_CID: {
-                    if (VDBG) log("REQ_GET_CID  cid=" + cid);
-                    mAc.replyToMessage(msg, DataConnectionAc.RSP_GET_CID, cid);
+                    if (VDBG) log("REQ_GET_CID  cid=" + mCid);
+                    mAc.replyToMessage(msg, DataConnectionAc.RSP_GET_CID, mCid);
                     break;
                 }
                 case DataConnectionAc.REQ_GET_APNSETTING: {
@@ -732,24 +944,8 @@
                     transitionTo(mInactiveState);
                     break;
                 case DataConnectionAc.REQ_GET_REFCOUNT: {
-                    if (VDBG) log("REQ_GET_REFCOUNT  refCount=" + mRefCount);
-                    mAc.replyToMessage(msg, DataConnectionAc.RSP_GET_REFCOUNT, mRefCount);
-                    break;
-                }
-                case DataConnectionAc.REQ_ADD_APNCONTEXT: {
-                    ApnContext apnContext = (ApnContext) msg.obj;
-                    if (VDBG) log("REQ_ADD_APNCONTEXT apn=" + apnContext.getApnType());
-                    if (!mApnList.contains(apnContext)) {
-                        mApnList.add(apnContext);
-                    }
-                    mAc.replyToMessage(msg, DataConnectionAc.RSP_ADD_APNCONTEXT);
-                    break;
-                }
-                case DataConnectionAc.REQ_REMOVE_APNCONTEXT: {
-                    ApnContext apnContext = (ApnContext) msg.obj;
-                    if (VDBG) log("REQ_REMOVE_APNCONTEXT apn=" + apnContext.getApnType());
-                    mApnList.remove(apnContext);
-                    mAc.replyToMessage(msg, DataConnectionAc.RSP_REMOVE_APNCONTEXT);
+                    if (VDBG) log("REQ_GET_REFCOUNT  RefCount=" + mApnList.size());
+                    mAc.replyToMessage(msg, DataConnectionAc.RSP_GET_REFCOUNT, mApnList.size());
                     break;
                 }
                 case DataConnectionAc.REQ_GET_APNCONTEXT_LIST: {
@@ -779,14 +975,16 @@
 
                 case EVENT_DISCONNECT:
                     if (DBG) {
-                        log("DcDefaultState deferring msg.what=EVENT_DISCONNECT" + mRefCount);
+                        log("DcDefaultState deferring msg.what=EVENT_DISCONNECT RefCount="
+                                + mApnList.size());
                     }
                     deferMessage(msg);
                     break;
 
                 case EVENT_DISCONNECT_ALL:
                     if (DBG) {
-                        log("DcDefaultState deferring msg.what=EVENT_DISCONNECT_ALL" + mRefCount);
+                        log("DcDefaultState deferring msg.what=EVENT_DISCONNECT_ALL RefCount="
+                                + mApnList.size());
                     }
                     deferMessage(msg);
                     break;
@@ -884,13 +1082,13 @@
 
                 case EVENT_CONNECT:
                     ConnectionParams cp = (ConnectionParams) msg.obj;
-                    cp.tag = mTag;
+                    mApnList.add(cp.mApnContext);
+                    cp.mTheTag = mTag;
                     if (DBG) {
-                        log("DcInactiveState msg.what=EVENT_CONNECT." + "RefCount = "
-                                + mRefCount);
+                        log("DcInactiveState msg.what=EVENT_CONNECT " + "RefCount="
+                                + mApnList.size());
                     }
-                    mRefCount = 1;
-                    onConnect(cp);
+                    doOnConnect(cp);
                     transitionTo(mActivatingState);
                     retVal = HANDLED;
                     break;
@@ -932,14 +1130,19 @@
 
             switch (msg.what) {
                 case EVENT_CONNECT:
-                    if (DBG) log("DcActivatingState deferring msg.what=EVENT_CONNECT refCount = "
-                            + mRefCount);
+                    if (DBG) {
+                        log("DcActivatingState deferring msg.what=EVENT_CONNECT RefCount="
+                                + mApnList.size());
+                    }
                     deferMessage(msg);
                     retVal = HANDLED;
                     break;
 
                 case EVENT_SETUP_DATA_CONNECTION_DONE:
-                    if (DBG) log("DcActivatingState msg.what=EVENT_SETUP_DATA_CONNECTION_DONE");
+                    if (DBG) {
+                        log("DcActivatingState msg.what=EVENT_SETUP_DATA_CONNECTION_DONE"
+                                + " RefCount=" + mApnList.size());
+                    }
 
                     ar = (AsyncResult) msg.obj;
                     cp = (ConnectionParams) ar.userObj;
@@ -966,7 +1169,7 @@
                             break;
                         case ERR_GetLastErrorFromRil:
                             // Request failed and this is an old RIL
-                            phone.mCM.getLastDataCallFailCause(
+                            mPhone.mCi.getLastDataCallFailCause(
                                     obtainMessage(EVENT_GET_LAST_FAIL_DONE, cp));
                             break;
                         case ERR_RilError:
@@ -989,8 +1192,11 @@
                     cp = (ConnectionParams) ar.userObj;
                     FailCause cause = FailCause.UNKNOWN;
 
-                    if (cp.tag == mTag) {
-                        if (DBG) log("DcActivatingState msg.what=EVENT_GET_LAST_FAIL_DONE");
+                    if (cp.mTheTag == mTag) {
+                        if (DBG) {
+                            log("DcActivatingState msg.what=EVENT_GET_LAST_FAIL_DONE"
+                                    + " RefCount=" + mApnList.size());
+                        }
                         if (ar.exception == null) {
                             int rilFailCause = ((int[]) (ar.result))[0];
                             cause = FailCause.fromInt(rilFailCause);
@@ -1002,7 +1208,7 @@
                     } else {
                         if (DBG) {
                             log("DcActivatingState EVENT_GET_LAST_FAIL_DONE is stale cp.tag="
-                                + cp.tag + ", mTag=" + mTag);
+                                + cp.mTheTag + ", mTag=" + mTag + " RefCount=" + mApnList.size());
                         }
                     }
 
@@ -1012,7 +1218,7 @@
                 default:
                     if (VDBG) {
                         log("DcActivatingState not handled msg.what=0x" +
-                                Integer.toHexString(msg.what));
+                                Integer.toHexString(msg.what) + " RefCount=" + mApnList.size());
                     }
                     retVal = NOT_HANDLED;
                     break;
@@ -1061,43 +1267,59 @@
             boolean retVal;
 
             switch (msg.what) {
-                case EVENT_CONNECT:
-                    mRefCount++;
-                    if (DBG) log("DcActiveState msg.what=EVENT_CONNECT RefCount=" + mRefCount);
-                    if (msg.obj != null) {
-                        notifyConnectCompleted((ConnectionParams) msg.obj, FailCause.NONE);
-                    }
-                    retVal = HANDLED;
-                    break;
-                case EVENT_DISCONNECT:
-                    mRefCount--;
-                    if (DBG) log("DcActiveState msg.what=EVENT_DISCONNECT RefCount=" + mRefCount);
-                    if (mRefCount == 0)
-                    {
-                        DisconnectParams dp = (DisconnectParams) msg.obj;
-                        dp.tag = mTag;
-                        tearDownData(dp);
-                        transitionTo(mDisconnectingState);
+                case EVENT_CONNECT: {
+                    ConnectionParams cp = (ConnectionParams) msg.obj;
+                    if (mApnList.contains(cp.mApnContext)) {
+                        log("DcActiveState ERROR already added apnContext=" + cp.mApnContext
+                                    + " to this DC=" + this);
                     } else {
-                        if (msg.obj != null) {
-                            notifyDisconnectCompleted((DisconnectParams) msg.obj, false);
+                        mApnList.add(cp.mApnContext);
+                        if (DBG) {
+                            log("DcActiveState msg.what=EVENT_CONNECT RefCount=" + mApnList.size());
                         }
                     }
+                    notifyConnectCompleted(cp, FailCause.NONE);
                     retVal = HANDLED;
                     break;
-
-                case EVENT_DISCONNECT_ALL:
-                    if (DBG) {
-                        log("DcActiveState msg.what=EVENT_DISCONNECT_ALL RefCount=" + mRefCount);
-                    }
-                    mRefCount = 0;
+                }
+                case EVENT_DISCONNECT: {
                     DisconnectParams dp = (DisconnectParams) msg.obj;
-                    dp.tag = mTag;
+                    if (mApnList.contains(dp.mApnContext)) {
+                        if (DBG) {
+                            log("DcActiveState msg.what=EVENT_DISCONNECT RefCount="
+                                    + mApnList.size());
+                        }
+
+                        if (mApnList.size() == 1) {
+                            mApnList.clear();
+                            dp.mTheTag = mTag;
+                            tearDownData(dp);
+                            transitionTo(mDisconnectingState);
+                        } else {
+                            mApnList.remove(dp.mApnContext);
+                            notifyDisconnectCompleted(dp, false);
+                        }
+                    } else {
+                        log("DcActiveState ERROR no such apnContext=" + dp.mApnContext
+                                + " in this DC=" + this);
+                        notifyDisconnectCompleted(dp, false);
+                    }
+                    retVal = HANDLED;
+                    break;
+                }
+                case EVENT_DISCONNECT_ALL: {
+                    if (DBG) {
+                        log("DcActiveState msg.what=EVENT_DISCONNECT_ALL RefCount="
+                                + mApnList.size() + " clearing apn contexts");
+                    }
+                    mApnList.clear();
+                    DisconnectParams dp = (DisconnectParams) msg.obj;
+                    dp.mTheTag = mTag;
                     tearDownData(dp);
                     transitionTo(mDisconnectingState);
                     retVal = HANDLED;
                     break;
-
+                }
                 default:
                     if (VDBG) {
                         log("DcActiveState not handled msg.what=0x" +
@@ -1122,23 +1344,24 @@
             switch (msg.what) {
                 case EVENT_CONNECT:
                     if (DBG) log("DcDisconnectingState msg.what=EVENT_CONNECT. Defer. RefCount = "
-                            + mRefCount);
+                            + mApnList.size());
                     deferMessage(msg);
                     retVal = HANDLED;
                     break;
 
                 case EVENT_DEACTIVATE_DONE:
-                    if (DBG) log("DcDisconnectingState msg.what=EVENT_DEACTIVATE_DONE");
+                    if (DBG) log("DcDisconnectingState msg.what=EVENT_DEACTIVATE_DONE RefCount="
+                            + mApnList.size());
                     AsyncResult ar = (AsyncResult) msg.obj;
                     DisconnectParams dp = (DisconnectParams) ar.userObj;
-                    if (dp.tag == mTag) {
+                    if (dp.mTheTag == mTag) {
                         // Transition to inactive but send notifications after
                         // we've entered the mInactive state.
                         mInactiveState.setEnterNotificationParams((DisconnectParams) ar.userObj);
                         transitionTo(mInactiveState);
                     } else {
                         if (DBG) log("DcDisconnectState EVENT_DEACTIVATE_DONE stale dp.tag="
-                                + dp.tag + " mTag=" + mTag);
+                                + dp.mTheTag + " mTag=" + mTag);
                     }
                     retVal = HANDLED;
                     break;
@@ -1168,7 +1391,7 @@
                 case EVENT_DEACTIVATE_DONE:
                     AsyncResult ar = (AsyncResult) msg.obj;
                     ConnectionParams cp = (ConnectionParams) ar.userObj;
-                    if (cp.tag == mTag) {
+                    if (cp.mTheTag == mTag) {
                         if (DBG) {
                             log("DcDisconnectionErrorCreatingConnection" +
                                 " msg.what=EVENT_DEACTIVATE_DONE");
@@ -1182,7 +1405,7 @@
                     } else {
                         if (DBG) {
                             log("DcDisconnectionErrorCreatingConnection EVENT_DEACTIVATE_DONE" +
-                                    " stale dp.tag=" + cp.tag + ", mTag=" + mTag);
+                                    " stale dp.tag=" + cp.mTheTag + ", mTag=" + mTag);
                         }
                     }
                     retVal = HANDLED;
@@ -1209,13 +1432,14 @@
      * Used for cellular networks that use Acesss Point Names (APN) such
      * as GSM networks.
      *
+     * @param apnContext is the Access Point Name to bring up a connection to
      * @param onCompletedMsg is sent with its msg.obj as an AsyncResult object.
      *        With AsyncResult.userObj set to the original msg.obj,
      *        AsyncResult.result = FailCause and AsyncResult.exception = Exception().
-     * @param apn is the Access Point Name to bring up a connection to
      */
-    public void bringUp(Message onCompletedMsg, ApnSetting apn) {
-        sendMessage(obtainMessage(EVENT_CONNECT, new ConnectionParams(apn, onCompletedMsg)));
+    public void bringUp(ApnContext apnContext, Message onCompletedMsg) {
+        if (DBG) log("bringUp: apnContext=" + apnContext + " onCompletedMsg=" + onCompletedMsg);
+        sendMessage(obtainMessage(EVENT_CONNECT, new ConnectionParams(apnContext, onCompletedMsg)));
     }
 
     /**
@@ -1224,8 +1448,13 @@
      * @param onCompletedMsg is sent with its msg.obj as an AsyncResult object.
      *        With AsyncResult.userObj set to the original msg.obj.
      */
-    public void tearDown(String reason, Message onCompletedMsg) {
-        sendMessage(obtainMessage(EVENT_DISCONNECT, new DisconnectParams(reason, onCompletedMsg)));
+    public void tearDown(ApnContext apnContext, String reason, Message onCompletedMsg) {
+        if (DBG) {
+            log("tearDown: apnContext=" + apnContext
+                    + " reason=" + reason + " onCompletedMsg=" + onCompletedMsg);
+        }
+        sendMessage(obtainMessage(EVENT_DISCONNECT,
+                        new DisconnectParams(apnContext, reason, onCompletedMsg)));
     }
 
     /**
@@ -1236,8 +1465,9 @@
      *        With AsyncResult.userObj set to the original msg.obj.
      */
     public void tearDownAll(String reason, Message onCompletedMsg) {
+        if (DBG) log("tearDownAll: reason=" + reason + " onCompletedMsg=" + onCompletedMsg);
         sendMessage(obtainMessage(EVENT_DISCONNECT_ALL,
-                new DisconnectParams(reason, onCompletedMsg)));
+                new DisconnectParams(null, reason, onCompletedMsg)));
     }
 
     /**
@@ -1262,28 +1492,28 @@
      */
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-        pw.print("DataConnection ");
+        pw.print("DataConnectionBase ");
         super.dump(fd, pw, args);
-        pw.println(" mApnList=" + mApnList);
+        pw.println(" mApnContexts.size=" + mApnList.size());
+        pw.println(" mApnContexts=" + mApnList);
         pw.flush();
         pw.println(" mDataConnectionTracker=" + mDataConnectionTracker);
         pw.println(" mApn=" + mApn);
         pw.println(" mTag=" + mTag);
         pw.flush();
-        pw.println(" phone=" + phone);
+        pw.println(" mPhone=" + mPhone);
         pw.println(" mRilVersion=" + mRilVersion);
-        pw.println(" cid=" + cid);
+        pw.println(" mCid=" + mCid);
         pw.flush();
         pw.println(" mLinkProperties=" + mLinkProperties);
         pw.flush();
         pw.println(" mCapabilities=" + mCapabilities);
-        pw.println(" createTime=" + TimeUtils.logTimeOfDay(createTime));
-        pw.println(" lastFailTime=" + TimeUtils.logTimeOfDay(lastFailTime));
-        pw.println(" lastFailCause=" + lastFailCause);
+        pw.println(" mCreateTime=" + TimeUtils.logTimeOfDay(mCreateTime));
+        pw.println(" mLastFailTime=" + TimeUtils.logTimeOfDay(mLastFailTime));
+        pw.println(" mLastFailCause=" + mLastFailCause);
         pw.flush();
         pw.println(" mRetryOverride=" + mRetryOverride);
-        pw.println(" mRefCount=" + mRefCount);
-        pw.println(" userData=" + userData);
+        pw.println(" mUserData=" + mUserData);
         if (mRetryMgr != null) pw.println(" " + mRetryMgr);
         pw.flush();
     }
diff --git a/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/src/java/com/android/internal/telephony/dataconnection/DataConnectionTracker.java
similarity index 90%
rename from src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
rename to src/java/com/android/internal/telephony/dataconnection/DataConnectionTracker.java
index ae5fb0f..4095288 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DataConnectionTracker.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.internal.telephony.gsm;
+package com.android.internal.telephony.dataconnection;
 
 import android.app.AlarmManager;
 import android.app.PendingIntent;
@@ -34,7 +34,6 @@
 import android.net.NetworkConfig;
 import android.net.NetworkUtils;
 import android.net.ProxyProperties;
-import android.net.TrafficStats;
 import android.net.Uri;
 import android.os.AsyncResult;
 import android.os.Message;
@@ -51,24 +50,23 @@
 import android.util.EventLog;
 import android.telephony.Rlog;
 
-import com.android.internal.telephony.ApnContext;
-import com.android.internal.telephony.ApnSetting;
-import com.android.internal.telephony.DataCallState;
-import com.android.internal.telephony.DataConnection;
-import com.android.internal.telephony.DataConnection.FailCause;
-import com.android.internal.telephony.DataConnection.UpdateLinkPropertyResult;
-import com.android.internal.telephony.DataConnectionAc;
-import com.android.internal.telephony.DataConnectionTracker;
-import com.android.internal.telephony.DctConstants;
-import com.android.internal.telephony.EventLogTags;
-import com.android.internal.telephony.IccCard;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneBase;
+import com.android.internal.telephony.dataconnection.ApnContext;
+import com.android.internal.telephony.dataconnection.ApnSetting;
+import com.android.internal.telephony.DataCallState;
+import com.android.internal.telephony.dataconnection.DataConnectionBase;
+import com.android.internal.telephony.dataconnection.DataConnectionBase.FailCause;
+import com.android.internal.telephony.dataconnection.DataConnectionBase.UpdateLinkPropertyResult;
+import com.android.internal.telephony.dataconnection.DataConnectionAc;
+import com.android.internal.telephony.dataconnection.DataConnectionTrackerBase;
+import com.android.internal.telephony.DctConstants;
+import com.android.internal.telephony.EventLogTags;
+import com.android.internal.telephony.gsm.GSMPhone;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.RILConstants;
 import com.android.internal.telephony.RetryManager;
 import com.android.internal.telephony.uicc.IccRecords;
-import com.android.internal.telephony.uicc.UiccCard;
 import com.android.internal.telephony.uicc.UiccController;
 import com.android.internal.util.AsyncChannel;
 
@@ -78,13 +76,12 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * {@hide}
  */
-public final class GsmDataConnectionTracker extends DataConnectionTracker {
-    protected final String LOG_TAG = "GSM";
+public final class DataConnectionTracker extends DataConnectionTrackerBase {
+    protected final String LOG_TAG = "DCT";
 
     /**
      * Handles changes to the APN db.
@@ -121,50 +118,52 @@
     static final Uri PREFERAPN_NO_UPDATE_URI =
                         Uri.parse("content://telephony/carriers/preferapn_no_update");
     static final String APN_ID = "apn_id";
-    private boolean canSetPreferApn = false;
-
-    private static final boolean DATA_STALL_SUSPECTED = true;
-    private static final boolean DATA_STALL_NOT_SUSPECTED = false;
+    private boolean mCanSetPreferApn = false;
 
     @Override
     protected void onActionIntentReconnectAlarm(Intent intent) {
         String reason = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON);
-        int connectionId = intent.getIntExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE, -1);
+        String apnType = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE);
         int retryCount = intent.getIntExtra(INTENT_RECONNECT_ALARM_EXTRA_RETRY_COUNT, 0);
 
-        DataConnectionAc dcac= mDataConnectionAsyncChannels.get(connectionId);
+        ApnContext apnContext = mApnContexts.get(apnType);
 
         if (DBG) {
             log("onActionIntentReconnectAlarm: mState=" + mState + " reason=" + reason +
-                    " connectionId=" + connectionId + " retryCount=" + retryCount + " dcac=" + dcac
-                    + " mDataConnectionAsyncChannels=" + mDataConnectionAsyncChannels);
+                    " retryCount=" + retryCount +
+                    " apnType=" + apnType + " apnContext=" + apnContext +
+                    " mDataConnectionAsyncChannels=" + mDataConnectionAsyncChannels);
         }
 
-        if (dcac != null) {
-            for (ApnContext apnContext : dcac.getApnListSync()) {
-                apnContext.setReason(reason);
-                apnContext.setRetryCount(retryCount);
-                DctConstants.State apnContextState = apnContext.getState();
-                if (DBG) {
-                    log("onActionIntentReconnectAlarm: apnContext state=" + apnContextState);
-                }
-                if ((apnContextState == DctConstants.State.FAILED)
-                        || (apnContextState == DctConstants.State.IDLE)) {
-                    if (DBG) {
-                        log("onActionIntentReconnectAlarm: state is FAILED|IDLE, disassociate");
-                    }
-                    apnContext.setDataConnectionAc(null);
-                    apnContext.setDataConnection(null);
-                    apnContext.setState(DctConstants.State.IDLE);
-                } else {
-                    if (DBG) {
-                        log("onActionIntentReconnectAlarm: keep associated");
-                    }
-                }
-                sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, apnContext));
+        if ((apnContext != null) && (apnContext.isEnabled())) {
+            apnContext.setReason(reason);
+            apnContext.setRetryCount(retryCount);
+            DctConstants.State apnContextState = apnContext.getState();
+            if (DBG) {
+                log("onActionIntentReconnectAlarm: apnContext state=" + apnContextState);
             }
-            // Alram had expired. Clear pending intent recorded on the DataConnection.
-            dcac.setReconnectIntentSync(null);
+            if ((apnContextState == DctConstants.State.FAILED)
+                    || (apnContextState == DctConstants.State.IDLE)) {
+                if (DBG) {
+                    log("onActionIntentReconnectAlarm: state is FAILED|IDLE, disassociate");
+                }
+                apnContext.setDataConnectionAc(null);
+                apnContext.setDataConnection(null);
+                apnContext.setState(DctConstants.State.IDLE);
+            } else {
+                if (DBG) log("onActionIntentReconnectAlarm: keep associated");
+            }
+            // TODO: IF already associated should we send the EVENT_TRY_SETUP_DATA???
+            sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, apnContext));
+
+            DataConnectionAc dcac = apnContext.getDataConnectionAc();
+            if (dcac != null) {
+                Collection<ApnContext> apnList = dcac.getApnListSync();
+                log("onActionIntentReconnectAlarm: dcac.getApnListSync()=" + apnList);
+                // Alarm had expired. Clear pending intent recorded on the DataConnection.
+                // TODO: Maybe store in apnContext????
+                dcac.setReconnectIntentSync(null);
+            }
         }
     }
 
@@ -173,13 +172,13 @@
 
     //***** Constructor
 
-    public GsmDataConnectionTracker(PhoneBase p) {
+    public DataConnectionTracker(PhoneBase p) {
         super(p);
         if (DBG) log("GsmDCT.constructor");
-        p.mCM.registerForAvailable (this, DctConstants.EVENT_RADIO_AVAILABLE, null);
-        p.mCM.registerForOffOrNotAvailable(this, DctConstants.EVENT_RADIO_OFF_OR_NOT_AVAILABLE,
+        p.mCi.registerForAvailable (this, DctConstants.EVENT_RADIO_AVAILABLE, null);
+        p.mCi.registerForOffOrNotAvailable(this, DctConstants.EVENT_RADIO_OFF_OR_NOT_AVAILABLE,
                 null);
-        p.mCM.registerForDataNetworkStateChanged (this, DctConstants.EVENT_DATA_STATE_CHANGED,
+        p.mCi.registerForDataNetworkStateChanged (this, DctConstants.EVENT_DATA_STATE_CHANGED,
                 null);
         p.getCallTracker().registerForVoiceCallEnded (this, DctConstants.EVENT_VOICE_CALL_ENDED,
                 null);
@@ -215,11 +214,11 @@
         super.dispose();
 
         //Unregister for all events
-        mPhone.mCM.unregisterForAvailable(this);
-        mPhone.mCM.unregisterForOffOrNotAvailable(this);
+        mPhone.mCi.unregisterForAvailable(this);
+        mPhone.mCi.unregisterForOffOrNotAvailable(this);
         IccRecords r = mIccRecords.get();
         if (r != null) { r.unregisterForRecordsLoaded(this);}
-        mPhone.mCM.unregisterForDataNetworkStateChanged(this);
+        mPhone.mCi.unregisterForDataNetworkStateChanged(this);
         mPhone.getCallTracker().unregisterForVoiceCallEnded(this);
         mPhone.getCallTracker().unregisterForVoiceCallStarted(this);
         mPhone.getServiceStateTracker().unregisterForDataConnectionAttached(this);
@@ -229,7 +228,7 @@
         mPhone.getServiceStateTracker().unregisterForPsRestrictedEnabled(this);
         mPhone.getServiceStateTracker().unregisterForPsRestrictedDisabled(this);
 
-        mPhone.getContext().getContentResolver().unregisterContentObserver(this.mApnObserver);
+        mPhone.getContext().getContentResolver().unregisterContentObserver(mApnObserver);
         mApnContexts.clear();
 
         destroyDataConnections();
@@ -244,7 +243,7 @@
     }
 
     @Override
-    protected boolean isDataPossible(String apnType) {
+    public boolean isDataPossible(String apnType) {
         ApnContext apnContext = mApnContexts.get(apnType);
         if (apnContext == null) {
             return false;
@@ -341,7 +340,7 @@
     }
 
     @Override
-    protected LinkProperties getLinkProperties(String apnType) {
+    public LinkProperties getLinkProperties(String apnType) {
         ApnContext apnContext = mApnContexts.get(apnType);
         if (apnContext != null) {
             DataConnectionAc dcac = apnContext.getDataConnectionAc();
@@ -355,7 +354,7 @@
     }
 
     @Override
-    protected LinkCapabilities getLinkCapabilities(String apnType) {
+    public LinkCapabilities getLinkCapabilities(String apnType) {
         ApnContext apnContext = mApnContexts.get(apnType);
         if (apnContext!=null) {
             DataConnectionAc dataConnectionAc = apnContext.getDataConnectionAc();
@@ -380,7 +379,7 @@
             }
         }
 
-        return (String[])result.toArray(new String[0]);
+        return result.toArray(new String[0]);
     }
 
     @Override
@@ -422,6 +421,7 @@
     }
 
     // Return state of overall
+    @Override
     public DctConstants.State getOverallState() {
         boolean isConnecting = false;
         boolean isFailed = true; // All enabled Apns should be FAILED.
@@ -436,7 +436,6 @@
                     if (DBG) log("overall state is CONNECTED");
                     return DctConstants.State.CONNECTED;
                 case CONNECTING:
-                case INITING:
                     isConnecting = true;
                     isFailed = false;
                     break;
@@ -444,6 +443,9 @@
                 case SCANNING:
                     isFailed = false;
                     break;
+                default:
+                    isAnyEnabled = true;
+                    break;
                 }
             }
         }
@@ -468,7 +470,7 @@
     /**
      * Ensure that we are connected to an APN of the specified type.
      *
-     * @param type the APN type
+     * @param apnType the APN type
      * @return Success is indicated by {@code PhoneConstants.APN_ALREADY_ACTIVE} or
      *         {@code PhoneConstants.APN_REQUEST_STARTED}. In the latter case, a
      *         broadcast will be sent by the ConnectivityManager when a
@@ -497,25 +499,6 @@
         return PhoneConstants.APN_REQUEST_STARTED;
     }
 
-    // A new APN has gone active and needs to send events to catch up with the
-    // current condition
-    private void notifyApnIdUpToCurrent(String reason, ApnContext apnContext, String type) {
-        switch (apnContext.getState()) {
-            case IDLE:
-            case INITING:
-                break;
-            case CONNECTING:
-            case SCANNING:
-                mPhone.notifyDataConnection(reason, type, PhoneConstants.DataState.CONNECTING);
-                break;
-            case CONNECTED:
-            case DISCONNECTING:
-                mPhone.notifyDataConnection(reason, type, PhoneConstants.DataState.CONNECTING);
-                mPhone.notifyDataConnection(reason, type, PhoneConstants.DataState.CONNECTED);
-                break;
-        }
-    }
-
     @Override
     public synchronized int disableApnType(String type) {
         if (DBG) log("disableApnType:" + type);
@@ -566,7 +549,7 @@
         synchronized (mDataEnabledLock) {
             if (!(mInternalDataEnabled && mUserDataEnabled && sPolicyDataEnabled)) return false;
             for (ApnContext apnContext : mApnContexts.values()) {
-                // Make sure we dont have a context that going down
+                // Make sure we don't have a context that is going down
                 // and is explicitly disabled.
                 if (isDataAllowed(apnContext)) {
                     return true;
@@ -726,7 +709,7 @@
     private boolean trySetupData(ApnContext apnContext) {
         if (DBG) {
             log("trySetupData for type:" + apnContext.getApnType() +
-                    " due to " + apnContext.getReason());
+                    " due to " + apnContext.getReason() + " apnContext=" + apnContext);
             log("trySetupData with mIsPsRestricted=" + mIsPsRestricted);
         }
 
@@ -736,7 +719,7 @@
             apnContext.setState(DctConstants.State.CONNECTED);
             mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType());
 
-            log("trySetupData: (fix?) We're on the simulator; assuming data is connected");
+            log("trySetupData: X We're on the simulator; assuming connected retValue=true");
             return true;
         }
 
@@ -749,9 +732,9 @@
             if (apnContext.getState() == DctConstants.State.IDLE) {
                 ArrayList<ApnSetting> waitingApns = buildWaitingApns(apnContext.getApnType());
                 if (waitingApns.isEmpty()) {
-                    if (DBG) log("trySetupData: No APN found");
-                    notifyNoData(GsmDataConnection.FailCause.MISSING_UNKNOWN_APN, apnContext);
+                    notifyNoData(DataConnectionBase.FailCause.MISSING_UNKNOWN_APN, apnContext);
                     notifyOffApnsOfAvailability(apnContext.getReason());
+                    if (DBG) log("trySetupData: X No APN found retValue=false");
                     return false;
                 } else {
                     apnContext.setWaitingApns(waitingApns);
@@ -762,11 +745,14 @@
             }
 
             if (DBG) {
-                log ("Setup watingApns : " + apnListToString(apnContext.getWaitingApns()));
+                log("trySetupData: call setupData, waitingApns : "
+                        + apnListToString(apnContext.getWaitingApns()));
             }
             // apnContext.setReason(apnContext.getReason());
             boolean retValue = setupData(apnContext);
             notifyOffApnsOfAvailability(apnContext.getReason());
+
+            if (DBG) log("trySetupData: X retValue=" + retValue);
             return retValue;
         } else {
             // TODO: check the condition.
@@ -775,6 +761,7 @@
                     || apnContext.getState() == DctConstants.State.SCANNING))
                 mPhone.notifyDataConnectionFailed(apnContext.getReason(), apnContext.getApnType());
             notifyOffApnsOfAvailability(apnContext.getReason());
+            if (DBG) log ("trySetupData: X apnContext not 'ready' retValue=false");
             return false;
         }
     }
@@ -790,7 +777,7 @@
                                             PhoneConstants.DataState.DISCONNECTED);
             } else {
                 if (DBG) {
-                    log("notifyOffApnsOfAvailability skipped apn due to isReady==false: " +
+                    log("notifyOffApnsOfAvailability skipped apn due to isReady==true: " +
                             apnContext.toString());
                 }
             }
@@ -799,10 +786,10 @@
 
     /**
      * If tearDown is true, this only tears down a CONNECTED session. Presently,
-     * there is no mechanism for abandoning an INITING/CONNECTING session,
+     * there is no mechanism for abandoning an CONNECTING session,
      * but would likely involve cancelling pending async requests or
      * setting a flag or new state to ignore them when they came in
-     * @param tearDown true if the underlying GsmDataConnection should be
+     * @param tearDown true if the underlying DataConnection should be
      * disconnected.
      * @param reason reason for the clean up.
      */
@@ -828,8 +815,7 @@
      *       Also, make sure when you clean up a conn, if it is last apply
      *       logic as though it is cleanupAllConnections
      *
-     * @param tearDown true if the underlying DataConnection should be disconnected.
-     * @param reason for the clean up.
+     * @param cause for the clean up.
      */
 
     @Override
@@ -882,7 +868,8 @@
                         if (disconnectAll) {
                             apnContext.getDataConnection().tearDownAll(apnContext.getReason(), msg);
                         } else {
-                            apnContext.getDataConnection().tearDown(apnContext.getReason(), msg);
+                            apnContext.getDataConnection()
+                                .tearDown(apnContext, apnContext.getReason(), msg);
                         }
                         apnContext.setState(DctConstants.State.DISCONNECTING);
                     }
@@ -920,7 +907,7 @@
     /**
      * Cancels the alarm associated with DCAC.
      *
-     * @param DataConnectionAc on which the alarm should be stopped.
+     * @param dcac on which the alarm should be stopped.
      */
     private void cancelReconnectAlarm(DataConnectionAc dcac) {
         if (dcac == null) return;
@@ -1001,62 +988,31 @@
         // TODO: Fix retry handling so free DataConnections have empty apnlists.
         // Probably move retry handling into DataConnections and reduce complexity
         // of DCT.
-        for (ApnContext apnContext : dcac.getApnListSync()) {
-            if (DBG) {
-                log("dataConnectionNotInUse: removing apnContext=" + apnContext);
-            }
-            dcac.removeApnContextSync(apnContext);
-        }
+        if (DBG) log("dataConnectionNotInUse: tearDownAll");
+        dcac.dataConnection.tearDownAll("No connection", null);
         if (DBG) log("dataConnectionNotInUse: not in use return true");
         return true;
     }
 
-    private GsmDataConnection findFreeDataConnection() {
+    private DataConnection findFreeDataConnection() {
         for (DataConnectionAc dcac : mDataConnectionAsyncChannels.values()) {
             if (dcac.isInactiveSync() && dataConnectionNotInUse(dcac)) {
-                DataConnection dc = dcac.dataConnection;
+                DataConnectionBase dc = dcac.dataConnection;
                 if (DBG) {
-                    log("findFreeDataConnection: found free GsmDataConnection=" +
+                    log("findFreeDataConnection: found free DataConnection=" +
                         " dcac=" + dcac + " dc=" + dc);
                 }
-                return (GsmDataConnection) dc;
+                return (DataConnection) dc;
             }
         }
-        log("findFreeDataConnection: NO free GsmDataConnection");
+        log("findFreeDataConnection: NO free DataConnection");
         return null;
     }
 
-    protected GsmDataConnection findReadyDataConnection(ApnSetting apn) {
-        if (apn == null) {
-            return null;
-        }
-        if (DBG) {
-            log("findReadyDataConnection: apn string <" + apn + ">" +
-                    " dcacs.size=" + mDataConnectionAsyncChannels.size());
-        }
-        for (DataConnectionAc dcac : mDataConnectionAsyncChannels.values()) {
-            ApnSetting apnSetting = dcac.getApnSettingSync();
-            if (DBG) {
-                log("findReadyDataConnection: dc apn string <" +
-                         (apnSetting != null ? (apnSetting.toString()) : "null") + ">");
-            }
-            if ((apnSetting != null) && TextUtils.equals(apnSetting.toString(), apn.toString())) {
-                DataConnection dc = dcac.dataConnection;
-                if (DBG) {
-                    log("findReadyDataConnection: found ready GsmDataConnection=" +
-                        " dcac=" + dcac + " dc=" + dc);
-                }
-                return (GsmDataConnection) dc;
-            }
-        }
-        return null;
-    }
-
-
     private boolean setupData(ApnContext apnContext) {
         if (DBG) log("setupData: apnContext=" + apnContext);
         ApnSetting apn;
-        GsmDataConnection dc;
+        DataConnection dc;
 
         int profileId = getApnProfileID(apnContext.getApnType());
         apn = apnContext.getNextWaitingApn();
@@ -1066,24 +1022,19 @@
         }
 
 
-        dc = (GsmDataConnection) checkForConnectionForApnContext(apnContext);
+        dc = (DataConnection) checkForConnectionForApnContext(apnContext);
 
         if (dc == null) {
-            dc = findReadyDataConnection(apn);
-
-            if (dc == null) {
-                if (DBG) log("setupData: No ready GsmDataConnection found!");
-                // TODO: When allocating you are mapping type to id. If more than 1 free,
-                // then could findFreeDataConnection get the wrong one??
-                dc = findFreeDataConnection();
-            }
+            // TODO: When allocating you are mapping type to id. If more than 1 free,
+            // then could findFreeDataConnection get the wrong one??
+            dc = findFreeDataConnection();
 
             if (dc == null) {
                 dc = createDataConnection();
             }
 
             if (dc == null) {
-                if (DBG) log("setupData: No free GsmDataConnection found!");
+                if (DBG) log("setupData: No free DataConnection found!");
                 return false;
             }
         } else {
@@ -1094,7 +1045,7 @@
         dc.setProfileId( profileId );  //  assumed no connection sharing on profiled types
 
         int refCount = dcac.getRefCountSync();
-        if (DBG) log("setupData: init dc and apnContext refCount=" + refCount);
+        if (DBG) log("setupData: init dc and apnContext RefCount=" + refCount);
 
         // configure retry count if no other Apn is using the same connection.
         if (refCount == 0) {
@@ -1105,10 +1056,10 @@
         apnContext.setDataConnection(dc);
 
         apnContext.setApnSetting(apn);
-        apnContext.setState(DctConstants.State.INITING);
+        apnContext.setState(DctConstants.State.CONNECTING);
         mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType());
         // If reconnect alarm is active on this DataConnection, wait for the alarm being
-        // fired so that we don't disruppt data retry pattern engaged.
+        // fired so that we don't disrupt data retry pattern engaged.
         if (apnContext.getDataConnectionAc().getReconnectIntentSync() != null) {
             if (DBG) log("setupData: data reconnection pending");
             apnContext.setState(DctConstants.State.FAILED);
@@ -1119,7 +1070,7 @@
         Message msg = obtainMessage();
         msg.what = DctConstants.EVENT_DATA_SETUP_COMPLETE;
         msg.obj = apnContext;
-        dc.bringUp(msg, apn);
+        dc.bringUp(apnContext, msg);
 
         if (DBG) log("setupData: initing!");
         return true;
@@ -1184,8 +1135,7 @@
                 }
                 if (!found) {
                     // ApnContext does not have dcac reported in data call list.
-                    // Fetch all the ApnContexts that map to this dcac which are in
-                    // INITING state too.
+                    // Fetch all the ApnContexts that map to this dcac.
                     if (DBG) log("findApnContextToClean(ar): Connected apn not found in the list (" +
                                  apnContext.toString() + ")");
                     if (apnContext.getDataConnectionAc() != null) {
@@ -1253,8 +1203,7 @@
             ArrayList<ApnContext> connectedApns = new ArrayList<ApnContext>();
             for (ApnContext apnContext : apns) {
                 if (apnContext.getState() == DctConstants.State.CONNECTED ||
-                       apnContext.getState() == DctConstants.State.CONNECTING ||
-                       apnContext.getState() == DctConstants.State.INITING) {
+                       apnContext.getState() == DctConstants.State.CONNECTING) {
                     connectedApns.add(apnContext);
                 }
             }
@@ -1384,6 +1333,7 @@
     }
 
     // TODO: For multiple Active APNs not exactly sure how to do this.
+    @Override
     protected void gotoIdleAndNotifyDataConnection(String reason) {
         if (DBG) log("gotoIdleAndNotifyDataConnection: reason=" + reason);
         notifyDataConnection(reason);
@@ -1412,8 +1362,8 @@
      * seems like it deserves an error notification.
      * Transient errors are ignored
      */
-    private boolean shouldPostNotification(GsmDataConnection.FailCause  cause) {
-        return (cause != GsmDataConnection.FailCause.UNKNOWN);
+    private boolean shouldPostNotification(DataConnection.FailCause  cause) {
+        return (cause != DataConnection.FailCause.UNKNOWN);
     }
 
     /**
@@ -1482,6 +1432,7 @@
                                 + "-- likely transient error");
                 }
             } else {
+                apnContext.setState(DctConstants.State.FAILED);
                 notifyNoData(lastFailCauseCode, apnContext);
             }
         }
@@ -1504,8 +1455,8 @@
                                    dcac.dataConnection.getDataConnectionId());
         String reason = apnContext.getReason();
         intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON, reason);
-        int connectionId = dcac.dataConnection.getDataConnectionId();
-        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE, connectionId);
+        String apnType = apnContext.getApnType();
+        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE, apnType);
 
         // TODO: Until a real fix is created, which probably entails pushing
         // retires into the DC itself, this fix gets the retry count and
@@ -1519,7 +1470,7 @@
 
         if (DBG) {
             log("startAlarmForReconnect: next attempt in " + (delay / 1000) + "s" +
-                    " reason='" + reason + "' connectionId=" + connectionId +
+                    " reason='" + reason + "' apnType=" + apnType +
                     " retryCount=" + retryCount);
         }
 
@@ -1531,10 +1482,9 @@
 
     }
 
-    private void notifyNoData(GsmDataConnection.FailCause lastFailCauseCode,
+    private void notifyNoData(DataConnectionBase.FailCause lastFailCauseCode,
                               ApnContext apnContext) {
         if (DBG) log( "notifyNoData: type=" + apnContext.getApnType());
-        apnContext.setState(DctConstants.State.FAILED);
         if (lastFailCauseCode.isPermanentFail()
             && (!apnContext.getApnType().equals(PhoneConstants.APN_TYPE_DEFAULT))) {
             mPhone.notifyDataConnectionFailed(apnContext.getReason(), apnContext.getApnType());
@@ -1544,7 +1494,7 @@
     private void onRecordsLoaded() {
         if (DBG) log("onRecordsLoaded: createAllApnList");
         createAllApnList();
-        if (mPhone.mCM.getRadioState().isOn()) {
+        if (mPhone.mCi.getRadioState().isOn()) {
             if (DBG) log("onRecordsLoaded: notifying data availability");
             notifyOffApnsOfAvailability(Phone.REASON_SIM_LOADED);
         }
@@ -1605,7 +1555,7 @@
         if (trySetup) trySetupData(apnContext);
     }
 
-    private DataConnection checkForConnectionForApnContext(ApnContext apnContext) {
+    private DataConnectionBase checkForConnectionForApnContext(ApnContext apnContext) {
         // Loop through all apnContexts looking for one with a conn that satisfies this apnType
         String apnType = apnContext.getApnType();
         ApnSetting dunSetting = null;
@@ -1614,9 +1564,9 @@
             dunSetting = fetchDunApn();
         }
 
-        DataConnection potential = null;
+        DataConnectionBase potential = null;
         for (ApnContext c : mApnContexts.values()) {
-            DataConnection conn = c.getDataConnection();
+            DataConnectionBase conn = c.getDataConnection();
             if (conn != null) {
                 ApnSetting apnSetting = c.getApnSetting();
                 if (dunSetting != null) {
@@ -1630,6 +1580,9 @@
                                 return conn;
                             case CONNECTING:
                                 potential = conn;
+                            default:
+                                // Not connected, potential unchanged
+                                break;
                         }
                     }
                 } else if (apnSetting != null && apnSetting.canHandleType(apnType)) {
@@ -1642,6 +1595,9 @@
                             return conn;
                         case CONNECTING:
                             potential = conn;
+                        default:
+                            // Not connected, potential unchanged
+                            break;
                     }
                 }
             }
@@ -1756,7 +1712,7 @@
     @Override
     protected void onDataSetupComplete(AsyncResult ar) {
 
-        DataConnection.FailCause cause = DataConnection.FailCause.UNKNOWN;
+        DataConnectionBase.FailCause cause = DataConnectionBase.FailCause.UNKNOWN;
         boolean handleError = false;
         ApnContext apnContext = null;
 
@@ -1766,7 +1722,7 @@
             throw new RuntimeException("onDataSetupComplete: No apnContext");
         }
 
-        if (isDataSetupCompleteOk(ar)) {
+        if (ar.exception == null) {
             DataConnectionAc dcac = apnContext.getDataConnectionAc();
 
             if (RADIO_TESTS) {
@@ -1789,10 +1745,10 @@
             }
             if (dcac == null) {
                 log("onDataSetupComplete: no connection to DC, handle as error");
-                cause = DataConnection.FailCause.CONNECTION_TO_DATACONNECTIONAC_BROKEN;
+                cause = DataConnectionBase.FailCause.CONNECTION_TO_DATACONNECTIONAC_BROKEN;
                 handleError = true;
             } else {
-                DataConnection dc = apnContext.getDataConnection();
+                DataConnectionBase dc = apnContext.getDataConnection();
                 ApnSetting apn = apnContext.getApnSetting();
                 if (DBG) {
                     log("onDataSetupComplete: success apn=" + (apn == null ? "unknown" : apn.apn));
@@ -1813,7 +1769,7 @@
                 // everything is setup
                 if(TextUtils.equals(apnContext.getApnType(),PhoneConstants.APN_TYPE_DEFAULT)) {
                     SystemProperties.set("gsm.defaultpdpcontext.active", "true");
-                    if (canSetPreferApn && mPreferredApn == null) {
+                    if (mCanSetPreferApn && mPreferredApn == null) {
                         if (DBG) log("onDataSetupComplete: PREFERED APN is null");
                         mPreferredApn = apn;
                         if (mPreferredApn != null) {
@@ -1826,7 +1782,7 @@
                 notifyDefaultData(apnContext);
             }
         } else {
-            cause = (DataConnection.FailCause) (ar.result);
+            cause = (DataConnectionBase.FailCause) (ar.result);
             if (DBG) {
                 ApnSetting apn = apnContext.getApnSetting();
                 log(String.format("onDataSetupComplete: error apn=%s cause=%s",
@@ -1868,9 +1824,9 @@
                     if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
                     // check to see if retry should be overridden for this failure.
                     int retryOverride = -1;
-                    if (ar.exception instanceof DataConnection.CallSetupException) {
+                    if (ar.exception instanceof DataConnectionBase.CallSetupException) {
                         retryOverride =
-                            ((DataConnection.CallSetupException)ar.exception).getRetryOverride();
+                            ((DataConnectionBase.CallSetupException)ar.exception).getRetryOverride();
                     }
                     if (retryOverride == RILConstants.MAX_INT) {
                         if (DBG) log("No retry is suggested.");
@@ -1936,7 +1892,7 @@
     protected void onPollPdp() {
         if (getOverallState() == DctConstants.State.CONNECTED) {
             // only poll when connected
-            mPhone.mCM.getDataCallList(this.obtainMessage(DctConstants.EVENT_DATA_STATE_CHANGED));
+            mPhone.mCi.getDataCallList(obtainMessage(DctConstants.EVENT_DATA_STATE_CHANGED));
             sendMessageDelayed(obtainMessage(DctConstants.EVENT_POLL_PDP), POLL_PDP_MILLIS);
         }
     }
@@ -1979,6 +1935,7 @@
         }
     }
 
+    @Override
     protected boolean isConnected() {
         for (ApnContext apnContext : mApnContexts.values()) {
             if (apnContext.getState() ==DctConstants.State.CONNECTED) {
@@ -2045,7 +2002,7 @@
             if (DBG) log("createAllApnList: No APN found for carrier: " + operator);
             mPreferredApn = null;
             // TODO: What is the right behaviour?
-            //notifyNoData(GsmDataConnection.FailCause.MISSING_UNKNOWN_APN);
+            //notifyNoData(DataConnection.FailCause.MISSING_UNKNOWN_APN);
         } else {
             mPreferredApn = getPreferredApn();
             if (mPreferredApn != null && !mPreferredApn.numeric.equals(operator)) {
@@ -2058,12 +2015,12 @@
     }
 
     /** Return the id for a new data connection */
-    private GsmDataConnection createDataConnection() {
+    private DataConnection createDataConnection() {
         if (DBG) log("createDataConnection E");
 
         RetryManager rm = new RetryManager();
         int id = mUniqueIdGenerator.getAndIncrement();
-        GsmDataConnection conn = GsmDataConnection.makeDataConnection(mPhone, id, rm, this);
+        DataConnection conn = DataConnection.makeDataConnection(mPhone, id, rm, this);
         mDataConnections.put(id, conn);
         DataConnectionAc dcac = new DataConnectionAc(conn, LOG_TAG);
         int status = dcac.fullyConnectSync(mPhone.getContext(), this, conn.getHandler());
@@ -2083,7 +2040,7 @@
         return conn;
     }
 
-    private void configureRetry(DataConnection dc, boolean forDefault, int retryCount) {
+    private void configureRetry(DataConnectionBase dc, boolean forDefault, int retryCount) {
         if (DBG) {
             log("configureRetry: forDefault=" + forDefault + " retryCount=" + retryCount +
                     " dc=" + dc);
@@ -2127,6 +2084,7 @@
      *          error when waitingApns.isEmpty()
      */
     private ArrayList<ApnSetting> buildWaitingApns(String requestedApnType) {
+        if (DBG) log("buildWaitingApns: E requestedApnType=" + requestedApnType);
         ArrayList<ApnSetting> apnList = new ArrayList<ApnSetting>();
 
         if (requestedApnType.equals(PhoneConstants.APN_TYPE_DUN)) {
@@ -2140,7 +2098,7 @@
 
         IccRecords r = mIccRecords.get();
         String operator = (r != null) ? r.getOperatorNumeric() : "";
-        int radioTech = mPhone.getServiceState().getRilRadioTechnology();
+        int radioTech = mPhone.getServiceState().getRilDataRadioTechnology();
 
         // This is a workaround for a bug (7305641) where we don't failover to other
         // suitable APNs if our preferred APN fails.  On prepaid ATT sims we need to
@@ -2152,10 +2110,18 @@
             usePreferred = ! mPhone.getContext().getResources().getBoolean(com.android.
                     internal.R.bool.config_dontPreferApn);
         } catch (Resources.NotFoundException e) {
+            if (DBG) log("buildWaitingApns: usePreferred NotFoundException set to true");
             usePreferred = true;
         }
+        if (DBG) {
+            log("buildWaitingApns: usePreferred=" + usePreferred
+                    + " canSetPreferApn=" + mCanSetPreferApn
+                    + " mPreferredApn=" + mPreferredApn
+                    + " operator=" + operator + " radioTech=" + radioTech
+                    + " IccRecords r=" + r);
+        }
 
-        if (usePreferred && canSetPreferApn && mPreferredApn != null &&
+        if (usePreferred && mCanSetPreferApn && mPreferredApn != null &&
                 mPreferredApn.canHandleType(requestedApnType)) {
             if (DBG) {
                 log("buildWaitingApns: Preferred APN:" + operator + ":"
@@ -2178,14 +2144,26 @@
             }
         }
         if (mAllApns != null) {
+            if (DBG) log("buildWaitingApns: mAllApns=" + mAllApns);
             for (ApnSetting apn : mAllApns) {
+                if (DBG) log("buildWaitingApns: apn=" + apn);
                 if (apn.canHandleType(requestedApnType)) {
                     if (apn.bearer == 0 || apn.bearer == radioTech) {
-                        if (DBG) log("apn info : " +apn.toString());
+                        if (DBG) log("buildWaitingApns: adding apn=" + apn.toString());
                         apnList.add(apn);
+                    } else {
+                        if (DBG) {
+                            log("buildWaitingApns: bearer:" + apn.bearer + " != "
+                                    + "radioTech:" + radioTech);
+                        }
                     }
+                } else {
+                if (DBG) {
+                    log("buildWaitingApns: couldn't handle requesedApnType="
+                            + requestedApnType);
                 }
             }
+            }
         } else {
             loge("mAllApns is empty!");
         }
@@ -2203,14 +2181,15 @@
         return result.toString();
     }
 
-    private void startDelayedRetry(GsmDataConnection.FailCause cause,
+    private void startDelayedRetry(DataConnection.FailCause cause,
                                    ApnContext apnContext, int retryOverride) {
+        apnContext.setState(DctConstants.State.FAILED);
         notifyNoData(cause, apnContext);
         reconnectAfterFail(cause, apnContext, retryOverride);
     }
 
     private void setPreferredApn(int pos) {
-        if (!canSetPreferApn) {
+        if (!mCanSetPreferApn) {
             log("setPreferredApn: X !canSEtPreferApn");
             return;
         }
@@ -2238,16 +2217,19 @@
                 null, null, Telephony.Carriers.DEFAULT_SORT_ORDER);
 
         if (cursor != null) {
-            canSetPreferApn = true;
+            mCanSetPreferApn = true;
         } else {
-            canSetPreferApn = false;
+            mCanSetPreferApn = false;
         }
+        log("getPreferredApn: mRequestedApnType=" + mRequestedApnType + " cursor=" + cursor
+                + " cursor.count=" + ((cursor != null) ? cursor.getCount() : 0));
 
-        if (canSetPreferApn && cursor.getCount() > 0) {
+        if (mCanSetPreferApn && cursor.getCount() > 0) {
             int pos;
             cursor.moveToFirst();
             pos = cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers._ID));
             for(ApnSetting p:mAllApns) {
+                log("getPreferredApn: apnSetting=" + p);
                 if (p.id == pos && p.canHandleType(mRequestedApnType)) {
                     log("getPreferredApn: X found apnSetting" + p);
                     cursor.close();
@@ -2423,10 +2405,10 @@
 
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-        pw.println("GsmDataConnectionTracker extends:");
+        pw.println("DataConnectionTracker extends:");
         super.dump(fd, pw, args);
         pw.println(" mReregisterOnReconnectFailure=" + mReregisterOnReconnectFailure);
-        pw.println(" canSetPreferApn=" + canSetPreferApn);
+        pw.println(" canSetPreferApn=" + mCanSetPreferApn);
         pw.println(" mApnObserver=" + mApnObserver);
         pw.println(" getOverallState=" + getOverallState());
         pw.println(" mDataConnectionAsyncChannels=%s\n" + mDataConnectionAsyncChannels);
diff --git a/src/java/com/android/internal/telephony/DataConnectionTracker.java b/src/java/com/android/internal/telephony/dataconnection/DataConnectionTrackerBase.java
similarity index 91%
rename from src/java/com/android/internal/telephony/DataConnectionTracker.java
rename to src/java/com/android/internal/telephony/dataconnection/DataConnectionTrackerBase.java
index ec83723..66eb400 100644
--- a/src/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DataConnectionTrackerBase.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.internal.telephony;
+package com.android.internal.telephony.dataconnection;
 
 import android.app.AlarmManager;
 import android.app.PendingIntent;
@@ -40,15 +40,17 @@
 import android.preference.PreferenceManager;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
-import android.telephony.ServiceState;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.EventLog;
 import android.telephony.Rlog;
 
 import com.android.internal.R;
-import com.android.internal.telephony.DataConnection.FailCause;
 import com.android.internal.telephony.DctConstants;
+import com.android.internal.telephony.EventLogTags;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneBase;
+import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.uicc.IccRecords;
 import com.android.internal.telephony.uicc.UiccController;
 import com.android.internal.util.AsyncChannel;
@@ -66,7 +68,7 @@
 /**
  * {@hide}
  */
-public abstract class DataConnectionTracker extends Handler {
+public abstract class DataConnectionTrackerBase extends Handler {
     protected static final boolean DBG = true;
     protected static final boolean VDBG = false;
     protected static final boolean RADIO_TESTS = false;
@@ -98,9 +100,9 @@
     // TODO: move away from static state once 5587429 is fixed.
     protected static boolean sPolicyDataEnabled = true;
 
-    private boolean[] dataEnabled = new boolean[DctConstants.APN_NUM_TYPES];
+    private boolean[] mDataEnabled = new boolean[DctConstants.APN_NUM_TYPES];
 
-    private int enabledCount = 0;
+    private int mEnabledCount = 0;
 
     /* Currently requested APN type (TODO: This should probably be a parameter not a member) */
     protected String mRequestedApnType = PhoneConstants.APN_TYPE_DEFAULT;
@@ -161,18 +163,6 @@
     protected static final String INTENT_RECONNECT_ALARM_EXTRA_REASON =
         "reconnect_alarm_extra_reason";
 
-    // Used for debugging. Send the INTENT with an optional counter value with the number
-    // of times the setup is to fail before succeeding. If the counter isn't passed the
-    // setup will fail once. Example fail two times with FailCause.SIGNAL_LOST(-3)
-    // adb shell am broadcast \
-    //  -a com.android.internal.telephony.dataconnectiontracker.intent_set_fail_data_setup_counter \
-    //  --ei fail_data_setup_counter 3 --ei fail_data_setup_fail_cause -3
-    protected static final String INTENT_SET_FAIL_DATA_SETUP_COUNTER =
-        "com.android.internal.telephony.dataconnectiontracker.intent_set_fail_data_setup_counter";
-    protected static final String FAIL_DATA_SETUP_COUNTER = "fail_data_setup_counter";
-    protected int mFailDataSetupCounter = 0;
-    protected static final String FAIL_DATA_SETUP_FAIL_CAUSE = "fail_data_setup_fail_cause";
-    protected FailCause mFailDataSetupFailCause = FailCause.ERROR_UNSPECIFIED;
 
     protected static final String DEFALUT_DATA_ON_BOOT_PROP = "net.def_data_on_boot";
 
@@ -220,8 +210,8 @@
     protected AtomicInteger mUniqueIdGenerator = new AtomicInteger(0);
 
     /** The data connections. */
-    protected HashMap<Integer, DataConnection> mDataConnections =
-        new HashMap<Integer, DataConnection>();
+    protected HashMap<Integer, DataConnectionBase> mDataConnections =
+        new HashMap<Integer, DataConnectionBase>();
 
     /** The data connection async channels */
     protected HashMap<Integer, DataConnectionAc> mDataConnectionAsyncChannels =
@@ -270,7 +260,7 @@
                 startNetStatPoll();
                 restartDataStallAlarm();
             } else if (action.startsWith(getActionIntentReconnectAlarm())) {
-                log("Reconnect alarm. Previous state was " + mState);
+                if (DBG) log("Reconnect alarm. Previous state was " + mState);
                 onActionIntentReconnectAlarm(intent);
             } else if (action.equals(getActionIntentDataStallAlarm())) {
                 onActionIntentDataStallAlarm(intent);
@@ -278,6 +268,7 @@
                 final android.net.NetworkInfo networkInfo = (NetworkInfo)
                         intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
                 mIsWifiConnected = (networkInfo != null && networkInfo.isConnected());
+                if (DBG) log("NETWORK_STATE_CHANGED_ACTION: mIsWifiConnected=" + mIsWifiConnected);
             } else if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
                 final boolean enabled = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
                         WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_ENABLED;
@@ -287,13 +278,8 @@
                     // quit and won't report disconnected until next enabling.
                     mIsWifiConnected = false;
                 }
-            } else if (action.equals(INTENT_SET_FAIL_DATA_SETUP_COUNTER)) {
-                mFailDataSetupCounter = intent.getIntExtra(FAIL_DATA_SETUP_COUNTER, 1);
-                mFailDataSetupFailCause = FailCause.fromInt(
-                        intent.getIntExtra(FAIL_DATA_SETUP_FAIL_CAUSE,
-                                                    FailCause.ERROR_UNSPECIFIED.getErrorCode()));
-                if (DBG) log("set mFailDataSetupCounter=" + mFailDataSetupCounter +
-                        " mFailDataSetupFailCause=" + mFailDataSetupFailCause);
+                if (DBG) log("WIFI_STATE_CHANGED_ACTION: enabled=" + enabled
+                        + " mIsWifiConnected=" + mIsWifiConnected);
             }
         }
     };
@@ -372,35 +358,17 @@
             rxPkts = -1;
         }
 
+        @Override
         public String toString() {
             return "{txSum=" + txPkts + " rxSum=" + rxPkts + "}";
         }
 
         public void updateTxRxSum() {
-            this.txPkts = TrafficStats.getMobileTxPackets();
-            this.rxPkts = TrafficStats.getMobileRxPackets();
+            this.txPkts = TrafficStats.getMobileTcpTxPackets();
+            this.rxPkts = TrafficStats.getMobileTcpRxPackets();
         }
     }
 
-    protected boolean isDataSetupCompleteOk(AsyncResult ar) {
-        if (ar.exception != null) {
-            if (DBG) log("isDataSetupCompleteOk return false, ar.result=" + ar.result);
-            return false;
-        }
-        if (mFailDataSetupCounter <= 0) {
-            if (DBG) log("isDataSetupCompleteOk return true");
-            return true;
-        }
-        ar.result = mFailDataSetupFailCause;
-        if (DBG) {
-            log("isDataSetupCompleteOk return false" +
-                    " mFailDataSetupCounter=" + mFailDataSetupCounter +
-                    " mFailDataSetupFailCause=" + mFailDataSetupFailCause);
-        }
-        mFailDataSetupCounter -= 1;
-        return false;
-    }
-
     protected void onActionIntentReconnectAlarm(Intent intent) {
         String reason = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON);
         if (mState == DctConstants.State.FAILED) {
@@ -424,7 +392,7 @@
     /**
      * Default constructor
      */
-    protected DataConnectionTracker(PhoneBase phone) {
+    protected DataConnectionTrackerBase(PhoneBase phone) {
         super();
         if (DBG) log("DCT.constructor");
         mPhone = phone;
@@ -437,7 +405,6 @@
         filter.addAction(Intent.ACTION_SCREEN_OFF);
         filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
         filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
-        filter.addAction(INTENT_SET_FAIL_DATA_SETUP_COUNTER);
         filter.addAction(getActionIntentDataStallAlarm());
 
         mUserDataEnabled = Settings.Global.getInt(
@@ -450,10 +417,10 @@
         // This preference tells us 1) initial condition for "dataEnabled",
         // and 2) whether the RIL will setup the baseband to auto-PS attach.
 
-        dataEnabled[DctConstants.APN_DEFAULT_ID] =
+        mDataEnabled[DctConstants.APN_DEFAULT_ID] =
                 SystemProperties.getBoolean(DEFALUT_DATA_ON_BOOT_PROP,true);
-        if (dataEnabled[DctConstants.APN_DEFAULT_ID]) {
-            enabledCount++;
+        if (mDataEnabled[DctConstants.APN_DEFAULT_ID]) {
+            mEnabledCount++;
         }
 
         SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
@@ -473,7 +440,7 @@
         }
         mDataConnectionAsyncChannels.clear();
         mIsDisposed = true;
-        mPhone.getContext().unregisterReceiver(this.mIntentReceiver);
+        mPhone.getContext().unregisterReceiver(mIntentReceiver);
         mDataRoamingSettingObserver.unregister(mPhone.getContext());
         mUiccController.unregisterForIccChanged(this);
     }
@@ -540,7 +507,7 @@
     }
 
     /**
-     * Modify {@link Settings.Global#DATA_ROAMING} value.
+     * Modify {@link android.provider.Settings.Global#DATA_ROAMING} value.
      */
     public void setDataOnRoamingEnabled(boolean enabled) {
         if (getDataOnRoamingEnabled() != enabled) {
@@ -551,7 +518,7 @@
     }
 
     /**
-     * Return current {@link Settings.Global#DATA_ROAMING} value.
+     * Return current {@link android.provider.Settings.Global#DATA_ROAMING} value.
      */
     public boolean getDataOnRoamingEnabled() {
         try {
@@ -594,7 +561,7 @@
     protected abstract void onVoiceCallEnded();
     protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason);
     protected abstract void onCleanUpAllConnections(String cause);
-    protected abstract boolean isDataPossible(String apnType);
+    public abstract boolean isDataPossible(String apnType);
     protected abstract void onUpdateIcc();
 
     @Override
@@ -722,7 +689,7 @@
         final boolean result;
         synchronized (mDataEnabledLock) {
             result = (mInternalDataEnabled && mUserDataEnabled && sPolicyDataEnabled
-                    && (enabledCount != 0));
+                    && (mEnabledCount != 0));
         }
         if (!result && DBG) log("getAnyDataEnabled " + result);
         return result;
@@ -783,7 +750,7 @@
         }
     }
 
-    protected LinkProperties getLinkProperties(String apnType) {
+    public LinkProperties getLinkProperties(String apnType) {
         int id = apnTypeToId(apnType);
 
         if (isApnIdEnabled(id)) {
@@ -795,7 +762,7 @@
         }
     }
 
-    protected LinkCapabilities getLinkCapabilities(String apnType) {
+    public LinkCapabilities getLinkCapabilities(String apnType) {
         int id = apnTypeToId(apnType);
         if (isApnIdEnabled(id)) {
             // TODO - remove this cdma-only hack and support multiple DCs.
@@ -809,7 +776,7 @@
     // tell all active apns of the current condition
     protected void notifyDataConnection(String reason) {
         for (int id = 0; id < DctConstants.APN_NUM_TYPES; id++) {
-            if (dataEnabled[id]) {
+            if (mDataEnabled[id]) {
                 mPhone.notifyDataConnection(reason, apnIdToType(id));
             }
         }
@@ -821,7 +788,6 @@
     private void notifyApnIdUpToCurrent(String reason, int apnId) {
         switch (mState) {
             case IDLE:
-            case INITING:
                 break;
             case CONNECTING:
             case SCANNING:
@@ -835,6 +801,9 @@
                 mPhone.notifyDataConnection(reason, apnIdToType(apnId),
                         PhoneConstants.DataState.CONNECTED);
                 break;
+            default:
+                // Ingore
+                break;
         }
     }
 
@@ -864,7 +833,7 @@
 
     protected synchronized boolean isApnIdEnabled(int id) {
         if (id != DctConstants.APN_INVALID_ID) {
-            return dataEnabled[id];
+            return mDataEnabled[id];
         }
         return false;
     }
@@ -873,7 +842,7 @@
      * Ensure that we are connected to an APN of the specified type.
      *
      * @param type the APN type (currently the only valid values are
-     *            {@link Phone#APN_TYPE_MMS} and {@link Phone#APN_TYPE_SUPL})
+     *            {@link PhoneConstants#APN_TYPE_MMS} and {@link PhoneConstants#APN_TYPE_SUPL})
      * @return Success is indicated by {@code Phone.APN_ALREADY_ACTIVE} or
      *         {@code Phone.APN_REQUEST_STARTED}. In the latter case, a
      *         broadcast will be sent by the ConnectivityManager when a
@@ -909,7 +878,7 @@
      * default APN.
      *
      * @param type the APN type. The only valid values are currently
-     *            {@link Phone#APN_TYPE_MMS} and {@link Phone#APN_TYPE_SUPL}.
+     *            {@link PhoneConstants#APN_TYPE_MMS} and {@link PhoneConstants#APN_TYPE_SUPL}.
      * @return Success is indicated by {@code PhoneConstants.APN_ALREADY_ACTIVE} or
      *         {@code PhoneConstants.APN_REQUEST_STARTED}. In the latter case, a
      *         broadcast will be sent by the ConnectivityManager when a
@@ -926,7 +895,7 @@
         if (isApnIdEnabled(id)) {
             setEnabled(id, false);
             if (isApnTypeActive(PhoneConstants.APN_TYPE_DEFAULT)) {
-                if (dataEnabled[DctConstants.APN_DEFAULT_ID]) {
+                if (mDataEnabled[DctConstants.APN_DEFAULT_ID]) {
                     return PhoneConstants.APN_ALREADY_ACTIVE;
                 } else {
                     return PhoneConstants.APN_REQUEST_STARTED;
@@ -941,8 +910,8 @@
 
     protected void setEnabled(int id, boolean enable) {
         if (DBG) {
-            log("setEnabled(" + id + ", " + enable + ") with old state = " + dataEnabled[id]
-                    + " and enabledCount = " + enabledCount);
+            log("setEnabled(" + id + ", " + enable + ") with old state = " + mDataEnabled[id]
+                    + " and enabledCount = " + mEnabledCount);
         }
         Message msg = obtainMessage(DctConstants.EVENT_ENABLE_NEW_APN);
         msg.arg1 = id;
@@ -953,15 +922,15 @@
     protected void onEnableApn(int apnId, int enabled) {
         if (DBG) {
             log("EVENT_APN_ENABLE_REQUEST apnId=" + apnId + ", apnType=" + apnIdToType(apnId) +
-                    ", enabled=" + enabled + ", dataEnabled = " + dataEnabled[apnId] +
-                    ", enabledCount = " + enabledCount + ", isApnTypeActive = " +
+                    ", enabled=" + enabled + ", dataEnabled = " + mDataEnabled[apnId] +
+                    ", enabledCount = " + mEnabledCount + ", isApnTypeActive = " +
                     isApnTypeActive(apnIdToType(apnId)));
         }
         if (enabled == DctConstants.ENABLED) {
             synchronized (this) {
-                if (!dataEnabled[apnId]) {
-                    dataEnabled[apnId] = true;
-                    enabledCount++;
+                if (!mDataEnabled[apnId]) {
+                    mDataEnabled[apnId] = true;
+                    mEnabledCount++;
                 }
             }
             String type = apnIdToType(apnId);
@@ -975,14 +944,14 @@
             // disable
             boolean didDisable = false;
             synchronized (this) {
-                if (dataEnabled[apnId]) {
-                    dataEnabled[apnId] = false;
-                    enabledCount--;
+                if (mDataEnabled[apnId]) {
+                    mDataEnabled[apnId] = false;
+                    mEnabledCount--;
                     didDisable = true;
                 }
             }
             if (didDisable) {
-                if ((enabledCount == 0) || (apnId == DctConstants.APN_DUN_ID)) {
+                if ((mEnabledCount == 0) || (apnId == DctConstants.APN_DUN_ID)) {
                     mRequestedApnType = PhoneConstants.APN_TYPE_DEFAULT;
                     onCleanUpConnection(true, apnId, Phone.REASON_DATA_DISABLED);
                 }
@@ -990,7 +959,7 @@
                 // send the disconnect msg manually, since the normal route wont send
                 // it (it's not enabled)
                 notifyApnIdDisconnected(Phone.REASON_DATA_DISABLED, apnId);
-                if (dataEnabled[DctConstants.APN_DEFAULT_ID] == true
+                if (mDataEnabled[DctConstants.APN_DEFAULT_ID] == true
                         && !isApnTypeActive(PhoneConstants.APN_TYPE_DEFAULT)) {
                     // TODO - this is an ugly way to restore the default conn - should be done
                     // by a real contention manager and policy that disconnects the lower pri
@@ -1141,7 +1110,7 @@
         for (ApnContext ac : mApnContexts.values()) {
             ac.setRetryCount(0);
         }
-        for (DataConnection dc : mDataConnections.values()) {
+        for (DataConnectionBase dc : mDataConnections.values()) {
             dc.resetRetryCount();
         }
     }
@@ -1251,7 +1220,7 @@
                 EventLog.writeEvent(EventLogTags.DATA_STALL_RECOVERY_GET_DATA_CALL_LIST,
                         mSentSinceLastRecv);
                 if (DBG) log("doRecovery() get data call list");
-                mPhone.mCM.getDataCallList(obtainMessage(DctConstants.EVENT_DATA_STATE_CHANGED));
+                mPhone.mCi.getDataCallList(obtainMessage(DctConstants.EVENT_DATA_STATE_CHANGED));
                 putRecoveryAction(RecoveryAction.CLEANUP);
                 break;
             case RecoveryAction.CLEANUP:
@@ -1435,17 +1404,17 @@
     }
 
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-        pw.println("DataConnectionTracker:");
+        pw.println("DataConnectionTrackerBase:");
         pw.println(" RADIO_TESTS=" + RADIO_TESTS);
         pw.println(" mInternalDataEnabled=" + mInternalDataEnabled);
         pw.println(" mUserDataEnabled=" + mUserDataEnabled);
         pw.println(" sPolicyDataEnabed=" + sPolicyDataEnabled);
-        pw.println(" dataEnabled:");
-        for(int i=0; i < dataEnabled.length; i++) {
-            pw.printf("  dataEnabled[%d]=%b\n", i, dataEnabled[i]);
+        pw.println(" mDataEnabled:");
+        for(int i=0; i < mDataEnabled.length; i++) {
+            pw.printf("  mDataEnabled[%d]=%b\n", i, mDataEnabled[i]);
         }
         pw.flush();
-        pw.println(" enabledCount=" + enabledCount);
+        pw.println(" mEnabledCount=" + mEnabledCount);
         pw.println(" mRequestedApnType=" + mRequestedApnType);
         pw.println(" mPhone=" + mPhone.getPhoneName());
         pw.println(" mActivity=" + mActivity);
@@ -1467,9 +1436,9 @@
         pw.println(" mUniqueIdGenerator=" + mUniqueIdGenerator);
         pw.flush();
         pw.println(" ***************************************");
-        Set<Entry<Integer, DataConnection> > mDcSet = mDataConnections.entrySet();
+        Set<Entry<Integer, DataConnectionBase> > mDcSet = mDataConnections.entrySet();
         pw.println(" mDataConnections: count=" + mDcSet.size());
-        for (Entry<Integer, DataConnection> entry : mDcSet) {
+        for (Entry<Integer, DataConnectionBase> entry : mDcSet) {
             pw.printf(" *** mDataConnection[%d] \n", entry.getKey());
             entry.getValue().dump(fd, pw, args);
         }
diff --git a/src/java/com/android/internal/telephony/gsm/GSMPhone.java b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
index 7c675d8..32e5a80 100644
--- a/src/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -32,7 +32,6 @@
 import android.telephony.CellLocation;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.ServiceState;
-import android.telephony.SignalStrength;
 import com.android.internal.telephony.CallTracker;
 import android.text.TextUtils;
 import android.telephony.Rlog;
@@ -50,8 +49,7 @@
 import static com.android.internal.telephony.CommandsInterface.SERVICE_CLASS_VOICE;
 import static com.android.internal.telephony.TelephonyProperties.PROPERTY_BASEBAND_VERSION;
 
-import com.android.internal.telephony.cat.CatService;
-import com.android.internal.telephony.Call;
+import com.android.internal.telephony.dataconnection.DataConnectionTracker;
 import com.android.internal.telephony.CallForwardInfo;
 import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.CommandsInterface;
@@ -69,13 +67,10 @@
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.telephony.UUSInfo;
 import com.android.internal.telephony.test.SimulatedRadioControl;
-import com.android.internal.telephony.uicc.IccFileHandler;
 import com.android.internal.telephony.uicc.IccRecords;
 import com.android.internal.telephony.uicc.IccVmNotSupportedException;
-import com.android.internal.telephony.uicc.UiccCard;
 import com.android.internal.telephony.uicc.UiccCardApplication;
 import com.android.internal.telephony.uicc.UiccController;
-import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
 import com.android.internal.telephony.ServiceStateTracker;
 
 import java.io.FileDescriptor;
@@ -94,9 +89,10 @@
     // NOTE that LOG_TAG here is "GSM", which means that log messages
     // from this file will go into the radio log rather than the main
     // log.  (Use "adb logcat -b radio" to see them.)
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "GSMPhone";
     private static final boolean LOCAL_DEBUG = true;
-    private static final boolean VDBG = false; /* STOP SHIP if true */
+    private static final boolean VDBG = false; /* STOPSHIP if true */
+    private static final boolean DBG_PORT = false; /* STOPSHIP if true */
 
     // Key used to read/write current ciphering state
     public static final String CIPHERING_KEY = "ciphering_key";
@@ -119,8 +115,8 @@
     /** List of Registrants to receive Supplementary Service Notifications. */
     RegistrantList mSsnRegistrants = new RegistrantList();
 
-    Thread debugPortThread;
-    ServerSocket debugSocket;
+    Thread mDebugPortThread;
+    ServerSocket mDebugSocket;
 
     private String mImei;
     private String mImeiSv;
@@ -142,42 +138,43 @@
             mSimulatedRadioControl = (SimulatedRadioControl) ci;
         }
 
-        mCM.setPhoneType(PhoneConstants.PHONE_TYPE_GSM);
+        mCi.setPhoneType(PhoneConstants.PHONE_TYPE_GSM);
         mCT = new GsmCallTracker(this);
         mSST = new GsmServiceStateTracker (this);
         mSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
 
-        mDataConnectionTracker = new GsmDataConnectionTracker (this);
+        mDataConnectionTracker = new DataConnectionTracker (this);
         if (!unitTestMode) {
             mSimPhoneBookIntManager = new SimPhoneBookInterfaceManager(this);
             mSimSmsIntManager = new SimSmsInterfaceManager(this, mSMS);
             mSubInfo = new PhoneSubInfo(this);
         }
 
-        mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
-        mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
-        mCM.registerForOn(this, EVENT_RADIO_ON, null);
-        mCM.setOnUSSD(this, EVENT_USSD, null);
-        mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
+        mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
+        mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
+        mCi.registerForOn(this, EVENT_RADIO_ON, null);
+        mCi.setOnUSSD(this, EVENT_USSD, null);
+        mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
         mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
 
-        if (false) {
+        if (DBG_PORT) {
             try {
                 //debugSocket = new LocalServerSocket("com.android.internal.telephony.debug");
-                debugSocket = new ServerSocket();
-                debugSocket.setReuseAddress(true);
-                debugSocket.bind (new InetSocketAddress("127.0.0.1", 6666));
+                mDebugSocket = new ServerSocket();
+                mDebugSocket.setReuseAddress(true);
+                mDebugSocket.bind (new InetSocketAddress("127.0.0.1", 6666));
 
-                debugPortThread
+                mDebugPortThread
                     = new Thread(
                         new Runnable() {
+                            @Override
                             public void run() {
                                 for(;;) {
                                     try {
                                         Socket sock;
-                                        sock = debugSocket.accept();
+                                        sock = mDebugSocket.accept();
                                         Rlog.i(LOG_TAG, "New connection; resetting radio");
-                                        mCM.resetRadio(null);
+                                        mCi.resetRadio(null);
                                         sock.close();
                                     } catch (IOException ex) {
                                         Rlog.w(LOG_TAG,
@@ -188,7 +185,7 @@
                         },
                         "GSMPhone debug");
 
-                debugPortThread.start();
+                mDebugPortThread.start();
 
             } catch (IOException ex) {
                 Rlog.w(LOG_TAG, "Failure to open com.android.internal.telephony.debug socket", ex);
@@ -206,13 +203,13 @@
             super.dispose();
 
             //Unregister from all former registered events
-            mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
+            mCi.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
             unregisterForSimRecordEvents();
-            mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
-            mCM.unregisterForOn(this); //EVENT_RADIO_ON
+            mCi.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
+            mCi.unregisterForOn(this); //EVENT_RADIO_ON
             mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
-            mCM.unSetOnUSSD(this);
-            mCM.unSetOnSuppServiceNotification(this);
+            mCi.unSetOnUSSD(this);
+            mCi.unSetOnSuppServiceNotification(this);
 
             mPendingMMIs.clear();
 
@@ -238,45 +235,55 @@
         super.removeReferences();
     }
 
+    @Override
     protected void finalize() {
         if(LOCAL_DEBUG) Rlog.d(LOG_TAG, "GSMPhone finalized");
     }
 
 
+    @Override
     public ServiceState
     getServiceState() {
-        return mSST.ss;
+        return mSST.mSS;
     }
 
+    @Override
     public CellLocation getCellLocation() {
-        return mSST.cellLoc;
+        return mSST.mCellLoc;
     }
 
+    @Override
     public PhoneConstants.State getState() {
-        return mCT.state;
+        return mCT.mState;
     }
 
+    @Override
     public String getPhoneName() {
         return "GSM";
     }
 
+    @Override
     public int getPhoneType() {
         return PhoneConstants.PHONE_TYPE_GSM;
     }
 
+    @Override
     public ServiceStateTracker getServiceStateTracker() {
         return mSST;
     }
 
+    @Override
     public CallTracker getCallTracker() {
         return mCT;
     }
 
+    @Override
     public List<? extends MmiCode>
     getPendingMmiCodes() {
         return mPendingMMIs;
     }
 
+    @Override
     public PhoneConstants.DataState getDataConnectionState(String apnType) {
         PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED;
 
@@ -285,7 +292,7 @@
             // already been called
 
             ret = PhoneConstants.DataState.DISCONNECTED;
-        } else if (mSST.getCurrentGprsState()
+        } else if (mSST.getCurrentDataConnectionState()
                 != ServiceState.STATE_IN_SERVICE) {
             // If we're out of service, open TCP sockets may still work
             // but no data will flow
@@ -305,7 +312,7 @@
 
                 case CONNECTED:
                 case DISCONNECTING:
-                    if ( mCT.state != PhoneConstants.State.IDLE
+                    if ( mCT.mState != PhoneConstants.State.IDLE
                             && !mSST.isConcurrentVoiceAndDataAllowed()) {
                         ret = PhoneConstants.DataState.SUSPENDED;
                     } else {
@@ -313,7 +320,6 @@
                     }
                 break;
 
-                case INITING:
                 case CONNECTING:
                 case SCANNING:
                     ret = PhoneConstants.DataState.CONNECTING;
@@ -324,10 +330,11 @@
         return ret;
     }
 
+    @Override
     public DataActivityState getDataActivityState() {
         DataActivityState ret = DataActivityState.NONE;
 
-        if (mSST.getCurrentGprsState() == ServiceState.STATE_IN_SERVICE) {
+        if (mSST.getCurrentDataConnectionState() == ServiceState.STATE_IN_SERVICE) {
             switch (mDataConnectionTracker.getActivity()) {
                 case DATAIN:
                     ret = DataActivityState.DATAIN;
@@ -344,6 +351,10 @@
                 case DORMANT:
                     ret = DataActivityState.DORMANT;
                 break;
+
+                default:
+                    ret = DataActivityState.NONE;
+                break;
             }
         }
 
@@ -351,15 +362,17 @@
     }
 
     /**
-     * Notify any interested party of a Phone state change {@link PhoneConstants.State}
+     * Notify any interested party of a Phone state change
+     * {@link com.android.internal.telephony.PhoneConstants.State}
      */
     /*package*/ void notifyPhoneStateChanged() {
         mNotifier.notifyPhoneState(this);
     }
 
     /**
-     * Notify registrants of a change in the call state. This notifies changes in {@link Call.State}
-     * Use this when changes in the precise call state are needed, else use notifyPhoneStateChanged.
+     * Notify registrants of a change in the call state. This notifies changes in
+     * {@link com.android.internal.telephony.Call.State}. Use this when changes
+     * in the precise call state are needed, else use notifyPhoneStateChanged.
      */
     /*package*/ void notifyPreciseCallStateChanged() {
         /* we'd love it if this was package-scoped*/
@@ -395,6 +408,7 @@
         mNotifier.notifyCellLocation(this);
     }
 
+    @Override
     public void
     notifyCallForwardingIndicator() {
         mNotifier.notifyCallForwardingChanged(this);
@@ -404,37 +418,44 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public final void
     setSystemProperty(String property, String value) {
         super.setSystemProperty(property, value);
     }
 
+    @Override
     public void registerForSuppServiceNotification(
             Handler h, int what, Object obj) {
         mSsnRegistrants.addUnique(h, what, obj);
-        if (mSsnRegistrants.size() == 1) mCM.setSuppServiceNotifications(true, null);
+        if (mSsnRegistrants.size() == 1) mCi.setSuppServiceNotifications(true, null);
     }
 
+    @Override
     public void unregisterForSuppServiceNotification(Handler h) {
         mSsnRegistrants.remove(h);
-        if (mSsnRegistrants.size() == 0) mCM.setSuppServiceNotifications(false, null);
+        if (mSsnRegistrants.size() == 0) mCi.setSuppServiceNotifications(false, null);
     }
 
+    @Override
     public void
     acceptCall() throws CallStateException {
         mCT.acceptCall();
     }
 
+    @Override
     public void
     rejectCall() throws CallStateException {
         mCT.rejectCall();
     }
 
+    @Override
     public void
     switchHoldingAndActive() throws CallStateException {
         mCT.switchWaitingOrHoldingAndActive();
     }
 
+    @Override
     public boolean canConference() {
         return mCT.canConference();
     }
@@ -443,39 +464,46 @@
         return mCT.canDial();
     }
 
-    public void conference() throws CallStateException {
+    @Override
+    public void conference() {
         mCT.conference();
     }
 
+    @Override
     public void clearDisconnected() {
         mCT.clearDisconnected();
     }
 
+    @Override
     public boolean canTransfer() {
         return mCT.canTransfer();
     }
 
-    public void explicitCallTransfer() throws CallStateException {
+    @Override
+    public void explicitCallTransfer() {
         mCT.explicitCallTransfer();
     }
 
+    @Override
     public GsmCall
     getForegroundCall() {
-        return mCT.foregroundCall;
+        return mCT.mForegroundCall;
     }
 
+    @Override
     public GsmCall
     getBackgroundCall() {
-        return mCT.backgroundCall;
+        return mCT.mBackgroundCall;
     }
 
+    @Override
     public GsmCall
     getRingingCall() {
-        return mCT.ringingCall;
+        return mCT.mRingingCall;
     }
 
     private boolean handleCallDeflectionIncallSupplementaryService(
-            String dialString) throws CallStateException {
+            String dialString) {
         if (dialString.length() > 1) {
             return false;
         }
@@ -499,14 +527,14 @@
     }
 
     private boolean handleCallWaitingIncallSupplementaryService(
-            String dialString) throws CallStateException {
+            String dialString) {
         int len = dialString.length();
 
         if (len > 2) {
             return false;
         }
 
-        GsmCall call = (GsmCall) getForegroundCall();
+        GsmCall call = getForegroundCall();
 
         try {
             if (len > 1) {
@@ -540,15 +568,14 @@
         return true;
     }
 
-    private boolean handleCallHoldIncallSupplementaryService(String dialString)
-            throws CallStateException {
+    private boolean handleCallHoldIncallSupplementaryService(String dialString) {
         int len = dialString.length();
 
         if (len > 2) {
             return false;
         }
 
-        GsmCall call = (GsmCall) getForegroundCall();
+        GsmCall call = getForegroundCall();
 
         if (len > 1) {
             try {
@@ -593,24 +620,17 @@
     }
 
     private boolean handleMultipartyIncallSupplementaryService(
-            String dialString) throws CallStateException {
+            String dialString) {
         if (dialString.length() > 1) {
             return false;
         }
 
         if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "MmiCode 3: merge calls");
-        try {
-            conference();
-        } catch (CallStateException e) {
-            if (LOCAL_DEBUG) Rlog.d(LOG_TAG,
-                "conference failed", e);
-            notifySuppServiceFailed(Phone.SuppService.CONFERENCE);
-        }
+        conference();
         return true;
     }
 
-    private boolean handleEctIncallSupplementaryService(String dialString)
-            throws CallStateException {
+    private boolean handleEctIncallSupplementaryService(String dialString) {
 
         int len = dialString.length();
 
@@ -619,18 +639,11 @@
         }
 
         if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "MmiCode 4: explicit call transfer");
-        try {
-            explicitCallTransfer();
-        } catch (CallStateException e) {
-            if (LOCAL_DEBUG) Rlog.d(LOG_TAG,
-                "transfer failed", e);
-            notifySuppServiceFailed(Phone.SuppService.TRANSFER);
-        }
+        explicitCallTransfer();
         return true;
     }
 
-    private boolean handleCcbsIncallSupplementaryService(String dialString)
-            throws CallStateException {
+    private boolean handleCcbsIncallSupplementaryService(String dialString) {
         if (dialString.length() > 1) {
             return false;
         }
@@ -641,8 +654,8 @@
         return true;
     }
 
-    public boolean handleInCallMmiCommands(String dialString)
-            throws CallStateException {
+    @Override
+    public boolean handleInCallMmiCommands(String dialString) {
         if (!isInCall()) {
             return false;
         }
@@ -691,11 +704,13 @@
                 ringingCallState.isAlive());
     }
 
+    @Override
     public Connection
     dial(String dialString) throws CallStateException {
         return dial(dialString, null);
     }
 
+    @Override
     public Connection
     dial (String dialString, UUSInfo uusInfo) throws CallStateException {
         // Need to make sure dialString gets parsed properly
@@ -716,7 +731,7 @@
         if (mmi == null) {
             return mCT.dial(newDialString, uusInfo);
         } else if (mmi.isTemporaryModeCLIR()) {
-            return mCT.dial(mmi.dialingNumber, mmi.getCLIRMode(), uusInfo);
+            return mCT.dial(mmi.mDialingNumber, mmi.getCLIRMode(), uusInfo);
         } else {
             mPendingMMIs.add(mmi);
             mMmiRegistrants.notifyRegistrants(new AsyncResult(null, mmi, null));
@@ -727,6 +742,7 @@
         }
     }
 
+    @Override
     public boolean handlePinMmi(String dialString) {
         GsmMmiCode mmi = GsmMmiCode.newFromDialString(dialString, this, mUiccApplication.get());
 
@@ -740,6 +756,7 @@
         return false;
     }
 
+    @Override
     public void sendUssdResponse(String ussdMessge) {
         GsmMmiCode mmi = GsmMmiCode.newFromUssdUserInput(ussdMessge, this, mUiccApplication.get());
         mPendingMMIs.add(mmi);
@@ -747,31 +764,34 @@
         mmi.sendUssd(ussdMessge);
     }
 
+    @Override
     public void
     sendDtmf(char c) {
         if (!PhoneNumberUtils.is12Key(c)) {
             Rlog.e(LOG_TAG,
                     "sendDtmf called with invalid character '" + c + "'");
         } else {
-            if (mCT.state ==  PhoneConstants.State.OFFHOOK) {
-                mCM.sendDtmf(c, null);
+            if (mCT.mState ==  PhoneConstants.State.OFFHOOK) {
+                mCi.sendDtmf(c, null);
             }
         }
     }
 
+    @Override
     public void
     startDtmf(char c) {
         if (!PhoneNumberUtils.is12Key(c)) {
             Rlog.e(LOG_TAG,
                 "startDtmf called with invalid character '" + c + "'");
         } else {
-            mCM.startDtmf(c, null);
+            mCi.startDtmf(c, null);
         }
     }
 
+    @Override
     public void
     stopDtmf() {
-        mCM.stopDtmf(null);
+        mCi.stopDtmf(null);
     }
 
     public void
@@ -779,6 +799,7 @@
         Rlog.e(LOG_TAG, "[GSMPhone] sendBurstDtmf() is a CDMA method");
     }
 
+    @Override
     public void
     setRadioPower(boolean power) {
         mSST.setRadioPower(power);
@@ -792,6 +813,7 @@
         setVmSimImsi(getSubscriberId());
     }
 
+    @Override
     public String getVoiceMailNumber() {
         // Read from the SIM. If its null, try reading from the shared preference area.
         IccRecords r = mIccRecords.get();
@@ -815,6 +837,7 @@
         editor.apply();
     }
 
+    @Override
     public String getVoiceMailAlphaTag() {
         String ret;
         IccRecords r = mIccRecords.get();
@@ -829,33 +852,40 @@
         return ret;
     }
 
+    @Override
     public String getDeviceId() {
         return mImei;
     }
 
+    @Override
     public String getDeviceSvn() {
         return mImeiSv;
     }
 
+    @Override
     public String getImei() {
         return mImei;
     }
 
+    @Override
     public String getEsn() {
         Rlog.e(LOG_TAG, "[GSMPhone] getEsn() is a CDMA method");
         return "0";
     }
 
+    @Override
     public String getMeid() {
         Rlog.e(LOG_TAG, "[GSMPhone] getMeid() is a CDMA method");
         return "0";
     }
 
+    @Override
     public String getSubscriberId() {
         IccRecords r = mIccRecords.get();
         return (r != null) ? r.getIMSI() : null;
     }
 
+    @Override
     public String getLine1Number() {
         IccRecords r = mIccRecords.get();
         return (r != null) ? r.getMsisdnNumber() : null;
@@ -867,11 +897,13 @@
         return (r != null) ? r.getMsisdnNumber() : "";
     }
 
+    @Override
     public String getLine1AlphaTag() {
         IccRecords r = mIccRecords.get();
         return (r != null) ? r.getMsisdnAlphaTag() : "";
     }
 
+    @Override
     public void setLine1Number(String alphaTag, String number, Message onComplete) {
         IccRecords r = mIccRecords.get();
         if (r != null) {
@@ -879,6 +911,7 @@
         }
     }
 
+    @Override
     public void setVoiceMailNumber(String alphaTag,
                             String voiceMailNumber,
                             Message onComplete) {
@@ -922,6 +955,7 @@
         return (action == CF_ACTION_ENABLE) || (action == CF_ACTION_REGISTRATION);
     }
 
+    @Override
     public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) {
         if (isValidCommandInterfaceCFReason(commandInterfaceCFReason)) {
             if (LOCAL_DEBUG) Rlog.d(LOG_TAG, "requesting call forwarding query.");
@@ -931,10 +965,11 @@
             } else {
                 resp = onComplete;
             }
-            mCM.queryCallForwardStatus(commandInterfaceCFReason,0,null,resp);
+            mCi.queryCallForwardStatus(commandInterfaceCFReason,0,null,resp);
         }
     }
 
+    @Override
     public void setCallForwardingOption(int commandInterfaceCFAction,
             int commandInterfaceCFReason,
             String dialingNumber,
@@ -950,7 +985,7 @@
             } else {
                 resp = onComplete;
             }
-            mCM.setCallForward(commandInterfaceCFAction,
+            mCi.setCallForward(commandInterfaceCFAction,
                     commandInterfaceCFReason,
                     CommandsInterface.SERVICE_CLASS_VOICE,
                     dialingNumber,
@@ -959,29 +994,34 @@
         }
     }
 
+    @Override
     public void getOutgoingCallerIdDisplay(Message onComplete) {
-        mCM.getCLIR(onComplete);
+        mCi.getCLIR(onComplete);
     }
 
+    @Override
     public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
                                            Message onComplete) {
-        mCM.setCLIR(commandInterfaceCLIRMode,
+        mCi.setCLIR(commandInterfaceCLIRMode,
                 obtainMessage(EVENT_SET_CLIR_COMPLETE, commandInterfaceCLIRMode, 0, onComplete));
     }
 
+    @Override
     public void getCallWaiting(Message onComplete) {
         //As per 3GPP TS 24.083, section 1.6 UE doesn't need to send service
         //class parameter in call waiting interrogation  to network
-        mCM.queryCallWaiting(CommandsInterface.SERVICE_CLASS_NONE, onComplete);
+        mCi.queryCallWaiting(CommandsInterface.SERVICE_CLASS_NONE, onComplete);
     }
 
+    @Override
     public void setCallWaiting(boolean enable, Message onComplete) {
-        mCM.setCallWaiting(enable, CommandsInterface.SERVICE_CLASS_VOICE, onComplete);
+        mCi.setCallWaiting(enable, CommandsInterface.SERVICE_CLASS_VOICE, onComplete);
     }
 
+    @Override
     public void
     getAvailableNetworks(Message response) {
-        mCM.getAvailableNetworks(response);
+        mCi.getAvailableNetworks(response);
     }
 
     /**
@@ -996,6 +1036,7 @@
         public String operatorAlphaLong;
     }
 
+    @Override
     public void
     setNetworkSelectionModeAutomatic(Message response) {
         // wrap the response message in our own message along with
@@ -1011,9 +1052,10 @@
         if (LOCAL_DEBUG)
             Rlog.d(LOG_TAG, "wrapping and sending message to connect automatically");
 
-        mCM.setNetworkSelectionModeAutomatic(msg);
+        mCi.setNetworkSelectionModeAutomatic(msg);
     }
 
+    @Override
     public void
     selectNetworkManually(OperatorInfo network,
             Message response) {
@@ -1027,46 +1069,56 @@
         // get the message
         Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
 
-        mCM.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
+        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
     }
 
+    @Override
     public void
     getNeighboringCids(Message response) {
-        mCM.getNeighboringCids(response);
+        mCi.getNeighboringCids(response);
     }
 
+    @Override
     public void setOnPostDialCharacter(Handler h, int what, Object obj) {
         mPostDialHandler = new Registrant(h, what, obj);
     }
 
+    @Override
     public void setMute(boolean muted) {
         mCT.setMute(muted);
     }
 
+    @Override
     public boolean getMute() {
         return mCT.getMute();
     }
 
+    @Override
     public void getDataCallList(Message response) {
-        mCM.getDataCallList(response);
+        mCi.getDataCallList(response);
     }
 
+    @Override
     public void updateServiceLocation() {
         mSST.enableSingleLocationUpdate();
     }
 
+    @Override
     public void enableLocationUpdates() {
         mSST.enableLocationUpdates();
     }
 
+    @Override
     public void disableLocationUpdates() {
         mSST.disableLocationUpdates();
     }
 
+    @Override
     public boolean getDataRoamingEnabled() {
         return mDataConnectionTracker.getDataOnRoamingEnabled();
     }
 
+    @Override
     public void setDataRoamingEnabled(boolean enable) {
         mDataConnectionTracker.setDataOnRoamingEnabled(enable);
     }
@@ -1152,7 +1204,7 @@
         SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
         int clirSetting = sp.getInt(CLIR_KEY, -1);
         if (clirSetting >= 0) {
-            mCM.setCLIR(clirSetting, null);
+            mCi.setCLIR(clirSetting, null);
         }
     }
 
@@ -1163,11 +1215,11 @@
 
         switch (msg.what) {
             case EVENT_RADIO_AVAILABLE: {
-                mCM.getBasebandVersion(
+                mCi.getBasebandVersion(
                         obtainMessage(EVENT_GET_BASEBAND_VERSION_DONE));
 
-                mCM.getIMEI(obtainMessage(EVENT_GET_IMEI_DONE));
-                mCM.getIMEISV(obtainMessage(EVENT_GET_IMEISV_DONE));
+                mCi.getIMEI(obtainMessage(EVENT_GET_IMEI_DONE));
+                mCi.getIMEISV(obtainMessage(EVENT_GET_IMEISV_DONE));
             }
             break;
 
@@ -1379,7 +1431,7 @@
      *
      * @return true for success; false otherwise.
      */
-    boolean updateCurrentCarrierInProvider() {
+    public boolean updateCurrentCarrierInProvider() {
         IccRecords r = mIccRecords.get();
         if (r != null) {
             try {
@@ -1468,6 +1520,7 @@
     /**
      * Retrieves the PhoneSubInfo of the GSMPhone
      */
+    @Override
     public PhoneSubInfo getPhoneSubInfo(){
         return mSubInfo;
     }
@@ -1475,6 +1528,7 @@
     /**
      * Retrieves the IccSmsInterfaceManager of the GSMPhone
      */
+    @Override
     public IccSmsInterfaceManager getIccSmsInterfaceManager(){
         return mSimSmsIntManager;
     }
@@ -1482,6 +1536,7 @@
     /**
      * Retrieves the IccPhoneBookInterfaceManager of the GSMPhone
      */
+    @Override
     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(){
         return mSimPhoneBookIntManager;
     }
@@ -1492,6 +1547,7 @@
      * @param activate 0 = activate, 1 = deactivate
      * @param response Callback message is empty on completion
      */
+    @Override
     public void activateCellBroadcastSms(int activate, Message response) {
         Rlog.e(LOG_TAG, "[GSMPhone] activateCellBroadcastSms() is obsolete; use SmsManager");
         response.sendToTarget();
@@ -1502,6 +1558,7 @@
      *
      * @param response Callback message is empty on completion
      */
+    @Override
     public void getCellBroadcastSmsConfig(Message response) {
         Rlog.e(LOG_TAG, "[GSMPhone] getCellBroadcastSmsConfig() is obsolete; use SmsManager");
         response.sendToTarget();
@@ -1512,11 +1569,13 @@
      *
      * @param response Callback message is empty on completion
      */
+    @Override
     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response) {
         Rlog.e(LOG_TAG, "[GSMPhone] setCellBroadcastSmsConfig() is obsolete; use SmsManager");
         response.sendToTarget();
     }
 
+    @Override
     public boolean isCspPlmnEnabled() {
         IccRecords r = mIccRecords.get();
         return (r != null) ? r.isCspPlmnEnabled() : false;
diff --git a/src/java/com/android/internal/telephony/gsm/GsmCall.java b/src/java/com/android/internal/telephony/gsm/GsmCall.java
index 58124a2..a24d6dd 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmCall.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmCall.java
@@ -22,7 +22,6 @@
 import com.android.internal.telephony.DriverCall;
 import com.android.internal.telephony.Phone;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -31,8 +30,7 @@
 class GsmCall extends Call {
     /*************************** Instance Variables **************************/
 
-    /*package*/ ArrayList<Connection> connections = new ArrayList<Connection>();
-    /*package*/ GsmCallTracker owner;
+    /*package*/ GsmCallTracker mOwner;
 
 
     /***************************** Class Methods *****************************/
@@ -54,7 +52,7 @@
     /****************************** Constructors *****************************/
     /*package*/
     GsmCall (GsmCallTracker owner) {
-        this.owner = owner;
+        mOwner = owner;
     }
 
     public void dispose() {
@@ -62,50 +60,55 @@
 
     /************************** Overridden from Call *************************/
 
+    @Override
     public List<Connection>
     getConnections() {
         // FIXME should return Collections.unmodifiableList();
-        return connections;
+        return mConnections;
     }
 
+    @Override
     public Phone
     getPhone() {
-        return owner.phone;
+        return mOwner.mPhone;
     }
 
+    @Override
     public boolean
     isMultiparty() {
-        return connections.size() > 1;
+        return mConnections.size() > 1;
     }
 
     /** Please note: if this is the foreground call and a
      *  background call exists, the background call will be resumed
      *  because an AT+CHLD=1 will be sent
      */
+    @Override
     public void
     hangup() throws CallStateException {
-        owner.hangup(this);
+        mOwner.hangup(this);
     }
 
+    @Override
     public String
     toString() {
-        return state.toString();
+        return mState.toString();
     }
 
     //***** Called from GsmConnection
 
     /*package*/ void
     attach(Connection conn, DriverCall dc) {
-        connections.add(conn);
+        mConnections.add(conn);
 
-        state = stateFromDCState (dc.state);
+        mState = stateFromDCState (dc.state);
     }
 
     /*package*/ void
     attachFake(Connection conn, State state) {
-        connections.add(conn);
+        mConnections.add(conn);
 
-        this.state = state;
+        mState = state;
     }
 
     /**
@@ -113,13 +116,13 @@
      */
     void
     connectionDisconnected(GsmConnection conn) {
-        if (state != State.DISCONNECTED) {
+        if (mState != State.DISCONNECTED) {
             /* If only disconnected connections remain, we are disconnected*/
 
             boolean hasOnlyDisconnectedConnections = true;
 
-            for (int i = 0, s = connections.size()  ; i < s; i ++) {
-                if (connections.get(i).getState()
+            for (int i = 0, s = mConnections.size()  ; i < s; i ++) {
+                if (mConnections.get(i).getState()
                     != State.DISCONNECTED
                 ) {
                     hasOnlyDisconnectedConnections = false;
@@ -128,7 +131,7 @@
             }
 
             if (hasOnlyDisconnectedConnections) {
-                state = State.DISCONNECTED;
+                mState = State.DISCONNECTED;
             }
         }
     }
@@ -136,10 +139,10 @@
 
     /*package*/ void
     detach(GsmConnection conn) {
-        connections.remove(conn);
+        mConnections.remove(conn);
 
-        if (connections.size() == 0) {
-            state = State.IDLE;
+        if (mConnections.size() == 0) {
+            mState = State.IDLE;
         }
     }
 
@@ -150,8 +153,8 @@
 
         newState = stateFromDCState(dc.state);
 
-        if (newState != state) {
-            state = newState;
+        if (newState != mState) {
+            mState = newState;
             changed = true;
         }
 
@@ -164,7 +167,7 @@
      */
     /*package*/ boolean
     isFull() {
-        return connections.size() == GsmCallTracker.MAX_CONNECTIONS_PER_CALL;
+        return mConnections.size() == GsmCallTracker.MAX_CONNECTIONS_PER_CALL;
     }
 
     //***** Called from GsmCallTracker
@@ -177,14 +180,14 @@
      */
     void
     onHangupLocal() {
-        for (int i = 0, s = connections.size()
+        for (int i = 0, s = mConnections.size()
                 ; i < s; i++
         ) {
-            GsmConnection cn = (GsmConnection)connections.get(i);
+            GsmConnection cn = (GsmConnection)mConnections.get(i);
 
             cn.onHangupLocal();
         }
-        state = State.DISCONNECTING;
+        mState = State.DISCONNECTING;
     }
 
     /**
@@ -192,16 +195,16 @@
      */
     void
     clearDisconnected() {
-        for (int i = connections.size() - 1 ; i >= 0 ; i--) {
-            GsmConnection cn = (GsmConnection)connections.get(i);
+        for (int i = mConnections.size() - 1 ; i >= 0 ; i--) {
+            GsmConnection cn = (GsmConnection)mConnections.get(i);
 
             if (cn.getState() == State.DISCONNECTED) {
-                connections.remove(i);
+                mConnections.remove(i);
             }
         }
 
-        if (connections.size() == 0) {
-            state = State.IDLE;
+        if (mConnections.size() == 0) {
+            mState = State.IDLE;
         }
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java b/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java
index 2080976..f866078 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java
@@ -53,7 +53,7 @@
  * {@hide}
  */
 public final class GsmCallTracker extends CallTracker {
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "GsmCallTracker";
     private static final boolean REPEAT_POLLING = false;
 
     private static final boolean DBG_POLL = false;
@@ -64,28 +64,28 @@
     static final int MAX_CONNECTIONS_PER_CALL = 5; // only 5 connections allowed per call
 
     //***** Instance Variables
-    GsmConnection connections[] = new GsmConnection[MAX_CONNECTIONS];
-    RegistrantList voiceCallEndedRegistrants = new RegistrantList();
-    RegistrantList voiceCallStartedRegistrants = new RegistrantList();
+    GsmConnection mConnections[] = new GsmConnection[MAX_CONNECTIONS];
+    RegistrantList mVoiceCallEndedRegistrants = new RegistrantList();
+    RegistrantList mVoiceCallStartedRegistrants = new RegistrantList();
 
 
     // connections dropped during last poll
-    ArrayList<GsmConnection> droppedDuringPoll
+    ArrayList<GsmConnection> mDroppedDuringPoll
         = new ArrayList<GsmConnection>(MAX_CONNECTIONS);
 
-    GsmCall ringingCall = new GsmCall(this);
+    GsmCall mRingingCall = new GsmCall(this);
             // A call that is ringing or (call) waiting
-    GsmCall foregroundCall = new GsmCall(this);
-    GsmCall backgroundCall = new GsmCall(this);
+    GsmCall mForegroundCall = new GsmCall(this);
+    GsmCall mBackgroundCall = new GsmCall(this);
 
     GsmConnection pendingMO;
-    boolean hangupPendingMO;
+    boolean mHangupPendingMO;
 
-    GSMPhone phone;
+    GSMPhone mPhone;
 
-    boolean desiredMute = false;    // false = mute off
+    boolean mDesiredMute = false;    // false = mute off
 
-    PhoneConstants.State state = PhoneConstants.State.IDLE;
+    PhoneConstants.State mState = PhoneConstants.State.IDLE;
 
 
 
@@ -95,22 +95,22 @@
     //***** Constructors
 
     GsmCallTracker (GSMPhone phone) {
-        this.phone = phone;
-        cm = phone.mCM;
+        this.mPhone = phone;
+        mCi = phone.mCi;
 
-        cm.registerForCallStateChanged(this, EVENT_CALL_STATE_CHANGE, null);
+        mCi.registerForCallStateChanged(this, EVENT_CALL_STATE_CHANGE, null);
 
-        cm.registerForOn(this, EVENT_RADIO_AVAILABLE, null);
-        cm.registerForNotAvailable(this, EVENT_RADIO_NOT_AVAILABLE, null);
+        mCi.registerForOn(this, EVENT_RADIO_AVAILABLE, null);
+        mCi.registerForNotAvailable(this, EVENT_RADIO_NOT_AVAILABLE, null);
     }
 
     public void dispose() {
         //Unregister for all events
-        cm.unregisterForCallStateChanged(this);
-        cm.unregisterForOn(this);
-        cm.unregisterForNotAvailable(this);
+        mCi.unregisterForCallStateChanged(this);
+        mCi.unregisterForOn(this);
+        mCi.unregisterForNotAvailable(this);
 
-        for(GsmConnection c : connections) {
+        for(GsmConnection c : mConnections) {
             try {
                 if(c != null) hangup(c);
             } catch (CallStateException ex) {
@@ -127,6 +127,7 @@
         clearDisconnected();
     }
 
+    @Override
     protected void finalize() {
         Rlog.d(LOG_TAG, "GsmCallTracker finalized");
     }
@@ -134,22 +135,26 @@
     //***** Instance Methods
 
     //***** Public Methods
+    @Override
     public void registerForVoiceCallStarted(Handler h, int what, Object obj) {
         Registrant r = new Registrant(h, what, obj);
-        voiceCallStartedRegistrants.add(r);
+        mVoiceCallStartedRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForVoiceCallStarted(Handler h) {
-        voiceCallStartedRegistrants.remove(h);
+        mVoiceCallStartedRegistrants.remove(h);
     }
 
+    @Override
     public void registerForVoiceCallEnded(Handler h, int what, Object obj) {
         Registrant r = new Registrant(h, what, obj);
-        voiceCallEndedRegistrants.add(r);
+        mVoiceCallEndedRegistrants.add(r);
     }
 
+    @Override
     public void unregisterForVoiceCallEnded(Handler h) {
-        voiceCallEndedRegistrants.remove(h);
+        mVoiceCallEndedRegistrants.remove(h);
     }
 
     private void
@@ -158,7 +163,7 @@
 
         // We need to make a copy here, since fakeHoldBeforeDial()
         // modifies the lists, and we don't want to reverse the order
-        connCopy = (List<Connection>) foregroundCall.connections.clone();
+        connCopy = (List<Connection>) mForegroundCall.mConnections.clone();
 
         for (int i = 0, s = connCopy.size() ; i < s ; i++) {
             GsmConnection conn = (GsmConnection)connCopy.get(i);
@@ -182,7 +187,7 @@
         // The new call must be assigned to the foreground call.
         // That call must be idle, so place anything that's
         // there on hold
-        if (foregroundCall.getState() == GsmCall.State.ACTIVE) {
+        if (mForegroundCall.getState() == GsmCall.State.ACTIVE) {
             // this will probably be done by the radio anyway
             // but the dial might fail before this happens
             // and we need to make sure the foreground call is clear
@@ -196,20 +201,20 @@
             fakeHoldForegroundBeforeDial();
         }
 
-        if (foregroundCall.getState() != GsmCall.State.IDLE) {
+        if (mForegroundCall.getState() != GsmCall.State.IDLE) {
             //we should have failed in !canDial() above before we get here
             throw new CallStateException("cannot dial in current state");
         }
 
-        pendingMO = new GsmConnection(phone.getContext(), checkForTestEmergencyNumber(dialString),
-                this, foregroundCall);
-        hangupPendingMO = false;
+        pendingMO = new GsmConnection(mPhone.getContext(), checkForTestEmergencyNumber(dialString),
+                this, mForegroundCall);
+        mHangupPendingMO = false;
 
-        if (pendingMO.address == null || pendingMO.address.length() == 0
-            || pendingMO.address.indexOf(PhoneNumberUtils.WILD) >= 0
+        if (pendingMO.mAddress == null || pendingMO.mAddress.length() == 0
+            || pendingMO.mAddress.indexOf(PhoneNumberUtils.WILD) >= 0
         ) {
             // Phone number is invalid
-            pendingMO.cause = Connection.DisconnectCause.INVALID_NUMBER;
+            pendingMO.mCause = Connection.DisconnectCause.INVALID_NUMBER;
 
             // handlePollCalls() will notice this call not present
             // and will mark it as dropped.
@@ -218,11 +223,11 @@
             // Always unmute when initiating a new call
             setMute(false);
 
-            cm.dial(pendingMO.address, clirMode, uusInfo, obtainCompleteMessage());
+            mCi.dial(pendingMO.mAddress, clirMode, uusInfo, obtainCompleteMessage());
         }
 
         updatePhoneState();
-        phone.notifyPreciseCallStateChanged();
+        mPhone.notifyPreciseCallStateChanged();
 
         return pendingMO;
     }
@@ -248,12 +253,12 @@
         // in case the active/holding call disappeared and this
         // is no longer call waiting
 
-        if (ringingCall.getState() == GsmCall.State.INCOMING) {
+        if (mRingingCall.getState() == GsmCall.State.INCOMING) {
             Rlog.i("phone", "acceptCall: incoming...");
             // Always unmute when answering a new call
             setMute(false);
-            cm.acceptCall(obtainCompleteMessage());
-        } else if (ringingCall.getState() == GsmCall.State.WAITING) {
+            mCi.acceptCall(obtainCompleteMessage());
+        } else if (mRingingCall.getState() == GsmCall.State.WAITING) {
             setMute(false);
             switchWaitingOrHoldingAndActive();
         } else {
@@ -265,8 +270,8 @@
     rejectCall () throws CallStateException {
         // AT+CHLD=0 means "release held or UDUB"
         // so if the phone isn't ringing, this could hang up held
-        if (ringingCall.getState().isRinging()) {
-            cm.rejectCall(obtainCompleteMessage());
+        if (mRingingCall.getState().isRinging()) {
+            mCi.rejectCall(obtainCompleteMessage());
         } else {
             throw new CallStateException("phone not ringing");
         }
@@ -275,22 +280,22 @@
     void
     switchWaitingOrHoldingAndActive() throws CallStateException {
         // Should we bother with this check?
-        if (ringingCall.getState() == GsmCall.State.INCOMING) {
+        if (mRingingCall.getState() == GsmCall.State.INCOMING) {
             throw new CallStateException("cannot be in the incoming state");
         } else {
-            cm.switchWaitingOrHoldingAndActive(
+            mCi.switchWaitingOrHoldingAndActive(
                     obtainCompleteMessage(EVENT_SWITCH_RESULT));
         }
     }
 
     void
-    conference() throws CallStateException {
-        cm.conference(obtainCompleteMessage(EVENT_CONFERENCE_RESULT));
+    conference() {
+        mCi.conference(obtainCompleteMessage(EVENT_CONFERENCE_RESULT));
     }
 
     void
-    explicitCallTransfer() throws CallStateException {
-        cm.explicitCallTransfer(obtainCompleteMessage(EVENT_ECT_RESULT));
+    explicitCallTransfer() {
+        mCi.explicitCallTransfer(obtainCompleteMessage(EVENT_ECT_RESULT));
     }
 
     void
@@ -298,47 +303,47 @@
         internalClearDisconnected();
 
         updatePhoneState();
-        phone.notifyPreciseCallStateChanged();
+        mPhone.notifyPreciseCallStateChanged();
     }
 
     boolean
     canConference() {
-        return foregroundCall.getState() == GsmCall.State.ACTIVE
-                && backgroundCall.getState() == GsmCall.State.HOLDING
-                && !backgroundCall.isFull()
-                && !foregroundCall.isFull();
+        return mForegroundCall.getState() == GsmCall.State.ACTIVE
+                && mBackgroundCall.getState() == GsmCall.State.HOLDING
+                && !mBackgroundCall.isFull()
+                && !mForegroundCall.isFull();
     }
 
     boolean
     canDial() {
         boolean ret;
-        int serviceState = phone.getServiceState().getState();
+        int serviceState = mPhone.getServiceState().getState();
         String disableCall = SystemProperties.get(
                 TelephonyProperties.PROPERTY_DISABLE_CALL, "false");
 
         ret = (serviceState != ServiceState.STATE_POWER_OFF)
                 && pendingMO == null
-                && !ringingCall.isRinging()
+                && !mRingingCall.isRinging()
                 && !disableCall.equals("true")
-                && (!foregroundCall.getState().isAlive()
-                    || !backgroundCall.getState().isAlive());
+                && (!mForegroundCall.getState().isAlive()
+                    || !mBackgroundCall.getState().isAlive());
 
         return ret;
     }
 
     boolean
     canTransfer() {
-        return foregroundCall.getState() == GsmCall.State.ACTIVE
-                && backgroundCall.getState() == GsmCall.State.HOLDING;
+        return mForegroundCall.getState() == GsmCall.State.ACTIVE
+                && mBackgroundCall.getState() == GsmCall.State.HOLDING;
     }
 
     //***** Private Instance Methods
 
     private void
     internalClearDisconnected() {
-        ringingCall.clearDisconnected();
-        foregroundCall.clearDisconnected();
-        backgroundCall.clearDisconnected();
+        mRingingCall.clearDisconnected();
+        mForegroundCall.clearDisconnected();
+        mBackgroundCall.clearDisconnected();
     }
 
     /**
@@ -356,59 +361,60 @@
      */
     private Message
     obtainCompleteMessage(int what) {
-        pendingOperations++;
-        lastRelevantPoll = null;
-        needsPoll = true;
+        mPendingOperations++;
+        mLastRelevantPoll = null;
+        mNeedsPoll = true;
 
         if (DBG_POLL) log("obtainCompleteMessage: pendingOperations=" +
-                pendingOperations + ", needsPoll=" + needsPoll);
+                mPendingOperations + ", needsPoll=" + mNeedsPoll);
 
         return obtainMessage(what);
     }
 
     private void
     operationComplete() {
-        pendingOperations--;
+        mPendingOperations--;
 
         if (DBG_POLL) log("operationComplete: pendingOperations=" +
-                pendingOperations + ", needsPoll=" + needsPoll);
+                mPendingOperations + ", needsPoll=" + mNeedsPoll);
 
-        if (pendingOperations == 0 && needsPoll) {
-            lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
-            cm.getCurrentCalls(lastRelevantPoll);
-        } else if (pendingOperations < 0) {
+        if (mPendingOperations == 0 && mNeedsPoll) {
+            mLastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
+            mCi.getCurrentCalls(mLastRelevantPoll);
+        } else if (mPendingOperations < 0) {
             // this should never happen
             Rlog.e(LOG_TAG,"GsmCallTracker.pendingOperations < 0");
-            pendingOperations = 0;
+            mPendingOperations = 0;
         }
     }
 
     private void
     updatePhoneState() {
-        PhoneConstants.State oldState = state;
+        PhoneConstants.State oldState = mState;
 
-        if (ringingCall.isRinging()) {
-            state = PhoneConstants.State.RINGING;
+        if (mRingingCall.isRinging()) {
+            mState = PhoneConstants.State.RINGING;
         } else if (pendingMO != null ||
-                !(foregroundCall.isIdle() && backgroundCall.isIdle())) {
-            state = PhoneConstants.State.OFFHOOK;
+                !(mForegroundCall.isIdle() && mBackgroundCall.isIdle())) {
+            mState = PhoneConstants.State.OFFHOOK;
         } else {
-            state = PhoneConstants.State.IDLE;
+            mState = PhoneConstants.State.IDLE;
         }
 
-        if (state == PhoneConstants.State.IDLE && oldState != state) {
-            voiceCallEndedRegistrants.notifyRegistrants(
+        if (mState == PhoneConstants.State.IDLE && oldState != mState) {
+            mVoiceCallEndedRegistrants.notifyRegistrants(
                 new AsyncResult(null, null, null));
-        } else if (oldState == PhoneConstants.State.IDLE && oldState != state) {
-            voiceCallStartedRegistrants.notifyRegistrants (
+        } else if (oldState == PhoneConstants.State.IDLE && oldState != mState) {
+            mVoiceCallStartedRegistrants.notifyRegistrants (
                     new AsyncResult(null, null, null));
         }
 
-        if (state != oldState) {
-            phone.notifyPhoneStateChanged();
+        if (mState != oldState) {
+            mPhone.notifyPhoneStateChanged();
         }
     }
 
+    @Override
     protected synchronized void
     handlePollCalls(AsyncResult ar) {
         List polledCalls;
@@ -433,8 +439,8 @@
         boolean unknownConnectionAppeared = false;
 
         for (int i = 0, curDC = 0, dcSize = polledCalls.size()
-                ; i < connections.length; i++) {
-            GsmConnection conn = connections[i];
+                ; i < mConnections.length; i++) {
+            GsmConnection conn = mConnections[i];
             DriverCall dc = null;
 
             // polledCall list is sparse
@@ -458,18 +464,18 @@
                     if (DBG_POLL) log("poll: pendingMO=" + pendingMO);
 
                     // It's our pending mobile originating call
-                    connections[i] = pendingMO;
-                    pendingMO.index = i;
+                    mConnections[i] = pendingMO;
+                    pendingMO.mIndex = i;
                     pendingMO.update(dc);
                     pendingMO = null;
 
                     // Someone has already asked to hangup this call
-                    if (hangupPendingMO) {
-                        hangupPendingMO = false;
+                    if (mHangupPendingMO) {
+                        mHangupPendingMO = false;
                         try {
                             if (Phone.DEBUG_PHONE) log(
                                     "poll: hangupPendingMO, hangup conn " + i);
-                            hangup(connections[i]);
+                            hangup(mConnections[i]);
                         } catch (CallStateException ex) {
                             Rlog.e(LOG_TAG, "unexpected error on hangup");
                         }
@@ -479,11 +485,11 @@
                         return;
                     }
                 } else {
-                    connections[i] = new GsmConnection(phone.getContext(), dc, this, i);
+                    mConnections[i] = new GsmConnection(mPhone.getContext(), dc, this, i);
 
                     // it's a ringing call
-                    if (connections[i].getCall() == ringingCall) {
-                        newRinging = connections[i];
+                    if (mConnections[i].getCall() == mRingingCall) {
+                        newRinging = mConnections[i];
                     } else {
                         // Something strange happened: a call appeared
                         // which is neither a ringing call or one we created.
@@ -497,10 +503,10 @@
                         // it won't appear as a Missed Call.
                         if (dc.state != DriverCall.State.ALERTING
                                 && dc.state != DriverCall.State.DIALING) {
-                            connections[i].onConnectedInOrOut();
+                            mConnections[i].onConnectedInOrOut();
                             if (dc.state == DriverCall.State.HOLDING) {
                                 // We've transitioned into HOLDING
-                                connections[i].onStartedHolding();
+                                mConnections[i].onStartedHolding();
                             }
                         }
 
@@ -511,19 +517,19 @@
             } else if (conn != null && dc == null) {
                 // Connection missing in CLCC response that we were
                 // tracking.
-                droppedDuringPoll.add(conn);
+                mDroppedDuringPoll.add(conn);
                 // Dropped connections are removed from the CallTracker
                 // list but kept in the GsmCall list
-                connections[i] = null;
+                mConnections[i] = null;
             } else if (conn != null && dc != null && !conn.compareTo(dc)) {
                 // Connection in CLCC response does not match what
                 // we were tracking. Assume dropped call and new call
 
-                droppedDuringPoll.add(conn);
-                connections[i] = new GsmConnection (phone.getContext(), dc, this, i);
+                mDroppedDuringPoll.add(conn);
+                mConnections[i] = new GsmConnection (mPhone.getContext(), dc, this, i);
 
-                if (connections[i].getCall() == ringingCall) {
-                    newRinging = connections[i];
+                if (mConnections[i].getCall() == mRingingCall) {
+                    newRinging = mConnections[i];
                 } // else something strange happened
                 hasNonHangupStateChanged = true;
             } else if (conn != null && dc != null) { /* implicit conn.compareTo(dc) */
@@ -557,52 +563,52 @@
         // If it does not, we land here
         if (pendingMO != null) {
             Rlog.d(LOG_TAG,"Pending MO dropped before poll fg state:"
-                            + foregroundCall.getState());
+                            + mForegroundCall.getState());
 
-            droppedDuringPoll.add(pendingMO);
+            mDroppedDuringPoll.add(pendingMO);
             pendingMO = null;
-            hangupPendingMO = false;
+            mHangupPendingMO = false;
         }
 
         if (newRinging != null) {
-            phone.notifyNewRingingConnection(newRinging);
+            mPhone.notifyNewRingingConnection(newRinging);
         }
 
         // clear the "local hangup" and "missed/rejected call"
         // cases from the "dropped during poll" list
         // These cases need no "last call fail" reason
-        for (int i = droppedDuringPoll.size() - 1; i >= 0 ; i--) {
-            GsmConnection conn = droppedDuringPoll.get(i);
+        for (int i = mDroppedDuringPoll.size() - 1; i >= 0 ; i--) {
+            GsmConnection conn = mDroppedDuringPoll.get(i);
 
             if (conn.isIncoming() && conn.getConnectTime() == 0) {
                 // Missed or rejected call
                 Connection.DisconnectCause cause;
-                if (conn.cause == Connection.DisconnectCause.LOCAL) {
+                if (conn.mCause == Connection.DisconnectCause.LOCAL) {
                     cause = Connection.DisconnectCause.INCOMING_REJECTED;
                 } else {
                     cause = Connection.DisconnectCause.INCOMING_MISSED;
                 }
 
                 if (Phone.DEBUG_PHONE) {
-                    log("missed/rejected call, conn.cause=" + conn.cause);
+                    log("missed/rejected call, conn.cause=" + conn.mCause);
                     log("setting cause to " + cause);
                 }
-                droppedDuringPoll.remove(i);
+                mDroppedDuringPoll.remove(i);
                 conn.onDisconnect(cause);
-            } else if (conn.cause == Connection.DisconnectCause.LOCAL) {
+            } else if (conn.mCause == Connection.DisconnectCause.LOCAL) {
                 // Local hangup
-                droppedDuringPoll.remove(i);
+                mDroppedDuringPoll.remove(i);
                 conn.onDisconnect(Connection.DisconnectCause.LOCAL);
-            } else if (conn.cause ==
+            } else if (conn.mCause ==
                 Connection.DisconnectCause.INVALID_NUMBER) {
-                droppedDuringPoll.remove(i);
+                mDroppedDuringPoll.remove(i);
                 conn.onDisconnect(Connection.DisconnectCause.INVALID_NUMBER);
             }
         }
 
         // Any non-local disconnects: determine cause
-        if (droppedDuringPoll.size() > 0) {
-            cm.getLastCallFailCause(
+        if (mDroppedDuringPoll.size() > 0) {
+            mCi.getLastCallFailCause(
                 obtainNoPollCompleteMessage(EVENT_GET_LAST_CALL_FAIL_CAUSE));
         }
 
@@ -622,11 +628,11 @@
         updatePhoneState();
 
         if (unknownConnectionAppeared) {
-            phone.notifyUnknownConnection();
+            mPhone.notifyUnknownConnection();
         }
 
         if (hasNonHangupStateChanged || newRinging != null) {
-            phone.notifyPreciseCallStateChanged();
+            mPhone.notifyPreciseCallStateChanged();
         }
 
         //dumpState();
@@ -644,25 +650,25 @@
     dumpState() {
         List l;
 
-        Rlog.i(LOG_TAG,"Phone State:" + state);
+        Rlog.i(LOG_TAG,"Phone State:" + mState);
 
-        Rlog.i(LOG_TAG,"Ringing call: " + ringingCall.toString());
+        Rlog.i(LOG_TAG,"Ringing call: " + mRingingCall.toString());
 
-        l = ringingCall.getConnections();
+        l = mRingingCall.getConnections();
         for (int i = 0, s = l.size(); i < s; i++) {
             Rlog.i(LOG_TAG,l.get(i).toString());
         }
 
-        Rlog.i(LOG_TAG,"Foreground call: " + foregroundCall.toString());
+        Rlog.i(LOG_TAG,"Foreground call: " + mForegroundCall.toString());
 
-        l = foregroundCall.getConnections();
+        l = mForegroundCall.getConnections();
         for (int i = 0, s = l.size(); i < s; i++) {
             Rlog.i(LOG_TAG,l.get(i).toString());
         }
 
-        Rlog.i(LOG_TAG,"Background call: " + backgroundCall.toString());
+        Rlog.i(LOG_TAG,"Background call: " + mBackgroundCall.toString());
 
-        l = backgroundCall.getConnections();
+        l = mBackgroundCall.getConnections();
         for (int i = 0, s = l.size(); i < s; i++) {
             Rlog.i(LOG_TAG,l.get(i).toString());
         }
@@ -673,7 +679,7 @@
 
     /*package*/ void
     hangup (GsmConnection conn) throws CallStateException {
-        if (conn.owner != this) {
+        if (conn.mOwner != this) {
             throw new CallStateException ("GsmConnection " + conn
                                     + "does not belong to GsmCallTracker " + this);
         }
@@ -683,10 +689,10 @@
             // GSM index assigned yet
 
             if (Phone.DEBUG_PHONE) log("hangup: set hangupPendingMO to true");
-            hangupPendingMO = true;
+            mHangupPendingMO = true;
         } else {
             try {
-                cm.hangupConnection (conn.getGSMIndex(), obtainCompleteMessage());
+                mCi.hangupConnection (conn.getGSMIndex(), obtainCompleteMessage());
             } catch (CallStateException ex) {
                 // Ignore "connection not found"
                 // Call may have hung up already
@@ -700,12 +706,12 @@
 
     /*package*/ void
     separate (GsmConnection conn) throws CallStateException {
-        if (conn.owner != this) {
+        if (conn.mOwner != this) {
             throw new CallStateException ("GsmConnection " + conn
                                     + "does not belong to GsmCallTracker " + this);
         }
         try {
-            cm.separateConnection (conn.getGSMIndex(),
+            mCi.separateConnection (conn.getGSMIndex(),
                 obtainCompleteMessage(EVENT_SEPARATE_RESULT));
         } catch (CallStateException ex) {
             // Ignore "connection not found"
@@ -719,13 +725,13 @@
 
     /*package*/ void
     setMute(boolean mute) {
-        desiredMute = mute;
-        cm.setMute(desiredMute, null);
+        mDesiredMute = mute;
+        mCi.setMute(mDesiredMute, null);
     }
 
     /*package*/ boolean
     getMute() {
-        return desiredMute;
+        return mDesiredMute;
     }
 
 
@@ -737,10 +743,10 @@
             throw new CallStateException("no connections in call");
         }
 
-        if (call == ringingCall) {
+        if (call == mRingingCall) {
             if (Phone.DEBUG_PHONE) log("(ringing) hangup waiting or background");
-            cm.hangupWaitingOrBackground(obtainCompleteMessage());
-        } else if (call == foregroundCall) {
+            mCi.hangupWaitingOrBackground(obtainCompleteMessage());
+        } else if (call == mForegroundCall) {
             if (call.isDialingOrAlerting()) {
                 if (Phone.DEBUG_PHONE) {
                     log("(foregnd) hangup dialing or alerting...");
@@ -749,8 +755,8 @@
             } else {
                 hangupForegroundResumeBackground();
             }
-        } else if (call == backgroundCall) {
-            if (ringingCall.isRinging()) {
+        } else if (call == mBackgroundCall) {
+            if (mRingingCall.isRinging()) {
                 if (Phone.DEBUG_PHONE) {
                     log("hangup all conns in background call");
                 }
@@ -764,28 +770,28 @@
         }
 
         call.onHangupLocal();
-        phone.notifyPreciseCallStateChanged();
+        mPhone.notifyPreciseCallStateChanged();
     }
 
     /* package */
     void hangupWaitingOrBackground() {
         if (Phone.DEBUG_PHONE) log("hangupWaitingOrBackground");
-        cm.hangupWaitingOrBackground(obtainCompleteMessage());
+        mCi.hangupWaitingOrBackground(obtainCompleteMessage());
     }
 
     /* package */
     void hangupForegroundResumeBackground() {
         if (Phone.DEBUG_PHONE) log("hangupForegroundResumeBackground");
-        cm.hangupForegroundResumeBackground(obtainCompleteMessage());
+        mCi.hangupForegroundResumeBackground(obtainCompleteMessage());
     }
 
     void hangupConnectionByIndex(GsmCall call, int index)
             throws CallStateException {
-        int count = call.connections.size();
+        int count = call.mConnections.size();
         for (int i = 0; i < count; i++) {
-            GsmConnection cn = (GsmConnection)call.connections.get(i);
+            GsmConnection cn = (GsmConnection)call.mConnections.get(i);
             if (cn.getGSMIndex() == index) {
-                cm.hangupConnection(index, obtainCompleteMessage());
+                mCi.hangupConnection(index, obtainCompleteMessage());
                 return;
             }
         }
@@ -793,12 +799,12 @@
         throw new CallStateException("no gsm index found");
     }
 
-    void hangupAllConnections(GsmCall call) throws CallStateException{
+    void hangupAllConnections(GsmCall call) {
         try {
-            int count = call.connections.size();
+            int count = call.mConnections.size();
             for (int i = 0; i < count; i++) {
-                GsmConnection cn = (GsmConnection)call.connections.get(i);
-                cm.hangupConnection(cn.getGSMIndex(), obtainCompleteMessage());
+                GsmConnection cn = (GsmConnection)call.mConnections.get(i);
+                mCi.hangupConnection(cn.getGSMIndex(), obtainCompleteMessage());
             }
         } catch (CallStateException ex) {
             Rlog.e(LOG_TAG, "hangupConnectionByIndex caught " + ex);
@@ -808,9 +814,9 @@
     /* package */
     GsmConnection getConnectionByIndex(GsmCall call, int index)
             throws CallStateException {
-        int count = call.connections.size();
+        int count = call.mConnections.size();
         for (int i = 0; i < count; i++) {
-            GsmConnection cn = (GsmConnection)call.connections.get(i);
+            GsmConnection cn = (GsmConnection)call.mConnections.get(i);
             if (cn.getGSMIndex() == index) {
                 return cn;
             }
@@ -835,6 +841,7 @@
 
     //****** Overridden from Handler
 
+    @Override
     public void
     handleMessage (Message msg) {
         AsyncResult ar;
@@ -843,11 +850,11 @@
             case EVENT_POLL_CALLS_RESULT:
                 ar = (AsyncResult)msg.obj;
 
-                if (msg == lastRelevantPoll) {
+                if (msg == mLastRelevantPoll) {
                     if (DBG_POLL) log(
                             "handle EVENT_POLL_CALL_RESULT: set needsPoll=F");
-                    needsPoll = false;
-                    lastRelevantPoll = null;
+                    mNeedsPoll = false;
+                    mLastRelevantPoll = null;
                     handlePollCalls((AsyncResult)msg.obj);
                 }
             break;
@@ -863,7 +870,7 @@
             case EVENT_ECT_RESULT:
                 ar = (AsyncResult)msg.obj;
                 if (ar.exception != null) {
-                    phone.notifySuppServiceFailed(getFailedService(msg.what));
+                    mPhone.notifySuppServiceFailed(getFailedService(msg.what));
                 }
                 operationComplete();
             break;
@@ -891,24 +898,24 @@
                     causeCode == CallFailCause.QOS_NOT_AVAIL ||
                     causeCode == CallFailCause.BEARER_NOT_AVAIL ||
                     causeCode == CallFailCause.ERROR_UNSPECIFIED) {
-                    GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
+                    GsmCellLocation loc = ((GsmCellLocation)mPhone.getCellLocation());
                     EventLog.writeEvent(EventLogTags.CALL_DROP,
                             causeCode, loc != null ? loc.getCid() : -1,
                             TelephonyManager.getDefault().getNetworkType());
                 }
 
-                for (int i = 0, s =  droppedDuringPoll.size()
+                for (int i = 0, s =  mDroppedDuringPoll.size()
                         ; i < s ; i++
                 ) {
-                    GsmConnection conn = droppedDuringPoll.get(i);
+                    GsmConnection conn = mDroppedDuringPoll.get(i);
 
                     conn.onRemoteDisconnect(causeCode);
                 }
 
                 updatePhoneState();
 
-                phone.notifyPreciseCallStateChanged();
-                droppedDuringPoll.clear();
+                mPhone.notifyPreciseCallStateChanged();
+                mDroppedDuringPoll.clear();
             break;
 
             case EVENT_REPOLL_AFTER_DELAY:
@@ -926,6 +933,7 @@
         }
     }
 
+    @Override
     protected void log(String msg) {
         Rlog.d(LOG_TAG, "[GsmCallTracker] " + msg);
     }
@@ -934,23 +942,23 @@
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("GsmCallTracker extends:");
         super.dump(fd, pw, args);
-        pw.println("connections: length=" + connections.length);
-        for(int i=0; i < connections.length; i++) {
-            pw.printf("  connections[%d]=%s\n", i, connections[i]);
+        pw.println("mConnections: length=" + mConnections.length);
+        for(int i=0; i < mConnections.length; i++) {
+            pw.printf("  mConnections[%d]=%s\n", i, mConnections[i]);
         }
-        pw.println(" voiceCallEndedRegistrants=" + voiceCallEndedRegistrants);
-        pw.println(" voiceCallStartedRegistrants=" + voiceCallStartedRegistrants);
-        pw.println(" droppedDuringPoll: size=" + droppedDuringPoll.size());
-        for(int i = 0; i < droppedDuringPoll.size(); i++) {
-            pw.printf( "  droppedDuringPoll[%d]=%s\n", i, droppedDuringPoll.get(i));
+        pw.println(" mVoiceCallEndedRegistrants=" + mVoiceCallEndedRegistrants);
+        pw.println(" mVoiceCallStartedRegistrants=" + mVoiceCallStartedRegistrants);
+        pw.println(" mDroppedDuringPoll: size=" + mDroppedDuringPoll.size());
+        for(int i = 0; i < mDroppedDuringPoll.size(); i++) {
+            pw.printf( "  mDroppedDuringPoll[%d]=%s\n", i, mDroppedDuringPoll.get(i));
         }
-        pw.println(" ringingCall=" + ringingCall);
-        pw.println(" foregroundCall=" + foregroundCall);
-        pw.println(" backgroundCall=" + backgroundCall);
-        pw.println(" pendingMO=" + pendingMO);
-        pw.println(" hangupPendingMO=" + hangupPendingMO);
-        pw.println(" phone=" + phone);
-        pw.println(" desiredMute=" + desiredMute);
-        pw.println(" state=" + state);
+        pw.println(" mRingingCall=" + mRingingCall);
+        pw.println(" mForegroundCall=" + mForegroundCall);
+        pw.println(" mBackgroundCall=" + mBackgroundCall);
+        pw.println(" mPendingMO=" + pendingMO);
+        pw.println(" mHangupPendingMO=" + mHangupPendingMO);
+        pw.println(" mPhone=" + mPhone);
+        pw.println(" mDesiredMute=" + mDesiredMute);
+        pw.println(" mState=" + mState);
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/GsmConnection.java b/src/java/com/android/internal/telephony/gsm/GsmConnection.java
index 9ccc0aa..4699b0e 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmConnection.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmConnection.java
@@ -37,48 +37,49 @@
  * {@hide}
  */
 public class GsmConnection extends Connection {
-    static final String LOG_TAG = "GSM";
+    private static final String LOG_TAG = "GsmConnection";
+    private static final boolean DBG = true;
 
     //***** Instance Variables
 
-    GsmCallTracker owner;
-    GsmCall parent;
+    GsmCallTracker mOwner;
+    GsmCall mParent;
 
-    String address;     // MAY BE NULL!!!
-    String dialString;          // outgoing calls only
-    String postDialString;      // outgoing calls only
-    boolean isIncoming;
-    boolean disconnected;
+    String mAddress;     // MAY BE NULL!!!
+    String mDialString;          // outgoing calls only
+    String mPostDialString;      // outgoing calls only
+    boolean mIsIncoming;
+    boolean mDisconnected;
 
-    int index;          // index in GsmCallTracker.connections[], -1 if unassigned
+    int mIndex;          // index in GsmCallTracker.connections[], -1 if unassigned
                         // The GSM index is 1 + this
 
     /*
      * These time/timespan values are based on System.currentTimeMillis(),
      * i.e., "wall clock" time.
      */
-    long createTime;
-    long connectTime;
-    long disconnectTime;
+    long mCreateTime;
+    long mConnectTime;
+    long mDisconnectTime;
 
     /*
      * These time/timespan values are based on SystemClock.elapsedRealTime(),
      * i.e., time since boot.  They are appropriate for comparison and
      * calculating deltas.
      */
-    long connectTimeReal;
-    long duration;
-    long holdingStartTime;  // The time when the Connection last transitioned
+    long mConnectTimeReal;
+    long mDuration;
+    long mHoldingStartTime;  // The time when the Connection last transitioned
                             // into HOLDING
 
-    int nextPostDialChar;       // index into postDialString
+    int mNextPostDialChar;       // index into postDialString
 
-    DisconnectCause cause = DisconnectCause.NOT_DISCONNECTED;
-    PostDialState postDialState = PostDialState.NOT_STARTED;
-    int numberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
-    UUSInfo uusInfo;
+    DisconnectCause mCause = DisconnectCause.NOT_DISCONNECTED;
+    PostDialState mPostDialState = PostDialState.NOT_STARTED;
+    int mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
+    UUSInfo mUusInfo;
 
-    Handler h;
+    Handler mHandler;
 
     private PowerManager.WakeLock mPartialWakeLock;
 
@@ -97,6 +98,7 @@
     class MyHandler extends Handler {
         MyHandler(Looper l) {super(l);}
 
+        @Override
         public void
         handleMessage(Message msg) {
 
@@ -121,22 +123,22 @@
         createWakeLock(context);
         acquireWakeLock();
 
-        owner = ct;
-        h = new MyHandler(owner.getLooper());
+        mOwner = ct;
+        mHandler = new MyHandler(mOwner.getLooper());
 
-        address = dc.number;
+        mAddress = dc.number;
 
-        isIncoming = dc.isMT;
-        createTime = System.currentTimeMillis();
-        cnapName = dc.name;
-        cnapNamePresentation = dc.namePresentation;
-        numberPresentation = dc.numberPresentation;
-        uusInfo = dc.uusInfo;
+        mIsIncoming = dc.isMT;
+        mCreateTime = System.currentTimeMillis();
+        mCnapName = dc.name;
+        mCnapNamePresentation = dc.namePresentation;
+        mNumberPresentation = dc.numberPresentation;
+        mUusInfo = dc.uusInfo;
 
-        this.index = index;
+        mIndex = index;
 
-        parent = parentFromDCState (dc.state);
-        parent.attach(this, dc);
+        mParent = parentFromDCState (dc.state);
+        mParent.attach(this, dc);
     }
 
     /** This is an MO call, created when dialing */
@@ -145,23 +147,23 @@
         createWakeLock(context);
         acquireWakeLock();
 
-        owner = ct;
-        h = new MyHandler(owner.getLooper());
+        mOwner = ct;
+        mHandler = new MyHandler(mOwner.getLooper());
 
-        this.dialString = dialString;
+        mDialString = dialString;
 
-        this.address = PhoneNumberUtils.extractNetworkPortionAlt(dialString);
-        this.postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
+        mAddress = PhoneNumberUtils.extractNetworkPortionAlt(dialString);
+        mPostDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
 
-        index = -1;
+        mIndex = -1;
 
-        isIncoming = false;
-        cnapName = null;
-        cnapNamePresentation = PhoneConstants.PRESENTATION_ALLOWED;
-        numberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
-        createTime = System.currentTimeMillis();
+        mIsIncoming = false;
+        mCnapName = null;
+        mCnapNamePresentation = PhoneConstants.PRESENTATION_ALLOWED;
+        mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
+        mCreateTime = System.currentTimeMillis();
 
-        this.parent = parent;
+        mParent = parent;
         parent.attachFake(this, GsmCall.State.DIALING);
     }
 
@@ -180,94 +182,108 @@
         //
         // We assume we know when MO calls are created (since we created them)
         // and therefore don't need to compare the phone number anyway.
-        if (! (isIncoming || c.isMT)) return true;
+        if (! (mIsIncoming || c.isMT)) return true;
 
         // ... but we can compare phone numbers on MT calls, and we have
         // no control over when they begin, so we might as well
 
         String cAddress = PhoneNumberUtils.stringFromStringAndTOA(c.number, c.TOA);
-        return isIncoming == c.isMT && equalsHandlesNulls(address, cAddress);
+        return mIsIncoming == c.isMT && equalsHandlesNulls(mAddress, cAddress);
     }
 
+    @Override
     public String getAddress() {
-        return address;
+        return mAddress;
     }
 
+    @Override
     public GsmCall getCall() {
-        return parent;
+        return mParent;
     }
 
+    @Override
     public long getCreateTime() {
-        return createTime;
+        return mCreateTime;
     }
 
+    @Override
     public long getConnectTime() {
-        return connectTime;
+        return mConnectTime;
     }
 
+    @Override
     public long getDisconnectTime() {
-        return disconnectTime;
+        return mDisconnectTime;
     }
 
+    @Override
     public long getDurationMillis() {
-        if (connectTimeReal == 0) {
+        if (mConnectTimeReal == 0) {
             return 0;
-        } else if (duration == 0) {
-            return SystemClock.elapsedRealtime() - connectTimeReal;
+        } else if (mDuration == 0) {
+            return SystemClock.elapsedRealtime() - mConnectTimeReal;
         } else {
-            return duration;
+            return mDuration;
         }
     }
 
+    @Override
     public long getHoldDurationMillis() {
         if (getState() != GsmCall.State.HOLDING) {
             // If not holding, return 0
             return 0;
         } else {
-            return SystemClock.elapsedRealtime() - holdingStartTime;
+            return SystemClock.elapsedRealtime() - mHoldingStartTime;
         }
     }
 
+    @Override
     public DisconnectCause getDisconnectCause() {
-        return cause;
+        return mCause;
     }
 
+    @Override
     public boolean isIncoming() {
-        return isIncoming;
+        return mIsIncoming;
     }
 
+    @Override
     public GsmCall.State getState() {
-        if (disconnected) {
+        if (mDisconnected) {
             return GsmCall.State.DISCONNECTED;
         } else {
             return super.getState();
         }
     }
 
+    @Override
     public void hangup() throws CallStateException {
-        if (!disconnected) {
-            owner.hangup(this);
+        if (!mDisconnected) {
+            mOwner.hangup(this);
         } else {
             throw new CallStateException ("disconnected");
         }
     }
 
+    @Override
     public void separate() throws CallStateException {
-        if (!disconnected) {
-            owner.separate(this);
+        if (!mDisconnected) {
+            mOwner.separate(this);
         } else {
             throw new CallStateException ("disconnected");
         }
     }
 
+    @Override
     public PostDialState getPostDialState() {
-        return postDialState;
+        return mPostDialState;
     }
 
+    @Override
     public void proceedAfterWaitChar() {
-        if (postDialState != PostDialState.WAIT) {
+        if (mPostDialState != PostDialState.WAIT) {
             Rlog.w(LOG_TAG, "GsmConnection.proceedAfterWaitChar(): Expected "
-                + "getPostDialState() to be WAIT but was " + postDialState);
+                + "getPostDialState() to be WAIT but was " + mPostDialState);
             return;
         }
 
@@ -276,53 +292,32 @@
         processNextPostDialChar();
     }
 
+    @Override
     public void proceedAfterWildChar(String str) {
-        if (postDialState != PostDialState.WILD) {
+        if (mPostDialState != PostDialState.WILD) {
             Rlog.w(LOG_TAG, "GsmConnection.proceedAfterWaitChar(): Expected "
-                + "getPostDialState() to be WILD but was " + postDialState);
+                + "getPostDialState() to be WILD but was " + mPostDialState);
             return;
         }
 
         setPostDialState(PostDialState.STARTED);
 
-        if (false) {
-            boolean playedTone = false;
-            int len = (str != null ? str.length() : 0);
+        // make a new postDialString, with the wild char replacement string
+        // at the beginning, followed by the remaining postDialString.
 
-            for (int i=0; i<len; i++) {
-                char c = str.charAt(i);
-                Message msg = null;
-
-                if (i == len-1) {
-                    msg = h.obtainMessage(EVENT_DTMF_DONE);
-                }
-
-                if (PhoneNumberUtils.is12Key(c)) {
-                    owner.cm.sendDtmf(c, msg);
-                    playedTone = true;
-                }
-            }
-
-            if (!playedTone) {
-                processNextPostDialChar();
-            }
-        } else {
-            // make a new postDialString, with the wild char replacement string
-            // at the beginning, followed by the remaining postDialString.
-
-            StringBuilder buf = new StringBuilder(str);
-            buf.append(postDialString.substring(nextPostDialChar));
-            postDialString = buf.toString();
-            nextPostDialChar = 0;
-            if (Phone.DEBUG_PHONE) {
-                log("proceedAfterWildChar: new postDialString is " +
-                        postDialString);
-            }
-
-            processNextPostDialChar();
+        StringBuilder buf = new StringBuilder(str);
+        buf.append(mPostDialString.substring(mNextPostDialChar));
+        mPostDialString = buf.toString();
+        mNextPostDialChar = 0;
+        if (Phone.DEBUG_PHONE) {
+            log("proceedAfterWildChar: new postDialString is " +
+                    mPostDialString);
         }
+
+        processNextPostDialChar();
     }
 
+    @Override
     public void cancelPostDial() {
         setPostDialState(PostDialState.CANCELLED);
     }
@@ -334,7 +329,7 @@
      */
     void
     onHangupLocal() {
-        cause = DisconnectCause.LOCAL;
+        mCause = DisconnectCause.LOCAL;
     }
 
     DisconnectCause
@@ -371,7 +366,7 @@
             case CallFailCause.ERROR_UNSPECIFIED:
             case CallFailCause.NORMAL_CLEARING:
             default:
-                GSMPhone phone = owner.phone;
+                GSMPhone phone = mOwner.mPhone;
                 int serviceState = phone.getServiceState().getState();
                 UiccCardApplication cardApp = UiccController
                         .getInstance()
@@ -413,22 +408,21 @@
     /** Called when the radio indicates the connection has been disconnected */
     /*package*/ void
     onDisconnect(DisconnectCause cause) {
-        this.cause = cause;
+        mCause = cause;
 
-        if (!disconnected) {
-            index = -1;
+        if (!mDisconnected) {
+            mIndex = -1;
 
-            disconnectTime = System.currentTimeMillis();
-            duration = SystemClock.elapsedRealtime() - connectTimeReal;
-            disconnected = true;
+            mDisconnectTime = System.currentTimeMillis();
+            mDuration = SystemClock.elapsedRealtime() - mConnectTimeReal;
+            mDisconnected = true;
 
-            if (false) Rlog.d(LOG_TAG,
-                    "[GSMConn] onDisconnect: cause=" + cause);
+            if (DBG) Rlog.d(LOG_TAG, "onDisconnect: cause=" + cause);
 
-            owner.phone.notifyDisconnect(this);
+            mOwner.mPhone.notifyDisconnect(this);
 
-            if (parent != null) {
-                parent.connectionDisconnected(this);
+            if (mParent != null) {
+                mParent.connectionDisconnected(this);
             }
         }
         releaseWakeLock();
@@ -444,45 +438,45 @@
 
         newParent = parentFromDCState(dc.state);
 
-        if (!equalsHandlesNulls(address, dc.number)) {
+        if (!equalsHandlesNulls(mAddress, dc.number)) {
             if (Phone.DEBUG_PHONE) log("update: phone # changed!");
-            address = dc.number;
+            mAddress = dc.number;
             changed = true;
         }
 
         // A null cnapName should be the same as ""
         if (TextUtils.isEmpty(dc.name)) {
-            if (!TextUtils.isEmpty(cnapName)) {
+            if (!TextUtils.isEmpty(mCnapName)) {
                 changed = true;
-                cnapName = "";
+                mCnapName = "";
             }
-        } else if (!dc.name.equals(cnapName)) {
+        } else if (!dc.name.equals(mCnapName)) {
             changed = true;
-            cnapName = dc.name;
+            mCnapName = dc.name;
         }
 
-        if (Phone.DEBUG_PHONE) log("--dssds----"+cnapName);
-        cnapNamePresentation = dc.namePresentation;
-        numberPresentation = dc.numberPresentation;
+        if (Phone.DEBUG_PHONE) log("--dssds----"+mCnapName);
+        mCnapNamePresentation = dc.namePresentation;
+        mNumberPresentation = dc.numberPresentation;
 
-        if (newParent != parent) {
-            if (parent != null) {
-                parent.detach(this);
+        if (newParent != mParent) {
+            if (mParent != null) {
+                mParent.detach(this);
             }
             newParent.attach(this, dc);
-            parent = newParent;
+            mParent = newParent;
             changed = true;
         } else {
             boolean parentStateChange;
-            parentStateChange = parent.update (this, dc);
+            parentStateChange = mParent.update (this, dc);
             changed = changed || parentStateChange;
         }
 
         /** Some state-transition events */
 
         if (Phone.DEBUG_PHONE) log(
-                "update: parent=" + parent +
-                ", hasNewParent=" + (newParent != parent) +
+                "update: parent=" + mParent +
+                ", hasNewParent=" + (newParent != mParent) +
                 ", wasConnectingInOrOut=" + wasConnectingInOrOut +
                 ", wasHolding=" + wasHolding +
                 ", isConnectingInOrOut=" + isConnectingInOrOut() +
@@ -509,20 +503,20 @@
      */
     void
     fakeHoldBeforeDial() {
-        if (parent != null) {
-            parent.detach(this);
+        if (mParent != null) {
+            mParent.detach(this);
         }
 
-        parent = owner.backgroundCall;
-        parent.attachFake(this, GsmCall.State.HOLDING);
+        mParent = mOwner.mBackgroundCall;
+        mParent.attachFake(this, GsmCall.State.HOLDING);
 
         onStartedHolding();
     }
 
     /*package*/ int
     getGSMIndex() throws CallStateException {
-        if (index >= 0) {
-            return index + 1;
+        if (mIndex >= 0) {
+            return mIndex + 1;
         } else {
             throw new CallStateException ("GSM index not yet assigned");
         }
@@ -533,17 +527,17 @@
      */
     void
     onConnectedInOrOut() {
-        connectTime = System.currentTimeMillis();
-        connectTimeReal = SystemClock.elapsedRealtime();
-        duration = 0;
+        mConnectTime = System.currentTimeMillis();
+        mConnectTimeReal = SystemClock.elapsedRealtime();
+        mDuration = 0;
 
         // bug #678474: incoming call interpreted as missed call, even though
         // it sounds like the user has picked up the call.
         if (Phone.DEBUG_PHONE) {
-            log("onConnectedInOrOut: connectTime=" + connectTime);
+            log("onConnectedInOrOut: connectTime=" + mConnectTime);
         }
 
-        if (!isIncoming) {
+        if (!mIsIncoming) {
             // outgoing calls only
             processNextPostDialChar();
         }
@@ -552,7 +546,7 @@
 
     /*package*/ void
     onStartedHolding() {
-        holdingStartTime = SystemClock.elapsedRealtime();
+        mHoldingStartTime = SystemClock.elapsedRealtime();
     }
     /**
      * Performs the appropriate action for a post-dial char, but does not
@@ -562,21 +556,21 @@
     private boolean
     processPostDialChar(char c) {
         if (PhoneNumberUtils.is12Key(c)) {
-            owner.cm.sendDtmf(c, h.obtainMessage(EVENT_DTMF_DONE));
+            mOwner.mCi.sendDtmf(c, mHandler.obtainMessage(EVENT_DTMF_DONE));
         } else if (c == PhoneNumberUtils.PAUSE) {
             // From TS 22.101:
             // It continues...
             // Upon the called party answering the UE shall send the DTMF digits
-            // automatically to the network after a delay of 3 seconds(± 20 %).
+            // automatically to the network after a delay of 3 seconds( 20 ).
             // The digits shall be sent according to the procedures and timing
             // specified in 3GPP TS 24.008 [13]. The first occurrence of the
             // "DTMF Control Digits Separator" shall be used by the ME to
             // distinguish between the addressing digits (i.e. the phone number)
             // and the DTMF digits. Upon subsequent occurrences of the
             // separator,
-            // the UE shall pause again for 3 seconds (± 20 %) before sending
+            // the UE shall pause again for 3 seconds ( 20 ) before sending
             // any further DTMF digits.
-            h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE),
+            mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_PAUSE_DONE),
                     PAUSE_DELAY_MILLIS);
         } else if (c == PhoneNumberUtils.WAIT) {
             setPostDialState(PostDialState.WAIT);
@@ -589,17 +583,18 @@
         return true;
     }
 
+    @Override
     public String
     getRemainingPostDialString() {
-        if (postDialState == PostDialState.CANCELLED
-            || postDialState == PostDialState.COMPLETE
-            || postDialString == null
-            || postDialString.length() <= nextPostDialChar
+        if (mPostDialState == PostDialState.CANCELLED
+            || mPostDialState == PostDialState.COMPLETE
+            || mPostDialString == null
+            || mPostDialString.length() <= mNextPostDialChar
         ) {
             return "";
         }
 
-        return postDialString.substring(nextPostDialChar);
+        return mPostDialString.substring(mNextPostDialChar);
     }
 
     @Override
@@ -622,13 +617,13 @@
         char c = 0;
         Registrant postDialHandler;
 
-        if (postDialState == PostDialState.CANCELLED) {
+        if (mPostDialState == PostDialState.CANCELLED) {
             //Rlog.v("GSM", "##### processNextPostDialChar: postDialState == CANCELLED, bail");
             return;
         }
 
-        if (postDialString == null ||
-                postDialString.length() <= nextPostDialChar) {
+        if (mPostDialString == null ||
+                mPostDialString.length() <= mNextPostDialChar) {
             setPostDialState(PostDialState.COMPLETE);
 
             // notifyMessage.arg1 is 0 on complete
@@ -638,27 +633,27 @@
 
             setPostDialState(PostDialState.STARTED);
 
-            c = postDialString.charAt(nextPostDialChar++);
+            c = mPostDialString.charAt(mNextPostDialChar++);
 
             isValid = processPostDialChar(c);
 
             if (!isValid) {
                 // Will call processNextPostDialChar
-                h.obtainMessage(EVENT_NEXT_POST_DIAL).sendToTarget();
+                mHandler.obtainMessage(EVENT_NEXT_POST_DIAL).sendToTarget();
                 // Don't notify application
                 Rlog.e("GSM", "processNextPostDialChar: c=" + c + " isn't valid!");
                 return;
             }
         }
 
-        postDialHandler = owner.phone.mPostDialHandler;
+        postDialHandler = mOwner.mPhone.mPostDialHandler;
 
         Message notifyMessage;
 
         if (postDialHandler != null
                 && (notifyMessage = postDialHandler.messageForRegistrant()) != null) {
             // The AsyncResult.result is the Connection object
-            PostDialState state = postDialState;
+            PostDialState state = mPostDialState;
             AsyncResult ar = AsyncResult.forMessage(notifyMessage);
             ar.result = this;
             ar.userObj = state;
@@ -677,9 +672,9 @@
      */
     private boolean
     isConnectingInOrOut() {
-        return parent == null || parent == owner.ringingCall
-            || parent.state == GsmCall.State.DIALING
-            || parent.state == GsmCall.State.ALERTING;
+        return mParent == null || mParent == mOwner.mRingingCall
+            || mParent.mState == GsmCall.State.DIALING
+            || mParent.mState == GsmCall.State.ALERTING;
     }
 
     private GsmCall
@@ -688,16 +683,16 @@
             case ACTIVE:
             case DIALING:
             case ALERTING:
-                return owner.foregroundCall;
+                return mOwner.mForegroundCall;
             //break;
 
             case HOLDING:
-                return owner.backgroundCall;
+                return mOwner.mBackgroundCall;
             //break;
 
             case INCOMING:
             case WAITING:
-                return owner.ringingCall;
+                return mOwner.mRingingCall;
             //break;
 
             default:
@@ -712,17 +707,17 @@
      * @param s new PostDialState
      */
     private void setPostDialState(PostDialState s) {
-        if (postDialState != PostDialState.STARTED
+        if (mPostDialState != PostDialState.STARTED
                 && s == PostDialState.STARTED) {
             acquireWakeLock();
-            Message msg = h.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
-            h.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
-        } else if (postDialState == PostDialState.STARTED
+            Message msg = mHandler.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
+            mHandler.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
+        } else if (mPostDialState == PostDialState.STARTED
                 && s != PostDialState.STARTED) {
-            h.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
+            mHandler.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
             releaseWakeLock();
         }
-        postDialState = s;
+        mPostDialState = s;
     }
 
     private void
@@ -753,11 +748,11 @@
 
     @Override
     public int getNumberPresentation() {
-        return numberPresentation;
+        return mNumberPresentation;
     }
 
     @Override
     public UUSInfo getUUSInfo() {
-        return uusInfo;
+        return mUusInfo;
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
index 55230f2..ac346cd 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
@@ -43,7 +43,7 @@
  *
  */
 public final class GsmMmiCode extends Handler implements MmiCode {
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "GsmMmiCode";
 
     //***** Constants
 
@@ -111,26 +111,26 @@
 
     //***** Instance Variables
 
-    GSMPhone phone;
-    Context context;
+    GSMPhone mPhone;
+    Context mContext;
     UiccCardApplication mUiccApplication;
     IccRecords mIccRecords;
 
-    String action;              // One of ACTION_*
-    String sc;                  // Service Code
-    String sia, sib, sic;       // Service Info a,b,c
-    String poundString;         // Entire MMI string up to and including #
-    String dialingNumber;
-    String pwd;                 // For password registration
+    String mAction;              // One of ACTION_*
+    String mSc;                  // Service Code
+    String mSia, mSib, mSic;       // Service Info a,b,c
+    String mPoundString;         // Entire MMI string up to and including #
+    String mDialingNumber;
+    String mPwd;                 // For password registration
 
     /** Set to true in processCode, not at newFromDialString time */
-    private boolean isPendingUSSD;
+    private boolean mIsPendingUSSD;
 
-    private boolean isUssdRequest;
+    private boolean mIsUssdRequest;
 
-    private boolean isCallFwdReg;
-    State state = State.PENDING;
-    CharSequence message;
+    private boolean mIsCallFwdReg;
+    State mState = State.PENDING;
+    CharSequence mMessage;
 
     //***** Class Variables
 
@@ -188,24 +188,24 @@
         // Is this formatted like a standard supplementary service code?
         if (m.matches()) {
             ret = new GsmMmiCode(phone, app);
-            ret.poundString = makeEmptyNull(m.group(MATCH_GROUP_POUND_STRING));
-            ret.action = makeEmptyNull(m.group(MATCH_GROUP_ACTION));
-            ret.sc = makeEmptyNull(m.group(MATCH_GROUP_SERVICE_CODE));
-            ret.sia = makeEmptyNull(m.group(MATCH_GROUP_SIA));
-            ret.sib = makeEmptyNull(m.group(MATCH_GROUP_SIB));
-            ret.sic = makeEmptyNull(m.group(MATCH_GROUP_SIC));
-            ret.pwd = makeEmptyNull(m.group(MATCH_GROUP_PWD_CONFIRM));
-            ret.dialingNumber = makeEmptyNull(m.group(MATCH_GROUP_DIALING_NUMBER));
+            ret.mPoundString = makeEmptyNull(m.group(MATCH_GROUP_POUND_STRING));
+            ret.mAction = makeEmptyNull(m.group(MATCH_GROUP_ACTION));
+            ret.mSc = makeEmptyNull(m.group(MATCH_GROUP_SERVICE_CODE));
+            ret.mSia = makeEmptyNull(m.group(MATCH_GROUP_SIA));
+            ret.mSib = makeEmptyNull(m.group(MATCH_GROUP_SIB));
+            ret.mSic = makeEmptyNull(m.group(MATCH_GROUP_SIC));
+            ret.mPwd = makeEmptyNull(m.group(MATCH_GROUP_PWD_CONFIRM));
+            ret.mDialingNumber = makeEmptyNull(m.group(MATCH_GROUP_DIALING_NUMBER));
             // According to TS 22.030 6.5.2 "Structure of the MMI",
             // the dialing number should not ending with #.
             // The dialing number ending # is treated as unique USSD,
             // eg, *400#16 digit number# to recharge the prepaid card
             // in India operator(Mumbai MTNL)
-            if(ret.dialingNumber != null &&
-                    ret.dialingNumber.endsWith("#") &&
+            if(ret.mDialingNumber != null &&
+                    ret.mDialingNumber.endsWith("#") &&
                     dialString.endsWith("#")){
                 ret = new GsmMmiCode(phone, app);
-                ret.poundString = dialString;
+                ret.mPoundString = dialString;
             }
         } else if (dialString.endsWith("#")) {
             // TS 22.030 sec 6.5.3.2
@@ -213,14 +213,14 @@
             // (up to the maximum defined in 3GPP TS 24.080 [10]), followed by #SEND".
 
             ret = new GsmMmiCode(phone, app);
-            ret.poundString = dialString;
+            ret.mPoundString = dialString;
         } else if (isTwoDigitShortCode(phone.getContext(), dialString)) {
             //Is a country-specific exception to short codes as defined in TS 22.030, 6.5.3.2
             ret = null;
         } else if (isShortCode(dialString, phone)) {
             // this may be a short code, as defined in TS 22.030, 6.5.3.2
             ret = new GsmMmiCode(phone, app);
-            ret.dialingNumber = dialString;
+            ret.mDialingNumber = dialString;
         }
 
         return ret;
@@ -233,15 +233,15 @@
 
         ret = new GsmMmiCode(phone, app);
 
-        ret.message = ussdMessage;
-        ret.isUssdRequest = isUssdRequest;
+        ret.mMessage = ussdMessage;
+        ret.mIsUssdRequest = isUssdRequest;
 
         // If it's a request, set to PENDING so that it's cancelable.
         if (isUssdRequest) {
-            ret.isPendingUSSD = true;
-            ret.state = State.PENDING;
+            ret.mIsPendingUSSD = true;
+            ret.mState = State.PENDING;
         } else {
-            ret.state = State.COMPLETE;
+            ret.mState = State.COMPLETE;
         }
 
         return ret;
@@ -252,9 +252,9 @@
                                            UiccCardApplication app) {
         GsmMmiCode ret = new GsmMmiCode(phone, app);
 
-        ret.message = ussdMessge;
-        ret.state = State.PENDING;
-        ret.isPendingUSSD = true;
+        ret.mMessage = ussdMessge;
+        ret.mState = State.PENDING;
+        ret.mIsPendingUSSD = true;
 
         return ret;
     }
@@ -405,8 +405,8 @@
         // The telephony unit-test cases may create GsmMmiCode's
         // in secondary threads
         super(phone.getHandler().getLooper());
-        this.phone = phone;
-        this.context = phone.getContext();
+        mPhone = phone;
+        mContext = phone.getContext();
         mUiccApplication = app;
         if (app != null) {
             mIccRecords = app.getIccRecords();
@@ -415,32 +415,35 @@
 
     //***** MmiCode implementation
 
+    @Override
     public State
     getState() {
-        return state;
+        return mState;
     }
 
+    @Override
     public CharSequence
     getMessage() {
-        return message;
+        return mMessage;
     }
 
     // inherited javadoc suffices
+    @Override
     public void
     cancel() {
         // Complete or failed cannot be cancelled
-        if (state == State.COMPLETE || state == State.FAILED) {
+        if (mState == State.COMPLETE || mState == State.FAILED) {
             return;
         }
 
-        state = State.CANCELLED;
+        mState = State.CANCELLED;
 
-        if (isPendingUSSD) {
+        if (mIsPendingUSSD) {
             /*
              * There can only be one pending USSD session, so tell the radio to
              * cancel it.
              */
-            phone.mCM.cancelPendingUssd(obtainMessage(EVENT_USSD_CANCEL_COMPLETE, this));
+            mPhone.mCi.cancelPendingUssd(obtainMessage(EVENT_USSD_CANCEL_COMPLETE, this));
 
             /*
              * Don't call phone.onMMIDone here; wait for CANCEL_COMPLETE notice
@@ -451,14 +454,15 @@
             // the pending radio operation. This requires RIL cancellation
             // support, which does not presently exist.
 
-            phone.onMMIDone (this);
+            mPhone.onMMIDone (this);
         }
 
     }
 
+    @Override
     public boolean isCancelable() {
         /* Can only cancel pending USSD sessions. */
-        return isPendingUSSD;
+        return mIsPendingUSSD;
     }
 
     //***** Instance Methods
@@ -466,14 +470,14 @@
     /** Does this dial string contain a structured or unstructured MMI code? */
     boolean
     isMMI() {
-        return poundString != null;
+        return mPoundString != null;
     }
 
     /* Is this a 1 or 2 digit "short code" as defined in TS 22.030 sec 6.5.3.2? */
     boolean
     isShortCode() {
-        return poundString == null
-                    && dialingNumber != null && dialingNumber.length() <= 2;
+        return mPoundString == null
+                    && mDialingNumber != null && mDialingNumber.length() <= 2;
 
     }
 
@@ -558,8 +562,8 @@
      * @return true if the Service Code is PIN/PIN2/PUK/PUK2-related
      */
     boolean isPinCommand() {
-        return sc != null && (sc.equals(SC_PIN) || sc.equals(SC_PIN2)
-                              || sc.equals(SC_PUK) || sc.equals(SC_PUK2));
+        return mSc != null && (mSc.equals(SC_PIN) || mSc.equals(SC_PIN2)
+                              || mSc.equals(SC_PUK) || mSc.equals(SC_PUK2));
      }
 
     /**
@@ -571,7 +575,7 @@
      */
     boolean
     isTemporaryModeCLIR() {
-        return sc != null && sc.equals(SC_CLIR) && dialingNumber != null
+        return mSc != null && mSc.equals(SC_CLIR) && mDialingNumber != null
                 && (isActivate() || isDeactivate());
     }
 
@@ -581,7 +585,7 @@
      */
     int
     getCLIRMode() {
-        if (sc != null && sc.equals(SC_CLIR)) {
+        if (mSc != null && mSc.equals(SC_CLIR)) {
             if (isActivate()) {
                 return CommandsInterface.CLIR_SUPPRESSION;
             } else if (isDeactivate()) {
@@ -593,23 +597,23 @@
     }
 
     boolean isActivate() {
-        return action != null && action.equals(ACTION_ACTIVATE);
+        return mAction != null && mAction.equals(ACTION_ACTIVATE);
     }
 
     boolean isDeactivate() {
-        return action != null && action.equals(ACTION_DEACTIVATE);
+        return mAction != null && mAction.equals(ACTION_DEACTIVATE);
     }
 
     boolean isInterrogate() {
-        return action != null && action.equals(ACTION_INTERROGATE);
+        return mAction != null && mAction.equals(ACTION_INTERROGATE);
     }
 
     boolean isRegister() {
-        return action != null && action.equals(ACTION_REGISTER);
+        return mAction != null && mAction.equals(ACTION_REGISTER);
     }
 
     boolean isErasure() {
-        return action != null && action.equals(ACTION_ERASURE);
+        return mAction != null && mAction.equals(ACTION_ERASURE);
     }
 
     /**
@@ -617,11 +621,12 @@
      * network...eg, after processCode() is called
      */
     public boolean isPendingUSSD() {
-        return isPendingUSSD;
+        return mIsPendingUSSD;
     }
 
+    @Override
     public boolean isUssdRequest() {
-        return isUssdRequest;
+        return mIsUssdRequest;
     }
 
     /** Process a MMI code or short code...anything that isn't a dialing number */
@@ -631,42 +636,42 @@
             if (isShortCode()) {
                 Rlog.d(LOG_TAG, "isShortCode");
                 // These just get treated as USSD.
-                sendUssd(dialingNumber);
-            } else if (dialingNumber != null) {
+                sendUssd(mDialingNumber);
+            } else if (mDialingNumber != null) {
                 // We should have no dialing numbers here
                 throw new RuntimeException ("Invalid or Unsupported MMI Code");
-            } else if (sc != null && sc.equals(SC_CLIP)) {
+            } else if (mSc != null && mSc.equals(SC_CLIP)) {
                 Rlog.d(LOG_TAG, "is CLIP");
                 if (isInterrogate()) {
-                    phone.mCM.queryCLIP(
+                    mPhone.mCi.queryCLIP(
                             obtainMessage(EVENT_QUERY_COMPLETE, this));
                 } else {
                     throw new RuntimeException ("Invalid or Unsupported MMI Code");
                 }
-            } else if (sc != null && sc.equals(SC_CLIR)) {
+            } else if (mSc != null && mSc.equals(SC_CLIR)) {
                 Rlog.d(LOG_TAG, "is CLIR");
                 if (isActivate()) {
-                    phone.mCM.setCLIR(CommandsInterface.CLIR_INVOCATION,
+                    mPhone.mCi.setCLIR(CommandsInterface.CLIR_INVOCATION,
                         obtainMessage(EVENT_SET_COMPLETE, this));
                 } else if (isDeactivate()) {
-                    phone.mCM.setCLIR(CommandsInterface.CLIR_SUPPRESSION,
+                    mPhone.mCi.setCLIR(CommandsInterface.CLIR_SUPPRESSION,
                         obtainMessage(EVENT_SET_COMPLETE, this));
                 } else if (isInterrogate()) {
-                    phone.mCM.getCLIR(
+                    mPhone.mCi.getCLIR(
                         obtainMessage(EVENT_GET_CLIR_COMPLETE, this));
                 } else {
                     throw new RuntimeException ("Invalid or Unsupported MMI Code");
                 }
-            } else if (isServiceCodeCallForwarding(sc)) {
+            } else if (isServiceCodeCallForwarding(mSc)) {
                 Rlog.d(LOG_TAG, "is CF");
 
-                String dialingNumber = sia;
-                int serviceClass = siToServiceClass(sib);
-                int reason = scToCallForwardReason(sc);
-                int time = siToTime(sic);
+                String dialingNumber = mSia;
+                int serviceClass = siToServiceClass(mSib);
+                int reason = scToCallForwardReason(mSc);
+                int time = siToTime(mSic);
 
                 if (isInterrogate()) {
-                    phone.mCM.queryCallForwardStatus(
+                    mPhone.mCi.queryCallForwardStatus(
                             reason, serviceClass,  dialingNumber,
                                 obtainMessage(EVENT_QUERY_CF_COMPLETE, this));
                 } else {
@@ -679,10 +684,10 @@
                         // number, or an activation if not
                         if (isEmptyOrNull(dialingNumber)) {
                             cfAction = CommandsInterface.CF_ACTION_ENABLE;
-                            isCallFwdReg = false;
+                            mIsCallFwdReg = false;
                         } else {
                             cfAction = CommandsInterface.CF_ACTION_REGISTRATION;
-                            isCallFwdReg = true;
+                            mIsCallFwdReg = true;
                         }
                     } else if (isDeactivate()) {
                         cfAction = CommandsInterface.CF_ACTION_DISABLE;
@@ -705,50 +710,50 @@
                                 (cfAction == CommandsInterface.CF_ACTION_REGISTRATION)) ? 1 : 0;
 
                     Rlog.d(LOG_TAG, "is CF setCallForward");
-                    phone.mCM.setCallForward(cfAction, reason, serviceClass,
+                    mPhone.mCi.setCallForward(cfAction, reason, serviceClass,
                             dialingNumber, time, obtainMessage(
                                     EVENT_SET_CFF_COMPLETE,
                                     isSettingUnconditionalVoice,
                                     isEnableDesired, this));
                 }
-            } else if (isServiceCodeCallBarring(sc)) {
+            } else if (isServiceCodeCallBarring(mSc)) {
                 // sia = password
                 // sib = basic service group
 
-                String password = sia;
-                int serviceClass = siToServiceClass(sib);
-                String facility = scToBarringFacility(sc);
+                String password = mSia;
+                int serviceClass = siToServiceClass(mSib);
+                String facility = scToBarringFacility(mSc);
 
                 if (isInterrogate()) {
-                    phone.mCM.queryFacilityLock(facility, password,
+                    mPhone.mCi.queryFacilityLock(facility, password,
                             serviceClass, obtainMessage(EVENT_QUERY_COMPLETE, this));
                 } else if (isActivate() || isDeactivate()) {
-                    phone.mCM.setFacilityLock(facility, isActivate(), password,
+                    mPhone.mCi.setFacilityLock(facility, isActivate(), password,
                             serviceClass, obtainMessage(EVENT_SET_COMPLETE, this));
                 } else {
                     throw new RuntimeException ("Invalid or Unsupported MMI Code");
                 }
 
-            } else if (sc != null && sc.equals(SC_PWD)) {
+            } else if (mSc != null && mSc.equals(SC_PWD)) {
                 // sia = fac
                 // sib = old pwd
                 // sic = new pwd
                 // pwd = new pwd
                 String facility;
-                String oldPwd = sib;
-                String newPwd = sic;
+                String oldPwd = mSib;
+                String newPwd = mSic;
                 if (isActivate() || isRegister()) {
                     // Even though ACTIVATE is acceptable, this is really termed a REGISTER
-                    action = ACTION_REGISTER;
+                    mAction = ACTION_REGISTER;
 
-                    if (sia == null) {
+                    if (mSia == null) {
                         // If sc was not specified, treat it as BA_ALL.
                         facility = CommandsInterface.CB_FACILITY_BA_ALL;
                     } else {
-                        facility = scToBarringFacility(sia);
+                        facility = scToBarringFacility(mSia);
                     }
-                    if (newPwd.equals(pwd)) {
-                        phone.mCM.changeBarringPassword(facility, oldPwd,
+                    if (newPwd.equals(mPwd)) {
+                        mPhone.mCi.changeBarringPassword(facility, oldPwd,
                                 newPwd, obtainMessage(EVENT_SET_COMPLETE, this));
                     } else {
                         // password mismatch; return error
@@ -758,15 +763,15 @@
                     throw new RuntimeException ("Invalid or Unsupported MMI Code");
                 }
 
-            } else if (sc != null && sc.equals(SC_WAIT)) {
+            } else if (mSc != null && mSc.equals(SC_WAIT)) {
                 // sia = basic service group
-                int serviceClass = siToServiceClass(sia);
+                int serviceClass = siToServiceClass(mSia);
 
                 if (isActivate() || isDeactivate()) {
-                    phone.mCM.setCallWaiting(isActivate(), serviceClass,
+                    mPhone.mCi.setCallWaiting(isActivate(), serviceClass,
                             obtainMessage(EVENT_SET_COMPLETE, this));
                 } else if (isInterrogate()) {
-                    phone.mCM.queryCallWaiting(serviceClass,
+                    mPhone.mCi.queryCallWaiting(serviceClass,
                             obtainMessage(EVENT_QUERY_COMPLETE, this));
                 } else {
                     throw new RuntimeException ("Invalid or Unsupported MMI Code");
@@ -775,59 +780,59 @@
                 // sia = old PIN or PUK
                 // sib = new PIN
                 // sic = new PIN
-                String oldPinOrPuk = sia;
-                String newPin = sib;
+                String oldPinOrPuk = mSia;
+                String newPin = mSib;
                 int pinLen = newPin.length();
                 if (isRegister()) {
-                    if (!newPin.equals(sic)) {
+                    if (!newPin.equals(mSic)) {
                         // password mismatch; return error
                         handlePasswordError(com.android.internal.R.string.mismatchPin);
                     } else if (pinLen < 4 || pinLen > 8 ) {
                         // invalid length
                         handlePasswordError(com.android.internal.R.string.invalidPin);
-                    } else if (sc.equals(SC_PIN) &&
+                    } else if (mSc.equals(SC_PIN) &&
                                mUiccApplication != null &&
                                mUiccApplication.getState() == AppState.APPSTATE_PUK ) {
                         // Sim is puk-locked
                         handlePasswordError(com.android.internal.R.string.needPuk);
                     } else {
                         // pre-checks OK
-                        if (sc.equals(SC_PIN)) {
-                            phone.mCM.changeIccPin(oldPinOrPuk, newPin,
+                        if (mSc.equals(SC_PIN)) {
+                            mPhone.mCi.changeIccPin(oldPinOrPuk, newPin,
                                     obtainMessage(EVENT_SET_COMPLETE, this));
-                        } else if (sc.equals(SC_PIN2)) {
-                            phone.mCM.changeIccPin2(oldPinOrPuk, newPin,
+                        } else if (mSc.equals(SC_PIN2)) {
+                            mPhone.mCi.changeIccPin2(oldPinOrPuk, newPin,
                                     obtainMessage(EVENT_SET_COMPLETE, this));
-                        } else if (sc.equals(SC_PUK)) {
-                            phone.mCM.supplyIccPuk(oldPinOrPuk, newPin,
+                        } else if (mSc.equals(SC_PUK)) {
+                            mPhone.mCi.supplyIccPuk(oldPinOrPuk, newPin,
                                     obtainMessage(EVENT_SET_COMPLETE, this));
-                        } else if (sc.equals(SC_PUK2)) {
-                            phone.mCM.supplyIccPuk2(oldPinOrPuk, newPin,
+                        } else if (mSc.equals(SC_PUK2)) {
+                            mPhone.mCi.supplyIccPuk2(oldPinOrPuk, newPin,
                                     obtainMessage(EVENT_SET_COMPLETE, this));
                         }
                     }
                 } else {
                     throw new RuntimeException ("Invalid or Unsupported MMI Code");
                 }
-            } else if (poundString != null) {
-                sendUssd(poundString);
+            } else if (mPoundString != null) {
+                sendUssd(mPoundString);
             } else {
                 throw new RuntimeException ("Invalid or Unsupported MMI Code");
             }
         } catch (RuntimeException exc) {
-            state = State.FAILED;
-            message = context.getText(com.android.internal.R.string.mmiError);
-            phone.onMMIDone(this);
+            mState = State.FAILED;
+            mMessage = mContext.getText(com.android.internal.R.string.mmiError);
+            mPhone.onMMIDone(this);
         }
     }
 
     private void handlePasswordError(int res) {
-        state = State.FAILED;
+        mState = State.FAILED;
         StringBuilder sb = new StringBuilder(getScString());
         sb.append("\n");
-        sb.append(context.getText(res));
-        message = sb;
-        phone.onMMIDone(this);
+        sb.append(mContext.getText(res));
+        mMessage = sb;
+        mPhone.onMMIDone(this);
     }
 
     /**
@@ -841,19 +846,19 @@
      */
     void
     onUssdFinished(String ussdMessage, boolean isUssdRequest) {
-        if (state == State.PENDING) {
+        if (mState == State.PENDING) {
             if (ussdMessage == null) {
-                message = context.getText(com.android.internal.R.string.mmiComplete);
+                mMessage = mContext.getText(com.android.internal.R.string.mmiComplete);
             } else {
-                message = ussdMessage;
+                mMessage = ussdMessage;
             }
-            this.isUssdRequest = isUssdRequest;
+            mIsUssdRequest = isUssdRequest;
             // If it's a request, leave it PENDING so that it's cancelable.
             if (!isUssdRequest) {
-                state = State.COMPLETE;
+                mState = State.COMPLETE;
             }
 
-            phone.onMMIDone(this);
+            mPhone.onMMIDone(this);
         }
     }
 
@@ -865,28 +870,29 @@
 
     void
     onUssdFinishedError() {
-        if (state == State.PENDING) {
-            state = State.FAILED;
-            message = context.getText(com.android.internal.R.string.mmiError);
+        if (mState == State.PENDING) {
+            mState = State.FAILED;
+            mMessage = mContext.getText(com.android.internal.R.string.mmiError);
 
-            phone.onMMIDone(this);
+            mPhone.onMMIDone(this);
         }
     }
 
     void sendUssd(String ussdMessage) {
         // Treat this as a USSD string
-        isPendingUSSD = true;
+        mIsPendingUSSD = true;
 
         // Note that unlike most everything else, the USSD complete
         // response does not complete this MMI code...we wait for
         // an unsolicited USSD "Notify" or "Request".
         // The matching up of this is done in GSMPhone.
 
-        phone.mCM.sendUSSD(ussdMessage,
+        mPhone.mCi.sendUSSD(ussdMessage,
             obtainMessage(EVENT_USSD_COMPLETE, this));
     }
 
     /** Called from GSMPhone.handleMessage; not a Handler subclass */
+    @Override
     public void
     handleMessage (Message msg) {
         AsyncResult ar;
@@ -934,10 +940,10 @@
                 ar = (AsyncResult) (msg.obj);
 
                 if (ar.exception != null) {
-                    state = State.FAILED;
-                    message = getErrorMessage(ar);
+                    mState = State.FAILED;
+                    mMessage = getErrorMessage(ar);
 
-                    phone.onMMIDone(this);
+                    mPhone.onMMIDone(this);
                 }
 
                 // Note that unlike most everything else, the USSD complete
@@ -948,7 +954,7 @@
             break;
 
             case EVENT_USSD_CANCEL_COMPLETE:
-                phone.onMMIDone(this);
+                mPhone.onMMIDone(this);
             break;
         }
     }
@@ -960,29 +966,29 @@
             CommandException.Error err = ((CommandException)(ar.exception)).getCommandError();
             if (err == CommandException.Error.FDN_CHECK_FAILURE) {
                 Rlog.i(LOG_TAG, "FDN_CHECK_FAILURE");
-                return context.getText(com.android.internal.R.string.mmiFdnError);
+                return mContext.getText(com.android.internal.R.string.mmiFdnError);
             }
         }
 
-        return context.getText(com.android.internal.R.string.mmiError);
+        return mContext.getText(com.android.internal.R.string.mmiError);
     }
 
     private CharSequence getScString() {
-        if (sc != null) {
-            if (isServiceCodeCallBarring(sc)) {
-                return context.getText(com.android.internal.R.string.BaMmi);
-            } else if (isServiceCodeCallForwarding(sc)) {
-                return context.getText(com.android.internal.R.string.CfMmi);
-            } else if (sc.equals(SC_CLIP)) {
-                return context.getText(com.android.internal.R.string.ClipMmi);
-            } else if (sc.equals(SC_CLIR)) {
-                return context.getText(com.android.internal.R.string.ClirMmi);
-            } else if (sc.equals(SC_PWD)) {
-                return context.getText(com.android.internal.R.string.PwdMmi);
-            } else if (sc.equals(SC_WAIT)) {
-                return context.getText(com.android.internal.R.string.CwMmi);
+        if (mSc != null) {
+            if (isServiceCodeCallBarring(mSc)) {
+                return mContext.getText(com.android.internal.R.string.BaMmi);
+            } else if (isServiceCodeCallForwarding(mSc)) {
+                return mContext.getText(com.android.internal.R.string.CfMmi);
+            } else if (mSc.equals(SC_CLIP)) {
+                return mContext.getText(com.android.internal.R.string.ClipMmi);
+            } else if (mSc.equals(SC_CLIR)) {
+                return mContext.getText(com.android.internal.R.string.ClirMmi);
+            } else if (mSc.equals(SC_PWD)) {
+                return mContext.getText(com.android.internal.R.string.PwdMmi);
+            } else if (mSc.equals(SC_WAIT)) {
+                return mContext.getText(com.android.internal.R.string.CwMmi);
             } else if (isPinCommand()) {
-                return context.getText(com.android.internal.R.string.PinMmi);
+                return mContext.getText(com.android.internal.R.string.PinMmi);
             }
         }
 
@@ -995,78 +1001,78 @@
         sb.append("\n");
 
         if (ar.exception != null) {
-            state = State.FAILED;
+            mState = State.FAILED;
             if (ar.exception instanceof CommandException) {
                 CommandException.Error err = ((CommandException)(ar.exception)).getCommandError();
                 if (err == CommandException.Error.PASSWORD_INCORRECT) {
                     if (isPinCommand()) {
                         // look specifically for the PUK commands and adjust
                         // the message accordingly.
-                        if (sc.equals(SC_PUK) || sc.equals(SC_PUK2)) {
-                            sb.append(context.getText(
+                        if (mSc.equals(SC_PUK) || mSc.equals(SC_PUK2)) {
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.badPuk));
                         } else {
-                            sb.append(context.getText(
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.badPin));
                         }
                     } else {
-                        sb.append(context.getText(
+                        sb.append(mContext.getText(
                                 com.android.internal.R.string.passwordIncorrect));
                     }
                 } else if (err == CommandException.Error.SIM_PUK2) {
-                    sb.append(context.getText(
+                    sb.append(mContext.getText(
                             com.android.internal.R.string.badPin));
                     sb.append("\n");
-                    sb.append(context.getText(
+                    sb.append(mContext.getText(
                             com.android.internal.R.string.needPuk2));
                 } else if (err == CommandException.Error.FDN_CHECK_FAILURE) {
                     Rlog.i(LOG_TAG, "FDN_CHECK_FAILURE");
-                    sb.append(context.getText(com.android.internal.R.string.mmiFdnError));
+                    sb.append(mContext.getText(com.android.internal.R.string.mmiFdnError));
                 } else {
-                    sb.append(context.getText(
+                    sb.append(mContext.getText(
                             com.android.internal.R.string.mmiError));
                 }
             } else {
-                sb.append(context.getText(
+                sb.append(mContext.getText(
                         com.android.internal.R.string.mmiError));
             }
         } else if (isActivate()) {
-            state = State.COMPLETE;
-            if (isCallFwdReg) {
-                sb.append(context.getText(
+            mState = State.COMPLETE;
+            if (mIsCallFwdReg) {
+                sb.append(mContext.getText(
                         com.android.internal.R.string.serviceRegistered));
             } else {
-                sb.append(context.getText(
+                sb.append(mContext.getText(
                         com.android.internal.R.string.serviceEnabled));
             }
             // Record CLIR setting
-            if (sc.equals(SC_CLIR)) {
-                phone.saveClirSetting(CommandsInterface.CLIR_INVOCATION);
+            if (mSc.equals(SC_CLIR)) {
+                mPhone.saveClirSetting(CommandsInterface.CLIR_INVOCATION);
             }
         } else if (isDeactivate()) {
-            state = State.COMPLETE;
-            sb.append(context.getText(
+            mState = State.COMPLETE;
+            sb.append(mContext.getText(
                     com.android.internal.R.string.serviceDisabled));
             // Record CLIR setting
-            if (sc.equals(SC_CLIR)) {
-                phone.saveClirSetting(CommandsInterface.CLIR_SUPPRESSION);
+            if (mSc.equals(SC_CLIR)) {
+                mPhone.saveClirSetting(CommandsInterface.CLIR_SUPPRESSION);
             }
         } else if (isRegister()) {
-            state = State.COMPLETE;
-            sb.append(context.getText(
+            mState = State.COMPLETE;
+            sb.append(mContext.getText(
                     com.android.internal.R.string.serviceRegistered));
         } else if (isErasure()) {
-            state = State.COMPLETE;
-            sb.append(context.getText(
+            mState = State.COMPLETE;
+            sb.append(mContext.getText(
                     com.android.internal.R.string.serviceErased));
         } else {
-            state = State.FAILED;
-            sb.append(context.getText(
+            mState = State.FAILED;
+            sb.append(mContext.getText(
                     com.android.internal.R.string.mmiError));
         }
 
-        message = sb;
-        phone.onMMIDone(this);
+        mMessage = sb;
+        mPhone.onMMIDone(this);
     }
 
     private void
@@ -1075,7 +1081,7 @@
         sb.append("\n");
 
         if (ar.exception != null) {
-            state = State.FAILED;
+            mState = State.FAILED;
             sb.append(getErrorMessage(ar));
         } else {
             int clirArgs[];
@@ -1085,21 +1091,21 @@
             // the 'm' parameter from TS 27.007 7.7
             switch (clirArgs[1]) {
                 case 0: // CLIR not provisioned
-                    sb.append(context.getText(
+                    sb.append(mContext.getText(
                                 com.android.internal.R.string.serviceNotProvisioned));
-                    state = State.COMPLETE;
+                    mState = State.COMPLETE;
                 break;
 
                 case 1: // CLIR provisioned in permanent mode
-                    sb.append(context.getText(
+                    sb.append(mContext.getText(
                                 com.android.internal.R.string.CLIRPermanent));
-                    state = State.COMPLETE;
+                    mState = State.COMPLETE;
                 break;
 
                 case 2: // unknown (e.g. no network, etc.)
-                    sb.append(context.getText(
+                    sb.append(mContext.getText(
                                 com.android.internal.R.string.mmiError));
-                    state = State.FAILED;
+                    mState = State.FAILED;
                 break;
 
                 case 3: // CLIR temporary mode presentation restricted
@@ -1108,19 +1114,19 @@
                     switch (clirArgs[0]) {
                         default:
                         case 0: // Default
-                            sb.append(context.getText(
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.CLIRDefaultOnNextCallOn));
                         break;
                         case 1: // CLIR invocation
-                            sb.append(context.getText(
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.CLIRDefaultOnNextCallOn));
                         break;
                         case 2: // CLIR suppression
-                            sb.append(context.getText(
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.CLIRDefaultOnNextCallOff));
                         break;
                     }
-                    state = State.COMPLETE;
+                    mState = State.COMPLETE;
                 break;
 
                 case 4: // CLIR temporary mode presentation allowed
@@ -1128,26 +1134,26 @@
                     switch (clirArgs[0]) {
                         default:
                         case 0: // Default
-                            sb.append(context.getText(
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.CLIRDefaultOffNextCallOff));
                         break;
                         case 1: // CLIR invocation
-                            sb.append(context.getText(
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.CLIRDefaultOffNextCallOn));
                         break;
                         case 2: // CLIR suppression
-                            sb.append(context.getText(
+                            sb.append(mContext.getText(
                                     com.android.internal.R.string.CLIRDefaultOffNextCallOff));
                         break;
                     }
 
-                    state = State.COMPLETE;
+                    mState = State.COMPLETE;
                 break;
             }
         }
 
-        message = sb;
-        phone.onMMIDone(this);
+        mMessage = sb;
+        mPhone.onMMIDone(this);
     }
 
     /**
@@ -1160,21 +1166,21 @@
     serviceClassToCFString (int serviceClass) {
         switch (serviceClass) {
             case SERVICE_CLASS_VOICE:
-                return context.getText(com.android.internal.R.string.serviceClassVoice);
+                return mContext.getText(com.android.internal.R.string.serviceClassVoice);
             case SERVICE_CLASS_DATA:
-                return context.getText(com.android.internal.R.string.serviceClassData);
+                return mContext.getText(com.android.internal.R.string.serviceClassData);
             case SERVICE_CLASS_FAX:
-                return context.getText(com.android.internal.R.string.serviceClassFAX);
+                return mContext.getText(com.android.internal.R.string.serviceClassFAX);
             case SERVICE_CLASS_SMS:
-                return context.getText(com.android.internal.R.string.serviceClassSMS);
+                return mContext.getText(com.android.internal.R.string.serviceClassSMS);
             case SERVICE_CLASS_DATA_SYNC:
-                return context.getText(com.android.internal.R.string.serviceClassDataSync);
+                return mContext.getText(com.android.internal.R.string.serviceClassDataSync);
             case SERVICE_CLASS_DATA_ASYNC:
-                return context.getText(com.android.internal.R.string.serviceClassDataAsync);
+                return mContext.getText(com.android.internal.R.string.serviceClassDataAsync);
             case SERVICE_CLASS_PACKET:
-                return context.getText(com.android.internal.R.string.serviceClassPacket);
+                return mContext.getText(com.android.internal.R.string.serviceClassPacket);
             case SERVICE_CLASS_PAD:
-                return context.getText(com.android.internal.R.string.serviceClassPAD);
+                return mContext.getText(com.android.internal.R.string.serviceClassPAD);
             default:
                 return null;
         }
@@ -1197,24 +1203,24 @@
 
         if (info.status == 1) {
             if (needTimeTemplate) {
-                template = context.getText(
+                template = mContext.getText(
                         com.android.internal.R.string.cfTemplateForwardedTime);
             } else {
-                template = context.getText(
+                template = mContext.getText(
                         com.android.internal.R.string.cfTemplateForwarded);
             }
         } else if (info.status == 0 && isEmptyOrNull(info.number)) {
-            template = context.getText(
+            template = mContext.getText(
                         com.android.internal.R.string.cfTemplateNotForwarded);
         } else { /* (info.status == 0) && !isEmptyOrNull(info.number) */
             // A call forward record that is not active but contains
             // a phone number is considered "registered"
 
             if (needTimeTemplate) {
-                template = context.getText(
+                template = mContext.getText(
                         com.android.internal.R.string.cfTemplateRegisteredTime);
             } else {
-                template = context.getText(
+                template = mContext.getText(
                         com.android.internal.R.string.cfTemplateRegistered);
             }
         }
@@ -1247,7 +1253,7 @@
         sb.append("\n");
 
         if (ar.exception != null) {
-            state = State.FAILED;
+            mState = State.FAILED;
             sb.append(getErrorMessage(ar));
         } else {
             CallForwardInfo infos[];
@@ -1256,7 +1262,7 @@
 
             if (infos.length == 0) {
                 // Assume the default is not active
-                sb.append(context.getText(com.android.internal.R.string.serviceDisabled));
+                sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
 
                 // Set unconditional CFF in SIM to false
                 if (mIccRecords != null) {
@@ -1287,11 +1293,11 @@
                 sb.append(tb);
             }
 
-            state = State.COMPLETE;
+            mState = State.COMPLETE;
         }
 
-        message = sb;
-        phone.onMMIDone(this);
+        mMessage = sb;
+        mPhone.onMMIDone(this);
 
     }
 
@@ -1301,40 +1307,40 @@
         sb.append("\n");
 
         if (ar.exception != null) {
-            state = State.FAILED;
+            mState = State.FAILED;
             sb.append(getErrorMessage(ar));
         } else {
             int[] ints = (int[])ar.result;
 
             if (ints.length != 0) {
                 if (ints[0] == 0) {
-                    sb.append(context.getText(com.android.internal.R.string.serviceDisabled));
-                } else if (sc.equals(SC_WAIT)) {
+                    sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
+                } else if (mSc.equals(SC_WAIT)) {
                     // Call Waiting includes additional data in the response.
                     sb.append(createQueryCallWaitingResultMessage(ints[1]));
-                } else if (isServiceCodeCallBarring(sc)) {
+                } else if (isServiceCodeCallBarring(mSc)) {
                     // ints[0] for Call Barring is a bit vector of services
                     sb.append(createQueryCallBarringResultMessage(ints[0]));
                 } else if (ints[0] == 1) {
                     // for all other services, treat it as a boolean
-                    sb.append(context.getText(com.android.internal.R.string.serviceEnabled));
+                    sb.append(mContext.getText(com.android.internal.R.string.serviceEnabled));
                 } else {
-                    sb.append(context.getText(com.android.internal.R.string.mmiError));
+                    sb.append(mContext.getText(com.android.internal.R.string.mmiError));
                 }
             } else {
-                sb.append(context.getText(com.android.internal.R.string.mmiError));
+                sb.append(mContext.getText(com.android.internal.R.string.mmiError));
             }
-            state = State.COMPLETE;
+            mState = State.COMPLETE;
         }
 
-        message = sb;
-        phone.onMMIDone(this);
+        mMessage = sb;
+        mPhone.onMMIDone(this);
     }
 
     private CharSequence
     createQueryCallWaitingResultMessage(int serviceClass) {
         StringBuilder sb =
-                new StringBuilder(context.getText(com.android.internal.R.string.serviceEnabledFor));
+                new StringBuilder(mContext.getText(com.android.internal.R.string.serviceEnabledFor));
 
         for (int classMask = 1
                     ; classMask <= SERVICE_CLASS_MAX
@@ -1350,7 +1356,7 @@
     private CharSequence
     createQueryCallBarringResultMessage(int serviceClass)
     {
-        StringBuilder sb = new StringBuilder(context.getText(com.android.internal.R.string.serviceEnabledFor));
+        StringBuilder sb = new StringBuilder(mContext.getText(com.android.internal.R.string.serviceEnabledFor));
 
         for (int classMask = 1
                     ; classMask <= SERVICE_CLASS_MAX
@@ -1376,14 +1382,14 @@
         StringBuilder sb = new StringBuilder("GsmMmiCode {");
 
         sb.append("State=" + getState());
-        if (action != null) sb.append(" action=" + action);
-        if (sc != null) sb.append(" sc=" + sc);
-        if (sia != null) sb.append(" sia=" + sia);
-        if (sib != null) sb.append(" sib=" + sib);
-        if (sic != null) sb.append(" sic=" + sic);
-        if (poundString != null) sb.append(" poundString=" + poundString);
-        if (dialingNumber != null) sb.append(" dialingNumber=" + dialingNumber);
-        if (pwd != null) sb.append(" pwd=" + pwd);
+        if (mAction != null) sb.append(" action=" + mAction);
+        if (mSc != null) sb.append(" sc=" + mSc);
+        if (mSia != null) sb.append(" sia=" + mSia);
+        if (mSib != null) sb.append(" sib=" + mSib);
+        if (mSic != null) sb.append(" sic=" + mSic);
+        if (mPoundString != null) sb.append(" poundString=" + mPoundString);
+        if (mDialingNumber != null) sb.append(" dialingNumber=" + mDialingNumber);
+        if (mPwd != null) sb.append(" pwd=" + mPwd);
         sb.append("}");
         return sb.toString();
     }
diff --git a/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java b/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
index 9c22b90..b6cbc08 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
@@ -49,7 +49,8 @@
 import java.util.Iterator;
 
 public final class GsmSMSDispatcher extends SMSDispatcher {
-    private static final String TAG = "GSM";
+    private static final String TAG = "GsmSMSDispatcher";
+    private static final boolean VDBG = false;
 
     /** Status report received */
     private static final int EVENT_NEW_SMS_STATUS_REPORT = 100;
@@ -66,17 +67,17 @@
     public GsmSMSDispatcher(PhoneBase phone, SmsStorageMonitor storageMonitor,
             SmsUsageMonitor usageMonitor) {
         super(phone, storageMonitor, usageMonitor);
-        mDataDownloadHandler = new UsimDataDownloadHandler(mCm);
-        mCm.setOnNewGsmSms(this, EVENT_NEW_SMS, null);
-        mCm.setOnSmsStatus(this, EVENT_NEW_SMS_STATUS_REPORT, null);
-        mCm.setOnNewGsmBroadcastSms(this, EVENT_NEW_BROADCAST_SMS, null);
+        mDataDownloadHandler = new UsimDataDownloadHandler(mCi);
+        mCi.setOnNewGsmSms(this, EVENT_NEW_SMS, null);
+        mCi.setOnSmsStatus(this, EVENT_NEW_SMS_STATUS_REPORT, null);
+        mCi.setOnNewGsmBroadcastSms(this, EVENT_NEW_BROADCAST_SMS, null);
     }
 
     @Override
     public void dispose() {
-        mCm.unSetOnNewGsmSms(this);
-        mCm.unSetOnSmsStatus(this);
-        mCm.unSetOnNewGsmBroadcastSms(this);
+        mCi.unSetOnNewGsmSms(this);
+        mCi.unSetOnSmsStatus(this);
+        mCi.unSetOnNewGsmBroadcastSms(this);
     }
 
     @Override
@@ -105,10 +106,10 @@
             AsyncResult ar = (AsyncResult) msg.obj;
             if (ar.exception == null) {
                 Rlog.d(TAG, "Successfully wrote SMS-PP message to UICC");
-                mCm.acknowledgeLastIncomingGsmSms(true, 0, null);
+                mCi.acknowledgeLastIncomingGsmSms(true, 0, null);
             } else {
                 Rlog.d(TAG, "Failed to write SMS-PP message to UICC", ar.exception);
-                mCm.acknowledgeLastIncomingGsmSms(false,
+                mCi.acknowledgeLastIncomingGsmSms(false,
                         CommandsInterface.GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR, null);
             }
             break;
@@ -131,7 +132,7 @@
 
         if (sms != null) {
             int tpStatus = sms.getStatus();
-            int messageRef = sms.messageRef;
+            int messageRef = sms.mMessageRef;
             for (int i = 0, count = deliveryPendingList.size(); i < count; i++) {
                 SmsTracker tracker = deliveryPendingList.get(i);
                 if (tracker.mMessageRef == messageRef) {
@@ -190,7 +191,7 @@
                 String smsc = IccUtils.bytesToHexString(
                         PhoneNumberUtils.networkPortionToCalledPartyBCDWithLength(
                                 sms.getServiceCenterAddress()));
-                mCm.writeSmsToSim(SmsManager.STATUS_ON_ICC_UNREAD, smsc,
+                mCi.writeSmsToSim(SmsManager.STATUS_ON_ICC_UNREAD, smsc,
                         IccUtils.bytesToHexString(sms.getPdu()),
                         obtainMessage(EVENT_WRITE_SMS_COMPLETE));
                 return Activity.RESULT_OK;  // acknowledge after response from write to USIM
@@ -209,13 +210,13 @@
         if (sms.isMWISetMessage()) {
             mPhone.setVoiceMessageWaiting(1, -1);  // line 1: unknown number of msgs waiting
             handled = sms.isMwiDontStore();
-            if (false) {
+            if (VDBG) {
                 Rlog.d(TAG, "Received voice mail indicator set SMS shouldStore=" + !handled);
             }
         } else if (sms.isMWIClearMessage()) {
             mPhone.setVoiceMessageWaiting(1, 0);   // line 1: no msgs waiting
             handled = sms.isMwiDontStore();
-            if (false) {
+            if (VDBG) {
                 Rlog.d(TAG, "Received voice mail indicator clear SMS shouldStore=" + !handled);
             }
         }
@@ -309,13 +310,13 @@
                 pdu[1] = (byte) tracker.mMessageRef; // TP-MR
             }
         }
-        mCm.sendSMS(IccUtils.bytesToHexString(smsc), IccUtils.bytesToHexString(pdu), reply);
+        mCi.sendSMS(IccUtils.bytesToHexString(smsc), IccUtils.bytesToHexString(pdu), reply);
     }
 
     /** {@inheritDoc} */
     @Override
     protected void acknowledgeLastIncomingSms(boolean success, int result, Message response) {
-        mCm.acknowledgeLastIncomingGsmSms(success, resultToCause(result), response);
+        mCi.acknowledgeLastIncomingGsmSms(success, resultToCause(result), response);
     }
 
     private static int resultToCause(int rc) {
@@ -393,7 +394,7 @@
         try {
             byte[] receivedPdu = (byte[])ar.result;
 
-            if (false) {
+            if (VDBG) {
                 for (int i = 0; i < receivedPdu.length; i += 8) {
                     StringBuilder sb = new StringBuilder("SMS CB pdu data: ");
                     for (int j = i; j < i + 8 && j < receivedPdu.length; j++) {
diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 25ac850..fd6a69e 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -18,10 +18,8 @@
 
 import com.android.internal.telephony.CommandException;
 import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.DataConnectionTracker;
+import com.android.internal.telephony.dataconnection.DataConnectionTrackerBase;
 import com.android.internal.telephony.EventLogTags;
-import com.android.internal.telephony.IccCard;
-import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.MccTable;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.RestrictedState;
@@ -29,10 +27,8 @@
 import com.android.internal.telephony.ServiceStateTracker;
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.TelephonyProperties;
-import com.android.internal.telephony.uicc.IccCardStatus;
 import com.android.internal.telephony.uicc.IccRecords;
 import com.android.internal.telephony.uicc.SIMRecords;
-import com.android.internal.telephony.uicc.UiccCard;
 import com.android.internal.telephony.uicc.UiccCardApplication;
 import com.android.internal.telephony.uicc.UiccController;
 import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
@@ -52,14 +48,11 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.PowerManager;
-import android.os.Registrant;
-import android.os.RegistrantList;
 import android.os.SystemClock;
 import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
-import android.telephony.CellInfo;
 import android.telephony.CellInfoGsm;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
@@ -74,25 +67,21 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
-import java.util.Collection;
 import java.util.Date;
-import java.util.HashSet;
 import java.util.TimeZone;
 
 /**
  * {@hide}
  */
 final class GsmServiceStateTracker extends ServiceStateTracker {
-    static final String LOG_TAG = "GSM";
-    static final boolean DBG = true;
+    private static final String LOG_TAG = "GsmSST";
+    private static final boolean VDBG = false;
 
-    GSMPhone phone;
-    GsmCellLocation cellLoc;
-    GsmCellLocation newCellLoc;
+    GSMPhone mPhone;
+    GsmCellLocation mCellLoc;
+    GsmCellLocation mNewCellLoc;
     int mPreferredNetworkType;
 
-    private int gprsState = ServiceState.STATE_OUT_OF_SERVICE;
-    private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE;
     private int mMaxDataCalls = 1;
     private int mNewMaxDataCalls = 1;
     private int mReasonDataDenied = -1;
@@ -125,7 +114,7 @@
     private boolean mZoneDst;
     private long mZoneTime;
     private boolean mGotCountryCode = false;
-    private ContentResolver cr;
+    private ContentResolver mCr;
 
     /** Boolean is true is setTimeFromNITZString was called */
     private boolean mNitzUpdatedTime = false;
@@ -150,14 +139,10 @@
     private static final String WAKELOCK_TAG = "ServiceStateTracker";
 
     /** Keep track of SPN display rules, so we only broadcast intent if something changes. */
-    private String curSpn = null;
-    private String curPlmn = null;
-    private boolean curShowPlmn = false;
-    private boolean curShowSpn = false;
-
-
-    /** waiting period before recheck gprs and voice registration. */
-    static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS = 60 * 1000;
+    private String mCurSpn = null;
+    private String mCurPlmn = null;
+    private boolean mCurShowPlmn = false;
+    private boolean mCurShowSpn = false;
 
     /** Notification type. */
     static final int PS_ENABLED = 1001;            // Access Control blocks data service
@@ -198,35 +183,35 @@
     };
 
     public GsmServiceStateTracker(GSMPhone phone) {
-        super(phone, phone.mCM, new CellInfoGsm());
+        super(phone, phone.mCi, new CellInfoGsm());
 
-        this.phone = phone;
-        cellLoc = new GsmCellLocation();
-        newCellLoc = new GsmCellLocation();
+        mPhone = phone;
+        mCellLoc = new GsmCellLocation();
+        mNewCellLoc = new GsmCellLocation();
 
         PowerManager powerManager =
                 (PowerManager)phone.getContext().getSystemService(Context.POWER_SERVICE);
         mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_TAG);
 
-        cm.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
-        cm.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null);
+        mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
+        mCi.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null);
 
-        cm.registerForVoiceNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED, null);
-        cm.setOnNITZTime(this, EVENT_NITZ_TIME, null);
-        cm.setOnRestrictedStateChanged(this, EVENT_RESTRICTED_STATE_CHANGED, null);
+        mCi.registerForVoiceNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED, null);
+        mCi.setOnNITZTime(this, EVENT_NITZ_TIME, null);
+        mCi.setOnRestrictedStateChanged(this, EVENT_RESTRICTED_STATE_CHANGED, null);
 
         // system setting property AIRPLANE_MODE_ON is set in Settings.
-        int airplaneMode = Settings.System.getInt(
+        int airplaneMode = Settings.Global.getInt(
                 phone.getContext().getContentResolver(),
-                Settings.System.AIRPLANE_MODE_ON, 0);
+                Settings.Global.AIRPLANE_MODE_ON, 0);
         mDesiredPowerState = ! (airplaneMode > 0);
 
-        cr = phone.getContext().getContentResolver();
-        cr.registerContentObserver(
-                Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
+        mCr = phone.getContext().getContentResolver();
+        mCr.registerContentObserver(
+                Settings.Global.getUriFor(Settings.Global.AUTO_TIME), true,
                 mAutoTimeObserver);
-        cr.registerContentObserver(
-                Settings.System.getUriFor(Settings.System.AUTO_TIME_ZONE), true,
+        mCr.registerContentObserver(
+                Settings.Global.getUriFor(Settings.Global.AUTO_TIME_ZONE), true,
                 mAutoTimeZoneObserver);
 
         setSignalStrengthDefaultValues();
@@ -244,35 +229,37 @@
     public void dispose() {
         checkCorrectThread();
         // Unregister for all events.
-        cm.unregisterForAvailable(this);
-        cm.unregisterForRadioStateChanged(this);
-        cm.unregisterForVoiceNetworkStateChanged(this);
+        mCi.unregisterForAvailable(this);
+        mCi.unregisterForRadioStateChanged(this);
+        mCi.unregisterForVoiceNetworkStateChanged(this);
         if (mUiccApplcation != null) {mUiccApplcation.unregisterForReady(this);}
         if (mIccRecords != null) {mIccRecords.unregisterForRecordsLoaded(this);}
-        cm.unSetOnRestrictedStateChanged(this);
-        cm.unSetOnNITZTime(this);
-        cr.unregisterContentObserver(this.mAutoTimeObserver);
-        cr.unregisterContentObserver(this.mAutoTimeZoneObserver);
-        phone.getContext().unregisterReceiver(mIntentReceiver);
+        mCi.unSetOnRestrictedStateChanged(this);
+        mCi.unSetOnNITZTime(this);
+        mCr.unregisterContentObserver(mAutoTimeObserver);
+        mCr.unregisterContentObserver(mAutoTimeZoneObserver);
+        mPhone.getContext().unregisterReceiver(mIntentReceiver);
         super.dispose();
     }
 
+    @Override
     protected void finalize() {
         if(DBG) log("finalize");
     }
 
     @Override
     protected Phone getPhone() {
-        return phone;
+        return mPhone;
     }
 
+    @Override
     public void handleMessage (Message msg) {
         AsyncResult ar;
         int[] ints;
         String[] strings;
         Message message;
 
-        if (!phone.mIsTheCurrentActivePhone) {
+        if (!mPhone.mIsTheCurrentActivePhone) {
             Rlog.e(LOG_TAG, "Received message " + msg +
                     "[" + msg.what + "] while being destroyed. Ignoring.");
             return;
@@ -285,14 +272,14 @@
 
             case EVENT_SIM_READY:
                 // Set the network type, in case the radio does not restore it.
-                cm.setCurrentPreferredNetworkType();
+                mCi.setCurrentPreferredNetworkType();
 
-                boolean skipRestoringSelection = phone.getContext().getResources().getBoolean(
+                boolean skipRestoringSelection = mPhone.getContext().getResources().getBoolean(
                         com.android.internal.R.bool.skip_restoring_network_selection);
 
                 if (!skipRestoringSelection) {
                     // restore the previous network selection.
-                    phone.restoreSavedNetworkSelection(null);
+                    mPhone.restoreSavedNetworkSelection(null);
                 }
                 pollState();
                 // Signal strength polling stops when radio is off
@@ -314,7 +301,7 @@
                 // This callback is called when signal strength is polled
                 // all by itself
 
-                if (!(cm.getRadioState().isOn())) {
+                if (!(mCi.getRadioState().isOn())) {
                     // Polling will continue when radio turns back on
                     return;
                 }
@@ -343,8 +330,8 @@
                             Rlog.w(LOG_TAG, "error parsing location: " + ex);
                         }
                     }
-                    cellLoc.setLacAndCid(lac, cid);
-                    phone.notifyLocationChanged();
+                    mCellLoc.setLacAndCid(lac, cid);
+                    mPhone.notifyLocationChanged();
                 }
 
                 // Release any temporary cell lock, which could have been
@@ -364,7 +351,7 @@
             case EVENT_POLL_SIGNAL_STRENGTH:
                 // Just poll signal strength...not part of pollState()
 
-                cm.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));
+                mCi.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));
                 break;
 
             case EVENT_NITZ_TIME:
@@ -384,7 +371,7 @@
 
                 // The radio is telling us about signal strength changes
                 // we don't have to ask it
-                dontPollSignalStrength = true;
+                mDontPollSignalStrength = true;
 
                 onSignalStrengthResult(ar, true);
                 break;
@@ -397,7 +384,7 @@
                 ar = (AsyncResult) msg.obj;
 
                 if (ar.exception == null) {
-                    cm.getVoiceRegistrationState(obtainMessage(EVENT_GET_LOC_DONE, null));
+                    mCi.getVoiceRegistrationState(obtainMessage(EVENT_GET_LOC_DONE, null));
                 }
                 break;
 
@@ -405,7 +392,7 @@
                 ar = (AsyncResult) msg.obj;
                 // Don't care the result, only use for dereg network (COPS=2)
                 message = obtainMessage(EVENT_RESET_PREFERRED_NETWORK_TYPE, ar.userObj);
-                cm.setPreferredNetworkType(mPreferredNetworkType, message);
+                mCi.setPreferredNetworkType(mPreferredNetworkType, message);
                 break;
 
             case EVENT_RESET_PREFERRED_NETWORK_TYPE:
@@ -429,18 +416,18 @@
                 message = obtainMessage(EVENT_SET_PREFERRED_NETWORK_TYPE, ar.userObj);
                 int toggledNetworkType = RILConstants.NETWORK_MODE_GLOBAL;
 
-                cm.setPreferredNetworkType(toggledNetworkType, message);
+                mCi.setPreferredNetworkType(toggledNetworkType, message);
                 break;
 
             case EVENT_CHECK_REPORT_GPRS:
-                if (ss != null && !isGprsConsistent(gprsState, ss.getState())) {
+                if (mSS != null && !isGprsConsistent(mSS.getDataRegState(), mSS.getVoiceRegState())) {
 
                     // Can't register data service while voice service is ok
                     // i.e. CREG is ok while CGREG is not
                     // possible a network or baseband side error
-                    GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
+                    GsmCellLocation loc = ((GsmCellLocation)mPhone.getCellLocation());
                     EventLog.writeEvent(EventLogTags.DATA_NETWORK_REGISTRATION_FAIL,
-                            ss.getOperatorNumeric(), loc != null ? loc.getCid() : -1);
+                            mSS.getOperatorNumeric(), loc != null ? loc.getCid() : -1);
                     mReportedGprsNoReg = true;
                 }
                 mStartedGprsRegCheck = false;
@@ -463,14 +450,15 @@
         }
     }
 
+    @Override
     protected void setPowerStateToDesired() {
         // If we want it on and it's off, turn it on
         if (mDesiredPowerState
-            && cm.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
-            cm.setRadioPower(true, null);
-        } else if (!mDesiredPowerState && cm.getRadioState().isOn()) {
+            && mCi.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
+            mCi.setRadioPower(true, null);
+        } else if (!mDesiredPowerState && mCi.getRadioState().isOn()) {
             // If it's on and available and we want it off gracefully
-            DataConnectionTracker dcTracker = phone.mDataConnectionTracker;
+            DataConnectionTrackerBase dcTracker = mPhone.mDataConnectionTracker;
             powerOffRadioSafely(dcTracker);
         } // Otherwise, we're in the desired state
     }
@@ -478,13 +466,13 @@
     @Override
     protected void hangupAndPowerOff() {
         // hang up all active voice calls
-        if (phone.isInCall()) {
-            phone.mCT.ringingCall.hangupIfAlive();
-            phone.mCT.backgroundCall.hangupIfAlive();
-            phone.mCT.foregroundCall.hangupIfAlive();
+        if (mPhone.isInCall()) {
+            mPhone.mCT.mRingingCall.hangupIfAlive();
+            mPhone.mCT.mBackgroundCall.hangupIfAlive();
+            mPhone.mCT.mForegroundCall.hangupIfAlive();
         }
 
-        cm.setRadioPower(false, null);
+        mCi.setRadioPower(false, null);
     }
 
     @Override
@@ -510,9 +498,9 @@
         IccRecords iccRecords = mIccRecords;
         String plmn = null;
         boolean showPlmn = false;
-        int rule = (iccRecords != null) ? iccRecords.getDisplayRule(ss.getOperatorNumeric()) : 0;
-        if (ss.getState() == ServiceState.STATE_OUT_OF_SERVICE
-                || ss.getState() == ServiceState.STATE_EMERGENCY_ONLY) {
+        int rule = (iccRecords != null) ? iccRecords.getDisplayRule(mSS.getOperatorNumeric()) : 0;
+        if (mSS.getVoiceRegState() == ServiceState.STATE_OUT_OF_SERVICE
+                || mSS.getVoiceRegState() == ServiceState.STATE_EMERGENCY_ONLY) {
             showPlmn = true;
             if (mEmergencyOnly) {
                 // No service but emergency call allowed
@@ -525,9 +513,9 @@
             }
             if (DBG) log("updateSpnDisplay: radio is on but out " +
                     "of service, set plmn='" + plmn + "'");
-        } else if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
+        } else if (mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) {
             // In either home or roaming service
-            plmn = ss.getOperatorAlphaLong();
+            plmn = mSS.getOperatorAlphaLong();
             showPlmn = !TextUtils.isEmpty(plmn) &&
                     ((rule & SIMRecords.SPN_RULE_SHOW_PLMN)
                             == SIMRecords.SPN_RULE_SHOW_PLMN);
@@ -546,10 +534,10 @@
                         == SIMRecords.SPN_RULE_SHOW_SPN);
 
         // Update SPN_STRINGS_UPDATED_ACTION IFF any value changes
-        if (showPlmn != curShowPlmn
-                || showSpn != curShowSpn
-                || !TextUtils.equals(spn, curSpn)
-                || !TextUtils.equals(plmn, curPlmn)) {
+        if (showPlmn != mCurShowPlmn
+                || showSpn != mCurShowSpn
+                || !TextUtils.equals(spn, mCurSpn)
+                || !TextUtils.equals(plmn, mCurPlmn)) {
             if (DBG) {
                 log(String.format("updateSpnDisplay: changed" +
                         " sending intent rule=" + rule +
@@ -562,24 +550,25 @@
             intent.putExtra(TelephonyIntents.EXTRA_SPN, spn);
             intent.putExtra(TelephonyIntents.EXTRA_SHOW_PLMN, showPlmn);
             intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn);
-            phone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
+            mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
         }
 
-        curShowSpn = showSpn;
-        curShowPlmn = showPlmn;
-        curSpn = spn;
-        curPlmn = plmn;
+        mCurShowSpn = showSpn;
+        mCurShowPlmn = showPlmn;
+        mCurSpn = spn;
+        mCurPlmn = plmn;
     }
 
     /**
      * Handle the result of one of the pollState()-related requests
      */
+    @Override
     protected void handlePollStateResult (int what, AsyncResult ar) {
         int ints[];
         String states[];
 
         // Ignore stale requests from last poll
-        if (ar.userObj != pollingContext) return;
+        if (ar.userObj != mPollingContext) return;
 
         if (ar.exception != null) {
             CommandException.Error err=null;
@@ -594,7 +583,7 @@
                 return;
             }
 
-            if (!cm.getRadioState().isOn()) {
+            if (!mCi.getRadioState().isOn()) {
                 // Radio has crashed or turned off
                 cancelPollState();
                 return;
@@ -606,11 +595,12 @@
             }
         } else try {
             switch (what) {
-                case EVENT_POLL_STATE_REGISTRATION:
+                case EVENT_POLL_STATE_REGISTRATION: {
                     states = (String[])ar.result;
                     int lac = -1;
                     int cid = -1;
-                    int regState = -1;
+                    int type = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
+                    int regState = ServiceState.RIL_REG_STATE_UNKNOWN;
                     int reasonRegStateDenied = -1;
                     int psc = -1;
                     if (states.length > 0) {
@@ -623,6 +613,11 @@
                                 if (states[2] != null && states[2].length() > 0) {
                                     cid = Integer.parseInt(states[2], 16);
                                 }
+
+                                // states[3] (if present) is the current radio technology
+                                if (states.length >= 4 && states[3] != null) {
+                                    type = Integer.parseInt(states[3]);
+                                }
                             }
                             if (states.length > 14) {
                                 if (states[14] != null && states[14].length() > 0) {
@@ -635,24 +630,29 @@
                     }
 
                     mGsmRoaming = regCodeIsRoaming(regState);
-                    newSS.setState (regCodeToServiceState(regState));
+                    mNewSS.setState(regCodeToServiceState(regState));
+                    mNewSS.setRilVoiceRadioTechnology(type);
 
-                    if (regState == 10 || regState == 12 || regState == 13 || regState == 14) {
+                    if (regState == ServiceState.RIL_REG_STATE_DENIED_EMERGENCY_CALL_ENABLED
+                         || regState == ServiceState.RIL_REG_STATE_NOT_REG_EMERGENCY_CALL_ENABLED
+                         || regState == ServiceState.RIL_REG_STATE_SEARCHING_EMERGENCY_CALL_ENABLED
+                         || regState == ServiceState.RIL_REG_STATE_UNKNOWN_EMERGENCY_CALL_ENABLED) {
                         mEmergencyOnly = true;
                     } else {
                         mEmergencyOnly = false;
                     }
 
                     // LAC and CID are -1 if not avail
-                    newCellLoc.setLacAndCid(lac, cid);
-                    newCellLoc.setPsc(psc);
-                break;
+                    mNewCellLoc.setLacAndCid(lac, cid);
+                    mNewCellLoc.setPsc(psc);
+                    break;
+                }
 
-                case EVENT_POLL_STATE_GPRS:
+                case EVENT_POLL_STATE_GPRS: {
                     states = (String[])ar.result;
 
                     int type = 0;
-                    regState = -1;
+                    int regState = ServiceState.RIL_REG_STATE_UNKNOWN;
                     mNewReasonDataDenied = -1;
                     mNewMaxDataCalls = 1;
                     if (states.length > 0) {
@@ -663,7 +663,8 @@
                             if (states.length >= 4 && states[3] != null) {
                                 type = Integer.parseInt(states[3]);
                             }
-                            if ((states.length >= 5 ) && (regState == 3)) {
+                            if ((states.length >= 5 ) &&
+                                    (regState == ServiceState.RIL_REG_STATE_DENIED)) {
                                 mNewReasonDataDenied = Integer.parseInt(states[4]);
                             }
                             if (states.length >= 6) {
@@ -673,40 +674,41 @@
                             loge("error parsing GprsRegistrationState: " + ex);
                         }
                     }
-                    newGPRSState = regCodeToServiceState(regState);
+                    int dataRegState = regCodeToServiceState(regState);
+                    mNewSS.setDataRegState(dataRegState);
                     mDataRoaming = regCodeIsRoaming(regState);
-                    mNewRilRadioTechnology = type;
-                    newSS.setRadioTechnology(type);
-                break;
+                    mNewSS.setRilDataRadioTechnology(type);
+                    if (DBG) {
+                        log("handlPollStateResultMessage: GsmSST setDataRegState=" + dataRegState
+                                + " regState=" + regState
+                                + " dataRadioTechnology=" + type);
+                    }
+                    break;
+                }
 
-                case EVENT_POLL_STATE_OPERATOR:
+                case EVENT_POLL_STATE_OPERATOR: {
                     String opNames[] = (String[])ar.result;
 
                     if (opNames != null && opNames.length >= 3) {
-                         newSS.setOperatorName (opNames[0], opNames[1], opNames[2]);
+                         mNewSS.setOperatorName (opNames[0], opNames[1], opNames[2]);
                     }
-                break;
+                    break;
+                }
 
-                case EVENT_POLL_STATE_NETWORK_SELECTION_MODE:
+                case EVENT_POLL_STATE_NETWORK_SELECTION_MODE: {
                     ints = (int[])ar.result;
-                    newSS.setIsManualSelection(ints[0] == 1);
-                break;
+                    mNewSS.setIsManualSelection(ints[0] == 1);
+                    break;
+                }
             }
 
         } catch (RuntimeException ex) {
             loge("Exception while polling service state. Probably malformed RIL response." + ex);
         }
 
-        final boolean voice_capable = phone.getContext().getResources().getBoolean(
-                com.android.internal.R.bool.config_voice_capable);
+        mPollingContext[0]--;
 
-        if (!voice_capable && newGPRSState == ServiceState.STATE_IN_SERVICE) {
-            newSS.setState (newGPRSState);
-        }
-
-        pollingContext[0]--;
-
-        if (pollingContext[0] == 0) {
+        if (mPollingContext[0] == 0) {
             /**
              *  Since the roaming states of gsm service (from +CREG) and
              *  data service (from +CGREG) could be different, the new SS
@@ -717,11 +719,11 @@
              *  not roaming between operators.
              */
             boolean roaming = (mGsmRoaming || mDataRoaming);
-            if (mGsmRoaming && !isRoamingBetweenOperators(mGsmRoaming, newSS)) {
+            if (mGsmRoaming && !isRoamingBetweenOperators(mGsmRoaming, mNewSS)) {
                 roaming = false;
             }
-            newSS.setRoaming(roaming);
-            newSS.setEmergencyOnly(mEmergencyOnly);
+            mNewSS.setRoaming(roaming);
+            mNewSS.setEmergencyOnly(mEmergencyOnly);
             pollStateDone();
         }
     }
@@ -739,14 +741,13 @@
      * event has changed
      */
     private void pollState() {
-        pollingContext = new int[1];
-        pollingContext[0] = 0;
+        mPollingContext = new int[1];
+        mPollingContext[0] = 0;
 
-        switch (cm.getRadioState()) {
+        switch (mCi.getRadioState()) {
             case RADIO_UNAVAILABLE:
-                newSS.setStateOutOfService();
-                newGPRSState = ServiceState.STATE_OUT_OF_SERVICE;
-                newCellLoc.setStateInvalid();
+                mNewSS.setStateOutOfService();
+                mNewCellLoc.setStateInvalid();
                 setSignalStrengthDefaultValues();
                 mGotCountryCode = false;
                 mNitzUpdatedTime = false;
@@ -754,9 +755,8 @@
             break;
 
             case RADIO_OFF:
-                newSS.setStateOff();
-                newGPRSState = ServiceState.STATE_POWER_OFF;
-                newCellLoc.setStateInvalid();
+                mNewSS.setStateOff();
+                mNewCellLoc.setStateInvalid();
                 setSignalStrengthDefaultValues();
                 mGotCountryCode = false;
                 mNitzUpdatedTime = false;
@@ -768,25 +768,25 @@
                 // then count down the responses, which
                 // are allowed to arrive out-of-order
 
-                pollingContext[0]++;
-                cm.getOperator(
+                mPollingContext[0]++;
+                mCi.getOperator(
                     obtainMessage(
-                        EVENT_POLL_STATE_OPERATOR, pollingContext));
+                        EVENT_POLL_STATE_OPERATOR, mPollingContext));
 
-                pollingContext[0]++;
-                cm.getDataRegistrationState(
+                mPollingContext[0]++;
+                mCi.getDataRegistrationState(
                     obtainMessage(
-                        EVENT_POLL_STATE_GPRS, pollingContext));
+                        EVENT_POLL_STATE_GPRS, mPollingContext));
 
-                pollingContext[0]++;
-                cm.getVoiceRegistrationState(
+                mPollingContext[0]++;
+                mCi.getVoiceRegistrationState(
                     obtainMessage(
-                        EVENT_POLL_STATE_REGISTRATION, pollingContext));
+                        EVENT_POLL_STATE_REGISTRATION, mPollingContext));
 
-                pollingContext[0]++;
-                cm.getNetworkSelectionMode(
+                mPollingContext[0]++;
+                mCi.getNetworkSelectionMode(
                     obtainMessage(
-                        EVENT_POLL_STATE_NETWORK_SELECTION_MODE, pollingContext));
+                        EVENT_POLL_STATE_NETWORK_SELECTION_MODE, mPollingContext));
             break;
         }
     }
@@ -794,88 +794,85 @@
     private void pollStateDone() {
         if (DBG) {
             log("Poll ServiceState done: " +
-                " oldSS=[" + ss + "] newSS=[" + newSS +
-                "] oldGprs=" + gprsState + " newData=" + newGPRSState +
+                " oldSS=[" + mSS + "] newSS=[" + mNewSS + "]" +
                 " oldMaxDataCalls=" + mMaxDataCalls +
                 " mNewMaxDataCalls=" + mNewMaxDataCalls +
                 " oldReasonDataDenied=" + mReasonDataDenied +
-                " mNewReasonDataDenied=" + mNewReasonDataDenied +
-                " oldType=" + ServiceState.rilRadioTechnologyToString(mRilRadioTechnology) +
-                " newType=" + ServiceState.rilRadioTechnologyToString(mNewRilRadioTechnology));
+                " mNewReasonDataDenied=" + mNewReasonDataDenied);
         }
 
         boolean hasRegistered =
-            ss.getState() != ServiceState.STATE_IN_SERVICE
-            && newSS.getState() == ServiceState.STATE_IN_SERVICE;
+            mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
+            && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
 
         boolean hasDeregistered =
-            ss.getState() == ServiceState.STATE_IN_SERVICE
-            && newSS.getState() != ServiceState.STATE_IN_SERVICE;
+            mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE
+            && mNewSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE;
 
         boolean hasGprsAttached =
-                gprsState != ServiceState.STATE_IN_SERVICE
-                && newGPRSState == ServiceState.STATE_IN_SERVICE;
+                mSS.getDataRegState() != ServiceState.STATE_IN_SERVICE
+                && mNewSS.getDataRegState() == ServiceState.STATE_IN_SERVICE;
 
         boolean hasGprsDetached =
-                gprsState == ServiceState.STATE_IN_SERVICE
-                && newGPRSState != ServiceState.STATE_IN_SERVICE;
+                mSS.getDataRegState() == ServiceState.STATE_IN_SERVICE
+                && mNewSS.getDataRegState() != ServiceState.STATE_IN_SERVICE;
 
-        boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
+        boolean hasRilVoiceRadioTechnologyChanged =
+                mSS.getRilVoiceRadioTechnology() != mNewSS.getRilVoiceRadioTechnology();
 
-        boolean hasChanged = !newSS.equals(ss);
+        boolean hasChanged = !mNewSS.equals(mSS);
 
-        boolean hasRoamingOn = !ss.getRoaming() && newSS.getRoaming();
+        boolean hasRoamingOn = !mSS.getRoaming() && mNewSS.getRoaming();
 
-        boolean hasRoamingOff = ss.getRoaming() && !newSS.getRoaming();
+        boolean hasRoamingOff = mSS.getRoaming() && !mNewSS.getRoaming();
 
-        boolean hasLocationChanged = !newCellLoc.equals(cellLoc);
+        boolean hasLocationChanged = !mNewCellLoc.equals(mCellLoc);
 
         // Add an event log when connection state changes
-        if (ss.getState() != newSS.getState() || gprsState != newGPRSState) {
+        if (mSS.getVoiceRegState() != mNewSS.getVoiceRegState()
+                || mSS.getDataRegState() != mNewSS.getDataRegState()) {
             EventLog.writeEvent(EventLogTags.GSM_SERVICE_STATE_CHANGE,
-                ss.getState(), gprsState, newSS.getState(), newGPRSState);
+                mSS.getVoiceRegState(), mSS.getDataRegState(),
+                mNewSS.getVoiceRegState(), mNewSS.getDataRegState());
         }
 
         ServiceState tss;
-        tss = ss;
-        ss = newSS;
-        newSS = tss;
+        tss = mSS;
+        mSS = mNewSS;
+        mNewSS = tss;
         // clean slate for next time
-        newSS.setStateOutOfService();
+        mNewSS.setStateOutOfService();
 
-        GsmCellLocation tcl = cellLoc;
-        cellLoc = newCellLoc;
-        newCellLoc = tcl;
+        GsmCellLocation tcl = mCellLoc;
+        mCellLoc = mNewCellLoc;
+        mNewCellLoc = tcl;
 
         // Add an event log when network type switched
         // TODO: we may add filtering to reduce the event logged,
         // i.e. check preferred network setting, only switch to 2G, etc
-        if (hasRadioTechnologyChanged) {
+        if (hasRilVoiceRadioTechnologyChanged) {
             int cid = -1;
-            GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
+            GsmCellLocation loc = ((GsmCellLocation)mPhone.getCellLocation());
             if (loc != null) cid = loc.getCid();
-            EventLog.writeEvent(EventLogTags.GSM_RAT_SWITCHED, cid, mRilRadioTechnology,
-                    mNewRilRadioTechnology);
+            EventLog.writeEvent(EventLogTags.GSM_RAT_SWITCHED, cid, mSS.getRilVoiceRadioTechnology(),
+                    mNewSS.getRilVoiceRadioTechnology());
             if (DBG) {
-                log("RAT switched " + ServiceState.rilRadioTechnologyToString(mRilRadioTechnology) +
-                        " -> " + ServiceState.rilRadioTechnologyToString(mNewRilRadioTechnology) +
+                log("RAT switched "
+                        + ServiceState.rilRadioTechnologyToString(mSS.getRilVoiceRadioTechnology())
+                        + " -> "
+                        + ServiceState.rilRadioTechnologyToString(mNewSS.getRilVoiceRadioTechnology()) +
                         " at cell " + cid);
             }
         }
 
-        gprsState = newGPRSState;
         mReasonDataDenied = mNewReasonDataDenied;
         mMaxDataCalls = mNewMaxDataCalls;
-        mRilRadioTechnology = mNewRilRadioTechnology;
-        // this new state has been applied - forget it until we get a new new state
-        mNewRilRadioTechnology = 0;
 
+        mNewSS.setStateOutOfService(); // clean slate for next time
 
-        newSS.setStateOutOfService(); // clean slate for next time
-
-        if (hasRadioTechnologyChanged) {
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
-                    ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
+        if (hasRilVoiceRadioTechnologyChanged) {
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
+                    ServiceState.rilRadioTechnologyToString(mSS.getRilVoiceRadioTechnology()));
         }
 
         if (hasRegistered) {
@@ -893,17 +890,17 @@
 
             updateSpnDisplay();
 
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
-                ss.getOperatorAlphaLong());
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
+                mSS.getOperatorAlphaLong());
 
             String prevOperatorNumeric =
                     SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, "");
-            operatorNumeric = ss.getOperatorNumeric();
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
+            operatorNumeric = mSS.getOperatorNumeric();
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
 
             if (operatorNumeric == null) {
                 if (DBG) log("operatorNumeric is null");
-                phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
+                mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
                 mGotCountryCode = false;
                 mNitzUpdatedTime = false;
             } else {
@@ -918,7 +915,7 @@
                     loge("pollStateDone: countryCodeForMcc error" + ex);
                 }
 
-                phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, iso);
+                mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, iso);
                 mGotCountryCode = true;
 
                 TimeZone zone = null;
@@ -950,7 +947,7 @@
                     }
                 }
 
-                if (shouldFixTimeZoneNow(phone, operatorNumeric, prevOperatorNumeric,
+                if (shouldFixTimeZoneNow(mPhone, operatorNumeric, prevOperatorNumeric,
                         mNeedFixZoneAfterNitz)) {
                     // If the offset is (0, false) and the timezone property
                     // is set, use the timezone property rather than
@@ -1017,10 +1014,10 @@
                 }
             }
 
-            phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
-                ss.getRoaming() ? "true" : "false");
+            mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
+                mSS.getRoaming() ? "true" : "false");
 
-            phone.notifyServiceStateChanged(ss);
+            mPhone.notifyServiceStateChanged(mSS);
         }
 
         if (hasGprsAttached) {
@@ -1031,8 +1028,8 @@
             mDetachedRegistrants.notifyRegistrants();
         }
 
-        if (hasRadioTechnologyChanged) {
-            phone.notifyDataConnection(Phone.REASON_NW_TYPE_CHANGED);
+        if (hasRilVoiceRadioTechnologyChanged) {
+            mPhone.notifyDataConnection(Phone.REASON_NW_TYPE_CHANGED);
         }
 
         if (hasRoamingOn) {
@@ -1044,15 +1041,15 @@
         }
 
         if (hasLocationChanged) {
-            phone.notifyLocationChanged();
+            mPhone.notifyLocationChanged();
         }
 
-        if (! isGprsConsistent(gprsState, ss.getState())) {
+        if (! isGprsConsistent(mSS.getDataRegState(), mSS.getVoiceRegState())) {
             if (!mStartedGprsRegCheck && !mReportedGprsNoReg) {
                 mStartedGprsRegCheck = true;
 
                 int check_period = Settings.Global.getInt(
-                        phone.getContext().getContentResolver(),
+                        mPhone.getContext().getContentResolver(),
                         Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS,
                         DEFAULT_GPRS_CHECK_PERIOD_MILLIS);
                 sendMessageDelayed(obtainMessage(EVENT_CHECK_REPORT_GPRS),
@@ -1067,13 +1064,13 @@
     /**
      * Check if GPRS got registered while voice is registered.
      *
-     * @param gprsState for GPRS registration state, i.e. CGREG in GSM
-     * @param serviceState for voice registration state, i.e. CREG in GSM
+     * @param dataRegState i.e. CGREG in GSM
+     * @param voiceRegState i.e. CREG in GSM
      * @return false if device only register to voice but not gprs
      */
-    private boolean isGprsConsistent(int gprsState, int serviceState) {
-        return !((serviceState == ServiceState.STATE_IN_SERVICE) &&
-                (gprsState != ServiceState.STATE_IN_SERVICE));
+    private boolean isGprsConsistent(int dataRegState, int voiceRegState) {
+        return !((voiceRegState == ServiceState.STATE_IN_SERVICE) &&
+                (dataRegState != ServiceState.STATE_IN_SERVICE));
     }
 
     /**
@@ -1110,7 +1107,7 @@
     }
 
     private void queueNextSignalStrengthPoll() {
-        if (dontPollSignalStrength) {
+        if (mDontPollSignalStrength) {
             // The radio is telling us about signal strength changes
             // we don't have to ask it
             return;
@@ -1255,8 +1252,7 @@
      * returns true if registered roam, false otherwise
      */
     private boolean regCodeIsRoaming (int code) {
-        // 5 is  "in service -- roam"
-        return 5 == code;
+        return ServiceState.RIL_REG_STATE_ROAMING == code;
     }
 
     /**
@@ -1289,71 +1285,22 @@
         return gsmRoaming && !(equalsMcc && (equalsOnsl || equalsOnss));
     }
 
-    private static int twoDigitsAt(String s, int offset) {
-        int a, b;
-
-        a = Character.digit(s.charAt(offset), 10);
-        b = Character.digit(s.charAt(offset+1), 10);
-
-        if (a < 0 || b < 0) {
-
-            throw new RuntimeException("invalid format");
-        }
-
-        return a*10 + b;
-    }
-
     /**
      * @return The current GPRS state. IN_SERVICE is the same as "attached"
      * and OUT_OF_SERVICE is the same as detached.
      */
-    int getCurrentGprsState() {
-        return gprsState;
-    }
-
+    @Override
     public int getCurrentDataConnectionState() {
-        return gprsState;
+        return mSS.getDataRegState();
     }
 
     /**
      * @return true if phone is camping on a technology (eg UMTS)
      * that could support voice and data simultaneously.
      */
+    @Override
     public boolean isConcurrentVoiceAndDataAllowed() {
-        return (mRilRadioTechnology >= ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
-    }
-
-    /**
-     * Provides the name of the algorithmic time zone for the specified
-     * offset.  Taken from TimeZone.java.
-     */
-    private static String displayNameFor(int off) {
-        off = off / 1000 / 60;
-
-        char[] buf = new char[9];
-        buf[0] = 'G';
-        buf[1] = 'M';
-        buf[2] = 'T';
-
-        if (off < 0) {
-            buf[3] = '-';
-            off = -off;
-        } else {
-            buf[3] = '+';
-        }
-
-        int hours = off / 60;
-        int minutes = off % 60;
-
-        buf[4] = (char) ('0' + hours / 10);
-        buf[5] = (char) ('0' + hours % 10);
-
-        buf[6] = ':';
-
-        buf[7] = (char) ('0' + minutes / 10);
-        buf[8] = (char) ('0' + minutes % 10);
-
-        return new String(buf);
+        return (mSS.getRilVoiceRadioTechnology() >= ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
     }
 
     /**
@@ -1510,7 +1457,7 @@
                 }
                 SystemProperties.set("gsm.nitz.time", String.valueOf(c.getTimeInMillis()));
                 saveNitzTime(c.getTimeInMillis());
-                if (false) {
+                if (VDBG) {
                     long end = SystemClock.elapsedRealtime();
                     log("NITZ: end=" + end + " dur=" + (end - start));
                 }
@@ -1525,8 +1472,8 @@
 
     private boolean getAutoTime() {
         try {
-            return Settings.System.getInt(phone.getContext().getContentResolver(),
-                    Settings.System.AUTO_TIME) > 0;
+            return Settings.Global.getInt(mPhone.getContext().getContentResolver(),
+                    Settings.Global.AUTO_TIME) > 0;
         } catch (SettingNotFoundException snfe) {
             return true;
         }
@@ -1534,8 +1481,8 @@
 
     private boolean getAutoTimeZone() {
         try {
-            return Settings.System.getInt(phone.getContext().getContentResolver(),
-                    Settings.System.AUTO_TIME_ZONE) > 0;
+            return Settings.Global.getInt(mPhone.getContext().getContentResolver(),
+                    Settings.Global.AUTO_TIME_ZONE) > 0;
         } catch (SettingNotFoundException snfe) {
             return true;
         }
@@ -1559,12 +1506,12 @@
     private void setAndBroadcastNetworkSetTimeZone(String zoneId) {
         if (DBG) log("setAndBroadcastNetworkSetTimeZone: setTimeZone=" + zoneId);
         AlarmManager alarm =
-            (AlarmManager) phone.getContext().getSystemService(Context.ALARM_SERVICE);
+            (AlarmManager) mPhone.getContext().getSystemService(Context.ALARM_SERVICE);
         alarm.setTimeZone(zoneId);
         Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE);
         intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
         intent.putExtra("time-zone", zoneId);
-        phone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
+        mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
         if (DBG) {
             log("setAndBroadcastNetworkSetTimeZone: call alarm.setTimeZone and broadcast zoneId=" +
                 zoneId);
@@ -1583,12 +1530,12 @@
         Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME);
         intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
         intent.putExtra("time", time);
-        phone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
+        mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
     }
 
     private void revertToNitzTime() {
-        if (Settings.System.getInt(phone.getContext().getContentResolver(),
-                Settings.System.AUTO_TIME, 0) == 0) {
+        if (Settings.Global.getInt(mPhone.getContext().getContentResolver(),
+                Settings.Global.AUTO_TIME, 0) == 0) {
             return;
         }
         if (DBG) {
@@ -1602,8 +1549,8 @@
     }
 
     private void revertToNitzTimeZone() {
-        if (Settings.System.getInt(phone.getContext().getContentResolver(),
-                Settings.System.AUTO_TIME_ZONE, 0) == 0) {
+        if (Settings.Global.getInt(mPhone.getContext().getContentResolver(),
+                Settings.Global.AUTO_TIME_ZONE, 0) == 0) {
             return;
         }
         if (DBG) log("Reverting to NITZ TimeZone: tz='" + mSavedTimeZone);
@@ -1620,7 +1567,7 @@
     private void setNotification(int notifyType) {
 
         if (DBG) log("setNotification: create notification " + notifyType);
-        Context context = phone.getContext();
+        Context context = mPhone.getContext();
 
         mNotification = new Notification();
         mNotification.when = System.currentTimeMillis();
@@ -1637,19 +1584,19 @@
         switch (notifyType) {
         case PS_ENABLED:
             notificationId = PS_NOTIFICATION;
-            details = context.getText(com.android.internal.R.string.RestrictedOnData);;
+            details = context.getText(com.android.internal.R.string.RestrictedOnData);
             break;
         case PS_DISABLED:
             notificationId = PS_NOTIFICATION;
             break;
         case CS_ENABLED:
-            details = context.getText(com.android.internal.R.string.RestrictedOnAllVoice);;
+            details = context.getText(com.android.internal.R.string.RestrictedOnAllVoice);
             break;
         case CS_NORMAL_ENABLED:
-            details = context.getText(com.android.internal.R.string.RestrictedOnNormal);;
+            details = context.getText(com.android.internal.R.string.RestrictedOnNormal);
             break;
         case CS_EMERGENCY_ENABLED:
-            details = context.getText(com.android.internal.R.string.RestrictedOnEmergency);;
+            details = context.getText(com.android.internal.R.string.RestrictedOnEmergency);
             break;
         case CS_DISABLED:
             // do nothing and cancel the notification later
@@ -1713,20 +1660,16 @@
         Rlog.e(LOG_TAG, "[GsmSST] " + s);
     }
 
-    private static void sloge(String s) {
-        Rlog.e(LOG_TAG, "[GsmSST] " + s);
-    }
-
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("GsmServiceStateTracker extends:");
         super.dump(fd, pw, args);
-        pw.println(" phone=" + phone);
-        pw.println(" cellLoc=" + cellLoc);
-        pw.println(" newCellLoc=" + newCellLoc);
+        pw.println(" mPhone=" + mPhone);
+        pw.println(" mSS=" + mSS);
+        pw.println(" mNewSS=" + mNewSS);
+        pw.println(" mCellLoc=" + mCellLoc);
+        pw.println(" mNewCellLoc=" + mNewCellLoc);
         pw.println(" mPreferredNetworkType=" + mPreferredNetworkType);
-        pw.println(" gprsState=" + gprsState);
-        pw.println(" newGPRSState=" + newGPRSState);
         pw.println(" mMaxDataCalls=" + mMaxDataCalls);
         pw.println(" mNewMaxDataCalls=" + mNewMaxDataCalls);
         pw.println(" mReasonDataDenied=" + mReasonDataDenied);
@@ -1747,9 +1690,9 @@
         pw.println(" mReportedGprsNoReg=" + mReportedGprsNoReg);
         pw.println(" mNotification=" + mNotification);
         pw.println(" mWakeLock=" + mWakeLock);
-        pw.println(" curSpn=" + curSpn);
-        pw.println(" curShowSpn=" + curShowSpn);
-        pw.println(" curPlmn=" + curPlmn);
-        pw.println(" curShowPlmn=" + curShowPlmn);
+        pw.println(" mCurSpn=" + mCurSpn);
+        pw.println(" mCurShowSpn=" + mCurShowSpn);
+        pw.println(" mCurPlmn=" + mCurPlmn);
+        pw.println(" mCurShowPlmn=" + mCurShowPlmn);
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/GsmSmsAddress.java b/src/java/com/android/internal/telephony/gsm/GsmSmsAddress.java
index fa188f3..2fbf7ed 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmSmsAddress.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmSmsAddress.java
@@ -79,6 +79,7 @@
         }
     }
 
+    @Override
     public String getAddressString() {
         return address;
     }
@@ -86,10 +87,12 @@
     /**
      * Returns true if this is an alphanumeric address
      */
+    @Override
     public boolean isAlphanumeric() {
         return ton == TON_ALPHANUMERIC;
     }
 
+    @Override
     public boolean isNetworkSpecific() {
         return ton == TON_NETWORK;
     }
diff --git a/src/java/com/android/internal/telephony/gsm/SimPhoneBookInterfaceManager.java b/src/java/com/android/internal/telephony/gsm/SimPhoneBookInterfaceManager.java
index 9c5ce3b..7d06e37 100644
--- a/src/java/com/android/internal/telephony/gsm/SimPhoneBookInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/gsm/SimPhoneBookInterfaceManager.java
@@ -31,17 +31,19 @@
 
 
 public class SimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager {
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "SimPhoneBookIM";
 
     public SimPhoneBookInterfaceManager(GSMPhone phone) {
         super(phone);
         //NOTE service "simphonebook" added by IccSmsInterfaceManagerProxy
     }
 
+    @Override
     public void dispose() {
         super.dispose();
     }
 
+    @Override
     protected void finalize() {
         try {
             super.finalize();
@@ -51,30 +53,33 @@
         if(DBG) Rlog.d(LOG_TAG, "SimPhoneBookInterfaceManager finalized");
     }
 
+    @Override
     public int[] getAdnRecordsSize(int efid) {
         if (DBG) logd("getAdnRecordsSize: efid=" + efid);
         synchronized(mLock) {
             checkThread();
-            recordSize = new int[3];
+            mRecordSize = new int[3];
 
             //Using mBaseHandler, no difference in EVENT_GET_SIZE_DONE handling
             AtomicBoolean status = new AtomicBoolean(false);
             Message response = mBaseHandler.obtainMessage(EVENT_GET_SIZE_DONE, status);
 
-            IccFileHandler fh = phone.getIccFileHandler();
+            IccFileHandler fh = mPhone.getIccFileHandler();
             if (fh != null) {
                 fh.getEFLinearRecordSize(efid, response);
                 waitForResult(status);
             }
         }
 
-        return recordSize;
+        return mRecordSize;
     }
 
+    @Override
     protected void logd(String msg) {
         Rlog.d(LOG_TAG, "[SimPbInterfaceManager] " + msg);
     }
 
+    @Override
     protected void loge(String msg) {
         Rlog.e(LOG_TAG, "[SimPbInterfaceManager] " + msg);
     }
diff --git a/src/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java b/src/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java
index 003a5d3..1088758 100644
--- a/src/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java
@@ -16,6 +16,7 @@
 
 package com.android.internal.telephony.gsm;
 
+import android.Manifest;
 import android.content.Context;
 import android.os.Binder;
 import android.os.Message;
@@ -33,7 +34,7 @@
  * access Sms in Sim.
  */
 public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "SimSmsIM";
     static final boolean DBG = true;
 
     private CellBroadcastRangeManager mCellBroadcastRangeManager =
@@ -60,30 +61,35 @@
         if(DBG) Rlog.d(LOG_TAG, "SimSmsInterfaceManager finalized");
     }
 
+    @Override
     protected void deleteSms(int index, Message response) {
-        mPhone.mCM.deleteSmsOnSim(index, response);
+        mPhone.mCi.deleteSmsOnSim(index, response);
     }
 
+    @Override
     protected void writeSms(int status, byte[] pdu, byte[] smsc, Message response) {
-        mPhone.mCM.writeSmsToSim(status, IccUtils.bytesToHexString(smsc),
+        mPhone.mCi.writeSmsToSim(status, IccUtils.bytesToHexString(smsc),
                 IccUtils.bytesToHexString(pdu), response);
     }
 
+    @Override
     public boolean enableCellBroadcast(int messageIdentifier) {
         return enableCellBroadcastRange(messageIdentifier, messageIdentifier);
     }
 
+    @Override
     public boolean disableCellBroadcast(int messageIdentifier) {
         return disableCellBroadcastRange(messageIdentifier, messageIdentifier);
     }
 
+    @Override
     public boolean enableCellBroadcastRange(int startMessageId, int endMessageId) {
         if (DBG) log("enableCellBroadcastRange");
 
         Context context = mPhone.getContext();
 
         context.enforceCallingPermission(
-                "android.permission.RECEIVE_SMS",
+                Manifest.permission.RECEIVE_SMS,
                 "Enabling cell broadcast SMS");
 
         String client = context.getPackageManager().getNameForUid(
@@ -104,13 +110,14 @@
         return true;
     }
 
+    @Override
     public boolean disableCellBroadcastRange(int startMessageId, int endMessageId) {
         if (DBG) log("disableCellBroadcastRange");
 
         Context context = mPhone.getContext();
 
         context.enforceCallingPermission(
-                "android.permission.RECEIVE_SMS",
+                Manifest.permission.RECEIVE_SMS,
                 "Disabling cell broadcast SMS");
 
         String client = context.getPackageManager().getNameForUid(
@@ -140,6 +147,7 @@
          * followed by zero or more calls to {@link #addRange} followed by
          * a call to {@link #finishUpdate}.
          */
+        @Override
         protected void startUpdate() {
             mConfigList.clear();
         }
@@ -150,6 +158,7 @@
          * @param startId the first id included in the range
          * @param endId the last id included in the range
          */
+        @Override
         protected void addRange(int startId, int endId, boolean selected) {
             mConfigList.add(new SmsBroadcastConfigInfo(startId, endId,
                         SMS_CB_CODE_SCHEME_MIN, SMS_CB_CODE_SCHEME_MAX, selected));
@@ -160,6 +169,7 @@
          * previous call to {@link #startUpdate}.
          * @return true if successful, false otherwise
          */
+        @Override
         protected boolean finishUpdate() {
             if (mConfigList.isEmpty()) {
                 return true;
@@ -179,7 +189,7 @@
             Message response = mHandler.obtainMessage(EVENT_SET_BROADCAST_CONFIG_DONE);
 
             mSuccess = false;
-            mPhone.mCM.setGsmBroadcastConfig(configs, response);
+            mPhone.mCi.setGsmBroadcastConfig(configs, response);
 
             try {
                 mLock.wait();
@@ -199,7 +209,7 @@
             Message response = mHandler.obtainMessage(EVENT_SET_BROADCAST_ACTIVATION_DONE);
 
             mSuccess = false;
-            mPhone.mCM.setGsmBroadcastActivation(activate, response);
+            mPhone.mCi.setGsmBroadcastActivation(activate, response);
 
             try {
                 mLock.wait();
diff --git a/src/java/com/android/internal/telephony/gsm/SimTlv.java b/src/java/com/android/internal/telephony/gsm/SimTlv.java
index 497cf5f..c98b9a1 100644
--- a/src/java/com/android/internal/telephony/gsm/SimTlv.java
+++ b/src/java/com/android/internal/telephony/gsm/SimTlv.java
@@ -27,33 +27,33 @@
 {
     //***** Private Instance Variables
 
-    byte record[];
-    int tlvOffset;
-    int tlvLength;
-    int curOffset;
-    int curDataOffset;
-    int curDataLength;
-    boolean hasValidTlvObject;
+    byte mRecord[];
+    int mTlvOffset;
+    int mTlvLength;
+    int mCurOffset;
+    int mCurDataOffset;
+    int mCurDataLength;
+    boolean mHasValidTlvObject;
 
     public SimTlv(byte[] record, int offset, int length) {
-        this.record = record;
+        mRecord = record;
 
-        this.tlvOffset = offset;
-        this.tlvLength = length;
-        curOffset = offset;
+        mTlvOffset = offset;
+        mTlvLength = length;
+        mCurOffset = offset;
 
-        hasValidTlvObject = parseCurrentTlvObject();
+        mHasValidTlvObject = parseCurrentTlvObject();
     }
 
     public boolean nextObject() {
-        if (!hasValidTlvObject) return false;
-        curOffset = curDataOffset + curDataLength;
-        hasValidTlvObject = parseCurrentTlvObject();
-        return hasValidTlvObject;
+        if (!mHasValidTlvObject) return false;
+        mCurOffset = mCurDataOffset + mCurDataLength;
+        mHasValidTlvObject = parseCurrentTlvObject();
+        return mHasValidTlvObject;
     }
 
     public boolean isValidObject() {
-        return hasValidTlvObject;
+        return mHasValidTlvObject;
     }
 
     /**
@@ -63,8 +63,8 @@
      * valid tags range from 1 - 0xfe
      */
     public int getTag() {
-        if (!hasValidTlvObject) return 0;
-        return record[curOffset] & 0xff;
+        if (!mHasValidTlvObject) return 0;
+        return mRecord[mCurOffset] & 0xff;
     }
 
     /**
@@ -73,10 +73,10 @@
      */
 
     public byte[] getData() {
-        if (!hasValidTlvObject) return null;
+        if (!mHasValidTlvObject) return null;
 
-        byte[] ret = new byte[curDataLength];
-        System.arraycopy(record, curDataOffset, ret, 0, curDataLength);
+        byte[] ret = new byte[mCurDataLength];
+        System.arraycopy(mRecord, mCurDataOffset, ret, 0, mCurDataLength);
         return ret;
     }
 
@@ -89,18 +89,18 @@
         // 0x00 and 0xff are invalid tag values
 
         try {
-            if (record[curOffset] == 0 || (record[curOffset] & 0xff) == 0xff) {
+            if (mRecord[mCurOffset] == 0 || (mRecord[mCurOffset] & 0xff) == 0xff) {
                 return false;
             }
 
-            if ((record[curOffset + 1] & 0xff) < 0x80) {
+            if ((mRecord[mCurOffset + 1] & 0xff) < 0x80) {
                 // one byte length 0 - 0x7f
-                curDataLength = record[curOffset + 1] & 0xff;
-                curDataOffset = curOffset + 2;
-            } else if ((record[curOffset + 1] & 0xff) == 0x81) {
+                mCurDataLength = mRecord[mCurOffset + 1] & 0xff;
+                mCurDataOffset = mCurOffset + 2;
+            } else if ((mRecord[mCurOffset + 1] & 0xff) == 0x81) {
                 // two byte length 0x80 - 0xff
-                curDataLength = record[curOffset + 2] & 0xff;
-                curDataOffset = curOffset + 3;
+                mCurDataLength = mRecord[mCurOffset + 2] & 0xff;
+                mCurDataOffset = mCurOffset + 3;
             } else {
                 return false;
             }
@@ -108,7 +108,7 @@
             return false;
         }
 
-        if (curDataLength + curDataOffset > tlvOffset + tlvLength) {
+        if (mCurDataLength + mCurDataOffset > mTlvOffset + mTlvLength) {
             return false;
         }
 
diff --git a/src/java/com/android/internal/telephony/gsm/SmsBroadcastConfigInfo.java b/src/java/com/android/internal/telephony/gsm/SmsBroadcastConfigInfo.java
index 66e7ce0..f4f4036 100644
--- a/src/java/com/android/internal/telephony/gsm/SmsBroadcastConfigInfo.java
+++ b/src/java/com/android/internal/telephony/gsm/SmsBroadcastConfigInfo.java
@@ -35,99 +35,99 @@
  *
  */
 public final class SmsBroadcastConfigInfo {
-    private int fromServiceId;
-    private int toServiceId;
-    private int fromCodeScheme;
-    private int toCodeScheme;
-    private boolean selected;
+    private int mFromServiceId;
+    private int mToServiceId;
+    private int mFromCodeScheme;
+    private int mToCodeScheme;
+    private boolean mSelected;
 
     /**
      * Initialize the object from rssi and cid.
      */
     public SmsBroadcastConfigInfo(int fromId, int toId, int fromScheme,
             int toScheme, boolean selected) {
-        fromServiceId = fromId;
-        toServiceId = toId;
-        fromCodeScheme = fromScheme;
-        toCodeScheme = toScheme;
-        this.selected = selected;
+        mFromServiceId = fromId;
+        mToServiceId = toId;
+        mFromCodeScheme = fromScheme;
+        mToCodeScheme = toScheme;
+        mSelected = selected;
     }
 
     /**
      * @param fromServiceId the fromServiceId to set
      */
     public void setFromServiceId(int fromServiceId) {
-        this.fromServiceId = fromServiceId;
+        mFromServiceId = fromServiceId;
     }
 
     /**
      * @return the fromServiceId
      */
     public int getFromServiceId() {
-        return fromServiceId;
+        return mFromServiceId;
     }
 
     /**
      * @param toServiceId the toServiceId to set
      */
     public void setToServiceId(int toServiceId) {
-        this.toServiceId = toServiceId;
+        mToServiceId = toServiceId;
     }
 
     /**
      * @return the toServiceId
      */
     public int getToServiceId() {
-        return toServiceId;
+        return mToServiceId;
     }
 
     /**
      * @param fromCodeScheme the fromCodeScheme to set
      */
     public void setFromCodeScheme(int fromCodeScheme) {
-        this.fromCodeScheme = fromCodeScheme;
+        mFromCodeScheme = fromCodeScheme;
     }
 
     /**
      * @return the fromCodeScheme
      */
     public int getFromCodeScheme() {
-        return fromCodeScheme;
+        return mFromCodeScheme;
     }
 
     /**
      * @param toCodeScheme the toCodeScheme to set
      */
     public void setToCodeScheme(int toCodeScheme) {
-        this.toCodeScheme = toCodeScheme;
+        mToCodeScheme = toCodeScheme;
     }
 
     /**
      * @return the toCodeScheme
      */
     public int getToCodeScheme() {
-        return toCodeScheme;
+        return mToCodeScheme;
     }
 
     /**
      * @param selected the selected to set
      */
     public void setSelected(boolean selected) {
-        this.selected = selected;
+        mSelected = selected;
     }
 
     /**
      * @return the selected
      */
     public boolean isSelected() {
-        return selected;
+        return mSelected;
     }
 
     @Override
     public String toString() {
         return "SmsBroadcastConfigInfo: Id [" +
-                fromServiceId + ',' + toServiceId + "] Code [" +
-                fromCodeScheme + ',' + toCodeScheme + "] " +
-            (selected ? "ENABLED" : "DISABLED");
+                mFromServiceId + ',' + mToServiceId + "] Code [" +
+                mFromCodeScheme + ',' + mToCodeScheme + "] " +
+            (mSelected ? "ENABLED" : "DISABLED");
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java b/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java
index 995f5b1..157768d 100644
--- a/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java
+++ b/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java
@@ -68,21 +68,21 @@
      */
     private static final int PDU_LENGTH_ETWS = 56;
 
-    private final int geographicalScope;
+    private final int mGeographicalScope;
 
     /** The serial number combines geographical scope, message code, and update number. */
-    private final int serialNumber;
+    private final int mSerialNumber;
 
     /** The Message Identifier in 3GPP is the same as the Service Category in CDMA. */
-    private final int messageIdentifier;
+    private final int mMessageIdentifier;
 
-    private final int dataCodingScheme;
+    private final int mDataCodingScheme;
 
-    private final int pageIndex;
+    private final int mPageIndex;
 
-    private final int nrOfPages;
+    private final int mNrOfPages;
 
-    private final int format;
+    private final int mFormat;
 
     /** ETWS warning notification info. */
     private final SmsCbEtwsInfo mEtwsInfo;
@@ -100,14 +100,14 @@
             // Per TS23.041 9.4.1.2 and 9.4.1.3.2, GSM and ETWS format both
             // contain serial number which contains GS, Message Code, and Update Number
             // per 9.4.1.2.1, and message identifier in same octets
-            geographicalScope = (pdu[0] & 0xc0) >>> 6;
-            serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff);
-            messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff);
+            mGeographicalScope = (pdu[0] & 0xc0) >>> 6;
+            mSerialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff);
+            mMessageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff);
             if (isEtwsMessage() && pdu.length <= PDU_LENGTH_ETWS) {
-                format = FORMAT_ETWS_PRIMARY;
-                dataCodingScheme = -1;
-                pageIndex = -1;
-                nrOfPages = -1;
+                mFormat = FORMAT_ETWS_PRIMARY;
+                mDataCodingScheme = -1;
+                mPageIndex = -1;
+                mNrOfPages = -1;
                 boolean emergencyUserAlert = (pdu[4] & 0x1) != 0;
                 boolean activatePopup = (pdu[5] & 0x80) != 0;
                 int warningType = (pdu[4] & 0xfe) >>> 1;
@@ -124,8 +124,8 @@
                 return;     // skip the ETWS/CMAS initialization code for regular notifications
             } else {
                 // GSM pdus are no more than 88 bytes
-                format = FORMAT_GSM;
-                dataCodingScheme = pdu[4] & 0xff;
+                mFormat = FORMAT_GSM;
+                mDataCodingScheme = pdu[4] & 0xff;
 
                 // Check for invalid page parameter
                 int pageIndex = (pdu[5] & 0xf0) >>> 4;
@@ -136,13 +136,13 @@
                     nrOfPages = 1;
                 }
 
-                this.pageIndex = pageIndex;
-                this.nrOfPages = nrOfPages;
+                mPageIndex = pageIndex;
+                mNrOfPages = nrOfPages;
             }
         } else {
             // UMTS pdus are always at least 90 bytes since the payload includes
             // a number-of-pages octet and also one length octet per page
-            format = FORMAT_UMTS;
+            mFormat = FORMAT_UMTS;
 
             int messageType = pdu[0];
 
@@ -150,16 +150,16 @@
                 throw new IllegalArgumentException("Unsupported message type " + messageType);
             }
 
-            messageIdentifier = ((pdu[1] & 0xff) << 8) | pdu[2] & 0xff;
-            geographicalScope = (pdu[3] & 0xc0) >>> 6;
-            serialNumber = ((pdu[3] & 0xff) << 8) | (pdu[4] & 0xff);
-            dataCodingScheme = pdu[5] & 0xff;
+            mMessageIdentifier = ((pdu[1] & 0xff) << 8) | pdu[2] & 0xff;
+            mGeographicalScope = (pdu[3] & 0xc0) >>> 6;
+            mSerialNumber = ((pdu[3] & 0xff) << 8) | (pdu[4] & 0xff);
+            mDataCodingScheme = pdu[5] & 0xff;
 
             // We will always consider a UMTS message as having one single page
             // since there's only one instance of the header, even though the
             // actual payload may contain several pages.
-            pageIndex = 1;
-            nrOfPages = 1;
+            mPageIndex = 1;
+            mNrOfPages = 1;
         }
 
         if (isEtwsMessage()) {
@@ -183,27 +183,27 @@
     }
 
     int getGeographicalScope() {
-        return geographicalScope;
+        return mGeographicalScope;
     }
 
     int getSerialNumber() {
-        return serialNumber;
+        return mSerialNumber;
     }
 
     int getServiceCategory() {
-        return messageIdentifier;
+        return mMessageIdentifier;
     }
 
     int getDataCodingScheme() {
-        return dataCodingScheme;
+        return mDataCodingScheme;
     }
 
     int getPageIndex() {
-        return pageIndex;
+        return mPageIndex;
     }
 
     int getNumberOfPages() {
-        return nrOfPages;
+        return mNrOfPages;
     }
 
     SmsCbEtwsInfo getEtwsInfo() {
@@ -219,8 +219,8 @@
      * @return true if this message is emergency type; false otherwise
      */
     boolean isEmergencyMessage() {
-        return messageIdentifier >= SmsCbConstants.MESSAGE_ID_PWS_FIRST_IDENTIFIER
-                && messageIdentifier <= SmsCbConstants.MESSAGE_ID_PWS_LAST_IDENTIFIER;
+        return mMessageIdentifier >= SmsCbConstants.MESSAGE_ID_PWS_FIRST_IDENTIFIER
+                && mMessageIdentifier <= SmsCbConstants.MESSAGE_ID_PWS_LAST_IDENTIFIER;
     }
 
     /**
@@ -228,7 +228,7 @@
      * @return true if this message is ETWS emergency type; false otherwise
      */
     private boolean isEtwsMessage() {
-        return (messageIdentifier & SmsCbConstants.MESSAGE_ID_ETWS_TYPE_MASK)
+        return (mMessageIdentifier & SmsCbConstants.MESSAGE_ID_ETWS_TYPE_MASK)
                 == SmsCbConstants.MESSAGE_ID_ETWS_TYPE;
     }
 
@@ -237,7 +237,7 @@
      * @return true if this message is an ETWS primary notification; false otherwise
      */
     boolean isEtwsPrimaryNotification() {
-        return format == FORMAT_ETWS_PRIMARY;
+        return mFormat == FORMAT_ETWS_PRIMARY;
     }
 
     /**
@@ -245,7 +245,7 @@
      * @return true if this message is in UMTS format; false otherwise
      */
     boolean isUmtsFormat() {
-        return format == FORMAT_UMTS;
+        return mFormat == FORMAT_UMTS;
     }
 
     /**
@@ -253,8 +253,8 @@
      * @return true if this message is CMAS emergency type; false otherwise
      */
     private boolean isCmasMessage() {
-        return messageIdentifier >= SmsCbConstants.MESSAGE_ID_CMAS_FIRST_IDENTIFIER
-                && messageIdentifier <= SmsCbConstants.MESSAGE_ID_CMAS_LAST_IDENTIFIER;
+        return mMessageIdentifier >= SmsCbConstants.MESSAGE_ID_CMAS_FIRST_IDENTIFIER
+                && mMessageIdentifier <= SmsCbConstants.MESSAGE_ID_CMAS_LAST_IDENTIFIER;
     }
 
     /**
@@ -264,7 +264,7 @@
      * @return true if the message code indicates a popup alert should be displayed
      */
     private boolean isEtwsPopupAlert() {
-        return (serialNumber & SmsCbConstants.SERIAL_NUMBER_ETWS_ACTIVATE_POPUP) != 0;
+        return (mSerialNumber & SmsCbConstants.SERIAL_NUMBER_ETWS_ACTIVATE_POPUP) != 0;
     }
 
     /**
@@ -274,7 +274,7 @@
      * @return true if the message code indicates an emergency user alert
      */
     private boolean isEtwsEmergencyUserAlert() {
-        return (serialNumber & SmsCbConstants.SERIAL_NUMBER_ETWS_EMERGENCY_USER_ALERT) != 0;
+        return (mSerialNumber & SmsCbConstants.SERIAL_NUMBER_ETWS_EMERGENCY_USER_ALERT) != 0;
     }
 
     /**
@@ -284,7 +284,7 @@
      * @return the ETWS warning type defined in 3GPP TS 23.041 section 9.3.24
      */
     private int getEtwsWarningType() {
-        return messageIdentifier - SmsCbConstants.MESSAGE_ID_ETWS_EARTHQUAKE_WARNING;
+        return mMessageIdentifier - SmsCbConstants.MESSAGE_ID_ETWS_EARTHQUAKE_WARNING;
     }
 
     /**
@@ -293,7 +293,7 @@
      * @return the CMAS message class as defined in {@link SmsCbCmasInfo}
      */
     private int getCmasMessageClass() {
-        switch (messageIdentifier) {
+        switch (mMessageIdentifier) {
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL:
                 return SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT;
 
@@ -333,7 +333,7 @@
      * @return the CMAS severity as defined in {@link SmsCbCmasInfo}
      */
     private int getCmasSeverity() {
-        switch (messageIdentifier) {
+        switch (mMessageIdentifier) {
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED:
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY:
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED:
@@ -358,7 +358,7 @@
      * @return the CMAS urgency as defined in {@link SmsCbCmasInfo}
      */
     private int getCmasUrgency() {
-        switch (messageIdentifier) {
+        switch (mMessageIdentifier) {
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED:
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY:
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED:
@@ -383,7 +383,7 @@
      * @return the CMAS certainty as defined in {@link SmsCbCmasInfo}
      */
     private int getCmasCertainty() {
-        switch (messageIdentifier) {
+        switch (mMessageIdentifier) {
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED:
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED:
             case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED:
@@ -403,10 +403,10 @@
 
     @Override
     public String toString() {
-        return "SmsCbHeader{GS=" + geographicalScope + ", serialNumber=0x" +
-                Integer.toHexString(serialNumber) +
-                ", messageIdentifier=0x" + Integer.toHexString(messageIdentifier) +
-                ", DCS=0x" + Integer.toHexString(dataCodingScheme) +
-                ", page " + pageIndex + " of " + nrOfPages + '}';
+        return "SmsCbHeader{GS=" + mGeographicalScope + ", serialNumber=0x" +
+                Integer.toHexString(mSerialNumber) +
+                ", messageIdentifier=0x" + Integer.toHexString(mMessageIdentifier) +
+                ", DCS=0x" + Integer.toHexString(mDataCodingScheme) +
+                ", page " + mPageIndex + " of " + mNrOfPages + '}';
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/SmsMessage.java b/src/java/com/android/internal/telephony/gsm/SmsMessage.java
index 0bf1ea1..a383d18 100644
--- a/src/java/com/android/internal/telephony/gsm/SmsMessage.java
+++ b/src/java/com/android/internal/telephony/gsm/SmsMessage.java
@@ -46,7 +46,8 @@
  *
  */
 public class SmsMessage extends SmsMessageBase {
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "SmsMessage";
+    private static final boolean VDBG = false;
 
     private MessageClass messageClass;
 
@@ -54,44 +55,34 @@
      * TP-Message-Type-Indicator
      * 9.2.3
      */
-    private int mti;
+    private int mMti;
 
     /** TP-Protocol-Identifier (TP-PID) */
-    private int protocolIdentifier;
+    private int mProtocolIdentifier;
 
     // TP-Data-Coding-Scheme
     // see TS 23.038
-    private int dataCodingScheme;
+    private int mDataCodingScheme;
 
     // TP-Reply-Path
     // e.g. 23.040 9.2.2.1
-    private boolean replyPathPresent = false;
-
-    // "Message Marked for Automatic Deletion Group"
-    // 23.038 Section 4
-    private boolean automaticDeletion;
-
-    /** True if Status Report is for SMS-SUBMIT; false for SMS-COMMAND. */
-    private boolean forSubmit;
+    private boolean mReplyPathPresent = false;
 
     /** The address of the receiver. */
-    private GsmSmsAddress recipientAddress;
-
-    /** Time when SMS-SUBMIT was delivered from SC to MSE. */
-    private long dischargeTimeMillis;
+    private GsmSmsAddress mRecipientAddress;
 
     /**
      *  TP-Status - status of a previously submitted SMS.
      *  This field applies to SMS-STATUS-REPORT messages.  0 indicates success;
      *  see TS 23.040, 9.2.3.15 for description of other possible values.
      */
-    private int status;
+    private int mStatus;
 
     /**
      *  TP-Status - status of a previously submitted SMS.
      *  This field is true iff the message is a SMS-STATUS-REPORT message.
      */
-    private boolean isStatusReportMessage = false;
+    private boolean mIsStatusReportMessage = false;
 
     public static class SubmitPdu extends SubmitPduBase {
     }
@@ -115,7 +106,7 @@
      * by TP_PID field set to value 0x40
      */
     public boolean isTypeZero() {
-        return (protocolIdentifier == 0x40);
+        return (mProtocolIdentifier == 0x40);
     }
 
     /**
@@ -164,7 +155,7 @@
         try {
             SmsMessage msg = new SmsMessage();
 
-            msg.indexOnIcc = index;
+            msg.mIndexOnIcc = index;
 
             // First byte is status: RECEIVED_READ, RECEIVED_UNREAD, STORED_SENT,
             // or STORED_UNSENT
@@ -174,7 +165,7 @@
                         "SMS parsing failed: Trying to parse a free record");
                 return null;
             } else {
-                msg.statusOnIcc = data[0] & 0x07;
+                msg.mStatusOnIcc = data[0] & 0x07;
             }
 
             int size = data.length - 1;
@@ -344,7 +335,7 @@
     /**
      * Packs header and UCS-2 encoded message. Includes TP-UDL & TP-UDHL if necessary
      *
-     * @return
+     * @return encoded message as UCS2
      * @throws UnsupportedEncodingException
      */
     private static byte[] encodeUCS2(String message, byte[] header)
@@ -472,7 +463,7 @@
         if (statusReportRequested) {
             // Set TP-Status-Report-Request bit.
             mtiByte |= 0x20;
-            if (false) Rlog.d(LOG_TAG, "SMS status report requested");
+            if (VDBG) Rlog.d(LOG_TAG, "SMS status report requested");
         }
         bo.write(mtiByte);
 
@@ -497,16 +488,15 @@
     }
 
     private static class PduParser {
-        byte pdu[];
-        int cur;
-        SmsHeader userDataHeader;
-        byte[] userData;
+        byte mPdu[];
+        int mCur;
+        SmsHeader mUserDataHeader;
+        byte[] mUserData;
         int mUserDataSeptetPadding;
-        int mUserDataSize;
 
         PduParser(byte[] pdu) {
-            this.pdu = pdu;
-            cur = 0;
+            mPdu = pdu;
+            mCur = 0;
             mUserDataSeptetPadding = 0;
         }
 
@@ -528,14 +518,14 @@
                 // SC address
                 try {
                     ret = PhoneNumberUtils
-                            .calledPartyBCDToString(pdu, cur, len);
+                            .calledPartyBCDToString(mPdu, mCur, len);
                 } catch (RuntimeException tr) {
                     Rlog.d(LOG_TAG, "invalid SC address: ", tr);
                     ret = null;
                 }
             }
 
-            cur += len;
+            mCur += len;
 
             return ret;
         }
@@ -544,7 +534,7 @@
          * returns non-sign-extended byte value
          */
         int getByte() {
-            return pdu[cur++] & 0xff;
+            return mPdu[mCur++] & 0xff;
         }
 
         /**
@@ -558,17 +548,17 @@
             // the number field, i.e. excludes any semi-octet containing only
             // fill bits."
             // The TOA field is not included as part of this
-            int addressLength = pdu[cur] & 0xff;
+            int addressLength = mPdu[mCur] & 0xff;
             int lengthBytes = 2 + (addressLength + 1) / 2;
 
             try {
-                ret = new GsmSmsAddress(pdu, cur, lengthBytes);
+                ret = new GsmSmsAddress(mPdu, mCur, lengthBytes);
             } catch (ParseException e) {
                 Rlog.e(LOG_TAG, e.getMessage());
                 ret = null;
             }
 
-            cur += lengthBytes;
+            mCur += lengthBytes;
 
             return ret;
         }
@@ -580,19 +570,19 @@
 
         long getSCTimestampMillis() {
             // TP-Service-Centre-Time-Stamp
-            int year = IccUtils.gsmBcdByteToInt(pdu[cur++]);
-            int month = IccUtils.gsmBcdByteToInt(pdu[cur++]);
-            int day = IccUtils.gsmBcdByteToInt(pdu[cur++]);
-            int hour = IccUtils.gsmBcdByteToInt(pdu[cur++]);
-            int minute = IccUtils.gsmBcdByteToInt(pdu[cur++]);
-            int second = IccUtils.gsmBcdByteToInt(pdu[cur++]);
+            int year = IccUtils.gsmBcdByteToInt(mPdu[mCur++]);
+            int month = IccUtils.gsmBcdByteToInt(mPdu[mCur++]);
+            int day = IccUtils.gsmBcdByteToInt(mPdu[mCur++]);
+            int hour = IccUtils.gsmBcdByteToInt(mPdu[mCur++]);
+            int minute = IccUtils.gsmBcdByteToInt(mPdu[mCur++]);
+            int second = IccUtils.gsmBcdByteToInt(mPdu[mCur++]);
 
             // For the timezone, the most significant bit of the
             // least significant nibble is the sign byte
             // (meaning the max range of this field is 79 quarter-hours,
             // which is more than enough)
 
-            byte tzByte = pdu[cur++];
+            byte tzByte = mPdu[mCur++];
 
             // Mask out sign bit.
             int timezoneOffset = IccUtils.gsmBcdByteToInt((byte) (tzByte & (~0x08)));
@@ -623,17 +613,17 @@
          * @return the number of septets or octets in the user data payload
          */
         int constructUserData(boolean hasUserDataHeader, boolean dataInSeptets) {
-            int offset = cur;
-            int userDataLength = pdu[offset++] & 0xff;
+            int offset = mCur;
+            int userDataLength = mPdu[offset++] & 0xff;
             int headerSeptets = 0;
             int userDataHeaderLength = 0;
 
             if (hasUserDataHeader) {
-                userDataHeaderLength = pdu[offset++] & 0xff;
+                userDataHeaderLength = mPdu[offset++] & 0xff;
 
                 byte[] udh = new byte[userDataHeaderLength];
-                System.arraycopy(pdu, offset, udh, 0, userDataHeaderLength);
-                userDataHeader = SmsHeader.fromByteArray(udh);
+                System.arraycopy(mPdu, offset, udh, 0, userDataHeaderLength);
+                mUserDataHeader = SmsHeader.fromByteArray(udh);
                 offset += userDataHeaderLength;
 
                 int headerBits = (userDataHeaderLength + 1) * 8;
@@ -649,7 +639,7 @@
                  * the pdu minus the user data header, since userDataLength means
                  * the number of uncompressed septets.
                  */
-                bufferLen = pdu.length - offset;
+                bufferLen = mPdu.length - offset;
             } else {
                 /*
                  * userDataLength is the count of octets, so just subtract the
@@ -661,9 +651,9 @@
                 }
             }
 
-            userData = new byte[bufferLen];
-            System.arraycopy(pdu, offset, userData, 0, userData.length);
-            cur = offset;
+            mUserData = new byte[bufferLen];
+            System.arraycopy(mPdu, offset, mUserData, 0, mUserData.length);
+            mCur = offset;
 
             if (dataInSeptets) {
                 // Return the number of septets
@@ -672,7 +662,7 @@
                 return count < 0 ? 0 : count;
             } else {
                 // Return the number of octets
-                return userData.length;
+                return mUserData.length;
             }
         }
 
@@ -682,18 +672,7 @@
          * @return the user data payload, not including the headers
          */
         byte[] getUserData() {
-            return userData;
-        }
-
-        /**
-         * Returns the number of padding bits at the beginning of the user data
-         * array before the start of the septets.
-         *
-         * @return the number of padding bits at the beginning of the user data
-         * array before the start of the septets
-         */
-        int getUserDataSeptetPadding() {
-            return mUserDataSeptetPadding;
+            return mUserData;
         }
 
         /**
@@ -702,7 +681,7 @@
          * {@hide}
          */
         SmsHeader getUserDataHeader() {
-            return userDataHeader;
+            return mUserDataHeader;
         }
 
         /**
@@ -716,10 +695,10 @@
                 int languageShiftTable) {
             String ret;
 
-            ret = GsmAlphabet.gsm7BitPackedToString(pdu, cur, septetCount,
+            ret = GsmAlphabet.gsm7BitPackedToString(mPdu, mCur, septetCount,
                     mUserDataSeptetPadding, languageTable, languageShiftTable);
 
-            cur += (septetCount * 7) / 8;
+            mCur += (septetCount * 7) / 8;
 
             return ret;
         }
@@ -735,13 +714,13 @@
             String ret;
 
             try {
-                ret = new String(pdu, cur, byteCount, "utf-16");
+                ret = new String(mPdu, mCur, byteCount, "utf-16");
             } catch (UnsupportedEncodingException ex) {
                 ret = "";
                 Rlog.e(LOG_TAG, "implausible UnsupportedEncodingException", ex);
             }
 
-            cur += byteCount;
+            mCur += byteCount;
             return ret;
         }
 
@@ -756,18 +735,18 @@
             String ret;
 
             try {
-                ret = new String(pdu, cur, byteCount, "KSC5601");
+                ret = new String(mPdu, mCur, byteCount, "KSC5601");
             } catch (UnsupportedEncodingException ex) {
                 ret = "";
                 Rlog.e(LOG_TAG, "implausible UnsupportedEncodingException", ex);
             }
 
-            cur += byteCount;
+            mCur += byteCount;
             return ret;
         }
 
         boolean moreDataPresent() {
-            return (pdu.length > cur);
+            return (mPdu.length > mCur);
         }
     }
 
@@ -802,7 +781,7 @@
     /** {@inheritDoc} */
     @Override
     public int getProtocolIdentifier() {
-        return protocolIdentifier;
+        return mProtocolIdentifier;
     }
 
     /**
@@ -810,50 +789,50 @@
      * @return the TP-DCS field of the SMS header
      */
     int getDataCodingScheme() {
-        return dataCodingScheme;
+        return mDataCodingScheme;
     }
 
     /** {@inheritDoc} */
     @Override
     public boolean isReplace() {
-        return (protocolIdentifier & 0xc0) == 0x40
-                && (protocolIdentifier & 0x3f) > 0
-                && (protocolIdentifier & 0x3f) < 8;
+        return (mProtocolIdentifier & 0xc0) == 0x40
+                && (mProtocolIdentifier & 0x3f) > 0
+                && (mProtocolIdentifier & 0x3f) < 8;
     }
 
     /** {@inheritDoc} */
     @Override
     public boolean isCphsMwiMessage() {
-        return ((GsmSmsAddress) originatingAddress).isCphsVoiceMessageClear()
-                || ((GsmSmsAddress) originatingAddress).isCphsVoiceMessageSet();
+        return ((GsmSmsAddress) mOriginatingAddress).isCphsVoiceMessageClear()
+                || ((GsmSmsAddress) mOriginatingAddress).isCphsVoiceMessageSet();
     }
 
     /** {@inheritDoc} */
     @Override
     public boolean isMWIClearMessage() {
-        if (isMwi && !mwiSense) {
+        if (mIsMwi && !mMwiSense) {
             return true;
         }
 
-        return originatingAddress != null
-                && ((GsmSmsAddress) originatingAddress).isCphsVoiceMessageClear();
+        return mOriginatingAddress != null
+                && ((GsmSmsAddress) mOriginatingAddress).isCphsVoiceMessageClear();
     }
 
     /** {@inheritDoc} */
     @Override
     public boolean isMWISetMessage() {
-        if (isMwi && mwiSense) {
+        if (mIsMwi && mMwiSense) {
             return true;
         }
 
-        return originatingAddress != null
-                && ((GsmSmsAddress) originatingAddress).isCphsVoiceMessageSet();
+        return mOriginatingAddress != null
+                && ((GsmSmsAddress) mOriginatingAddress).isCphsVoiceMessageSet();
     }
 
     /** {@inheritDoc} */
     @Override
     public boolean isMwiDontStore() {
-        if (isMwi && mwiDontStore) {
+        if (mIsMwi && mMwiDontStore) {
             return true;
         }
 
@@ -872,19 +851,19 @@
     /** {@inheritDoc} */
     @Override
     public int getStatus() {
-        return status;
+        return mStatus;
     }
 
     /** {@inheritDoc} */
     @Override
     public boolean isStatusReportMessage() {
-        return isStatusReportMessage;
+        return mIsStatusReportMessage;
     }
 
     /** {@inheritDoc} */
     @Override
     public boolean isReplyPathPresent() {
-        return replyPathPresent;
+        return mReplyPathPresent;
     }
 
     /**
@@ -902,10 +881,10 @@
 
         PduParser p = new PduParser(pdu);
 
-        scAddress = p.getSCAddress();
+        mScAddress = p.getSCAddress();
 
-        if (scAddress != null) {
-            if (false) Rlog.d(LOG_TAG, "SMS SC address: " + scAddress);
+        if (mScAddress != null) {
+            if (VDBG) Rlog.d(LOG_TAG, "SMS SC address: " + mScAddress);
         }
 
         // TODO(mkf) support reply path, user data header indicator
@@ -914,8 +893,8 @@
         // 9.2.3
         int firstByte = p.getByte();
 
-        mti = firstByte & 0x3;
-        switch (mti) {
+        mMti = firstByte & 0x3;
+        switch (mMti) {
         // TP-Message-Type-Indicator
         // 9.2.3
         case 0:
@@ -942,20 +921,17 @@
      * @param firstByte The first byte of the PDU, which contains MTI, etc.
      */
     private void parseSmsStatusReport(PduParser p, int firstByte) {
-        isStatusReportMessage = true;
+        mIsStatusReportMessage = true;
 
-        // TP-Status-Report-Qualifier bit == 0 for SUBMIT
-        forSubmit = (firstByte & 0x20) == 0x00;
         // TP-Message-Reference
-        messageRef = p.getByte();
+        mMessageRef = p.getByte();
         // TP-Recipient-Address
-        recipientAddress = p.getAddress();
+        mRecipientAddress = p.getAddress();
         // TP-Service-Centre-Time-Stamp
-        scTimeMillis = p.getSCTimestampMillis();
-        // TP-Discharge-Time
-        dischargeTimeMillis = p.getSCTimestampMillis();
+        mScTimeMillis = p.getSCTimestampMillis();
+        p.getSCTimestampMillis();
         // TP-Status
-        status = p.getByte();
+        mStatus = p.getByte();
 
         // The following are optional fields that may or may not be present.
         if (p.moreDataPresent()) {
@@ -973,11 +949,11 @@
             if ((extraParams & 0x78) == 0) {
                 // TP-Protocol-Identifier
                 if ((extraParams & 0x01) != 0) {
-                    protocolIdentifier = p.getByte();
+                    mProtocolIdentifier = p.getByte();
                 }
                 // TP-Data-Coding-Scheme
                 if ((extraParams & 0x02) != 0) {
-                    dataCodingScheme = p.getByte();
+                    mDataCodingScheme = p.getByte();
                 }
                 // TP-User-Data-Length (implies existence of TP-User-Data)
                 if ((extraParams & 0x04) != 0) {
@@ -989,31 +965,31 @@
     }
 
     private void parseSmsDeliver(PduParser p, int firstByte) {
-        replyPathPresent = (firstByte & 0x80) == 0x80;
+        mReplyPathPresent = (firstByte & 0x80) == 0x80;
 
-        originatingAddress = p.getAddress();
+        mOriginatingAddress = p.getAddress();
 
-        if (originatingAddress != null) {
-            if (false) Rlog.v(LOG_TAG, "SMS originating address: "
-                    + originatingAddress.address);
+        if (mOriginatingAddress != null) {
+            if (VDBG) Rlog.v(LOG_TAG, "SMS originating address: "
+                    + mOriginatingAddress.address);
         }
 
         // TP-Protocol-Identifier (TP-PID)
         // TS 23.040 9.2.3.9
-        protocolIdentifier = p.getByte();
+        mProtocolIdentifier = p.getByte();
 
         // TP-Data-Coding-Scheme
         // see TS 23.038
-        dataCodingScheme = p.getByte();
+        mDataCodingScheme = p.getByte();
 
-        if (false) {
-            Rlog.v(LOG_TAG, "SMS TP-PID:" + protocolIdentifier
-                    + " data coding scheme: " + dataCodingScheme);
+        if (VDBG) {
+            Rlog.v(LOG_TAG, "SMS TP-PID:" + mProtocolIdentifier
+                    + " data coding scheme: " + mDataCodingScheme);
         }
 
-        scTimeMillis = p.getSCTimestampMillis();
+        mScTimeMillis = p.getSCTimestampMillis();
 
-        if (false) Rlog.d(LOG_TAG, "SMS SC timestamp: " + scTimeMillis);
+        if (VDBG) Rlog.d(LOG_TAG, "SMS SC timestamp: " + mScTimeMillis);
 
         boolean hasUserDataHeader = (firstByte & 0x40) == 0x40;
 
@@ -1027,29 +1003,28 @@
      * @param firstByte The first byte of the PDU, which contains MTI, etc.
      */
     private void parseSmsSubmit(PduParser p, int firstByte) {
-        replyPathPresent = (firstByte & 0x80) == 0x80;
+        mReplyPathPresent = (firstByte & 0x80) == 0x80;
 
         // TP-MR (TP-Message Reference)
-        messageRef = p.getByte();
+        mMessageRef = p.getByte();
 
-        recipientAddress = p.getAddress();
+        mRecipientAddress = p.getAddress();
 
-        if (recipientAddress != null) {
-            if (false) Rlog.v(LOG_TAG, "SMS recipient address: "
-                    + recipientAddress.address);
+        if (mRecipientAddress != null) {
+            if (VDBG) Rlog.v(LOG_TAG, "SMS recipient address: " + mRecipientAddress.address);
         }
 
         // TP-Protocol-Identifier (TP-PID)
         // TS 23.040 9.2.3.9
-        protocolIdentifier = p.getByte();
+        mProtocolIdentifier = p.getByte();
 
         // TP-Data-Coding-Scheme
         // see TS 23.038
-        dataCodingScheme = p.getByte();
+        mDataCodingScheme = p.getByte();
 
-        if (false) {
-            Rlog.v(LOG_TAG, "SMS TP-PID:" + protocolIdentifier
-                    + " data coding scheme: " + dataCodingScheme);
+        if (VDBG) {
+            Rlog.v(LOG_TAG, "SMS TP-PID:" + mProtocolIdentifier
+                    + " data coding scheme: " + mDataCodingScheme);
         }
 
         // TP-Validity-Period-Format
@@ -1093,17 +1068,15 @@
         int encodingType = ENCODING_UNKNOWN;
 
         // Look up the data encoding scheme
-        if ((dataCodingScheme & 0x80) == 0) {
-            // Bits 7..4 == 0xxx
-            automaticDeletion = (0 != (dataCodingScheme & 0x40));
-            userDataCompressed = (0 != (dataCodingScheme & 0x20));
-            hasMessageClass = (0 != (dataCodingScheme & 0x10));
+        if ((mDataCodingScheme & 0x80) == 0) {
+            userDataCompressed = (0 != (mDataCodingScheme & 0x20));
+            hasMessageClass = (0 != (mDataCodingScheme & 0x10));
 
             if (userDataCompressed) {
                 Rlog.w(LOG_TAG, "4 - Unsupported SMS data coding scheme "
-                        + "(compression) " + (dataCodingScheme & 0xff));
+                        + "(compression) " + (mDataCodingScheme & 0xff));
             } else {
-                switch ((dataCodingScheme >> 2) & 0x3) {
+                switch ((mDataCodingScheme >> 2) & 0x3) {
                 case 0: // GSM 7 bit default alphabet
                     encodingType = ENCODING_7BIT;
                     break;
@@ -1115,105 +1088,104 @@
                 case 1: // 8 bit data
                 case 3: // reserved
                     Rlog.w(LOG_TAG, "1 - Unsupported SMS data coding scheme "
-                            + (dataCodingScheme & 0xff));
+                            + (mDataCodingScheme & 0xff));
                     encodingType = ENCODING_8BIT;
                     break;
                 }
             }
-        } else if ((dataCodingScheme & 0xf0) == 0xf0) {
-            automaticDeletion = false;
+        } else if ((mDataCodingScheme & 0xf0) == 0xf0) {
             hasMessageClass = true;
             userDataCompressed = false;
 
-            if (0 == (dataCodingScheme & 0x04)) {
+            if (0 == (mDataCodingScheme & 0x04)) {
                 // GSM 7 bit default alphabet
                 encodingType = ENCODING_7BIT;
             } else {
                 // 8 bit data
                 encodingType = ENCODING_8BIT;
             }
-        } else if ((dataCodingScheme & 0xF0) == 0xC0
-                || (dataCodingScheme & 0xF0) == 0xD0
-                || (dataCodingScheme & 0xF0) == 0xE0) {
+        } else if ((mDataCodingScheme & 0xF0) == 0xC0
+                || (mDataCodingScheme & 0xF0) == 0xD0
+                || (mDataCodingScheme & 0xF0) == 0xE0) {
             // 3GPP TS 23.038 V7.0.0 (2006-03) section 4
 
             // 0xC0 == 7 bit, don't store
             // 0xD0 == 7 bit, store
             // 0xE0 == UCS-2, store
 
-            if ((dataCodingScheme & 0xF0) == 0xE0) {
+            if ((mDataCodingScheme & 0xF0) == 0xE0) {
                 encodingType = ENCODING_16BIT;
             } else {
                 encodingType = ENCODING_7BIT;
             }
 
             userDataCompressed = false;
-            boolean active = ((dataCodingScheme & 0x08) == 0x08);
+            boolean active = ((mDataCodingScheme & 0x08) == 0x08);
 
             // bit 0x04 reserved
 
-            if ((dataCodingScheme & 0x03) == 0x00) {
-                isMwi = true;
-                mwiSense = active;
-                mwiDontStore = ((dataCodingScheme & 0xF0) == 0xC0);
+            if ((mDataCodingScheme & 0x03) == 0x00) {
+                mIsMwi = true;
+                mMwiSense = active;
+                mMwiDontStore = ((mDataCodingScheme & 0xF0) == 0xC0);
             } else {
-                isMwi = false;
+                mIsMwi = false;
 
                 Rlog.w(LOG_TAG, "MWI for fax, email, or other "
-                        + (dataCodingScheme & 0xff));
+                        + (mDataCodingScheme & 0xff));
             }
-        } else if ((dataCodingScheme & 0xC0) == 0x80) {
+        } else if ((mDataCodingScheme & 0xC0) == 0x80) {
             // 3GPP TS 23.038 V7.0.0 (2006-03) section 4
             // 0x80..0xBF == Reserved coding groups
-            if (dataCodingScheme == 0x84) {
+            if (mDataCodingScheme == 0x84) {
                 // This value used for KSC5601 by carriers in Korea.
                 encodingType = ENCODING_KSC5601;
             } else {
                 Rlog.w(LOG_TAG, "5 - Unsupported SMS data coding scheme "
-                        + (dataCodingScheme & 0xff));
+                        + (mDataCodingScheme & 0xff));
             }
         } else {
             Rlog.w(LOG_TAG, "3 - Unsupported SMS data coding scheme "
-                    + (dataCodingScheme & 0xff));
+                    + (mDataCodingScheme & 0xff));
         }
 
         // set both the user data and the user data header.
         int count = p.constructUserData(hasUserDataHeader,
                 encodingType == ENCODING_7BIT);
-        this.userData = p.getUserData();
-        this.userDataHeader = p.getUserDataHeader();
+        this.mUserData = p.getUserData();
+        this.mUserDataHeader = p.getUserDataHeader();
 
         switch (encodingType) {
         case ENCODING_UNKNOWN:
         case ENCODING_8BIT:
-            messageBody = null;
+            mMessageBody = null;
             break;
 
         case ENCODING_7BIT:
-            messageBody = p.getUserDataGSM7Bit(count,
-                    hasUserDataHeader ? userDataHeader.languageTable : 0,
-                    hasUserDataHeader ? userDataHeader.languageShiftTable : 0);
+            mMessageBody = p.getUserDataGSM7Bit(count,
+                    hasUserDataHeader ? mUserDataHeader.languageTable : 0,
+                    hasUserDataHeader ? mUserDataHeader.languageShiftTable : 0);
             break;
 
         case ENCODING_16BIT:
-            messageBody = p.getUserDataUCS2(count);
+            mMessageBody = p.getUserDataUCS2(count);
             break;
 
         case ENCODING_KSC5601:
-            messageBody = p.getUserDataKSC5601(count);
+            mMessageBody = p.getUserDataKSC5601(count);
             break;
         }
 
-        if (false) Rlog.v(LOG_TAG, "SMS message body (raw): '" + messageBody + "'");
+        if (VDBG) Rlog.v(LOG_TAG, "SMS message body (raw): '" + mMessageBody + "'");
 
-        if (messageBody != null) {
+        if (mMessageBody != null) {
             parseMessageBody();
         }
 
         if (!hasMessageClass) {
             messageClass = MessageClass.UNKNOWN;
         } else {
-            switch (dataCodingScheme & 0x3) {
+            switch (mDataCodingScheme & 0x3) {
             case 0:
                 messageClass = MessageClass.CLASS_0;
                 break;
@@ -1246,6 +1218,6 @@
      */
     boolean isUsimDataDownload() {
         return messageClass == MessageClass.CLASS_2 &&
-                (protocolIdentifier == 0x7f || protocolIdentifier == 0x7c);
+                (mProtocolIdentifier == 0x7f || mProtocolIdentifier == 0x7c);
     }
 }
diff --git a/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java b/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java
index e68655e..a52dce0 100644
--- a/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java
+++ b/src/java/com/android/internal/telephony/gsm/SuppServiceNotification.java
@@ -57,6 +57,7 @@
     static public final int MT_CODE_DEFLECTED_CALL              = 9;
     static public final int MT_CODE_ADDITIONAL_CALL_FORWARDED   = 10;
 
+    @Override
     public String toString()
     {
         return super.toString() + " mobile"
diff --git a/src/java/com/android/internal/telephony/gsm/UsimDataDownloadHandler.java b/src/java/com/android/internal/telephony/gsm/UsimDataDownloadHandler.java
index 108cf5d..f0296c1 100644
--- a/src/java/com/android/internal/telephony/gsm/UsimDataDownloadHandler.java
+++ b/src/java/com/android/internal/telephony/gsm/UsimDataDownloadHandler.java
@@ -50,10 +50,10 @@
     /** Response to SMS-PP download envelope command. */
     private static final int EVENT_SEND_ENVELOPE_RESPONSE = 2;
 
-    private final CommandsInterface mCI;
+    private final CommandsInterface mCi;
 
     public UsimDataDownloadHandler(CommandsInterface commandsInterface) {
-        mCI = commandsInterface;
+        mCi = commandsInterface;
     }
 
     /**
@@ -128,7 +128,7 @@
         }
 
         String encodedEnvelope = IccUtils.bytesToHexString(envelope);
-        mCI.sendEnvelopeWithStatus(encodedEnvelope, obtainMessage(
+        mCi.sendEnvelopeWithStatus(encodedEnvelope, obtainMessage(
                 EVENT_SEND_ENVELOPE_RESPONSE, new int[]{ dcs, pid }));
     }
 
@@ -181,7 +181,7 @@
         byte[] responseBytes = response.payload;
         if (responseBytes == null || responseBytes.length == 0) {
             if (success) {
-                mCI.acknowledgeLastIncomingGsmSms(true, 0, null);
+                mCi.acknowledgeLastIncomingGsmSms(true, 0, null);
             } else {
                 acknowledgeSmsWithError(
                         CommandsInterface.GSM_SMS_FAIL_CAUSE_USIM_DATA_DOWNLOAD_ERROR);
@@ -215,12 +215,12 @@
 
         System.arraycopy(responseBytes, 0, smsAckPdu, index, responseBytes.length);
 
-        mCI.acknowledgeIncomingGsmSmsWithPdu(success,
+        mCi.acknowledgeIncomingGsmSmsWithPdu(success,
                 IccUtils.bytesToHexString(smsAckPdu), null);
     }
 
     private void acknowledgeSmsWithError(int cause) {
-        mCI.acknowledgeLastIncomingGsmSms(false, cause, null);
+        mCi.acknowledgeLastIncomingGsmSms(false, cause, null);
     }
 
     /**
diff --git a/src/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java b/src/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
index f46b461..9a975e7 100755
--- a/src/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
+++ b/src/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
@@ -21,7 +21,6 @@
 import android.os.Message;
 import android.telephony.Rlog;
 
-import com.android.internal.telephony.PhoneBase;
 import com.android.internal.telephony.uicc.AdnRecord;
 import com.android.internal.telephony.uicc.AdnRecordCache;
 import com.android.internal.telephony.uicc.IccConstants;
@@ -39,7 +38,7 @@
  * {@hide}
  */
 public class UsimPhoneBookManager extends Handler implements IccConstants {
-    private static final String LOG_TAG = "GSM";
+    private static final String LOG_TAG = "UsimPhoneBookManager";
     private static final boolean DBG = true;
     private PbrFile mPbrFile;
     private Boolean mIsPbrPresent;
diff --git a/src/java/com/android/internal/telephony/sip/SipCallBase.java b/src/java/com/android/internal/telephony/sip/SipCallBase.java
index 9050a43..d3b3102 100644
--- a/src/java/com/android/internal/telephony/sip/SipCallBase.java
+++ b/src/java/com/android/internal/telephony/sip/SipCallBase.java
@@ -17,39 +17,36 @@
 package com.android.internal.telephony.sip;
 
 import com.android.internal.telephony.Call;
-import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.Connection;
-import com.android.internal.telephony.Phone;
-
-import android.net.sip.SipManager;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
 abstract class SipCallBase extends Call {
-    protected List<Connection> connections = new ArrayList<Connection>();
 
     protected abstract void setState(State newState);
 
+    @Override
     public List<Connection> getConnections() {
         // FIXME should return Collections.unmodifiableList();
-        return connections;
+        return mConnections;
     }
 
+    @Override
     public boolean isMultiparty() {
-        return connections.size() > 1;
+        return mConnections.size() > 1;
     }
 
+    @Override
     public String toString() {
-        return state.toString() + ":" + super.toString();
+        return mState.toString() + ":" + super.toString();
     }
 
     void clearDisconnected() {
-        for (Iterator<Connection> it = connections.iterator(); it.hasNext(); ) {
+        for (Iterator<Connection> it = mConnections.iterator(); it.hasNext(); ) {
             Connection c = it.next();
             if (c.getState() == State.DISCONNECTED) it.remove();
         }
 
-        if (connections.isEmpty()) setState(State.IDLE);
+        if (mConnections.isEmpty()) setState(State.IDLE);
     }
 }
diff --git a/src/java/com/android/internal/telephony/sip/SipCommandInterface.java b/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
index 33a61f5..adc1378 100644
--- a/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
+++ b/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
@@ -38,226 +38,295 @@
     @Override public void setOnNITZTime(Handler h, int what, Object obj) {
     }
 
+    @Override
     public void getIccCardStatus(Message result) {
     }
 
+    @Override
     public void supplyIccPin(String pin, Message result) {
     }
 
+    @Override
     public void supplyIccPuk(String puk, String newPin, Message result) {
     }
 
+    @Override
     public void supplyIccPin2(String pin, Message result) {
     }
 
+    @Override
     public void supplyIccPuk2(String puk, String newPin2, Message result) {
     }
 
+    @Override
     public void changeIccPin(String oldPin, String newPin, Message result) {
     }
 
+    @Override
     public void changeIccPin2(String oldPin2, String newPin2, Message result) {
     }
 
+    @Override
     public void changeBarringPassword(String facility, String oldPwd,
             String newPwd, Message result) {
     }
 
+    @Override
     public void supplyNetworkDepersonalization(String netpin, Message result) {
     }
 
+    @Override
     public void getCurrentCalls(Message result) {
     }
 
+    @Override
     @Deprecated public void getPDPContextList(Message result) {
     }
 
+    @Override
     public void getDataCallList(Message result) {
     }
 
+    @Override
     public void dial(String address, int clirMode, Message result) {
     }
 
+    @Override
     public void dial(String address, int clirMode, UUSInfo uusInfo,
             Message result) {
     }
 
+    @Override
     public void getIMSI(Message result) {
     }
 
+    @Override
     public void getIMSIForApp(String aid, Message result) {
     }
 
+    @Override
     public void getIMEI(Message result) {
     }
 
+    @Override
     public void getIMEISV(Message result) {
     }
 
 
+    @Override
     public void hangupConnection (int gsmIndex, Message result) {
     }
 
+    @Override
     public void hangupWaitingOrBackground (Message result) {
     }
 
+    @Override
     public void hangupForegroundResumeBackground (Message result) {
     }
 
+    @Override
     public void switchWaitingOrHoldingAndActive (Message result) {
     }
 
+    @Override
     public void conference (Message result) {
     }
 
 
+    @Override
     public void setPreferredVoicePrivacy(boolean enable, Message result) {
     }
 
+    @Override
     public void getPreferredVoicePrivacy(Message result) {
     }
 
+    @Override
     public void separateConnection (int gsmIndex, Message result) {
     }
 
+    @Override
     public void acceptCall (Message result) {
     }
 
+    @Override
     public void rejectCall (Message result) {
     }
 
+    @Override
     public void explicitCallTransfer (Message result) {
     }
 
+    @Override
     public void getLastCallFailCause (Message result) {
     }
 
-    /** @deprecated */
+    @Deprecated
+    @Override
     public void getLastPdpFailCause (Message result) {
     }
 
+    @Override
     public void getLastDataCallFailCause (Message result) {
     }
 
+    @Override
     public void setMute (boolean enableMute, Message response) {
     }
 
+    @Override
     public void getMute (Message response) {
     }
 
+    @Override
     public void getSignalStrength (Message result) {
     }
 
+    @Override
     public void getVoiceRegistrationState (Message result) {
     }
 
+    @Override
     public void getDataRegistrationState (Message result) {
     }
 
+    @Override
     public void getOperator(Message result) {
     }
 
+    @Override
     public void sendDtmf(char c, Message result) {
     }
 
+    @Override
     public void startDtmf(char c, Message result) {
     }
 
+    @Override
     public void stopDtmf(Message result) {
     }
 
+    @Override
     public void sendBurstDtmf(String dtmfString, int on, int off,
             Message result) {
     }
 
+    @Override
     public void sendSMS (String smscPDU, String pdu, Message result) {
     }
 
+    @Override
     public void sendCdmaSms(byte[] pdu, Message result) {
     }
 
+    @Override
     public void deleteSmsOnSim(int index, Message response) {
     }
 
+    @Override
     public void deleteSmsOnRuim(int index, Message response) {
     }
 
+    @Override
     public void writeSmsToSim(int status, String smsc, String pdu, Message response) {
     }
 
+    @Override
     public void writeSmsToRuim(int status, String pdu, Message response) {
     }
 
+    @Override
     public void setupDataCall(String radioTechnology, String profile,
             String apn, String user, String password, String authType,
             String protocol, Message result) {
     }
 
+    @Override
     public void deactivateDataCall(int cid, int reason, Message result) {
     }
 
+    @Override
     public void setRadioPower(boolean on, Message result) {
     }
 
+    @Override
     public void setSuppServiceNotifications(boolean enable, Message result) {
     }
 
+    @Override
     public void acknowledgeLastIncomingGsmSms(boolean success, int cause,
             Message result) {
     }
 
+    @Override
     public void acknowledgeLastIncomingCdmaSms(boolean success, int cause,
             Message result) {
     }
 
+    @Override
     public void acknowledgeIncomingGsmSmsWithPdu(boolean success, String ackPdu,
             Message result) {
     }
 
+    @Override
     public void iccIO (int command, int fileid, String path, int p1, int p2,
             int p3, String data, String pin2, Message result) {
     }
+    @Override
     public void iccIOForApp (int command, int fileid, String path, int p1, int p2,
             int p3, String data, String pin2, String aid, Message result) {
     }
 
+    @Override
     public void getCLIR(Message result) {
     }
 
+    @Override
     public void setCLIR(int clirMode, Message result) {
     }
 
+    @Override
     public void queryCallWaiting(int serviceClass, Message response) {
     }
 
+    @Override
     public void setCallWaiting(boolean enable, int serviceClass,
             Message response) {
     }
 
+    @Override
     public void setNetworkSelectionModeAutomatic(Message response) {
     }
 
+    @Override
     public void setNetworkSelectionModeManual(
             String operatorNumeric, Message response) {
     }
 
+    @Override
     public void getNetworkSelectionMode(Message response) {
     }
 
+    @Override
     public void getAvailableNetworks(Message response) {
     }
 
+    @Override
     public void setCallForward(int action, int cfReason, int serviceClass,
                 String number, int timeSeconds, Message response) {
     }
 
+    @Override
     public void queryCallForwardStatus(int cfReason, int serviceClass,
             String number, Message response) {
     }
 
+    @Override
     public void queryCLIP(Message response) {
     }
 
+    @Override
     public void getBasebandVersion (Message response) {
     }
 
@@ -281,61 +350,80 @@
             String password, int serviceClass, String appId, Message response) {
     }
 
+    @Override
     public void sendUSSD (String ussdString, Message response) {
     }
 
+    @Override
     public void cancelPendingUssd (Message response) {
     }
 
+    @Override
     public void resetRadio(Message result) {
     }
 
+    @Override
     public void invokeOemRilRequestRaw(byte[] data, Message response) {
     }
 
+    @Override
     public void invokeOemRilRequestStrings(String[] strings, Message response) {
     }
 
+    @Override
     public void setBandMode (int bandMode, Message response) {
     }
 
+    @Override
     public void queryAvailableBandMode (Message response) {
     }
 
+    @Override
     public void sendTerminalResponse(String contents, Message response) {
     }
 
+    @Override
     public void sendEnvelope(String contents, Message response) {
     }
 
+    @Override
     public void sendEnvelopeWithStatus(String contents, Message response) {
     }
 
+    @Override
     public void handleCallSetupRequestFromSim(
             boolean accept, Message response) {
     }
 
+    @Override
     public void setPreferredNetworkType(int networkType , Message response) {
     }
 
+    @Override
     public void getPreferredNetworkType(Message response) {
     }
 
+    @Override
     public void getNeighboringCids(Message response) {
     }
 
+    @Override
     public void setLocationUpdates(boolean enable, Message response) {
     }
 
+    @Override
     public void getSmscAddress(Message result) {
     }
 
+    @Override
     public void setSmscAddress(String address, Message result) {
     }
 
+    @Override
     public void reportSmsMemoryStatus(boolean available, Message result) {
     }
 
+    @Override
     public void reportStkServiceIsRunning(Message result) {
     }
 
@@ -343,52 +431,68 @@
     public void getCdmaSubscriptionSource(Message response) {
     }
 
+    @Override
     public void getGsmBroadcastConfig(Message response) {
     }
 
+    @Override
     public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message response) {
     }
 
+    @Override
     public void setGsmBroadcastActivation(boolean activate, Message response) {
     }
 
     // ***** Methods for CDMA support
+    @Override
     public void getDeviceIdentity(Message response) {
     }
 
+    @Override
     public void getCDMASubscription(Message response) {
     }
 
+    @Override
     public void setPhoneType(int phoneType) { //Set by CDMAPhone and GSMPhone constructor
     }
 
+    @Override
     public void queryCdmaRoamingPreference(Message response) {
     }
 
+    @Override
     public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
     }
 
+    @Override
     public void setCdmaSubscriptionSource(int cdmaSubscription , Message response) {
     }
 
+    @Override
     public void queryTTYMode(Message response) {
     }
 
+    @Override
     public void setTTYMode(int ttyMode, Message response) {
     }
 
+    @Override
     public void sendCDMAFeatureCode(String FeatureCode, Message response) {
     }
 
+    @Override
     public void getCdmaBroadcastConfig(Message response) {
     }
 
+    @Override
     public void setCdmaBroadcastConfig(CdmaSmsBroadcastConfigInfo[] configs, Message response) {
     }
 
+    @Override
     public void setCdmaBroadcastActivation(boolean activate, Message response) {
     }
 
+    @Override
     public void exitEmergencyCallbackMode(Message response) {
     }
 
@@ -417,9 +521,11 @@
             Message response) {
     }
 
+    @Override
     public void requestIsimAuthentication(String nonce, Message response) {
     }
 
+    @Override
     public void getVoiceRadioTechnology(Message result) {
     }
 }
diff --git a/src/java/com/android/internal/telephony/sip/SipConnectionBase.java b/src/java/com/android/internal/telephony/sip/SipConnectionBase.java
index eca4a50..19d217f 100644
--- a/src/java/com/android/internal/telephony/sip/SipConnectionBase.java
+++ b/src/java/com/android/internal/telephony/sip/SipConnectionBase.java
@@ -22,161 +22,174 @@
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.UUSInfo;
 
-import android.net.sip.SipAudioCall;
 import android.os.SystemClock;
 import android.telephony.Rlog;
 import android.telephony.PhoneNumberUtils;
 
 abstract class SipConnectionBase extends Connection {
-    private static final String LOG_TAG = "SIP_CONN";
+    private static final String LOG_TAG = "SipConnBase";
+    private static final boolean DBG = true;
+    private static final boolean VDBG = true; // STOPSHIP if true
 
-    private SipAudioCall mSipAudioCall;
-
-    private String dialString;          // outgoing calls only
-    private String postDialString;      // outgoing calls only
-    private int nextPostDialChar;       // index into postDialString
-    private boolean isIncoming;
-
+    private String mPostDialString;      // outgoing calls only
+    private int mNextPostDialChar;       // index into postDialString
     /*
      * These time/timespan values are based on System.currentTimeMillis(),
      * i.e., "wall clock" time.
      */
-    private long createTime;
-    private long connectTime;
-    private long disconnectTime;
+    private long mCreateTime;
+    private long mConnectTime;
+    private long mDisconnectTime;
 
     /*
      * These time/timespan values are based on SystemClock.elapsedRealTime(),
      * i.e., time since boot.  They are appropriate for comparison and
      * calculating deltas.
      */
-    private long connectTimeReal;
-    private long duration = -1L;
-    private long holdingStartTime;  // The time when the Connection last transitioned
+    private long mConnectTimeReal;
+    private long mDuration = -1L;
+    private long mHoldingStartTime;  // The time when the Connection last transitioned
                             // into HOLDING
 
     private DisconnectCause mCause = DisconnectCause.NOT_DISCONNECTED;
-    private PostDialState postDialState = PostDialState.NOT_STARTED;
+    private PostDialState mPostDialState = PostDialState.NOT_STARTED;
 
     SipConnectionBase(String dialString) {
-        this.dialString = dialString;
+        if (DBG) log("SipConnectionBase: ctor dialString=" + dialString);
+        mPostDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
 
-        postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
-
-        isIncoming = false;
-        createTime = System.currentTimeMillis();
+        mCreateTime = System.currentTimeMillis();
     }
 
     protected void setState(Call.State state) {
+        if (DBG) log("setState: state=" + state);
         switch (state) {
             case ACTIVE:
-                if (connectTime == 0) {
-                    connectTimeReal = SystemClock.elapsedRealtime();
-                    connectTime = System.currentTimeMillis();
+                if (mConnectTime == 0) {
+                    mConnectTimeReal = SystemClock.elapsedRealtime();
+                    mConnectTime = System.currentTimeMillis();
                 }
                 break;
             case DISCONNECTED:
-                duration = getDurationMillis();
-                disconnectTime = System.currentTimeMillis();
+                mDuration = getDurationMillis();
+                mDisconnectTime = System.currentTimeMillis();
                 break;
             case HOLDING:
-                holdingStartTime = SystemClock.elapsedRealtime();
+                mHoldingStartTime = SystemClock.elapsedRealtime();
+                break;
+            default:
+                // Ignore
                 break;
         }
     }
 
     @Override
     public long getCreateTime() {
-        return createTime;
+        if (VDBG) log("getCreateTime: ret=" + mCreateTime);
+        return mCreateTime;
     }
 
     @Override
     public long getConnectTime() {
-        return connectTime;
+        if (VDBG) log("getConnectTime: ret=" + mConnectTime);
+        return mConnectTime;
     }
 
     @Override
     public long getDisconnectTime() {
-        return disconnectTime;
+        if (VDBG) log("getDisconnectTime: ret=" + mDisconnectTime);
+        return mDisconnectTime;
     }
 
     @Override
     public long getDurationMillis() {
-        if (connectTimeReal == 0) {
-            return 0;
-        } else if (duration < 0) {
-            return SystemClock.elapsedRealtime() - connectTimeReal;
+        long dur;
+        if (mConnectTimeReal == 0) {
+            dur = 0;
+        } else if (mDuration < 0) {
+            dur = SystemClock.elapsedRealtime() - mConnectTimeReal;
         } else {
-            return duration;
+            dur = mDuration;
         }
+        if (VDBG) log("getDurationMillis: ret=" + dur);
+        return dur;
     }
 
     @Override
     public long getHoldDurationMillis() {
+        long dur;
         if (getState() != Call.State.HOLDING) {
             // If not holding, return 0
-            return 0;
+            dur = 0;
         } else {
-            return SystemClock.elapsedRealtime() - holdingStartTime;
+            dur = SystemClock.elapsedRealtime() - mHoldingStartTime;
         }
+        if (VDBG) log("getHoldDurationMillis: ret=" + dur);
+        return dur;
     }
 
     @Override
     public DisconnectCause getDisconnectCause() {
+        if (VDBG) log("getDisconnectCause: ret=" + mCause);
         return mCause;
     }
 
     void setDisconnectCause(DisconnectCause cause) {
+        if (DBG) log("setDisconnectCause: prev=" + mCause + " new=" + cause);
         mCause = cause;
     }
 
     @Override
     public PostDialState getPostDialState() {
-        return postDialState;
+        if (VDBG) log("getPostDialState: ret=" + mPostDialState);
+        return mPostDialState;
     }
 
     @Override
     public void proceedAfterWaitChar() {
-        // TODO
+        if (DBG) log("proceedAfterWaitChar: ignore");
     }
 
     @Override
     public void proceedAfterWildChar(String str) {
-        // TODO
+        if (DBG) log("proceedAfterWildChar: ignore");
     }
 
     @Override
     public void cancelPostDial() {
-        // TODO
+        if (DBG) log("cancelPostDial: ignore");
     }
 
     protected abstract Phone getPhone();
 
     @Override
     public String getRemainingPostDialString() {
-        if (postDialState == PostDialState.CANCELLED
-            || postDialState == PostDialState.COMPLETE
-            || postDialString == null
-            || postDialString.length() <= nextPostDialChar) {
+        if (mPostDialState == PostDialState.CANCELLED
+            || mPostDialState == PostDialState.COMPLETE
+            || mPostDialString == null
+            || mPostDialString.length() <= mNextPostDialChar) {
+            if (DBG) log("getRemaingPostDialString: ret empty string");
             return "";
         }
 
-        return postDialString.substring(nextPostDialChar);
+        return mPostDialString.substring(mNextPostDialChar);
     }
 
     private void log(String msg) {
-        Rlog.d(LOG_TAG, "[SipConn] " + msg);
+        Rlog.d(LOG_TAG, msg);
     }
 
     @Override
     public int getNumberPresentation() {
         // TODO: add PRESENTATION_URL
+        if (VDBG) log("getNumberPresentation: ret=PRESENTATION_ALLOWED");
         return PhoneConstants.PRESENTATION_ALLOWED;
     }
 
     @Override
     public UUSInfo getUUSInfo() {
         // FIXME: what's this for SIP?
+        if (VDBG) log("getUUSInfo: ? ret=null");
         return null;
     }
 }
diff --git a/src/java/com/android/internal/telephony/sip/SipPhone.java b/src/java/com/android/internal/telephony/sip/SipPhone.java
index 24651df..764c7ef 100644
--- a/src/java/com/android/internal/telephony/sip/SipPhone.java
+++ b/src/java/com/android/internal/telephony/sip/SipPhone.java
@@ -48,15 +48,16 @@
  */
 public class SipPhone extends SipPhoneBase {
     private static final String LOG_TAG = "SipPhone";
-    private static final boolean DEBUG = true;
+    private static final boolean DBG = true;
+    private static final boolean VDBG = true; // STOPSHIP if true
     private static final int TIMEOUT_MAKE_CALL = 15; // in seconds
     private static final int TIMEOUT_ANSWER_CALL = 8; // in seconds
     private static final int TIMEOUT_HOLD_CALL = 15; // in seconds
 
     // A call that is ringing or (call) waiting
-    private SipCall ringingCall = new SipCall();
-    private SipCall foregroundCall = new SipCall();
-    private SipCall backgroundCall = new SipCall();
+    private SipCall mRingingCall = new SipCall();
+    private SipCall mForegroundCall = new SipCall();
+    private SipCall mBackgroundCall = new SipCall();
 
     private SipManager mSipManager;
     private SipProfile mProfile;
@@ -64,10 +65,10 @@
     SipPhone (Context context, PhoneNotifier notifier, SipProfile profile) {
         super(context, notifier);
 
-        if (DEBUG) Rlog.d(LOG_TAG, "new SipPhone: " + profile.getUriString());
-        ringingCall = new SipCall();
-        foregroundCall = new SipCall();
-        backgroundCall = new SipCall();
+        if (DBG) log("new SipPhone: " + profile.getUriString());
+        mRingingCall = new SipCall();
+        mForegroundCall = new SipCall();
+        mBackgroundCall = new SipCall();
         mProfile = profile;
         mSipManager = SipManager.newInstance(context);
     }
@@ -80,6 +81,7 @@
         return mProfile.getUriString().equals(that.mProfile.getUriString());
     }
 
+    @Override
     public String getPhoneName() {
         return "SIP:" + getUriString(mProfile);
     }
@@ -93,30 +95,43 @@
     }
 
     public boolean canTake(Object incomingCall) {
+        // FIXME: Is synchronizing on the class necessary, should we use a mLockObj?
+        // Also there are many things not synchronized, of course
+        // this may be true of CdmaPhone and GsmPhone too!!!
         synchronized (SipPhone.class) {
-            if (!(incomingCall instanceof SipAudioCall)) return false;
-            if (ringingCall.getState().isAlive()) return false;
+            if (!(incomingCall instanceof SipAudioCall)) {
+                if (DBG) log("canTake: ret=false, not a SipAudioCall");
+                return false;
+            }
+            if (mRingingCall.getState().isAlive()) {
+                if (DBG) log("canTake: ret=false, ringingCall not alive");
+                return false;
+            }
 
             // FIXME: is it true that we cannot take any incoming call if
             // both foreground and background are active
-            if (foregroundCall.getState().isAlive()
-                    && backgroundCall.getState().isAlive()) {
+            if (mForegroundCall.getState().isAlive()
+                    && mBackgroundCall.getState().isAlive()) {
+                if (DBG) {
+                    log("canTake: ret=false," +
+                            " foreground and background both alive");
+                }
                 return false;
             }
 
             try {
                 SipAudioCall sipAudioCall = (SipAudioCall) incomingCall;
-                if (DEBUG) Rlog.d(LOG_TAG, "+++ taking call from: "
+                if (DBG) log("canTake: taking call from: "
                         + sipAudioCall.getPeerProfile().getUriString());
                 String localUri = sipAudioCall.getLocalProfile().getUriString();
                 if (localUri.equals(mProfile.getUriString())) {
-                    boolean makeCallWait = foregroundCall.getState().isAlive();
-                    ringingCall.initIncomingCall(sipAudioCall, makeCallWait);
+                    boolean makeCallWait = mForegroundCall.getState().isAlive();
+                    mRingingCall.initIncomingCall(sipAudioCall, makeCallWait);
                     if (sipAudioCall.getState()
                             != SipSession.State.INCOMING_CALL) {
                         // Peer cancelled the call!
-                        if (DEBUG) Rlog.d(LOG_TAG, "    call cancelled !!");
-                        ringingCall.reset();
+                        if (DBG) log("    canTake: call cancelled !!");
+                        mRingingCall.reset();
                     }
                     return true;
                 }
@@ -124,37 +139,50 @@
                 // Peer may cancel the call at any time during the time we hook
                 // up ringingCall with sipAudioCall. Clean up ringingCall when
                 // that happens.
-                ringingCall.reset();
+                if (DBG) log("    canTake: exception e=" + e);
+                mRingingCall.reset();
             }
+            if (DBG) log("canTake: NOT taking !!");
             return false;
         }
     }
 
+    @Override
     public void acceptCall() throws CallStateException {
         synchronized (SipPhone.class) {
-            if ((ringingCall.getState() == Call.State.INCOMING) ||
-                    (ringingCall.getState() == Call.State.WAITING)) {
-                if (DEBUG) Rlog.d(LOG_TAG, "acceptCall");
+            if ((mRingingCall.getState() == Call.State.INCOMING) ||
+                    (mRingingCall.getState() == Call.State.WAITING)) {
+                if (DBG) log("acceptCall: accepting");
                 // Always unmute when answering a new call
-                ringingCall.setMute(false);
-                ringingCall.acceptCall();
+                mRingingCall.setMute(false);
+                mRingingCall.acceptCall();
             } else {
+                if (DBG) {
+                    log("acceptCall:" +
+                        " throw CallStateException(\"phone not ringing\")");
+                }
                 throw new CallStateException("phone not ringing");
             }
         }
     }
 
+    @Override
     public void rejectCall() throws CallStateException {
         synchronized (SipPhone.class) {
-            if (ringingCall.getState().isRinging()) {
-                if (DEBUG) Rlog.d(LOG_TAG, "rejectCall");
-                ringingCall.rejectCall();
+            if (mRingingCall.getState().isRinging()) {
+                if (DBG) log("rejectCall: rejecting");
+                mRingingCall.rejectCall();
             } else {
+                if (DBG) {
+                    log("rejectCall:" +
+                        " throw CallStateException(\"phone not ringing\")");
+                }
                 throw new CallStateException("phone not ringing");
             }
         }
     }
 
+    @Override
     public Connection dial(String dialString) throws CallStateException {
         synchronized (SipPhone.class) {
             return dialInternal(dialString);
@@ -163,51 +191,57 @@
 
     private Connection dialInternal(String dialString)
             throws CallStateException {
+        if (DBG) log("dialInternal: dialString=" + (VDBG ? dialString : "xxxxxx"));
         clearDisconnected();
 
         if (!canDial()) {
-            throw new CallStateException("cannot dial in current state");
+            throw new CallStateException("dialInternal: cannot dial in current state");
         }
-        if (foregroundCall.getState() == SipCall.State.ACTIVE) {
+        if (mForegroundCall.getState() == SipCall.State.ACTIVE) {
             switchHoldingAndActive();
         }
-        if (foregroundCall.getState() != SipCall.State.IDLE) {
+        if (mForegroundCall.getState() != SipCall.State.IDLE) {
             //we should have failed in !canDial() above before we get here
             throw new CallStateException("cannot dial in current state");
         }
 
-        foregroundCall.setMute(false);
+        mForegroundCall.setMute(false);
         try {
-            Connection c = foregroundCall.dial(dialString);
+            Connection c = mForegroundCall.dial(dialString);
             return c;
         } catch (SipException e) {
-            Rlog.e(LOG_TAG, "dial()", e);
+            loge("dialInternal: ", e);
             throw new CallStateException("dial error: " + e);
         }
     }
 
+    @Override
     public void switchHoldingAndActive() throws CallStateException {
-        if (DEBUG) Rlog.d(LOG_TAG, " ~~~~~~  switch fg and bg");
+        if (DBG) log("dialInternal: switch fg and bg");
         synchronized (SipPhone.class) {
-            foregroundCall.switchWith(backgroundCall);
-            if (backgroundCall.getState().isAlive()) backgroundCall.hold();
-            if (foregroundCall.getState().isAlive()) foregroundCall.unhold();
+            mForegroundCall.switchWith(mBackgroundCall);
+            if (mBackgroundCall.getState().isAlive()) mBackgroundCall.hold();
+            if (mForegroundCall.getState().isAlive()) mForegroundCall.unhold();
         }
     }
 
+    @Override
     public boolean canConference() {
+        if (DBG) log("canConference: ret=true");
         return true;
     }
 
+    @Override
     public void conference() throws CallStateException {
         synchronized (SipPhone.class) {
-            if ((foregroundCall.getState() != SipCall.State.ACTIVE)
-                    || (foregroundCall.getState() != SipCall.State.ACTIVE)) {
+            if ((mForegroundCall.getState() != SipCall.State.ACTIVE)
+                    || (mForegroundCall.getState() != SipCall.State.ACTIVE)) {
                 throw new CallStateException("wrong state to merge calls: fg="
-                        + foregroundCall.getState() + ", bg="
-                        + backgroundCall.getState());
+                        + mForegroundCall.getState() + ", bg="
+                        + mBackgroundCall.getState());
             }
-            foregroundCall.merge(backgroundCall);
+            if (DBG) log("conference: merge fg & bg");
+            mForegroundCall.merge(mBackgroundCall);
         }
     }
 
@@ -217,63 +251,69 @@
                 throw new CallStateException("expect " + SipCall.class
                         + ", cannot merge with " + that.getClass());
             }
-            foregroundCall.merge((SipCall) that);
+            mForegroundCall.merge((SipCall) that);
         }
     }
 
+    @Override
     public boolean canTransfer() {
         return false;
     }
 
-    public void explicitCallTransfer() throws CallStateException {
+    @Override
+    public void explicitCallTransfer() {
         //mCT.explicitCallTransfer();
     }
 
+    @Override
     public void clearDisconnected() {
         synchronized (SipPhone.class) {
-            ringingCall.clearDisconnected();
-            foregroundCall.clearDisconnected();
-            backgroundCall.clearDisconnected();
+            mRingingCall.clearDisconnected();
+            mForegroundCall.clearDisconnected();
+            mBackgroundCall.clearDisconnected();
 
             updatePhoneState();
             notifyPreciseCallStateChanged();
         }
     }
 
+    @Override
     public void sendDtmf(char c) {
         if (!PhoneNumberUtils.is12Key(c)) {
-            Rlog.e(LOG_TAG,
-                    "sendDtmf called with invalid character '" + c + "'");
-        } else if (foregroundCall.getState().isAlive()) {
+            loge("sendDtmf called with invalid character '" + c + "'");
+        } else if (mForegroundCall.getState().isAlive()) {
             synchronized (SipPhone.class) {
-                foregroundCall.sendDtmf(c);
+                mForegroundCall.sendDtmf(c);
             }
         }
     }
 
+    @Override
     public void startDtmf(char c) {
         if (!PhoneNumberUtils.is12Key(c)) {
-            Rlog.e(LOG_TAG,
-                "startDtmf called with invalid character '" + c + "'");
+            loge("startDtmf called with invalid character '" + c + "'");
         } else {
             sendDtmf(c);
         }
     }
 
+    @Override
     public void stopDtmf() {
         // no op
     }
 
     public void sendBurstDtmf(String dtmfString) {
-        Rlog.e(LOG_TAG, "[SipPhone] sendBurstDtmf() is a CDMA method");
+        loge("sendBurstDtmf() is a CDMA method");
     }
 
+    @Override
     public void getOutgoingCallerIdDisplay(Message onComplete) {
         // FIXME: what to reply?
         AsyncResult.forMessage(onComplete, null, null);
         onComplete.sendToTarget();
     }
 
+    @Override
     public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
                                            Message onComplete) {
         // FIXME: what's this for SIP?
@@ -281,15 +321,17 @@
         onComplete.sendToTarget();
     }
 
+    @Override
     public void getCallWaiting(Message onComplete) {
         // FIXME: what to reply?
         AsyncResult.forMessage(onComplete, null, null);
         onComplete.sendToTarget();
     }
 
+    @Override
     public void setCallWaiting(boolean enable, Message onComplete) {
         // FIXME: what to reply?
-        Rlog.e(LOG_TAG, "call waiting not supported");
+        loge("call waiting not supported");
     }
 
     @Override
@@ -300,34 +342,40 @@
         // to something like onSpeaerphoneStateChanged(). Echo suppression may
         // not be available on every device.
         synchronized (SipPhone.class) {
-            foregroundCall.setAudioGroupMode();
+            mForegroundCall.setAudioGroupMode();
         }
     }
 
+    @Override
     public void setMute(boolean muted) {
         synchronized (SipPhone.class) {
-            foregroundCall.setMute(muted);
+            mForegroundCall.setMute(muted);
         }
     }
 
+    @Override
     public boolean getMute() {
-        return (foregroundCall.getState().isAlive()
-                ? foregroundCall.getMute()
-                : backgroundCall.getMute());
+        return (mForegroundCall.getState().isAlive()
+                ? mForegroundCall.getMute()
+                : mBackgroundCall.getMute());
     }
 
+    @Override
     public Call getForegroundCall() {
-        return foregroundCall;
+        return mForegroundCall;
     }
 
+    @Override
     public Call getBackgroundCall() {
-        return backgroundCall;
+        return mBackgroundCall;
     }
 
+    @Override
     public Call getRingingCall() {
-        return ringingCall;
+        return mRingingCall;
     }
 
+    @Override
     public ServiceState getServiceState() {
         // FIXME: we may need to provide this when data connectivity is lost
         // or when server is down
@@ -349,13 +397,52 @@
         }
     }
 
+    private static Call.State getCallStateFrom(SipAudioCall sipAudioCall) {
+        if (sipAudioCall.isOnHold()) return Call.State.HOLDING;
+        int sessionState = sipAudioCall.getState();
+        switch (sessionState) {
+            case SipSession.State.READY_TO_CALL:            return Call.State.IDLE;
+            case SipSession.State.INCOMING_CALL:
+            case SipSession.State.INCOMING_CALL_ANSWERING:  return Call.State.INCOMING;
+            case SipSession.State.OUTGOING_CALL:            return Call.State.DIALING;
+            case SipSession.State.OUTGOING_CALL_RING_BACK:  return Call.State.ALERTING;
+            case SipSession.State.OUTGOING_CALL_CANCELING:  return Call.State.DISCONNECTING;
+            case SipSession.State.IN_CALL:                  return Call.State.ACTIVE;
+            default:
+                slog("illegal connection state: " + sessionState);
+                return Call.State.DISCONNECTED;
+        }
+    }
+
+    private void log(String s) {
+        Rlog.d(LOG_TAG, s);
+    }
+
+    private static void slog(String s) {
+        Rlog.d(LOG_TAG, s);
+    }
+
+    private void loge(String s) {
+        Rlog.e(LOG_TAG, s);
+    }
+
+    private void loge(String s, Exception e) {
+        Rlog.e(LOG_TAG, s, e);
+    }
+
     private class SipCall extends SipCallBase {
+        private static final String SC_TAG = "SipCall";
+        private static final boolean SC_DBG = true;
+        private static final boolean SC_VDBG = false; // STOPSHIP if true
+
         void reset() {
-            connections.clear();
+            if (SC_DBG) log("reset");
+            mConnections.clear();
             setState(Call.State.IDLE);
         }
 
         void switchWith(SipCall that) {
+            if (SC_DBG) log("switchWith");
             synchronized (SipPhone.class) {
                 SipCall tmp = new SipCall();
                 tmp.takeOver(this);
@@ -365,9 +452,10 @@
         }
 
         private void takeOver(SipCall that) {
-            connections = that.connections;
-            state = that.state;
-            for (Connection c : connections) {
+            if (SC_DBG) log("takeOver");
+            mConnections = that.mConnections;
+            mState = that.mState;
+            for (Connection c : mConnections) {
                 ((SipConnection) c).changeOwner(this);
             }
         }
@@ -379,13 +467,16 @@
 
         @Override
         public List<Connection> getConnections() {
+            if (SC_VDBG) log("getConnections");
             synchronized (SipPhone.class) {
                 // FIXME should return Collections.unmodifiableList();
-                return connections;
+                return mConnections;
             }
         }
 
         Connection dial(String originalNumber) throws SipException {
+            if (SC_DBG) log("dial: num=" + (SC_VDBG ? originalNumber : "xxx"));
+            // TODO: Should this be synchronized?
             String calleeSipUri = originalNumber;
             if (!calleeSipUri.contains("@")) {
                 String replaceStr = Pattern.quote(mProfile.getUserName() + "@");
@@ -398,7 +489,7 @@
                 SipConnection c = new SipConnection(this, callee,
                         originalNumber);
                 c.dial();
-                connections.add(c);
+                mConnections.add(c);
                 setState(Call.State.DIALING);
                 return c;
             } catch (ParseException e) {
@@ -409,12 +500,12 @@
         @Override
         public void hangup() throws CallStateException {
             synchronized (SipPhone.class) {
-                if (state.isAlive()) {
-                    if (DEBUG) Rlog.d(LOG_TAG, "hang up call: " + getState()
+                if (mState.isAlive()) {
+                    if (SC_DBG) log("hangup: call " + getState()
                             + ": " + this + " on phone " + getPhone());
                     setState(State.DISCONNECTING);
                     CallStateException excp = null;
-                    for (Connection c : connections) {
+                    for (Connection c : mConnections) {
                         try {
                             c.hangup();
                         } catch (CallStateException e) {
@@ -423,7 +514,7 @@
                     }
                     if (excp != null) throw excp;
                 } else {
-                    if (DEBUG) Rlog.d(LOG_TAG, "hang up dead call: " + getState()
+                    if (SC_DBG) log("hangup: dead call " + getState()
                             + ": " + this + " on phone " + getPhone());
                 }
             }
@@ -432,7 +523,7 @@
         void initIncomingCall(SipAudioCall sipAudioCall, boolean makeCallWait) {
             SipProfile callee = sipAudioCall.getPeerProfile();
             SipConnection c = new SipConnection(this, callee);
-            connections.add(c);
+            mConnections.add(c);
 
             Call.State newState = makeCallWait ? State.WAITING : State.INCOMING;
             c.initIncomingCall(sipAudioCall, newState);
@@ -442,29 +533,36 @@
         }
 
         void rejectCall() throws CallStateException {
+            if (SC_DBG) log("rejectCall:");
             hangup();
         }
 
         void acceptCall() throws CallStateException {
-            if (this != ringingCall) {
+            if (SC_DBG) log("acceptCall: accepting");
+            if (this != mRingingCall) {
                 throw new CallStateException("acceptCall() in a non-ringing call");
             }
-            if (connections.size() != 1) {
+            if (mConnections.size() != 1) {
                 throw new CallStateException("acceptCall() in a conf call");
             }
-            ((SipConnection) connections.get(0)).acceptCall();
+            ((SipConnection) mConnections.get(0)).acceptCall();
         }
 
         private boolean isSpeakerOn() {
-            return ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE))
+            Boolean ret = ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE))
                     .isSpeakerphoneOn();
+            if (SC_VDBG) log("isSpeakerOn: ret=" + ret);
+            return ret;
         }
 
         void setAudioGroupMode() {
             AudioGroup audioGroup = getAudioGroup();
-            if (audioGroup == null) return;
+            if (audioGroup == null) {
+                if (SC_DBG) log("setAudioGroupMode: audioGroup == null ignore");
+                return;
+            }
             int mode = audioGroup.getMode();
-            if (state == State.HOLDING) {
+            if (mState == State.HOLDING) {
                 audioGroup.setMode(AudioGroup.MODE_ON_HOLD);
             } else if (getMute()) {
                 audioGroup.setMode(AudioGroup.MODE_MUTED);
@@ -473,45 +571,51 @@
             } else {
                 audioGroup.setMode(AudioGroup.MODE_NORMAL);
             }
-            if (DEBUG) Rlog.d(LOG_TAG, String.format(
-                    "audioGroup mode change: %d --> %d", mode,
+            if (SC_DBG) log(String.format(
+                    "setAudioGroupMode change: %d --> %d", mode,
                     audioGroup.getMode()));
         }
 
         void hold() throws CallStateException {
+            if (SC_DBG) log("hold:");
             setState(State.HOLDING);
-            for (Connection c : connections) ((SipConnection) c).hold();
+            for (Connection c : mConnections) ((SipConnection) c).hold();
             setAudioGroupMode();
         }
 
         void unhold() throws CallStateException {
+            if (SC_DBG) log("unhold:");
             setState(State.ACTIVE);
             AudioGroup audioGroup = new AudioGroup();
-            for (Connection c : connections) {
+            for (Connection c : mConnections) {
                 ((SipConnection) c).unhold(audioGroup);
             }
             setAudioGroupMode();
         }
 
         void setMute(boolean muted) {
-            for (Connection c : connections) {
+            if (SC_DBG) log("setMute: muted=" + muted);
+            for (Connection c : mConnections) {
                 ((SipConnection) c).setMute(muted);
             }
         }
 
         boolean getMute() {
-            return connections.isEmpty()
+            boolean ret = mConnections.isEmpty()
                     ? false
-                    : ((SipConnection) connections.get(0)).getMute();
+                    : ((SipConnection) mConnections.get(0)).getMute();
+            if (SC_DBG) log("getMute: ret=" + ret);
+            return ret;
         }
 
         void merge(SipCall that) throws CallStateException {
+            if (SC_DBG) log("merge:");
             AudioGroup audioGroup = getAudioGroup();
 
             // copy to an array to avoid concurrent modification as connections
             // in that.connections will be removed in add(SipConnection).
-            Connection[] cc = that.connections.toArray(
-                    new Connection[that.connections.size()]);
+            Connection[] cc = that.mConnections.toArray(
+                    new Connection[that.mConnections.size()]);
             for (Connection c : cc) {
                 SipConnection conn = (SipConnection) c;
                 add(conn);
@@ -523,17 +627,22 @@
         }
 
         private void add(SipConnection conn) {
+            if (SC_DBG) log("add:");
             SipCall call = conn.getCall();
             if (call == this) return;
-            if (call != null) call.connections.remove(conn);
+            if (call != null) call.mConnections.remove(conn);
 
-            connections.add(conn);
+            mConnections.add(conn);
             conn.changeOwner(this);
         }
 
         void sendDtmf(char c) {
+            if (SC_DBG) log("sendDtmf: c=" + c);
             AudioGroup audioGroup = getAudioGroup();
-            if (audioGroup == null) return;
+            if (audioGroup == null) {
+                if (SC_DBG) log("sendDtmf: audioGroup == null, ignore c=" + c);
+                return;
+            }
             audioGroup.sendDtmf(convertDtmf(c));
         }
 
@@ -557,18 +666,18 @@
 
         @Override
         protected void setState(State newState) {
-            if (state != newState) {
-                if (DEBUG) Rlog.v(LOG_TAG, "+***+ call state changed: " + state
+            if (mState != newState) {
+                if (SC_DBG) log("setState: cur state" + mState
                         + " --> " + newState + ": " + this + ": on phone "
-                        + getPhone() + " " + connections.size());
+                        + getPhone() + " " + mConnections.size());
 
                 if (newState == Call.State.ALERTING) {
-                    state = newState; // need in ALERTING to enable ringback
-                    SipPhone.this.startRingbackTone();
-                } else if (state == Call.State.ALERTING) {
-                    SipPhone.this.stopRingbackTone();
+                    mState = newState; // need in ALERTING to enable ringback
+                    startRingbackTone();
+                } else if (mState == Call.State.ALERTING) {
+                    stopRingbackTone();
                 }
-                state = newState;
+                mState = newState;
                 updatePhoneState();
                 notifyPreciseCallStateChanged();
             }
@@ -576,19 +685,21 @@
 
         void onConnectionStateChanged(SipConnection conn) {
             // this can be called back when a conf call is formed
-            if (state != State.ACTIVE) {
+            if (SC_DBG) log("onConnectionStateChanged: conn=" + conn);
+            if (mState != State.ACTIVE) {
                 setState(conn.getState());
             }
         }
 
         void onConnectionEnded(SipConnection conn) {
             // set state to DISCONNECTED only when all conns are disconnected
-            if (state != State.DISCONNECTED) {
+            if (SC_DBG) log("onConnectionEnded: conn=" + conn);
+            if (mState != State.DISCONNECTED) {
                 boolean allConnectionsDisconnected = true;
-                if (DEBUG) Rlog.d(LOG_TAG, "---check connections: "
-                        + connections.size());
-                for (Connection c : connections) {
-                    if (DEBUG) Rlog.d(LOG_TAG, "   state=" + c.getState() + ": "
+                if (SC_DBG) log("---check connections: "
+                        + mConnections.size());
+                for (Connection c : mConnections) {
+                    if (SC_DBG) log("   state=" + c.getState() + ": "
                             + c);
                     if (c.getState() != State.DISCONNECTED) {
                         allConnectionsDisconnected = false;
@@ -601,18 +712,25 @@
         }
 
         private AudioGroup getAudioGroup() {
-            if (connections.isEmpty()) return null;
-            return ((SipConnection) connections.get(0)).getAudioGroup();
+            if (mConnections.isEmpty()) return null;
+            return ((SipConnection) mConnections.get(0)).getAudioGroup();
+        }
+
+        private void log(String s) {
+            Rlog.d(SC_TAG, s);
         }
     }
 
     private class SipConnection extends SipConnectionBase {
+        private static final String SCN_TAG = "SipConnection";
+        private static final boolean SCN_DBG = true;
+
         private SipCall mOwner;
         private SipAudioCall mSipAudioCall;
         private Call.State mState = Call.State.IDLE;
         private SipProfile mPeer;
-        private String mOriginalNumber; // may be a PSTN number
         private boolean mIncoming = false;
+        private String mOriginalNumber; // may be a PSTN number
 
         private SipAudioCallAdapter mAdapter = new SipAudioCallAdapter() {
             @Override
@@ -623,11 +741,12 @@
                 synchronized (SipPhone.class) {
                     setState(Call.State.DISCONNECTED);
                     SipAudioCall sipAudioCall = mSipAudioCall;
+                    // FIXME: This goes null and is synchronized, but many uses aren't sync'd
                     mSipAudioCall = null;
                     String sessionState = (sipAudioCall == null)
                             ? ""
                             : (sipAudioCall.getState() + ", ");
-                    if (DEBUG) Rlog.d(LOG_TAG, "--- connection ended: "
+                    if (SCN_DBG) log("[SipAudioCallAdapter] onCallEnded: "
                             + mPeer.getUriString() + ": " + sessionState
                             + "cause: " + getDisconnectCause() + ", on phone "
                             + getPhone());
@@ -642,12 +761,14 @@
             @Override
             public void onCallEstablished(SipAudioCall call) {
                 onChanged(call);
+                // Race onChanged synchronized this isn't
                 if (mState == Call.State.ACTIVE) call.startAudio();
             }
 
             @Override
             public void onCallHeld(SipAudioCall call) {
                 onChanged(call);
+                // Race onChanged synchronized this isn't
                 if (mState == Call.State.HOLDING) call.startAudio();
             }
 
@@ -659,8 +780,8 @@
                     if (newState == Call.State.INCOMING) {
                         setState(mOwner.getState()); // INCOMING or WAITING
                     } else {
-                        if (mOwner == ringingCall) {
-                            if (ringingCall.getState() == Call.State.WAITING) {
+                        if (mOwner == mRingingCall) {
+                            if (mRingingCall.getState() == Call.State.WAITING) {
                                 try {
                                     switchHoldingAndActive();
                                 } catch (CallStateException e) {
@@ -669,12 +790,12 @@
                                     return;
                                 }
                             }
-                            foregroundCall.switchWith(ringingCall);
+                            mForegroundCall.switchWith(mRingingCall);
                         }
                         setState(newState);
                     }
                     mOwner.onConnectionStateChanged(SipConnection.this);
-                    if (DEBUG) Rlog.v(LOG_TAG, "+***+ connection state changed: "
+                    if (SCN_DBG) log("onChanged: "
                             + mPeer.getUriString() + ": " + mState
                             + " on phone " + getPhone());
                 }
@@ -682,7 +803,7 @@
 
             @Override
             protected void onError(DisconnectCause cause) {
-                if (DEBUG) Rlog.d(LOG_TAG, "SIP error: " + cause);
+                if (SCN_DBG) log("onError: " + cause);
                 onCallEnded(cause);
             }
         };
@@ -763,6 +884,7 @@
 
         void setMute(boolean muted) {
             if ((mSipAudioCall != null) && (muted != mSipAudioCall.isMuted())) {
+                if (SCN_DBG) log("setState: prev muted=" + !muted + " new muted=" + muted);
                 mSipAudioCall.toggleMute();
             }
         }
@@ -810,7 +932,7 @@
         @Override
         public void hangup() throws CallStateException {
             synchronized (SipPhone.class) {
-                if (DEBUG) Rlog.d(LOG_TAG, "hangup conn: " + mPeer.getUriString()
+                if (SCN_DBG) log("hangup: conn=" + mPeer.getUriString()
                         + ": " + mState + ": on phone "
                         + getPhone().getPhoneName());
                 if (!mState.isAlive()) return;
@@ -835,14 +957,14 @@
         public void separate() throws CallStateException {
             synchronized (SipPhone.class) {
                 SipCall call = (getPhone() == SipPhone.this)
-                        ? (SipCall) SipPhone.this.getBackgroundCall()
-                        : (SipCall) SipPhone.this.getForegroundCall();
+                        ? (SipCall) getBackgroundCall()
+                        : (SipCall) getForegroundCall();
                 if (call.getState() != Call.State.IDLE) {
                     throw new CallStateException(
                             "cannot put conn back to a call in non-idle state: "
                             + call.getState());
                 }
-                if (DEBUG) Rlog.d(LOG_TAG, "separate conn: "
+                if (SCN_DBG) log("separate: conn="
                         + mPeer.getUriString() + " from " + mOwner + " back to "
                         + call);
 
@@ -857,37 +979,26 @@
                 originalPhone.switchHoldingAndActive();
 
                 // start audio and notify the phone app of the state change
-                call = (SipCall) SipPhone.this.getForegroundCall();
+                call = (SipCall) getForegroundCall();
                 mSipAudioCall.startAudio();
                 call.onConnectionStateChanged(this);
             }
         }
 
-    }
-
-    private static Call.State getCallStateFrom(SipAudioCall sipAudioCall) {
-        if (sipAudioCall.isOnHold()) return Call.State.HOLDING;
-        int sessionState = sipAudioCall.getState();
-        switch (sessionState) {
-            case SipSession.State.READY_TO_CALL:            return Call.State.IDLE;
-            case SipSession.State.INCOMING_CALL:
-            case SipSession.State.INCOMING_CALL_ANSWERING:  return Call.State.INCOMING;
-            case SipSession.State.OUTGOING_CALL:            return Call.State.DIALING;
-            case SipSession.State.OUTGOING_CALL_RING_BACK:  return Call.State.ALERTING;
-            case SipSession.State.OUTGOING_CALL_CANCELING:  return Call.State.DISCONNECTING;
-            case SipSession.State.IN_CALL:                  return Call.State.ACTIVE;
-            default:
-                Rlog.w(LOG_TAG, "illegal connection state: " + sessionState);
-                return Call.State.DISCONNECTED;
+        private void log(String s) {
+            Rlog.d(SCN_TAG, s);
         }
     }
 
     private abstract class SipAudioCallAdapter extends SipAudioCall.Listener {
+        private static final String SACA_TAG = "SipAudioCallAdapter";
+        private static final boolean SACA_DBG = true;
         protected abstract void onCallEnded(Connection.DisconnectCause cause);
         protected abstract void onError(Connection.DisconnectCause cause);
 
         @Override
         public void onCallEnded(SipAudioCall call) {
+            if (SACA_DBG) log("onCallEnded: call=" + call);
             onCallEnded(call.isInCall()
                     ? Connection.DisconnectCause.NORMAL
                     : Connection.DisconnectCause.INCOMING_MISSED);
@@ -895,12 +1006,17 @@
 
         @Override
         public void onCallBusy(SipAudioCall call) {
+            if (SACA_DBG) log("onCallBusy: call=" + call);
             onCallEnded(Connection.DisconnectCause.BUSY);
         }
 
         @Override
         public void onError(SipAudioCall call, int errorCode,
                 String errorMessage) {
+            if (SACA_DBG) {
+                log("onError: call=" + call + " code="+ SipErrorCode.toString(errorCode)
+                    + ": " + errorMessage);
+            }
             switch (errorCode) {
                 case SipErrorCode.SERVER_UNREACHABLE:
                     onError(Connection.DisconnectCause.SERVER_UNREACHABLE);
@@ -930,10 +1046,12 @@
                 case SipErrorCode.SOCKET_ERROR:
                 case SipErrorCode.CLIENT_ERROR:
                 default:
-                    Rlog.w(LOG_TAG, "error: " + SipErrorCode.toString(errorCode)
-                            + ": " + errorMessage);
                     onError(Connection.DisconnectCause.ERROR_UNSPECIFIED);
             }
         }
+
+        private void log(String s) {
+            Rlog.d(SACA_TAG, s);
+        }
     }
 }
diff --git a/src/java/com/android/internal/telephony/sip/SipPhoneBase.java b/src/java/com/android/internal/telephony/sip/SipPhoneBase.java
index 041ac79..49ca7c6 100755
--- a/src/java/com/android/internal/telephony/sip/SipPhoneBase.java
+++ b/src/java/com/android/internal/telephony/sip/SipPhoneBase.java
@@ -33,13 +33,12 @@
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.Connection;
-import com.android.internal.telephony.DataConnection;
+import com.android.internal.telephony.dataconnection.DataConnectionBase;
 import com.android.internal.telephony.IccCard;
 import com.android.internal.telephony.IccPhoneBookInterfaceManager;
 import com.android.internal.telephony.IccSmsInterfaceManager;
 import com.android.internal.telephony.MmiCode;
 import com.android.internal.telephony.OperatorInfo;
-import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneBase;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.PhoneNotifier;
@@ -52,21 +51,25 @@
 import java.util.List;
 
 abstract class SipPhoneBase extends PhoneBase {
-    private static final String LOG_TAG = "SipPhone";
+    private static final String LOG_TAG = "SipPhoneBase";
 
     private RegistrantList mRingbackRegistrants = new RegistrantList();
-    private PhoneConstants.State state = PhoneConstants.State.IDLE;
+    private PhoneConstants.State mState = PhoneConstants.State.IDLE;
 
     public SipPhoneBase(Context context, PhoneNotifier notifier) {
         super(notifier, context, new SipCommandInterface(context), false);
     }
 
+    @Override
     public abstract Call getForegroundCall();
 
+    @Override
     public abstract Call getBackgroundCall();
 
+    @Override
     public abstract Call getRingingCall();
 
+    @Override
     public Connection dial(String dialString, UUSInfo uusInfo)
             throws CallStateException {
         // ignore UUSInfo
@@ -113,6 +116,7 @@
         mRingbackRegistrants.notifyRegistrants(result);
     }
 
+    @Override
     public ServiceState getServiceState() {
         // FIXME: we may need to provide this when data connectivity is lost
         // or when server is down
@@ -129,58 +133,70 @@
         return getServiceStateTracker().getAllCellInfo();
     }
 
+    @Override
     public CellLocation getCellLocation() {
         return null;
     }
 
+    @Override
     public PhoneConstants.State getState() {
-        return state;
+        return mState;
     }
 
+    @Override
     public int getPhoneType() {
         return PhoneConstants.PHONE_TYPE_SIP;
     }
 
+    @Override
     public SignalStrength getSignalStrength() {
         return new SignalStrength();
     }
 
+    @Override
     public boolean getMessageWaitingIndicator() {
         return false;
     }
 
+    @Override
     public boolean getCallForwardingIndicator() {
         return false;
     }
 
+    @Override
     public List<? extends MmiCode> getPendingMmiCodes() {
         return new ArrayList<MmiCode>(0);
     }
 
+    @Override
     public PhoneConstants.DataState getDataConnectionState() {
         return PhoneConstants.DataState.DISCONNECTED;
     }
 
+    @Override
     public PhoneConstants.DataState getDataConnectionState(String apnType) {
         return PhoneConstants.DataState.DISCONNECTED;
     }
 
+    @Override
     public DataActivityState getDataActivityState() {
         return DataActivityState.NONE;
     }
 
     /**
-     * Notify any interested party of a Phone state change {@link Phone.State}
+     * Notify any interested party of a Phone state change
+     * {@link com.android.internal.telephony.PhoneConstants.State}
      */
-    void notifyPhoneStateChanged() {
+    /* package */ void notifyPhoneStateChanged() {
         mNotifier.notifyPhoneState(this);
     }
 
     /**
-     * Notify registrants of a change in the call state. This notifies changes in {@link Call.State}
-     * Use this when changes in the precise call state are needed, else use notifyPhoneStateChanged.
+     * Notify registrants of a change in the call state. This notifies changes in
+     * {@link com.android.internal.telephony.Call.State}. Use this when changes
+     * in the precise call state are needed, else use notifyPhoneStateChanged.
      */
-    void notifyPreciseCallStateChanged() {
+    /* package */ void notifyPreciseCallStateChanged() {
         /* we'd love it if this was package-scoped*/
         super.notifyPreciseCallStateChangedP();
     }
@@ -205,6 +221,7 @@
         super.notifyServiceStateChangedP(ss);
     }
 
+    @Override
     public void notifyCallForwardingIndicator() {
         mNotifier.notifyCallForwardingChanged(this);
     }
@@ -227,8 +244,8 @@
                     || !getBackgroundCall().getState().isAlive());
     }
 
-    public boolean handleInCallMmiCommands(String dialString)
-            throws CallStateException {
+    @Override
+    public boolean handleInCallMmiCommands(String dialString) {
         return false;
     }
 
@@ -241,75 +258,93 @@
             || ringingCallState.isAlive());
     }
 
+    @Override
     public boolean handlePinMmi(String dialString) {
         return false;
     }
 
+    @Override
     public void sendUssdResponse(String ussdMessge) {
     }
 
+    @Override
     public void registerForSuppServiceNotification(
             Handler h, int what, Object obj) {
     }
 
+    @Override
     public void unregisterForSuppServiceNotification(Handler h) {
     }
 
+    @Override
     public void setRadioPower(boolean power) {
     }
 
+    @Override
     public String getVoiceMailNumber() {
         return null;
     }
 
+    @Override
     public String getVoiceMailAlphaTag() {
         return null;
     }
 
+    @Override
     public String getDeviceId() {
         return null;
     }
 
+    @Override
     public String getDeviceSvn() {
         return null;
     }
 
+    @Override
     public String getImei() {
         return null;
     }
 
+    @Override
     public String getEsn() {
         Rlog.e(LOG_TAG, "[SipPhone] getEsn() is a CDMA method");
         return "0";
     }
 
+    @Override
     public String getMeid() {
         Rlog.e(LOG_TAG, "[SipPhone] getMeid() is a CDMA method");
         return "0";
     }
 
+    @Override
     public String getSubscriberId() {
         return null;
     }
 
+    @Override
     public String getIccSerialNumber() {
         return null;
     }
 
+    @Override
     public String getLine1Number() {
         return null;
     }
 
+    @Override
     public String getLine1AlphaTag() {
         return null;
     }
 
+    @Override
     public void setLine1Number(String alphaTag, String number, Message onComplete) {
         // FIXME: what to reply for SIP?
         AsyncResult.forMessage(onComplete, null, null);
         onComplete.sendToTarget();
     }
 
+    @Override
     public void setVoiceMailNumber(String alphaTag, String voiceMailNumber,
             Message onComplete) {
         // FIXME: what to reply for SIP?
@@ -317,20 +352,24 @@
         onComplete.sendToTarget();
     }
 
+    @Override
     public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) {
     }
 
+    @Override
     public void setCallForwardingOption(int commandInterfaceCFAction,
             int commandInterfaceCFReason, String dialingNumber,
             int timerSeconds, Message onComplete) {
     }
 
+    @Override
     public void getOutgoingCallerIdDisplay(Message onComplete) {
         // FIXME: what to reply?
         AsyncResult.forMessage(onComplete, null, null);
         onComplete.sendToTarget();
     }
 
+    @Override
     public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
                                            Message onComplete) {
         // FIXME: what's this for SIP?
@@ -338,60 +377,75 @@
         onComplete.sendToTarget();
     }
 
+    @Override
     public void getCallWaiting(Message onComplete) {
         AsyncResult.forMessage(onComplete, null, null);
         onComplete.sendToTarget();
     }
 
+    @Override
     public void setCallWaiting(boolean enable, Message onComplete) {
         Rlog.e(LOG_TAG, "call waiting not supported");
     }
 
+    @Override
     public boolean getIccRecordsLoaded() {
         return false;
     }
 
+    @Override
     public IccCard getIccCard() {
         return null;
     }
 
+    @Override
     public void getAvailableNetworks(Message response) {
     }
 
+    @Override
     public void setNetworkSelectionModeAutomatic(Message response) {
     }
 
+    @Override
     public void selectNetworkManually(
             OperatorInfo network,
             Message response) {
     }
 
+    @Override
     public void getNeighboringCids(Message response) {
     }
 
+    @Override
     public void setOnPostDialCharacter(Handler h, int what, Object obj) {
     }
 
+    @Override
     public void getDataCallList(Message response) {
     }
 
-    public List<DataConnection> getCurrentDataConnectionList () {
+    public List<DataConnectionBase> getCurrentDataConnectionList () {
         return null;
     }
 
+    @Override
     public void updateServiceLocation() {
     }
 
+    @Override
     public void enableLocationUpdates() {
     }
 
+    @Override
     public void disableLocationUpdates() {
     }
 
+    @Override
     public boolean getDataRoamingEnabled() {
         return false;
     }
 
+    @Override
     public void setDataRoamingEnabled(boolean enable) {
     }
 
@@ -403,6 +457,7 @@
         return false;
     }
 
+    @Override
     public boolean isDataConnectivityPossible() {
         return false;
     }
@@ -414,60 +469,69 @@
     public void saveClirSetting(int commandInterfaceCLIRMode) {
     }
 
+    @Override
     public PhoneSubInfo getPhoneSubInfo(){
         return null;
     }
 
+    @Override
     public IccSmsInterfaceManager getIccSmsInterfaceManager(){
         return null;
     }
 
+    @Override
     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(){
         return null;
     }
 
+    @Override
     public IccFileHandler getIccFileHandler(){
         return null;
     }
 
+    @Override
     public void activateCellBroadcastSms(int activate, Message response) {
         Rlog.e(LOG_TAG, "Error! This functionality is not implemented for SIP.");
     }
 
+    @Override
     public void getCellBroadcastSmsConfig(Message response) {
         Rlog.e(LOG_TAG, "Error! This functionality is not implemented for SIP.");
     }
 
+    @Override
     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response){
         Rlog.e(LOG_TAG, "Error! This functionality is not implemented for SIP.");
     }
 
     //@Override
+    @Override
     public boolean needsOtaServiceProvisioning() {
         // FIXME: what's this for SIP?
         return false;
     }
 
     //@Override
+    @Override
     public LinkProperties getLinkProperties(String apnType) {
         // FIXME: what's this for SIP?
         return null;
     }
 
     void updatePhoneState() {
-        PhoneConstants.State oldState = state;
+        PhoneConstants.State oldState = mState;
 
         if (getRingingCall().isRinging()) {
-            state = PhoneConstants.State.RINGING;
+            mState = PhoneConstants.State.RINGING;
         } else if (getForegroundCall().isIdle()
                 && getBackgroundCall().isIdle()) {
-            state = PhoneConstants.State.IDLE;
+            mState = PhoneConstants.State.IDLE;
         } else {
-            state = PhoneConstants.State.OFFHOOK;
+            mState = PhoneConstants.State.OFFHOOK;
         }
 
-        if (state != oldState) {
-            Rlog.d(LOG_TAG, " ^^^ new phone state: " + state);
+        if (mState != oldState) {
+            Rlog.d(LOG_TAG, " ^^^ new phone state: " + mState);
             notifyPhoneStateChanged();
         }
     }
diff --git a/src/java/com/android/internal/telephony/test/ModelInterpreter.java b/src/java/com/android/internal/telephony/test/ModelInterpreter.java
index 20aca89..7930b56 100644
--- a/src/java/com/android/internal/telephony/test/ModelInterpreter.java
+++ b/src/java/com/android/internal/telephony/test/ModelInterpreter.java
@@ -18,7 +18,6 @@
 
 import android.os.HandlerThread;
 import android.os.Looper;
-import android.os.Message;
 import android.telephony.Rlog;
 
 import java.io.IOException;
@@ -45,15 +44,15 @@
     static final int BUFFER_SIZE = 0x1000;
 
     // just to prevent constant allocations
-    byte buffer[] = new byte[BUFFER_SIZE];
+    byte mBuffer[] = new byte[BUFFER_SIZE];
 
     //***** Instance Variables
 
-    InputStream inStream;
+    InputStream mInStream;
 
     LineReader (InputStream s)
     {
-        inStream = s;
+        mInStream = s;
     }
 
     String
@@ -84,7 +83,7 @@
             for (;;) {
                 int result;
 
-                result = inStream.read();
+                result = mInStream.read();
 
                 if (result < 0) {
                     return null;
@@ -101,7 +100,7 @@
                     }
                 }
 
-                buffer[i++] = (byte)result;
+                mBuffer[i++] = (byte)result;
             }
         } catch (IOException ex) {
             return null;
@@ -110,7 +109,7 @@
         }
 
         try {
-            return new String(buffer, 0, i, "US-ASCII");
+            return new String(mBuffer, 0, i, "US-ASCII");
         } catch (UnsupportedEncodingException ex) {
             System.err.println("ATChannel: implausable UnsupportedEncodingException");
             return null;
@@ -125,10 +124,10 @@
     public
     InterpreterEx (String result)
     {
-        this.result = result;
+        mResult = result;
     }
 
-    String result;
+    String mResult;
 }
 
 public class ModelInterpreter
@@ -143,19 +142,19 @@
 
     //***** Instance Variables
 
-    InputStream in;
-    OutputStream out;
-    LineReader lineReader;
-    ServerSocket ss;
+    InputStream mIn;
+    OutputStream mOut;
+    LineReader mLineReader;
+    ServerSocket mSS;
 
-    private String finalResponse;
+    private String mFinalResponse;
 
-    SimulatedGsmCallState simulatedCallState;
+    SimulatedGsmCallState mSimulatedCallState;
 
     HandlerThread mHandlerThread;
 
-    int pausedResponseCount;
-    Object pausedResponseMonitor = new Object();
+    int mPausedResponseCount;
+    Object mPausedResponseMonitor = new Object();
 
     //***** Events
 
@@ -166,8 +165,8 @@
     public
     ModelInterpreter (InputStream in, OutputStream out)
     {
-        this.in = in;
-        this.out = out;
+        mIn = in;
+        mOut = out;
 
         init();
     }
@@ -175,10 +174,10 @@
     public
     ModelInterpreter (InetSocketAddress sa) throws java.io.IOException
     {
-        ss = new ServerSocket();
+        mSS = new ServerSocket();
 
-        ss.setReuseAddress(true);
-        ss.bind(sa);
+        mSS.setReuseAddress(true);
+        mSS.bind(sa);
 
         init();
     }
@@ -190,19 +189,20 @@
         mHandlerThread = new HandlerThread("ModelInterpreter");
         mHandlerThread.start();
         Looper looper = mHandlerThread.getLooper();
-        simulatedCallState = new SimulatedGsmCallState(looper);
+        mSimulatedCallState = new SimulatedGsmCallState(looper);
     }
 
     //***** Runnable Implementation
 
+    @Override
     public void run()
     {
         for (;;) {
-            if (ss != null) {
+            if (mSS != null) {
                 Socket s;
 
                 try {
-                    s = ss.accept();
+                    s = mSS.accept();
                 } catch (java.io.IOException ex) {
                     Rlog.w(LOG_TAG,
                         "IOException on socket.accept(); stopping", ex);
@@ -210,8 +210,8 @@
                 }
 
                 try {
-                    in = s.getInputStream();
-                    out = s.getOutputStream();
+                    mIn = s.getInputStream();
+                    mOut = s.getOutputStream();
                 } catch (java.io.IOException ex) {
                     Rlog.w(LOG_TAG,
                         "IOException on accepted socket(); re-listening", ex);
@@ -222,14 +222,14 @@
             }
 
 
-            lineReader = new LineReader (in);
+            mLineReader = new LineReader (mIn);
 
             println ("Welcome");
 
             for (;;) {
                 String line;
 
-                line = lineReader.getNextLine();
+                line = mLineReader.getNextLine();
 
                 //System.out.println("MI<< " + line);
 
@@ -237,10 +237,10 @@
                     break;
                 }
 
-                synchronized(pausedResponseMonitor) {
-                    while (pausedResponseCount > 0) {
+                synchronized(mPausedResponseMonitor) {
+                    while (mPausedResponseCount > 0) {
                         try {
-                            pausedResponseMonitor.wait();
+                            mPausedResponseMonitor.wait();
                         } catch (InterruptedException ex) {
                         }
                     }
@@ -248,11 +248,11 @@
 
                 synchronized (this) {
                     try {
-                        finalResponse = "OK";
+                        mFinalResponse = "OK";
                         processLine(line);
-                        println(finalResponse);
+                        println(mFinalResponse);
                     } catch (InterpreterEx ex) {
-                        println(ex.result);
+                        println(ex.mResult);
                     } catch (RuntimeException ex) {
                         ex.printStackTrace();
                         println("ERROR");
@@ -262,7 +262,7 @@
 
             Rlog.i(LOG_TAG, "Disconnected");
 
-            if (ss == null) {
+            if (mSS == null) {
                 // no reconnect in this case
                 break;
             }
@@ -273,13 +273,14 @@
     //***** Instance Methods
 
     /** Start the simulated phone ringing */
+    @Override
     public void
     triggerRing(String number)
     {
         synchronized (this) {
             boolean success;
 
-            success = simulatedCallState.triggerRing(number);
+            success = mSimulatedCallState.triggerRing(number);
 
             if (success) {
                 println ("RING");
@@ -288,35 +289,40 @@
     }
 
     /** If a call is DIALING or ALERTING, progress it to the next state */
+    @Override
     public void
     progressConnectingCallState()
     {
-        simulatedCallState.progressConnectingCallState();
+        mSimulatedCallState.progressConnectingCallState();
     }
 
 
     /** If a call is DIALING or ALERTING, progress it all the way to ACTIVE */
+    @Override
     public void
     progressConnectingToActive()
     {
-        simulatedCallState.progressConnectingToActive();
+        mSimulatedCallState.progressConnectingToActive();
     }
 
     /** automatically progress mobile originated calls to ACTIVE.
      *  default to true
      */
+    @Override
     public void
     setAutoProgressConnectingCall(boolean b)
     {
-        simulatedCallState.setAutoProgressConnectingCall(b);
+        mSimulatedCallState.setAutoProgressConnectingCall(b);
     }
 
+    @Override
     public void
     setNextDialFailImmediately(boolean b)
     {
-        simulatedCallState.setNextDialFailImmediately(b);
+        mSimulatedCallState.setNextDialFailImmediately(b);
     }
 
+    @Override
     public void setNextCallFailCause(int gsmCause)
     {
         //FIXME implement
@@ -324,12 +330,13 @@
 
 
     /** hangup ringing, dialing, or actuve calls */
+    @Override
     public void
     triggerHangupForeground()
     {
         boolean success;
 
-        success = simulatedCallState.triggerHangupForeground();
+        success = mSimulatedCallState.triggerHangupForeground();
 
         if (success) {
             println ("NO CARRIER");
@@ -337,12 +344,13 @@
     }
 
     /** hangup holding calls */
+    @Override
     public void
     triggerHangupBackground()
     {
         boolean success;
 
-        success = simulatedCallState.triggerHangupBackground();
+        success = mSimulatedCallState.triggerHangupBackground();
 
         if (success) {
             println ("NO CARRIER");
@@ -351,12 +359,13 @@
 
     /** hangup all */
 
+    @Override
     public void
     triggerHangupAll()
     {
         boolean success;
 
-        success = simulatedCallState.triggerHangupAll();
+        success = mSimulatedCallState.triggerHangupAll();
 
         if (success) {
             println ("NO CARRIER");
@@ -371,9 +380,12 @@
         }
     }
 
+    @Override
     public void triggerSsn(int a, int b) {}
+    @Override
     public void triggerIncomingUssd(String statusCode, String message) {}
 
+    @Override
     public void
     triggerIncomingSMS(String message)
     {
@@ -403,22 +415,24 @@
 **************/
     }
 
+    @Override
     public void
     pauseResponses()
     {
-        synchronized(pausedResponseMonitor) {
-            pausedResponseCount++;
+        synchronized(mPausedResponseMonitor) {
+            mPausedResponseCount++;
         }
     }
 
+    @Override
     public void
     resumeResponses()
     {
-        synchronized(pausedResponseMonitor) {
-            pausedResponseCount--;
+        synchronized(mPausedResponseMonitor) {
+            mPausedResponseCount--;
 
-            if (pausedResponseCount == 0) {
-                pausedResponseMonitor.notifyAll();
+            if (mPausedResponseCount == 0) {
+                mPausedResponseMonitor.notifyAll();
             }
         }
     }
@@ -430,7 +444,7 @@
     {
         boolean success;
 
-        success = simulatedCallState.onAnswer();
+        success = mSimulatedCallState.onAnswer();
 
         if (!success) {
             throw new InterpreterEx("ERROR");
@@ -442,13 +456,13 @@
     {
         boolean success = false;
 
-        success = simulatedCallState.onAnswer();
+        success = mSimulatedCallState.onAnswer();
 
         if (!success) {
             throw new InterpreterEx("ERROR");
         }
 
-        finalResponse = "NO CARRIER";
+        mFinalResponse = "NO CARRIER";
     }
 
     private void
@@ -465,67 +479,7 @@
             c1 = command.charAt(7);
         }
 
-        success = simulatedCallState.onChld(c0, c1);
-
-        if (!success) {
-            throw new InterpreterEx("ERROR");
-        }
-    }
-
-    private void
-    releaseHeldOrUDUB() throws InterpreterEx
-    {
-        boolean success;
-
-        success = simulatedCallState.releaseHeldOrUDUB();
-
-        if (!success) {
-            throw new InterpreterEx("ERROR");
-        }
-    }
-
-    private void
-    releaseActiveAcceptHeldOrWaiting() throws InterpreterEx
-    {
-        boolean success;
-
-        success = simulatedCallState.releaseActiveAcceptHeldOrWaiting();
-
-        if (!success) {
-            throw new InterpreterEx("ERROR");
-        }
-    }
-
-    private void
-    switchActiveAndHeldOrWaiting() throws InterpreterEx
-    {
-        boolean success;
-
-        success = simulatedCallState.switchActiveAndHeldOrWaiting();
-
-        if (!success) {
-            throw new InterpreterEx("ERROR");
-        }
-    }
-
-    private void
-    separateCall(int index) throws InterpreterEx
-    {
-        boolean success;
-
-        success = simulatedCallState.separateCall(index);
-
-        if (!success) {
-            throw new InterpreterEx("ERROR");
-        }
-    }
-
-    private void
-    conference() throws InterpreterEx
-    {
-        boolean success;
-
-        success = simulatedCallState.conference();
+        success = mSimulatedCallState.onChld(c0, c1);
 
         if (!success) {
             throw new InterpreterEx("ERROR");
@@ -537,7 +491,7 @@
     {
         boolean success;
 
-        success = simulatedCallState.onDial(command.substring(1));
+        success = mSimulatedCallState.onDial(command.substring(1));
 
         if (!success) {
             throw new InterpreterEx("ERROR");
@@ -545,11 +499,11 @@
     }
 
     private void
-    onCLCC() throws InterpreterEx
+    onCLCC()
     {
         List<String> lines;
 
-        lines = simulatedCallState.getClccLines();
+        lines = mSimulatedCallState.getClccLines();
 
         for (int i = 0, s = lines.size() ; i < s ; i++) {
             println (lines.get(i));
@@ -557,12 +511,12 @@
     }
 
     private void
-    onSMSSend(String command) throws InterpreterEx
+    onSMSSend(String command)
     {
         String pdu;
 
         print ("> ");
-        pdu = lineReader.getNextLineCtrlZ();
+        pdu = mLineReader.getNextLineCtrlZ();
 
         println("+CMGS: 1");
     }
@@ -655,8 +609,8 @@
 
                 //System.out.println("MI>> " + s);
 
-                out.write(bytes);
-                out.write('\r');
+                mOut.write(bytes);
+                mOut.write('\r');
             } catch (IOException ex) {
                 ex.printStackTrace();
             }
@@ -672,7 +626,7 @@
 
                 //System.out.println("MI>> " + s + " (no <cr>)");
 
-                out.write(bytes);
+                mOut.write(bytes);
             } catch (IOException ex) {
                 ex.printStackTrace();
             }
@@ -680,6 +634,7 @@
     }
 
 
+    @Override
     public void
     shutdown()
     {
@@ -689,11 +644,11 @@
         }
 
         try {
-            in.close();
+            mIn.close();
         } catch (IOException ex) {
         }
         try {
-            out.close();
+            mOut.close();
         } catch (IOException ex) {
         }
     }
diff --git a/src/java/com/android/internal/telephony/test/SimulatedCommands.java b/src/java/com/android/internal/telephony/test/SimulatedCommands.java
index 5125a40..883e11c 100644
--- a/src/java/com/android/internal/telephony/test/SimulatedCommands.java
+++ b/src/java/com/android/internal/telephony/test/SimulatedCommands.java
@@ -37,7 +37,7 @@
 
 public final class SimulatedCommands extends BaseCommands
         implements CommandsInterface, SimulatedRadioControl {
-    private final static String LOG_TAG = "SIM";
+    private final static String LOG_TAG = "SimulatedCommands";
 
     private enum SimLockState {
         NONE,
@@ -77,10 +77,10 @@
     String mPin2Code;
     boolean mSsnNotifyOn = false;
 
-    int pausedResponseCount;
-    ArrayList<Message> pausedResponses = new ArrayList<Message>();
+    int mPausedResponseCount;
+    ArrayList<Message> mPausedResponses = new ArrayList<Message>();
 
-    int nextCallFailCause = CallFailCause.NORMAL_CLEARING;
+    int mNextCallFailCause = CallFailCause.NORMAL_CLEARING;
 
     //***** Constructor
 
@@ -104,10 +104,12 @@
 
     //***** CommandsInterface implementation
 
+    @Override
     public void getIccCardStatus(Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void supplyIccPin(String pin, Message result)  {
         if (mSimLockedState != SimLockState.REQUIRE_PIN) {
             Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: wrong state, state=" +
@@ -150,6 +152,7 @@
         }
     }
 
+    @Override
     public void supplyIccPuk(String puk, String newPin, Message result)  {
         if (mSimLockedState != SimLockState.REQUIRE_PUK) {
             Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk: wrong state, state=" +
@@ -192,6 +195,7 @@
         }
     }
 
+    @Override
     public void supplyIccPin2(String pin2, Message result)  {
         if (mSimFdnEnabledState != SimFdnState.REQUIRE_PIN2) {
             Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: wrong state, state=" +
@@ -233,6 +237,7 @@
         }
     }
 
+    @Override
     public void supplyIccPuk2(String puk2, String newPin2, Message result)  {
         if (mSimFdnEnabledState != SimFdnState.REQUIRE_PUK2) {
             Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk2: wrong state, state=" +
@@ -274,6 +279,7 @@
         }
     }
 
+    @Override
     public void changeIccPin(String oldPin, String newPin, Message result)  {
         if (oldPin != null && oldPin.equals(mPinCode)) {
             mPinCode = newPin;
@@ -295,6 +301,7 @@
         }
     }
 
+    @Override
     public void changeIccPin2(String oldPin2, String newPin2, Message result)  {
         if (oldPin2 != null && oldPin2.equals(mPin2Code)) {
             mPin2Code = newPin2;
@@ -316,11 +323,13 @@
         }
     }
 
+    @Override
     public void
     changeBarringPassword(String facility, String oldPwd, String newPwd, Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void
     setSuppServiceNotifications(boolean enable, Message result) {
         resultSuccess(result, null);
@@ -429,6 +438,7 @@
         unimplemented(result);
     }
 
+    @Override
     public void supplyNetworkDepersonalization(String netpin, Message result)  {
         unimplemented(result);
     }
@@ -441,6 +451,7 @@
      *  ar.result contains a List of DriverCall
      *      The ar.result List is sorted by DriverCall.index
      */
+    @Override
     public void getCurrentCalls (Message result) {
         if ((mState == RadioState.RADIO_ON) && !isSimLocked()) {
             //Rlog.i("GSM", "[SimCmds] getCurrentCalls");
@@ -456,6 +467,8 @@
     /**
      *  @deprecated
      */
+    @Deprecated
+    @Override
     public void getPDPContextList(Message result) {
         getDataCallList(result);
     }
@@ -467,6 +480,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result contains a List of DataCallState
      */
+    @Override
     public void getDataCallList(Message result) {
         resultSuccess(result, new ArrayList<DataCallState>(0));
     }
@@ -482,6 +496,7 @@
      * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
      * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
      */
+    @Override
     public void dial (String address, int clirMode, Message result) {
         simulatedCallState.onDial(address);
 
@@ -499,12 +514,14 @@
      * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
      * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
      */
+    @Override
     public void dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
         simulatedCallState.onDial(address);
 
         resultSuccess(result, null);
     }
 
+    @Override
     public void getIMSI(Message result) {
         getIMSIForApp(null, result);
     }
@@ -515,6 +532,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is String containing IMSI on success
      */
+    @Override
     public void getIMSIForApp(String aid, Message result) {
         resultSuccess(result, "012345678901234");
     }
@@ -526,6 +544,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is String containing IMEI on success
      */
+    @Override
     public void getIMEI(Message result) {
         resultSuccess(result, "012345678901234");
     }
@@ -537,6 +556,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is String containing IMEISV on success
      */
+    @Override
     public void getIMEISV(Message result) {
         resultSuccess(result, "99");
     }
@@ -552,6 +572,7 @@
      *  3GPP 22.030 6.5.5
      *  "Releases a specific active call X"
      */
+    @Override
     public void hangupConnection (int gsmIndex, Message result) {
         boolean success;
 
@@ -574,6 +595,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void hangupWaitingOrBackground (Message result) {
         boolean success;
 
@@ -595,6 +617,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void hangupForegroundResumeBackground (Message result) {
         boolean success;
 
@@ -616,6 +639,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void switchWaitingOrHoldingAndActive (Message result) {
         boolean success;
 
@@ -636,6 +660,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void conference (Message result) {
         boolean success;
 
@@ -656,6 +681,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void explicitCallTransfer (Message result) {
         boolean success;
 
@@ -673,6 +699,7 @@
      * "Places all active calls on hold except call X with which
      *  communication shall be supported."
      */
+    @Override
     public void separateConnection (int gsmIndex, Message result) {
         boolean success;
 
@@ -692,6 +719,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void acceptCall (Message result) {
         boolean success;
 
@@ -710,6 +738,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void rejectCall (Message result) {
         boolean success;
 
@@ -730,27 +759,33 @@
      * - Any defined in 22.001 F.4 (for generating busy/congestion)
      * - Cause 68: ACM >= ACMMax
      */
+    @Override
     public void getLastCallFailCause (Message result) {
         int[] ret = new int[1];
 
-        ret[0] = nextCallFailCause;
+        ret[0] = mNextCallFailCause;
         resultSuccess(result, ret);
     }
 
     /**
      * @deprecated
      */
+    @Deprecated
+    @Override
     public void getLastPdpFailCause (Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void getLastDataCallFailCause(Message result) {
         //
         unimplemented(result);
     }
 
+    @Override
     public void setMute (boolean enableMute, Message result) {unimplemented(result);}
 
+    @Override
     public void getMute (Message result) {unimplemented(result);}
 
     /**
@@ -760,6 +795,7 @@
      * response.obj.result[1] is  bit error rate (0-7, 99)
      * as defined in TS 27.007 8.5
      */
+    @Override
     public void getSignalStrength (Message result) {
         int ret[] = new int[2];
 
@@ -775,6 +811,7 @@
      * @param bandMode one of BM_*_BAND
      * @param result is callback message
      */
+    @Override
     public void setBandMode (int bandMode, Message result) {
         resultSuccess(result, null);
     }
@@ -786,6 +823,7 @@
      *        ((AsyncResult)response.obj).result  is an int[] with every
      *        element representing one available BM_*_BAND
      */
+    @Override
     public void queryAvailableBandMode (Message result) {
         int ret[] = new int [4];
 
@@ -800,6 +838,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendTerminalResponse(String contents, Message response) {
         resultSuccess(response, null);
     }
@@ -807,6 +846,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendEnvelope(String contents, Message response) {
         resultSuccess(response, null);
     }
@@ -814,6 +854,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendEnvelopeWithStatus(String contents, Message response) {
         resultSuccess(response, null);
     }
@@ -821,6 +862,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void handleCallSetupRequestFromSim(
             boolean accept, Message response) {
         resultSuccess(response, null);
@@ -833,6 +875,7 @@
      * Please note that registration state 4 ("unknown") is treated
      * as "out of service" above
      */
+    @Override
     public void getVoiceRegistrationState (Message result) {
         String ret[] = new String[14];
 
@@ -871,6 +914,7 @@
      * Please note that registration state 4 ("unknown") is treated
      * as "out of service" in the Android telephony system
      */
+    @Override
     public void getDataRegistrationState (Message result) {
         String ret[] = new String[4];
 
@@ -888,6 +932,7 @@
      * response.obj.result[1] is short alpha or null if unregistered
      * response.obj.result[2] is numeric or null if unregistered
      */
+    @Override
     public void getOperator(Message result) {
         String[] ret = new String[3];
 
@@ -903,6 +948,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void sendDtmf(char c, Message result) {
         resultSuccess(result, null);
     }
@@ -912,6 +958,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void startDtmf(char c, Message result) {
         resultSuccess(result, null);
     }
@@ -921,6 +968,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void stopDtmf(Message result) {
         resultSuccess(result, null);
     }
@@ -930,6 +978,7 @@
      *  ar.userObject contains the original value of result.obj
      *  ar.result is null on success and failure
      */
+    @Override
     public void sendBurstDtmf(String dtmfString, int on, int off, Message result) {
         resultSuccess(result, null);
     }
@@ -940,41 +989,50 @@
      * pdu is SMS in PDU format as an ASCII hex string
      *      less the SMSC address
      */
+    @Override
     public void sendSMS (String smscPDU, String pdu, Message result) {unimplemented(result);}
 
+    @Override
     public void deleteSmsOnSim(int index, Message response) {
         Rlog.d(LOG_TAG, "Delete message at index " + index);
         unimplemented(response);
     }
 
+    @Override
     public void deleteSmsOnRuim(int index, Message response) {
         Rlog.d(LOG_TAG, "Delete RUIM message at index " + index);
         unimplemented(response);
     }
 
+    @Override
     public void writeSmsToSim(int status, String smsc, String pdu, Message response) {
         Rlog.d(LOG_TAG, "Write SMS to SIM with status " + status);
         unimplemented(response);
     }
 
+    @Override
     public void writeSmsToRuim(int status, String pdu, Message response) {
         Rlog.d(LOG_TAG, "Write SMS to RUIM with status " + status);
         unimplemented(response);
     }
 
+    @Override
     public void setupDataCall(String radioTechnology, String profile,
             String apn, String user, String password, String authType,
             String protocol, Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void deactivateDataCall(int cid, int reason, Message result) {unimplemented(result);}
 
+    @Override
     public void setPreferredNetworkType(int networkType , Message result) {
         mNetworkType = networkType;
         resultSuccess(result, null);
     }
 
+    @Override
     public void getPreferredNetworkType(Message result) {
         int ret[] = new int[1];
 
@@ -982,6 +1040,7 @@
         resultSuccess(result, ret);
     }
 
+    @Override
     public void getNeighboringCids(Message result) {
         int ret[] = new int[7];
 
@@ -992,22 +1051,27 @@
         resultSuccess(result, ret);
     }
 
+    @Override
     public void setLocationUpdates(boolean enable, Message response) {
         unimplemented(response);
     }
 
+    @Override
     public void getSmscAddress(Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void setSmscAddress(String address, Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void reportSmsMemoryStatus(boolean available, Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void reportStkServiceIsRunning(Message result) {
         resultSuccess(result, null);
     }
@@ -1024,6 +1088,7 @@
         return false;
     }
 
+    @Override
     public void setRadioPower(boolean on, Message result) {
         if(on) {
             setRadioState(RadioState.RADIO_ON);
@@ -1033,19 +1098,23 @@
     }
 
 
+    @Override
     public void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void acknowledgeIncomingGsmSmsWithPdu(boolean success, String ackPdu,
             Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void iccIO(int command, int fileid, String path, int p1, int p2, int p3, String data,
             String pin2, Message response) {
         iccIOForApp(command, fileid, path, p1, p2, p3, data,pin2, null, response);
@@ -1056,6 +1125,7 @@
      * response.obj will be an AsyncResult
      * response.obj.userObj will be a SimIoResult on success
      */
+    @Override
     public void iccIOForApp (int command, int fileid, String path, int p1, int p2,
                        int p3, String data, String pin2, String aid, Message result) {
         unimplemented(result);
@@ -1067,6 +1137,7 @@
      *
      * @param response is callback message
      */
+    @Override
     public void queryCLIP(Message response) { unimplemented(response); }
 
 
@@ -1086,6 +1157,7 @@
      *  4 CLIR temporary mode presentation allowed
      */
 
+    @Override
     public void getCLIR(Message result) {unimplemented(result);}
 
     /**
@@ -1094,6 +1166,7 @@
      * response.obj is null
      */
 
+    @Override
     public void setCLIR(int clirMode, Message result) {unimplemented(result);}
 
     /**
@@ -1104,6 +1177,7 @@
      * @param response is callback message
      */
 
+    @Override
     public void queryCallWaiting(int serviceClass, Message response) {
         unimplemented(response);
     }
@@ -1114,6 +1188,7 @@
      * @param response is callback message
      */
 
+    @Override
     public void setCallWaiting(boolean enable, int serviceClass,
             Message response) {
         unimplemented(response);
@@ -1124,6 +1199,7 @@
      * @param cfReason is one of CF_REASON_*
      * @param serviceClass is a sum of SERVICE_CLASSS_*
      */
+    @Override
     public void setCallForward(int action, int cfReason, int serviceClass,
             String number, int timeSeconds, Message result) {unimplemented(result);}
 
@@ -1135,11 +1211,15 @@
      *
      * An array of length 0 means "disabled for all codes"
      */
+    @Override
     public void queryCallForwardStatus(int cfReason, int serviceClass,
             String number, Message result) {unimplemented(result);}
 
+    @Override
     public void setNetworkSelectionModeAutomatic(Message result) {unimplemented(result);}
+    @Override
     public void exitEmergencyCallbackMode(Message result) {unimplemented(result);}
+    @Override
     public void setNetworkSelectionModeManual(
             String operatorNumeric, Message result) {unimplemented(result);}
 
@@ -1151,6 +1231,7 @@
      * a 0 for automatic selection and a 1 for manual selection
      */
 
+    @Override
     public void getNetworkSelectionMode(Message result) {
         int ret[] = new int[1];
 
@@ -1163,8 +1244,10 @@
      *
      * ((AsyncResult)response.obj).result  is a List of NetworkInfo objects
      */
+    @Override
     public void getAvailableNetworks(Message result) {unimplemented(result);}
 
+    @Override
     public void getBasebandVersion (Message result) {
         resultSuccess(result, "SimulatedCommands");
     }
@@ -1175,6 +1258,7 @@
      * in CommandsInterface.java
      * @param message Message text to send or null if none
      */
+    @Override
     public void triggerIncomingUssd(String statusCode, String message) {
         if (mUSSDRegistrant != null) {
             String[] result = {statusCode, message};
@@ -1183,6 +1267,7 @@
     }
 
 
+    @Override
     public void sendUSSD (String ussdString, Message result) {
 
         // We simulate this particular sequence
@@ -1199,15 +1284,18 @@
     }
 
     // inherited javadoc suffices
+    @Override
     public void cancelPendingUssd (Message response) {
         resultSuccess(response, null);
     }
 
 
+    @Override
     public void resetRadio(Message result) {
         unimplemented(result);
     }
 
+    @Override
     public void invokeOemRilRequestRaw(byte[] data, Message response) {
         // Just echo back data
         if (response != null) {
@@ -1216,6 +1304,7 @@
         }
     }
 
+    @Override
     public void invokeOemRilRequestStrings(String[] strings, Message response) {
         // Just echo back data
         if (response != null) {
@@ -1228,12 +1317,14 @@
 
 
     /** Start the simulated phone ringing */
+    @Override
     public void
     triggerRing(String number) {
         simulatedCallState.triggerRing(number);
         mCallStateRegistrants.notifyRegistrants();
     }
 
+    @Override
     public void
     progressConnectingCallState() {
         simulatedCallState.progressConnectingCallState();
@@ -1241,6 +1332,7 @@
     }
 
     /** If a call is DIALING or ALERTING, progress it all the way to ACTIVE */
+    @Override
     public void
     progressConnectingToActive() {
         simulatedCallState.progressConnectingToActive();
@@ -1250,21 +1342,25 @@
     /** automatically progress mobile originated calls to ACTIVE.
      *  default to true
      */
+    @Override
     public void
     setAutoProgressConnectingCall(boolean b) {
         simulatedCallState.setAutoProgressConnectingCall(b);
     }
 
+    @Override
     public void
     setNextDialFailImmediately(boolean b) {
         simulatedCallState.setNextDialFailImmediately(b);
     }
 
+    @Override
     public void
     setNextCallFailCause(int gsmCause) {
-        nextCallFailCause = gsmCause;
+        mNextCallFailCause = gsmCause;
     }
 
+    @Override
     public void
     triggerHangupForeground() {
         simulatedCallState.triggerHangupForeground();
@@ -1272,12 +1368,14 @@
     }
 
     /** hangup holding calls */
+    @Override
     public void
     triggerHangupBackground() {
         simulatedCallState.triggerHangupBackground();
         mCallStateRegistrants.notifyRegistrants();
     }
 
+    @Override
     public void triggerSsn(int type, int code) {
         SuppServiceNotification not = new SuppServiceNotification();
         not.notificationType = type;
@@ -1285,6 +1383,7 @@
         mSsnRegistrant.notifyRegistrant(new AsyncResult(null, not, null));
     }
 
+    @Override
     public void
     shutdown() {
         setRadioState(RadioState.RADIO_UNAVAILABLE);
@@ -1296,31 +1395,35 @@
 
     /** hangup all */
 
+    @Override
     public void
     triggerHangupAll() {
         simulatedCallState.triggerHangupAll();
         mCallStateRegistrants.notifyRegistrants();
     }
 
+    @Override
     public void
     triggerIncomingSMS(String message) {
         //TODO
     }
 
+    @Override
     public void
     pauseResponses() {
-        pausedResponseCount++;
+        mPausedResponseCount++;
     }
 
+    @Override
     public void
     resumeResponses() {
-        pausedResponseCount--;
+        mPausedResponseCount--;
 
-        if (pausedResponseCount == 0) {
-            for (int i = 0, s = pausedResponses.size(); i < s ; i++) {
-                pausedResponses.get(i).sendToTarget();
+        if (mPausedResponseCount == 0) {
+            for (int i = 0, s = mPausedResponses.size(); i < s ; i++) {
+                mPausedResponses.get(i).sendToTarget();
             }
-            pausedResponses.clear();
+            mPausedResponses.clear();
         } else {
             Rlog.e("GSM", "SimulatedCommands.resumeResponses < 0");
         }
@@ -1333,8 +1436,8 @@
             AsyncResult.forMessage(result).exception
                 = new RuntimeException("Unimplemented");
 
-            if (pausedResponseCount > 0) {
-                pausedResponses.add(result);
+            if (mPausedResponseCount > 0) {
+                mPausedResponses.add(result);
             } else {
                 result.sendToTarget();
             }
@@ -1344,8 +1447,8 @@
     private void resultSuccess(Message result, Object ret) {
         if (result != null) {
             AsyncResult.forMessage(result).result = ret;
-            if (pausedResponseCount > 0) {
-                pausedResponses.add(result);
+            if (mPausedResponseCount > 0) {
+                mPausedResponses.add(result);
             } else {
                 result.sendToTarget();
             }
@@ -1355,8 +1458,8 @@
     private void resultFail(Message result, Throwable tr) {
         if (result != null) {
             AsyncResult.forMessage(result).exception = tr;
-            if (pausedResponseCount > 0) {
-                pausedResponses.add(result);
+            if (mPausedResponseCount > 0) {
+                mPausedResponses.add(result);
             } else {
                 result.sendToTarget();
             }
@@ -1364,44 +1467,52 @@
     }
 
     // ***** Methods for CDMA support
+    @Override
     public void
     getDeviceIdentity(Message response) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(response);
     }
 
+    @Override
     public void
     getCDMASubscription(Message response) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(response);
     }
 
+    @Override
     public void
     setCdmaSubscriptionSource(int cdmaSubscriptionType, Message response) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(response);
     }
 
+    @Override
     public void queryCdmaRoamingPreference(Message response) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(response);
     }
 
+    @Override
     public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(response);
     }
 
+    @Override
     public void
     setPhoneType(int phoneType) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
     }
 
+    @Override
     public void getPreferredVoicePrivacy(Message result) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(result);
     }
 
+    @Override
     public void setPreferredVoicePrivacy(boolean enable, Message result) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(result);
@@ -1417,6 +1528,7 @@
      * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
      * @param response is callback message
      */
+    @Override
     public void setTTYMode(int ttyMode, Message response) {
         Rlog.w(LOG_TAG, "Not implemented in SimulatedCommands");
         unimplemented(response);
@@ -1432,6 +1544,7 @@
      * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
      * @param response is callback message
      */
+    @Override
     public void queryTTYMode(Message response) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(response);
@@ -1440,6 +1553,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendCDMAFeatureCode(String FeatureCode, Message response) {
         Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
         unimplemented(response);
@@ -1448,20 +1562,24 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public void sendCdmaSms(byte[] pdu, Message response){
        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
     }
 
+    @Override
     public void setCdmaBroadcastActivation(boolean activate, Message response) {
         unimplemented(response);
 
     }
 
+    @Override
     public void getCdmaBroadcastConfig(Message response) {
         unimplemented(response);
 
     }
 
+    @Override
     public void setCdmaBroadcastConfig(CdmaSmsBroadcastConfigInfo[] configs, Message response) {
         unimplemented(response);
     }
@@ -1471,15 +1589,18 @@
     }
 
 
+    @Override
     public void setGsmBroadcastActivation(boolean activate, Message response) {
         unimplemented(response);
     }
 
 
+    @Override
     public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message response) {
         unimplemented(response);
     }
 
+    @Override
     public void getGsmBroadcastConfig(Message response) {
         unimplemented(response);
     }
@@ -1515,10 +1636,12 @@
         unimplemented(response);
     }
 
+    @Override
     public void requestIsimAuthentication(String nonce, Message response) {
         unimplemented(response);
     }
 
+    @Override
     public void getVoiceRadioTechnology(Message response) {
         unimplemented(response);
     }
diff --git a/src/java/com/android/internal/telephony/test/SimulatedGsmCallState.java b/src/java/com/android/internal/telephony/test/SimulatedGsmCallState.java
index 6b0a346..75e84c4 100644
--- a/src/java/com/android/internal/telephony/test/SimulatedGsmCallState.java
+++ b/src/java/com/android/internal/telephony/test/SimulatedGsmCallState.java
@@ -36,28 +36,28 @@
         INCOMING(4),   // MT call only
         WAITING(5);    // MT call only
 
-        State (int value) {this.value = value;}
+        State(int value) {mValue = value;}
 
-        private final int value;
-        public int value() {return value;};
-    };
+        private final int mValue;
+        public int value() {return mValue;}
+    }
 
-    boolean isMT;
-    State state;
-    boolean isMpty;
-    String number;
-    int TOA;
+    boolean mIsMT;
+    State mState;
+    boolean mIsMpty;
+    String mNumber;
+    int mTOA;
 
     CallInfo (boolean isMT, State state, boolean isMpty, String number) {
-        this.isMT = isMT;
-        this.state = state;
-        this.isMpty = isMpty;
-        this.number = number;
+        mIsMT = isMT;
+        mState = state;
+        mIsMpty = isMpty;
+        mNumber = number;
 
         if (number.length() > 0 && number.charAt(0) == '+') {
-            TOA = PhoneNumberUtils.TOA_International;
+            mTOA = PhoneNumberUtils.TOA_International;
         } else {
-            TOA = PhoneNumberUtils.TOA_Unknown;
+            mTOA = PhoneNumberUtils.TOA_Unknown;
         }
     }
 
@@ -75,9 +75,9 @@
     toCLCCLine(int index) {
         return
             "+CLCC: "
-            + index + "," + (isMT ? "1" : "0") +","
-            + state.value() + ",0," + (isMpty ? "1" : "0")
-            + ",\"" + number + "\"," + TOA;
+            + index + "," + (mIsMT ? "1" : "0") +","
+            + mState.value() + ",0," + (mIsMpty ? "1" : "0")
+            + ",\"" + mNumber + "\"," + mTOA;
     }
 
     DriverCall
@@ -87,17 +87,17 @@
         ret = new DriverCall();
 
         ret.index = index;
-        ret.isMT = isMT;
+        ret.isMT = mIsMT;
 
         try {
-            ret.state = DriverCall.stateFromCLCC(state.value());
+            ret.state = DriverCall.stateFromCLCC(mState.value());
         } catch (ATParseEx ex) {
             throw new RuntimeException("should never happen", ex);
         }
 
-        ret.isMpty = isMpty;
-        ret.number = number;
-        ret.TOA = TOA;
+        ret.isMpty = mIsMpty;
+        ret.number = mNumber;
+        ret.TOA = mTOA;
         ret.isVoice = true;
         ret.als = 0;
 
@@ -107,17 +107,17 @@
 
     boolean
     isActiveOrHeld() {
-        return state == State.ACTIVE || state == State.HOLDING;
+        return mState == State.ACTIVE || mState == State.HOLDING;
     }
 
     boolean
     isConnecting() {
-        return state == State.DIALING || state == State.ALERTING;
+        return mState == State.DIALING || mState == State.ALERTING;
     }
 
     boolean
     isRinging() {
-        return state == State.INCOMING || state == State.WAITING;
+        return mState == State.INCOMING || mState == State.WAITING;
     }
 
 }
@@ -132,10 +132,10 @@
 class SimulatedGsmCallState extends Handler {
     //***** Instance Variables
 
-    CallInfo calls[] = new CallInfo[MAX_CALLS];
+    CallInfo mCalls[] = new CallInfo[MAX_CALLS];
 
-    private boolean autoProgressConnecting = true;
-    private boolean nextDialFailImmediately;
+    private boolean mAutoProgressConnecting = true;
+    private boolean mNextDialFailImmediately;
 
 
     //***** Event Constants
@@ -155,6 +155,7 @@
         super(looper);
     }
 
+    @Override
     public void
     handleMessage(Message msg) {
         synchronized(this) { switch (msg.what) {
@@ -180,14 +181,14 @@
             boolean isCallWaiting = false;
 
             // ensure there aren't already calls INCOMING or WAITING
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
                 if (call == null && empty < 0) {
                     empty = i;
                 } else if (call != null
-                    && (call.state == CallInfo.State.INCOMING
-                        || call.state == CallInfo.State.WAITING)
+                    && (call.mState == CallInfo.State.INCOMING
+                        || call.mState == CallInfo.State.WAITING)
                 ) {
                     Rlog.w("ModelInterpreter",
                         "triggerRing failed; phone already ringing");
@@ -202,11 +203,11 @@
                 return false;
             }
 
-            calls[empty] = CallInfo.createIncomingCall(
+            mCalls[empty] = CallInfo.createIncomingCall(
                 PhoneNumberUtils.extractNetworkPortion(number));
 
             if (isCallWaiting) {
-                calls[empty].state = CallInfo.State.WAITING;
+                mCalls[empty].mState = CallInfo.State.WAITING;
             }
 
         }
@@ -217,22 +218,22 @@
     public void
     progressConnectingCallState() {
         synchronized (this)  {
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
-                if (call != null && call.state == CallInfo.State.DIALING) {
-                    call.state = CallInfo.State.ALERTING;
+                if (call != null && call.mState == CallInfo.State.DIALING) {
+                    call.mState = CallInfo.State.ALERTING;
 
-                    if (autoProgressConnecting) {
+                    if (mAutoProgressConnecting) {
                         sendMessageDelayed(
                                 obtainMessage(EVENT_PROGRESS_CALL_STATE, call),
                                 CONNECTING_PAUSE_MSEC);
                     }
                     break;
                 } else if (call != null
-                        && call.state == CallInfo.State.ALERTING
+                        && call.mState == CallInfo.State.ALERTING
                 ) {
-                    call.state = CallInfo.State.ACTIVE;
+                    call.mState = CallInfo.State.ACTIVE;
                     break;
                 }
             }
@@ -243,13 +244,13 @@
     public void
     progressConnectingToActive() {
         synchronized (this)  {
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
-                if (call != null && (call.state == CallInfo.State.DIALING
-                    || call.state == CallInfo.State.ALERTING)
+                if (call != null && (call.mState == CallInfo.State.DIALING
+                    || call.mState == CallInfo.State.ALERTING)
                 ) {
-                    call.state = CallInfo.State.ACTIVE;
+                    call.mState = CallInfo.State.ACTIVE;
                     break;
                 }
             }
@@ -261,12 +262,12 @@
      */
     public void
     setAutoProgressConnectingCall(boolean b) {
-        autoProgressConnecting = b;
+        mAutoProgressConnecting = b;
     }
 
     public void
     setNextDialFailImmediately(boolean b) {
-        nextDialFailImmediately = b;
+        mNextDialFailImmediately = b;
     }
 
     /**
@@ -280,27 +281,27 @@
 
             found = false;
 
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
                 if (call != null
-                    && (call.state == CallInfo.State.INCOMING
-                        || call.state == CallInfo.State.WAITING)
+                    && (call.mState == CallInfo.State.INCOMING
+                        || call.mState == CallInfo.State.WAITING)
                 ) {
-                    calls[i] = null;
+                    mCalls[i] = null;
                     found = true;
                 }
             }
 
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
                 if (call != null
-                    && (call.state == CallInfo.State.DIALING
-                        || call.state == CallInfo.State.ACTIVE
-                        || call.state == CallInfo.State.ALERTING)
+                    && (call.mState == CallInfo.State.DIALING
+                        || call.mState == CallInfo.State.ACTIVE
+                        || call.mState == CallInfo.State.ALERTING)
                 ) {
-                    calls[i] = null;
+                    mCalls[i] = null;
                     found = true;
                 }
             }
@@ -317,11 +318,11 @@
         synchronized (this) {
             boolean found = false;
 
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
-                if (call != null && call.state == CallInfo.State.HOLDING) {
-                    calls[i] = null;
+                if (call != null && call.mState == CallInfo.State.HOLDING) {
+                    mCalls[i] = null;
                     found = true;
                 }
             }
@@ -339,14 +340,14 @@
         synchronized(this) {
             boolean found = false;
 
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
-                if (calls[i] != null) {
+                if (mCalls[i] != null) {
                     found = true;
                 }
 
-                calls[i] = null;
+                mCalls[i] = null;
             }
 
             return found;
@@ -356,12 +357,12 @@
     public boolean
     onAnswer() {
         synchronized (this) {
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo call = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo call = mCalls[i];
 
                 if (call != null
-                    && (call.state == CallInfo.State.INCOMING
-                        || call.state == CallInfo.State.WAITING)
+                    && (call.mState == CallInfo.State.INCOMING
+                        || call.mState == CallInfo.State.WAITING)
                 ) {
                     return switchActiveAndHeldOrWaiting();
                 }
@@ -375,11 +376,11 @@
     onHangup() {
         boolean found = false;
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo call = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo call = mCalls[i];
 
-            if (call != null && call.state != CallInfo.State.WAITING) {
-                calls[i] = null;
+            if (call != null && call.mState != CallInfo.State.WAITING) {
+                mCalls[i] = null;
                 found = true;
             }
         }
@@ -395,7 +396,7 @@
         if (c1 != 0) {
             callIndex = c1 - '1';
 
-            if (callIndex < 0 || callIndex >= calls.length) {
+            if (callIndex < 0 || callIndex >= mCalls.length) {
                 return false;
             }
         }
@@ -408,10 +409,10 @@
                 if (c1 <= 0) {
                     ret = releaseActiveAcceptHeldOrWaiting();
                 } else {
-                    if (calls[callIndex] == null) {
+                    if (mCalls[callIndex] == null) {
                         ret = false;
                     } else {
-                        calls[callIndex] = null;
+                        mCalls[callIndex] = null;
                         ret = true;
                     }
                 }
@@ -447,23 +448,23 @@
     releaseHeldOrUDUB() {
         boolean found = false;
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null && c.isRinging()) {
                 found = true;
-                calls[i] = null;
+                mCalls[i] = null;
                 break;
             }
         }
 
         if (!found) {
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo c = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo c = mCalls[i];
 
-                if (c != null && c.state == CallInfo.State.HOLDING) {
+                if (c != null && c.mState == CallInfo.State.HOLDING) {
                     found = true;
-                    calls[i] = null;
+                    mCalls[i] = null;
                     // don't stop...there may be more than one
                 }
             }
@@ -478,11 +479,11 @@
         boolean foundHeld = false;
         boolean foundActive = false;
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
-            if (c != null && c.state == CallInfo.State.ACTIVE) {
-                calls[i] = null;
+            if (c != null && c.mState == CallInfo.State.ACTIVE) {
+                mCalls[i] = null;
                 foundActive = true;
             }
         }
@@ -490,24 +491,24 @@
         if (!foundActive) {
             // FIXME this may not actually be how most basebands react
             // CHLD=1 may not hang up dialing/alerting calls
-            for (int i = 0 ; i < calls.length ; i++) {
-                CallInfo c = calls[i];
+            for (int i = 0 ; i < mCalls.length ; i++) {
+                CallInfo c = mCalls[i];
 
                 if (c != null
-                        && (c.state == CallInfo.State.DIALING
-                            || c.state == CallInfo.State.ALERTING)
+                        && (c.mState == CallInfo.State.DIALING
+                            || c.mState == CallInfo.State.ALERTING)
                 ) {
-                    calls[i] = null;
+                    mCalls[i] = null;
                     foundActive = true;
                 }
             }
         }
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
-            if (c != null && c.state == CallInfo.State.HOLDING) {
-                c.state = CallInfo.State.ACTIVE;
+            if (c != null && c.mState == CallInfo.State.HOLDING) {
+                c.mState = CallInfo.State.ACTIVE;
                 foundHeld = true;
             }
         }
@@ -516,11 +517,11 @@
             return true;
         }
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null && c.isRinging()) {
-                c.state = CallInfo.State.ACTIVE;
+                c.mState = CallInfo.State.ACTIVE;
                 return true;
             }
         }
@@ -533,26 +534,26 @@
         boolean hasHeld = false;
 
         // first, are there held calls?
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
-            if (c != null && c.state == CallInfo.State.HOLDING) {
+            if (c != null && c.mState == CallInfo.State.HOLDING) {
                 hasHeld = true;
                 break;
             }
         }
 
         // Now, switch
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null) {
-                if (c.state == CallInfo.State.ACTIVE) {
-                    c.state = CallInfo.State.HOLDING;
-                } else if (c.state == CallInfo.State.HOLDING) {
-                    c.state = CallInfo.State.ACTIVE;
+                if (c.mState == CallInfo.State.ACTIVE) {
+                    c.mState = CallInfo.State.HOLDING;
+                } else if (c.mState == CallInfo.State.HOLDING) {
+                    c.mState = CallInfo.State.ACTIVE;
                 } else if (!hasHeld && c.isRinging())  {
-                    c.state = CallInfo.State.ACTIVE;
+                    c.mState = CallInfo.State.ACTIVE;
                 }
             }
         }
@@ -566,23 +567,23 @@
         try {
             CallInfo c;
 
-            c = calls[index];
+            c = mCalls[index];
 
             if (c == null || c.isConnecting() || countActiveLines() != 1) {
                 return false;
             }
 
-            c.state = CallInfo.State.ACTIVE;
-            c.isMpty = false;
+            c.mState = CallInfo.State.ACTIVE;
+            c.mIsMpty = false;
 
-            for (int i = 0 ; i < calls.length ; i++) {
+            for (int i = 0 ; i < mCalls.length ; i++) {
                 int countHeld=0, lastHeld=0;
 
                 if (i != index) {
-                    CallInfo cb = calls[i];
+                    CallInfo cb = mCalls[i];
 
-                    if (cb != null && cb.state == CallInfo.State.ACTIVE) {
-                        cb.state = CallInfo.State.HOLDING;
+                    if (cb != null && cb.mState == CallInfo.State.ACTIVE) {
+                        cb.mState = CallInfo.State.HOLDING;
                         countHeld++;
                         lastHeld = i;
                     }
@@ -590,7 +591,7 @@
 
                 if (countHeld == 1) {
                     // if there's only one left, clear the MPTY flag
-                    calls[lastHeld].isMpty = false;
+                    mCalls[lastHeld].mIsMpty = false;
                 }
             }
 
@@ -607,8 +608,8 @@
         int countCalls = 0;
 
         // if there's connecting calls, we can't do this yet
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null) {
                 countCalls++;
@@ -618,13 +619,13 @@
                 }
             }
         }
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null) {
-                c.state = CallInfo.State.ACTIVE;
+                c.mState = CallInfo.State.ACTIVE;
                 if (countCalls > 0) {
-                    c.isMpty = true;
+                    c.mIsMpty = true;
                 }
             }
         }
@@ -637,8 +638,8 @@
         int countCalls = 0;
 
         // if there's connecting calls, we can't do this yet
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null) {
                 countCalls++;
@@ -660,8 +661,8 @@
 
         Rlog.d("GSM", "SC> dial '" + address + "'");
 
-        if (nextDialFailImmediately) {
-            nextDialFailImmediately = false;
+        if (mNextDialFailImmediately) {
+            mNextDialFailImmediately = false;
 
             Rlog.d("GSM", "SC< dial fail (per request)");
             return false;
@@ -692,19 +693,19 @@
             return false;
         }
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            if (freeSlot < 0 && calls[i] == null) {
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            if (freeSlot < 0 && mCalls[i] == null) {
                 freeSlot = i;
             }
 
-            if (calls[i] != null && !calls[i].isActiveOrHeld()) {
+            if (mCalls[i] != null && !mCalls[i].isActiveOrHeld()) {
                 // Can't make outgoing calls when there is a ringing or
                 // connecting outgoing call
                 Rlog.d("GSM", "SC< dial fail (invalid call state)");
                 return false;
-            } else if (calls[i] != null && calls[i].state == CallInfo.State.ACTIVE) {
+            } else if (mCalls[i] != null && mCalls[i].mState == CallInfo.State.ACTIVE) {
                 // All active calls behome held
-                calls[i].state = CallInfo.State.HOLDING;
+                mCalls[i].mState = CallInfo.State.HOLDING;
             }
         }
 
@@ -713,11 +714,11 @@
             return false;
         }
 
-        calls[freeSlot] = CallInfo.createOutgoingCall(phNum);
+        mCalls[freeSlot] = CallInfo.createOutgoingCall(phNum);
 
-        if (autoProgressConnecting) {
+        if (mAutoProgressConnecting) {
             sendMessageDelayed(
-                    obtainMessage(EVENT_PROGRESS_CALL_STATE, calls[freeSlot]),
+                    obtainMessage(EVENT_PROGRESS_CALL_STATE, mCalls[freeSlot]),
                     CONNECTING_PAUSE_MSEC);
         }
 
@@ -728,10 +729,10 @@
 
     public List<DriverCall>
     getDriverCalls() {
-        ArrayList<DriverCall> ret = new ArrayList<DriverCall>(calls.length);
+        ArrayList<DriverCall> ret = new ArrayList<DriverCall>(mCalls.length);
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null) {
                 DriverCall dc;
@@ -748,10 +749,10 @@
 
     public List<String>
     getClccLines() {
-        ArrayList<String> ret = new ArrayList<String>(calls.length);
+        ArrayList<String> ret = new ArrayList<String>(mCalls.length);
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo c = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo c = mCalls[i];
 
             if (c != null) {
                 ret.add((c.toCLCCLine(i + 1)));
@@ -770,27 +771,27 @@
         boolean hasRinging = false;
         boolean mptyIsHeld = false;
 
-        for (int i = 0 ; i < calls.length ; i++) {
-            CallInfo call = calls[i];
+        for (int i = 0 ; i < mCalls.length ; i++) {
+            CallInfo call = mCalls[i];
 
             if (call != null) {
-                if (!hasMpty && call.isMpty) {
-                    mptyIsHeld = call.state == CallInfo.State.HOLDING;
-                } else if (call.isMpty && mptyIsHeld
-                    && call.state == CallInfo.State.ACTIVE
+                if (!hasMpty && call.mIsMpty) {
+                    mptyIsHeld = call.mState == CallInfo.State.HOLDING;
+                } else if (call.mIsMpty && mptyIsHeld
+                    && call.mState == CallInfo.State.ACTIVE
                 ) {
                     Rlog.e("ModelInterpreter", "Invalid state");
                     throw new InvalidStateEx();
-                } else if (!call.isMpty && hasMpty && mptyIsHeld
-                    && call.state == CallInfo.State.HOLDING
+                } else if (!call.mIsMpty && hasMpty && mptyIsHeld
+                    && call.mState == CallInfo.State.HOLDING
                 ) {
                     Rlog.e("ModelInterpreter", "Invalid state");
                     throw new InvalidStateEx();
                 }
 
-                hasMpty |= call.isMpty;
-                hasHeld |= call.state == CallInfo.State.HOLDING;
-                hasActive |= call.state == CallInfo.State.ACTIVE;
+                hasMpty |= call.mIsMpty;
+                hasHeld |= call.mState == CallInfo.State.HOLDING;
+                hasActive |= call.mState == CallInfo.State.ACTIVE;
                 hasConnecting |= call.isConnecting();
                 hasRinging |= call.isRinging();
             }
diff --git a/src/java/com/android/internal/telephony/uicc/AdnRecord.java b/src/java/com/android/internal/telephony/uicc/AdnRecord.java
index ce5c329..8ba7869 100644
--- a/src/java/com/android/internal/telephony/uicc/AdnRecord.java
+++ b/src/java/com/android/internal/telephony/uicc/AdnRecord.java
@@ -35,16 +35,16 @@
  *
  */
 public class AdnRecord implements Parcelable {
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "AdnRecord";
 
     //***** Instance Variables
 
-    String alphaTag = null;
-    String number = null;
-    String[] emails;
-    int extRecord = 0xff;
-    int efid;                   // or 0 if none
-    int recordNumber;           // or 0 if none
+    String mAlphaTag = null;
+    String mNumber = null;
+    String[] mEmails;
+    int mExtRecord = 0xff;
+    int mEfid;                   // or 0 if none
+    int mRecordNumber;           // or 0 if none
 
 
     //***** Constants
@@ -73,6 +73,7 @@
 
     public static final Parcelable.Creator<AdnRecord> CREATOR
             = new Parcelable.Creator<AdnRecord>() {
+        @Override
         public AdnRecord createFromParcel(Parcel source) {
             int efid;
             int recordNumber;
@@ -89,6 +90,7 @@
             return new AdnRecord(efid, recordNumber, alphaTag, number, emails);
         }
 
+        @Override
         public AdnRecord[] newArray(int size) {
             return new AdnRecord[size];
         }
@@ -101,8 +103,8 @@
     }
 
     public AdnRecord (int efid, int recordNumber, byte[] record) {
-        this.efid = efid;
-        this.recordNumber = recordNumber;
+        this.mEfid = efid;
+        this.mRecordNumber = recordNumber;
         parseRecord(record);
     }
 
@@ -115,49 +117,50 @@
     }
 
     public AdnRecord (int efid, int recordNumber, String alphaTag, String number, String[] emails) {
-        this.efid = efid;
-        this.recordNumber = recordNumber;
-        this.alphaTag = alphaTag;
-        this.number = number;
-        this.emails = emails;
+        this.mEfid = efid;
+        this.mRecordNumber = recordNumber;
+        this.mAlphaTag = alphaTag;
+        this.mNumber = number;
+        this.mEmails = emails;
     }
 
     public AdnRecord(int efid, int recordNumber, String alphaTag, String number) {
-        this.efid = efid;
-        this.recordNumber = recordNumber;
-        this.alphaTag = alphaTag;
-        this.number = number;
-        this.emails = null;
+        this.mEfid = efid;
+        this.mRecordNumber = recordNumber;
+        this.mAlphaTag = alphaTag;
+        this.mNumber = number;
+        this.mEmails = null;
     }
 
     //***** Instance Methods
 
     public String getAlphaTag() {
-        return alphaTag;
+        return mAlphaTag;
     }
 
     public String getNumber() {
-        return number;
+        return mNumber;
     }
 
     public String[] getEmails() {
-        return emails;
+        return mEmails;
     }
 
     public void setEmails(String[] emails) {
-        this.emails = emails;
+        this.mEmails = emails;
     }
 
+    @Override
     public String toString() {
-        return "ADN Record '" + alphaTag + "' '" + number + " " + emails + "'";
+        return "ADN Record '" + mAlphaTag + "' '" + mNumber + " " + mEmails + "'";
     }
 
     public boolean isEmpty() {
-        return TextUtils.isEmpty(alphaTag) && TextUtils.isEmpty(number) && emails == null;
+        return TextUtils.isEmpty(mAlphaTag) && TextUtils.isEmpty(mNumber) && mEmails == null;
     }
 
     public boolean hasExtendedRecord() {
-        return extRecord != 0 && extRecord != 0xff;
+        return mExtRecord != 0 && mExtRecord != 0xff;
     }
 
     /** Helper function for {@link #isEqual}. */
@@ -175,22 +178,24 @@
     }
 
     public boolean isEqual(AdnRecord adn) {
-        return ( stringCompareNullEqualsEmpty(alphaTag, adn.alphaTag) &&
-                stringCompareNullEqualsEmpty(number, adn.number) &&
-                Arrays.equals(emails, adn.emails));
+        return ( stringCompareNullEqualsEmpty(mAlphaTag, adn.mAlphaTag) &&
+                stringCompareNullEqualsEmpty(mNumber, adn.mNumber) &&
+                Arrays.equals(mEmails, adn.mEmails));
     }
     //***** Parcelable Implementation
 
+    @Override
     public int describeContents() {
         return 0;
     }
 
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
-        dest.writeInt(efid);
-        dest.writeInt(recordNumber);
-        dest.writeString(alphaTag);
-        dest.writeString(number);
-        dest.writeStringArray(emails);
+        dest.writeInt(mEfid);
+        dest.writeInt(mRecordNumber);
+        dest.writeString(mAlphaTag);
+        dest.writeString(mNumber);
+        dest.writeStringArray(mEmails);
     }
 
     /**
@@ -213,20 +218,20 @@
             adnString[i] = (byte) 0xFF;
         }
 
-        if (TextUtils.isEmpty(number)) {
+        if (TextUtils.isEmpty(mNumber)) {
             Rlog.w(LOG_TAG, "[buildAdnString] Empty dialing number");
             return adnString;   // return the empty record (for delete)
-        } else if (number.length()
+        } else if (mNumber.length()
                 > (ADN_DIALING_NUMBER_END - ADN_DIALING_NUMBER_START + 1) * 2) {
             Rlog.w(LOG_TAG,
                     "[buildAdnString] Max length of dialing number is 20");
             return null;
-        } else if (alphaTag != null && alphaTag.length() > footerOffset) {
+        } else if (mAlphaTag != null && mAlphaTag.length() > footerOffset) {
             Rlog.w(LOG_TAG,
                     "[buildAdnString] Max length of tag is " + footerOffset);
             return null;
         } else {
-            bcdNumber = PhoneNumberUtils.numberToCalledPartyBCD(number);
+            bcdNumber = PhoneNumberUtils.numberToCalledPartyBCD(mNumber);
 
             System.arraycopy(bcdNumber, 0, adnString,
                     footerOffset + ADN_TON_AND_NPI, bcdNumber.length);
@@ -238,8 +243,8 @@
             adnString[footerOffset + ADN_EXTENSION_ID]
                     = (byte) 0xFF; // Extension Record Id
 
-            if (!TextUtils.isEmpty(alphaTag)) {
-                byteTag = GsmAlphabet.stringToGsm8BitPacked(alphaTag);
+            if (!TextUtils.isEmpty(mAlphaTag)) {
+                byteTag = GsmAlphabet.stringToGsm8BitPacked(mAlphaTag);
                 System.arraycopy(byteTag, 0, adnString, 0, byteTag.length);
             }
 
@@ -267,7 +272,7 @@
                 return;
             }
 
-            number += PhoneNumberUtils.calledPartyBCDFragmentToString(
+            mNumber += PhoneNumberUtils.calledPartyBCDFragmentToString(
                                         extRecord, 2, 0xff & extRecord[1]);
 
             // We don't support ext record chaining.
@@ -285,7 +290,7 @@
     private void
     parseRecord(byte[] record) {
         try {
-            alphaTag = IccUtils.adnStringFieldToString(
+            mAlphaTag = IccUtils.adnStringFieldToString(
                             record, 0, record.length - FOOTER_SIZE_BYTES);
 
             int footerOffset = record.length - FOOTER_SIZE_BYTES;
@@ -294,7 +299,7 @@
 
             if (numberLength > MAX_NUMBER_SIZE_BYTES) {
                 // Invalid number length
-                number = "";
+                mNumber = "";
                 return;
             }
 
@@ -305,19 +310,19 @@
             // a service, the TON/NPI byte shall be set to 'FF' by
             // the ME (see note 2)."
 
-            number = PhoneNumberUtils.calledPartyBCDToString(
+            mNumber = PhoneNumberUtils.calledPartyBCDToString(
                             record, footerOffset + 1, numberLength);
 
 
-            extRecord = 0xff & record[record.length - 1];
+            mExtRecord = 0xff & record[record.length - 1];
 
-            emails = null;
+            mEmails = null;
 
         } catch (RuntimeException ex) {
             Rlog.w(LOG_TAG, "Error parsing AdnRecord", ex);
-            number = "";
-            alphaTag = "";
-            emails = null;
+            mNumber = "";
+            mAlphaTag = "";
+            mEmails = null;
         }
     }
 }
diff --git a/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java b/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java
index f7b5d8c..4b379a2 100644
--- a/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java
+++ b/src/java/com/android/internal/telephony/uicc/AdnRecordCache.java
@@ -19,7 +19,6 @@
 import android.os.AsyncResult;
 import android.os.Handler;
 import android.os.Message;
-import android.telephony.Rlog;
 import android.util.SparseArray;
 
 import com.android.internal.telephony.gsm.UsimPhoneBookManager;
@@ -37,15 +36,15 @@
     private UsimPhoneBookManager mUsimPhoneBookManager;
 
     // Indexed by EF ID
-    SparseArray<ArrayList<AdnRecord>> adnLikeFiles
+    SparseArray<ArrayList<AdnRecord>> mAdnLikeFiles
         = new SparseArray<ArrayList<AdnRecord>>();
 
     // People waiting for ADN-like files to be loaded
-    SparseArray<ArrayList<Message>> adnLikeWaiters
+    SparseArray<ArrayList<Message>> mAdnLikeWaiters
         = new SparseArray<ArrayList<Message>>();
 
     // People waiting for adn record to be updated
-    SparseArray<Message> userWriteResponse = new SparseArray<Message>();
+    SparseArray<Message> mUserWriteResponse = new SparseArray<Message>();
 
     //***** Event Constants
 
@@ -67,7 +66,7 @@
      * Called from SIMRecords.onRadioNotAvailable and SIMRecords.handleSimRefresh.
      */
     public void reset() {
-        adnLikeFiles.clear();
+        mAdnLikeFiles.clear();
         mUsimPhoneBookManager.reset();
 
         clearWaiters();
@@ -76,21 +75,21 @@
     }
 
     private void clearWaiters() {
-        int size = adnLikeWaiters.size();
+        int size = mAdnLikeWaiters.size();
         for (int i = 0; i < size; i++) {
-            ArrayList<Message> waiters = adnLikeWaiters.valueAt(i);
+            ArrayList<Message> waiters = mAdnLikeWaiters.valueAt(i);
             AsyncResult ar = new AsyncResult(null, null, new RuntimeException("AdnCache reset"));
             notifyWaiters(waiters, ar);
         }
-        adnLikeWaiters.clear();
+        mAdnLikeWaiters.clear();
     }
 
     private void clearUserWriters() {
-        int size = userWriteResponse.size();
+        int size = mUserWriteResponse.size();
         for (int i = 0; i < size; i++) {
-            sendErrorResponse(userWriteResponse.valueAt(i), "AdnCace reset");
+            sendErrorResponse(mUserWriteResponse.valueAt(i), "AdnCace reset");
         }
-        userWriteResponse.clear();
+        mUserWriteResponse.clear();
     }
 
     /**
@@ -99,7 +98,7 @@
      */
     public ArrayList<AdnRecord>
     getRecordsIfLoaded(int efid) {
-        return adnLikeFiles.get(efid);
+        return mAdnLikeFiles.get(efid);
     }
 
     /**
@@ -147,13 +146,13 @@
             return;
         }
 
-        Message pendingResponse = userWriteResponse.get(efid);
+        Message pendingResponse = mUserWriteResponse.get(efid);
         if (pendingResponse != null) {
             sendErrorResponse(response, "Have pending update for EF:" + efid);
             return;
         }
 
-        userWriteResponse.put(efid, response);
+        mUserWriteResponse.put(efid, response);
 
         new AdnRecordLoader(mFh).updateEF(adn, efid, extensionEF,
                 recordIndex, pin2,
@@ -215,23 +214,23 @@
 
         if (efid == EF_PBR) {
             AdnRecord foundAdn = oldAdnList.get(index-1);
-            efid = foundAdn.efid;
-            extensionEF = foundAdn.extRecord;
-            index = foundAdn.recordNumber;
+            efid = foundAdn.mEfid;
+            extensionEF = foundAdn.mExtRecord;
+            index = foundAdn.mRecordNumber;
 
-            newAdn.efid = efid;
-            newAdn.extRecord = extensionEF;
-            newAdn.recordNumber = index;
+            newAdn.mEfid = efid;
+            newAdn.mExtRecord = extensionEF;
+            newAdn.mRecordNumber = index;
         }
 
-        Message pendingResponse = userWriteResponse.get(efid);
+        Message pendingResponse = mUserWriteResponse.get(efid);
 
         if (pendingResponse != null) {
             sendErrorResponse(response, "Have pending update for EF:" + efid);
             return;
         }
 
-        userWriteResponse.put(efid, response);
+        mUserWriteResponse.put(efid, response);
 
         new AdnRecordLoader(mFh).updateEF(newAdn, efid, extensionEF,
                 index, pin2,
@@ -266,7 +265,7 @@
 
         // Have we already *started* loading this efid?
 
-        waiters = adnLikeWaiters.get(efid);
+        waiters = mAdnLikeWaiters.get(efid);
 
         if (waiters != null) {
             // There's a pending request for this EF already
@@ -281,7 +280,7 @@
         waiters = new ArrayList<Message>();
         waiters.add(response);
 
-        adnLikeWaiters.put(efid, waiters);
+        mAdnLikeWaiters.put(efid, waiters);
 
 
         if (extensionEf < 0) {
@@ -319,6 +318,7 @@
 
     //***** Overridden from Handler
 
+    @Override
     public void
     handleMessage(Message msg) {
         AsyncResult ar;
@@ -331,11 +331,11 @@
                 efid = msg.arg1;
                 ArrayList<Message> waiters;
 
-                waiters = adnLikeWaiters.get(efid);
-                adnLikeWaiters.delete(efid);
+                waiters = mAdnLikeWaiters.get(efid);
+                mAdnLikeWaiters.delete(efid);
 
                 if (ar.exception == null) {
-                    adnLikeFiles.put(efid, (ArrayList<AdnRecord>) ar.result);
+                    mAdnLikeFiles.put(efid, (ArrayList<AdnRecord>) ar.result);
                 }
                 notifyWaiters(waiters, ar);
                 break;
@@ -346,12 +346,12 @@
                 AdnRecord adn = (AdnRecord) (ar.userObj);
 
                 if (ar.exception == null) {
-                    adnLikeFiles.get(efid).set(index - 1, adn);
+                    mAdnLikeFiles.get(efid).set(index - 1, adn);
                     mUsimPhoneBookManager.invalidateCache();
                 }
 
-                Message response = userWriteResponse.get(efid);
-                userWriteResponse.delete(efid);
+                Message response = mUserWriteResponse.get(efid);
+                mUserWriteResponse.delete(efid);
 
                 AsyncResult.forMessage(response, null, ar.exception);
                 response.sendToTarget();
diff --git a/src/java/com/android/internal/telephony/uicc/AdnRecordLoader.java b/src/java/com/android/internal/telephony/uicc/AdnRecordLoader.java
index 4de69d1..8df8216 100644
--- a/src/java/com/android/internal/telephony/uicc/AdnRecordLoader.java
+++ b/src/java/com/android/internal/telephony/uicc/AdnRecordLoader.java
@@ -25,26 +25,27 @@
 import android.telephony.Rlog;
 
 public class AdnRecordLoader extends Handler {
-    final static String LOG_TAG = "RIL_AdnRecordLoader";
+    final static String LOG_TAG = "AdnRecordLoader";
+    final static boolean VDBG = false;
 
     //***** Instance Variables
 
     private IccFileHandler mFh;
-    int ef;
-    int extensionEF;
-    int pendingExtLoads;
-    Message userResponse;
-    String pin2;
+    int mEf;
+    int mExtensionEF;
+    int mPendingExtLoads;
+    Message mUserResponse;
+    String mPin2;
 
     // For "load one"
-    int recordNumber;
+    int mRecordNumber;
 
     // for "load all"
-    ArrayList<AdnRecord> adns; // only valid after EVENT_ADN_LOAD_ALL_DONE
+    ArrayList<AdnRecord> mAdns; // only valid after EVENT_ADN_LOAD_ALL_DONE
 
     // Either an AdnRecord or a reference to adns depending
     // if this is a load one or load all operation
-    Object result;
+    Object mResult;
 
     //***** Event Constants
 
@@ -70,10 +71,10 @@
     public void
     loadFromEF(int ef, int extensionEF, int recordNumber,
                 Message response) {
-        this.ef = ef;
-        this.extensionEF = extensionEF;
-        this.recordNumber = recordNumber;
-        this.userResponse = response;
+        mEf = ef;
+        mExtensionEF = extensionEF;
+        mRecordNumber = recordNumber;
+        mUserResponse = response;
 
         mFh.loadEFLinearFixed(
                     ef, recordNumber,
@@ -89,9 +90,9 @@
     public void
     loadAllFromEF(int ef, int extensionEF,
                 Message response) {
-        this.ef = ef;
-        this.extensionEF = extensionEF;
-        this.userResponse = response;
+        mEf = ef;
+        mExtensionEF = extensionEF;
+        mUserResponse = response;
 
         mFh.loadEFLinearFixedAll(
                     ef,
@@ -114,11 +115,11 @@
     public void
     updateEF(AdnRecord adn, int ef, int extensionEF, int recordNumber,
             String pin2, Message response) {
-        this.ef = ef;
-        this.extensionEF = extensionEF;
-        this.recordNumber = recordNumber;
-        this.userResponse = response;
-        this.pin2 = pin2;
+        mEf = ef;
+        mExtensionEF = extensionEF;
+        mRecordNumber = recordNumber;
+        mUserResponse = response;
+        mPin2 = pin2;
 
         mFh.getEFLinearRecordSize( ef,
             obtainMessage(EVENT_EF_LINEAR_RECORD_SIZE_DONE, adn));
@@ -126,6 +127,7 @@
 
     //***** Overridden from Handler
 
+    @Override
     public void
     handleMessage(Message msg) {
         AsyncResult ar;
@@ -149,7 +151,7 @@
                     // int[1]  is the total length of the EF file
                     // int[2]  is the number of records in the EF file
                     // So int[0] * int[2] = int[1]
-                   if (recordSize.length != 3 || recordNumber > recordSize[2]) {
+                   if (recordSize.length != 3 || mRecordNumber > recordSize[2]) {
                         throw new RuntimeException("get wrong EF record size format",
                                 ar.exception);
                     }
@@ -161,10 +163,10 @@
                                 ar.exception);
                     }
 
-                    mFh.updateEFLinearFixed(ef, recordNumber,
-                            data, pin2, obtainMessage(EVENT_UPDATE_RECORD_DONE));
+                    mFh.updateEFLinearFixed(mEf, mRecordNumber,
+                            data, mPin2, obtainMessage(EVENT_UPDATE_RECORD_DONE));
 
-                    pendingExtLoads = 1;
+                    mPendingExtLoads = 1;
 
                     break;
                 case EVENT_UPDATE_RECORD_DONE:
@@ -173,8 +175,8 @@
                         throw new RuntimeException("update EF adn record failed",
                                 ar.exception);
                     }
-                    pendingExtLoads = 0;
-                    result = null;
+                    mPendingExtLoads = 0;
+                    mResult = null;
                     break;
                 case EVENT_ADN_LOAD_DONE:
                     ar = (AsyncResult)(msg.obj);
@@ -184,25 +186,25 @@
                         throw new RuntimeException("load failed", ar.exception);
                     }
 
-                    if (false) {
+                    if (VDBG) {
                         Rlog.d(LOG_TAG,"ADN EF: 0x"
-                            + Integer.toHexString(ef)
-                            + ":" + recordNumber
+                            + Integer.toHexString(mEf)
+                            + ":" + mRecordNumber
                             + "\n" + IccUtils.bytesToHexString(data));
                     }
 
-                    adn = new AdnRecord(ef, recordNumber, data);
-                    result = adn;
+                    adn = new AdnRecord(mEf, mRecordNumber, data);
+                    mResult = adn;
 
                     if (adn.hasExtendedRecord()) {
                         // If we have a valid value in the ext record field,
                         // we're not done yet: we need to read the corresponding
                         // ext record and append it
 
-                        pendingExtLoads = 1;
+                        mPendingExtLoads = 1;
 
                         mFh.loadEFLinearFixed(
-                            extensionEF, adn.extRecord,
+                            mExtensionEF, adn.mExtRecord,
                             obtainMessage(EVENT_EXT_RECORD_LOAD_DONE, adn));
                     }
                 break;
@@ -217,13 +219,13 @@
                     }
 
                     Rlog.d(LOG_TAG,"ADN extension EF: 0x"
-                        + Integer.toHexString(extensionEF)
-                        + ":" + adn.extRecord
+                        + Integer.toHexString(mExtensionEF)
+                        + ":" + adn.mExtRecord
                         + "\n" + IccUtils.bytesToHexString(data));
 
                     adn.appendExtRecord(data);
 
-                    pendingExtLoads--;
+                    mPendingExtLoads--;
                     // result should have been set in
                     // EVENT_ADN_LOAD_DONE or EVENT_ADN_LOAD_ALL_DONE
                 break;
@@ -236,46 +238,46 @@
                         throw new RuntimeException("load failed", ar.exception);
                     }
 
-                    adns = new ArrayList<AdnRecord>(datas.size());
-                    result = adns;
-                    pendingExtLoads = 0;
+                    mAdns = new ArrayList<AdnRecord>(datas.size());
+                    mResult = mAdns;
+                    mPendingExtLoads = 0;
 
                     for(int i = 0, s = datas.size() ; i < s ; i++) {
-                        adn = new AdnRecord(ef, 1 + i, datas.get(i));
-                        adns.add(adn);
+                        adn = new AdnRecord(mEf, 1 + i, datas.get(i));
+                        mAdns.add(adn);
 
                         if (adn.hasExtendedRecord()) {
                             // If we have a valid value in the ext record field,
                             // we're not done yet: we need to read the corresponding
                             // ext record and append it
 
-                            pendingExtLoads++;
+                            mPendingExtLoads++;
 
                             mFh.loadEFLinearFixed(
-                                extensionEF, adn.extRecord,
+                                mExtensionEF, adn.mExtRecord,
                                 obtainMessage(EVENT_EXT_RECORD_LOAD_DONE, adn));
                         }
                     }
                 break;
             }
         } catch (RuntimeException exc) {
-            if (userResponse != null) {
-                AsyncResult.forMessage(userResponse)
+            if (mUserResponse != null) {
+                AsyncResult.forMessage(mUserResponse)
                                 .exception = exc;
-                userResponse.sendToTarget();
+                mUserResponse.sendToTarget();
                 // Loading is all or nothing--either every load succeeds
                 // or we fail the whole thing.
-                userResponse = null;
+                mUserResponse = null;
             }
             return;
         }
 
-        if (userResponse != null && pendingExtLoads == 0) {
-            AsyncResult.forMessage(userResponse).result
-                = result;
+        if (mUserResponse != null && mPendingExtLoads == 0) {
+            AsyncResult.forMessage(mUserResponse).result
+                = mResult;
 
-            userResponse.sendToTarget();
-            userResponse = null;
+            mUserResponse.sendToTarget();
+            mUserResponse = null;
         }
     }
 
diff --git a/src/java/com/android/internal/telephony/uicc/CsimFileHandler.java b/src/java/com/android/internal/telephony/uicc/CsimFileHandler.java
index 54f9a60..285b8be 100644
--- a/src/java/com/android/internal/telephony/uicc/CsimFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/CsimFileHandler.java
@@ -25,7 +25,7 @@
  * This class should be used to access files in CSIM ADF
  */
 public final class CsimFileHandler extends IccFileHandler implements IccConstants {
-    static final String LOG_TAG = "RIL_CsimFH";
+    static final String LOG_TAG = "CsimFH";
 
     public CsimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
         super(app, aid, ci);
diff --git a/src/java/com/android/internal/telephony/uicc/IccCardApplicationStatus.java b/src/java/com/android/internal/telephony/uicc/IccCardApplicationStatus.java
index db5065b..753f6fe 100644
--- a/src/java/com/android/internal/telephony/uicc/IccCardApplicationStatus.java
+++ b/src/java/com/android/internal/telephony/uicc/IccCardApplicationStatus.java
@@ -32,7 +32,7 @@
         APPTYPE_RUIM,
         APPTYPE_CSIM,
         APPTYPE_ISIM
-    };
+    }
 
     public enum AppState{
         APPSTATE_UNKNOWN,
@@ -62,7 +62,7 @@
             return this == APPSTATE_UNKNOWN  ||
                    this == APPSTATE_DETECTED;
         }
-    };
+    }
 
     public enum PersoSubState{
         PERSOSUBSTATE_UNKNOWN,
@@ -94,7 +94,7 @@
         boolean isPersoSubStateUnknown() {
             return this == PERSOSUBSTATE_UNKNOWN;
         }
-    };
+    }
 
     public AppType        app_type;
     public AppState       app_state;
diff --git a/src/java/com/android/internal/telephony/uicc/IccCardProxy.java b/src/java/com/android/internal/telephony/uicc/IccCardProxy.java
index e0e7124..733af64 100644
--- a/src/java/com/android/internal/telephony/uicc/IccCardProxy.java
+++ b/src/java/com/android/internal/telephony/uicc/IccCardProxy.java
@@ -35,12 +35,12 @@
 import com.android.internal.telephony.IccCard;
 import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.RILConstants;
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.IccCardConstants.State;
 import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
-import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
 import com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState;
 import com.android.internal.telephony.uicc.IccCardStatus.CardState;
 import com.android.internal.telephony.uicc.IccCardStatus.PinState;
@@ -56,7 +56,7 @@
  *
  * The Phone App assumes that there is only one icc card, and one icc application
  * available at a time. Moreover, it assumes such object (represented with IccCard)
- * is available all the time (whether {@link RILConstants.RIL_REQUEST_GET_SIM_STATUS} returned
+ * is available all the time (whether {@link RILConstants#RIL_REQUEST_GET_SIM_STATUS} returned
  * or not, whether card has desired application or not, whether there really is a card in the
  * slot or not).
  *
@@ -71,7 +71,7 @@
 
 public class IccCardProxy extends Handler implements IccCard {
     private static final boolean DBG = true;
-    private static final String LOG_TAG = "RIL_IccCardProxy";
+    private static final String LOG_TAG = "IccCardProxy";
 
     private static final int EVENT_RADIO_OFF_OR_UNAVAILABLE = 1;
     private static final int EVENT_RADIO_ON = 2;
@@ -106,8 +106,8 @@
 
     public IccCardProxy(Context context, CommandsInterface ci) {
         log("Creating");
-        this.mContext = context;
-        this.mCi = ci;
+        mContext = context;
+        mCi = ci;
         mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(context,
                 ci, this, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
         mUiccController = UiccController.getInstance();
@@ -198,6 +198,7 @@
         }
     }
 
+    @Override
     public void handleMessage(Message msg) {
         switch (msg.what) {
             case EVENT_RADIO_OFF_OR_UNAVAILABLE:
@@ -374,6 +375,12 @@
                 case APPSTATE_PUK:
                     setExternalState(State.PUK_REQUIRED);
                     break;
+                case APPSTATE_DETECTED:
+                case APPSTATE_READY:
+                case APPSTATE_SUBSCRIPTION_PERSO:
+                case APPSTATE_UNKNOWN:
+                    // Neither required
+                    break;
             }
         }
     }
diff --git a/src/java/com/android/internal/telephony/uicc/IccCardStatus.java b/src/java/com/android/internal/telephony/uicc/IccCardStatus.java
index a4fbc1f..fe5c77b 100644
--- a/src/java/com/android/internal/telephony/uicc/IccCardStatus.java
+++ b/src/java/com/android/internal/telephony/uicc/IccCardStatus.java
@@ -16,9 +16,6 @@
 
 package com.android.internal.telephony.uicc;
 
-
-import java.util.ArrayList;
-
 /**
  * See also RIL_CardStatus in include/telephony/ril.h
  *
diff --git a/src/java/com/android/internal/telephony/uicc/IccFileHandler.java b/src/java/com/android/internal/telephony/uicc/IccFileHandler.java
index ae460ba..c2091ee 100644
--- a/src/java/com/android/internal/telephony/uicc/IccFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/IccFileHandler.java
@@ -17,8 +17,6 @@
 package com.android.internal.telephony.uicc;
 
 import android.os.*;
-import android.telephony.Rlog;
-
 import com.android.internal.telephony.CommandsInterface;
 
 import java.util.ArrayList;
@@ -101,26 +99,26 @@
 
     static class LoadLinearFixedContext {
 
-        int efid;
-        int recordNum, recordSize, countRecords;
-        boolean loadAll;
+        int mEfid;
+        int mRecordNum, mRecordSize, mCountRecords;
+        boolean mLoadAll;
 
-        Message onLoaded;
+        Message mOnLoaded;
 
         ArrayList<byte[]> results;
 
         LoadLinearFixedContext(int efid, int recordNum, Message onLoaded) {
-            this.efid = efid;
-            this.recordNum = recordNum;
-            this.onLoaded = onLoaded;
-            this.loadAll = false;
+            mEfid = efid;
+            mRecordNum = recordNum;
+            mOnLoaded = onLoaded;
+            mLoadAll = false;
         }
 
         LoadLinearFixedContext(int efid, Message onLoaded) {
-            this.efid = efid;
-            this.recordNum = 1;
-            this.loadAll = true;
-            this.onLoaded = onLoaded;
+            mEfid = efid;
+            mRecordNum = 1;
+            mLoadAll = true;
+            mOnLoaded = onLoaded;
         }
     }
 
@@ -320,6 +318,7 @@
 
     //***** Overridden from Handler
 
+    @Override
     public void handleMessage(Message msg) {
         AsyncResult ar;
         IccIoResult result;
@@ -341,7 +340,7 @@
                 ar = (AsyncResult) msg.obj;
                 lc = (LoadLinearFixedContext) ar.userObj;
                 result = (IccIoResult) ar.result;
-                response = lc.onLoaded;
+                response = lc.mOnLoaded;
 
                 if (ar.exception != null) {
                     sendResult(response, null, ar.exception);
@@ -356,7 +355,7 @@
                 }
 
                 data = result.payload;
-                lc.recordSize = data[RESPONSE_DATA_RECORD_LENGTH] & 0xFF;
+                lc.mRecordSize = data[RESPONSE_DATA_RECORD_LENGTH] & 0xFF;
 
                 if ((TYPE_EF != data[RESPONSE_DATA_FILE_TYPE]) ||
                     (EF_TYPE_LINEAR_FIXED != data[RESPONSE_DATA_STRUCTURE])) {
@@ -365,10 +364,10 @@
                 }
 
                 logd("IccFileHandler: read EF IMG");
-                mCi.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
-                        lc.recordNum,
+                mCi.iccIOForApp(COMMAND_READ_RECORD, lc.mEfid, getEFPath(lc.mEfid),
+                        lc.mRecordNum,
                         READ_RECORD_MODE_ABSOLUTE,
-                        lc.recordSize, null, null, mAid,
+                        lc.mRecordSize, null, null, mAid,
                         obtainMessage(EVENT_READ_IMG_DONE, IccConstants.EF_IMG, 0, response));
                 break;
 
@@ -376,7 +375,7 @@
                 ar = (AsyncResult) msg.obj;
                 lc = (LoadLinearFixedContext) ar.userObj;
                 result = (IccIoResult) ar.result;
-                response = lc.onLoaded;
+                response = lc.mOnLoaded;
 
                 iccException = result.getException();
                 if (iccException != null) {
@@ -397,7 +396,7 @@
                 ar = (AsyncResult)msg.obj;
                 lc = (LoadLinearFixedContext) ar.userObj;
                 result = (IccIoResult) ar.result;
-                response = lc.onLoaded;
+                response = lc.mOnLoaded;
 
                 if (ar.exception != null) {
                     sendResult(response, null, ar.exception);
@@ -429,7 +428,7 @@
                 ar = (AsyncResult)msg.obj;
                 lc = (LoadLinearFixedContext) ar.userObj;
                 result = (IccIoResult) ar.result;
-                response = lc.onLoaded;
+                response = lc.mOnLoaded;
 
                 if (ar.exception != null) {
                     sendResult(response, null, ar.exception);
@@ -444,8 +443,8 @@
                 }
 
                 data = result.payload;
-                fileid = lc.efid;
-                recordNum = lc.recordNum;
+                fileid = lc.mEfid;
+                recordNum = lc.mRecordNum;
 
                 if (TYPE_EF != data[RESPONSE_DATA_FILE_TYPE]) {
                     throw new IccFileTypeMismatch();
@@ -455,21 +454,21 @@
                     throw new IccFileTypeMismatch();
                 }
 
-                lc.recordSize = data[RESPONSE_DATA_RECORD_LENGTH] & 0xFF;
+                lc.mRecordSize = data[RESPONSE_DATA_RECORD_LENGTH] & 0xFF;
 
                 size = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8)
                        + (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff);
 
-                lc.countRecords = size / lc.recordSize;
+                lc.mCountRecords = size / lc.mRecordSize;
 
-                 if (lc.loadAll) {
-                     lc.results = new ArrayList<byte[]>(lc.countRecords);
+                 if (lc.mLoadAll) {
+                     lc.results = new ArrayList<byte[]>(lc.mCountRecords);
                  }
 
-                 mCi.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
-                         lc.recordNum,
+                 mCi.iccIOForApp(COMMAND_READ_RECORD, lc.mEfid, getEFPath(lc.mEfid),
+                         lc.mRecordNum,
                          READ_RECORD_MODE_ABSOLUTE,
-                         lc.recordSize, null, null, mAid,
+                         lc.mRecordSize, null, null, mAid,
                          obtainMessage(EVENT_READ_RECORD_DONE, lc));
                  break;
             case EVENT_GET_BINARY_SIZE_DONE:
@@ -515,7 +514,7 @@
                 ar = (AsyncResult)msg.obj;
                 lc = (LoadLinearFixedContext) ar.userObj;
                 result = (IccIoResult) ar.result;
-                response = lc.onLoaded;
+                response = lc.mOnLoaded;
 
                 if (ar.exception != null) {
                     sendResult(response, null, ar.exception);
@@ -529,20 +528,20 @@
                     break;
                 }
 
-                if (!lc.loadAll) {
+                if (!lc.mLoadAll) {
                     sendResult(response, result.payload, null);
                 } else {
                     lc.results.add(result.payload);
 
-                    lc.recordNum++;
+                    lc.mRecordNum++;
 
-                    if (lc.recordNum > lc.countRecords) {
+                    if (lc.mRecordNum > lc.mCountRecords) {
                         sendResult(response, lc.results, null);
                     } else {
-                        mCi.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
-                                    lc.recordNum,
+                        mCi.iccIOForApp(COMMAND_READ_RECORD, lc.mEfid, getEFPath(lc.mEfid),
+                                    lc.mRecordNum,
                                     READ_RECORD_MODE_ABSOLUTE,
-                                    lc.recordSize, null, null, mAid,
+                                    lc.mRecordSize, null, null, mAid,
                                     obtainMessage(EVENT_READ_RECORD_DONE, lc));
                     }
                 }
@@ -585,7 +584,7 @@
      * This function handles only EFids that are common to
      * RUIM, SIM, USIM and other types of Icc cards.
      *
-     * @param efId
+     * @param efid of path to retrieve
      * @return root path of the file.
      */
     protected String getCommonIccEFPath(int efid) {
diff --git a/src/java/com/android/internal/telephony/uicc/IccIoResult.java b/src/java/com/android/internal/telephony/uicc/IccIoResult.java
index 281a391..6f0b5c3 100644
--- a/src/java/com/android/internal/telephony/uicc/IccIoResult.java
+++ b/src/java/com/android/internal/telephony/uicc/IccIoResult.java
@@ -37,6 +37,7 @@
         this(sw1, sw2, IccUtils.hexStringToBytes(hexString));
     }
 
+    @Override
     public String toString() {
         return "IccIoResponse sw1:0x" + Integer.toHexString(sw1) + " sw2:0x"
                 + Integer.toHexString(sw2);
diff --git a/src/java/com/android/internal/telephony/uicc/IccRecords.java b/src/java/com/android/internal/telephony/uicc/IccRecords.java
index 38da633..0692876 100644
--- a/src/java/com/android/internal/telephony/uicc/IccRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/IccRecords.java
@@ -33,8 +33,8 @@
  * {@hide}
  */
 public abstract class IccRecords extends Handler implements IccConstants {
-
     protected static final boolean DBG = true;
+
     // ***** Instance Variables
     protected AtomicBoolean mDestroyed = new AtomicBoolean(false);
     protected Context mContext;
@@ -48,29 +48,29 @@
     protected RegistrantList mNewSmsRegistrants = new RegistrantList();
     protected RegistrantList mNetworkSelectionModeAutomaticRegistrants = new RegistrantList();
 
-    protected int recordsToLoad;  // number of pending load requests
+    protected int mRecordsToLoad;  // number of pending load requests
 
-    protected AdnRecordCache adnCache;
+    protected AdnRecordCache mAdnCache;
 
     // ***** Cached SIM State; cleared on channel close
 
-    protected boolean recordsRequested = false; // true if we've made requests for the sim records
+    protected boolean mRecordsRequested = false; // true if we've made requests for the sim records
 
-    public String iccid;
-    protected String msisdn = null;  // My mobile number
-    protected String msisdnTag = null;
-    protected String voiceMailNum = null;
-    protected String voiceMailTag = null;
-    protected String newVoiceMailNum = null;
-    protected String newVoiceMailTag = null;
-    protected boolean isVoiceMailFixed = false;
-    protected int countVoiceMessages = 0;
+    public String iccId;
+    protected String mMsisdn = null;  // My mobile number
+    protected String mMsisdnTag = null;
+    protected String mVoiceMailNum = null;
+    protected String mVoiceMailTag = null;
+    protected String mNewVoiceMailNum = null;
+    protected String mNewVoiceMailTag = null;
+    protected boolean mIsVoiceMailFixed = false;
+    protected int mCountVoiceMessages = 0;
     protected String mImsi;
 
-    protected int mncLength = UNINITIALIZED;
-    protected int mailboxIndex = 0; // 0 is no mailbox dailing number associated
+    protected int mMncLength = UNINITIALIZED;
+    protected int mMailboxIndex = 0; // 0 is no mailbox dailing number associated
 
-    protected String spn;
+    protected String mSpn;
 
     // ***** Constants
 
@@ -79,8 +79,8 @@
     protected static final int UNKNOWN = 0;
 
     // Bitmasks for SPN display rules.
-    protected static final int SPN_RULE_SHOW_SPN  = 0x01;
-    protected static final int SPN_RULE_SHOW_PLMN = 0x02;
+    public static final int SPN_RULE_SHOW_SPN  = 0x01;
+    public static final int SPN_RULE_SHOW_PLMN = 0x02;
 
     // ***** Event Constants
     protected static final int EVENT_SET_MSISDN_DONE = 30;
@@ -90,12 +90,44 @@
 
     public static final int EVENT_GET_ICC_RECORD_DONE = 100;
 
+    @Override
+    public String toString() {
+        return "mDestroyed=" + mDestroyed
+                + " mContext=" + mContext
+                + " mCi=" + mCi
+                + " mFh=" + mFh
+                + " mParentApp=" + mParentApp
+                + " recordsLoadedRegistrants=" + recordsLoadedRegistrants
+                + " mImsiReadyRegistrants=" + mImsiReadyRegistrants
+                + " mRecordsEventsRegistrants=" + mRecordsEventsRegistrants
+                + " mNewSmsRegistrants=" + mNewSmsRegistrants
+                + " mNetworkSelectionModeAutomaticRegistrants="
+                        + mNetworkSelectionModeAutomaticRegistrants
+                + " recordsToLoad=" + mRecordsToLoad
+                + " adnCache=" + mAdnCache
+                + " recordsRequested=" + mRecordsRequested
+                + " iccid=" + iccId
+                + " msisdn=" + mMsisdn
+                + " msisdnTag=" + mMsisdnTag
+                + " voiceMailNum=" + mVoiceMailNum
+                + " voiceMailTag=" + mVoiceMailTag
+                + " newVoiceMailNum=" + mNewVoiceMailNum
+                + " newVoiceMailTag=" + mNewVoiceMailTag
+                + " isVoiceMailFixed=" + mIsVoiceMailFixed
+                + " countVoiceMessages=" + mCountVoiceMessages
+                + " mImsi=" + mImsi
+                + " mncLength=" + mMncLength
+                + " mailboxIndex=" + mMailboxIndex
+                + " spn=" + mSpn;
+
+    }
+
     /**
      * Generic ICC record loaded callback. Subclasses can call EF load methods on
      * {@link IccFileHandler} passing a Message for onLoaded with the what field set to
      * {@link #EVENT_GET_ICC_RECORD_DONE} and the obj field set to an instance
      * of this interface. The {@link #handleMessage} method in this class will print a
-     * log message using {@link #getEfName()} and decrement {@link #recordsToLoad}.
+     * log message using {@link #getEfName()} and decrement {@link #mRecordsToLoad}.
      *
      * If the record load was successful, {@link #onRecordLoaded} will be called with the result.
      * Otherwise, an error log message will be output by {@link #handleMessage} and
@@ -129,7 +161,7 @@
 
     //***** Public Methods
     public AdnRecordCache getAdnCache() {
-        return adnCache;
+        return mAdnCache;
     }
 
     public void registerForRecordsLoaded(Handler h, int what, Object obj) {
@@ -140,7 +172,7 @@
         Registrant r = new Registrant(h, what, obj);
         recordsLoadedRegistrants.add(r);
 
-        if (recordsToLoad == 0 && recordsRequested == true) {
+        if (mRecordsToLoad == 0 && mRecordsRequested == true) {
             r.notifyRegistrant(new AsyncResult(null, null, null));
         }
     }
@@ -205,12 +237,12 @@
      * @param imsi
      */
     public void setImsi(String imsi) {
-        this.mImsi = imsi;
+        mImsi = imsi;
         mImsiReadyRegistrants.notifyRegistrants();
     }
 
     public String getMsisdnNumber() {
-        return msisdn;
+        return mMsisdn;
     }
 
     /**
@@ -231,24 +263,24 @@
     public void setMsisdnNumber(String alphaTag, String number,
             Message onComplete) {
 
-        msisdn = number;
-        msisdnTag = alphaTag;
+        mMsisdn = number;
+        mMsisdnTag = alphaTag;
 
-        if(DBG) log("Set MSISDN: " + msisdnTag +" " + msisdn);
+        if (DBG) log("Set MSISDN: " + mMsisdnTag +" " + mMsisdn);
 
 
-        AdnRecord adn = new AdnRecord(msisdnTag, msisdn);
+        AdnRecord adn = new AdnRecord(mMsisdnTag, mMsisdn);
 
         new AdnRecordLoader(mFh).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
                 obtainMessage(EVENT_SET_MSISDN_DONE, onComplete));
     }
 
     public String getMsisdnAlphaTag() {
-        return msisdnTag;
+        return mMsisdnTag;
     }
 
     public String getVoiceMailNumber() {
-        return voiceMailNum;
+        return mVoiceMailNum;
     }
 
     /**
@@ -256,7 +288,7 @@
      * @return null if SIM is not yet ready or no RUIM entry
      */
     public String getServiceProviderName() {
-        return spn;
+        return mSpn;
     }
 
     /**
@@ -287,7 +319,7 @@
             Message onComplete);
 
     public String getVoiceMailAlphaTag() {
-        return voiceMailTag;
+        return mVoiceMailTag;
     }
 
     /**
@@ -301,7 +333,7 @@
 
     /** @return  true if there are messages waiting, false otherwise. */
     public boolean getVoiceMessageWaiting() {
-        return countVoiceMessages != 0;
+        return mCountVoiceMessages != 0;
     }
 
     /**
@@ -310,7 +342,7 @@
      * getVoiceMessageWaiting() is true
      */
     public int getVoiceMessageCount() {
-        return countVoiceMessages;
+        return mCountVoiceMessages;
     }
 
     /**
@@ -322,7 +354,7 @@
 
 
     public boolean getRecordsLoaded() {
-        if (recordsToLoad == 0 && recordsRequested == true) {
+        if (mRecordsToLoad == 0 && mRecordsRequested == true) {
             return true;
         } else {
             return false;
@@ -477,22 +509,22 @@
             pw.println("  mNetworkSelectionModeAutomaticRegistrants[" + i + "]="
                     + ((Registrant)mNetworkSelectionModeAutomaticRegistrants.get(i)).getHandler());
         }
-        pw.println(" recordsRequested=" + recordsRequested);
-        pw.println(" recordsToLoad=" + recordsToLoad);
-        pw.println(" adnCache=" + adnCache);
-        pw.println(" iccid=" + iccid);
-        pw.println(" msisdn=" + msisdn);
-        pw.println(" msisdnTag=" + msisdnTag);
-        pw.println(" voiceMailNum=" + voiceMailNum);
-        pw.println(" voiceMailTag=" + voiceMailTag);
-        pw.println(" newVoiceMailNum=" + newVoiceMailNum);
-        pw.println(" newVoiceMailTag=" + newVoiceMailTag);
-        pw.println(" isVoiceMailFixed=" + isVoiceMailFixed);
-        pw.println(" countVoiceMessages=" + countVoiceMessages);
+        pw.println(" mRecordsRequested=" + mRecordsRequested);
+        pw.println(" mRecordsToLoad=" + mRecordsToLoad);
+        pw.println(" mRdnCache=" + mAdnCache);
+        pw.println(" iccid=" + iccId);
+        pw.println(" mMsisdn=" + mMsisdn);
+        pw.println(" mMsisdnTag=" + mMsisdnTag);
+        pw.println(" mVoiceMailNum=" + mVoiceMailNum);
+        pw.println(" mVoiceMailTag=" + mVoiceMailTag);
+        pw.println(" mNewVoiceMailNum=" + mNewVoiceMailNum);
+        pw.println(" mNewVoiceMailTag=" + mNewVoiceMailTag);
+        pw.println(" mIsVoiceMailFixed=" + mIsVoiceMailFixed);
+        pw.println(" mCountVoiceMessages=" + mCountVoiceMessages);
         pw.println(" mImsi=" + mImsi);
-        pw.println(" mncLength=" + mncLength);
-        pw.println(" mailboxIndex=" + mailboxIndex);
-        pw.println(" spn=" + spn);
+        pw.println(" mMncLength=" + mMncLength);
+        pw.println(" mMailboxIndex=" + mMailboxIndex);
+        pw.println(" mSpn=" + mSpn);
         pw.flush();
     }
 }
diff --git a/src/java/com/android/internal/telephony/uicc/IccServiceTable.java b/src/java/com/android/internal/telephony/uicc/IccServiceTable.java
index 2b5b2de..a96d499 100644
--- a/src/java/com/android/internal/telephony/uicc/IccServiceTable.java
+++ b/src/java/com/android/internal/telephony/uicc/IccServiceTable.java
@@ -51,6 +51,7 @@
         return (mServiceTable[offset] & (1 << bit)) != 0;
     }
 
+    @Override
     public String toString() {
         Object[] values = getValues();
         int numBytes = mServiceTable.length;
diff --git a/src/java/com/android/internal/telephony/uicc/IccUtils.java b/src/java/com/android/internal/telephony/uicc/IccUtils.java
index 8b84bfe..3c2f1f3 100644
--- a/src/java/com/android/internal/telephony/uicc/IccUtils.java
+++ b/src/java/com/android/internal/telephony/uicc/IccUtils.java
@@ -24,8 +24,6 @@
 
 import com.android.internal.telephony.GsmAlphabet;
 import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
 
 /**
  * Various methods, useful for dealing with SIM data.
@@ -118,7 +116,7 @@
     }
 
     /**
-     * Decodes a CDMA style BCD byte like {@link gsmBcdByteToInt}, but
+     * Decodes a CDMA style BCD byte like {@link #gsmBcdByteToInt}, but
      * opposite nibble format. The least significant BCD digit
      * is in the least significant nibble and the most significant
      * is in the most significant nibble.
@@ -406,7 +404,7 @@
                 bitIndex = 7;
             }
             pixels[pixelIndex++] = bitToRGB((currentByte >> bitIndex-- ) & 0x01);
-        };
+        }
 
         if (pixelIndex != numOfPixels) {
             Rlog.e(LOG_TAG, "parse end and size error");
diff --git a/src/java/com/android/internal/telephony/uicc/IsimFileHandler.java b/src/java/com/android/internal/telephony/uicc/IsimFileHandler.java
index d7f2e40..07c5ec8 100644
--- a/src/java/com/android/internal/telephony/uicc/IsimFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/IsimFileHandler.java
@@ -25,7 +25,7 @@
  * This class should be used to access files in ISIM ADF
  */
 public final class IsimFileHandler extends IccFileHandler implements IccConstants {
-    static final String LOG_TAG = "RIL_IsimFH";
+    static final String LOG_TAG = "IsimFH";
 
     public IsimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
         super(app, aid, ci);
diff --git a/src/java/com/android/internal/telephony/uicc/IsimUiccRecords.java b/src/java/com/android/internal/telephony/uicc/IsimUiccRecords.java
index 2330aa8..a7d4433 100644
--- a/src/java/com/android/internal/telephony/uicc/IsimUiccRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/IsimUiccRecords.java
@@ -40,7 +40,7 @@
  * {@hide}
  */
 public final class IsimUiccRecords extends IccRecords implements IsimRecords {
-    protected static final String LOG_TAG = "GSM";
+    protected static final String LOG_TAG = "IsimUiccRecords";
 
     private static final boolean DBG = true;
     private static final boolean DUMP_RECORDS = false;   // Note: PII is logged when this is true
@@ -54,15 +54,24 @@
 
     private static final int TAG_ISIM_VALUE = 0x80;     // From 3GPP TS 31.103
 
+    @Override
+    public String toString() {
+        return "IsimUiccRecords: " + super.toString()
+                + " mIsimImpi=" + mIsimImpi
+                + " mIsimDomain=" + mIsimDomain
+                + " mIsimImpu=" + mIsimImpu;
+    }
+
     public IsimUiccRecords(UiccCardApplication app, Context c, CommandsInterface ci) {
         super(app, c, ci);
 
-        recordsRequested = false;  // No load request is made till SIM ready
+        mRecordsRequested = false;  // No load request is made till SIM ready
 
         // recordsToLoad is set to 0 because no requests are made yet
-        recordsToLoad = 0;
+        mRecordsToLoad = 0;
 
         mParentApp.registerForReady(this, EVENT_APP_READY, null);
+        if (DBG) log("IsimUiccRecords X ctor this=" + this);
     }
 
     @Override
@@ -99,28 +108,28 @@
     }
 
     protected void fetchIsimRecords() {
-        recordsRequested = true;
+        mRecordsRequested = true;
 
         mFh.loadEFTransparent(EF_IMPI, obtainMessage(
                 IccRecords.EVENT_GET_ICC_RECORD_DONE, new EfIsimImpiLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFLinearFixedAll(EF_IMPU, obtainMessage(
                 IccRecords.EVENT_GET_ICC_RECORD_DONE, new EfIsimImpuLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_DOMAIN, obtainMessage(
                 IccRecords.EVENT_GET_ICC_RECORD_DONE, new EfIsimDomainLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
-        log("fetchIsimRecords " + recordsToLoad);
+        log("fetchIsimRecords " + mRecordsToLoad);
     }
 
     protected void resetRecords() {
         // recordsRequested is set to false indicating that the SIM
         // read requests made so far are not valid. This is set to
         // true only when fresh set of read requests are made.
-        recordsRequested = false;
+        mRecordsRequested = false;
     }
 
     private class EfIsimImpiLoaded implements IccRecords.IccRecordLoaded {
@@ -184,13 +193,13 @@
     protected void onRecordLoaded() {
         // One record loaded successfully or failed, In either case
         // we need to update the recordsToLoad count
-        recordsToLoad -= 1;
+        mRecordsToLoad -= 1;
 
-        if (recordsToLoad == 0 && recordsRequested == true) {
+        if (mRecordsToLoad == 0 && mRecordsRequested == true) {
             onAllRecordsLoaded();
-        } else if (recordsToLoad < 0) {
+        } else if (mRecordsToLoad < 0) {
             loge("recordsToLoad <0, programmer error suspected");
-            recordsToLoad = 0;
+            mRecordsToLoad = 0;
         }
     }
 
diff --git a/src/java/com/android/internal/telephony/uicc/RuimFileHandler.java b/src/java/com/android/internal/telephony/uicc/RuimFileHandler.java
index 180b277..a581314 100644
--- a/src/java/com/android/internal/telephony/uicc/RuimFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/RuimFileHandler.java
@@ -25,7 +25,7 @@
  * {@hide}
  */
 public final class RuimFileHandler extends IccFileHandler {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "RuimFH";
 
     //***** Instance Variables
 
diff --git a/src/java/com/android/internal/telephony/uicc/RuimRecords.java b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
index c7d1070..c16ef09 100755
--- a/src/java/com/android/internal/telephony/uicc/RuimRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
@@ -30,22 +30,14 @@
 import java.util.Locale;
 import android.content.Context;
 import android.os.AsyncResult;
-import android.os.Handler;
 import android.os.Message;
-import android.os.Registrant;
 import android.os.SystemProperties;
 import android.telephony.Rlog;
 
 import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.GsmAlphabet;
-import com.android.internal.telephony.PhoneBase;
-import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.telephony.MccTable;
 
-// can't be used since VoiceMailConstants is not public
-//import com.android.internal.telephony.gsm.VoiceMailConstants;
-import com.android.internal.telephony.PhoneProxy;
 import com.android.internal.telephony.cdma.sms.UserData;
 import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
 
@@ -54,10 +46,9 @@
  * {@hide}
  */
 public final class RuimRecords extends IccRecords {
-    static final String LOG_TAG = "CDMA";
+    static final String LOG_TAG = "RuimRecords";
 
-    private static final boolean DBG = true;
-    private boolean  m_ota_commited=false;
+    private boolean  mOtaCommited=false;
 
     // ***** Instance Variables
 
@@ -74,6 +65,22 @@
     private String mHomeSystemId;
     private String mHomeNetworkId;
 
+    @Override
+    public String toString() {
+        return "RuimRecords: " + super.toString()
+                + " m_ota_commited" + mOtaCommited
+                + " mMyMobileNumber=" + "xxxx"
+                + " mMin2Min1=" + mMin2Min1
+                + " mPrlVersion=" + mPrlVersion
+                + " mEFpl=" + mEFpl
+                + " mEFli=" + mEFli
+                + " mCsimSpnDisplayCondition=" + mCsimSpnDisplayCondition
+                + " mMdn=" + mMdn
+                + " mMin=" + mMin
+                + " mHomeSystemId=" + mHomeSystemId
+                + " mHomeNetworkId=" + mHomeNetworkId;
+    }
+
     // ***** Event Constants
     private static final int EVENT_APP_READY = 1;
     private static final int EVENT_GET_IMSI_DONE = 3;
@@ -93,12 +100,12 @@
     public RuimRecords(UiccCardApplication app, Context c, CommandsInterface ci) {
         super(app, c, ci);
 
-        adnCache = new AdnRecordCache(mFh);
+        mAdnCache = new AdnRecordCache(mFh);
 
-        recordsRequested = false;  // No load request is made till SIM ready
+        mRecordsRequested = false;  // No load request is made till SIM ready
 
         // recordsToLoad is set to 0 because no requests are made yet
-        recordsToLoad = 0;
+        mRecordsToLoad = 0;
 
         // NOTE the EVENT_SMS_ON_RUIM is not registered
         mCi.registerForIccRefresh(this, EVENT_RUIM_REFRESH, null);
@@ -107,6 +114,7 @@
         resetRecords();
 
         mParentApp.registerForReady(this, EVENT_APP_READY, null);
+        if (DBG) log("RuimRecords X ctor this=" + this);
     }
 
     @Override
@@ -125,11 +133,11 @@
     }
 
     protected void resetRecords() {
-        countVoiceMessages = 0;
-        mncLength = UNINITIALIZED;
-        iccid = null;
+        mCountVoiceMessages = 0;
+        mMncLength = UNINITIALIZED;
+        iccId = null;
 
-        adnCache.reset();
+        mAdnCache.reset();
 
         // Don't clean up PROPERTY_ICC_OPERATOR_ISO_COUNTRY and
         // PROPERTY_ICC_OPERATOR_NUMERIC here. Since not all CDMA
@@ -140,7 +148,7 @@
         // recordsRequested is set to false indicating that the SIM
         // read requests made so far are not valid. This is set to
         // true only when fresh set of read requests are made.
-        recordsRequested = false;
+        mRecordsRequested = false;
     }
 
     @Override
@@ -203,10 +211,10 @@
             return null;
         }
 
-        if (mncLength != UNINITIALIZED && mncLength != UNKNOWN) {
+        if (mMncLength != UNINITIALIZED && mMncLength != UNKNOWN) {
             // Length = length of MCC + length of MNC
             // length of mcc = 3 (3GPP2 C.S0005 - Section 2.3)
-            return mImsi.substring(0, 3 + mncLength);
+            return mImsi.substring(0, 3 + mMncLength);
         }
 
         // Guess the MNC length based on the MCC if we don't
@@ -218,10 +226,12 @@
 
     // Refer to ETSI TS 102.221
     private class EfPlLoaded implements IccRecordLoaded {
+        @Override
         public String getEfName() {
             return "EF_PL";
         }
 
+        @Override
         public void onRecordLoaded(AsyncResult ar) {
             mEFpl = (byte[]) ar.result;
             if (DBG) log("EF_PL=" + IccUtils.bytesToHexString(mEFpl));
@@ -230,10 +240,12 @@
 
     // Refer to C.S0065 5.2.26
     private class EfCsimLiLoaded implements IccRecordLoaded {
+        @Override
         public String getEfName() {
             return "EF_CSIM_LI";
         }
 
+        @Override
         public void onRecordLoaded(AsyncResult ar) {
             mEFli = (byte[]) ar.result;
             // convert csim efli data to iso 639 format
@@ -256,10 +268,12 @@
 
     // Refer to C.S0065 5.2.32
     private class EfCsimSpnLoaded implements IccRecordLoaded {
+        @Override
         public String getEfName() {
             return "EF_CSIM_SPN";
         }
 
+        @Override
         public void onRecordLoaded(AsyncResult ar) {
             byte[] data = (byte[]) ar.result;
             if (DBG) log("CSIM_SPN=" +
@@ -280,22 +294,22 @@
             }
 
             if (numBytes == 0) {
-                spn = "";
+                mSpn = "";
                 return;
             }
             try {
                 switch (encoding) {
                 case UserData.ENCODING_OCTET:
                 case UserData.ENCODING_LATIN:
-                    spn = new String(spnData, 0, numBytes, "ISO-8859-1");
+                    mSpn = new String(spnData, 0, numBytes, "ISO-8859-1");
                     break;
                 case UserData.ENCODING_IA5:
                 case UserData.ENCODING_GSM_7BIT_ALPHABET:
                 case UserData.ENCODING_7BIT_ASCII:
-                    spn = GsmAlphabet.gsm7BitPackedToString(spnData, 0, (numBytes*8)/7);
+                    mSpn = GsmAlphabet.gsm7BitPackedToString(spnData, 0, (numBytes*8)/7);
                     break;
                 case UserData.ENCODING_UNICODE_16:
-                    spn =  new String(spnData, 0, numBytes, "utf-16");
+                    mSpn =  new String(spnData, 0, numBytes, "utf-16");
                     break;
                 default:
                     log("SPN encoding not supported");
@@ -303,17 +317,19 @@
             } catch(Exception e) {
                 log("spn decode error: " + e);
             }
-            if (DBG) log("spn=" + spn);
+            if (DBG) log("spn=" + mSpn);
             if (DBG) log("spnCondition=" + mCsimSpnDisplayCondition);
-            SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+            SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, mSpn);
         }
     }
 
     private class EfCsimMdnLoaded implements IccRecordLoaded {
+        @Override
         public String getEfName() {
             return "EF_CSIM_MDN";
         }
 
+        @Override
         public void onRecordLoaded(AsyncResult ar) {
             byte[] data = (byte[]) ar.result;
             if (DBG) log("CSIM_MDN=" + IccUtils.bytesToHexString(data));
@@ -325,10 +341,12 @@
     }
 
     private class EfCsimImsimLoaded implements IccRecordLoaded {
+        @Override
         public String getEfName() {
             return "EF_CSIM_IMSIM";
         }
 
+        @Override
         public void onRecordLoaded(AsyncResult ar) {
             byte[] data = (byte[]) ar.result;
             if (DBG) log("CSIM_IMSIM=" + IccUtils.bytesToHexString(data));
@@ -360,10 +378,12 @@
     }
 
     private class EfCsimCdmaHomeLoaded implements IccRecordLoaded {
+        @Override
         public String getEfName() {
             return "EF_CSIM_CDMAHOME";
         }
 
+        @Override
         public void onRecordLoaded(AsyncResult ar) {
             // Per C.S0065 section 5.2.8
             ArrayList<byte[]> dataList = (ArrayList<byte[]>) ar.result;
@@ -392,9 +412,11 @@
     }
 
     private class EfCsimEprlLoaded implements IccRecordLoaded {
+        @Override
         public String getEfName() {
             return "EF_CSIM_EPRL";
         }
+        @Override
         public void onRecordLoaded(AsyncResult ar) {
             onGetCSimEprlDone(ar);
         }
@@ -491,9 +513,9 @@
                     break;
                 }
 
-                iccid = IccUtils.bcdToString(data, 0, data.length);
+                iccId = IccUtils.bcdToString(data, 0, data.length);
 
-                log("iccid: " + iccid);
+                log("iccid: " + iccId);
 
             break;
 
@@ -591,14 +613,14 @@
     protected void onRecordLoaded() {
         // One record loaded successfully or failed, In either case
         // we need to update the recordsToLoad count
-        recordsToLoad -= 1;
-        if (DBG) log("onRecordLoaded " + recordsToLoad + " requested: " + recordsRequested);
+        mRecordsToLoad -= 1;
+        if (DBG) log("onRecordLoaded " + mRecordsToLoad + " requested: " + mRecordsRequested);
 
-        if (recordsToLoad == 0 && recordsRequested == true) {
+        if (mRecordsToLoad == 0 && mRecordsRequested == true) {
             onAllRecordsLoaded();
-        } else if (recordsToLoad < 0) {
+        } else if (mRecordsToLoad < 0) {
             loge("recordsToLoad <0, programmer error suspected");
-            recordsToLoad = 0;
+            mRecordsToLoad = 0;
         }
     }
 
@@ -632,48 +654,48 @@
 
 
     private void fetchRuimRecords() {
-        recordsRequested = true;
+        mRecordsRequested = true;
 
-        if (DBG) log("fetchRuimRecords " + recordsToLoad);
+        if (DBG) log("fetchRuimRecords " + mRecordsToLoad);
 
         mCi.getIMSIForApp(mParentApp.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_ICCID,
                 obtainMessage(EVENT_GET_ICCID_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_PL,
                 obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfPlLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_CSIM_LI,
                 obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimLiLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_CSIM_SPN,
                 obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimSpnLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFLinearFixed(EF_CSIM_MDN, 1,
                 obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimMdnLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_CSIM_IMSIM,
                 obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimImsimLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFLinearFixedAll(EF_CSIM_CDMAHOME,
                 obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimCdmaHomeLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         // Entire PRL could be huge. We are only interested in
         // the first 4 bytes of the record.
         mFh.loadEFTransparent(EF_CSIM_EPRL, 4,
                 obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimEprlLoaded()));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
-        if (DBG) log("fetchRuimRecords " + recordsToLoad + " requested: " + recordsRequested);
+        if (DBG) log("fetchRuimRecords " + mRecordsToLoad + " requested: " + mRecordsRequested);
         // Further records that can be inserted are Operator/OEM dependent
     }
 
@@ -726,7 +748,7 @@
             // range: 0-99
             countWaiting = 0xff;
         }
-        countVoiceMessages = countWaiting;
+        mCountVoiceMessages = countWaiting;
 
         mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
     }
@@ -746,7 +768,7 @@
         switch (refreshResponse.refreshResult) {
             case IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE:
                 if (DBG) log("handleRuimRefresh with SIM_REFRESH_FILE_UPDATED");
-                adnCache.reset();
+                mAdnCache.reset();
                 fetchRuimRecords();
                 break;
             case IccRefreshResponse.REFRESH_RESULT_INIT:
@@ -806,7 +828,7 @@
         pw.println("RuimRecords: " + this);
         pw.println(" extends:");
         super.dump(fd, pw, args);
-        pw.println(" m_ota_commited=" + m_ota_commited);
+        pw.println(" mOtaCommited=" + mOtaCommited);
         pw.println(" mMyMobileNumber=" + mMyMobileNumber);
         pw.println(" mMin2Min1=" + mMin2Min1);
         pw.println(" mPrlVersion=" + mPrlVersion);
diff --git a/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java b/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java
index 797a085..9b0c4c0 100644
--- a/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/SIMFileHandler.java
@@ -16,7 +16,6 @@
 
 package com.android.internal.telephony.uicc;
 
-import android.os.Message;
 import android.telephony.Rlog;
 
 import com.android.internal.telephony.CommandsInterface;
@@ -25,7 +24,7 @@
  * {@hide}
  */
 public final class SIMFileHandler extends IccFileHandler implements IccConstants {
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "SIMFileHandler";
 
     //***** Instance Variables
 
@@ -75,11 +74,11 @@
 
     @Override
     protected void logd(String msg) {
-        Rlog.d(LOG_TAG, "[SIMFileHandler] " + msg);
+        Rlog.d(LOG_TAG, msg);
     }
 
     @Override
     protected void loge(String msg) {
-        Rlog.e(LOG_TAG, "[SIMFileHandler] " + msg);
+        Rlog.e(LOG_TAG, msg);
     }
 }
diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
index 66eaf6a..c965102 100755
--- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
@@ -21,18 +21,13 @@
 import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
 import android.content.Context;
 import android.os.AsyncResult;
-import android.os.Handler;
 import android.os.Message;
 import android.os.SystemProperties;
 import android.text.TextUtils;
 import android.telephony.Rlog;
 
-import com.android.internal.telephony.BaseCommands;
 import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.MccTable;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneBase;
 import com.android.internal.telephony.SmsMessageBase;
 import com.android.internal.telephony.gsm.SimTlv;
 import com.android.internal.telephony.gsm.SmsMessage;
@@ -47,12 +42,10 @@
  * {@hide}
  */
 public class SIMRecords extends IccRecords {
-    protected static final String LOG_TAG = "GSM";
+    protected static final String LOG_TAG = "SIMRecords";
 
     private static final boolean CRASH_RIL = false;
 
-    protected static final boolean DBG = true;
-
     // ***** Instance Variables
 
     VoiceMailConstants mVmConfig;
@@ -62,13 +55,13 @@
 
     // ***** Cached SIM State; cleared on channel close
 
-    private boolean callForwardingEnabled;
+    private boolean mCallForwardingEnabled;
 
 
     /**
      * States only used by getSpnFsm FSM
      */
-    private Get_Spn_Fsm_State spnState;
+    private GetSpnFsmState mSpnState;
 
     /** CPHS service information (See CPHS 4.2 B.3.1.1)
      *  It will be set in onSimReady if reading GET_CPHS_INFO successfully
@@ -78,25 +71,37 @@
     private byte[] mCphsInfo = null;
     boolean mCspPlmnEnabled = true;
 
-    byte[] efMWIS = null;
-    byte[] efCPHS_MWI =null;
+    byte[] mEfMWIS = null;
+    byte[] mEfCPHS_MWI =null;
     byte[] mEfCff = null;
     byte[] mEfCfis = null;
 
 
-    int spnDisplayCondition;
+    int mSpnDisplayCondition;
     // Numeric network codes listed in TS 51.011 EF[SPDI]
-    ArrayList<String> spdiNetworks = null;
+    ArrayList<String> mSpdiNetworks = null;
 
-    String pnnHomeName = null;
+    String mPnnHomeName = null;
 
     UsimServiceTable mUsimServiceTable;
 
-    // ***** Constants
+    @Override
+    public String toString() {
+        return "SimRecords: " + super.toString()
+                + " mVmConfig" + mVmConfig
+                + " mSpnOverride=" + "mSpnOverride"
+                + " callForwardingEnabled=" + mCallForwardingEnabled
+                + " spnState=" + mSpnState
+                + " mCphsInfo=" + mCphsInfo
+                + " mCspPlmnEnabled=" + mCspPlmnEnabled
+                + " efMWIS=" + mEfMWIS
+                + " efCPHS_MWI=" + mEfCPHS_MWI
+                + " mEfCff=" + mEfCff
+                + " mEfCfis=" + mEfCfis
+                + " getOperatorNumeric=" + getOperatorNumeric();
+    }
 
-    // Bitmasks for SPN display rules.
-    public static final int SPN_RULE_SHOW_SPN  = 0x01;
-    public static final int SPN_RULE_SHOW_PLMN = 0x02;
+    // ***** Constants
 
     // From TS 51.011 EF[SPDI] section
     static final int TAG_SPDI = 0xA3;
@@ -143,7 +148,7 @@
     private static final int EVENT_GET_CFF_DONE = 24;
     private static final int EVENT_SET_CPHS_MAILBOX_DONE = 25;
     private static final int EVENT_GET_INFO_CPHS_DONE = 26;
-    private static final int EVENT_SET_MSISDN_DONE = 30;
+    // private static final int EVENT_SET_MSISDN_DONE = 30; Defined in IccRecords as 30
     private static final int EVENT_SIM_REFRESH = 31;
     private static final int EVENT_GET_CFIS_DONE = 32;
     private static final int EVENT_GET_CSP_CPHS_DONE = 33;
@@ -174,15 +179,15 @@
     public SIMRecords(UiccCardApplication app, Context c, CommandsInterface ci) {
         super(app, c, ci);
 
-        adnCache = new AdnRecordCache(mFh);
+        mAdnCache = new AdnRecordCache(mFh);
 
         mVmConfig = new VoiceMailConstants();
         mSpnOverride = new SpnOverride();
 
-        recordsRequested = false;  // No load request is made till SIM ready
+        mRecordsRequested = false;  // No load request is made till SIM ready
 
         // recordsToLoad is set to 0 because no requests are made yet
-        recordsToLoad = 0;
+        mRecordsToLoad = 0;
 
         mCi.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
         mCi.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);
@@ -190,11 +195,12 @@
         // Start off by setting empty state
         resetRecords();
         mParentApp.registerForReady(this, EVENT_APP_READY, null);
+        if (DBG) log("SIMRecords X ctor this=" + this);
     }
 
     @Override
     public void dispose() {
-        if (DBG) log("Disposing SIMRecords " + this);
+        if (DBG) log("Disposing SIMRecords this=" + this);
         //Unregister for all events
         mCi.unregisterForIccRefresh(this);
         mCi.unSetOnSmsOnSim(this);
@@ -203,25 +209,26 @@
         super.dispose();
     }
 
+    @Override
     protected void finalize() {
         if(DBG) log("finalized");
     }
 
     protected void resetRecords() {
         mImsi = null;
-        msisdn = null;
-        voiceMailNum = null;
-        countVoiceMessages = 0;
-        mncLength = UNINITIALIZED;
-        iccid = null;
+        mMsisdn = null;
+        mVoiceMailNum = null;
+        mCountVoiceMessages = 0;
+        mMncLength = UNINITIALIZED;
+        iccId = null;
         // -1 means no EF_SPN found; treat accordingly.
-        spnDisplayCondition = -1;
-        efMWIS = null;
-        efCPHS_MWI = null;
-        spdiNetworks = null;
-        pnnHomeName = null;
+        mSpnDisplayCondition = -1;
+        mEfMWIS = null;
+        mEfCPHS_MWI = null;
+        mSpdiNetworks = null;
+        mPnnHomeName = null;
 
-        adnCache.reset();
+        mAdnCache.reset();
 
         log("SIMRecords: onRadioOffOrNotAvailable set 'gsm.sim.operator.numeric' to operator=null");
         SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, null);
@@ -231,7 +238,7 @@
         // recordsRequested is set to false indicating that the SIM
         // read requests made so far are not valid. This is set to
         // true only when fresh set of read requests are made.
-        recordsRequested = false;
+        mRecordsRequested = false;
     }
 
 
@@ -245,8 +252,9 @@
         return mImsi;
     }
 
+    @Override
     public String getMsisdnNumber() {
-        return msisdn;
+        return mMsisdn;
     }
 
     @Override
@@ -269,27 +277,30 @@
      *        ((AsyncResult)onComplete.obj).exception == null on success
      *        ((AsyncResult)onComplete.obj).exception != null on fail
      */
+    @Override
     public void setMsisdnNumber(String alphaTag, String number,
             Message onComplete) {
 
-        msisdn = number;
-        msisdnTag = alphaTag;
+        mMsisdn = number;
+        mMsisdnTag = alphaTag;
 
-        if(DBG) log("Set MSISDN: " + msisdnTag + " " + /*msisdn*/ "xxxxxxx");
+        if(DBG) log("Set MSISDN: " + mMsisdnTag + " " + /*mMsisdn*/ "xxxxxxx");
 
 
-        AdnRecord adn = new AdnRecord(msisdnTag, msisdn);
+        AdnRecord adn = new AdnRecord(mMsisdnTag, mMsisdn);
 
         new AdnRecordLoader(mFh).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
                 obtainMessage(EVENT_SET_MSISDN_DONE, onComplete));
     }
 
+    @Override
     public String getMsisdnAlphaTag() {
-        return msisdnTag;
+        return mMsisdnTag;
     }
 
+    @Override
     public String getVoiceMailNumber() {
-        return voiceMailNum;
+        return mVoiceMailNum;
     }
 
     /**
@@ -316,24 +327,25 @@
      *        ((AsyncResult)onComplete.obj).exception == null on success
      *        ((AsyncResult)onComplete.obj).exception != null on fail
      */
+    @Override
     public void setVoiceMailNumber(String alphaTag, String voiceNumber,
             Message onComplete) {
-        if (isVoiceMailFixed) {
+        if (mIsVoiceMailFixed) {
             AsyncResult.forMessage((onComplete)).exception =
                     new IccVmFixedException("Voicemail number is fixed by operator");
             onComplete.sendToTarget();
             return;
         }
 
-        newVoiceMailNum = voiceNumber;
-        newVoiceMailTag = alphaTag;
+        mNewVoiceMailNum = voiceNumber;
+        mNewVoiceMailTag = alphaTag;
 
-        AdnRecord adn = new AdnRecord(newVoiceMailTag, newVoiceMailNum);
+        AdnRecord adn = new AdnRecord(mNewVoiceMailTag, mNewVoiceMailNum);
 
-        if (mailboxIndex != 0 && mailboxIndex != 0xff) {
+        if (mMailboxIndex != 0 && mMailboxIndex != 0xff) {
 
             new AdnRecordLoader(mFh).updateEF(adn, EF_MBDN, EF_EXT6,
-                    mailboxIndex, null,
+                    mMailboxIndex, null,
                     obtainMessage(EVENT_SET_MBDN_DONE, onComplete));
 
         } else if (isCphsMailboxEnabled()) {
@@ -349,9 +361,10 @@
         }
     }
 
+    @Override
     public String getVoiceMailAlphaTag()
     {
-        return voiceMailTag;
+        return mVoiceMailTag;
     }
 
     /**
@@ -361,6 +374,7 @@
      *                     -1 to indicate that an unknown number of
      *                      messages are waiting
      */
+    @Override
     public void
     setVoiceMessageWaiting(int line, int countWaiting) {
         if (line != 1) {
@@ -377,39 +391,39 @@
             countWaiting = 0xff;
         }
 
-        countVoiceMessages = countWaiting;
+        mCountVoiceMessages = countWaiting;
 
         mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
 
         try {
-            if (efMWIS != null) {
+            if (mEfMWIS != null) {
                 // TS 51.011 10.3.45
 
                 // lsb of byte 0 is 'voicemail' status
-                efMWIS[0] = (byte)((efMWIS[0] & 0xfe)
-                                    | (countVoiceMessages == 0 ? 0 : 1));
+                mEfMWIS[0] = (byte)((mEfMWIS[0] & 0xfe)
+                                    | (mCountVoiceMessages == 0 ? 0 : 1));
 
                 // byte 1 is the number of voice messages waiting
                 if (countWaiting < 0) {
                     // The spec does not define what this should be
                     // if we don't know the count
-                    efMWIS[1] = 0;
+                    mEfMWIS[1] = 0;
                 } else {
-                    efMWIS[1] = (byte) countWaiting;
+                    mEfMWIS[1] = (byte) countWaiting;
                 }
 
                 mFh.updateEFLinearFixed(
-                    EF_MWIS, 1, efMWIS, null,
+                    EF_MWIS, 1, mEfMWIS, null,
                     obtainMessage (EVENT_UPDATE_DONE, EF_MWIS));
             }
 
-            if (efCPHS_MWI != null) {
+            if (mEfCPHS_MWI != null) {
                     // Refer CPHS4_2.WW6 B4.2.3
-                efCPHS_MWI[0] = (byte)((efCPHS_MWI[0] & 0xf0)
-                            | (countVoiceMessages == 0 ? 0x5 : 0xa));
+                mEfCPHS_MWI[0] = (byte)((mEfCPHS_MWI[0] & 0xf0)
+                            | (mCountVoiceMessages == 0 ? 0x5 : 0xa));
 
                 mFh.updateEFTransparent(
-                    EF_VOICE_MAIL_INDICATOR_CPHS, efCPHS_MWI,
+                    EF_VOICE_MAIL_INDICATOR_CPHS, mEfCPHS_MWI,
                     obtainMessage (EVENT_UPDATE_DONE, EF_VOICE_MAIL_INDICATOR_CPHS));
             }
         } catch (ArrayIndexOutOfBoundsException ex) {
@@ -428,7 +442,7 @@
      */
     @Override
     public boolean getVoiceCallForwardingFlag() {
-        return callForwardingEnabled;
+        return mCallForwardingEnabled;
     }
 
     /**
@@ -439,7 +453,7 @@
 
         if (line != 1) return; // only line 1 is supported
 
-        callForwardingEnabled = enable;
+        mCallForwardingEnabled = enable;
 
         mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
 
@@ -491,6 +505,7 @@
      * @param fileChanged indicates whether any files changed
      * @param fileList if non-null, a list of EF files that changed
      */
+    @Override
     public void onRefresh(boolean fileChanged, int[] fileList) {
         if (fileChanged) {
             // A future optimization would be to inspect fileList and
@@ -509,17 +524,18 @@
             log("getOperatorNumeric: IMSI == null");
             return null;
         }
-        if (mncLength == UNINITIALIZED || mncLength == UNKNOWN) {
+        if (mMncLength == UNINITIALIZED || mMncLength == UNKNOWN) {
             log("getSIMOperatorNumeric: bad mncLength");
             return null;
         }
 
         // Length = length of MCC + length of MNC
         // length of mcc = 3 (TS 23.003 Section 2.2)
-        return mImsi.substring(0, 3 + mncLength);
+        return mImsi.substring(0, 3 + mMncLength);
     }
 
     // ***** Overridden from Handler
+    @Override
     public void handleMessage(Message msg) {
         AsyncResult ar;
         AdnRecord adn;
@@ -561,32 +577,32 @@
 
                 log("IMSI: " + /* imsi.substring(0, 6) +*/ "xxxxxxx");
 
-                if (((mncLength == UNKNOWN) || (mncLength == 2)) &&
+                if (((mMncLength == UNKNOWN) || (mMncLength == 2)) &&
                         ((mImsi != null) && (mImsi.length() >= 6))) {
                     String mccmncCode = mImsi.substring(0, 6);
                     for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) {
                         if (mccmnc.equals(mccmncCode)) {
-                            mncLength = 3;
+                            mMncLength = 3;
                             break;
                         }
                     }
                 }
 
-                if (mncLength == UNKNOWN) {
+                if (mMncLength == UNKNOWN) {
                     // the SIM has told us all it knows, but it didn't know the mnc length.
                     // guess using the mcc
                     try {
                         int mcc = Integer.parseInt(mImsi.substring(0,3));
-                        mncLength = MccTable.smallestDigitsMccForMnc(mcc);
+                        mMncLength = MccTable.smallestDigitsMccForMnc(mcc);
                     } catch (NumberFormatException e) {
-                        mncLength = UNKNOWN;
+                        mMncLength = UNKNOWN;
                         loge("Corrupt IMSI!");
                     }
                 }
 
-                if (mncLength != UNKNOWN && mncLength != UNINITIALIZED) {
+                if (mMncLength != UNKNOWN && mMncLength != UNINITIALIZED) {
                     // finally have both the imsi and the mncLength and can parse the imsi properly
-                    MccTable.updateMccMncConfiguration(mContext, mImsi.substring(0, 3 + mncLength));
+                    MccTable.updateMccMncConfiguration(mContext, mImsi.substring(0, 3 + mMncLength));
                 }
                 mImsiReadyRegistrants.notifyRegistrants();
             break;
@@ -604,22 +620,22 @@
                     log("EF_MBI: " + IccUtils.bytesToHexString(data));
 
                     // Voice mail record number stored first
-                    mailboxIndex = (int)data[0] & 0xff;
+                    mMailboxIndex = data[0] & 0xff;
 
                     // check if dailing numbe id valid
-                    if (mailboxIndex != 0 && mailboxIndex != 0xff) {
+                    if (mMailboxIndex != 0 && mMailboxIndex != 0xff) {
                         log("Got valid mailbox number for MBDN");
                         isValidMbdn = true;
                     }
                 }
 
                 // one more record to load
-                recordsToLoad += 1;
+                mRecordsToLoad += 1;
 
                 if (isValidMbdn) {
                     // Note: MBDN was not included in NUM_OF_SIM_RECORDS_LOADED
                     new AdnRecordLoader(mFh).loadFromEF(EF_MBDN, EF_EXT6,
-                            mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
+                            mMailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
                 } else {
                     // If this EF not present, try mailbox as in CPHS standard
                     // CPHS (CPHS4_2.WW6) is a european standard.
@@ -636,8 +652,8 @@
                 //If they are not reset, incase of invalid data/exception these
                 //variables are retaining their previous values and are
                 //causing invalid voice mailbox info display to user.
-                voiceMailNum = null;
-                voiceMailTag = null;
+                mVoiceMailNum = null;
+                mVoiceMailTag = null;
                 isRecordLoadResponse = true;
 
                 ar = (AsyncResult)msg.obj;
@@ -654,7 +670,7 @@
                         //load CPHS on fail...
                         // FIXME right now, only load line1's CPHS voice mail entry
 
-                        recordsToLoad += 1;
+                        mRecordsToLoad += 1;
                         new AdnRecordLoader(mFh).loadFromEF(
                                 EF_MAILBOX_CPHS, EF_EXT1, 1,
                                 obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
@@ -671,7 +687,7 @@
                     // Bug #645770 fall back to CPHS
                     // FIXME should use SST to decide
                     // FIXME right now, only load line1's CPHS voice mail entry
-                    recordsToLoad += 1;
+                    mRecordsToLoad += 1;
                     new AdnRecordLoader(mFh).loadFromEF(
                             EF_MAILBOX_CPHS, EF_EXT1, 1,
                             obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
@@ -679,8 +695,8 @@
                     break;
                 }
 
-                voiceMailNum = adn.getNumber();
-                voiceMailTag = adn.getAlphaTag();
+                mVoiceMailNum = adn.getNumber();
+                mVoiceMailTag = adn.getAlphaTag();
             break;
 
             case EVENT_GET_MSISDN_DONE:
@@ -695,10 +711,10 @@
 
                 adn = (AdnRecord)ar.result;
 
-                msisdn = adn.getNumber();
-                msisdnTag = adn.getAlphaTag();
+                mMsisdn = adn.getNumber();
+                mMsisdnTag = adn.getAlphaTag();
 
-                log("MSISDN: " + /*msisdn*/ "xxxxxxx");
+                log("MSISDN: " + /*mMsisdn*/ "xxxxxxx");
             break;
 
             case EVENT_SET_MSISDN_DONE:
@@ -724,7 +740,7 @@
 
                 log("EF_MWIS: " + IccUtils.bytesToHexString(data));
 
-                efMWIS = data;
+                mEfMWIS = data;
 
                 if ((data[0] & 0xff) == 0xff) {
                     log("Uninitialized record MWIS");
@@ -733,11 +749,11 @@
 
                 // Refer TS 51.011 Section 10.3.45 for the content description
                 boolean voiceMailWaiting = ((data[0] & 0x01) != 0);
-                countVoiceMessages = data[1] & 0xff;
+                mCountVoiceMessages = data[1] & 0xff;
 
-                if (voiceMailWaiting && countVoiceMessages == 0) {
+                if (voiceMailWaiting && mCountVoiceMessages == 0) {
                     // Unknown count = -1
-                    countVoiceMessages = -1;
+                    mCountVoiceMessages = -1;
                 }
 
                 mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
@@ -753,20 +769,20 @@
                     break;
                 }
 
-                efCPHS_MWI = data;
+                mEfCPHS_MWI = data;
 
                 // Use this data if the EF[MWIS] exists and
                 // has been loaded
 
-                if (efMWIS == null) {
-                    int indicator = (int)(data[0] & 0xf);
+                if (mEfMWIS == null) {
+                    int indicator = data[0] & 0xf;
 
                     // Refer CPHS4_2.WW6 B4.2.3
                     if (indicator == 0xA) {
                         // Unknown count = -1
-                        countVoiceMessages = -1;
+                        mCountVoiceMessages = -1;
                     } else if (indicator == 0x5) {
-                        countVoiceMessages = 0;
+                        mCountVoiceMessages = 0;
                     }
 
                     mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
@@ -783,9 +799,9 @@
                     break;
                 }
 
-                iccid = IccUtils.bcdToString(data, 0, data.length);
+                iccId = IccUtils.bcdToString(data, 0, data.length);
 
-                log("iccid: " + iccid);
+                log("iccid: " + iccId);
 
             break;
 
@@ -813,45 +829,45 @@
                         break;
                     }
 
-                    mncLength = (int)data[3] & 0xf;
+                    mMncLength = data[3] & 0xf;
 
-                    if (mncLength == 0xf) {
-                        mncLength = UNKNOWN;
+                    if (mMncLength == 0xf) {
+                        mMncLength = UNKNOWN;
                     }
                 } finally {
-                    if (((mncLength == UNINITIALIZED) || (mncLength == UNKNOWN) ||
-                            (mncLength == 2)) && ((mImsi != null) && (mImsi.length() >= 6))) {
+                    if (((mMncLength == UNINITIALIZED) || (mMncLength == UNKNOWN) ||
+                            (mMncLength == 2)) && ((mImsi != null) && (mImsi.length() >= 6))) {
                         String mccmncCode = mImsi.substring(0, 6);
                         for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) {
                             if (mccmnc.equals(mccmncCode)) {
-                                mncLength = 3;
+                                mMncLength = 3;
                                 break;
                             }
                         }
                     }
 
-                    if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) {
+                    if (mMncLength == UNKNOWN || mMncLength == UNINITIALIZED) {
                         if (mImsi != null) {
                             try {
                                 int mcc = Integer.parseInt(mImsi.substring(0,3));
 
-                                mncLength = MccTable.smallestDigitsMccForMnc(mcc);
+                                mMncLength = MccTable.smallestDigitsMccForMnc(mcc);
                             } catch (NumberFormatException e) {
-                                mncLength = UNKNOWN;
+                                mMncLength = UNKNOWN;
                                 loge("Corrupt IMSI!");
                             }
                         } else {
                             // Indicate we got this info, but it didn't contain the length.
-                            mncLength = UNKNOWN;
+                            mMncLength = UNKNOWN;
 
                             log("MNC length not present in EF_AD");
                         }
                     }
-                    if (mImsi != null && mncLength != UNKNOWN) {
+                    if (mImsi != null && mMncLength != UNKNOWN) {
                         // finally have both imsi and the length of the mnc and can parse
                         // the imsi properly
                         MccTable.updateMccMncConfiguration(mContext,
-                                mImsi.substring(0, 3 + mncLength));
+                                mImsi.substring(0, 3 + mMncLength));
                     }
                 }
             break;
@@ -876,7 +892,7 @@
                 mEfCff = data;
 
                 if (validEfCfis(mEfCfis)) {
-                    callForwardingEnabled =
+                    mCallForwardingEnabled =
                         ((data[0] & CFF_LINE1_MASK) == CFF_UNCONDITIONAL_ACTIVE);
 
                     mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
@@ -920,7 +936,7 @@
 
                 for ( ; tlv.isValidObject() ; tlv.nextObject()) {
                     if (tlv.getTag() == TAG_FULL_NETWORK_NAME) {
-                        pnnHomeName
+                        mPnnHomeName
                             = IccUtils.networkNameToString(
                                 tlv.getData(), 0, tlv.getData().length);
                         break;
@@ -935,7 +951,7 @@
                 if (ar.exception != null)
                     break;
 
-                handleSmses((ArrayList) ar.result);
+                handleSmses((ArrayList<byte []>) ar.result);
                 break;
 
             case EVENT_MARK_SMS_READ_DONE:
@@ -1002,12 +1018,12 @@
                 ar = (AsyncResult)msg.obj;
 
                 if (ar.exception == null) {
-                    voiceMailNum = newVoiceMailNum;
-                    voiceMailTag = newVoiceMailTag;
+                    mVoiceMailNum = mNewVoiceMailNum;
+                    mVoiceMailTag = mNewVoiceMailTag;
                 }
 
                 if (isCphsMailboxEnabled()) {
-                    adn = new AdnRecord(voiceMailTag, voiceMailNum);
+                    adn = new AdnRecord(mVoiceMailTag, mVoiceMailNum);
                     Message onCphsCompleted = (Message) ar.userObj;
 
                     /* write to cphs mailbox whenever it is available but
@@ -1043,8 +1059,8 @@
                 isRecordLoadResponse = false;
                 ar = (AsyncResult)msg.obj;
                 if(ar.exception == null) {
-                    voiceMailNum = newVoiceMailNum;
-                    voiceMailTag = newVoiceMailTag;
+                    mVoiceMailNum = mNewVoiceMailNum;
+                    mVoiceMailTag = mNewVoiceMailTag;
                 } else {
                     if (DBG) log("Set CPHS MailBox with exception: "
                             + ar.exception);
@@ -1080,8 +1096,8 @@
                     mEfCfis = data;
 
                     // Refer TS 51.011 Section 10.3.46 for the content description
-                    callForwardingEnabled = ((data[1] & 0x01) != 0);
-                    log("EF_CFIS: callFordwardingEnabled=" + callForwardingEnabled);
+                    mCallForwardingEnabled = ((data[1] & 0x01) != 0);
+                    log("EF_CFIS: callFordwardingEnabled=" + mCallForwardingEnabled);
 
                     mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
                 } else {
@@ -1122,17 +1138,17 @@
     private void handleFileUpdate(int efid) {
         switch(efid) {
             case EF_MBDN:
-                recordsToLoad++;
+                mRecordsToLoad++;
                 new AdnRecordLoader(mFh).loadFromEF(EF_MBDN, EF_EXT6,
-                        mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
+                        mMailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
                 break;
             case EF_MAILBOX_CPHS:
-                recordsToLoad++;
+                mRecordsToLoad++;
                 new AdnRecordLoader(mFh).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1,
                         1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
                 break;
             case EF_CSP_CPHS:
-                recordsToLoad++;
+                mRecordsToLoad++;
                 log("[CSP] SIM Refresh for EF_CSP_CPHS");
                 mFh.loadEFTransparent(EF_CSP_CPHS,
                         obtainMessage(EVENT_GET_CSP_CPHS_DONE));
@@ -1141,7 +1157,7 @@
                 // For now, fetch all records if this is not a
                 // voicemail number.
                 // TODO: Handle other cases, instead of fetching all.
-                adnCache.reset();
+                mAdnCache.reset();
                 fetchSimRecords();
                 break;
         }
@@ -1167,7 +1183,7 @@
             case IccRefreshResponse.REFRESH_RESULT_INIT:
                 if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT");
                 // need to reload all files (that we care about)
-                adnCache.reset();
+                mAdnCache.reset();
                 fetchSimRecords();
                 break;
             case IccRefreshResponse.REFRESH_RESULT_RESET:
@@ -1218,11 +1234,11 @@
     }
 
 
-    private void handleSmses(ArrayList messages) {
+    private void handleSmses(ArrayList<byte[]> messages) {
         int count = messages.size();
 
         for (int i = 0; i < count; i++) {
-            byte[] ba = (byte[]) messages.get(i);
+            byte[] ba = messages.get(i);
 
             if (ba[0] != 0)
                 Rlog.i("ENF", "status " + i + ": " + ba[0]);
@@ -1246,7 +1262,7 @@
 
                 ba[0] = 1;
 
-                if (false) { // XXX writing seems to crash RdoServD
+                if (false) { // FIXME: writing seems to crash RdoServD
                     mFh.updateEFLinearFixed(EF_SMS,
                             i, ba, null, obtainMessage(EVENT_MARK_SMS_READ_DONE, i));
                 }
@@ -1254,20 +1270,22 @@
         }
     }
 
+    @Override
     protected void onRecordLoaded() {
         // One record loaded successfully or failed, In either case
         // we need to update the recordsToLoad count
-        recordsToLoad -= 1;
-        if (DBG) log("onRecordLoaded " + recordsToLoad + " requested: " + recordsRequested);
+        mRecordsToLoad -= 1;
+        if (DBG) log("onRecordLoaded " + mRecordsToLoad + " requested: " + mRecordsRequested);
 
-        if (recordsToLoad == 0 && recordsRequested == true) {
+        if (mRecordsToLoad == 0 && mRecordsRequested == true) {
             onAllRecordsLoaded();
-        } else if (recordsToLoad < 0) {
+        } else if (mRecordsToLoad < 0) {
             loge("recordsToLoad <0, programmer error suspected");
-            recordsToLoad = 0;
+            mRecordsToLoad = 0;
         }
     }
 
+    @Override
     protected void onAllRecordsLoaded() {
         String operator = getOperatorNumeric();
 
@@ -1296,16 +1314,16 @@
 
     private void setSpnFromConfig(String carrier) {
         if (mSpnOverride.containsCarrier(carrier)) {
-            spn = mSpnOverride.getSpn(carrier);
+            mSpn = mSpnOverride.getSpn(carrier);
         }
     }
 
 
     private void setVoiceMailByCountry (String spn) {
         if (mVmConfig.containsCarrier(spn)) {
-            isVoiceMailFixed = true;
-            voiceMailNum = mVmConfig.getVoiceMailNumber(spn);
-            voiceMailTag = mVmConfig.getVoiceMailTag(spn);
+            mIsVoiceMailFixed = true;
+            mVoiceMailNum = mVmConfig.getVoiceMailNumber(spn);
+            mVoiceMailTag = mVmConfig.getVoiceMailTag(spn);
         }
     }
 
@@ -1315,32 +1333,32 @@
     }
 
     protected void fetchSimRecords() {
-        recordsRequested = true;
+        mRecordsRequested = true;
 
-        if (DBG) log("fetchSimRecords " + recordsToLoad);
+        if (DBG) log("fetchSimRecords " + mRecordsToLoad);
 
         mCi.getIMSIForApp(mParentApp.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         // FIXME should examine EF[MSISDN]'s capability configuration
         // to determine which is the voice/data/fax line
         new AdnRecordLoader(mFh).loadFromEF(EF_MSISDN, EF_EXT1, 1,
                     obtainMessage(EVENT_GET_MSISDN_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         // Record number is subscriber profile
         mFh.loadEFLinearFixed(EF_MBI, 1, obtainMessage(EVENT_GET_MBI_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         // Record number is subscriber profile
         mFh.loadEFLinearFixed(EF_MWIS, 1, obtainMessage(EVENT_GET_MWIS_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
 
         // Also load CPHS-style voice mail indicator, which stores
@@ -1350,37 +1368,37 @@
         mFh.loadEFTransparent(
                 EF_VOICE_MAIL_INDICATOR_CPHS,
                 obtainMessage(EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         // Same goes for Call Forward Status indicator: fetch both
         // EF[CFIS] and CPHS-EF, with EF[CFIS] preferred.
         mFh.loadEFLinearFixed(EF_CFIS, 1, obtainMessage(EVENT_GET_CFIS_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
         mFh.loadEFTransparent(EF_CFF_CPHS, obtainMessage(EVENT_GET_CFF_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
 
         getSpnFsm(true, null);
 
         mFh.loadEFTransparent(EF_SPDI, obtainMessage(EVENT_GET_SPDI_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFLinearFixed(EF_PNN, 1, obtainMessage(EVENT_GET_PNN_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         mFh.loadEFTransparent(EF_CSP_CPHS,obtainMessage(EVENT_GET_CSP_CPHS_DONE));
-        recordsToLoad++;
+        mRecordsToLoad++;
 
         // XXX should seek instead of examining them all
         if (false) { // XXX
             mFh.loadEFLinearFixedAll(EF_SMS, obtainMessage(EVENT_GET_ALL_SMS_DONE));
-            recordsToLoad++;
+            mRecordsToLoad++;
         }
 
         if (CRASH_RIL) {
@@ -1395,7 +1413,7 @@
             mFh.updateEFLinearFixed(EF_SMS, 1, ba, null,
                             obtainMessage(EVENT_MARK_SMS_READ_DONE, 1));
         }
-        if (DBG) log("fetchSimRecords " + recordsToLoad + " requested: " + recordsRequested);
+        if (DBG) log("fetchSimRecords " + mRecordsToLoad + " requested: " + mRecordsRequested);
     }
 
     /**
@@ -1409,18 +1427,18 @@
     @Override
     public int getDisplayRule(String plmn) {
         int rule;
-        if (TextUtils.isEmpty(spn) || spnDisplayCondition == -1) {
+        if (TextUtils.isEmpty(mSpn) || mSpnDisplayCondition == -1) {
             // No EF_SPN content was found on the SIM, or not yet loaded.  Just show ONS.
             rule = SPN_RULE_SHOW_PLMN;
         } else if (isOnMatchingPlmn(plmn)) {
             rule = SPN_RULE_SHOW_SPN;
-            if ((spnDisplayCondition & 0x01) == 0x01) {
+            if ((mSpnDisplayCondition & 0x01) == 0x01) {
                 // ONS required when registered to HPLMN or PLMN in EF_SPDI
                 rule |= SPN_RULE_SHOW_PLMN;
             }
         } else {
             rule = SPN_RULE_SHOW_PLMN;
-            if ((spnDisplayCondition & 0x02) == 0x00) {
+            if ((mSpnDisplayCondition & 0x02) == 0x00) {
                 // SPN required if not registered to HPLMN or PLMN in EF_SPDI
                 rule |= SPN_RULE_SHOW_SPN;
             }
@@ -1438,8 +1456,8 @@
             return true;
         }
 
-        if (spdiNetworks != null) {
-            for (String spdiNet : spdiNetworks) {
+        if (mSpdiNetworks != null) {
+            for (String spdiNet : mSpdiNetworks) {
                 if (plmn.equals(spdiNet)) {
                     return true;
                 }
@@ -1451,7 +1469,7 @@
     /**
      * States of Get SPN Finite State Machine which only used by getSpnFsm()
      */
-    private enum Get_Spn_Fsm_State {
+    private enum GetSpnFsmState {
         IDLE,               // No initialized
         INIT,               // Start FSM
         READ_SPN_3GPP,      // Load EF_SPN firstly
@@ -1482,84 +1500,84 @@
         if (start) {
             // Check previous state to see if there is outstanding
             // SPN read
-            if(spnState == Get_Spn_Fsm_State.READ_SPN_3GPP ||
-               spnState == Get_Spn_Fsm_State.READ_SPN_CPHS ||
-               spnState == Get_Spn_Fsm_State.READ_SPN_SHORT_CPHS ||
-               spnState == Get_Spn_Fsm_State.INIT) {
+            if(mSpnState == GetSpnFsmState.READ_SPN_3GPP ||
+               mSpnState == GetSpnFsmState.READ_SPN_CPHS ||
+               mSpnState == GetSpnFsmState.READ_SPN_SHORT_CPHS ||
+               mSpnState == GetSpnFsmState.INIT) {
                 // Set INIT then return so the INIT code
                 // will run when the outstanding read done.
-                spnState = Get_Spn_Fsm_State.INIT;
+                mSpnState = GetSpnFsmState.INIT;
                 return;
             } else {
-                spnState = Get_Spn_Fsm_State.INIT;
+                mSpnState = GetSpnFsmState.INIT;
             }
         }
 
-        switch(spnState){
+        switch(mSpnState){
             case INIT:
-                spn = null;
+                mSpn = null;
 
                 mFh.loadEFTransparent(EF_SPN,
                         obtainMessage(EVENT_GET_SPN_DONE));
-                recordsToLoad++;
+                mRecordsToLoad++;
 
-                spnState = Get_Spn_Fsm_State.READ_SPN_3GPP;
+                mSpnState = GetSpnFsmState.READ_SPN_3GPP;
                 break;
             case READ_SPN_3GPP:
                 if (ar != null && ar.exception == null) {
                     data = (byte[]) ar.result;
-                    spnDisplayCondition = 0xff & data[0];
-                    spn = IccUtils.adnStringFieldToString(data, 1, data.length - 1);
+                    mSpnDisplayCondition = 0xff & data[0];
+                    mSpn = IccUtils.adnStringFieldToString(data, 1, data.length - 1);
 
-                    if (DBG) log("Load EF_SPN: " + spn
-                            + " spnDisplayCondition: " + spnDisplayCondition);
-                    SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+                    if (DBG) log("Load EF_SPN: " + mSpn
+                            + " spnDisplayCondition: " + mSpnDisplayCondition);
+                    SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, mSpn);
 
-                    spnState = Get_Spn_Fsm_State.IDLE;
+                    mSpnState = GetSpnFsmState.IDLE;
                 } else {
                     mFh.loadEFTransparent( EF_SPN_CPHS,
                             obtainMessage(EVENT_GET_SPN_DONE));
-                    recordsToLoad++;
+                    mRecordsToLoad++;
 
-                    spnState = Get_Spn_Fsm_State.READ_SPN_CPHS;
+                    mSpnState = GetSpnFsmState.READ_SPN_CPHS;
 
                     // See TS 51.011 10.3.11.  Basically, default to
                     // show PLMN always, and SPN also if roaming.
-                    spnDisplayCondition = -1;
+                    mSpnDisplayCondition = -1;
                 }
                 break;
             case READ_SPN_CPHS:
                 if (ar != null && ar.exception == null) {
                     data = (byte[]) ar.result;
-                    spn = IccUtils.adnStringFieldToString(data, 0, data.length);
+                    mSpn = IccUtils.adnStringFieldToString(data, 0, data.length);
 
-                    if (DBG) log("Load EF_SPN_CPHS: " + spn);
-                    SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+                    if (DBG) log("Load EF_SPN_CPHS: " + mSpn);
+                    SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, mSpn);
 
-                    spnState = Get_Spn_Fsm_State.IDLE;
+                    mSpnState = GetSpnFsmState.IDLE;
                 } else {
                     mFh.loadEFTransparent(
                             EF_SPN_SHORT_CPHS, obtainMessage(EVENT_GET_SPN_DONE));
-                    recordsToLoad++;
+                    mRecordsToLoad++;
 
-                    spnState = Get_Spn_Fsm_State.READ_SPN_SHORT_CPHS;
+                    mSpnState = GetSpnFsmState.READ_SPN_SHORT_CPHS;
                 }
                 break;
             case READ_SPN_SHORT_CPHS:
                 if (ar != null && ar.exception == null) {
                     data = (byte[]) ar.result;
-                    spn = IccUtils.adnStringFieldToString(data, 0, data.length);
+                    mSpn = IccUtils.adnStringFieldToString(data, 0, data.length);
 
-                    if (DBG) log("Load EF_SPN_SHORT_CPHS: " + spn);
-                    SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+                    if (DBG) log("Load EF_SPN_SHORT_CPHS: " + mSpn);
+                    SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, mSpn);
                 }else {
                     if (DBG) log("No SPN loaded in either CHPS or 3GPP");
                 }
 
-                spnState = Get_Spn_Fsm_State.IDLE;
+                mSpnState = GetSpnFsmState.IDLE;
                 break;
             default:
-                spnState = Get_Spn_Fsm_State.IDLE;
+                mSpnState = GetSpnFsmState.IDLE;
         }
     }
 
@@ -1590,7 +1608,7 @@
             return;
         }
 
-        spdiNetworks = new ArrayList<String>(plmnEntries.length / 3);
+        mSpdiNetworks = new ArrayList<String>(plmnEntries.length / 3);
 
         for (int i = 0 ; i + 2 < plmnEntries.length ; i += 3) {
             String plmnCode;
@@ -1599,7 +1617,7 @@
             // Valid operator codes are 5 or 6 digits
             if (plmnCode.length() >= 5) {
                 log("EF_SPDI network: " + plmnCode);
-                spdiNetworks.add(plmnCode);
+                mSpdiNetworks.add(plmnCode);
             }
         }
     }
@@ -1612,10 +1630,12 @@
         return ((mCphsInfo[1] & CPHS_SST_MBN_MASK) == CPHS_SST_MBN_ENABLED );
     }
 
+    @Override
     protected void log(String s) {
         Rlog.d(LOG_TAG, "[SIMRecords] " + s);
     }
 
+    @Override
     protected void loge(String s) {
         Rlog.e(LOG_TAG, "[SIMRecords] " + s);
     }
@@ -1632,6 +1652,7 @@
      * Return true if "Restriction of menu options for manual PLMN selection"
      * bit is set or EF_CSP data is unavailable, return false otherwise.
      */
+    @Override
     public boolean isCspPlmnEnabled() {
         return mCspPlmnEnabled;
     }
@@ -1684,18 +1705,18 @@
         super.dump(fd, pw, args);
         pw.println(" mVmConfig=" + mVmConfig);
         pw.println(" mSpnOverride=" + mSpnOverride);
-        pw.println(" callForwardingEnabled=" + callForwardingEnabled);
-        pw.println(" spnState=" + spnState);
+        pw.println(" mCallForwardingEnabled=" + mCallForwardingEnabled);
+        pw.println(" mSpnState=" + mSpnState);
         pw.println(" mCphsInfo=" + mCphsInfo);
         pw.println(" mCspPlmnEnabled=" + mCspPlmnEnabled);
-        pw.println(" efMWIS[]=" + Arrays.toString(efMWIS));
-        pw.println(" efCPHS_MWI[]=" + Arrays.toString(efCPHS_MWI));
+        pw.println(" mEfMWIS[]=" + Arrays.toString(mEfMWIS));
+        pw.println(" mEfCPHS_MWI[]=" + Arrays.toString(mEfCPHS_MWI));
         pw.println(" mEfCff[]=" + Arrays.toString(mEfCff));
         pw.println(" mEfCfis[]=" + Arrays.toString(mEfCfis));
-        pw.println(" spnDisplayCondition=" + spnDisplayCondition);
-        pw.println(" spdiNetworks[]=" + spdiNetworks);
-        pw.println(" pnnHomeName=" + pnnHomeName);
+        pw.println(" mSpnDisplayCondition=" + mSpnDisplayCondition);
+        pw.println(" mSpdiNetworks[]=" + mSpdiNetworks);
+        pw.println(" mPnnHomeName=" + mPnnHomeName);
         pw.println(" mUsimServiceTable=" + mUsimServiceTable);
         pw.flush();
     }
-}
\ No newline at end of file
+}
diff --git a/src/java/com/android/internal/telephony/uicc/SpnOverride.java b/src/java/com/android/internal/telephony/uicc/SpnOverride.java
index 2c06b2b..016a793 100644
--- a/src/java/com/android/internal/telephony/uicc/SpnOverride.java
+++ b/src/java/com/android/internal/telephony/uicc/SpnOverride.java
@@ -32,23 +32,23 @@
 import com.android.internal.util.XmlUtils;
 
 public class SpnOverride {
-    private HashMap<String, String> CarrierSpnMap;
+    private HashMap<String, String> mCarrierSpnMap;
 
 
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "SpnOverride";
     static final String PARTNER_SPN_OVERRIDE_PATH ="etc/spn-conf.xml";
 
     SpnOverride () {
-        CarrierSpnMap = new HashMap<String, String>();
+        mCarrierSpnMap = new HashMap<String, String>();
         loadSpnOverrides();
     }
 
     boolean containsCarrier(String carrier) {
-        return CarrierSpnMap.containsKey(carrier);
+        return mCarrierSpnMap.containsKey(carrier);
     }
 
     String getSpn(String carrier) {
-        return CarrierSpnMap.get(carrier);
+        return mCarrierSpnMap.get(carrier);
     }
 
     private void loadSpnOverrides() {
@@ -60,7 +60,7 @@
         try {
             spnReader = new FileReader(spnFile);
         } catch (FileNotFoundException e) {
-            Rlog.w(LOG_TAG, "Can't open " +
+            Rlog.w(LOG_TAG, "Can not open " +
                     Environment.getRootDirectory() + "/" + PARTNER_SPN_OVERRIDE_PATH);
             return;
         }
@@ -82,7 +82,7 @@
                 String numeric = parser.getAttributeValue(null, "numeric");
                 String data    = parser.getAttributeValue(null, "spn");
 
-                CarrierSpnMap.put(numeric, data);
+                mCarrierSpnMap.put(numeric, data);
             }
         } catch (XmlPullParserException e) {
             Rlog.w(LOG_TAG, "Exception in spn-conf parser " + e);
diff --git a/src/java/com/android/internal/telephony/uicc/UiccCard.java b/src/java/com/android/internal/telephony/uicc/UiccCard.java
index c3e816d..7d63522 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccCard.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccCard.java
@@ -56,7 +56,7 @@
  * {@hide}
  */
 public class UiccCard {
-    protected static final String LOG_TAG = "RIL_UiccCard";
+    protected static final String LOG_TAG = "UiccCard";
     protected static final boolean DBG = true;
 
     private final Object mLock = new Object();
@@ -165,6 +165,7 @@
         }
     }
 
+    @Override
     protected void finalize() {
         if (DBG) log("UiccCard finalized");
     }
diff --git a/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java b/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java
index 6618197..0715b0e 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccCardApplication.java
@@ -37,7 +37,7 @@
  * {@hide}
  */
 public class UiccCardApplication {
-    private static final String LOG_TAG = "RIL_UiccCardApplication";
+    private static final String LOG_TAG = "UiccCardApplication";
     private static final boolean DBG = true;
 
     private static final int EVENT_QUERY_FACILITY_FDN_DONE = 1;
@@ -283,6 +283,10 @@
                             loge("QUERY_FACILITY_LOCK:disabled GET_SIM_STATUS.Pin1:enabled."
                                     + " Fixme");
                         }
+                    case PINSTATE_UNKNOWN:
+                    default:
+                        if (DBG) log("Ignoring: pin1state=" + mPin1State);
+                        break;
                 }
             } else {
                 loge("Bogus facility lock response");
diff --git a/src/java/com/android/internal/telephony/uicc/UiccController.java b/src/java/com/android/internal/telephony/uicc/UiccController.java
index 2647b39..c33dcfa 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccController.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccController.java
@@ -67,11 +67,11 @@
  *         ^ stands for Generalization
  *
  * See also {@link com.android.internal.telephony.IccCard}
- * and {@link com.android.internal.telephony.IccCardProxy}
+ * and {@link com.android.internal.telephony.uicc.IccCardProxy}
  */
 public class UiccController extends Handler {
     private static final boolean DBG = true;
-    private static final String LOG_TAG = "RIL_UiccController";
+    private static final String LOG_TAG = "UiccController";
 
     public static final int APP_FAM_3GPP =  1;
     public static final int APP_FAM_3GPP2 = 2;
diff --git a/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java b/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java
index f219153..96934cb 100644
--- a/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java
+++ b/src/java/com/android/internal/telephony/uicc/UsimFileHandler.java
@@ -26,7 +26,7 @@
  * This class should be used to access files in USIM ADF
  */
 public final class UsimFileHandler extends IccFileHandler implements IccConstants {
-    static final String LOG_TAG = "RIL_UsimFH";
+    static final String LOG_TAG = "UsimFH";
 
     public UsimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
         super(app, aid, ci);
diff --git a/src/java/com/android/internal/telephony/uicc/VoiceMailConstants.java b/src/java/com/android/internal/telephony/uicc/VoiceMailConstants.java
index b2357fc..2c70648 100644
--- a/src/java/com/android/internal/telephony/uicc/VoiceMailConstants.java
+++ b/src/java/com/android/internal/telephony/uicc/VoiceMailConstants.java
@@ -38,7 +38,7 @@
     private HashMap<String, String[]> CarrierVmMap;
 
 
-    static final String LOG_TAG = "GSM";
+    static final String LOG_TAG = "VoiceMailConstants";
     static final String PARTNER_VOICEMAIL_PATH ="etc/voicemail-conf.xml";
 
     static final int NAME = 0;
diff --git a/tests/telephonymockriltests/Android.mk b/tests/telephonymockriltests/Android.mk
deleted file mode 100644
index 9731d0d..0000000
--- a/tests/telephonymockriltests/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_STATIC_JAVA_LIBRARIES := mockrilcontroller
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_PACKAGE_NAME := TelephonyMockRilTests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/telephonymockriltests/AndroidManifest.xml b/tests/telephonymockriltests/AndroidManifest.xml
deleted file mode 100644
index 63f44a2..0000000
--- a/tests/telephonymockriltests/AndroidManifest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.telephonymockriltests">
-
-    <application>
-        <uses-library android:name="android.test.runner" />
-        <activity android:label="TelephonyMockRilTest"
-                android:name="TelephonyMockRilTest">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER"/>
-            </intent-filter>
-        </activity>
-    </application>
-
-    <instrumentation android:name=".TelephonyMockTestRunner"
-        android:targetPackage="com.android.telephonymockriltests"
-        android:label="Test runner for Telephony Tests Using Mock RIL"
-    />
-
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.INTERNET" />
-
-</manifest>
diff --git a/tests/telephonymockriltests/src/com/android/telephonymockriltests/TelephonyMockTestRunner.java b/tests/telephonymockriltests/src/com/android/telephonymockriltests/TelephonyMockTestRunner.java
deleted file mode 100644
index b6bcd27..0000000
--- a/tests/telephonymockriltests/src/com/android/telephonymockriltests/TelephonyMockTestRunner.java
+++ /dev/null
@@ -1,64 +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 com.android.telephonymockriltests;
-
-import android.os.Bundle;
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-import com.android.internal.telephony.mockril.MockRilController;
-import android.telephony.Rlog;
-
-import com.android.telephonymockriltests.functional.SimpleTestUsingMockRil;
-
-import java.io.IOException;
-import junit.framework.TestSuite;
-import junit.framework.TestCase;
-
-/**
- * Test runner for telephony tests that using Mock RIL
- *
- */
-public class TelephonyMockTestRunner extends InstrumentationTestRunner {
-    private static final String TAG="TelephonyMockTestRunner";
-    public MockRilController mController;
-
-    @Override
-    public TestSuite getAllTests() {
-        TestSuite suite = new InstrumentationTestSuite(this);
-        suite.addTestSuite(SimpleTestUsingMockRil.class);
-        return suite;
-    }
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        try {
-            mController = new MockRilController();
-        } catch (IOException e) {
-            e.printStackTrace();
-            TestCase.assertTrue("Create Mock RIl Controller failed", false);
-        }
-        TestCase.assertNotNull(mController);
-        super.onCreate(icicle);
-    }
-
-    @Override
-    public void finish(int resultCode, Bundle results) {
-        if (mController != null)
-            mController.closeChannel();
-        super.finish(resultCode, results);
-    }
-}
diff --git a/tests/telephonymockriltests/src/com/android/telephonymockriltests/functional/SimpleTestUsingMockRil.java b/tests/telephonymockriltests/src/com/android/telephonymockriltests/functional/SimpleTestUsingMockRil.java
deleted file mode 100644
index df79b8b..0000000
--- a/tests/telephonymockriltests/src/com/android/telephonymockriltests/functional/SimpleTestUsingMockRil.java
+++ /dev/null
@@ -1,63 +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 com.android.telephonymockriltests.functional;
-
-import com.android.internal.telephony.mockril.MockRilController;
-import android.test.InstrumentationTestCase;
-import android.telephony.Rlog;
-
-import com.android.telephonymockriltests.TelephonyMockTestRunner;
-
-/**
- * A simple test that using Mock RIL Controller
- */
-public class SimpleTestUsingMockRil extends InstrumentationTestCase {
-    private static final String TAG = "SimpleTestUsingMockRil";
-    private MockRilController mMockRilCtrl = null;
-    private TelephonyMockTestRunner mRunner;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        mRunner = (TelephonyMockTestRunner)getInstrumentation();
-        mMockRilCtrl = mRunner.mController;
-        assertNotNull(mMockRilCtrl);
-    }
-
-    /**
-     * Get the current radio state of RIL
-     */
-    public void testGetRadioState() {
-        int state = mMockRilCtrl.getRadioState();
-        Rlog.v(TAG, "testGetRadioState: " + state);
-        assertTrue(state >= 0 && state <= 9);
-    }
-
-    /**
-     * Set the current radio state of RIL
-     * and verify the radio state is set correctly
-     */
-    public void testSetRadioState() {
-        for (int state = 0; state <= 9; state++) {
-            Rlog.v(TAG, "set radio state to be " + state);
-            assertTrue("set radio state: " + state + " failed.",
-                       mMockRilCtrl.setRadioState(state));
-        }
-        assertFalse("use an invalid radio state", mMockRilCtrl.setRadioState(-1));
-        assertFalse("the radio state doesn't exist", mMockRilCtrl.setRadioState(10));
-    }
-}
diff --git a/tests/telephonytests/Android.mk b/tests/telephonytests/Android.mk
index 197cedf..13363dc 100644
--- a/tests/telephonytests/Android.mk
+++ b/tests/telephonytests/Android.mk
@@ -5,7 +5,7 @@
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_STATIC_JAVA_LIBRARIES := librilproto-java
+#LOCAL_STATIC_JAVA_LIBRARIES := librilproto-java
 
 LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
 
diff --git a/tests/telephonytests/AndroidManifest.xml b/tests/telephonytests/AndroidManifest.xml
index ba1d957..eaf17bd 100644
--- a/tests/telephonytests/AndroidManifest.xml
+++ b/tests/telephonytests/AndroidManifest.xml
@@ -33,11 +33,6 @@
         android:label="Frameworks Telephony Tests">
     </instrumentation>
 
-    <instrumentation android:name=".TelephonyMockRilTestRunner"
-        android:targetPackage="com.android.frameworks.telephonytests"
-        android:label="Test Runner for Mock Ril Tests"
-    />
-
     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
     <uses-permission android:name="android.permission.INTERNET" />
 
diff --git a/tests/telephonytests/src/com/android/frameworks/telephonytests/TelephonyMockRilTestRunner.java b/tests/telephonytests/src/com/android/frameworks/telephonytests/TelephonyMockRilTestRunner.java
deleted file mode 100644
index 25d9f4d..0000000
--- a/tests/telephonytests/src/com/android/frameworks/telephonytests/TelephonyMockRilTestRunner.java
+++ /dev/null
@@ -1,93 +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 com.android.frameworks.telephonytests;
-
-import android.os.Bundle;
-
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-import android.telephony.Rlog;
-
-import java.io.IOException;
-
-import com.android.internal.telephony.RilChannel;
-import com.android.internal.telephony.mockril.MockRilTest;
-
-import junit.framework.TestSuite;
-
-public class TelephonyMockRilTestRunner extends InstrumentationTestRunner {
-
-    public RilChannel mMockRilChannel;
-
-    @Override
-    public TestSuite getAllTests() {
-        log("getAllTests E");
-        TestSuite suite = new InstrumentationTestSuite(this);
-        suite.addTestSuite(MockRilTest.class);
-        log("getAllTests X");
-        return suite;
-    }
-
-    @Override
-    public ClassLoader getLoader() {
-        log("getLoader EX");
-        return TelephonyMockRilTestRunner.class.getClassLoader();
-    }
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        log("onCreate E");
-        try {
-            mMockRilChannel = RilChannel.makeRilChannel();
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        log("onCreate X");
-
-        super.onCreate(icicle);
-    }
-
-    @Override
-    public void onDestroy() {
-        // I've not seen this called
-        log("onDestroy EX");
-        super.onDestroy();
-    }
-
-    @Override
-    public void onStart() {
-        // Called when the instrumentation thread is started.
-        // At the moment we don't need the thread so return
-        // which will shut down this unused thread.
-        log("onStart EX");
-        super.onStart();
-    }
-
-    @Override
-    public void finish(int resultCode, Bundle results) {
-        // Called when complete so I ask the mMockRilChannel to quit.
-        log("finish E");
-        mMockRilChannel.close();
-        log("finish X");
-        super.finish(resultCode, results);
-    }
-
-    private void log(String s) {
-        Rlog.e("TelephonyMockRilTestRunner", s);
-    }
-}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java b/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java
index ac8c4c1..91c481d 100755
--- a/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java
@@ -17,6 +17,7 @@
 package com.android.internal.telephony;
 
 import junit.framework.TestCase;
+import android.telephony.Rlog;
 
 import android.test.suitebuilder.annotation.SmallTest;
 
@@ -83,14 +84,6 @@
 
         testString = "Name,apn,,,,,,,,,123, 45,";
         assertEquals(null, ApnSetting.fromString(testString));
-
-        // Parse (incorrect) V2 format without the tag as V1.
-        testString = "Name,apn,,,,,,,,,123, 45,,mms|*,IPV6,true,14";
-        String[] incorrectTypes = {"mms|*", "IPV6"};
-        expected_apn =  new ApnSetting(
-                -1, "12345", "Name", "apn", "", "",
-                "", "", "", "", "", 0, incorrectTypes, "IP", "IP",true,14);
-        assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString));
     }
 
 
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CallerInfoTest.java b/tests/telephonytests/src/com/android/internal/telephony/CallerInfoTest.java
deleted file mode 100644
index 5155ccf..0000000
--- a/tests/telephonytests/src/com/android/internal/telephony/CallerInfoTest.java
+++ /dev/null
@@ -1,241 +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 com.android.internal.telephony;
-
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.res.Resources;
-import com.android.internal.telephony.CallerInfo;
-import com.android.internal.telephony.CallerInfoAsyncQuery;
-import android.telephony.Rlog;
-import android.os.Looper;
-import android.test.ActivityInstrumentationTestCase;
-import android.util.StringBuilderPrinter;
-
-/*
- * Check the CallerInfo utility class works as expected.
- *
- */
-
-public class CallerInfoTest extends AndroidTestCase {
-    private CallerInfo mInfo;
-    private Context mContext;
-
-    private static final String kEmergencyNumber = "Emergency Number";
-    private static final int kToken = 0xdeadbeef;
-    private static final String TAG = "CallerInfoUnitTest";
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mContext = new MockContext();
-        mInfo = new CallerInfo();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    /**
-     * Checks the caller info instance is flagged as an emergency if
-     * the number is an emergency one. There is no test for the
-     * contact based constructors because emergency number are not in
-     * the contact DB.
-     */
-    @SmallTest
-    public void testEmergencyIsProperlySet() throws Exception {
-        assertFalse(mInfo.isEmergencyNumber());
-
-        mInfo = CallerInfo.getCallerInfo(mContext, "911");
-        assertIsValidEmergencyCallerInfo();
-
-        mInfo = CallerInfo.getCallerInfo(mContext, "tel:911");
-        assertIsValidEmergencyCallerInfo();
-
-
-        // This one hits the content resolver.
-        mInfo = CallerInfo.getCallerInfo(mContext, "18001234567");
-        assertFalse(mInfo.isEmergencyNumber());
-    }
-
-    /**
-     * Same as testEmergencyIsProperlySet but uses the async query api.
-     */
-    @SmallTest
-    public void testEmergencyIsProperlySetUsingAsyncQuery() throws Exception {
-        QueryRunner query;
-
-        query = new QueryRunner("911");
-        query.runAndCheckCompletion();
-        assertIsValidEmergencyCallerInfo();
-
-        query = new QueryRunner("tel:911");
-        query.runAndCheckCompletion();
-        assertIsValidEmergencyCallerInfo();
-
-        query = new QueryRunner("18001234567");
-        query.runAndCheckCompletion();
-        assertFalse(mInfo.isEmergencyNumber());
-    }
-
-    /**
-     * For emergency caller info, phoneNumber should be set to the
-     * string emergency_call_dialog_number_for_display and the
-     * photoResource should be set to the picture_emergency drawable.
-     */
-    @SmallTest
-    public void testEmergencyNumberAndPhotoAreSet() throws Exception {
-        mInfo = CallerInfo.getCallerInfo(mContext, "911");
-
-        assertIsValidEmergencyCallerInfo();
-    }
-
-    // TODO: Add more tests:
-    /**
-     * Check if the voice mail number cannot be retrieved that the
-     * original phone number is preserved.
-     */
-    /**
-     * Check the markAs* methods work.
-     */
-
-
-    //
-    // Helpers
-    //
-
-    // Partial implementation of MockResources.
-    public class MockResources extends android.test.mock.MockResources
-    {
-        @Override
-        public String getString(int resId) throws Resources.NotFoundException {
-            switch (resId) {
-                case com.android.internal.R.string.emergency_call_dialog_number_for_display:
-                    return kEmergencyNumber;
-                default:
-                    throw new UnsupportedOperationException("Missing handling for resid " + resId);
-            }
-        }
-    }
-
-    // Partial implementation of MockContext.
-    public class MockContext extends android.test.mock.MockContext {
-        private ContentResolver mResolver;
-        private Resources mResources;
-
-        public MockContext() {
-            mResolver = new android.test.mock.MockContentResolver();
-            mResources = new MockResources();
-        }
-
-        @Override
-        public ContentResolver getContentResolver() {
-            return mResolver;
-        }
-
-        @Override
-        public Resources getResources() {
-            return mResources;
-        }
-    }
-
-    /**
-     * Class to run a CallerInfoAsyncQuery in a separate thread, with
-     * its own Looper. We cannot use the main Looper because on the
-     * 1st quit the thread is maked dead, ie no further test can use
-     * it. Also there is not way to inject a Looper instance in the
-     * query, so we have to use a thread with its own looper.
-     */
-    private class QueryRunner extends Thread
-            implements CallerInfoAsyncQuery.OnQueryCompleteListener {
-        private Looper mLooper;
-        private String mNumber;
-        private boolean mAsyncCompleted;
-
-        public QueryRunner(String number) {
-            super();
-            mNumber = number;
-        }
-
-        // Run the query in the thread, wait for completion.
-        public void runAndCheckCompletion() throws InterruptedException {
-            start();
-            join();
-            assertTrue(mAsyncCompleted);
-        }
-
-        @Override
-        public void run() {
-            Looper.prepare();
-            mLooper = Looper.myLooper();
-            mAsyncCompleted = false;
-            // The query will pick the thread local looper we've just prepared.
-            CallerInfoAsyncQuery.startQuery(kToken, mContext, mNumber, this, null);
-            mLooper.loop();
-        }
-
-        // Quit the Looper on the 1st callback
-        // (EVENT_EMERGENCY_NUMBER). There is another message
-        // (EVENT_END_OF_QUEUE) that will never be delivered because
-        // the test has exited. The corresponding stack trace
-        // "Handler{xxxxx} sending message to a Handler on a dead
-        // thread" can be ignored.
-        public void onQueryComplete(int token, Object cookie, CallerInfo info) {
-            mAsyncCompleted = true;
-            mInfo = info;
-            mLooper.quit();
-        }
-    }
-
-    /**
-     * Fail if mInfo does not contain a valid emergency CallerInfo instance.
-     */
-    private void assertIsValidEmergencyCallerInfo() throws Exception {
-        assertTrue(mInfo.isEmergencyNumber());
-
-        // For emergency caller info, phoneNumber should be set to the
-        // string emergency_call_dialog_number_for_display and the
-        // photoResource should be set to the picture_emergency drawable.
-        assertEquals(kEmergencyNumber, mInfo.phoneNumber);
-        assertEquals(com.android.internal.R.drawable.picture_emergency, mInfo.photoResource);
-
-        // The name should be null
-        assertNull(mInfo.name);
-        assertEquals(0, mInfo.namePresentation);
-        assertNull(mInfo.cnapName);
-        assertEquals(0, mInfo.numberPresentation);
-
-        assertFalse(mInfo.contactExists);
-        assertEquals(0, mInfo.person_id);
-        assertFalse(mInfo.needUpdate);
-        assertNull(mInfo.contactRefUri);
-
-        assertNull(mInfo.phoneLabel);
-        assertEquals(0, mInfo.numberType);
-        assertNull(mInfo.numberLabel);
-
-        assertNull(mInfo.contactRingtoneUri);
-        assertFalse(mInfo.shouldSendToVoicemail);
-
-        assertNull(mInfo.cachedPhoto);
-        assertFalse(mInfo.isCachedPhotoCurrent);
-    }
-}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SimSmsTest.java b/tests/telephonytests/src/com/android/internal/telephony/SimSmsTest.java
index 1609680..8b9fd2e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SimSmsTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SimSmsTest.java
@@ -16,6 +16,7 @@
 
 package com.android.internal.telephony;
 
+import android.app.ActivityThread;
 import android.os.ServiceManager;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.test.suitebuilder.annotation.Suppress;
@@ -33,7 +34,7 @@
         ISms sms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
         assertNotNull(sms);
 
-        List<SmsRawData> records = sms.getAllMessagesFromIccEf();
+        List<SmsRawData> records = sms.getAllMessagesFromIccEf(ActivityThread.currentPackageName());
         assertNotNull(records);
         assertTrue(records.size() >= 0);
 
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SmsMessageBodyTest.java b/tests/telephonytests/src/com/android/internal/telephony/SmsMessageBodyTest.java
index 2069696..36bad22 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SmsMessageBodyTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SmsMessageBodyTest.java
@@ -18,11 +18,11 @@
 
 import android.telephony.SmsMessage;
 import android.telephony.TelephonyManager;
+import android.telephony.Rlog;
 import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.LargeTest;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.test.suitebuilder.annotation.SmallTest;
-import android.telephony.Rlog;
 
 import com.android.internal.telephony.SmsConstants;
 
diff --git a/tests/telephonytests/src/com/android/internal/telephony/Wap230WspContentTypeTest.java b/tests/telephonytests/src/com/android/internal/telephony/Wap230WspContentTypeTest.java
index 9c2b7ef..598c743 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/Wap230WspContentTypeTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/Wap230WspContentTypeTest.java
@@ -188,7 +188,7 @@
     }
 
     final int WSP_DEFINED_SHORT_MIME_TYPE_COUNT = 85;
-    final int WSP_DEFINED_LONG_MIME_TYPE_COUNT = 85;
+    final int WSP_DEFINED_LONG_MIME_TYPE_COUNT = 40;
 
     private static final byte WSP_STRING_TERMINATOR = 0x00;
     private static final byte WSP_SHORT_INTEGER_MASK = (byte) 0x80;
diff --git a/tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java b/tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java
index 850babe..363321a 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/cdma/sms/CdmaSmsTest.java
@@ -40,6 +40,9 @@
             "\u0400\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408" +
             "\u00a2\u00a9\u00ae\u2122";
 
+    // "Hello, world" in Japanese.
+    private static final String sHelloWorldJa = "\u3053\u3093\u306b\u3061\u306f\u4e16\u754c";
+
     @SmallTest
     public void testCdmaSmsAddrParsing() throws Exception {
         CdmaSmsAddress addr = CdmaSmsAddress.parse("6502531000");
@@ -812,51 +815,98 @@
 
     @SmallTest
     public void testUserDataHeaderWithEightCharMsg() throws Exception {
-        encodeDecodeAssertEquals("01234567", 2, 2, false);
+        SmsHeader smsHeader = getConcatUserDataHeader(2, 2);
+        encodeDecodeAssertEquals("01234567", smsHeader, -1);
+        SmsHeader smsHeader2 = getOddLengthUserDataHeader();
+        encodeDecodeAssertEquals("01234567", smsHeader2, -1);
     }
 
-    private void encodeDecodeAssertEquals(String payload, int index, int total,
-            boolean oddLengthHeader) throws Exception {
+    @SmallTest
+    public void testShiftJis() throws Exception {
+        encodeDecodeAssertEquals(sHelloWorldJa, null, UserData.ENCODING_UNICODE_16);
+        encodeDecodeAssertEquals(sHelloWorldJa, null, UserData.ENCODING_SHIFT_JIS);
+    }
+
+    @SmallTest
+    public void testIgnoreReservedSubparam() throws Exception {
         BearerData bearerData = new BearerData();
         bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
-        bearerData.messageId = 55;
-        SmsHeader smsHeader = new SmsHeader();
-        if (oddLengthHeader) {
-            // Odd length header to verify correct UTF-16 header padding
-            SmsHeader.MiscElt miscElt = new SmsHeader.MiscElt();
-            miscElt.id = 0x27;  // reserved for future use; ignored on decode
-            miscElt.data = new byte[]{0x12, 0x34};
-            smsHeader.miscEltList.add(miscElt);
-        } else {
-            // Even length header normally generated for concatenated SMS.
-            SmsHeader.ConcatRef concatRef = new SmsHeader.ConcatRef();
-            concatRef.refNumber = 0xEE;
-            concatRef.msgCount = total;
-            concatRef.seqNumber = index;
-            concatRef.isEightBits = true;
-            smsHeader.concatRef = concatRef;
-        }
-        byte[] encodeHeader = SmsHeader.toByteArray(smsHeader);
-        if (oddLengthHeader) {
-            assertEquals(4, encodeHeader.length);     // 5 bytes with UDH length
-        } else {
-            assertEquals(5, encodeHeader.length);     // 6 bytes with UDH length
-        }
+        bearerData.messageId = 1234;
         UserData userData = new UserData();
-        userData.payloadStr = payload;
-        userData.userDataHeader = smsHeader;
+        userData.payloadStr = sHelloWorldJa;
         bearerData.userData = userData;
         byte[] encodedSms = BearerData.encode(bearerData);
         BearerData revBearerData = BearerData.decode(encodedSms);
         assertEquals(userData.payloadStr, revBearerData.userData.payloadStr);
-        assertTrue(revBearerData.hasUserDataHeader);
-        byte[] header = SmsHeader.toByteArray(revBearerData.userData.userDataHeader);
-        if (oddLengthHeader) {
-            assertEquals(4, header.length);     // 5 bytes with UDH length
-        } else {
-            assertEquals(5, header.length);     // 6 bytes with UDH length
+
+        byte[] smsWithValidSubparam = Arrays.copyOf(encodedSms, encodedSms.length + 5);
+        smsWithValidSubparam[encodedSms.length] = 0x18; // BearerData.SUBPARAM_ID_LAST_DEFINED + 1
+        smsWithValidSubparam[encodedSms.length + 1] = 3;
+        smsWithValidSubparam[encodedSms.length + 2] = 0x12;
+        smsWithValidSubparam[encodedSms.length + 3] = 0x34;
+        smsWithValidSubparam[encodedSms.length + 4] = 0x56;
+        revBearerData = BearerData.decode(smsWithValidSubparam);
+        assertEquals(userData.payloadStr, revBearerData.userData.payloadStr);
+
+        smsWithValidSubparam = Arrays.copyOf(encodedSms, encodedSms.length + 2);
+        smsWithValidSubparam[encodedSms.length] = 0x18;
+        smsWithValidSubparam[encodedSms.length + 1] = 0;
+        revBearerData = BearerData.decode(smsWithValidSubparam);
+        assertEquals(userData.payloadStr, revBearerData.userData.payloadStr);
+
+        byte[] smsWithInvalidSubparam = Arrays.copyOf(encodedSms, encodedSms.length + 2);
+        smsWithInvalidSubparam[encodedSms.length] = 0x18;
+        smsWithInvalidSubparam[encodedSms.length + 1] = (byte) 1;
+        revBearerData = BearerData.decode(smsWithInvalidSubparam);
+        assertNull(revBearerData);
+    }
+
+    // Return a user data header for a concatenated message
+    private static SmsHeader getConcatUserDataHeader(int index, int total) {
+        SmsHeader smsHeader = new SmsHeader();
+        SmsHeader.ConcatRef concatRef = new SmsHeader.ConcatRef();
+        concatRef.refNumber = 0xEE;
+        concatRef.msgCount = total;
+        concatRef.seqNumber = index;
+        concatRef.isEightBits = true;
+        smsHeader.concatRef = concatRef;
+        return smsHeader;
+    }
+
+    // Return a user data header of odd length to verify correct UTF-16 header padding
+    private static SmsHeader getOddLengthUserDataHeader() {
+        SmsHeader smsHeader = new SmsHeader();
+        SmsHeader.MiscElt miscElt = new SmsHeader.MiscElt();
+        miscElt.id = 0x27;  // reserved for future use; ignored on decode
+        miscElt.data = new byte[]{0x12, 0x34};
+        smsHeader.miscEltList.add(miscElt);
+        return smsHeader;
+    }
+
+    private static void encodeDecodeAssertEquals(String payload, SmsHeader smsHeader,
+            int msgEncoding) throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 55;
+        UserData userData = new UserData();
+        userData.payloadStr = payload;
+        userData.userDataHeader = smsHeader;    // may be null
+        if (msgEncoding != -1) {
+            userData.msgEncoding = msgEncoding;
+            userData.msgEncodingSet = true;
         }
-        assertTrue(Arrays.equals(encodeHeader, header));
+        bearerData.userData = userData;
+        byte[] encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(userData.payloadStr, revBearerData.userData.payloadStr);
+        if (smsHeader != null) {
+            assertTrue(revBearerData.hasUserDataHeader);
+            byte[] encodeHeader = SmsHeader.toByteArray(smsHeader);
+            byte[] decodeHeader = SmsHeader.toByteArray(revBearerData.userData.userDataHeader);
+            assertTrue(Arrays.equals(encodeHeader, decodeHeader));
+        } else {
+            assertFalse(revBearerData.hasUserDataHeader);
+        }
     }
 
     @SmallTest
@@ -912,8 +962,10 @@
             assertEquals(3, fragments.size());
 
             for (int i = 0; i < 3; i++) {
-                encodeDecodeAssertEquals(fragments.get(i), i + 1, 3, false);
-                encodeDecodeAssertEquals(fragments.get(i), i + 1, 3, true);
+                SmsHeader header = getConcatUserDataHeader(i + 1, 3);
+                SmsHeader header2 = getOddLengthUserDataHeader();
+                encodeDecodeAssertEquals(fragments.get(i), header, -1);
+                encodeDecodeAssertEquals(fragments.get(i), header2, -1);
             }
         }
 
@@ -928,8 +980,10 @@
             assertEquals(3, fragments.size());
 
             for (int i = 0; i < 3; i++) {
-                encodeDecodeAssertEquals(fragments.get(i), i + 1, 3, false);
-                encodeDecodeAssertEquals(fragments.get(i), i + 1, 3, true);
+                SmsHeader header = getConcatUserDataHeader(i + 1, 3);
+                SmsHeader header2 = getOddLengthUserDataHeader();
+                encodeDecodeAssertEquals(fragments.get(i), header, -1);
+                encodeDecodeAssertEquals(fragments.get(i), header2, -1);
             }
         }
     }
diff --git a/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java b/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java
index 943e36d..b5335aa 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java
@@ -16,11 +16,11 @@
 
 package com.android.internal.telephony.gsm;
 
+import android.telephony.Rlog;
 import android.telephony.SmsCbEtwsInfo;
 import android.telephony.SmsCbLocation;
 import android.telephony.SmsCbMessage;
 import android.test.AndroidTestCase;
-import android.telephony.Rlog;
 
 import com.android.internal.telephony.uicc.IccUtils;
 
diff --git a/tests/telephonytests/src/com/android/internal/telephony/gsm/UsimDataDownloadTest.java b/tests/telephonytests/src/com/android/internal/telephony/gsm/UsimDataDownloadTest.java
index 7f0282a..e690ffa 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/gsm/UsimDataDownloadTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/gsm/UsimDataDownloadTest.java
@@ -39,7 +39,7 @@
         @Override
         protected void onLooperPrepared() {
             synchronized (this) {
-                mHandler = new UsimDataDownloadHandler(mCm);
+                mHandler = new UsimDataDownloadHandler(mCi);
                 notifyAll();
             }
         }
@@ -56,14 +56,14 @@
         }
     }
 
-    private UsimDataDownloadCommands mCm;
+    private UsimDataDownloadCommands mCi;
     private TestHandlerThread mHandlerThread;
     UsimDataDownloadHandler mHandler;
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        mCm = new UsimDataDownloadCommands(mContext);
+        mCi = new UsimDataDownloadCommands(mContext);
         mHandlerThread = new TestHandlerThread();
         mHandlerThread.start();
         mHandler = mHandlerThread.getHandler();
@@ -111,34 +111,34 @@
         SmsMessage message = SmsMessage.createFromPdu(SMS_PP_MESSAGE_3_1_1);
         assertTrue("message is SMS-PP data download", message.isUsimDataDownload());
 
-        mCm.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x90, 0x00, "");
-        mCm.expectAcknowledgeGsmSms(true, 0);
+        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x90, 0x00, "");
+        mCi.expectAcknowledgeGsmSms(true, 0);
         mHandler.startDataDownload(message);
-        mCm.assertExpectedMethodsCalled();
+        mCi.assertExpectedMethodsCalled();
 
-        mCm.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x90, 0x00, "0123456789");
-        mCm.expectAcknowledgeGsmSmsWithPdu(true, "00077f16050123456789");
+        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x90, 0x00, "0123456789");
+        mCi.expectAcknowledgeGsmSmsWithPdu(true, "00077f16050123456789");
         mHandler.startDataDownload(message);
-        mCm.assertExpectedMethodsCalled();
+        mCi.assertExpectedMethodsCalled();
 
-        mCm.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x62, 0xff, "0123456789abcdef");
-        mCm.expectAcknowledgeGsmSmsWithPdu(false, "00d5077f16080123456789abcdef");
+        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_1, 0x62, 0xff, "0123456789abcdef");
+        mCi.expectAcknowledgeGsmSmsWithPdu(false, "00d5077f16080123456789abcdef");
         mHandler.startDataDownload(message);
-        mCm.assertExpectedMethodsCalled();
+        mCi.assertExpectedMethodsCalled();
     }
 
     public void testDataDownloadMessage5() {
         SmsMessage message = SmsMessage.createFromPdu(SMS_PP_MESSAGE_3_1_5);
         assertTrue("message is SMS-PP data download", message.isUsimDataDownload());
 
-        mCm.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_5, 0x90, 0x00, "9876543210");
-        mCm.expectAcknowledgeGsmSmsWithPdu(true, "00077ff6059876543210");
+        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_5, 0x90, 0x00, "9876543210");
+        mCi.expectAcknowledgeGsmSmsWithPdu(true, "00077ff6059876543210");
         mHandler.startDataDownload(message);
-        mCm.assertExpectedMethodsCalled();
+        mCi.assertExpectedMethodsCalled();
 
-        mCm.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_5, 0x93, 0x00, "");
-        mCm.expectAcknowledgeGsmSms(false, 0xd4);   // SIM toolkit busy
+        mCi.expectSendEnvelope(SMS_PP_ENVELOPE_3_1_5, 0x93, 0x00, "");
+        mCi.expectAcknowledgeGsmSms(false, 0xd4);   // SIM toolkit busy
         mHandler.startDataDownload(message);
-        mCm.assertExpectedMethodsCalled();
+        mCi.assertExpectedMethodsCalled();
     }
 }
diff --git a/tests/telephonytests/src/com/android/internal/telephony/mockril/MockRilTest.java b/tests/telephonytests/src/com/android/internal/telephony/mockril/MockRilTest.java
deleted file mode 100644
index 598d9fe..0000000
--- a/tests/telephonytests/src/com/android/internal/telephony/mockril/MockRilTest.java
+++ /dev/null
@@ -1,304 +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 com.android.internal.telephony.mockril;
-
-import android.telephony.Rlog;
-import android.test.InstrumentationTestCase;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import com.android.internal.communication.MsgHeader;
-import com.android.internal.communication.Msg;
-import com.android.internal.telephony.RilChannel;
-import com.android.internal.telephony.ril_proto.RilCtrlCmds;
-import com.android.internal.telephony.ril_proto.RilCmds;
-
-import com.android.frameworks.telephonytests.TelephonyMockRilTestRunner;
-import com.google.protobuf.micro.InvalidProtocolBufferMicroException;
-
-// Test suite for test ril
-public class MockRilTest extends InstrumentationTestCase {
-    private static final String TAG = "MockRilTest";
-
-    RilChannel mMockRilChannel;
-    TelephonyMockRilTestRunner mRunner;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mRunner = (TelephonyMockRilTestRunner)getInstrumentation();
-        mMockRilChannel = mRunner.mMockRilChannel;
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    static void log(String s) {
-        Rlog.v(TAG, s);
-    }
-
-    /**
-     * Test Case 1: Test protobuf serialization and deserialization
-     * @throws InvalidProtocolBufferMicroException
-     */
-    public void testProtobufSerDes() throws InvalidProtocolBufferMicroException {
-        log("testProtobufSerdes E");
-
-        RilCtrlCmds.CtrlRspRadioState rs = new RilCtrlCmds.CtrlRspRadioState();
-        assertTrue(String.format("expected rs.state == 0 was %d", rs.getState()),
-                rs.getState() == 0);
-        rs.setState(1);
-        assertTrue(String.format("expected rs.state == 1 was %d", rs.getState()),
-                rs.getState() == 1);
-
-        byte[] rs_ser = rs.toByteArray();
-        RilCtrlCmds.CtrlRspRadioState rsNew = RilCtrlCmds.CtrlRspRadioState.parseFrom(rs_ser);
-        assertTrue(String.format("expected rsNew.state == 1 was %d", rs.getState()),
-                rs.getState() == 1);
-
-        log("testProtobufSerdes X");
-    }
-
-    /**
-     * Test case 2: Test echo command works using writeMsg & readMsg
-     */
-    public void testEchoMsg() throws IOException {
-        log("testEchoMsg E");
-
-        MsgHeader mh = new MsgHeader();
-        mh.setCmd(0);
-        mh.setToken(1);
-        mh.setStatus(2);
-        ByteBuffer data = ByteBuffer.allocate(3);
-        data.put((byte)3);
-        data.put((byte)4);
-        data.put((byte)5);
-        Msg.send(mMockRilChannel, mh, data);
-
-        Msg respMsg = Msg.recv(mMockRilChannel);
-        assertTrue(String.format("expected mhd.header.cmd == 0 was %d",respMsg.getCmd()),
-                respMsg.getCmd() == 0);
-        assertTrue(String.format("expected mhd.header.token == 1 was %d",respMsg.getToken()),
-                respMsg.getToken() == 1);
-        assertTrue(String.format("expected mhd.header.status == 2 was %d", respMsg.getStatus()),
-                respMsg.getStatus() == 2);
-        assertTrue(String.format("expected mhd.data[0] == 3 was %d", respMsg.getData(0)),
-                respMsg.getData(0) == 3);
-        assertTrue(String.format("expected mhd.data[1] == 4 was %d", respMsg.getData(1)),
-                respMsg.getData(1) == 4);
-        assertTrue(String.format("expected mhd.data[2] == 5 was %d", respMsg.getData(2)),
-                respMsg.getData(2) == 5);
-
-        log("testEchoMsg X");
-    }
-
-    /**
-     * Test case 3: Test get as
-     */
-    public void testGetAs() {
-        log("testGetAs E");
-
-        // Use a message header as the protobuf data content
-        MsgHeader mh = new MsgHeader();
-        mh.setCmd(12345);
-        mh.setToken(9876);
-        mh.setStatus(7654);
-        mh.setLengthData(4321);
-        byte[] data = mh.toByteArray();
-        MsgHeader mhResult = Msg.getAs(MsgHeader.class, data);
-
-        assertTrue(String.format("expected cmd == 12345 was %d", mhResult.getCmd()),
-                mhResult.getCmd() == 12345);
-        assertTrue(String.format("expected token == 9876 was %d", mhResult.getToken()),
-                mhResult.getToken() == 9876);
-        assertTrue(String.format("expected status == 7654 was %d", mhResult.getStatus()),
-                mhResult.getStatus() == 7654);
-        assertTrue(String.format("expected lengthData == 4321 was %d", mhResult.getLengthData()),
-                mhResult.getLengthData() == 4321);
-
-        Msg msg = Msg.obtain();
-        msg.setData(ByteBuffer.wrap(data));
-
-        mhResult = msg.getDataAs(MsgHeader.class);
-
-        assertTrue(String.format("expected cmd == 12345 was %d", mhResult.getCmd()),
-                mhResult.getCmd() == 12345);
-        assertTrue(String.format("expected token == 9876 was %d", mhResult.getToken()),
-                mhResult.getToken() == 9876);
-        assertTrue(String.format("expected status == 7654 was %d", mhResult.getStatus()),
-                mhResult.getStatus() == 7654);
-        assertTrue(String.format("expected lengthData == 4321 was %d", mhResult.getLengthData()),
-                mhResult.getLengthData() == 4321);
-
-        log("testGetAs X");
-    }
-
-    /**
-     * Test case 3: test get radio state
-     */
-    public void testGetRadioState() throws IOException {
-        log("testGetRadioState E");
-
-        Msg.send(mMockRilChannel, 1, 9876, 0, null);
-
-        Msg resp = Msg.recv(mMockRilChannel);
-        //resp.printHeader("testGetRadioState");
-
-        assertTrue(String.format("expected cmd == 1 was %d", resp.getCmd()),
-                resp.getCmd() == 1);
-        assertTrue(String.format("expected token == 9876 was %d", resp.getToken()),
-                resp.getToken() == 9876);
-        assertTrue(String.format("expected status == 0 was %d", resp.getStatus()),
-                resp.getStatus() == 0);
-
-        RilCtrlCmds.CtrlRspRadioState rsp = resp.getDataAs(RilCtrlCmds.CtrlRspRadioState.class);
-
-        int state = rsp.getState();
-        log("testGetRadioState state=" + state);
-        assertTrue(String.format("expected RadioState >= 0 && RadioState <= 9 was %d", state),
-                ((state >= 0) && (state <= 9)));
-
-        log("testGetRadioState X");
-    }
-
-    /**
-     * Test case 5: test set radio state
-     */
-    public void testSetRadioState() throws IOException {
-        log("testSetRadioState E");
-
-        RilCtrlCmds.CtrlReqRadioState cmdrs = new RilCtrlCmds.CtrlReqRadioState();
-        assertEquals(0, cmdrs.getState());
-
-        cmdrs.setState(RilCmds.RADIOSTATE_SIM_NOT_READY);
-        assertEquals(2, cmdrs.getState());
-
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_SET_RADIO_STATE, 0, 0, cmdrs);
-
-        Msg resp = Msg.recv(mMockRilChannel);
-        log("get response status :" + resp.getStatus());
-        log("get response for command: " + resp.getCmd());
-        log("get command token: " + resp.getToken());
-
-        RilCtrlCmds.CtrlRspRadioState rsp = resp.getDataAs(RilCtrlCmds.CtrlRspRadioState.class);
-
-        int state = rsp.getState();
-        log("get response for testSetRadioState: " + state);
-        assertTrue(RilCmds.RADIOSTATE_SIM_NOT_READY == state);
-    }
-
-    /**
-     * Test case 6: test start incoming call and hangup it.
-     */
-    public void testStartIncomingCallAndHangup() throws IOException {
-        log("testStartIncomingCallAndHangup");
-        RilCtrlCmds.CtrlReqSetMTCall cmd = new RilCtrlCmds.CtrlReqSetMTCall();
-        String incomingCall = "6502889108";
-        // set the MT call
-        cmd.setPhoneNumber(incomingCall);
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_SET_MT_CALL, 0, 0, cmd);
-        // get response
-        Msg resp = Msg.recv(mMockRilChannel);
-        log("Get response status: " + resp.getStatus());
-        assertTrue("The ril is not in a proper state to set MT calls.",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-
-        // allow the incoming call alerting for some time
-        try {
-            Thread.sleep(5000);
-        } catch (InterruptedException e) {}
-
-        // we are playing a trick to assume the current is 1
-        RilCtrlCmds.CtrlHangupConnRemote hangupCmd = new RilCtrlCmds.CtrlHangupConnRemote();
-        hangupCmd.setConnectionId(1);
-        hangupCmd.setCallFailCause(16);   // normal hangup
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_HANGUP_CONN_REMOTE, 0, 0, hangupCmd);
-
-        // get response
-        resp = Msg.recv(mMockRilChannel);
-        log("Get response for hangup connection: " + resp.getStatus());
-        assertTrue("CTRL_CMD_HANGUP_CONN_REMOTE failed",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-    }
-
-    /**
-     * Test case 7: test set call transition flag
-     */
-    public void testSetCallTransitionFlag() throws IOException {
-        log("testSetCallTransitionFlag");
-        // Set flag to true:
-        RilCtrlCmds.CtrlSetCallTransitionFlag cmd = new RilCtrlCmds.CtrlSetCallTransitionFlag();
-        cmd.setFlag(true);
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_SET_CALL_TRANSITION_FLAG, 0, 0, cmd);
-
-        Msg resp = Msg.recv(mMockRilChannel);
-        log("Get response status: " + resp.getStatus());
-        assertTrue("Set call transition flag failed",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-
-        // add a dialing call
-        RilCtrlCmds.CtrlReqAddDialingCall cmdDialCall = new RilCtrlCmds.CtrlReqAddDialingCall();
-        String phoneNumber = "5102345678";
-        cmdDialCall.setPhoneNumber(phoneNumber);
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_ADD_DIALING_CALL, 0, 0, cmdDialCall);
-        resp = Msg.recv(mMockRilChannel);
-        log("Get response status for adding a dialing call: " + resp.getStatus());
-        assertTrue("add dialing call failed",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-        try {
-            Thread.sleep(5000);
-        } catch (InterruptedException e) {}
-
-        // send command to force call state change
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_SET_CALL_ALERT, 0, 0, null);
-        resp = Msg.recv(mMockRilChannel);
-        log("Get response status: " + resp.getStatus());
-        assertTrue("Set call alert failed",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-
-        try {
-            Thread.sleep(2000);
-        } catch (InterruptedException e) {}
-
-        // send command to force call state change
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_SET_CALL_ACTIVE, 0, 0, null);
-        resp = Msg.recv(mMockRilChannel);
-        log("Get response status: " + resp.getStatus());
-        assertTrue("Set call active failed",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-
-        // hangup the active all remotely
-        RilCtrlCmds.CtrlHangupConnRemote hangupCmd = new RilCtrlCmds.CtrlHangupConnRemote();
-        hangupCmd.setConnectionId(1);
-        hangupCmd.setCallFailCause(16);   // normal hangup
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_HANGUP_CONN_REMOTE, 0, 0, hangupCmd);
-        resp = Msg.recv(mMockRilChannel);
-        log("Get response for hangup connection: " + resp.getStatus());
-        assertTrue("CTRL_CMD_HANGUP_CONN_REMOTE failed",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-
-        // set the flag to false
-        cmd.setFlag(false);
-        Msg.send(mMockRilChannel, RilCtrlCmds.CTRL_CMD_SET_CALL_TRANSITION_FLAG, 0, 0, cmd);
-        resp = Msg.recv(mMockRilChannel);
-        assertTrue("Set call transition flag failed",
-                   resp.getStatus() == RilCtrlCmds.CTRL_STATUS_OK);
-    }
-}
diff --git a/tools/tdi b/tools/tdi
new file mode 100755
index 0000000..940a83b
--- /dev/null
+++ b/tools/tdi
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Telephony Debug Intents
+#set -x
+
+file_name='tdi'
+
+# Get the command as the first parameter
+cmd=$1
+shift
+
+function dc_errors()
+{
+    if [ "$1" == "" ]; then
+        echo "Usage: $file_name $cmd <dc> <count> <cause> <retry-time>"
+        echo "  <dc> must specifiy the DataConnection such as DC or GsmDC-1"
+        echo "  <count> := number of times to retry"
+        echo "  <cause> := From DataConnection.FailCause; such as -3 for SIGNAL_LOST"
+        echo "  <retry-time> := suggested retry time in milli-seconds"
+        exit
+    fi
+    the_DC=$1
+    echo "the_DC=$the_DC"
+
+    if [ "$2" != "" ]; then
+        counter="--ei counter $2";
+    fi
+    echo "counter=$counter"
+
+    if [ "$3" != "" ]; then
+        fail_cause="--ei fail_cause $3";
+    fi
+    echo "fail_cause=$fail_cause"
+
+    if [ "$4" != "" ]; then
+        suggested_retry_time="--ei suggested_retry_time $4";
+    fi
+    echo "suggested_retry_time=$suggested_retry_time"
+
+
+    adb shell am broadcast -a com.android.internal.telephony.$the_DC.action_fail_bringup $counter $fail_cause $suggested_retry_time
+}
+
+
+case ${cmd} in
+	dce) dc_errors "$@";;
+    # Add more commands in the future
+	*) echo 'Broadcast telephony debug intents'; echo 'usage: tdi [dce]'; echo '  dce=DC errors';;
+esac