Fix device administrator "add" logic
Due to a missing "else" the logic to activate a device administrator was immediately falling through into the logic to remove it. As a result, the add was immediately countermanded by a remove.
This commit is contained in:
@@ -140,24 +140,25 @@ public class DeviceAdminAdd extends Activity {
|
|||||||
mDPM.setActiveAdmin(mDeviceAdmin.getComponent());
|
mDPM.setActiveAdmin(mDeviceAdmin.getComponent());
|
||||||
setResult(Activity.RESULT_OK);
|
setResult(Activity.RESULT_OK);
|
||||||
finish();
|
finish();
|
||||||
}
|
} else {
|
||||||
mDPM.getRemoveWarning(mDeviceAdmin.getComponent(),
|
mDPM.getRemoveWarning(mDeviceAdmin.getComponent(),
|
||||||
new RemoteCallback(mHandler) {
|
new RemoteCallback(mHandler) {
|
||||||
@Override
|
@Override
|
||||||
protected void onResult(Bundle bundle) {
|
protected void onResult(Bundle bundle) {
|
||||||
CharSequence msg = bundle != null
|
CharSequence msg = bundle != null
|
||||||
? bundle.getCharSequence(DeviceAdmin.EXTRA_DISABLE_WARNING)
|
? bundle.getCharSequence(DeviceAdmin.EXTRA_DISABLE_WARNING)
|
||||||
: null;
|
: null;
|
||||||
if (msg == null) {
|
if (msg == null) {
|
||||||
mDPM.removeActiveAdmin(mDeviceAdmin.getComponent());
|
mDPM.removeActiveAdmin(mDeviceAdmin.getComponent());
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putCharSequence(DeviceAdmin.EXTRA_DISABLE_WARNING, msg);
|
args.putCharSequence(DeviceAdmin.EXTRA_DISABLE_WARNING, msg);
|
||||||
showDialog(DIALOG_WARNING, args);
|
showDialog(DIALOG_WARNING, args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user