Loading src/java/com/android/internal/telephony/InboundSmsHandler.java +8 −3 Original line number Diff line number Diff line Loading @@ -1436,12 +1436,14 @@ public abstract class InboundSmsHandler extends StateMachine { intent.putExtra("messageId", messageId); } UserHandle userHandle = null; if (destPort == -1) { intent.setAction(Intents.SMS_DELIVER_ACTION); // Direct the intent to only the default SMS app. If we can't find a default SMS app // then sent it to all broadcast receivers. // We are deliberately delivering to the primary user's default SMS App. ComponentName componentName = SmsApplication.getDefaultSmsApplication(mContext, true); userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, subId); ComponentName componentName = SmsApplication.getDefaultSmsApplicationAsUser(mContext, true, userHandle); if (componentName != null) { // Deliver SMS message only to this receiver. intent.setComponent(componentName); Loading @@ -1465,9 +1467,12 @@ public abstract class InboundSmsHandler extends StateMachine { intent.setComponent(null); } if (userHandle == null) { userHandle = UserHandle.SYSTEM; } Bundle options = handleSmsWhitelisting(intent.getComponent(), isClass0); dispatchIntent(intent, android.Manifest.permission.RECEIVE_SMS, AppOpsManager.OPSTR_RECEIVE_SMS, options, resultReceiver, UserHandle.SYSTEM, subId); AppOpsManager.OPSTR_RECEIVE_SMS, options, resultReceiver, userHandle, subId); } /** Loading src/java/com/android/internal/telephony/SMSDispatcher.java +4 −2 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails; import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.uicc.IccRecords; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; import java.io.FileDescriptor; Loading Loading @@ -2401,9 +2402,10 @@ public abstract class SMSDispatcher extends Handler { /** Return if the SMS was originated from the default SMS application. */ public boolean isFromDefaultSmsApplication(Context context) { if (mIsFromDefaultSmsApplication == null) { UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(context, mSubId); // Perform a lazy initialization, due to the cost of the operation. mIsFromDefaultSmsApplication = SmsApplication.isDefaultSmsApplication(context, getAppPackageName()); mIsFromDefaultSmsApplication = SmsApplication.isDefaultSmsApplicationAsUser(context, getAppPackageName(), userHandle); } return mIsFromDefaultSmsApplication; } Loading src/java/com/android/internal/telephony/SmsPermissions.java +5 −1 Original line number Diff line number Diff line Loading @@ -23,9 +23,11 @@ import android.content.Context; import android.content.Intent; import android.os.Binder; import android.os.Build; import android.os.UserHandle; import android.service.carrier.CarrierMessagingService; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; /** Loading Loading @@ -163,7 +165,9 @@ public class SmsPermissions { @VisibleForTesting public boolean isCallerDefaultSmsPackage(String packageName) { if (packageNameMatchesCallingUid(packageName)) { return SmsApplication.isDefaultSmsApplication(mContext, packageName); UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, mPhone.getSubId()); return SmsApplication.isDefaultSmsApplicationAsUser(mContext, packageName, userHandle); } return false; } Loading src/java/com/android/internal/telephony/SmsStorageMonitor.java +9 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony; import android.compat.annotation.UnsupportedAppUsage; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; Loading @@ -26,10 +27,12 @@ import android.os.Build; import android.os.Handler; import android.os.Message; import android.os.PowerManager; import android.os.UserHandle; import android.provider.Telephony.Sms.Intents; import android.telephony.SubscriptionManager; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; /** Loading Loading @@ -223,9 +226,14 @@ public class SmsStorageMonitor extends Handler { * that SIM storage for SMS messages is full. */ private void handleIccFull() { UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, mPhone.getSubId()); ComponentName componentName = SmsApplication.getDefaultSimFullApplicationAsUser(mContext, false, userHandle); // broadcast SIM_FULL intent Intent intent = new Intent(Intents.SIM_FULL_ACTION); intent.setComponent(SmsApplication.getDefaultSimFullApplication(mContext, false)); intent.setComponent(componentName); mWakeLock.acquire(WAKE_LOCK_TIMEOUT); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); mContext.sendBroadcast(intent, android.Manifest.permission.RECEIVE_SMS); Loading src/java/com/android/internal/telephony/WapPushOverSms.java +9 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.telephony.SubscriptionManager; import android.text.TextUtils; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; import com.google.android.mms.pdu.GenericPdu; Loading Loading @@ -392,7 +393,10 @@ public class WapPushOverSms implements ServiceConnection { // Direct the intent to only the default MMS app. If we can't find a default MMS app // then sent it to all broadcast receivers. ComponentName componentName = SmsApplication.getDefaultMmsApplication(mContext, true); UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, subId); ComponentName componentName = SmsApplication.getDefaultMmsApplicationAsUser(mContext, true, userHandle); Bundle options = null; if (componentName != null) { // Deliver MMS message only to this receiver Loading @@ -410,9 +414,12 @@ public class WapPushOverSms implements ServiceConnection { options = bopts.toBundle(); } if (userHandle == null) { userHandle = UserHandle.SYSTEM; } handler.dispatchIntent(intent, getPermissionForType(result.mimeType), getAppOpsStringPermissionForIntent(result.mimeType), options, receiver, UserHandle.SYSTEM, subId); userHandle, subId); return Activity.RESULT_OK; } Loading Loading
src/java/com/android/internal/telephony/InboundSmsHandler.java +8 −3 Original line number Diff line number Diff line Loading @@ -1436,12 +1436,14 @@ public abstract class InboundSmsHandler extends StateMachine { intent.putExtra("messageId", messageId); } UserHandle userHandle = null; if (destPort == -1) { intent.setAction(Intents.SMS_DELIVER_ACTION); // Direct the intent to only the default SMS app. If we can't find a default SMS app // then sent it to all broadcast receivers. // We are deliberately delivering to the primary user's default SMS App. ComponentName componentName = SmsApplication.getDefaultSmsApplication(mContext, true); userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, subId); ComponentName componentName = SmsApplication.getDefaultSmsApplicationAsUser(mContext, true, userHandle); if (componentName != null) { // Deliver SMS message only to this receiver. intent.setComponent(componentName); Loading @@ -1465,9 +1467,12 @@ public abstract class InboundSmsHandler extends StateMachine { intent.setComponent(null); } if (userHandle == null) { userHandle = UserHandle.SYSTEM; } Bundle options = handleSmsWhitelisting(intent.getComponent(), isClass0); dispatchIntent(intent, android.Manifest.permission.RECEIVE_SMS, AppOpsManager.OPSTR_RECEIVE_SMS, options, resultReceiver, UserHandle.SYSTEM, subId); AppOpsManager.OPSTR_RECEIVE_SMS, options, resultReceiver, userHandle, subId); } /** Loading
src/java/com/android/internal/telephony/SMSDispatcher.java +4 −2 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails; import com.android.internal.telephony.cdma.sms.UserData; import com.android.internal.telephony.uicc.IccRecords; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; import java.io.FileDescriptor; Loading Loading @@ -2401,9 +2402,10 @@ public abstract class SMSDispatcher extends Handler { /** Return if the SMS was originated from the default SMS application. */ public boolean isFromDefaultSmsApplication(Context context) { if (mIsFromDefaultSmsApplication == null) { UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(context, mSubId); // Perform a lazy initialization, due to the cost of the operation. mIsFromDefaultSmsApplication = SmsApplication.isDefaultSmsApplication(context, getAppPackageName()); mIsFromDefaultSmsApplication = SmsApplication.isDefaultSmsApplicationAsUser(context, getAppPackageName(), userHandle); } return mIsFromDefaultSmsApplication; } Loading
src/java/com/android/internal/telephony/SmsPermissions.java +5 −1 Original line number Diff line number Diff line Loading @@ -23,9 +23,11 @@ import android.content.Context; import android.content.Intent; import android.os.Binder; import android.os.Build; import android.os.UserHandle; import android.service.carrier.CarrierMessagingService; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; /** Loading Loading @@ -163,7 +165,9 @@ public class SmsPermissions { @VisibleForTesting public boolean isCallerDefaultSmsPackage(String packageName) { if (packageNameMatchesCallingUid(packageName)) { return SmsApplication.isDefaultSmsApplication(mContext, packageName); UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, mPhone.getSubId()); return SmsApplication.isDefaultSmsApplicationAsUser(mContext, packageName, userHandle); } return false; } Loading
src/java/com/android/internal/telephony/SmsStorageMonitor.java +9 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony; import android.compat.annotation.UnsupportedAppUsage; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; Loading @@ -26,10 +27,12 @@ import android.os.Build; import android.os.Handler; import android.os.Message; import android.os.PowerManager; import android.os.UserHandle; import android.provider.Telephony.Sms.Intents; import android.telephony.SubscriptionManager; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; /** Loading Loading @@ -223,9 +226,14 @@ public class SmsStorageMonitor extends Handler { * that SIM storage for SMS messages is full. */ private void handleIccFull() { UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, mPhone.getSubId()); ComponentName componentName = SmsApplication.getDefaultSimFullApplicationAsUser(mContext, false, userHandle); // broadcast SIM_FULL intent Intent intent = new Intent(Intents.SIM_FULL_ACTION); intent.setComponent(SmsApplication.getDefaultSimFullApplication(mContext, false)); intent.setComponent(componentName); mWakeLock.acquire(WAKE_LOCK_TIMEOUT); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); mContext.sendBroadcast(intent, android.Manifest.permission.RECEIVE_SMS); Loading
src/java/com/android/internal/telephony/WapPushOverSms.java +9 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.telephony.SubscriptionManager; import android.text.TextUtils; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; import com.google.android.mms.pdu.GenericPdu; Loading Loading @@ -392,7 +393,10 @@ public class WapPushOverSms implements ServiceConnection { // Direct the intent to only the default MMS app. If we can't find a default MMS app // then sent it to all broadcast receivers. ComponentName componentName = SmsApplication.getDefaultMmsApplication(mContext, true); UserHandle userHandle = TelephonyUtils.getSubscriptionUserHandle(mContext, subId); ComponentName componentName = SmsApplication.getDefaultMmsApplicationAsUser(mContext, true, userHandle); Bundle options = null; if (componentName != null) { // Deliver MMS message only to this receiver Loading @@ -410,9 +414,12 @@ public class WapPushOverSms implements ServiceConnection { options = bopts.toBundle(); } if (userHandle == null) { userHandle = UserHandle.SYSTEM; } handler.dispatchIntent(intent, getPermissionForType(result.mimeType), getAppOpsStringPermissionForIntent(result.mimeType), options, receiver, UserHandle.SYSTEM, subId); userHandle, subId); return Activity.RESULT_OK; } Loading