Already have the same functionality at line 782:

https://github.com/onepf/OpenIAB/blob/master/library/src/org/onepf/oms/OpenIabHelper.java#L782