Policy: make bulk CA uninstalls happen in service
Fewer round trips, only one point of contact for bugs to creep in.
Bug: 21650477
Change-Id: I1764faa753bd674ecb0d13149d778d99bd2ff4c4
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 3ab0e01..bf44746 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -2275,7 +2275,7 @@
if (mService != null) {
try {
final String alias = getCaCertAlias(certBuffer);
- mService.uninstallCaCert(admin, alias);
+ mService.uninstallCaCerts(admin, new String[] {alias});
} catch (CertificateException e) {
Log.w(TAG, "Unable to parse certificate", e);
} catch (RemoteException e) {
@@ -2322,12 +2322,11 @@
*/
public void uninstallAllUserCaCerts(@Nullable ComponentName admin) {
if (mService != null) {
- for (String alias : new TrustedCertificateStore().userAliases()) {
- try {
- mService.uninstallCaCert(admin, alias);
- } catch (RemoteException re) {
- Log.w(TAG, "Failed talking with device policy service", re);
- }
+ try {
+ mService.uninstallCaCerts(admin, new TrustedCertificateStore().userAliases()
+ .toArray(new String[0]));
+ } catch (RemoteException re) {
+ Log.w(TAG, "Failed talking with device policy service", re);
}
}
}