Dileesha Rajapakse 9 years ago
commit 4fc895588b

@ -335,7 +335,7 @@ public class AndroidDeviceManager implements DeviceManager {
List<MobileDevice> mobileDevices = List<MobileDevice> mobileDevices =
daoFactory.getMobileDeviceDAO().getAllMobileDevices(); daoFactory.getMobileDeviceDAO().getAllMobileDevices();
if (mobileDevices != null) { if (mobileDevices != null) {
devices = new ArrayList<>(); devices = new ArrayList<>(mobileDevices.size());
for (MobileDevice mobileDevice : mobileDevices) { for (MobileDevice mobileDevice : mobileDevices) {
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice)); devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice));
} }

@ -64,7 +64,7 @@ public class AndroidFeatureManager implements FeatureManager {
@Override @Override
public boolean addFeatures(List<Feature> features) throws DeviceManagementException { public boolean addFeatures(List<Feature> features) throws DeviceManagementException {
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>(); List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>(features.size());
for (Feature feature : features) { for (Feature feature : features) {
mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature)); mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature));
} }
@ -96,9 +96,9 @@ public class AndroidFeatureManager implements FeatureManager {
@Override @Override
public List<Feature> getFeatures() throws DeviceManagementException { public List<Feature> getFeatures() throws DeviceManagementException {
List<Feature> featureList = new ArrayList<Feature>();
try { try {
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures(); List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
List<Feature> featureList = new ArrayList<Feature>(mobileFeatures.size());
for (MobileFeature mobileFeature : mobileFeatures) { for (MobileFeature mobileFeature : mobileFeatures) {
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature)); featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
} }

@ -61,8 +61,6 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
if (compliancePayload == null || policy == null) { if (compliancePayload == null || policy == null) {
return complianceData; return complianceData;
} }
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
String compliancePayloadString = new Gson().toJson(compliancePayload); String compliancePayloadString = new Gson().toJson(compliancePayload);
// Parsing json string to get compliance features. // Parsing json string to get compliance features.
JsonElement jsonElement; JsonElement jsonElement;
@ -75,6 +73,8 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
JsonArray jsonArray = jsonElement.getAsJsonArray(); JsonArray jsonArray = jsonElement.getAsJsonArray();
Gson gson = new Gson(); Gson gson = new Gson();
ComplianceFeature complianceFeature; ComplianceFeature complianceFeature;
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>(jsonArray.size());
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
for (JsonElement element : jsonArray) { for (JsonElement element : jsonArray) {
complianceFeature = gson.fromJson(element, ComplianceFeature.class); complianceFeature = gson.fromJson(element, ComplianceFeature.class);

@ -43,7 +43,7 @@ public class GCMService {
} }
public void sendNotification(String messageData, Device device) { public void sendNotification(String messageData, Device device) {
List<Device> devices = new ArrayList<>(); List<Device> devices = new ArrayList<>(1);
devices.add(device); devices.add(device);
GCMResult result = GCMUtil.sendWakeUpCall(messageData, devices); GCMResult result = GCMUtil.sendWakeUpCall(messageData, devices);
if (result.getStatusCode() != 200) { if (result.getStatusCode() != 200) {

@ -123,6 +123,9 @@ public class GCMUtil {
//Set device reg-ids //Set device reg-ids
JsonArray regIds = new JsonArray(); JsonArray regIds = new JsonArray();
for (String regId : registrationIds) { for (String regId : registrationIds) {
if (regId == null && regId.isEmpty()) {
continue;
}
regIds.add(new JsonPrimitive(regId)); regIds.add(new JsonPrimitive(regId));
} }
@ -131,7 +134,7 @@ public class GCMUtil {
} }
private static List<String> getGCMTokens(List<Device> devices) { private static List<String> getGCMTokens(List<Device> devices) {
List<String> tokens = new ArrayList<>(); List<String> tokens = new ArrayList<>(devices.size());
for (Device device : devices) { for (Device device : devices) {
tokens.add(getGCMToken(device.getProperties())); tokens.add(getGCMToken(device.getProperties()));
} }

@ -193,7 +193,7 @@ public class WindowsDeviceManager implements DeviceManager {
WindowsDAOFactory.openConnection(); WindowsDAOFactory.openConnection();
List<MobileDevice> mobileDevices = daoFactory.getMobileDeviceDAO().getAllMobileDevices(); List<MobileDevice> mobileDevices = daoFactory.getMobileDeviceDAO().getAllMobileDevices();
if (mobileDevices != null) { if (mobileDevices != null) {
devices = new ArrayList<>(); devices = new ArrayList<>(mobileDevices.size());
for (MobileDevice mobileDevice : mobileDevices) { for (MobileDevice mobileDevice : mobileDevices) {
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice)); devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice));
} }

@ -58,7 +58,7 @@ public class WindowsFeatureManager implements FeatureManager {
@Override @Override
public boolean addFeatures(List<Feature> features) throws DeviceManagementException { public boolean addFeatures(List<Feature> features) throws DeviceManagementException {
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>(); List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>(features.size());
for (Feature feature : features) { for (Feature feature : features) {
mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature)); mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature));
} }
@ -92,10 +92,10 @@ public class WindowsFeatureManager implements FeatureManager {
@Override @Override
public List<Feature> getFeatures() throws DeviceManagementException { public List<Feature> getFeatures() throws DeviceManagementException {
List<Feature> featureList = new ArrayList<Feature>();
try { try {
WindowsDAOFactory.openConnection(); WindowsDAOFactory.openConnection();
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures(); List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
List<Feature> featureList = new ArrayList<Feature>(mobileFeatures.size());
for (MobileFeature mobileFeature : mobileFeatures) { for (MobileFeature mobileFeature : mobileFeatures) {
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature)); featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
} }

@ -165,7 +165,7 @@ public class MobileDeviceManagementUtil {
public static List<Integer> getMobileOperationIdsFromMobileDeviceOperations( public static List<Integer> getMobileOperationIdsFromMobileDeviceOperations(
List<MobileDeviceOperationMapping> mobileDeviceOperationMappings) { List<MobileDeviceOperationMapping> mobileDeviceOperationMappings) {
List<Integer> mobileOperationIds = new ArrayList<Integer>(); List<Integer> mobileOperationIds = new ArrayList<Integer>(mobileDeviceOperationMappings.size());
for (MobileDeviceOperationMapping mobileDeviceOperationMapping : mobileDeviceOperationMappings) { for (MobileDeviceOperationMapping mobileDeviceOperationMapping : mobileDeviceOperationMappings) {
mobileOperationIds.add(mobileDeviceOperationMapping.getOperationId()); mobileOperationIds.add(mobileDeviceOperationMapping.getOperationId());
} }

@ -577,7 +577,7 @@
<carbon.deployment.version>4.6.0</carbon.deployment.version> <carbon.deployment.version>4.6.0</carbon.deployment.version>
<!-- Identity --> <!-- Identity -->
<carbon.identity.version>5.0.5</carbon.identity.version> <carbon.identity.version>5.0.7</carbon.identity.version>
<!-- Multi-tenancy --> <!-- Multi-tenancy -->
<carbon.multitenancy.version>4.5.0</carbon.multitenancy.version> <carbon.multitenancy.version>4.5.0</carbon.multitenancy.version>

Loading…
Cancel
Save