Merge "Revert "Revert "Use RenderScript for large text blurs"""
diff --git a/core/java/android/security/IKeystoreService.java b/core/java/android/security/IKeystoreService.java
index f8a49e6..651693a 100644
--- a/core/java/android/security/IKeystoreService.java
+++ b/core/java/android/security/IKeystoreService.java
@@ -78,7 +78,7 @@
                 return _result;
             }
 
-            public int insert(String name, byte[] item) throws RemoteException {
+            public int insert(String name, byte[] item, int uid) throws RemoteException {
                 Parcel _data = Parcel.obtain();
                 Parcel _reply = Parcel.obtain();
                 int _result;
@@ -86,6 +86,7 @@
                     _data.writeInterfaceToken(DESCRIPTOR);
                     _data.writeString(name);
                     _data.writeByteArray(item);
+                    _data.writeInt(uid);
                     mRemote.transact(Stub.TRANSACTION_insert, _data, _reply, 0);
                     _reply.readException();
                     _result = _reply.readInt();
@@ -96,13 +97,14 @@
                 return _result;
             }
 
-            public int del(String name) throws RemoteException {
+            public int del(String name, int uid) throws RemoteException {
                 Parcel _data = Parcel.obtain();
                 Parcel _reply = Parcel.obtain();
                 int _result;
                 try {
                     _data.writeInterfaceToken(DESCRIPTOR);
                     _data.writeString(name);
+                    _data.writeInt(uid);
                     mRemote.transact(Stub.TRANSACTION_del, _data, _reply, 0);
                     _reply.readException();
                     _result = _reply.readInt();
@@ -113,13 +115,14 @@
                 return _result;
             }
 
-            public int exist(String name) throws RemoteException {
+            public int exist(String name, int uid) throws RemoteException {
                 Parcel _data = Parcel.obtain();
                 Parcel _reply = Parcel.obtain();
                 int _result;
                 try {
                     _data.writeInterfaceToken(DESCRIPTOR);
                     _data.writeString(name);
+                    _data.writeInt(uid);
                     mRemote.transact(Stub.TRANSACTION_exist, _data, _reply, 0);
                     _reply.readException();
                     _result = _reply.readInt();
@@ -130,13 +133,14 @@
                 return _result;
             }
 
-            public String[] saw(String name) throws RemoteException {
+            public String[] saw(String name, int uid) throws RemoteException {
                 Parcel _data = Parcel.obtain();
                 Parcel _reply = Parcel.obtain();
                 String[] _result;
                 try {
                     _data.writeInterfaceToken(DESCRIPTOR);
                     _data.writeString(name);
+                    _data.writeInt(uid);
                     mRemote.transact(Stub.TRANSACTION_saw, _data, _reply, 0);
                     _reply.readException();
                     int size = _reply.readInt();
@@ -235,13 +239,14 @@
                 return _result;
             }
 
-            public int generate(String name) throws RemoteException {
+            public int generate(String name, int uid) throws RemoteException {
                 Parcel _data = Parcel.obtain();
                 Parcel _reply = Parcel.obtain();
                 int _result;
                 try {
                     _data.writeInterfaceToken(DESCRIPTOR);
                     _data.writeString(name);
+                    _data.writeInt(uid);
                     mRemote.transact(Stub.TRANSACTION_generate, _data, _reply, 0);
                     _reply.readException();
                     _result = _reply.readInt();
@@ -252,7 +257,7 @@
                 return _result;
             }
 
-            public int import_key(String name, byte[] data) throws RemoteException {
+            public int import_key(String name, byte[] data, int uid) throws RemoteException {
                 Parcel _data = Parcel.obtain();
                 Parcel _reply = Parcel.obtain();
                 int _result;
@@ -260,6 +265,7 @@
                     _data.writeInterfaceToken(DESCRIPTOR);
                     _data.writeString(name);
                     _data.writeByteArray(data);
+                    _data.writeInt(uid);
                     mRemote.transact(Stub.TRANSACTION_import, _data, _reply, 0);
                     _reply.readException();
                     _result = _reply.readInt();
@@ -324,13 +330,14 @@
                 return _result;
             }
 
-            public int del_key(String name) throws RemoteException {
+            public int del_key(String name, int uid) throws RemoteException {
                 Parcel _data = Parcel.obtain();
                 Parcel _reply = Parcel.obtain();
                 int _result;
                 try {
                     _data.writeInterfaceToken(DESCRIPTOR);
                     _data.writeString(name);
+                    _data.writeInt(uid);
                     mRemote.transact(Stub.TRANSACTION_del_key, _data, _reply, 0);
                     _reply.readException();
                     _result = _reply.readInt();
@@ -467,13 +474,13 @@
 
     public byte[] get(String name) throws RemoteException;
 
-    public int insert(String name, byte[] item) throws RemoteException;
+    public int insert(String name, byte[] item, int uid) throws RemoteException;
 
-    public int del(String name) throws RemoteException;
+    public int del(String name, int uid) throws RemoteException;
 
-    public int exist(String name) throws RemoteException;
+    public int exist(String name, int uid) throws RemoteException;
 
-    public String[] saw(String name) throws RemoteException;
+    public String[] saw(String name, int uid) throws RemoteException;
 
     public int reset() throws RemoteException;
 
@@ -485,9 +492,9 @@
 
     public int zero() throws RemoteException;
 
-    public int generate(String name) throws RemoteException;
+    public int generate(String name, int uid) throws RemoteException;
 
-    public int import_key(String name, byte[] data) throws RemoteException;
+    public int import_key(String name, byte[] data, int uid) throws RemoteException;
 
     public byte[] sign(String name, byte[] data) throws RemoteException;
 
@@ -495,7 +502,7 @@
 
     public byte[] get_pubkey(String name) throws RemoteException;
 
-    public int del_key(String name) throws RemoteException;
+    public int del_key(String name, int uid) throws RemoteException;
 
     public int grant(String name, int granteeUid) throws RemoteException;
 
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java
index 31c38d5..d7119fff 100644
--- a/keystore/java/android/security/KeyChain.java
+++ b/keystore/java/android/security/KeyChain.java
@@ -336,7 +336,12 @@
         KeyChainConnection keyChainConnection = bind(context);
         try {
             IKeyChainService keyChainService = keyChainConnection.getService();
-            byte[] certificateBytes = keyChainService.getCertificate(alias);
+
+            final byte[] certificateBytes = keyChainService.getCertificate(alias);
+            if (certificateBytes == null) {
+                return null;
+            }
+
             TrustedCertificateStore store = new TrustedCertificateStore();
             List<X509Certificate> chain = store
                     .getCertificateChain(toCertificate(certificateBytes));
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index ceaff37..9dd2b0d 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -85,7 +85,7 @@
 
     public boolean put(String key, byte[] value) {
         try {
-            return mBinder.insert(key, value) == NO_ERROR;
+            return mBinder.insert(key, value, -1) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -94,7 +94,7 @@
 
     public boolean delete(String key) {
         try {
-            return mBinder.del(key) == NO_ERROR;
+            return mBinder.del(key, -1) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -103,7 +103,7 @@
 
     public boolean contains(String key) {
         try {
-            return mBinder.exist(key) == NO_ERROR;
+            return mBinder.exist(key, -1) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -112,7 +112,7 @@
 
     public String[] saw(String prefix) {
         try {
-            return mBinder.saw(prefix);
+            return mBinder.saw(prefix, -1);
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return null;
@@ -167,7 +167,7 @@
 
     public boolean generate(String key) {
         try {
-            return mBinder.generate(key) == NO_ERROR;
+            return mBinder.generate(key, -1) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -176,7 +176,7 @@
 
     public boolean importKey(String keyName, byte[] key) {
         try {
-            return mBinder.import_key(keyName, key) == NO_ERROR;
+            return mBinder.import_key(keyName, key, -1) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -194,7 +194,7 @@
 
     public boolean delKey(String key) {
         try {
-            return mBinder.del_key(key) == NO_ERROR;
+            return mBinder.del_key(key, -1) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
diff --git a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java
index 198bb74..8979fc2 100644
--- a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java
+++ b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java
@@ -21,15 +21,11 @@
 import android.media.MediaPlayer;
 import android.media.MediaPlayer.OnCompletionListener;
 import android.net.Uri;
-import android.os.Handler;
 import android.os.Looper;
-import android.os.Message;
 import android.os.PowerManager;
 import android.os.SystemClock;
 import android.util.Log;
 
-import java.io.IOException;
-import java.lang.IllegalStateException;
 import java.lang.Thread;
 import java.util.LinkedList;