Merge change 26793 into eclair

* changes:
  KeyStore: remove classes used by old keystore.
diff --git a/api/current.xml b/api/current.xml
index d764d16..36a82a8 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -125112,6 +125112,17 @@
  visibility="public"
 >
 </field>
+<field name="PHONE_TYPE_CDMA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="PHONE_TYPE_GSM"
  type="int"
  transient="false"
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index b8035ef..2d8a91a 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -40,7 +40,10 @@
 /**
  * The contract between the contacts provider and applications. Contains definitions
  * for the supported URIs and columns. These APIs supersede {@link Contacts}.
+ *
+ * @hide
  */
+@SuppressWarnings("unused")
 public final class ContactsContract {
     /** The authority for the contacts provider */
     public static final String AUTHORITY = "com.android.contacts";
@@ -225,7 +228,7 @@
         public static final String IN_VISIBLE_GROUP = "in_visible_group";
 
         /**
-         * Contact presence status.  See {@link android.provider.Im.CommonPresenceColumns}
+         * Contact presence status.  See {@link PresenceColumns}
          * for individual status definitions.  This column is only returned if explicitly
          * requested in the query projection.
          * <p>Type: NUMBER</p>
@@ -2531,8 +2534,6 @@
 
             /**
              * The extra field for the IM protocol
-             * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)}
-             * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P>
              */
             public static final String IM_PROTOCOL = "im_protocol";
 
diff --git a/telephony/java/android/telephony/CellLocation.java b/telephony/java/android/telephony/CellLocation.java
index 7d600f0..f763d3f 100644
--- a/telephony/java/android/telephony/CellLocation.java
+++ b/telephony/java/android/telephony/CellLocation.java
@@ -26,11 +26,10 @@
 import android.telephony.cdma.CdmaCellLocation;
 import android.telephony.gsm.GsmCellLocation;
 import com.android.internal.telephony.ITelephony;
-import com.android.internal.telephony.RILConstants;
+import com.android.internal.telephony.Phone;
 
 /**
- * Abstract class that represents the location of the device.  Currently the only
- * subclass is {@link android.telephony.gsm.GsmCellLocation}.  {@more}
+ * Abstract class that represents the location of the device.  {@more}
  */
 public abstract class CellLocation {
 
@@ -64,11 +63,13 @@
     public static CellLocation newFromBundle(Bundle bundle) {
         // TelephonyManager.getDefault().getPhoneType() handles the case when
         // ITelephony interface is not up yet.
-        int type = TelephonyManager.getDefault().getPhoneType();
-        if (type == RILConstants.CDMA_PHONE) {
+        switch(TelephonyManager.getDefault().getPhoneType()) {
+        case Phone.PHONE_TYPE_CDMA:
             return new CdmaCellLocation(bundle);
-        } else {
+        case Phone.PHONE_TYPE_GSM:
             return new GsmCellLocation(bundle);
+        default:
+            return null;
         }
     }
 
@@ -78,17 +79,20 @@
     public abstract void fillInNotifierBundle(Bundle bundle);
 
     /**
-     * Return a new CellLocation object representing an unknown location.
+     * Return a new CellLocation object representing an unknown
+     * location, or null for unknown/none phone radio types.
      *
      */
     public static CellLocation getEmpty() {
         // TelephonyManager.getDefault().getPhoneType() handles the case when
         // ITelephony interface is not up yet.
-        int type = TelephonyManager.getDefault().getPhoneType();
-        if (type == RILConstants.CDMA_PHONE) {
+        switch(TelephonyManager.getDefault().getPhoneType()) {
+        case Phone.PHONE_TYPE_CDMA:
             return new CdmaCellLocation();
-        } else {
+        case Phone.PHONE_TYPE_GSM:
             return new GsmCellLocation();
+        default:
+            return null;
         }
     }
 }
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 8914aceac..6664b08 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -263,22 +263,12 @@
        }
     }
 
-    /**
-     * No phone module
-     *
-     */
-    public static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE;
-
-    /**
-     * GSM phone
-     */
-    public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE;
-
-    /**
-     * CDMA phone
-     * @hide
-     */
-    public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE;
+    /** No phone radio. */
+    public static final int PHONE_TYPE_NONE = Phone.PHONE_TYPE_NONE;
+    /** Phone radio is GSM. */
+    public static final int PHONE_TYPE_GSM = Phone.PHONE_TYPE_GSM;
+    /** Phone radio is CDMA. */
+    public static final int PHONE_TYPE_CDMA = Phone.PHONE_TYPE_CDMA;
 
     /**
      * Returns a constant indicating the device phone type.
@@ -291,11 +281,7 @@
         try{
             ITelephony telephony = getITelephony();
             if (telephony != null) {
-                if(telephony.getActivePhoneType() == RILConstants.CDMA_PHONE) {
-                    return PHONE_TYPE_CDMA;
-                } else {
-                    return PHONE_TYPE_GSM;
-                }
+                return telephony.getActivePhoneType();
             } else {
                 // This can happen when the ITelephony interface is not up yet.
                 return getPhoneTypeFromProperty();
diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java
index 52f25f6..7586ba2 100644
--- a/telephony/java/com/android/internal/telephony/BaseCommands.java
+++ b/telephony/java/com/android/internal/telephony/BaseCommands.java
@@ -676,7 +676,7 @@
                 mRadioTechnologyChangedRegistrants.notifyRegistrants();
             }
 
-            if (mState.isGsm() && !oldState.isOn() && (mPhoneType == RILConstants.CDMA_PHONE)) {
+            if (mState.isGsm() && !oldState.isOn() && (mPhoneType == Phone.PHONE_TYPE_CDMA)) {
                 Log.d(LOG_TAG,"Notifying: radio technology change CDMA OFF to GSM");
                 mRadioTechnologyChangedRegistrants.notifyRegistrants();
             }
@@ -686,7 +686,7 @@
                 mRadioTechnologyChangedRegistrants.notifyRegistrants();
             }
 
-            if (mState.isCdma() && !oldState.isOn() && (mPhoneType == RILConstants.GSM_PHONE)) {
+            if (mState.isCdma() && !oldState.isOn() && (mPhoneType == Phone.PHONE_TYPE_GSM)) {
                 Log.d(LOG_TAG,"Notifying: radio technology change GSM OFF to CDMA");
                 mRadioTechnologyChangedRegistrants.notifyRegistrants();
             }
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java
index 9d83556..5777cad 100644
--- a/telephony/java/com/android/internal/telephony/CommandsInterface.java
+++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -1256,6 +1256,7 @@
 
     /** Set the Phone type created */
     void setPhoneType(int phoneType);
+
     /**
      *  Query the CDMA roaming preference setting
      *
diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java
index fffd128b..c113581 100644
--- a/telephony/java/com/android/internal/telephony/Phone.java
+++ b/telephony/java/com/android/internal/telephony/Phone.java
@@ -173,6 +173,11 @@
     static final int BM_AUS2_BAND   = 5; // GSM-900 / DCS-1800 / WCDMA-850
     static final int BM_BOUNDARY    = 6; // upper band boundary
 
+    // Radio Type
+    static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE;
+    static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE;
+    static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE;
+
     // Used for preferred network type
     // Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
     int NT_MODE_WCDMA_PREF   = RILConstants.NETWORK_MODE_WCDMA_PREF;
@@ -288,6 +293,12 @@
     String getPhoneName();
 
     /**
+     * Return a numerical identifier for the phone radio interface.
+     * @return PHONE_TYPE_XXX as defined above.
+     */
+    int getPhoneType();
+
+    /**
      * Returns an array of string identifiers for the APN types serviced by the
      * currently active or last connected APN.
      *  @return The string array.
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 1c62a82..1c03c5a 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -740,6 +740,8 @@
 
     public abstract String getPhoneName();
 
+    public abstract int getPhoneType();
+
     /** @hide */
     public int getVoiceMessageCount(){
         return 0;
diff --git a/telephony/java/com/android/internal/telephony/PhoneFactory.java b/telephony/java/com/android/internal/telephony/PhoneFactory.java
index a84f74e..cd72752 100644
--- a/telephony/java/com/android/internal/telephony/PhoneFactory.java
+++ b/telephony/java/com/android/internal/telephony/PhoneFactory.java
@@ -108,11 +108,11 @@
                 sCommandsInterface = new RIL(context, networkMode, cdmaSubscription);
 
                 int phoneType = getPhoneType(networkMode);
-                if (phoneType == RILConstants.GSM_PHONE) {
+                if (phoneType == Phone.PHONE_TYPE_GSM) {
                     sProxyPhone = new PhoneProxy(new GSMPhone(context,
                             sCommandsInterface, sPhoneNotifier));
                     Log.i(LOG_TAG, "Creating GSMPhone");
-                } else if (phoneType == RILConstants.CDMA_PHONE) {
+                } else if (phoneType == Phone.PHONE_TYPE_CDMA) {
                     sProxyPhone = new PhoneProxy(new CDMAPhone(context,
                             sCommandsInterface, sPhoneNotifier));
                     Log.i(LOG_TAG, "Creating CDMAPhone");
@@ -135,18 +135,18 @@
         case RILConstants.NETWORK_MODE_CDMA:
         case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
         case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
-            return RILConstants.CDMA_PHONE;
+            return Phone.PHONE_TYPE_CDMA;
 
         case RILConstants.NETWORK_MODE_WCDMA_PREF:
         case RILConstants.NETWORK_MODE_GSM_ONLY:
         case RILConstants.NETWORK_MODE_WCDMA_ONLY:
         case RILConstants.NETWORK_MODE_GSM_UMTS:
-            return RILConstants.GSM_PHONE;
+            return Phone.PHONE_TYPE_GSM;
 
         case RILConstants.NETWORK_MODE_GLOBAL:
-            return RILConstants.CDMA_PHONE;
+            return Phone.PHONE_TYPE_CDMA;
         default:
-            return RILConstants.GSM_PHONE;
+            return Phone.PHONE_TYPE_GSM;
         }
     }
 
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index c4f663a..b1eaa93 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -191,6 +191,10 @@
         return mActivePhone.getPhoneName();
     }
 
+    public int getPhoneType() {
+        return mActivePhone.getPhoneType();
+    }
+
     public String[] getActiveApnTypes() {
         return mActivePhone.getActiveApnTypes();
     }
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index dfc4889..6dcfcd9 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -60,7 +60,6 @@
 import com.android.internal.telephony.PhoneNotifier;
 import com.android.internal.telephony.PhoneProxy;
 import com.android.internal.telephony.PhoneSubInfo;
-import com.android.internal.telephony.RILConstants;
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.TelephonyProperties;
 
@@ -143,7 +142,7 @@
             boolean unitTestMode) {
         super(notifier, context, ci, unitTestMode);
 
-        mCM.setPhoneType(RILConstants.CDMA_PHONE);
+        mCM.setPhoneType(Phone.PHONE_TYPE_CDMA);
         mCT = new CdmaCallTracker(this);
         mSST = new CdmaServiceStateTracker (this);
         mSMS = new CdmaSMSDispatcher(this);
@@ -171,7 +170,7 @@
 
         //Change the system setting
         SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
-                new Integer(RILConstants.CDMA_PHONE).toString());
+                new Integer(Phone.PHONE_TYPE_CDMA).toString());
 
         // This is needed to handle phone process crashes
         String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
