diff options
author | Mohamed Abdalkader <abdalkader@google.com> | 2018-01-23 13:09:00 -0800 |
---|---|---|
committer | Mohamed Abdalkader <abdalkader@google.com> | 2018-01-24 15:07:24 -0800 |
commit | bddbd624ec0289975fd835b37f3882d1888c6b23 (patch) | |
tree | 03007ce393888e6f1baed6d5c3f71d2e837d6acc | |
parent | b2b547454bb7bf7258e40929f7fe8721c858be79 (diff) |
Add and trigger onReady API for SMS over IMS.
Test: manual test that normal code path is fine since this code path is
not yet exercisable.
BUG=69846044
Change-Id: Icb15ca4aa6606fba641f6270dca5e0e06fc4466a
3 files changed, 26 insertions, 5 deletions
diff --git a/telephony/java/android/telephony/ims/feature/MMTelFeature.java b/telephony/java/android/telephony/ims/feature/MMTelFeature.java index 519710728403..8b59d3902ec3 100644 --- a/telephony/java/android/telephony/ims/feature/MMTelFeature.java +++ b/telephony/java/android/telephony/ims/feature/MMTelFeature.java @@ -209,6 +209,13 @@ public class MMTelFeature extends ImsFeature { return MMTelFeature.this.getSmsFormat(); } } + + @Override + public void onSmsReady() { + synchronized (mLock) { + MMTelFeature.this.onSmsReady(); + } + } }; /** @@ -403,6 +410,10 @@ public class MMTelFeature extends ImsFeature { getSmsImplementation().acknowledgeSmsReport(token, messageRef, result); } + private void onSmsReady() { + getSmsImplementation().onReady(); + } + /** * Must be overridden by IMS Provider to be able to support SMS over IMS. Otherwise a default * non-functional implementation is returned. diff --git a/telephony/java/android/telephony/ims/internal/stub/SmsImplBase.java b/telephony/java/android/telephony/ims/internal/stub/SmsImplBase.java index 113dad4696ef..afbd93c1cb67 100644 --- a/telephony/java/android/telephony/ims/internal/stub/SmsImplBase.java +++ b/telephony/java/android/telephony/ims/internal/stub/SmsImplBase.java @@ -177,14 +177,14 @@ public class SmsImplBase { * platform will deliver the message to the messages database and notify the IMS provider of the * result by calling {@link #acknowledgeSms(int, int, int)}. * - * This method must not be called before {@link MmTelFeature#onFeatureReady()} is called. + * This method must not be called before {@link #onReady()} 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()} + * @throws IllegalStateException if called before {@link #onReady()} */ public final void onSmsReceived(int token, String format, byte[] pdu) throws IllegalStateException { @@ -205,7 +205,7 @@ public class SmsImplBase { * This method should be triggered by the IMS providers to pass the result of the sent message * to the platform. * - * This method must not be called before {@link MmTelFeature#onFeatureReady()} is called. + * This method must not be called before {@link #onReady()} 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 @@ -219,7 +219,7 @@ public class SmsImplBase { * {@link SmsManager#RESULT_ERROR_LIMIT_EXCEEDED}, * {@link SmsManager#RESULT_ERROR_SHORT_CODE_NOT_ALLOWED}, * {@link SmsManager#RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED} - * @throws IllegalStateException if called before {@link MmTelFeature#onFeatureReady()} + * @throws IllegalStateException if called before {@link #onReady()} * @throws RemoteException if the connection to the framework is not available. If this happens * attempting to send the SMS should be aborted. */ @@ -241,7 +241,7 @@ public class SmsImplBase { * @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()} + * @throws IllegalStateException if called before {@link #onReady()} */ public final void onSmsStatusReportReceived(int token, int messageRef, String format, byte[] pdu) { @@ -268,4 +268,13 @@ public class SmsImplBase { public String getSmsFormat() { return SmsMessage.FORMAT_3GPP; } + + /** + * Called when SmsImpl has been initialized and communication with the framework is set up. + * Any attempt by this class to access the framework before this method is called will return + * with an {@link RuntimeException}. + */ + public void onReady() { + // Base Implementation - Should be overridden + } } diff --git a/telephony/java/com/android/ims/internal/IImsMMTelFeature.aidl b/telephony/java/com/android/ims/internal/IImsMMTelFeature.aidl index cce39f4daf2a..10c7f3e8a2d7 100644 --- a/telephony/java/com/android/ims/internal/IImsMMTelFeature.aidl +++ b/telephony/java/com/android/ims/internal/IImsMMTelFeature.aidl @@ -61,4 +61,5 @@ interface IImsMMTelFeature { oneway void acknowledgeSms(int token, int messageRef, int result); oneway void acknowledgeSmsReport(int token, int messageRef, int result); String getSmsFormat(); + oneway void onSmsReady(); } |