Loading telephony/common/com/android/internal/telephony/SmsApplication.java +16 −1 Original line number Diff line number Diff line Loading @@ -1051,7 +1051,8 @@ public final class SmsApplication { } /** * Check if a package is default sms app (or equivalent, like bluetooth) * Check if a package is default sms app (or equivalent, like bluetooth), and verify that * packageName belongs to the caller. * * @param context context from the calling app * @param packageName the name of the package to be checked Loading @@ -1060,8 +1061,22 @@ public final class SmsApplication { @UnsupportedAppUsage public static boolean isDefaultSmsApplication(Context context, String packageName) { if (packageName == null) { Log.e(LOG_TAG, "isDefaultSmsApplication: packageName is null"); return false; } try { if (Binder.getCallingUid() == context.getPackageManager().getPackageUid(packageName, 0)) { Log.e(LOG_TAG, "isDefaultSmsApplication: " + packageName + " calling uid " + context.getPackageManager().getPackageUid(packageName, 0) + " does not match calling uid " + Binder.getCallingUid()); return false; } } catch (NameNotFoundException ex) { Log.e(LOG_TAG, "isDefaultSmsApplication: packageName " + packageName + " not found"); return false; } final String defaultSmsPackage = getDefaultSmsApplicationPackageName(context); if ((defaultSmsPackage != null && defaultSmsPackage.equals(packageName)) || BLUETOOTH_PACKAGE_NAME.equals(packageName)) { Loading telephony/java/android/telephony/SmsManager.java +4 −3 Original line number Diff line number Diff line Loading @@ -2743,7 +2743,7 @@ public final class SmsManager { getSubscriptionId(), null); } } catch (RemoteException ex) { // ignore it throw new RuntimeException(ex); } return smsc; } Loading @@ -2765,7 +2765,8 @@ public final class SmsManager { * </p> * * @param smsc the SMSC address string. * @return true for success, false otherwise. * @return true for success, false otherwise. Failure can be due to caller not having the * appropriate permission, or modem returning an error. */ @SuppressAutoDoc // for carrier privileges and default SMS application. @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) Loading @@ -2777,7 +2778,7 @@ public final class SmsManager { smsc, getSubscriptionId(), null); } } catch (RemoteException ex) { // ignore it throw new RuntimeException(ex); } return false; } Loading Loading
telephony/common/com/android/internal/telephony/SmsApplication.java +16 −1 Original line number Diff line number Diff line Loading @@ -1051,7 +1051,8 @@ public final class SmsApplication { } /** * Check if a package is default sms app (or equivalent, like bluetooth) * Check if a package is default sms app (or equivalent, like bluetooth), and verify that * packageName belongs to the caller. * * @param context context from the calling app * @param packageName the name of the package to be checked Loading @@ -1060,8 +1061,22 @@ public final class SmsApplication { @UnsupportedAppUsage public static boolean isDefaultSmsApplication(Context context, String packageName) { if (packageName == null) { Log.e(LOG_TAG, "isDefaultSmsApplication: packageName is null"); return false; } try { if (Binder.getCallingUid() == context.getPackageManager().getPackageUid(packageName, 0)) { Log.e(LOG_TAG, "isDefaultSmsApplication: " + packageName + " calling uid " + context.getPackageManager().getPackageUid(packageName, 0) + " does not match calling uid " + Binder.getCallingUid()); return false; } } catch (NameNotFoundException ex) { Log.e(LOG_TAG, "isDefaultSmsApplication: packageName " + packageName + " not found"); return false; } final String defaultSmsPackage = getDefaultSmsApplicationPackageName(context); if ((defaultSmsPackage != null && defaultSmsPackage.equals(packageName)) || BLUETOOTH_PACKAGE_NAME.equals(packageName)) { Loading
telephony/java/android/telephony/SmsManager.java +4 −3 Original line number Diff line number Diff line Loading @@ -2743,7 +2743,7 @@ public final class SmsManager { getSubscriptionId(), null); } } catch (RemoteException ex) { // ignore it throw new RuntimeException(ex); } return smsc; } Loading @@ -2765,7 +2765,8 @@ public final class SmsManager { * </p> * * @param smsc the SMSC address string. * @return true for success, false otherwise. * @return true for success, false otherwise. Failure can be due to caller not having the * appropriate permission, or modem returning an error. */ @SuppressAutoDoc // for carrier privileges and default SMS application. @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) Loading @@ -2777,7 +2778,7 @@ public final class SmsManager { smsc, getSubscriptionId(), null); } } catch (RemoteException ex) { // ignore it throw new RuntimeException(ex); } return false; } Loading