Loading src/java/com/android/internal/telephony/SmsController.java +54 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.internal.telephony; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static com.android.internal.telephony.util.TelephonyUtils.checkDumpPermission; import android.annotation.Nullable; Loading Loading @@ -792,6 +794,58 @@ public class SmsController extends ISmsImplBase { return getPhone(subId).getAppSmsManager().createAppSpecificSmsToken(callingPkg, intent); } @Override public void setStorageMonitorMemoryStatusOverride(int subId, boolean isStorageAvailable) { Phone phone = getPhone(subId); Context context; if (phone != null) { context = phone.getContext(); } else { Rlog.e(LOG_TAG, "Phone Object is Null"); return; } // If it doesn't have modify phone state permission // a SecurityException will be thrown. if (context.checkPermission(android.Manifest .permission.MODIFY_PHONE_STATE, Binder.getCallingPid(), Binder.getCallingUid()) != PERMISSION_GRANTED) { throw new SecurityException( "setStorageMonitorMemoryStatusOverride needs MODIFY_PHONE_STATE"); } final long identity = Binder.clearCallingIdentity(); try { phone.mSmsStorageMonitor.sendMemoryStatusOverride(isStorageAvailable); } finally { Binder.restoreCallingIdentity(identity); } } @Override public void clearStorageMonitorMemoryStatusOverride(int subId) { Phone phone = getPhone(subId); Context context; if (phone != null) { context = phone.getContext(); } else { Rlog.e(LOG_TAG, "Phone Object is Null"); return; } // If it doesn't have modify phone state permission // a SecurityException will be thrown. if (context.checkPermission(android.Manifest .permission.MODIFY_PHONE_STATE, Binder.getCallingPid(), Binder.getCallingUid()) != PERMISSION_GRANTED) { throw new SecurityException( "clearStorageMonitorMemoryStatusOverride needs MODIFY_PHONE_STATE"); } final long identity = Binder.clearCallingIdentity(); try { phone.mSmsStorageMonitor.clearMemoryStatusOverride(); } finally { Binder.restoreCallingIdentity(identity); } } @Override public int checkSmsShortCodeDestination(int subId, String callingPackage, String callingFeatureId, String destAddress, String countryIso) { Loading src/java/com/android/internal/telephony/SmsStorageMonitor.java +30 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import com.android.telephony.Rlog; * dual-mode devices that require support for both 3GPP and 3GPP2 format messages. */ public class SmsStorageMonitor extends Handler { private static final String TAG = "SmsStorageMonitor"; private static final String TAG = "SmsStorageMonitor1"; /** Maximum number of times to retry memory status reporting */ private static final int MAX_RETRIES = 1; Loading Loading @@ -87,6 +87,10 @@ public class SmsStorageMonitor extends Handler { final CommandsInterface mCi; boolean mStorageAvailable = true; boolean mInitialStorageAvailableStatus = true; private boolean mMemoryStatusOverrideFlag = false; /** * Hold the wake lock for 5 seconds, which should be enough time for * any receiver(s) to grab its own wake lock. Loading Loading @@ -115,6 +119,31 @@ public class SmsStorageMonitor extends Handler { mContext.registerReceiver(mResultReceiver, filter); } /** * Overriding of the Memory Status by the TestApi and send the event to Handler to test * the RP-SMMA feature * @param isStorageAvailable boolean value specifies the MemoryStatus to be * sent to Handler */ public void sendMemoryStatusOverride(boolean isStorageAvailable) { if (!mMemoryStatusOverrideFlag) { mInitialStorageAvailableStatus = mStorageAvailable; mMemoryStatusOverrideFlag = true; } mStorageAvailable = isStorageAvailable; if (isStorageAvailable) { sendMessage(obtainMessage(EVENT_REPORT_MEMORY_STATUS)); } } /** * reset Memory Status change made by {@link #sendMemoryStatusOverride} */ public void clearMemoryStatusOverride() { mStorageAvailable = mInitialStorageAvailableStatus; mMemoryStatusOverrideFlag = false; } @VisibleForTesting public void setMaxRetries(int maxCount) { mMaxRetryCount = maxCount; Loading Loading
src/java/com/android/internal/telephony/SmsController.java +54 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.internal.telephony; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static com.android.internal.telephony.util.TelephonyUtils.checkDumpPermission; import android.annotation.Nullable; Loading Loading @@ -792,6 +794,58 @@ public class SmsController extends ISmsImplBase { return getPhone(subId).getAppSmsManager().createAppSpecificSmsToken(callingPkg, intent); } @Override public void setStorageMonitorMemoryStatusOverride(int subId, boolean isStorageAvailable) { Phone phone = getPhone(subId); Context context; if (phone != null) { context = phone.getContext(); } else { Rlog.e(LOG_TAG, "Phone Object is Null"); return; } // If it doesn't have modify phone state permission // a SecurityException will be thrown. if (context.checkPermission(android.Manifest .permission.MODIFY_PHONE_STATE, Binder.getCallingPid(), Binder.getCallingUid()) != PERMISSION_GRANTED) { throw new SecurityException( "setStorageMonitorMemoryStatusOverride needs MODIFY_PHONE_STATE"); } final long identity = Binder.clearCallingIdentity(); try { phone.mSmsStorageMonitor.sendMemoryStatusOverride(isStorageAvailable); } finally { Binder.restoreCallingIdentity(identity); } } @Override public void clearStorageMonitorMemoryStatusOverride(int subId) { Phone phone = getPhone(subId); Context context; if (phone != null) { context = phone.getContext(); } else { Rlog.e(LOG_TAG, "Phone Object is Null"); return; } // If it doesn't have modify phone state permission // a SecurityException will be thrown. if (context.checkPermission(android.Manifest .permission.MODIFY_PHONE_STATE, Binder.getCallingPid(), Binder.getCallingUid()) != PERMISSION_GRANTED) { throw new SecurityException( "clearStorageMonitorMemoryStatusOverride needs MODIFY_PHONE_STATE"); } final long identity = Binder.clearCallingIdentity(); try { phone.mSmsStorageMonitor.clearMemoryStatusOverride(); } finally { Binder.restoreCallingIdentity(identity); } } @Override public int checkSmsShortCodeDestination(int subId, String callingPackage, String callingFeatureId, String destAddress, String countryIso) { Loading
src/java/com/android/internal/telephony/SmsStorageMonitor.java +30 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import com.android.telephony.Rlog; * dual-mode devices that require support for both 3GPP and 3GPP2 format messages. */ public class SmsStorageMonitor extends Handler { private static final String TAG = "SmsStorageMonitor"; private static final String TAG = "SmsStorageMonitor1"; /** Maximum number of times to retry memory status reporting */ private static final int MAX_RETRIES = 1; Loading Loading @@ -87,6 +87,10 @@ public class SmsStorageMonitor extends Handler { final CommandsInterface mCi; boolean mStorageAvailable = true; boolean mInitialStorageAvailableStatus = true; private boolean mMemoryStatusOverrideFlag = false; /** * Hold the wake lock for 5 seconds, which should be enough time for * any receiver(s) to grab its own wake lock. Loading Loading @@ -115,6 +119,31 @@ public class SmsStorageMonitor extends Handler { mContext.registerReceiver(mResultReceiver, filter); } /** * Overriding of the Memory Status by the TestApi and send the event to Handler to test * the RP-SMMA feature * @param isStorageAvailable boolean value specifies the MemoryStatus to be * sent to Handler */ public void sendMemoryStatusOverride(boolean isStorageAvailable) { if (!mMemoryStatusOverrideFlag) { mInitialStorageAvailableStatus = mStorageAvailable; mMemoryStatusOverrideFlag = true; } mStorageAvailable = isStorageAvailable; if (isStorageAvailable) { sendMessage(obtainMessage(EVENT_REPORT_MEMORY_STATUS)); } } /** * reset Memory Status change made by {@link #sendMemoryStatusOverride} */ public void clearMemoryStatusOverride() { mStorageAvailable = mInitialStorageAvailableStatus; mMemoryStatusOverrideFlag = false; } @VisibleForTesting public void setMaxRetries(int maxCount) { mMaxRetryCount = maxCount; Loading