Merge changes from topic "RPSMMA-Implementation-master"

* changes:
  Send Sms Memory Availability notification to ImsService
  Adding Test API to send Memory Status Event For CTS
  Add SMMA Feature to device overlay config
This commit is contained in:
Megha Patil
2022-12-13 06:54:48 +00:00
committed by Android (Google) Code Review
10 changed files with 100 additions and 0 deletions

View File

@@ -15933,6 +15933,7 @@ package android.telephony.ims.stub {
method public void acknowledgeSms(int, @IntRange(from=0, to=65535) int, int, @NonNull byte[]);
method public void acknowledgeSmsReport(int, @IntRange(from=0, to=65535) int, int);
method public String getSmsFormat();
method public void onMemoryAvailable(int);
method public void onReady();
method @Deprecated public final void onSendSmsResult(int, @IntRange(from=0, to=65535) int, int, int) throws java.lang.RuntimeException;
method public final void onSendSmsResultError(int, @IntRange(from=0, to=65535) int, int, int, int) throws java.lang.RuntimeException;

View File

@@ -2638,6 +2638,8 @@ package android.telephony {
public final class SmsManager {
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int checkSmsShortCodeDestination(String, String);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void clearStorageMonitorMemoryStatusOverride();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setStorageMonitorMemoryStatusOverride(boolean);
field public static final int SMS_CATEGORY_FREE_SHORT_CODE = 1; // 0x1
field public static final int SMS_CATEGORY_NOT_SHORT_CODE = 0; // 0x0
field public static final int SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE = 3; // 0x3

View File

@@ -3422,6 +3422,11 @@
phone object irrespective of this config -->
<bool name="config_switch_phone_on_voice_reg_state_change">true</bool>
<!-- Config determines whether Memory Availability Notification is supported over Ims so that
the RP-SMMA Notification is sent over Ims to SMS Service center indicating that UE can now
start receiving SMS after failures due to Memory Full event -->
<bool name="config_smma_notification_supported_over_ims">false</bool>
<bool name="config_sms_force_7bit_encoding">false</bool>
<!-- Number of physical SIM slots on the device. This includes both eSIM and pSIM slots, and

View File

@@ -2810,6 +2810,7 @@
<java-symbol type="bool" name="config_switch_phone_on_voice_reg_state_change" />
<java-symbol type="string" name="whichHomeApplicationNamed" />
<java-symbol type="string" name="whichHomeApplicationLabel" />
<java-symbol type="bool" name="config_smma_notification_supported_over_ims" />
<java-symbol type="bool" name="config_sms_force_7bit_encoding" />
<java-symbol type="bool" name="config_defaultWindowFeatureOptionsPanel" />
<java-symbol type="bool" name="config_defaultWindowFeatureContextMenu" />

View File

@@ -3125,6 +3125,43 @@ public final class SmsManager {
}
}
/**
* Set Storage Availability in SmsStorageMonitor
* @param storageAvailable storage availability to be set true or false
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
@TestApi
public void setStorageMonitorMemoryStatusOverride(boolean storageAvailable) {
try {
ISms iccISms = getISmsServiceOrThrow();
if (iccISms != null) {
iccISms.setStorageMonitorMemoryStatusOverride(getSubscriptionId(),
storageAvailable);
}
} catch (RemoteException ex) {
ex.rethrowFromSystemServer();
}
}
/**
* Clear the memory status override set by
* {@link #setStorageMonitorMemoryStatusOverride(boolean)}
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
@TestApi
public void clearStorageMonitorMemoryStatusOverride() {
try {
ISms iccISms = getISmsServiceOrThrow();
if (iccISms != null) {
iccISms.clearStorageMonitorMemoryStatusOverride(getSubscriptionId());
}
} catch (RemoteException ex) {
ex.rethrowFromSystemServer();
}
}
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"SMS_CATEGORY_"},

View File

@@ -64,6 +64,7 @@ interface IImsMmTelFeature {
void setSmsListener(IImsSmsListener l);
oneway void sendSms(in int token, int messageRef, String format, String smsc, boolean retry,
in byte[] pdu);
oneway void onMemoryAvailable(int token);
oneway void acknowledgeSms(int token, int messageRef, int result);
oneway void acknowledgeSmsWithPdu(int token, int messageRef, int result, in byte[] pdu);
oneway void acknowledgeSmsReport(int token, int messageRef, int result);

View File

@@ -268,6 +268,12 @@ public class MmTelFeature extends ImsFeature {
.sendSms(token, messageRef, format, smsc, retry, pdu), "sendSms");
}
@Override
public void onMemoryAvailable(int token) {
executeMethodAsyncNoException(() -> MmTelFeature.this
.onMemoryAvailable(token), "onMemoryAvailable");
}
@Override
public void acknowledgeSms(int token, int messageRef, int result) {
executeMethodAsyncNoException(() -> MmTelFeature.this
@@ -1089,6 +1095,10 @@ public class MmTelFeature extends ImsFeature {
getSmsImplementation().sendSms(token, messageRef, format, smsc, isRetry, pdu);
}
private void onMemoryAvailable(int token) {
getSmsImplementation().onMemoryAvailable(token);
}
private void acknowledgeSms(int token, int messageRef,
@ImsSmsImplBase.DeliverStatusResult int result) {
getSmsImplementation().acknowledgeSms(token, messageRef, result);

View File

@@ -170,6 +170,20 @@ public class ImsSmsImplBase {
}
}
/**
* This method will be triggered by the platform when memory becomes available to receive SMS
* after a memory full event. This method should be implemented by IMS providers to
* send RP-SMMA notification from SMS Relay Layer to server over IMS as per section 7.3.2 of
* TS 124.11. Once the RP-SMMA Notification is sent to the network. The network will deliver all
* the pending messages which failed due to Unavailability of Memory.
*
* @param token unique token generated in {@link ImsSmsDispatcher#onMemoryAvailable(void)} that
* should be used when triggering callbacks for this specific message.
*/
public void onMemoryAvailable(int token) {
// Base Implementation - Should be overridden
}
/**
* This method will be triggered by the platform after
* {@link #onSmsReceived(int, String, byte[])} has been called to deliver the result to the IMS

View File

@@ -529,6 +529,25 @@ interface ISms {
String createAppSpecificSmsTokenWithPackageInfo(
int subId, String callingPkg, String prefixes, in PendingIntent intent);
/**
* set Memory Status in SmsStorageMonitor
*
* @param subId the subscription Id.
* @param callingPackage the package name of the calling app.
* @param isStorageAvailable sets StorageAvailable to false or true
* for testing behaviour of SmsStorageMonitor
*/
void setStorageMonitorMemoryStatusOverride(int subId, boolean isStorageAvailable);
/**
* reset Memory Status change made by TestApi setStorageMonitorMemoryStatusOverride
* in SmsStorageMonitor
*
* @param subId the subscription Id.
* @param callingPackage the package name of the calling app.
*/
void clearStorageMonitorMemoryStatusOverride(int subId);
/**
* Check if the destination is a possible premium short code.
*

View File

@@ -191,6 +191,16 @@ public class ISmsImplBase extends ISms.Stub {
throw new UnsupportedOperationException();
}
@Override
public void setStorageMonitorMemoryStatusOverride(int subId, boolean storageAvailable) {
throw new UnsupportedOperationException();
}
@Override
public void clearStorageMonitorMemoryStatusOverride(int subId) {
throw new UnsupportedOperationException();
}
@Override
public int checkSmsShortCodeDestination(int subid, String callingPackage,
String callingFeatureId, String destAddress, String countryIso) {