Loading src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +17 −12 Original line number Original line Diff line number Diff line Loading @@ -449,8 +449,7 @@ public class IccSmsInterfaceManager { return; return; } } if (!persistMessageForNonDefaultSmsApp) { if (!persistMessageForNonDefaultSmsApp) { // Only allow carrier app or phone process to skip auto message persistence. enforcePrivilegedAppPermissions(); enforceCarrierOrPhonePrivilege(); } } destAddr = filterDestAddress(destAddr); destAddr = filterDestAddress(destAddr); mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, Loading @@ -468,7 +467,7 @@ public class IccSmsInterfaceManager { * the same time an SMS received from radio is acknowledged back. * the same time an SMS received from radio is acknowledged back. */ */ public void injectSmsPdu(byte[] pdu, String format, PendingIntent receivedIntent) { public void injectSmsPdu(byte[] pdu, String format, PendingIntent receivedIntent) { enforceCarrierOrCarrierImsPrivilege(); enforcePrivilegedAppPermissions(); if (Rlog.isLoggable("SMS", Log.VERBOSE)) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("pdu: " + pdu + log("pdu: " + pdu + "\n format=" + format + "\n format=" + format + Loading Loading @@ -511,7 +510,7 @@ public class IccSmsInterfaceManager { "Sending SMS message"); "Sending SMS message"); if (!persistMessageForNonDefaultSmsApp) { if (!persistMessageForNonDefaultSmsApp) { // Only allow carrier app or carrier ims to skip auto message persistence. // Only allow carrier app or carrier ims to skip auto message persistence. enforceCarrierOrCarrierImsPrivilege(); enforcePrivilegedAppPermissions(); } } if (Rlog.isLoggable("SMS", Log.VERBOSE)) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { int i = 0; int i = 0; Loading Loading @@ -1118,8 +1117,21 @@ public class IccSmsInterfaceManager { } } } } private void enforceCarrierOrCarrierImsPrivilege() { /** * Enforces that the caller is one of the following: * <ul> * <li> Phone process * <li> IMS App * <li> Carrier App * </ul> */ private void enforcePrivilegedAppPermissions() { int callingUid = Binder.getCallingUid(); int callingUid = Binder.getCallingUid(); // Allow the phone process itself to send, inject messages. if (callingUid == Process.PHONE_UID) { return; } String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, mPhone, String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, mPhone, new Intent(CarrierMessagingService.SERVICE_INTERFACE)); new Intent(CarrierMessagingService.SERVICE_INTERFACE)); try { try { Loading @@ -1136,13 +1148,6 @@ public class IccSmsInterfaceManager { enforceCarrierPrivilege(); enforceCarrierPrivilege(); } } private void enforceCarrierOrPhonePrivilege() { int callingUid = Binder.getCallingUid(); if (callingUid != Process.PHONE_UID) { enforceCarrierPrivilege(); } } private String filterDestAddress(String destAddr) { private String filterDestAddress(String destAddr) { String result = null; String result = null; result = SmsNumberUtils.filterDestAddr(mPhone, destAddr); result = SmsNumberUtils.filterDestAddr(mPhone, destAddr); Loading Loading
src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +17 −12 Original line number Original line Diff line number Diff line Loading @@ -449,8 +449,7 @@ public class IccSmsInterfaceManager { return; return; } } if (!persistMessageForNonDefaultSmsApp) { if (!persistMessageForNonDefaultSmsApp) { // Only allow carrier app or phone process to skip auto message persistence. enforcePrivilegedAppPermissions(); enforceCarrierOrPhonePrivilege(); } } destAddr = filterDestAddress(destAddr); destAddr = filterDestAddress(destAddr); mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, Loading @@ -468,7 +467,7 @@ public class IccSmsInterfaceManager { * the same time an SMS received from radio is acknowledged back. * the same time an SMS received from radio is acknowledged back. */ */ public void injectSmsPdu(byte[] pdu, String format, PendingIntent receivedIntent) { public void injectSmsPdu(byte[] pdu, String format, PendingIntent receivedIntent) { enforceCarrierOrCarrierImsPrivilege(); enforcePrivilegedAppPermissions(); if (Rlog.isLoggable("SMS", Log.VERBOSE)) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("pdu: " + pdu + log("pdu: " + pdu + "\n format=" + format + "\n format=" + format + Loading Loading @@ -511,7 +510,7 @@ public class IccSmsInterfaceManager { "Sending SMS message"); "Sending SMS message"); if (!persistMessageForNonDefaultSmsApp) { if (!persistMessageForNonDefaultSmsApp) { // Only allow carrier app or carrier ims to skip auto message persistence. // Only allow carrier app or carrier ims to skip auto message persistence. enforceCarrierOrCarrierImsPrivilege(); enforcePrivilegedAppPermissions(); } } if (Rlog.isLoggable("SMS", Log.VERBOSE)) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { int i = 0; int i = 0; Loading Loading @@ -1118,8 +1117,21 @@ public class IccSmsInterfaceManager { } } } } private void enforceCarrierOrCarrierImsPrivilege() { /** * Enforces that the caller is one of the following: * <ul> * <li> Phone process * <li> IMS App * <li> Carrier App * </ul> */ private void enforcePrivilegedAppPermissions() { int callingUid = Binder.getCallingUid(); int callingUid = Binder.getCallingUid(); // Allow the phone process itself to send, inject messages. if (callingUid == Process.PHONE_UID) { return; } String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, mPhone, String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, mPhone, new Intent(CarrierMessagingService.SERVICE_INTERFACE)); new Intent(CarrierMessagingService.SERVICE_INTERFACE)); try { try { Loading @@ -1136,13 +1148,6 @@ public class IccSmsInterfaceManager { enforceCarrierPrivilege(); enforceCarrierPrivilege(); } } private void enforceCarrierOrPhonePrivilege() { int callingUid = Binder.getCallingUid(); if (callingUid != Process.PHONE_UID) { enforceCarrierPrivilege(); } } private String filterDestAddress(String destAddr) { private String filterDestAddress(String destAddr) { String result = null; String result = null; result = SmsNumberUtils.filterDestAddr(mPhone, destAddr); result = SmsNumberUtils.filterDestAddr(mPhone, destAddr); Loading