Add AndroidKeyStore provider for KeyStore API

This introduces a public API for the Android keystore that is accessible
via java.security.KeyStore API. This allows programs to store
PrivateKeyEntry and TrustedCertificateEntry items visible only to
themselves.

Future work should include:

* Implement KeyStore.CallbackHandlerProtection parameter to allow the
  caller to request that the keystore daemon unlock itself via the
  system password input dialog.

* Implement SecretKeyEntry once that support is in keystore daemon

Change-Id: I382ffdf742d3f9f7647c5f5a429244a340b6bb0a
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 7eb86f4..4d4b19b 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -81,6 +81,7 @@
 import android.view.WindowManager;
 import android.view.WindowManagerImpl;
 import android.renderscript.RenderScript;
+import android.security.AndroidKeyStoreProvider;
 
 import com.android.internal.os.BinderInternal;
 import com.android.internal.os.RuntimeInit;
@@ -95,6 +96,7 @@
 import java.io.PrintWriter;
 import java.lang.ref.WeakReference;
 import java.net.InetAddress;
+import java.security.Security;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -4799,6 +4801,8 @@
         // StrictMode) on debug builds, but using DropBox, not logs.
         CloseGuard.setEnabled(false);
 
+        Security.addProvider(new AndroidKeyStoreProvider());
+
         Process.setArgV0("<pre-initialized>");
 
         Looper.prepareMainLooper();