am 8bbbcd3d: Merge "Policy: make bulk CA uninstalls happen in service" into mnc-dev
* commit '8bbbcd3d5402285b05db64c3ffd3a959f26ad16c': Policy: make bulk CA uninstalls happen in service
This commit is contained in:
@@ -2275,7 +2275,7 @@ public class DevicePolicyManager {
|
||||
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 class DevicePolicyManager {
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ interface IDevicePolicyManager {
|
||||
boolean hasUserSetupCompleted();
|
||||
|
||||
boolean installCaCert(in ComponentName admin, in byte[] certBuffer);
|
||||
void uninstallCaCert(in ComponentName admin, in String alias);
|
||||
void uninstallCaCerts(in ComponentName admin, in String[] aliases);
|
||||
void enforceCanManageCaCerts(in ComponentName admin);
|
||||
|
||||
boolean installKeyPair(in ComponentName who, in byte[] privKeyBuffer, in byte[] certBuffer, String alias);
|
||||
|
||||
@@ -3129,7 +3129,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallCaCert(ComponentName admin, String alias) {
|
||||
public void uninstallCaCerts(ComponentName admin, String[] aliases) {
|
||||
enforceCanManageCaCerts(admin);
|
||||
|
||||
final UserHandle userHandle = new UserHandle(UserHandle.getCallingUserId());
|
||||
@@ -3137,7 +3137,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
try {
|
||||
final KeyChainConnection keyChainConnection = KeyChain.bindAsUser(mContext, userHandle);
|
||||
try {
|
||||
keyChainConnection.getService().deleteCaCertificate(alias);
|
||||
for (int i = 0 ; i < aliases.length; i++) {
|
||||
keyChainConnection.getService().deleteCaCertificate(aliases[i]);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(LOG_TAG, "from CaCertUninstaller: ", e);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user