diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 97c04c0d6a0..bf09bd367cc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -185,14 +185,6 @@ public class OperationManagerImpl implements OperationManager { String deviceType) { List activityStatuses = new ArrayList<>(); ActivityStatus activityStatus; - //Add the valid DeviceIds - for (DeviceIdentifier id : deviceIdValidationResult.getValidDeviceIDList()) { - activityStatus = new ActivityStatus(); - activityStatus.setDeviceIdentifier(id); - activityStatus.setStatus(ActivityStatus.Status.PENDING); - activityStatuses.add(activityStatus); - } - //Add the invalid DeviceIds for (String id : deviceIdValidationResult.getErrorDeviceIdList()) { activityStatus = new ActivityStatus(); @@ -208,6 +200,14 @@ public class OperationManagerImpl implements OperationManager { activityStatus.setStatus(ActivityStatus.Status.UNAUTHORIZED); activityStatuses.add(activityStatus); } + + //Add the authorized DeviceIds + for (DeviceIdentifier id : deviceAuthResult.getValidDeviceIDList()) { + activityStatus = new ActivityStatus(); + activityStatus.setDeviceIdentifier(id); + activityStatus.setStatus(ActivityStatus.Status.PENDING); + activityStatuses.add(activityStatus); + } return activityStatuses; }