diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java index 8240ce764..91dd56640 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java @@ -251,6 +251,20 @@ public class AndroidDeviceUtils { } } AndroidAPIUtils.getDeviceManagementService().updateOperation(deviceIdentifier, operation); + // This has to be bellow other if blocks, since updateOperation would fail if we execute against a disenrolled + // device. + if (!Operation.Status.ERROR.equals(operation.getStatus()) && AndroidConstants. + OperationCodes.WIPE_DATA.equals(operation.getCode())) { + if (log.isDebugEnabled()) { + log.debug("Received wipe data from device '" + deviceId + "'"); + } + try { + AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); + } catch (DeviceManagementException e) { + throw new OperationManagementException("Error occurred while unenrolling the device.", e); + } + + } } public static List extends Operation> getPendingOperations diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs index b814fc2a7..b191408c2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -20,12 +20,12 @@ data-deviceinfoservice="{{device.deviceInfoServiceAPI}}" data-devicelocationservice="{{device.deviceLocationServiceAPI}}"> {{device.owner}}'s {{device.name}} - - - + {{#if device.model}}