am 22afe626: Merge "Added isRemovingAdmin method" into lmp-mr1-dev
* commit '22afe6261aab343070b63c60a1f4c7ce6f4383f9': Added isRemovingAdmin method
This commit is contained in:
@@ -504,6 +504,22 @@ public class DevicePolicyManager {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return true if the given administrator component is currently being removed
|
||||||
|
* for the user.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isRemovingAdmin(ComponentName who, int userId) {
|
||||||
|
if (mService != null) {
|
||||||
|
try {
|
||||||
|
return mService.isRemovingAdmin(who, userId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.w(TAG, "Failed talking with device policy service", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of all currently active device administrator's component
|
* Return a list of all currently active device administrator's component
|
||||||
|
|||||||
@@ -196,4 +196,6 @@ interface IDevicePolicyManager {
|
|||||||
|
|
||||||
void setAutoTimeRequired(in ComponentName who, int userHandle, boolean required);
|
void setAutoTimeRequired(in ComponentName who, int userHandle, boolean required);
|
||||||
boolean getAutoTimeRequired();
|
boolean getAutoTimeRequired();
|
||||||
|
|
||||||
|
boolean isRemovingAdmin(in ComponentName adminReceiver, int userHandle);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.security.cert.CertificateEncodingException;
|
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.security.cert.CertificateFactory;
|
import java.security.cert.CertificateFactory;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
@@ -265,6 +264,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
= new HashMap<ComponentName, ActiveAdmin>();
|
= new HashMap<ComponentName, ActiveAdmin>();
|
||||||
final ArrayList<ActiveAdmin> mAdminList
|
final ArrayList<ActiveAdmin> mAdminList
|
||||||
= new ArrayList<ActiveAdmin>();
|
= new ArrayList<ActiveAdmin>();
|
||||||
|
final ArrayList<ComponentName> mRemovingAdmins
|
||||||
|
= new ArrayList<ComponentName>();
|
||||||
|
|
||||||
// This is the list of component allowed to start lock task mode.
|
// This is the list of component allowed to start lock task mode.
|
||||||
final List<String> mLockTaskPackages = new ArrayList<String>();
|
final List<String> mLockTaskPackages = new ArrayList<String>();
|
||||||
@@ -1212,6 +1213,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
void removeActiveAdminLocked(final ComponentName adminReceiver, int userHandle) {
|
void removeActiveAdminLocked(final ComponentName adminReceiver, int userHandle) {
|
||||||
final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver, userHandle);
|
final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver, userHandle);
|
||||||
if (admin != null) {
|
if (admin != null) {
|
||||||
|
synchronized (this) {
|
||||||
|
getUserData(userHandle).mRemovingAdmins.add(adminReceiver);
|
||||||
|
}
|
||||||
sendAdminCommandLocked(admin,
|
sendAdminCommandLocked(admin,
|
||||||
DeviceAdminReceiver.ACTION_DEVICE_ADMIN_DISABLED,
|
DeviceAdminReceiver.ACTION_DEVICE_ADMIN_DISABLED,
|
||||||
new BroadcastReceiver() {
|
new BroadcastReceiver() {
|
||||||
@@ -1231,6 +1235,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
}
|
}
|
||||||
saveSettingsLocked(userHandle);
|
saveSettingsLocked(userHandle);
|
||||||
updateMaximumTimeToLockLocked(policy);
|
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) {
|
public boolean hasGrantedPolicy(ComponentName adminReceiver, int policyId, int userHandle) {
|
||||||
if (!mHasFeature) {
|
if (!mHasFeature) {
|
||||||
return false;
|
return false;
|
||||||
@@ -4101,6 +4118,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
ap.dump(" ", pw);
|
ap.dump(" ", pw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!policy.mRemovingAdmins.isEmpty()) {
|
||||||
|
p.println(" Removing Device Admins (User " + policy.mUserHandle + "): "
|
||||||
|
+ policy.mRemovingAdmins);
|
||||||
|
}
|
||||||
|
|
||||||
pw.println(" ");
|
pw.println(" ");
|
||||||
pw.print(" mPasswordOwner="); pw.println(policy.mPasswordOwner);
|
pw.print(" mPasswordOwner="); pw.println(policy.mPasswordOwner);
|
||||||
|
|||||||
Reference in New Issue
Block a user