diff options
Diffstat (limited to 'src/java/com/android/internal/telephony')
-rw-r--r-- | src/java/com/android/internal/telephony/InboundSmsHandler.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/java/com/android/internal/telephony/InboundSmsHandler.java b/src/java/com/android/internal/telephony/InboundSmsHandler.java index fe29695d7..cbec2b081 100644 --- a/src/java/com/android/internal/telephony/InboundSmsHandler.java +++ b/src/java/com/android/internal/telephony/InboundSmsHandler.java @@ -37,20 +37,27 @@ import android.os.Message; import android.os.PowerManager; import android.os.SystemProperties; import android.preference.PreferenceManager; +import android.provider.Settings; import android.provider.Telephony; import android.provider.Telephony.Sms.Intents; import android.telephony.Rlog; import android.telephony.SmsMessage; import android.telephony.TelephonyManager; +import android.text.TextUtils; import com.android.internal.telephony.util.BlacklistUtils; import com.android.internal.telephony.PhoneBase; import com.android.internal.util.HexDump; import com.android.internal.util.State; import com.android.internal.util.StateMachine; +import com.google.i18n.phonenumbers.PhoneNumberUtil; import java.io.ByteArrayOutputStream; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA; @@ -730,7 +737,20 @@ public abstract class InboundSmsHandler extends StateMachine { } Intent intent; - if (destPort == -1) { + List<String> regAddresses = Settings.Secure.getDelimitedStringAsList(mContext.getContentResolver(), + Settings.Secure.PROTECTED_SMS_ADDRESSES , "\\|"); + + List<String> allAddresses = Intents + .getNormalizedAddressesFromPdus(pdus, tracker.getFormat()); + + if (!Collections.disjoint(regAddresses, allAddresses)) { + intent = new Intent(Intents.PROTECTED_SMS_RECEIVED_ACTION); + intent.putExtra("pdus", pdus); + intent.putExtra("format", tracker.getFormat()); + dispatchIntent(intent, android.Manifest.permission.RECEIVE_PROTECTED_SMS, + AppOpsManager.OP_RECEIVE_SMS, resultReceiver); + return true; + } else if (destPort == -1) { intent = new Intent(Intents.SMS_DELIVER_ACTION); // Direct the intent to only the default SMS app. If we can't find a default SMS app |