Save observer in call to commit

The observer used to be saved in a round-about way; being passed
to the "commit" message handler and set there. The idea was that
if there were multiple calls to commit() with different observers,
it would be strange to wipe out the first observer during the
second call to commit. However, setting the observer only in the
commit handler means there are other methods [namely abandon()
and setPermissionsResult()] where the observer will either not
be called unless the commit message handler was run or the first
observer might be wiped out with multiple commit calls.

The only way to track this properly would be to generate a
commit ID and assign an observer with that commit ID. However,
there doesn't appear to be a legit use case for a caller to invoke
commit multiple times on the same session with different observers.
So, we just set the observer directly in the commit() method.

Change-Id: I5e0d6c163ea84d1f49780aa899afb2e1cdf17584
Fixes: 64564511
Test: cts-tradefed run commandAndExit cts-dev -t android.appsecurity.cts.PkgInstallSignatureVerificationTest#testInstallEphemeralRequiresV2Signature -m CtsAppSecurityHostTestCases
1 file changed