Restart trust agents when updated or when they are dead

ActivityManager restarts the trust agent service for us
when it gets killed automatically. This does not apply
when its process crashes too often or when its package
gets updated however.
To catch the update case, the trust agent connection
is removed as soon as the package disappears, and then
readded when the new package appears.
To catch the repeated crashing case, the connection is
reset if it hasn't successfully connected for several minutes.

Also adds a button to SampleTrustAgent to simulate a crash.

Bug: 16137258
Change-Id: I1b18fc7a3025e23e25ca1623b6af658d5430a94b
6 files changed