summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy/java
diff options
context:
space:
mode:
authorFyodor Kupolov <fkupolov@google.com>2014-12-05 19:28:11 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-05 19:28:12 +0000
commit22afe6261aab343070b63c60a1f4c7ce6f4383f9 (patch)
treeac755acdef355d37bd70db32d974f1a2ad29e363 /services/devicepolicy/java
parent43606641f6a2b7f31b289da4548231306f4e5156 (diff)
parent96fb932666539e2b3be26ef91eb248a9ace5678e (diff)
downloadframeworks_base-22afe6261aab343070b63c60a1f4c7ce6f4383f9.zip
frameworks_base-22afe6261aab343070b63c60a1f4c7ce6f4383f9.tar.gz
frameworks_base-22afe6261aab343070b63c60a1f4c7ce6f4383f9.tar.bz2
Merge "Added isRemovingAdmin method" into lmp-mr1-dev
Diffstat (limited to 'services/devicepolicy/java')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index cd3c65c..72a3337 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -120,7 +120,6 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
-import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
@@ -265,6 +264,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
= new HashMap<ComponentName, ActiveAdmin>();
final ArrayList<ActiveAdmin> mAdminList
= new ArrayList<ActiveAdmin>();
+ final ArrayList<ComponentName> mRemovingAdmins
+ = new ArrayList<ComponentName>();
// This is the list of component allowed to start lock task mode.
final List<String> mLockTaskPackages = new ArrayList<String>();
@@ -1212,6 +1213,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
void removeActiveAdminLocked(final ComponentName adminReceiver, int userHandle) {
final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver, userHandle);
if (admin != null) {
+ synchronized (this) {
+ getUserData(userHandle).mRemovingAdmins.add(adminReceiver);
+ }
sendAdminCommandLocked(admin,
DeviceAdminReceiver.ACTION_DEVICE_ADMIN_DISABLED,
new BroadcastReceiver() {
@@ -1231,9 +1235,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
saveSettingsLocked(userHandle);
updateMaximumTimeToLockLocked(policy);
+ policy.mRemovingAdmins.remove(adminReceiver);
}
}
- });
+ });
}
}
@@ -1798,6 +1803,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
}
+ @Override
+ public boolean isRemovingAdmin(ComponentName adminReceiver, int userHandle) {
+ if (!mHasFeature) {
+ return false;
+ }
+ enforceCrossUserPermission(userHandle);
+ synchronized (this) {
+ DevicePolicyData policyData = getUserData(userHandle);
+ return policyData.mRemovingAdmins.contains(adminReceiver);
+ }
+ }
+
public boolean hasGrantedPolicy(ComponentName adminReceiver, int policyId, int userHandle) {
if (!mHasFeature) {
return false;
@@ -4101,6 +4118,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
ap.dump(" ", pw);
}
}
+ if (!policy.mRemovingAdmins.isEmpty()) {
+ p.println(" Removing Device Admins (User " + policy.mUserHandle + "): "
+ + policy.mRemovingAdmins);
+ }
pw.println(" ");
pw.print(" mPasswordOwner="); pw.println(policy.mPasswordOwner);