Merge branch 'master' into 'master'

Fix application update issue

See merge request entgra/carbon-device-mgt-plugins!28
revert-dabc3590
Charitha Goonetilleke 6 years ago
commit ab309f4485

@ -252,6 +252,9 @@ public class AndroidDeviceUtils {
throws ApplicationManagementException { throws ApplicationManagementException {
// Parsing json string to get applications list. // Parsing json string to get applications list.
if (operation.getOperationResponse() != null) { if (operation.getOperationResponse() != null) {
if (operation.getOperationResponse().equals("SAME_APPLICATION_LIST")) {
return;
}
JsonElement jsonElement = new JsonParser().parse(operation.getOperationResponse()); JsonElement jsonElement = new JsonParser().parse(operation.getOperationResponse());
JsonArray jsonArray = jsonElement.getAsJsonArray(); JsonArray jsonArray = jsonElement.getAsJsonArray();
Application app; Application app;
@ -323,9 +326,17 @@ public class AndroidDeviceUtils {
deviceInfo.getDeviceDetailsMap().put("IOW", getProperty(prop.getValue(), "IOW")); deviceInfo.getDeviceDetailsMap().put("IOW", getProperty(prop.getValue(), "IOW"));
deviceInfo.getDeviceDetailsMap().put("IRQ", getProperty(prop.getValue(), "IRQ")); deviceInfo.getDeviceDetailsMap().put("IRQ", getProperty(prop.getValue(), "IRQ"));
} else if (prop.getName().equalsIgnoreCase("RAM_INFO")) { } else if (prop.getName().equalsIgnoreCase("RAM_INFO")) {
deviceInfo.setTotalRAMMemory(Double.parseDouble(getProperty(prop.getValue(), "TOTAL_MEMORY"))); if (!getProperty(prop.getValue(), "TOTAL_MEMORY").isEmpty()) {
deviceInfo.setAvailableRAMMemory(Double.parseDouble( deviceInfo.setTotalRAMMemory(Double.parseDouble(getProperty(prop.getValue(), "TOTAL_MEMORY")));
getProperty(prop.getValue(), "AVAILABLE_MEMORY"))); } else {
deviceInfo.setTotalRAMMemory(-1D);
}
if (!getProperty(prop.getValue(), "AVAILABLE_MEMORY").isEmpty()) {
deviceInfo.setAvailableRAMMemory(Double.parseDouble(
getProperty(prop.getValue(), "AVAILABLE_MEMORY")));
} else {
deviceInfo.setAvailableRAMMemory(-1D);
}
deviceInfo.getDeviceDetailsMap().put("ramThreshold", getProperty(prop.getValue(), "THRESHOLD")); deviceInfo.getDeviceDetailsMap().put("ramThreshold", getProperty(prop.getValue(), "THRESHOLD"));
deviceInfo.getDeviceDetailsMap().put("ramLowMemory", getProperty(prop.getValue(), "LOW_MEMORY")); deviceInfo.getDeviceDetailsMap().put("ramLowMemory", getProperty(prop.getValue(), "LOW_MEMORY"));
} else if (prop.getName().equalsIgnoreCase("BATTERY_INFO")) { } else if (prop.getName().equalsIgnoreCase("BATTERY_INFO")) {
@ -352,16 +363,36 @@ public class AndroidDeviceUtils {
deviceInfo.getDeviceDetailsMap().put("wifiSignalStrength", deviceInfo.getDeviceDetailsMap().put("wifiSignalStrength",
getProperty(prop.getValue(), "WIFI_SIGNAL_STRENGTH")); getProperty(prop.getValue(), "WIFI_SIGNAL_STRENGTH"));
} else if (prop.getName().equalsIgnoreCase("DEVICE_INFO")) { } else if (prop.getName().equalsIgnoreCase("DEVICE_INFO")) {
deviceInfo.setBatteryLevel(Double.parseDouble( if (!getProperty(prop.getValue(), "BATTERY_LEVEL").isEmpty()) {
getProperty(prop.getValue(), "BATTERY_LEVEL"))); deviceInfo.setBatteryLevel(Double.parseDouble(
deviceInfo.setInternalTotalMemory(Double.parseDouble( getProperty(prop.getValue(), "BATTERY_LEVEL")));
getProperty(prop.getValue(), "INTERNAL_TOTAL_MEMORY"))); } else {
deviceInfo.setInternalAvailableMemory(Double.parseDouble( deviceInfo.setBatteryLevel(-1D);
getProperty(prop.getValue(), "INTERNAL_AVAILABLE_MEMORY"))); }
deviceInfo.setExternalTotalMemory(Double.parseDouble( if (!getProperty(prop.getValue(), "INTERNAL_TOTAL_MEMORY").isEmpty()) {
getProperty(prop.getValue(), "EXTERNAL_TOTAL_MEMORY"))); deviceInfo.setInternalTotalMemory(Double.parseDouble(
deviceInfo.setExternalAvailableMemory(Double.parseDouble( getProperty(prop.getValue(), "INTERNAL_TOTAL_MEMORY")));
getProperty(prop.getValue(), "EXTERNAL_AVAILABLE_MEMORY"))); } else {
deviceInfo.setInternalTotalMemory(-1D);
}
if (!getProperty(prop.getValue(), "INTERNAL_AVAILABLE_MEMORY").isEmpty()) {
deviceInfo.setInternalAvailableMemory(Double.parseDouble(
getProperty(prop.getValue(), "INTERNAL_AVAILABLE_MEMORY")));
} else {
deviceInfo.setInternalAvailableMemory(-1D);
}
if (!getProperty(prop.getValue(), "EXTERNAL_TOTAL_MEMORY").isEmpty()) {
deviceInfo.setExternalTotalMemory(Double.parseDouble(
getProperty(prop.getValue(), "EXTERNAL_TOTAL_MEMORY")));
} else {
deviceInfo.setExternalTotalMemory(-1D);
}
if (!getProperty(prop.getValue(), "EXTERNAL_AVAILABLE_MEMORY").isEmpty()) {
deviceInfo.setExternalAvailableMemory(Double.parseDouble(
getProperty(prop.getValue(), "EXTERNAL_AVAILABLE_MEMORY")));
} else {
deviceInfo.setExternalAvailableMemory(-1D);
}
deviceInfo.getDeviceDetailsMap().put("encryptionEnabled", deviceInfo.getDeviceDetailsMap().put("encryptionEnabled",
getProperty(prop.getValue(), "ENCRYPTION_ENABLED")); getProperty(prop.getValue(), "ENCRYPTION_ENABLED"));

@ -223,6 +223,9 @@ public class AndroidDeviceUtils {
throws ApplicationManagementException { throws ApplicationManagementException {
// Parsing json string to get applications list. // Parsing json string to get applications list.
if (operation.getOperationResponse() != null) { if (operation.getOperationResponse() != null) {
if (operation.getOperationResponse().equals("SAME_APPLICATION_LIST")) {
return;
}
JsonElement jsonElement = new JsonParser().parse(operation.getOperationResponse()); JsonElement jsonElement = new JsonParser().parse(operation.getOperationResponse());
JsonArray jsonArray = jsonElement.getAsJsonArray(); JsonArray jsonArray = jsonElement.getAsJsonArray();
Application app; Application app;
@ -294,9 +297,17 @@ public class AndroidDeviceUtils {
deviceInfo.getDeviceDetailsMap().put("IOW", getProperty(prop.getValue(), "IOW")); deviceInfo.getDeviceDetailsMap().put("IOW", getProperty(prop.getValue(), "IOW"));
deviceInfo.getDeviceDetailsMap().put("IRQ", getProperty(prop.getValue(), "IRQ")); deviceInfo.getDeviceDetailsMap().put("IRQ", getProperty(prop.getValue(), "IRQ"));
} else if (prop.getName().equalsIgnoreCase("RAM_INFO")) { } else if (prop.getName().equalsIgnoreCase("RAM_INFO")) {
deviceInfo.setTotalRAMMemory(Double.parseDouble(getProperty(prop.getValue(), "TOTAL_MEMORY"))); if (!getProperty(prop.getValue(), "TOTAL_MEMORY").isEmpty()) {
deviceInfo.setAvailableRAMMemory(Double.parseDouble( deviceInfo.setTotalRAMMemory(Double.parseDouble(getProperty(prop.getValue(), "TOTAL_MEMORY")));
getProperty(prop.getValue(), "AVAILABLE_MEMORY"))); } else {
deviceInfo.setTotalRAMMemory(-1D);
}
if (!getProperty(prop.getValue(), "AVAILABLE_MEMORY").isEmpty()) {
deviceInfo.setAvailableRAMMemory(Double.parseDouble(
getProperty(prop.getValue(), "AVAILABLE_MEMORY")));
} else {
deviceInfo.setAvailableRAMMemory(-1D);
}
deviceInfo.getDeviceDetailsMap().put("ramThreshold", getProperty(prop.getValue(), "THRESHOLD")); deviceInfo.getDeviceDetailsMap().put("ramThreshold", getProperty(prop.getValue(), "THRESHOLD"));
deviceInfo.getDeviceDetailsMap().put("ramLowMemory", getProperty(prop.getValue(), "LOW_MEMORY")); deviceInfo.getDeviceDetailsMap().put("ramLowMemory", getProperty(prop.getValue(), "LOW_MEMORY"));
} else if (prop.getName().equalsIgnoreCase("BATTERY_INFO")) { } else if (prop.getName().equalsIgnoreCase("BATTERY_INFO")) {
@ -323,25 +334,44 @@ public class AndroidDeviceUtils {
deviceInfo.getDeviceDetailsMap().put("wifiSignalStrength", deviceInfo.getDeviceDetailsMap().put("wifiSignalStrength",
getProperty(prop.getValue(), "WIFI_SIGNAL_STRENGTH")); getProperty(prop.getValue(), "WIFI_SIGNAL_STRENGTH"));
} else if (prop.getName().equalsIgnoreCase("DEVICE_INFO")) { } else if (prop.getName().equalsIgnoreCase("DEVICE_INFO")) {
deviceInfo.setBatteryLevel(Double.parseDouble( if (!getProperty(prop.getValue(), "BATTERY_LEVEL").isEmpty()) {
getProperty(prop.getValue(), "BATTERY_LEVEL"))); deviceInfo.setBatteryLevel(Double.parseDouble(
deviceInfo.setInternalTotalMemory(Double.parseDouble( getProperty(prop.getValue(), "BATTERY_LEVEL")));
getProperty(prop.getValue(), "INTERNAL_TOTAL_MEMORY"))); } else {
deviceInfo.setInternalAvailableMemory(Double.parseDouble( deviceInfo.setBatteryLevel(-1D);
getProperty(prop.getValue(), "INTERNAL_AVAILABLE_MEMORY"))); }
deviceInfo.setExternalTotalMemory(Double.parseDouble( if (!getProperty(prop.getValue(), "INTERNAL_TOTAL_MEMORY").isEmpty()) {
getProperty(prop.getValue(), "EXTERNAL_TOTAL_MEMORY"))); deviceInfo.setInternalTotalMemory(Double.parseDouble(
deviceInfo.setExternalAvailableMemory(Double.parseDouble( getProperty(prop.getValue(), "INTERNAL_TOTAL_MEMORY")));
getProperty(prop.getValue(), "EXTERNAL_AVAILABLE_MEMORY"))); } else {
deviceInfo.setInternalTotalMemory(-1D);
}
if (!getProperty(prop.getValue(), "INTERNAL_AVAILABLE_MEMORY").isEmpty()) {
deviceInfo.setInternalAvailableMemory(Double.parseDouble(
getProperty(prop.getValue(), "INTERNAL_AVAILABLE_MEMORY")));
} else {
deviceInfo.setInternalAvailableMemory(-1D);
}
if (!getProperty(prop.getValue(), "EXTERNAL_TOTAL_MEMORY").isEmpty()) {
deviceInfo.setExternalTotalMemory(Double.parseDouble(
getProperty(prop.getValue(), "EXTERNAL_TOTAL_MEMORY")));
} else {
deviceInfo.setExternalTotalMemory(-1D);
}
if (!getProperty(prop.getValue(), "EXTERNAL_AVAILABLE_MEMORY").isEmpty()) {
deviceInfo.setExternalAvailableMemory(Double.parseDouble(
getProperty(prop.getValue(), "EXTERNAL_AVAILABLE_MEMORY")));
} else {
deviceInfo.setExternalAvailableMemory(-1D);
}
deviceInfo.getDeviceDetailsMap().put("encryptionEnabled", deviceInfo.getDeviceDetailsMap().put("encryptionEnabled",
getProperty(prop.getValue(), "ENCRYPTION_ENABLED")); getProperty(prop.getValue(), "ENCRYPTION_ENABLED"));
deviceInfo.getDeviceDetailsMap().put("passcodeEnabled", deviceInfo.getDeviceDetailsMap().put("passcodeEnabled",
getProperty(prop.getValue(), "PASSCODE_ENABLED")); getProperty(prop.getValue(), "PASSCODE_ENABLED"));
deviceInfo.getDeviceDetailsMap().put("operator", deviceInfo.getDeviceDetailsMap().put("operator",
getProperty(prop.getValue(), "OPERATOR")); getProperty(prop.getValue(), "OPERATOR"));
deviceInfo.getDeviceDetailsMap().put("PhoneNumber", deviceInfo.getDeviceDetailsMap().put("PhoneNumber",
getProperty(prop.getValue(), "PHONE_NUMBER")); getProperty(prop.getValue(), "PHONE_NUMBER"));
} else if (prop.getName().equalsIgnoreCase("IMEI")) { } else if (prop.getName().equalsIgnoreCase("IMEI")) {
deviceInfo.getDeviceDetailsMap().put("IMEI", prop.getValue()); deviceInfo.getDeviceDetailsMap().put("IMEI", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("IMSI")) { } else if (prop.getName().equalsIgnoreCase("IMSI")) {

Loading…
Cancel
Save