Properly fail commit of a new staged session if another one is in progress

Previous implementation did not really work because:
* PackageInstallerSession.commit marks session as committed and then
  sends MSG_COMMIT message;
* handleCommit calls StagingManager#commitSession;

This means that by the time StagingManager#commitSession(session) is called:
* mStagedSessions already contain session;
* this session is already marked as committed;

As a result, implementation in the ag/6638240 was failing a second committed
session only if it's id is greater than id of the first one.

Why manual testing in the previous CL worked?
I guess, I got lucky and in my case the second session had a greater id.

Bug: 127296534
Test: atest CtsStagedInstallHostTestCases (run 10 times)
Test: adb install --staged foo.apk (10 times with reboots in between)
Change-Id: I78f22d5537a7d074fc69f146dafccee6a6e5e896
2 files changed