Skip to content
Commit 4a0c5361 authored by Krzysztof Dziembała's avatar Krzysztof Dziembała Committed by Simon Redman
Browse files

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).
parent aa25372e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment