|
|
|
@ -62,14 +62,16 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
|
|
|
|
return complianceData;
|
|
|
|
|
}
|
|
|
|
|
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
|
|
|
|
|
|
|
|
|
|
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
|
|
|
|
|
String compliancePayloadString = new Gson().toJson(compliancePayload);
|
|
|
|
|
// Parsing json string to get compliance features.
|
|
|
|
|
JsonElement jsonElement;
|
|
|
|
|
if (compliancePayload instanceof String) {
|
|
|
|
|
jsonElement = new JsonParser().parse((String) compliancePayload);
|
|
|
|
|
if (compliancePayloadString instanceof String) {
|
|
|
|
|
jsonElement = new JsonParser().parse(compliancePayloadString);
|
|
|
|
|
} else {
|
|
|
|
|
throw new PolicyComplianceException("Invalid policy compliance payload");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
ComplianceFeature complianceFeature;
|
|
|
|
@ -79,14 +81,15 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
|
|
|
|
complianceFeatures.add(complianceFeature);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
complianceData.setComplianceFeatures(complianceFeatures);
|
|
|
|
|
|
|
|
|
|
for (ComplianceFeature cf : complianceFeatures) {
|
|
|
|
|
if (!cf.isCompliant()) {
|
|
|
|
|
complianceData.setStatus(false);
|
|
|
|
|
nonComplianceFeatures.add(cf);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
complianceData.setComplianceFeatures(nonComplianceFeatures);
|
|
|
|
|
return complianceData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|