diff options
author | Fyodor Kupolov <fkupolov@google.com> | 2014-12-09 00:18:21 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-09 00:18:21 +0000 |
commit | 77779aa3a5eea2d275c82035b025df85b7702f07 (patch) | |
tree | 62addb484a0c2af2c9ef3fa060b41d504ba6b756 /services/devicepolicy/java | |
parent | 0d1f8bf705553cb1ededea3bb63e38a2d8c04f1b (diff) | |
parent | d483a85e69c3bb83b25473b93806e063b72c9315 (diff) | |
download | frameworks_base-77779aa3a5eea2d275c82035b025df85b7702f07.zip frameworks_base-77779aa3a5eea2d275c82035b025df85b7702f07.tar.gz frameworks_base-77779aa3a5eea2d275c82035b025df85b7702f07.tar.bz2 |
am d483a85e: am fed2812d: am 22afe626: Merge "Added isRemovingAdmin method" into lmp-mr1-dev
* commit 'd483a85e69c3bb83b25473b93806e063b72c9315':
Added isRemovingAdmin method
Diffstat (limited to 'services/devicepolicy/java')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 25 |
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 54cca9b..c033a9a 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -121,7 +121,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; @@ -266,6 +265,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>(); @@ -1213,6 +1214,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() { @@ -1232,9 +1236,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } saveSettingsLocked(userHandle); updateMaximumTimeToLockLocked(policy); + policy.mRemovingAdmins.remove(adminReceiver); } } - }); + }); } } @@ -1799,6 +1804,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; @@ -4102,6 +4119,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); |