Loading src/java/com/android/internal/telephony/SmsController.java +45 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,9 @@ public class SmsController extends ISmsImplBase { @Override public boolean updateMessageOnIccEfForSubscriber(int subId, String callingPackage, int index, int status, byte[] pdu) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.updateMessageOnIccEf(callingPackage, index, status, pdu); Loading @@ -94,6 +97,9 @@ public class SmsController extends ISmsImplBase { @Override public boolean copyMessageToIccEfForSubscriber(int subId, String callingPackage, int status, byte[] pdu, byte[] smsc) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.copyMessageToIccEf(callingPackage, status, pdu, smsc); Loading @@ -107,6 +113,9 @@ public class SmsController extends ISmsImplBase { @UnsupportedAppUsage @Override public List<SmsRawData> getAllMessagesFromIccEfForSubscriber(int subId, String callingPackage) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.getAllMessagesFromIccEf(callingPackage); Loading @@ -122,6 +131,9 @@ public class SmsController extends ISmsImplBase { public void sendDataForSubscriber(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendData(callingPackage, destAddr, scAddr, destPort, data, Loading Loading @@ -156,10 +168,17 @@ public class SmsController extends ISmsImplBase { } } private String getCallingPackage() { return mContext.getPackageManager().getPackagesForUid(Binder.getCallingUid())[0]; } @Override public void sendTextForSubscriber(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp) { if (callingPackage == null) { callingPackage = getCallingPackage(); } if (!getSmsPermissions(subId).checkCallingCanSendText(persistMessageForNonDefaultSmsApp, callingPackage, "Sending SMS message")) { sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE); Loading Loading @@ -233,6 +252,9 @@ public class SmsController extends ISmsImplBase { String destAddr, String scAddr, String parts, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntent, Loading @@ -248,6 +270,11 @@ public class SmsController extends ISmsImplBase { public void sendMultipartTextForSubscriber(int subId, String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp) { // This is different from the checking of other method. It prefers the package name // returned by getCallPackage() for backward-compatibility. if (getCallingPackage() != null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendMultipartText(callingPackage, destAddr, scAddr, parts, sentIntents, Loading @@ -264,6 +291,9 @@ public class SmsController extends ISmsImplBase { String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts, Loading Loading @@ -628,18 +658,27 @@ public class SmsController extends ISmsImplBase { @Override public String createAppSpecificSmsTokenWithPackageInfo( int subId, String callingPkg, String prefixes, PendingIntent intent) { if (callingPkg == null) { callingPkg = getCallingPackage(); } return getPhone(subId).getAppSmsManager().createAppSpecificSmsTokenWithPackageInfo( subId, callingPkg, prefixes, intent); } @Override public String createAppSpecificSmsToken(int subId, String callingPkg, PendingIntent intent) { if (callingPkg == null) { callingPkg = getCallingPackage(); } return getPhone(subId).getAppSmsManager().createAppSpecificSmsToken(callingPkg, intent); } @Override public int checkSmsShortCodeDestination(int subId, String callingPackage, String callingFeatureId, String destAddress, String countryIso) { if (callingPackage == null) { callingPackage = getCallingPackage(); } if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(getPhone(subId).getContext(), subId, callingPackage, callingFeatureId, "checkSmsShortCodeDestination")) { return SmsManager.SMS_CATEGORY_NOT_SHORT_CODE; Loading Loading @@ -670,6 +709,9 @@ public class SmsController extends ISmsImplBase { @Override public String getSmscAddressFromIccEfForSubscriber(int subId, String callingPackage) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.getSmscAddressFromIccEf(callingPackage); Loading @@ -683,6 +725,9 @@ public class SmsController extends ISmsImplBase { @Override public boolean setSmscAddressOnIccEfForSubscriber( String smsc, int subId, String callingPackage) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.setSmscAddressOnIccEf(callingPackage, smsc); Loading Loading
src/java/com/android/internal/telephony/SmsController.java +45 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,9 @@ public class SmsController extends ISmsImplBase { @Override public boolean updateMessageOnIccEfForSubscriber(int subId, String callingPackage, int index, int status, byte[] pdu) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.updateMessageOnIccEf(callingPackage, index, status, pdu); Loading @@ -94,6 +97,9 @@ public class SmsController extends ISmsImplBase { @Override public boolean copyMessageToIccEfForSubscriber(int subId, String callingPackage, int status, byte[] pdu, byte[] smsc) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.copyMessageToIccEf(callingPackage, status, pdu, smsc); Loading @@ -107,6 +113,9 @@ public class SmsController extends ISmsImplBase { @UnsupportedAppUsage @Override public List<SmsRawData> getAllMessagesFromIccEfForSubscriber(int subId, String callingPackage) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.getAllMessagesFromIccEf(callingPackage); Loading @@ -122,6 +131,9 @@ public class SmsController extends ISmsImplBase { public void sendDataForSubscriber(int subId, String callingPackage, String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendData(callingPackage, destAddr, scAddr, destPort, data, Loading Loading @@ -156,10 +168,17 @@ public class SmsController extends ISmsImplBase { } } private String getCallingPackage() { return mContext.getPackageManager().getPackagesForUid(Binder.getCallingUid())[0]; } @Override public void sendTextForSubscriber(int subId, String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp) { if (callingPackage == null) { callingPackage = getCallingPackage(); } if (!getSmsPermissions(subId).checkCallingCanSendText(persistMessageForNonDefaultSmsApp, callingPackage, "Sending SMS message")) { sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE); Loading Loading @@ -233,6 +252,9 @@ public class SmsController extends ISmsImplBase { String destAddr, String scAddr, String parts, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntent, Loading @@ -248,6 +270,11 @@ public class SmsController extends ISmsImplBase { public void sendMultipartTextForSubscriber(int subId, String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp) { // This is different from the checking of other method. It prefers the package name // returned by getCallPackage() for backward-compatibility. if (getCallingPackage() != null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendMultipartText(callingPackage, destAddr, scAddr, parts, sentIntents, Loading @@ -264,6 +291,9 @@ public class SmsController extends ISmsImplBase { String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts, Loading Loading @@ -628,18 +658,27 @@ public class SmsController extends ISmsImplBase { @Override public String createAppSpecificSmsTokenWithPackageInfo( int subId, String callingPkg, String prefixes, PendingIntent intent) { if (callingPkg == null) { callingPkg = getCallingPackage(); } return getPhone(subId).getAppSmsManager().createAppSpecificSmsTokenWithPackageInfo( subId, callingPkg, prefixes, intent); } @Override public String createAppSpecificSmsToken(int subId, String callingPkg, PendingIntent intent) { if (callingPkg == null) { callingPkg = getCallingPackage(); } return getPhone(subId).getAppSmsManager().createAppSpecificSmsToken(callingPkg, intent); } @Override public int checkSmsShortCodeDestination(int subId, String callingPackage, String callingFeatureId, String destAddress, String countryIso) { if (callingPackage == null) { callingPackage = getCallingPackage(); } if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(getPhone(subId).getContext(), subId, callingPackage, callingFeatureId, "checkSmsShortCodeDestination")) { return SmsManager.SMS_CATEGORY_NOT_SHORT_CODE; Loading Loading @@ -670,6 +709,9 @@ public class SmsController extends ISmsImplBase { @Override public String getSmscAddressFromIccEfForSubscriber(int subId, String callingPackage) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.getSmscAddressFromIccEf(callingPackage); Loading @@ -683,6 +725,9 @@ public class SmsController extends ISmsImplBase { @Override public boolean setSmscAddressOnIccEfForSubscriber( String smsc, int subId, String callingPackage) { if (callingPackage == null) { callingPackage = getCallingPackage(); } IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null) { return iccSmsIntMgr.setSmscAddressOnIccEf(callingPackage, smsc); Loading