am 193f193f: Externally-reported Moderate severity vulnerability in SMS: Apps can...
Tom Taylor [Fri, 17 Jul 2015 17:08:25 +0000 (17:08 +0000)]
* commit '193f193f79f06784fc1cb90328c4410c6b52820e':
  Externally-reported Moderate severity vulnerability in SMS: Apps can bypass the SMS short code notification prompt

13 files changed:
src/java/android/telephony/SmsManager.java
src/java/com/android/internal/telephony/CommandException.java
src/java/com/android/internal/telephony/CommandsInterface.java
src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
src/java/com/android/internal/telephony/RIL.java
src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
src/java/com/android/internal/telephony/gsm/GSMPhone.java
src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
src/java/com/android/internal/telephony/sip/SipCommandInterface.java
src/java/com/android/internal/telephony/test/SimulatedCommands.java
src/java/com/android/internal/telephony/uicc/IccConstants.java
tests/telephonytests/src/com/android/internal/telephony/gsm/UsimDataDownloadCommands.java

index b73cb49..3af756e 100644 (file)
@@ -96,11 +96,9 @@ public final class SmsManager {
         }
 
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
-            if (iccISms != null) {
-                iccISms.sendText(ActivityThread.currentPackageName(), destinationAddress,
-                        scAddress, text, sentIntent, deliveryIntent);
-            }
+            ISms iccISms = getISmsServiceOrThrow();
+            iccISms.sendText(ActivityThread.currentPackageName(), destinationAddress,
+                    scAddress, text, sentIntent, deliveryIntent);
         } catch (RemoteException ex) {
             // ignore it
         }