@@ -261,23 +260,24 @@
         return mSST.ss;
     }
 
-    public Phone.State
-    getState() {
+    public Phone.State getState() {
         return mCT.state;
     }
 
-    public String
-    getPhoneName() {
+    public String getPhoneName() {
         return "CDMA";
     }
 
+    public int getPhoneType() {
+        return Phone.PHONE_TYPE_CDMA;
+    }
+
     public boolean canTransfer() {
         Log.e(LOG_TAG, "canTransfer: not possible in CDMA");
         return false;
     }
 
-    public CdmaCall
-    getRingingCall() {
+    public CdmaCall getRingingCall() {
         return mCT.ringingCall;
     }
 
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
index 2fc2e13..5614c12 100755
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -66,7 +66,6 @@
 import com.android.internal.telephony.PhoneNotifier;
 import com.android.internal.telephony.PhoneProxy;
 import com.android.internal.telephony.PhoneSubInfo;
-import com.android.internal.telephony.RILConstants;
 import com.android.internal.telephony.TelephonyProperties;
 import com.android.internal.telephony.gsm.stk.StkService;
 import com.android.internal.telephony.test.SimulatedRadioControl;
@@ -141,7 +140,7 @@
             mSimulatedRadioControl = (SimulatedRadioControl) ci;
         }
 
-        mCM.setPhoneType(RILConstants.GSM_PHONE);
+        mCM.setPhoneType(Phone.PHONE_TYPE_GSM);
         mCT = new GsmCallTracker(this);
         mSST = new GsmServiceStateTracker (this);
         mSMS = new GsmSMSDispatcher(this);
@@ -201,7 +200,7 @@
 
         //Change the system property
         SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
-                new Integer(RILConstants.GSM_PHONE).toString());
+                new Integer(Phone.PHONE_TYPE_GSM).toString());
     }
 
     public void dispose() {
@@ -262,27 +261,27 @@
         return mSST.cellLoc;
     }
 
-    public Phone.State
-    getState() {
+    public Phone.State getState() {
         return mCT.state;
     }
 
-    public String
-    getPhoneName() {
+    public String getPhoneName() {
         return "GSM";
     }
 
+    public int getPhoneType() {
+        return Phone.PHONE_TYPE_GSM;
+    }
+
     public SignalStrength getSignalStrength() {
         return mSST.mSignalStrength;
     }
 
-    public boolean
-    getMessageWaitingIndicator() {
+    public boolean getMessageWaitingIndicator() {
         return mSIMRecords.getVoiceMessageWaiting();
     }
 
-    public boolean
-    getCallForwardingIndicator() {
+    public boolean getCallForwardingIndicator() {
         return mSIMRecords.getVoiceCallForwardingFlag();
     }