Fix reading SMS/MMS on devices with no `sub_id`
Some (Xiaomi) devices running >= Android Lollipop (SDK 22+) don't support `Telephony.Sms.SUBSCRIPTION_ID`. This commit adds a verification step to ensure that only devices with `"sub_id"` column include it in query. * Address review comments Check was moved to a separate helper function (boolean), it's performed only on SDK 22+ and `Telephony.Sms.SUBSCRIPTION_ID` is used in query (instead of null), so no NullPointerException is thrown. Also parseInt shouldn't now fail if `Message.SUBSCRIPTION_ID` key exists in messageInfo, but value is null * Return false if cursor is null * Return true without checking column If we got the cursor, the query won't fail when executed again, and the "sim_id" column must exist (because an exception wasn't thrown).
Loading
Please register or sign in to comment