Keystore 2.0: Start keystore2 daemon conditionally.

This patch makes the keystore2 daemon start conditionally based on the
platform property ro.android.system.keystore2.enable.
This is patch can be reverted when the Keystore 2.0 migration is
complete. b/171563717

Bug: 171563717
Bug: 171305684
Test: The keystore2 daemon is running if the property
      ro.android.system.keystore2.enable is set and true
      and not running otherwise.
Change-Id: I2b3d6c70f45f3dafb9edb6f2f6960be94e13ed20
diff --git a/keystore2/keystore2.rc b/keystore2/keystore2.rc
index 139c94b..bc040e5 100644
--- a/keystore2/keystore2.rc
+++ b/keystore2/keystore2.rc
@@ -5,8 +5,16 @@
 # Keystore shall run as user keystore and groups keystore, readproc, and log.
 #
 # See system/core/init/README.md for information on the init.rc language.
+
+# Start Keystore 2 conditionally
+# TODO b/171563717 Remove when Keystore 2 migration is complete.
+on nonencrypted && property:ro.android.security.keystore2.enable=true
+    enable keystore2
+
 service keystore2 /system/bin/keystore2 /data/misc/keystore
     class main
     user keystore
     group keystore readproc log
     writepid /dev/cpuset/foreground/tasks
+    # TODO b/171563717 Remove when Keystore 2 migration is complete.
+    disabled