Loading telephony/java/android/telephony/ims/internal/SmsImplBase.java +35 −23 Original line number Diff line number Diff line Loading @@ -124,70 +124,79 @@ public class SmsImplBase { * method should be implemented by the IMS providers to provide implementation of sending an SMS * over IMS. * * @param smsc the Short Message Service Center address. * @param token unique token generated by the platform that should be used when triggering * callbacks for this specific message. * @param messageRef the message reference. * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and * @param smsc the Short Message Service Center address. * {@link SmsMessage#FORMAT_3GPP2}. * @param messageRef the message reference. * @param isRetry whether it is a retry of an already attempted message or not. * @param pdu PDUs representing the contents of the message. */ public void sendSms(int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { public void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { // Base implementation returns error. Should be overridden. try { onSendSmsResult(messageRef, SEND_STATUS_ERROR, SmsManager.RESULT_ERROR_GENERIC_FAILURE); onSendSmsResult(token, messageRef, SEND_STATUS_ERROR, SmsManager.RESULT_ERROR_GENERIC_FAILURE); } catch (RemoteException e) { Log.e(LOG_TAG, "Can not send sms: " + e.getMessage()); } } /** * This method will be triggered by the platform after {@link #onSmsReceived(String, byte[])} has * been called to deliver the result to the IMS provider. * This method will be triggered by the platform after {@link #onSmsReceived(int, String, byte[])} * has been called to deliver the result to the IMS provider. * * @param token token provided in {@link #onSmsReceived(int, String, byte[])} * @param result result of delivering the message. Valid values are defined in * {@link DeliverStatusResult} * @param messageRef the message reference or -1 of unavailable. * @param messageRef the message reference */ public void acknowledgeSms(int messageRef, @DeliverStatusResult int result) { public void acknowledgeSms(int token, int messageRef, @DeliverStatusResult int result) { } /** * This method will be triggered by the platform after * {@link #onSmsStatusReportReceived(int, int, byte[])} has been called to provide the result to * the IMS provider. * {@link #onSmsStatusReportReceived(int, int, String, byte[])} has been called to provide the * result to the IMS provider. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} * @param result result of delivering the message. Valid values are defined in * {@link StatusReportResult} * @param messageRef the message reference or -1 of unavailable. * @param messageRef the message reference */ public void acknowledgeSmsReport(int messageRef, @StatusReportResult int result) { public void acknowledgeSmsReport(int token, int messageRef, @StatusReportResult int result) { } /** * This method should be triggered by the IMS providers when there is an incoming message. The * platform will deliver the message to the messages database and notify the IMS provider of the * result by calling {@link #acknowledgeSms(int, int)}. * result by calling {@link #acknowledgeSms(int, int, int)}. * * This method must not be called before {@link MmTelFeature#onFeatureReady()} is called. * * @param token unique token generated by IMS providers that the platform will use to trigger * callbacks for this message. * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and * {@link SmsMessage#FORMAT_3GPP2}. * @param pdu PDUs representing the contents of the message. * @throws IllegalStateException if called before {@link MmTelFeature#onFeatureReady()} */ public final void onSmsReceived(String format, byte[] pdu) throws IllegalStateException { public final void onSmsReceived(int token, String format, byte[] pdu) throws IllegalStateException { synchronized (mLock) { if (mListener == null) { throw new IllegalStateException("Feature not ready."); } try { mListener.onSmsReceived(format, pdu); acknowledgeSms(-1, DELIVER_STATUS_OK); mListener.onSmsReceived(token, format, pdu); acknowledgeSms(token, 0, DELIVER_STATUS_OK); } catch (RemoteException e) { Log.e(LOG_TAG, "Can not deliver sms: " + e.getMessage()); acknowledgeSms(-1, DELIVER_STATUS_ERROR); acknowledgeSms(token, 0, DELIVER_STATUS_ERROR); } } } Loading @@ -198,6 +207,7 @@ public class SmsImplBase { * * This method must not be called before {@link MmTelFeature#onFeatureReady()} is called. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} * @param messageRef the message reference. Should be between 0 and 255 per TS.123.040 * @param status result of sending the SMS. Valid values are defined in {@link SendStatusResult} * @param reason reason in case status is failure. Valid values are: Loading @@ -213,35 +223,37 @@ public class SmsImplBase { * @throws RemoteException if the connection to the framework is not available. If this happens * attempting to send the SMS should be aborted. */ public final void onSendSmsResult(int messageRef, @SendStatusResult int status, int reason) throws IllegalStateException, RemoteException { public final void onSendSmsResult(int token, int messageRef, @SendStatusResult int status, int reason) throws IllegalStateException, RemoteException { synchronized (mLock) { if (mListener == null) { throw new IllegalStateException("Feature not ready."); } mListener.onSendSmsResult(messageRef, status, reason); mListener.onSendSmsResult(token, messageRef, status, reason); } } /** * Sets the status report of the sent message. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} * @param messageRef the message reference. * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and * {@link SmsMessage#FORMAT_3GPP2}. * @param pdu PDUs representing the content of the status report. * @throws IllegalStateException if called before {@link MmTelFeature#onFeatureReady()} */ public final void onSmsStatusReportReceived(int messageRef, String format, byte[] pdu) { public final void onSmsStatusReportReceived(int token, int messageRef, String format, byte[] pdu) { synchronized (mLock) { if (mListener == null) { throw new IllegalStateException("Feature not ready."); } try { mListener.onSmsStatusReportReceived(messageRef, format, pdu); mListener.onSmsStatusReportReceived(token, messageRef, format, pdu); } catch (RemoteException e) { Log.e(LOG_TAG, "Can not process sms status report: " + e.getMessage()); acknowledgeSmsReport(messageRef, STATUS_REPORT_STATUS_ERROR); acknowledgeSmsReport(token, messageRef, STATUS_REPORT_STATUS_ERROR); } } } Loading telephony/java/android/telephony/ims/internal/aidl/IImsMmTelFeature.aidl +4 −3 Original line number Diff line number Diff line Loading @@ -52,8 +52,9 @@ interface IImsMmTelFeature { IImsCapabilityCallback c); // SMS APIs void setSmsListener(IImsSmsListener l); oneway void sendSms(int messageRef, String format, String smsc, boolean retry, in byte[] pdu); oneway void acknowledgeSms(int messageRef, int result); oneway void acknowledgeSmsReport(int messageRef, int result); oneway void sendSms(in int token, int messageRef, String format, String smsc, boolean retry, in byte[] pdu); oneway void acknowledgeSms(int token, int messageRef, int result); oneway void acknowledgeSmsReport(int token, int messageRef, int result); String getSmsFormat(); } telephony/java/android/telephony/ims/internal/aidl/IImsSmsListener.aidl +4 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ package android.telephony.ims.internal.aidl; * {@hide} */ interface IImsSmsListener { void onSendSmsResult(in int messageRef, in int status, in int reason); void onSmsStatusReportReceived(in int messageRef, in String format, in byte[] pdu); void onSmsReceived(in String format, in byte[] pdu); void onSendSmsResult(in int token, in int messageRef, in int status, in int reason); void onSmsStatusReportReceived(in int token, in int messageRef, in String format, in byte[] pdu); void onSmsReceived(in int token, in String format, in byte[] pdu); } No newline at end of file telephony/java/android/telephony/ims/internal/feature/MmTelFeature.java +14 −12 Original line number Diff line number Diff line Loading @@ -154,23 +154,24 @@ public class MmTelFeature extends ImsFeature { } @Override public void sendSms(int messageRef, String format, String smsc, boolean retry, byte[] pdu) { public void sendSms(int token, int messageRef, String format, String smsc, boolean retry, byte[] pdu) { synchronized (mLock) { MmTelFeature.this.sendSms(messageRef, format, smsc, retry, pdu); MmTelFeature.this.sendSms(token, messageRef, format, smsc, retry, pdu); } } @Override public void acknowledgeSms(int messageRef, int result) { public void acknowledgeSms(int token, int messageRef, int result) { synchronized (mLock) { MmTelFeature.this.acknowledgeSms(messageRef, result); MmTelFeature.this.acknowledgeSms(token, messageRef, result); } } @Override public void acknowledgeSmsReport(int messageRef, int result) { public void acknowledgeSmsReport(int token, int messageRef, int result) { synchronized (mLock) { MmTelFeature.this.acknowledgeSmsReport(messageRef, result); MmTelFeature.this.acknowledgeSmsReport(token, messageRef, result); } } Loading Loading @@ -447,16 +448,17 @@ public class MmTelFeature extends ImsFeature { // Base Implementation - Should be overridden } private void sendSms(int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { getSmsImplementation().sendSms(messageRef, format, smsc, isRetry, pdu); private void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { getSmsImplementation().sendSms(token, messageRef, format, smsc, isRetry, pdu); } private void acknowledgeSms(int messageRef, @DeliverStatusResult int result) { getSmsImplementation().acknowledgeSms(messageRef, result); private void acknowledgeSms(int token, int messageRef, @DeliverStatusResult int result) { getSmsImplementation().acknowledgeSms(token, messageRef, result); } private void acknowledgeSmsReport(int messageRef, @StatusReportResult int result) { getSmsImplementation().acknowledgeSmsReport(messageRef, result); private void acknowledgeSmsReport(int token, int messageRef, @StatusReportResult int result) { getSmsImplementation().acknowledgeSmsReport(token, messageRef, result); } private String getSmsFormat() { Loading Loading
telephony/java/android/telephony/ims/internal/SmsImplBase.java +35 −23 Original line number Diff line number Diff line Loading @@ -124,70 +124,79 @@ public class SmsImplBase { * method should be implemented by the IMS providers to provide implementation of sending an SMS * over IMS. * * @param smsc the Short Message Service Center address. * @param token unique token generated by the platform that should be used when triggering * callbacks for this specific message. * @param messageRef the message reference. * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and * @param smsc the Short Message Service Center address. * {@link SmsMessage#FORMAT_3GPP2}. * @param messageRef the message reference. * @param isRetry whether it is a retry of an already attempted message or not. * @param pdu PDUs representing the contents of the message. */ public void sendSms(int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { public void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { // Base implementation returns error. Should be overridden. try { onSendSmsResult(messageRef, SEND_STATUS_ERROR, SmsManager.RESULT_ERROR_GENERIC_FAILURE); onSendSmsResult(token, messageRef, SEND_STATUS_ERROR, SmsManager.RESULT_ERROR_GENERIC_FAILURE); } catch (RemoteException e) { Log.e(LOG_TAG, "Can not send sms: " + e.getMessage()); } } /** * This method will be triggered by the platform after {@link #onSmsReceived(String, byte[])} has * been called to deliver the result to the IMS provider. * This method will be triggered by the platform after {@link #onSmsReceived(int, String, byte[])} * has been called to deliver the result to the IMS provider. * * @param token token provided in {@link #onSmsReceived(int, String, byte[])} * @param result result of delivering the message. Valid values are defined in * {@link DeliverStatusResult} * @param messageRef the message reference or -1 of unavailable. * @param messageRef the message reference */ public void acknowledgeSms(int messageRef, @DeliverStatusResult int result) { public void acknowledgeSms(int token, int messageRef, @DeliverStatusResult int result) { } /** * This method will be triggered by the platform after * {@link #onSmsStatusReportReceived(int, int, byte[])} has been called to provide the result to * the IMS provider. * {@link #onSmsStatusReportReceived(int, int, String, byte[])} has been called to provide the * result to the IMS provider. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} * @param result result of delivering the message. Valid values are defined in * {@link StatusReportResult} * @param messageRef the message reference or -1 of unavailable. * @param messageRef the message reference */ public void acknowledgeSmsReport(int messageRef, @StatusReportResult int result) { public void acknowledgeSmsReport(int token, int messageRef, @StatusReportResult int result) { } /** * This method should be triggered by the IMS providers when there is an incoming message. The * platform will deliver the message to the messages database and notify the IMS provider of the * result by calling {@link #acknowledgeSms(int, int)}. * result by calling {@link #acknowledgeSms(int, int, int)}. * * This method must not be called before {@link MmTelFeature#onFeatureReady()} is called. * * @param token unique token generated by IMS providers that the platform will use to trigger * callbacks for this message. * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and * {@link SmsMessage#FORMAT_3GPP2}. * @param pdu PDUs representing the contents of the message. * @throws IllegalStateException if called before {@link MmTelFeature#onFeatureReady()} */ public final void onSmsReceived(String format, byte[] pdu) throws IllegalStateException { public final void onSmsReceived(int token, String format, byte[] pdu) throws IllegalStateException { synchronized (mLock) { if (mListener == null) { throw new IllegalStateException("Feature not ready."); } try { mListener.onSmsReceived(format, pdu); acknowledgeSms(-1, DELIVER_STATUS_OK); mListener.onSmsReceived(token, format, pdu); acknowledgeSms(token, 0, DELIVER_STATUS_OK); } catch (RemoteException e) { Log.e(LOG_TAG, "Can not deliver sms: " + e.getMessage()); acknowledgeSms(-1, DELIVER_STATUS_ERROR); acknowledgeSms(token, 0, DELIVER_STATUS_ERROR); } } } Loading @@ -198,6 +207,7 @@ public class SmsImplBase { * * This method must not be called before {@link MmTelFeature#onFeatureReady()} is called. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} * @param messageRef the message reference. Should be between 0 and 255 per TS.123.040 * @param status result of sending the SMS. Valid values are defined in {@link SendStatusResult} * @param reason reason in case status is failure. Valid values are: Loading @@ -213,35 +223,37 @@ public class SmsImplBase { * @throws RemoteException if the connection to the framework is not available. If this happens * attempting to send the SMS should be aborted. */ public final void onSendSmsResult(int messageRef, @SendStatusResult int status, int reason) throws IllegalStateException, RemoteException { public final void onSendSmsResult(int token, int messageRef, @SendStatusResult int status, int reason) throws IllegalStateException, RemoteException { synchronized (mLock) { if (mListener == null) { throw new IllegalStateException("Feature not ready."); } mListener.onSendSmsResult(messageRef, status, reason); mListener.onSendSmsResult(token, messageRef, status, reason); } } /** * Sets the status report of the sent message. * * @param token token provided in {@link #sendSms(int, int, String, String, boolean, byte[])} * @param messageRef the message reference. * @param format the format of the message. Valid values are {@link SmsMessage#FORMAT_3GPP} and * {@link SmsMessage#FORMAT_3GPP2}. * @param pdu PDUs representing the content of the status report. * @throws IllegalStateException if called before {@link MmTelFeature#onFeatureReady()} */ public final void onSmsStatusReportReceived(int messageRef, String format, byte[] pdu) { public final void onSmsStatusReportReceived(int token, int messageRef, String format, byte[] pdu) { synchronized (mLock) { if (mListener == null) { throw new IllegalStateException("Feature not ready."); } try { mListener.onSmsStatusReportReceived(messageRef, format, pdu); mListener.onSmsStatusReportReceived(token, messageRef, format, pdu); } catch (RemoteException e) { Log.e(LOG_TAG, "Can not process sms status report: " + e.getMessage()); acknowledgeSmsReport(messageRef, STATUS_REPORT_STATUS_ERROR); acknowledgeSmsReport(token, messageRef, STATUS_REPORT_STATUS_ERROR); } } } Loading
telephony/java/android/telephony/ims/internal/aidl/IImsMmTelFeature.aidl +4 −3 Original line number Diff line number Diff line Loading @@ -52,8 +52,9 @@ interface IImsMmTelFeature { IImsCapabilityCallback c); // SMS APIs void setSmsListener(IImsSmsListener l); oneway void sendSms(int messageRef, String format, String smsc, boolean retry, in byte[] pdu); oneway void acknowledgeSms(int messageRef, int result); oneway void acknowledgeSmsReport(int messageRef, int result); oneway void sendSms(in int token, int messageRef, String format, String smsc, boolean retry, in byte[] pdu); oneway void acknowledgeSms(int token, int messageRef, int result); oneway void acknowledgeSmsReport(int token, int messageRef, int result); String getSmsFormat(); }
telephony/java/android/telephony/ims/internal/aidl/IImsSmsListener.aidl +4 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ package android.telephony.ims.internal.aidl; * {@hide} */ interface IImsSmsListener { void onSendSmsResult(in int messageRef, in int status, in int reason); void onSmsStatusReportReceived(in int messageRef, in String format, in byte[] pdu); void onSmsReceived(in String format, in byte[] pdu); void onSendSmsResult(in int token, in int messageRef, in int status, in int reason); void onSmsStatusReportReceived(in int token, in int messageRef, in String format, in byte[] pdu); void onSmsReceived(in int token, in String format, in byte[] pdu); } No newline at end of file
telephony/java/android/telephony/ims/internal/feature/MmTelFeature.java +14 −12 Original line number Diff line number Diff line Loading @@ -154,23 +154,24 @@ public class MmTelFeature extends ImsFeature { } @Override public void sendSms(int messageRef, String format, String smsc, boolean retry, byte[] pdu) { public void sendSms(int token, int messageRef, String format, String smsc, boolean retry, byte[] pdu) { synchronized (mLock) { MmTelFeature.this.sendSms(messageRef, format, smsc, retry, pdu); MmTelFeature.this.sendSms(token, messageRef, format, smsc, retry, pdu); } } @Override public void acknowledgeSms(int messageRef, int result) { public void acknowledgeSms(int token, int messageRef, int result) { synchronized (mLock) { MmTelFeature.this.acknowledgeSms(messageRef, result); MmTelFeature.this.acknowledgeSms(token, messageRef, result); } } @Override public void acknowledgeSmsReport(int messageRef, int result) { public void acknowledgeSmsReport(int token, int messageRef, int result) { synchronized (mLock) { MmTelFeature.this.acknowledgeSmsReport(messageRef, result); MmTelFeature.this.acknowledgeSmsReport(token, messageRef, result); } } Loading Loading @@ -447,16 +448,17 @@ public class MmTelFeature extends ImsFeature { // Base Implementation - Should be overridden } private void sendSms(int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { getSmsImplementation().sendSms(messageRef, format, smsc, isRetry, pdu); private void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry, byte[] pdu) { getSmsImplementation().sendSms(token, messageRef, format, smsc, isRetry, pdu); } private void acknowledgeSms(int messageRef, @DeliverStatusResult int result) { getSmsImplementation().acknowledgeSms(messageRef, result); private void acknowledgeSms(int token, int messageRef, @DeliverStatusResult int result) { getSmsImplementation().acknowledgeSms(token, messageRef, result); } private void acknowledgeSmsReport(int messageRef, @StatusReportResult int result) { getSmsImplementation().acknowledgeSmsReport(messageRef, result); private void acknowledgeSmsReport(int token, int messageRef, @StatusReportResult int result) { getSmsImplementation().acknowledgeSmsReport(token, messageRef, result); } private String getSmsFormat() { Loading