Merge "Don\'t allow removing admin to be added again" into nyc-dev
am: 547fc39
* commit '547fc3983edc67a9abf28b628fcb0b9bd0be2415':
Don't allow removing admin to be added again
Change-Id: Ib44dc27ab2be9c0bd8298162cf64776090021d35
This commit is contained in:
@@ -245,6 +245,12 @@ public class DeviceAdminAdd extends Activity {
|
||||
if (DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN.equals(getIntent().getAction())) {
|
||||
mRefreshing = false;
|
||||
if (mDPM.isAdminActive(who)) {
|
||||
if (mDPM.isRemovingAdmin(who, android.os.Process.myUserHandle().getIdentifier())) {
|
||||
Log.w(TAG, "Requested admin is already being removed: " + who);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<DeviceAdminInfo.PolicyInfo> newPolicies = mDeviceAdmin.getUsedPolicies();
|
||||
for (int i = 0; i < newPolicies.size(); i++) {
|
||||
DeviceAdminInfo.PolicyInfo pi = newPolicies.get(i);
|
||||
|
Reference in New Issue
Block a user