@@ -176,12 +174,10 @@ public final class SmsManager {
 
         if (parts.size() > 1) {
             try {
-                ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
-                if (iccISms != null) {
-                    iccISms.sendMultipartText(ActivityThread.currentPackageName(),
-                            destinationAddress, scAddress, parts,
-                            sentIntents, deliveryIntents);
-                }
+                ISms iccISms = getISmsServiceOrThrow();
+                iccISms.sendMultipartText(ActivityThread.currentPackageName(),
+                        destinationAddress, scAddress, parts,
+                        sentIntents, deliveryIntents);
             } catch (RemoteException ex) {
                 // ignore it
             }
@@ -241,12 +237,10 @@ public final class SmsManager {
         }
 
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
-            if (iccISms != null) {
-                iccISms.sendData(ActivityThread.currentPackageName(),
-                        destinationAddress, scAddress, destinationPort & 0xFFFF,
-                        data, sentIntent, deliveryIntent);
-            }
+            ISms iccISms = getISmsServiceOrThrow();
+            iccISms.sendData(ActivityThread.currentPackageName(),
+                    destinationAddress, scAddress, destinationPort & 0xFFFF,
+                    data, sentIntent, deliveryIntent);
         } catch (RemoteException ex) {
             // ignore it
         }
@@ -266,6 +260,22 @@ public final class SmsManager {
     }
 
     /**
+     * Returns the ISms service, or throws an UnsupportedOperationException if
+     * the service does not exist.
+     */
+    private static ISms getISmsServiceOrThrow() {
+        ISms iccISms = getISmsService();
+        if (iccISms == null) {
+            throw new UnsupportedOperationException("Sms is not supported");
+        }
+        return iccISms;
+    }
+
+    private static ISms getISmsService() {
+        return ISms.Stub.asInterface(ServiceManager.getService("isms"));
+    }
+
+    /**
      * Copy a raw SMS PDU to the ICC.
      * ICC (Integrated Circuit Card) is the card of the device.
      * For example, this can be the SIM or USIM for GSM.
@@ -286,7 +296,7 @@ public final class SmsManager {
             throw new IllegalArgumentException("pdu is NULL");
         }
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 success = iccISms.copyMessageToIccEf(ActivityThread.currentPackageName(),
                         status, pdu, smsc);
@@ -315,7 +325,7 @@ public final class SmsManager {
         Arrays.fill(pdu, (byte)0xff);
 
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 success = iccISms.updateMessageOnIccEf(ActivityThread.currentPackageName(),
                         messageIndex, STATUS_ON_ICC_FREE, pdu);
@@ -345,7 +355,7 @@ public final class SmsManager {
         boolean success = false;
 
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 success = iccISms.updateMessageOnIccEf(ActivityThread.currentPackageName(),
                         messageIndex, newStatus, pdu);
@@ -370,7 +380,7 @@ public final class SmsManager {
         List<SmsRawData> records = null;
 
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 records = iccISms.getAllMessagesFromIccEf(ActivityThread.currentPackageName());
             }
@@ -401,7 +411,7 @@ public final class SmsManager {
         boolean success = false;
 
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 success = iccISms.enableCellBroadcast(messageIdentifier);
             }
@@ -432,7 +442,7 @@ public final class SmsManager {
         boolean success = false;
 
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 success = iccISms.disableCellBroadcast(messageIdentifier);
             }
@@ -469,7 +479,7 @@ public final class SmsManager {
             throw new IllegalArgumentException("endMessageId < startMessageId");
         }
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 success = iccISms.enableCellBroadcastRange(startMessageId, endMessageId);
             }
@@ -506,7 +516,7 @@ public final class SmsManager {
             throw new IllegalArgumentException("endMessageId < startMessageId");
         }
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 success = iccISms.disableCellBroadcastRange(startMessageId, endMessageId);
             }
@@ -556,7 +566,7 @@ public final class SmsManager {
     boolean isImsSmsSupported() {
         boolean boSupported = false;
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 boSupported = iccISms.isImsSmsSupported();
             }
@@ -581,7 +591,7 @@ public final class SmsManager {
     String getImsSmsFormat() {
         String format = com.android.internal.telephony.SmsConstants.FORMAT_UNKNOWN;
         try {
-            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
+            ISms iccISms = getISmsService();
             if (iccISms != null) {
                 format = iccISms.getImsSmsFormat();
             }
index 550e91c..80338ae 100644 (file)
@@ -42,6 +42,8 @@ public class CommandException extends RuntimeException {
         MODE_NOT_SUPPORTED,
         FDN_CHECK_FAILURE,
         ILLEGAL_SIM_OR_ME,
+        MISSING_RESOURCE,
+        NO_SUCH_ELEMENT,
     }
 
     public CommandException(Error e) {
@@ -83,6 +85,10 @@ public class CommandException extends RuntimeException {
                 return new CommandException(Error.FDN_CHECK_FAILURE);
             case RILConstants.ILLEGAL_SIM_OR_ME:
                 return new CommandException(Error.ILLEGAL_SIM_OR_ME);
+            case RILConstants.MISSING_RESOURCE:
+                return new CommandException(Error.MISSING_RESOURCE);
+            case RILConstants.NO_SUCH_ELEMENT:
+                return new CommandException(Error.NO_SUCH_ELEMENT);
             default:
                 Rlog.e("GSM", "Unrecognized RIL errno " + ril_errno);
                 return new CommandException(Error.INVALID_RESPONSE);
index 99274f8..9cb2db8 100644 (file)
@@ -1700,6 +1700,64 @@ public interface CommandsInterface {
      */
     public void testingEmergencyCall();
 
+    /**
+     * Open a logical channel to the SIM.
+     *
+     * Input parameters equivalent to TS 27.007 AT+CCHO command.
+     *
+     * @param AID Application id. See ETSI 102.221 and 101.220.
+     * @param response Callback message. response.obj will be an int [1] with
+     *            element [0] set to the id of the logical channel.
+     */
+    public void iccOpenLogicalChannel(String AID, Message response);
+
+    /**
+     * Close a previously opened logical channel to the SIM.
+     *
+     * Input parameters equivalent to TS 27.007 AT+CCHC command.
+     *
+     * @param channel Channel id. Id of the channel to be closed.
+     * @param response Callback message.
+     */
+    public void iccCloseLogicalChannel(int channel, Message response);
+
+    /**
+     * Exchange APDUs with the SIM on a logical channel.
+     *
+     * Input parameters equivalent to TS 27.007 AT+CGLA command.
+     *
+     * @param channel Channel id of the channel to use for communication. Has to
+     *            be greater than zero.
+     * @param cla Class of the APDU command.
+     * @param instruction Instruction of the APDU command.
+     * @param p1 P1 value of the APDU command.
+     * @param p2 P2 value of the APDU command.
+     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
+     *            is sent to the SIM.
+     * @param data Data to be sent with the APDU.
+     * @param response Callback message. response.obj.userObj will be
+     *            an IccIoResult on success.
+     */
+    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
+            int p1, int p2, int p3, String data, Message response);
+
+    /**
+     * Exchange APDUs with the SIM on a basic channel.
+     *
+     * Input parameters equivalent to TS 27.007 AT+CSIM command.
+     *
+     * @param cla Class of the APDU command.
+     * @param instruction Instruction of the APDU command.
+     * @param p1 P1 value of the APDU command.
+     * @param p2 P2 value of the APDU command.
+     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
+     *            is sent to the SIM.
+     * @param data Data to be sent with the APDU.
+     * @param response Callback message. response.obj.userObj will be
+     *            an IccIoResult on success.
+     */
+    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
+            int p3, String data, Message response);
 
     /**
      * @return version of the ril.
index 636ae39..bb83f6f 100644 (file)
@@ -50,7 +50,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
             incomingNumber = ringingCall.getEarliestConnection().getAddress();
         }
         try {
-            mRegistry.notifyCallState(convertCallState(sender.getState()), incomingNumber);
+            if (mRegistry != null) {
+                mRegistry.notifyCallState(convertCallState(sender.getState()), incomingNumber);
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -64,7 +66,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
             ss.setStateOutOfService();
         }
         try {
-            mRegistry.notifyServiceState(ss);
+            if (mRegistry != null) {
+                mRegistry.notifyServiceState(ss);
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -73,7 +77,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
     @Override
     public void notifySignalStrength(Phone sender) {
         try {
-            mRegistry.notifySignalStrength(sender.getSignalStrength());
+            if (mRegistry != null) {
+                mRegistry.notifySignalStrength(sender.getSignalStrength());
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -82,7 +88,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
     @Override
     public void notifyMessageWaitingChanged(Phone sender) {
         try {
-            mRegistry.notifyMessageWaitingChanged(sender.getMessageWaitingIndicator());
+            if (mRegistry != null) {
+                mRegistry.notifyMessageWaitingChanged(sender.getMessageWaitingIndicator());
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -91,7 +99,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
     @Override
     public void notifyCallForwardingChanged(Phone sender) {
         try {
-            mRegistry.notifyCallForwardingChanged(sender.getCallForwardingIndicator());
+            if (mRegistry != null) {
+                mRegistry.notifyCallForwardingChanged(sender.getCallForwardingIndicator());
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -100,7 +110,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
     @Override
     public void notifyDataActivity(Phone sender) {
         try {
-            mRegistry.notifyDataActivity(convertDataActivityState(sender.getDataActivityState()));
+            if (mRegistry != null) {
+                mRegistry.notifyDataActivity(convertDataActivityState(sender.getDataActivityState()));
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -130,16 +142,18 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
         if (ss != null) roaming = ss.getRoaming();
 
         try {
-            mRegistry.notifyDataConnection(
-                    convertDataState(state),
-                    sender.isDataConnectivityPossible(apnType), reason,
-                    sender.getActiveApnHost(apnType),
-                    apnType,
-                    linkProperties,
-                    linkCapabilities,
-                    ((telephony!=null) ? telephony.getNetworkType() :
-                    TelephonyManager.NETWORK_TYPE_UNKNOWN),
-                    roaming);
+            if (mRegistry != null) {
+                mRegistry.notifyDataConnection(
+                        convertDataState(state),
+                        sender.isDataConnectivityPossible(apnType), reason,
+                        sender.getActiveApnHost(apnType),
+                        apnType,
+                        linkProperties,
+                        linkCapabilities,
+                        ((telephony!=null) ? telephony.getNetworkType() :
+                                TelephonyManager.NETWORK_TYPE_UNKNOWN),
+                        roaming);
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -148,7 +162,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
     @Override
     public void notifyDataConnectionFailed(Phone sender, String reason, String apnType) {
         try {
-            mRegistry.notifyDataConnectionFailed(reason, apnType);
+            if (mRegistry != null) {
+                mRegistry.notifyDataConnectionFailed(reason, apnType);
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -159,7 +175,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
         Bundle data = new Bundle();
         sender.getCellLocation().fillInNotifierBundle(data);
         try {
-            mRegistry.notifyCellLocation(data);
+            if (mRegistry != null) {
+                mRegistry.notifyCellLocation(data);
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
@@ -168,7 +186,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
     @Override
     public void notifyCellInfo(Phone sender, List<CellInfo> cellInfo) {
         try {
-            mRegistry.notifyCellInfo(cellInfo);
+            if (mRegistry != null) {
+                mRegistry.notifyCellInfo(cellInfo);
+            }
         } catch (RemoteException ex) {
 
         }
@@ -177,7 +197,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
     @Override
     public void notifyOtaspChanged(Phone sender, int otaspMode) {
         try {
-            mRegistry.notifyOtaspChanged(otaspMode);
+            if (mRegistry != null) {
+                mRegistry.notifyOtaspChanged(otaspMode);
+            }
         } catch (RemoteException ex) {
             // system process is dead
         }
index 1572a4e..938fd38 100644 (file)
@@ -483,7 +483,12 @@ public class IccSmsInterfaceManager extends ISms.Stub {
      * @return byte array for the record.
      */
     protected byte[] makeSmsRecordData(int status, byte[] pdu) {
-        byte[] data = new byte[IccConstants.SMS_RECORD_LENGTH];
+        byte[] data;
+        if (PhoneConstants.PHONE_TYPE_GSM == mPhone.getPhoneType()) {
+            data = new byte[IccConstants.SMS_RECORD_LENGTH];
+        } else {
+            data = new byte[IccConstants.CDMA_SMS_RECORD_LENGTH];
+        }
 
         // Status bits for this record.  See TS 51.011 10.5.3
         data[0] = (byte)(status & 7);
@@ -491,7 +496,7 @@ public class IccSmsInterfaceManager extends ISms.Stub {
         System.arraycopy(pdu, 0, data, 1, pdu.length);
 
         // Pad out with 0xFF's.
-        for (int j = pdu.length+1; j < IccConstants.SMS_RECORD_LENGTH; j++) {
+        for (int j = pdu.length+1; j < data.length; j++) {
             data[j] = -1;
         }
 
index 824e191..268174d 100644 (file)
@@ -2435,6 +2435,10 @@ public final class RIL extends BaseCommands implements CommandsInterface {
             case RIL_REQUEST_SET_INITIAL_ATTACH_APN: ret = responseVoid(p); break;
             case RIL_REQUEST_IMS_REGISTRATION_STATE: ret = responseInts(p); break;
             case RIL_REQUEST_IMS_SEND_SMS: ret =  responseSMS(p); break;
+            case RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC: ret =  responseICC_IO(p); break;
+            case RIL_REQUEST_SIM_OPEN_CHANNEL: ret  = responseInts(p); break;
+            case RIL_REQUEST_SIM_CLOSE_CHANNEL: ret  = responseVoid(p); break;
+            case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: ret = responseICC_IO(p); break;
             default:
                 throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
             //break;
@@ -3740,6 +3744,10 @@ public final class RIL extends BaseCommands implements CommandsInterface {
             case RIL_REQUEST_SET_INITIAL_ATTACH_APN: return "RIL_REQUEST_SET_INITIAL_ATTACH_APN";
             case RIL_REQUEST_IMS_REGISTRATION_STATE: return "RIL_REQUEST_IMS_REGISTRATION_STATE";
             case RIL_REQUEST_IMS_SEND_SMS: return "RIL_REQUEST_IMS_SEND_SMS";
+            case RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC: return "RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC";
+            case RIL_REQUEST_SIM_OPEN_CHANNEL: return "RIL_REQUEST_SIM_OPEN_CHANNEL";
+            case RIL_REQUEST_SIM_CLOSE_CHANNEL: return "RIL_REQUEST_SIM_CLOSE_CHANNEL";
+            case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: return "RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL";
             default: return "<unknown request>";
         }
     }
@@ -4110,4 +4118,81 @@ public final class RIL extends BaseCommands implements CommandsInterface {
         pw.println(" mLastNITZTimeInfo=" + mLastNITZTimeInfo);
         pw.println(" mTestingEmergencyCall=" + mTestingEmergencyCall.get());
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void iccOpenLogicalChannel(String AID, Message response) {
+        RILRequest rr = RILRequest.obtain(RIL_REQUEST_SIM_OPEN_CHANNEL, response);
+        rr.mParcel.writeString(AID);
+
+        if (RILJ_LOGD)
+            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
+        send(rr);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void iccCloseLogicalChannel(int channel, Message response) {
+        RILRequest rr = RILRequest.obtain(RIL_REQUEST_SIM_CLOSE_CHANNEL, response);
+        rr.mParcel.writeInt(1);
+        rr.mParcel.writeInt(channel);
+
+        if (RILJ_LOGD)
+            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
+        send(rr);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
+            int p1, int p2, int p3, String data, Message response) {
+        if (channel <= 0) {
+            throw new RuntimeException(
+                "Invalid channel in iccTransmitApduLogicalChannel: " + channel);
+        }
+
+        iccTransmitApduHelper(channel, cla, instruction, p1, p2, p3, data, response);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
+            int p3, String data, Message response) {
+        iccTransmitApduHelper(0, cla, instruction, p1, p2, p3, data, response);
+    }
+
+    /*
+     * Helper function for the iccTransmitApdu* commands above.
+     */
+    private void iccTransmitApduHelper(int channel, int cla, int instruction,
+            int p1, int p2, int p3, String data, Message response) {
+        RILRequest rr;
+        if (channel == 0)
+            rr = RILRequest.obtain(RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, response);
+        else
+            rr = RILRequest.obtain(RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, response);
+
+        rr.mParcel.writeInt(channel);
+        rr.mParcel.writeInt(cla);
+        rr.mParcel.writeInt(instruction);
+        rr.mParcel.writeInt(p1);
+        rr.mParcel.writeInt(p2);
+        rr.mParcel.writeInt(p3);
+        rr.mParcel.writeString(data);
+
+        if (RILJ_LOGD)
+            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
+        send(rr);
+    }
 }
index 3ba47c3..73db998 100644 (file)
@@ -360,7 +360,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
         }
 
         if (hasChanged) {
-            if (mPhone.isEriFileLoaded()) {
+            if ((mCi.getRadioState().isOn()) && (mPhone.isEriFileLoaded())) {
                 String eriText;
                 // Now the CDMAPhone sees the new ServiceState so it can get the
                 // new ERI text
index 0e2a73e..2b435b5 100644 (file)
@@ -93,7 +93,6 @@ public class GSMPhone extends PhoneBase {
     static final String LOG_TAG = "GSMPhone";
     private static final boolean LOCAL_DEBUG = 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";
@@ -115,9 +114,6 @@ public class GSMPhone extends PhoneBase {
     /** List of Registrants to receive Supplementary Service Notifications. */
     RegistrantList mSsnRegistrants = new RegistrantList();
 
-    Thread mDebugPortThread;
-    ServerSocket mDebugSocket;
-
     private String mImei;
     private String mImeiSv;
     private String mVmNumber;
@@ -167,41 +163,6 @@ public class GSMPhone extends PhoneBase {
         mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
         mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
 
-        if (DBG_PORT) {
-            try {
-                //debugSocket = new LocalServerSocket("com.android.internal.telephony.debug");
-                mDebugSocket = new ServerSocket();
-                mDebugSocket.setReuseAddress(true);
-                mDebugSocket.bind (new InetSocketAddress("127.0.0.1", 6666));
-
-                mDebugPortThread
-                    = new Thread(
-                        new Runnable() {
-                            @Override
-                            public void run() {
-                                for(;;) {
-                                    try {
-                                        Socket sock;
-                                        sock = mDebugSocket.accept();
-                                        Rlog.i(LOG_TAG, "New connection; resetting radio");
-                                        mCi.resetRadio(null);
-                                        sock.close();
-                                    } catch (IOException ex) {
-                                        Rlog.w(LOG_TAG,
-                                            "Exception accepting socket", ex);
-                                    }
-                                }
-                            }
-                        },
-                        "GSMPhone debug");
-
-                mDebugPortThread.start();
-
-            } catch (IOException ex) {
-                Rlog.w(LOG_TAG, "Failure to open com.android.internal.telephony.debug socket", ex);
-            }
-        }
-
         //Change the system property
         SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
                 new Integer(PhoneConstants.PHONE_TYPE_GSM).toString());
index 24ec586..5781736 100644 (file)
@@ -1362,14 +1362,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
         String[] numericArray = mPhone.getContext().getResources().getStringArray(
                     com.android.internal.R.array.config_operatorConsideredNonRoaming);
 
-        if (numericArray.length == 0 || operatorNumeric == null) {
+        if (numericArray.length == 0 || operatorNumeric == null)
             return false;
-        }
 
         for (String numeric : numericArray) {
-            if (operatorNumeric.startsWith(numeric)) {
+            if (operatorNumeric.startsWith(numeric))
                 return true;
-            }
         }
         return false;
     }
@@ -1379,14 +1377,14 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
         String[] numericArray = mPhone.getContext().getResources().getStringArray(
                     com.android.internal.R.array.config_sameNamedOperatorConsideredRoaming);
 
-        if (numericArray.length == 0 || operatorNumeric == null) {
+        if (numericArray.length == 0 || operatorNumeric == null)
             return false;
-        }
 
         for (String numeric : numericArray) {
-            if (operatorNumeric.startsWith(numeric)) {
+            if (operatorNumeric.startsWith(numeric))
                 return true;
-            }
+            else
+                return false;
         }
         return false;
     }
index 42a3ff6..49c9933 100644 (file)
@@ -555,4 +555,22 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
     public void setInitialAttachApn(String apn, String protocol, int authType, String username,
             String password, Message result) {
     }
+
+    @Override
+    public void iccOpenLogicalChannel(String AID, Message response) {
+    }
+
+    @Override
+    public void iccCloseLogicalChannel(int channel, Message response) {
+    }
+
+    @Override
+    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
+            int p1, int p2, int p3, String data, Message response) {
+    }
+
+    @Override
+    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
+            int p3, String data, Message response) {
+    }
 }
index 8e886bb..d4d012e 100644 (file)
@@ -1677,4 +1677,26 @@ public final class SimulatedCommands extends BaseCommands
             int retry, int messageRef, Message response){
         unimplemented(response);
     }
+
+    @Override
+    public void iccOpenLogicalChannel(String AID, Message response) {
+        unimplemented(response);
+    }
+
+    @Override
+    public void iccCloseLogicalChannel(int channel, Message response) {
+        unimplemented(response);
+    }
+
+    @Override
+    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
+            int p1, int p2, int p3, String data, Message response) {
+        unimplemented(response);
+    }
+
+    @Override
+    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
+            int p3, String data, Message response) {
+        unimplemented(response);
+    }
 }
index 26ae602..ae1c442 100644 (file)
@@ -79,6 +79,8 @@ public interface IccConstants {
 
     // SMS record length from TS 51.011 10.5.3
     static public final int SMS_RECORD_LENGTH = 176;
+    // SMS record length from C.S0023 3.4.27
+    static public final int CDMA_SMS_RECORD_LENGTH = 255;
 
     static final String MF_SIM = "3F00";
     static final String DF_TELECOM = "7F10";
index bb944ae..ec6e230 100644 (file)
@@ -644,4 +644,22 @@ class UsimDataDownloadCommands extends BaseCommands {
     public void iccIOForApp(int command, int fileid, String path, int p1, int p2, int p3,
             String data, String pin2, String aid, Message response) {
     }
+
+    @Override
+    public void iccOpenLogicalChannel(String AID, Message response) {
+    }
+
+    @Override
+    public void iccCloseLogicalChannel(int channel, Message response) {
+    }
+
+    @Override
+    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
+            int p1, int p2, int p3, String data, Message response) {
+    }
+
+    @Override
+    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
+            int p3, String data, Message response) {
+    }
 }