Keystore 2.0: Fix deadlock situation.

The key blob garbage collector and the legacy migrator run on the same
worker thread. In case of the legacy migrator, the worker is used to
serialize key migrations but used synchronously, i.e., the requester
waits for the completion of the migration. A migration is also attempted
for super keys which are in some cases needed by the garbage collector.
This causes the garbage collector to schedule a migration request from
the worker thread and then blocks but the request can never complete
because it runs on the same thread which also services the migration.

With the worker blocked, subsequent keystore requests, that wait for
the worker, e.g., migration requests and time stamp token generation,
will block indefinitely until the binder thread pool is depleted. At
this point the deadlock spills over into other services provided by
keystore that are not directly effected by the worker thread
otherwise, e.g., VPN profile store, etc.

This patch gives the legacy migrator its own worker thread, thereby
breaking the circular dependency with the garbage collector.

Bug: 184006658
Bug: 186016708
Bug: 186630982
Change-Id: I12c63b5b74adaed385a8be0e06828693210571a6
diff --git a/keystore2/src/globals.rs b/keystore2/src/globals.rs
index 9f38799..bd28ca6 100644
--- a/keystore2/src/globals.rs
+++ b/keystore2/src/globals.rs
@@ -172,7 +172,7 @@
         &DB_PATH.lock().expect("Could not get the database path for legacy blob loader.")));
     /// Legacy migrator. Atomically migrates legacy blobs to the database.
     pub static ref LEGACY_MIGRATOR: Arc<LegacyMigrator> =
-        Arc::new(LegacyMigrator::new(ASYNC_TASK.clone()));
+        Arc::new(LegacyMigrator::new(Arc::new(Default::default())));
     /// Background thread which handles logging via statsd and logd
     pub static ref LOGS_HANDLER: Arc<AsyncTask> = Default::default();
 }