Loading Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -26,8 +26,9 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src/java) \ $(call all-proto-files-under, proto) LOCAL_JAVA_LIBRARIES := voip-common ims-common LOCAL_STATIC_JAVA_LIBRARIES := android.hardware.radio-V1.0-java-static \ LOCAL_STATIC_JAVA_LIBRARIES := android.hardware.radio-V1.1-java-static \ android.hardware.radio.deprecated-V1.0-java-static LOCAL_MODULE_TAGS := optional LOCAL_MODULE := telephony-common LOCAL_PROTOC_OPTIMIZE_TYPE := nano Loading src/java/com/android/internal/telephony/BaseCommands.java +11 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mPhoneRadioCapabilityChangedRegistrants = new RegistrantList(); protected RegistrantList mPcoDataRegistrants = new RegistrantList(); protected RegistrantList mCarrierInfoForImsiEncryptionRegistrants = new RegistrantList(); protected Registrant mGsmSmsRegistrant; Loading Loading @@ -905,4 +906,14 @@ public abstract class BaseCommands implements CommandsInterface { public void unregisterForPcoData(Handler h) { mPcoDataRegistrants.remove(h); } @Override public void registerForCarrierInfoForImsiEncryption(Handler h, int what, Object obj) { mCarrierInfoForImsiEncryptionRegistrants.add(new Registrant(h, what, obj)); } @Override public void unregisterForCarrierInfoForImsiEncryption(Handler h) { mCarrierInfoForImsiEncryptionRegistrants.remove(h); } } src/java/com/android/internal/telephony/CommandsInterface.java +29 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.internal.telephony.dataconnection.DataProfile; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import com.android.internal.telephony.uicc.IccCardStatus; import java.security.PublicKey; import java.util.List; /** Loading Loading @@ -1433,6 +1434,18 @@ public interface CommandsInterface { void invokeOemRilRequestRaw(byte[] data, Message response); /** * Sends carrier specific information to the vendor ril that can be used to * encrypt the IMSI and IMPI. * * @param publicKey the public key of the carrier used to encrypt IMSI/IMPI. * @param keyIdentifier the key identifier is optional information that is carrier * specific. * @param response callback message */ void setCarrierInfoForImsiEncryption(PublicKey publicKey, String keyIdentifier, Message response); void invokeOemRilRequestStrings(String[] strings, Message response); /** Loading Loading @@ -2070,6 +2083,22 @@ public interface CommandsInterface { */ void setSimCardPower(boolean powerUp, Message result); /** * Register for unsolicited Carrier Public Key. * * @param h Handler for notificaiton message. * @param what User-defined message code. * @param obj User object. */ void registerForCarrierInfoForImsiEncryption(Handler h, int what, Object obj); /** * DeRegister for unsolicited Carrier Public Key. * * @param h Handler for notificaiton message. */ void unregisterForCarrierInfoForImsiEncryption(Handler h); default public List<ClientRequestStats> getClientRequestStats() { return null; } Loading src/java/com/android/internal/telephony/RIL.java +46 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import java.io.DataInputStream; import java.io.FileDescriptor; import java.io.IOException; import java.io.PrintWriter; import java.security.PublicKey; import java.util.ArrayList; import java.util.Arrays; import java.util.List; Loading Loading @@ -3622,6 +3623,34 @@ public final class RIL extends BaseCommands implements CommandsInterface { } } @Override public void setCarrierInfoForImsiEncryption(PublicKey publicKey, String keyIdentifier, Message result) { IRadio radioProxy = getRadioProxy(result); if (radioProxy != null) { android.hardware.radio.V1_1.IRadio radioProxy11 = android.hardware.radio.V1_1.IRadio.castFrom(radioProxy); if (radioProxy11 == null) { if (result != null) { AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED)); result.sendToTarget(); } } else { RILRequest rr = obtainRequest(RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, result, mRILDefaultWorkSource); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); try { radioProxy11.setCarrierInfoForImsiEncryption( rr.mSerial, publicKeyToArrayList(publicKey), keyIdentifier); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "setCarrierInfoForImsiEncryption", e); } } } } @Override public void getIMEI(Message result) { throw new RuntimeException("getIMEI not expected to be called"); Loading Loading @@ -4523,6 +4552,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { return "RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER"; case RIL_RESPONSE_ACKNOWLEDGEMENT: return "RIL_RESPONSE_ACKNOWLEDGEMENT"; case RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION: return "RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION"; default: return "<unknown request>"; } } Loading Loading @@ -4621,6 +4652,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { return "UNSOL_LCE_INFO_RECV"; case RIL_UNSOL_PCO_DATA: return "UNSOL_PCO_DATA"; case RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION: return "RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION"; default: return "<unknown response>"; } Loading Loading @@ -4709,6 +4742,19 @@ public final class RIL extends BaseCommands implements CommandsInterface { return arrayList; } /** * Method to serialize the Public Key into ArrayList of bytes * @param publicKey publicKey to be converted to ArrayList of bytes. **/ public static ArrayList<Byte> publicKeyToArrayList(PublicKey publicKey) { byte[] key = publicKey.getEncoded(); ArrayList<Byte> arrayList = new ArrayList<>(key.length); for (byte b : key) { arrayList.add(b); } return arrayList; } public static byte[] arrayListToPrimitiveArray(ArrayList<Byte> bytes) { byte[] ret = new byte[bytes.size()]; for (int i = 0; i < ret.length; i++) { Loading src/java/com/android/internal/telephony/RadioIndication.java +49 −35 Original line number Diff line number Diff line Loading @@ -16,42 +16,8 @@ package com.android.internal.telephony; import android.hardware.radio.V1_0.CdmaCallWaiting; import android.hardware.radio.V1_0.CdmaInformationRecord; import android.hardware.radio.V1_0.CdmaLineControlInfoRecord; import android.hardware.radio.V1_0.CdmaNumberInfoRecord; import android.hardware.radio.V1_0.CdmaRedirectingNumberInfoRecord; import android.hardware.radio.V1_0.CdmaSignalInfoRecord; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.hardware.radio.V1_0.CdmaT53AudioControlInfoRecord; import android.hardware.radio.V1_0.CfData; import android.hardware.radio.V1_0.IRadioIndication; import android.hardware.radio.V1_0.LceDataInfo; import android.hardware.radio.V1_0.PcoDataInfo; import android.hardware.radio.V1_0.SetupDataCallResult; import android.hardware.radio.V1_0.SimRefreshResult; import android.hardware.radio.V1_0.SsInfoData; import android.hardware.radio.V1_0.StkCcUnsolSsResult; import android.hardware.radio.V1_0.SuppSvcNotification; import android.os.AsyncResult; import android.os.SystemProperties; import android.telephony.CellInfo; import android.telephony.PcoData; import android.telephony.SignalStrength; import android.telephony.SmsMessage; import com.android.internal.telephony.TelephonyProto.SmsSession; import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; import com.android.internal.telephony.cdma.CdmaInformationRecords; import com.android.internal.telephony.dataconnection.DataCallResponse; import com.android.internal.telephony.gsm.SsData; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.uicc.IccRefreshResponse; import com.android.internal.telephony.uicc.IccUtils; import java.util.ArrayList; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CALL_RING; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_CALL_WAITING; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_INFO_REC; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_OTA_PROVISION_STATUS; Loading Loading @@ -96,6 +62,41 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_UICC_SUBSCRI import static com.android.internal.telephony.RILConstants.RIL_UNSOL_VOICE_RADIO_TECH_CHANGED; import static com.android.internal.telephony.RILConstants.RIL_UNSOl_CDMA_PRL_CHANGED; import android.hardware.radio.V1_0.CdmaCallWaiting; import android.hardware.radio.V1_0.CdmaInformationRecord; import android.hardware.radio.V1_0.CdmaLineControlInfoRecord; import android.hardware.radio.V1_0.CdmaNumberInfoRecord; import android.hardware.radio.V1_0.CdmaRedirectingNumberInfoRecord; import android.hardware.radio.V1_0.CdmaSignalInfoRecord; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.hardware.radio.V1_0.CdmaT53AudioControlInfoRecord; import android.hardware.radio.V1_0.CfData; import android.hardware.radio.V1_0.LceDataInfo; import android.hardware.radio.V1_0.PcoDataInfo; import android.hardware.radio.V1_0.SetupDataCallResult; import android.hardware.radio.V1_0.SimRefreshResult; import android.hardware.radio.V1_0.SsInfoData; import android.hardware.radio.V1_0.StkCcUnsolSsResult; import android.hardware.radio.V1_0.SuppSvcNotification; import android.hardware.radio.V1_1.IRadioIndication; import android.os.AsyncResult; import android.os.SystemProperties; import android.telephony.CellInfo; import android.telephony.PcoData; import android.telephony.SignalStrength; import android.telephony.SmsMessage; import com.android.internal.telephony.TelephonyProto.SmsSession; import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; import com.android.internal.telephony.cdma.CdmaInformationRecords; import com.android.internal.telephony.dataconnection.DataCallResponse; import com.android.internal.telephony.gsm.SsData; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.uicc.IccRefreshResponse; import com.android.internal.telephony.uicc.IccUtils; import java.util.ArrayList; public class RadioIndication extends IRadioIndication.Stub { RIL mRil; Loading Loading @@ -775,6 +776,19 @@ public class RadioIndication extends IRadioIndication.Stub { mRil.processIndication(indicationType); } /** * Indicates when the carrier info to encrypt IMSI is being requested * @param indicationType RadioIndicationType */ public void carrierInfoForImsiEncryption(int indicationType) { mRil.processIndication(indicationType); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, null); mRil.mCarrierInfoForImsiEncryptionRegistrants.notifyRegistrants( new AsyncResult(null, null, null)); } private CommandsInterface.RadioState getRadioStateFromInt(int stateInt) { CommandsInterface.RadioState state; Loading Loading
Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -26,8 +26,9 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src/java) \ $(call all-proto-files-under, proto) LOCAL_JAVA_LIBRARIES := voip-common ims-common LOCAL_STATIC_JAVA_LIBRARIES := android.hardware.radio-V1.0-java-static \ LOCAL_STATIC_JAVA_LIBRARIES := android.hardware.radio-V1.1-java-static \ android.hardware.radio.deprecated-V1.0-java-static LOCAL_MODULE_TAGS := optional LOCAL_MODULE := telephony-common LOCAL_PROTOC_OPTIMIZE_TYPE := nano Loading
src/java/com/android/internal/telephony/BaseCommands.java +11 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mPhoneRadioCapabilityChangedRegistrants = new RegistrantList(); protected RegistrantList mPcoDataRegistrants = new RegistrantList(); protected RegistrantList mCarrierInfoForImsiEncryptionRegistrants = new RegistrantList(); protected Registrant mGsmSmsRegistrant; Loading Loading @@ -905,4 +906,14 @@ public abstract class BaseCommands implements CommandsInterface { public void unregisterForPcoData(Handler h) { mPcoDataRegistrants.remove(h); } @Override public void registerForCarrierInfoForImsiEncryption(Handler h, int what, Object obj) { mCarrierInfoForImsiEncryptionRegistrants.add(new Registrant(h, what, obj)); } @Override public void unregisterForCarrierInfoForImsiEncryption(Handler h) { mCarrierInfoForImsiEncryptionRegistrants.remove(h); } }
src/java/com/android/internal/telephony/CommandsInterface.java +29 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.internal.telephony.dataconnection.DataProfile; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import com.android.internal.telephony.uicc.IccCardStatus; import java.security.PublicKey; import java.util.List; /** Loading Loading @@ -1433,6 +1434,18 @@ public interface CommandsInterface { void invokeOemRilRequestRaw(byte[] data, Message response); /** * Sends carrier specific information to the vendor ril that can be used to * encrypt the IMSI and IMPI. * * @param publicKey the public key of the carrier used to encrypt IMSI/IMPI. * @param keyIdentifier the key identifier is optional information that is carrier * specific. * @param response callback message */ void setCarrierInfoForImsiEncryption(PublicKey publicKey, String keyIdentifier, Message response); void invokeOemRilRequestStrings(String[] strings, Message response); /** Loading Loading @@ -2070,6 +2083,22 @@ public interface CommandsInterface { */ void setSimCardPower(boolean powerUp, Message result); /** * Register for unsolicited Carrier Public Key. * * @param h Handler for notificaiton message. * @param what User-defined message code. * @param obj User object. */ void registerForCarrierInfoForImsiEncryption(Handler h, int what, Object obj); /** * DeRegister for unsolicited Carrier Public Key. * * @param h Handler for notificaiton message. */ void unregisterForCarrierInfoForImsiEncryption(Handler h); default public List<ClientRequestStats> getClientRequestStats() { return null; } Loading
src/java/com/android/internal/telephony/RIL.java +46 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ import java.io.DataInputStream; import java.io.FileDescriptor; import java.io.IOException; import java.io.PrintWriter; import java.security.PublicKey; import java.util.ArrayList; import java.util.Arrays; import java.util.List; Loading Loading @@ -3622,6 +3623,34 @@ public final class RIL extends BaseCommands implements CommandsInterface { } } @Override public void setCarrierInfoForImsiEncryption(PublicKey publicKey, String keyIdentifier, Message result) { IRadio radioProxy = getRadioProxy(result); if (radioProxy != null) { android.hardware.radio.V1_1.IRadio radioProxy11 = android.hardware.radio.V1_1.IRadio.castFrom(radioProxy); if (radioProxy11 == null) { if (result != null) { AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED)); result.sendToTarget(); } } else { RILRequest rr = obtainRequest(RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, result, mRILDefaultWorkSource); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); try { radioProxy11.setCarrierInfoForImsiEncryption( rr.mSerial, publicKeyToArrayList(publicKey), keyIdentifier); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "setCarrierInfoForImsiEncryption", e); } } } } @Override public void getIMEI(Message result) { throw new RuntimeException("getIMEI not expected to be called"); Loading Loading @@ -4523,6 +4552,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { return "RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER"; case RIL_RESPONSE_ACKNOWLEDGEMENT: return "RIL_RESPONSE_ACKNOWLEDGEMENT"; case RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION: return "RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION"; default: return "<unknown request>"; } } Loading Loading @@ -4621,6 +4652,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { return "UNSOL_LCE_INFO_RECV"; case RIL_UNSOL_PCO_DATA: return "UNSOL_PCO_DATA"; case RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION: return "RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION"; default: return "<unknown response>"; } Loading Loading @@ -4709,6 +4742,19 @@ public final class RIL extends BaseCommands implements CommandsInterface { return arrayList; } /** * Method to serialize the Public Key into ArrayList of bytes * @param publicKey publicKey to be converted to ArrayList of bytes. **/ public static ArrayList<Byte> publicKeyToArrayList(PublicKey publicKey) { byte[] key = publicKey.getEncoded(); ArrayList<Byte> arrayList = new ArrayList<>(key.length); for (byte b : key) { arrayList.add(b); } return arrayList; } public static byte[] arrayListToPrimitiveArray(ArrayList<Byte> bytes) { byte[] ret = new byte[bytes.size()]; for (int i = 0; i < ret.length; i++) { Loading
src/java/com/android/internal/telephony/RadioIndication.java +49 −35 Original line number Diff line number Diff line Loading @@ -16,42 +16,8 @@ package com.android.internal.telephony; import android.hardware.radio.V1_0.CdmaCallWaiting; import android.hardware.radio.V1_0.CdmaInformationRecord; import android.hardware.radio.V1_0.CdmaLineControlInfoRecord; import android.hardware.radio.V1_0.CdmaNumberInfoRecord; import android.hardware.radio.V1_0.CdmaRedirectingNumberInfoRecord; import android.hardware.radio.V1_0.CdmaSignalInfoRecord; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.hardware.radio.V1_0.CdmaT53AudioControlInfoRecord; import android.hardware.radio.V1_0.CfData; import android.hardware.radio.V1_0.IRadioIndication; import android.hardware.radio.V1_0.LceDataInfo; import android.hardware.radio.V1_0.PcoDataInfo; import android.hardware.radio.V1_0.SetupDataCallResult; import android.hardware.radio.V1_0.SimRefreshResult; import android.hardware.radio.V1_0.SsInfoData; import android.hardware.radio.V1_0.StkCcUnsolSsResult; import android.hardware.radio.V1_0.SuppSvcNotification; import android.os.AsyncResult; import android.os.SystemProperties; import android.telephony.CellInfo; import android.telephony.PcoData; import android.telephony.SignalStrength; import android.telephony.SmsMessage; import com.android.internal.telephony.TelephonyProto.SmsSession; import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; import com.android.internal.telephony.cdma.CdmaInformationRecords; import com.android.internal.telephony.dataconnection.DataCallResponse; import com.android.internal.telephony.gsm.SsData; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.uicc.IccRefreshResponse; import com.android.internal.telephony.uicc.IccUtils; import java.util.ArrayList; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CALL_RING; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_CALL_WAITING; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_INFO_REC; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_OTA_PROVISION_STATUS; Loading Loading @@ -96,6 +62,41 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_UICC_SUBSCRI import static com.android.internal.telephony.RILConstants.RIL_UNSOL_VOICE_RADIO_TECH_CHANGED; import static com.android.internal.telephony.RILConstants.RIL_UNSOl_CDMA_PRL_CHANGED; import android.hardware.radio.V1_0.CdmaCallWaiting; import android.hardware.radio.V1_0.CdmaInformationRecord; import android.hardware.radio.V1_0.CdmaLineControlInfoRecord; import android.hardware.radio.V1_0.CdmaNumberInfoRecord; import android.hardware.radio.V1_0.CdmaRedirectingNumberInfoRecord; import android.hardware.radio.V1_0.CdmaSignalInfoRecord; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.hardware.radio.V1_0.CdmaT53AudioControlInfoRecord; import android.hardware.radio.V1_0.CfData; import android.hardware.radio.V1_0.LceDataInfo; import android.hardware.radio.V1_0.PcoDataInfo; import android.hardware.radio.V1_0.SetupDataCallResult; import android.hardware.radio.V1_0.SimRefreshResult; import android.hardware.radio.V1_0.SsInfoData; import android.hardware.radio.V1_0.StkCcUnsolSsResult; import android.hardware.radio.V1_0.SuppSvcNotification; import android.hardware.radio.V1_1.IRadioIndication; import android.os.AsyncResult; import android.os.SystemProperties; import android.telephony.CellInfo; import android.telephony.PcoData; import android.telephony.SignalStrength; import android.telephony.SmsMessage; import com.android.internal.telephony.TelephonyProto.SmsSession; import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; import com.android.internal.telephony.cdma.CdmaInformationRecords; import com.android.internal.telephony.dataconnection.DataCallResponse; import com.android.internal.telephony.gsm.SsData; import com.android.internal.telephony.gsm.SuppServiceNotification; import com.android.internal.telephony.uicc.IccRefreshResponse; import com.android.internal.telephony.uicc.IccUtils; import java.util.ArrayList; public class RadioIndication extends IRadioIndication.Stub { RIL mRil; Loading Loading @@ -775,6 +776,19 @@ public class RadioIndication extends IRadioIndication.Stub { mRil.processIndication(indicationType); } /** * Indicates when the carrier info to encrypt IMSI is being requested * @param indicationType RadioIndicationType */ public void carrierInfoForImsiEncryption(int indicationType) { mRil.processIndication(indicationType); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, null); mRil.mCarrierInfoForImsiEncryptionRegistrants.notifyRegistrants( new AsyncResult(null, null, null)); } private CommandsInterface.RadioState getRadioStateFromInt(int stateInt) { CommandsInterface.RadioState state; Loading