arc: Make PAI flow error resistant.

PAI is started during the initial ARC boot. However it might be the case
when PAI is not triggered due user logs out earlier, crash or other
conditions. PAI may be alse locked until assistant completes. This makes
PAI starter fragile and in cases described above PAI might not be
executed on device at all.
This CL introduces the flag that indicates that PAI was started for this
device and we will start PAI on next user login if this is required.
This also adds extra protection to assistant flow that would release
lock if something goes wrong. As side refactoring, PAI lock
manipulations are moved to one class to make logic clear.

      cases PAI was finally called. Added extra unit tests.
      Bug: b/63765408

Test: various test cases on device, simulated different errors. In all
Change-Id: Ic6a026b4023d9ea91348f01e597910cdd4a084d8
Reviewed-on: https://chromium-review.googlesource.com/622071
Commit-Queue: Yury Khmel <[email protected]>
Reviewed-by: Luis Hector Chavez <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Cr-Commit-Position: refs/heads/master@{#496096}
10 files changed