Now I see that in Lollipop (API 21), even when using a benign function such as SmsManager.getDefault().divideMessage(String) , READ_PHONE_STATE permission is READ_PHONE_STATE . I am sure that this was not required before, and that this is a problem with the OS, since I tested it on Nexus 5 devices before and after upgrading to Lollipop. Previously, when KitKat started, SMS worked fine without the permission of READ_PHONE_STATE . And after that it was required.
The reason is that, I think, telephony features are trying to make wise decisions, well, thatβs it. Thus, a simple task, for example, splitting SMS (not even sending), goes to SmsManager to request it about the status of the phone.
I think this is a design mistake. And, as you said above, this can and should scare users. Why do they have so many ambiguous permissions on Android?
This is my stack trace, just for fun:
java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10078 nor current process has android.permission.READ_PHONE_STATE. at android.os.Parcel.readException(Parcel.java:1540) at android.os.Parcel.readException(Parcel.java:1493) at com.android.internal.telephony.IPhoneSubInfo$Stub$Proxy.getGroupIdLevel1(IPhoneSubInfo.java:465) at android.telephony.TelephonyManager.getGroupIdLevel1(TelephonyManager.java:1666) at android.telephony.SmsMessage.hasEmsSupport(SmsMessage.java:776) at com.android.internal.telephony.gsm.SmsMessage.calculateLength(SmsMessage.java:808) at android.telephony.SmsMessage.fragmentText(SmsMessage.java:322) at android.telephony.SmsManager.divideMessage(SmsManager.java:328) at mobi.chatfish.utils.CFCommunications.sendSMSDirect(CFCommunications.java:138)
Shoham
source share