[Android Payment App] Unbind only if binding initiated.
Before this patch, Context.bindService() could return false when connecting to payment app's org.chromium.intent.action.IS_READY_TO_PAY service, although ServiceConnection.onServiceConnected() was also invoked. The onServiceConnected() method would set mIsServiceConnected to true, which would cause Context.unbindService() call, which would throw InvalidArgumentException, because bindService() returned false. This patch removes mIsServiceConnected boolean that was set in onServiceConnected() method and adds mIsServiceBindingInitiated that is set to the return value of bindService(). If this boolean is true, then unbindService() is called. After this patch, unbindService() is called only if bindService() returned true, thus avoiding the IllegalArgumentException. Tested locally against BobPay.apk downloaded from https://bobpay.xyz and invoked from https://rsolomakhin.github.io/pr/skip-ui/. Bug: 828852 Change-Id: I00647791098f129b3a16f1f3430a363ee12ecee9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845953Reviewed-by:Danyao Wang <danyao@chromium.org> Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org> Cr-Commit-Position: refs/heads/master@{#703697}
Showing
Please register or sign in to comment