Unfortunately, rild is a binary blob. We're also constrained by the generic RIL API which doesn't offer any messages which allow us to query the PIN/PUK retry counts independent of an action.
In theory, this is something that could be fixed for a specific OEM by means of a custom RIL request/reply, however a generic solution isn't really possible.
My suggestion would be to tweak the UI to display the remaining retries after each attempt as I see no way to offer a guarantee that the retry number is correct before an initial unlock attempt is performed.
Unfortunately, rild is a binary blob. We're also constrained by the generic RIL API which doesn't offer any messages which allow us to query the PIN/PUK retry counts independent of an action.
In theory, this is something that could be fixed for a specific OEM by means of a custom RIL request/reply, however a generic solution isn't really possible.
My suggestion would be to tweak the UI to display the remaining retries after each attempt as I see no way to offer a guarantee that the retry number is correct before an initial unlock attempt is performed.