summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSelim Gurun <sgurun@google.com>2012-02-14 10:50:42 -0800
committerSelim Gurun <sgurun@google.com>2012-02-16 14:25:55 -0800
commit39e36e58a7fd0a4520af5467719dac73afc205b4 (patch)
tree326a1624f1cd1ab540923ba3f6d6d8f703cc3b7e /src
parent7ce96fdf41ccfe646abc75796804a373f21be97b (diff)
downloadandroid_packages_apps_KeyChain-39e36e58a7fd0a4520af5467719dac73afc205b4.tar.gz
android_packages_apps_KeyChain-39e36e58a7fd0a4520af5467719dac73afc205b4.tar.bz2
android_packages_apps_KeyChain-39e36e58a7fd0a4520af5467719dac73afc205b4.zip
Broadcast credential storage changes.
Bug: 6009802 Cherry pick 0cb57ed171d7898f5f052e86e485771cbcbadcd8 When credential storage changes (adding/deleting a user CA) or reset, send a broadcast intent so user can update any cached credential storage state. Change-Id: I3a3e93a0408e6db281e850268fe688182bfa4aa7
Diffstat (limited to 'src')
-rw-r--r--src/com/android/keychain/KeyChainService.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/android/keychain/KeyChainService.java b/src/com/android/keychain/KeyChainService.java
index 418f575..1ab3ad3 100644
--- a/src/com/android/keychain/KeyChainService.java
+++ b/src/com/android/keychain/KeyChainService.java
@@ -28,6 +28,7 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.os.IBinder;
import android.security.Credentials;
import android.security.IKeyChainService;
+import android.security.KeyChain;
import android.security.KeyStore;
import android.util.Log;
import java.io.ByteArrayInputStream;
@@ -39,6 +40,7 @@ import java.security.cert.X509Certificate;
import org.apache.harmony.xnet.provider.jsse.TrustedCertificateStore;
public class KeyChainService extends IntentService {
+
private static final String TAG = "KeyChain";
private static final String DATABASE_NAME = "grants.db";
@@ -123,6 +125,7 @@ public class KeyChainService extends IntentService {
} catch (CertificateException e) {
throw new IllegalStateException(e);
}
+ broadcastStorageChange();
}
private X509Certificate parseCertificate(byte[] bytes) throws CertificateException {
@@ -144,14 +147,20 @@ public class KeyChainService extends IntentService {
}
}
}
- return ok;
}
+ broadcastStorageChange();
+ return ok;
}
@Override public boolean deleteCaCertificate(String alias) {
// only Settings should be able to delete
checkSystemCaller();
- return deleteCertificateEntry(alias);
+ boolean ok = true;
+ synchronized (mTrustedCertificateStore) {
+ ok = deleteCertificateEntry(alias);
+ }
+ broadcastStorageChange();
+ return ok;
}
private boolean deleteCertificateEntry(String alias) {
@@ -196,6 +205,7 @@ public class KeyChainService extends IntentService {
@Override public void setGrant(int uid, String alias, boolean value) {
checkSystemCaller();
setGrantInternal(mDatabaseHelper.getWritableDatabase(), uid, alias, value);
+ broadcastStorageChange();
}
};
@@ -289,4 +299,10 @@ public class KeyChainService extends IntentService {
db.endTransaction();
}
}
+
+ private void broadcastStorageChange() {
+ Intent intent = new Intent(KeyChain.ACTION_STORAGE_CHANGED);
+ sendBroadcast(intent);
+ }
+
}