Refactoring the code

revert-dabc3590
charitha 7 years ago
parent cbd90feb68
commit b48c337d06

@ -167,14 +167,14 @@ public class AndroidDeviceUtils {
if (!Operation.Status.ERROR.equals(operation.getStatus()) &&
AndroidConstants.OperationCodes.MONITOR.equals(operation.getCode())) {
if (log.isDebugEnabled()) {
log.info("Received compliance status from MONITOR operation ID: " + operation.getId());
log.debug("Received compliance status from MONITOR operation ID: " + operation.getId());
}
AndroidAPIUtils.getPolicyManagerService().checkPolicyCompliance(deviceIdentifier,
getComplianceFeatures(operation.getPayLoad()));
} else if (!Operation.Status.ERROR.equals(operation.getStatus()) && AndroidConstants.
OperationCodes.APPLICATION_LIST.equals(operation.getCode())) {
if (log.isDebugEnabled()) {
log.info("Received applications list from device '" + deviceId + "'");
log.debug("Received applications list from device '" + deviceId + "'");
}
updateApplicationList(operation, deviceIdentifier);
@ -192,7 +192,6 @@ public class AndroidDeviceUtils {
throw new OperationManagementException("Error occurred while updating the device information.", e);
}
} else if (!Operation.Status.ERROR.equals(operation.getStatus()) &&
AndroidConstants.OperationCodes.DEVICE_LOCATION.equals(operation.getCode())) {
try {
@ -247,7 +246,9 @@ public class AndroidDeviceUtils {
}
AndroidAPIUtils.getApplicationManagerService().updateApplicationListInstalledInDevice(deviceIdentifier, applications);
} else {
log.error("Operation Response is null.");
if (log.isDebugEnabled()) {
log.debug("Operation Response is null.");
}
}
}
@ -277,48 +278,31 @@ public class AndroidDeviceUtils {
for (Device.Property prop : props) {
if (Utils.getDeviceDetailsColumnNames().containsValue(prop.getName())) {
if (prop.getName().equalsIgnoreCase("DEVICE_MODEL")) {
deviceInfo.setDeviceModel(prop.getValue());
} else if (prop.getName().equalsIgnoreCase("VENDOR")) {
deviceInfo.setVendor(prop.getValue());
} else if (prop.getName().equalsIgnoreCase("OS_VERSION")) {
deviceInfo.setOsVersion(prop.getValue());
} else if (prop.getName().equalsIgnoreCase("IMEI")) {
deviceInfo.getDeviceDetailsMap().put("IMEI", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("IMSI")) {
deviceInfo.getDeviceDetailsMap().put("IMSI", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("MAC")) {
deviceInfo.getDeviceDetailsMap().put("mac", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("SERIAL")) {
deviceInfo.getDeviceDetailsMap().put("serial", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("OS_BUILD_DATE")) {
deviceInfo.setOsBuildDate(prop.getValue());
}
extractDefinedProperties(deviceInfo, prop);
} else {
extractMapProperties(deviceInfo, prop);
}
}
return deviceInfo;
}
private static void extractMapProperties(DeviceInfo deviceInfo, Device.Property prop) {
if (prop.getName().equalsIgnoreCase("CPU_INFO")) {
deviceInfo.getDeviceDetailsMap().put("cpuUser",
getProperty(prop.getValue(), "User"));
deviceInfo.getDeviceDetailsMap().put("cpuSystem",
getProperty(prop.getValue(), "System"));
deviceInfo.getDeviceDetailsMap().put("IOW",
getProperty(prop.getValue(), "IOW"));
deviceInfo.getDeviceDetailsMap().put("IRQ",
getProperty(prop.getValue(), "IRQ"));
deviceInfo.getDeviceDetailsMap().put("cpuUser", getProperty(prop.getValue(), "User"));
deviceInfo.getDeviceDetailsMap().put("cpuSystem", getProperty(prop.getValue(), "System"));
deviceInfo.getDeviceDetailsMap().put("IOW", getProperty(prop.getValue(), "IOW"));
deviceInfo.getDeviceDetailsMap().put("IRQ", getProperty(prop.getValue(), "IRQ"));
} else if (prop.getName().equalsIgnoreCase("RAM_INFO")) {
deviceInfo.setTotalRAMMemory(Double.parseDouble(getProperty(prop.getValue(), "TOTAL_MEMORY")));
deviceInfo.setAvailableRAMMemory(Double.parseDouble(getProperty(prop.getValue(), "AVAILABLE_MEMORY")));
deviceInfo.getDeviceDetailsMap().put("ramThreshold",
getProperty(prop.getValue(), "THRESHOLD"));
deviceInfo.getDeviceDetailsMap().put("ramLowMemory",
getProperty(prop.getValue(), "LOW_MEMORY"));
deviceInfo.setAvailableRAMMemory(Double.parseDouble(
getProperty(prop.getValue(), "AVAILABLE_MEMORY")));
deviceInfo.getDeviceDetailsMap().put("ramThreshold", getProperty(prop.getValue(), "THRESHOLD"));
deviceInfo.getDeviceDetailsMap().put("ramLowMemory", getProperty(prop.getValue(), "LOW_MEMORY"));
} else if (prop.getName().equalsIgnoreCase("BATTERY_INFO")) {
deviceInfo.setPluggedIn(Boolean.parseBoolean(getProperty(prop.getValue(), "PLUGGED")));
deviceInfo.getDeviceDetailsMap().put("batteryLevel",
getProperty(prop.getValue(), "BATTERY_LEVEL"));
deviceInfo.getDeviceDetailsMap().put("batteryScale",
getProperty(prop.getValue(), "SCALE"));
deviceInfo.getDeviceDetailsMap().put("batteryLevel", getProperty(prop.getValue(), "BATTERY_LEVEL"));
deviceInfo.getDeviceDetailsMap().put("batteryScale", getProperty(prop.getValue(), "SCALE"));
deviceInfo.getDeviceDetailsMap().put("batteryVoltage",
getProperty(prop.getValue(), "BATTERY_VOLTAGE"));
deviceInfo.getDeviceDetailsMap().put("batteryTemperature",
@ -327,10 +311,8 @@ public class AndroidDeviceUtils {
getProperty(prop.getValue(), "CURRENT_AVERAGE"));
deviceInfo.getDeviceDetailsMap().put("batteryTechnology",
getProperty(prop.getValue(), "TECHNOLOGY"));
deviceInfo.getDeviceDetailsMap().put("batteryHealth",
getProperty(prop.getValue(), "HEALTH"));
deviceInfo.getDeviceDetailsMap().put("batteryStatus",
getProperty(prop.getValue(), "STATUS"));
deviceInfo.getDeviceDetailsMap().put("batteryHealth", getProperty(prop.getValue(), "HEALTH"));
deviceInfo.getDeviceDetailsMap().put("batteryStatus", getProperty(prop.getValue(), "STATUS"));
} else if (prop.getName().equalsIgnoreCase("NETWORK_INFO")) {
deviceInfo.setSsid(getProperty(prop.getValue(), "WIFI_SSID"));
deviceInfo.setConnectionType(getProperty(prop.getValue(), "CONNECTION_TYPE"));
@ -359,26 +341,46 @@ public class AndroidDeviceUtils {
getProperty(prop.getValue(), "OPERATOR"));
deviceInfo.getDeviceDetailsMap().put("PhoneNumber",
getProperty(prop.getValue(), "PHONE_NUMBER"));
} else if (prop.getName().equalsIgnoreCase("IMEI")) {
deviceInfo.getDeviceDetailsMap().put("IMEI", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("IMSI")) {
deviceInfo.getDeviceDetailsMap().put("IMSI", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("MAC")) {
deviceInfo.getDeviceDetailsMap().put("mac", prop.getValue());
} else if (prop.getName().equalsIgnoreCase("SERIAL")) {
deviceInfo.getDeviceDetailsMap().put("serial", prop.getValue());
}
}
private static void extractDefinedProperties(DeviceInfo deviceInfo, Device.Property prop) {
if (prop.getName().equalsIgnoreCase("DEVICE_MODEL")) {
deviceInfo.setDeviceModel(prop.getValue());
} else if (prop.getName().equalsIgnoreCase("VENDOR")) {
deviceInfo.setVendor(prop.getValue());
} else if (prop.getName().equalsIgnoreCase("OS_VERSION")) {
deviceInfo.setOsVersion(prop.getValue());
} else if (prop.getName().equalsIgnoreCase("OS_BUILD_DATE")) {
deviceInfo.setOsBuildDate(prop.getValue());
}
return deviceInfo;
}
private static String getProperty(String a, String needed) {
JsonElement jsonElement = new JsonParser().parse(a);
private static String getProperty(String properties, String needed) {
// This is not a key value pair. value is the immediate element to its filed name.
// Ex:
// [{"name":"ENCRYPTION_ENABLED","value":"false"},{"name":"PASSCODE_ENABLED","value":"true"},
// {"name":"BATTERY_LEVEL","value":"100"},{"name":"INTERNAL_TOTAL_MEMORY","value":"0.76"}]
JsonElement jsonElement = new JsonParser().parse(properties);
JsonArray jsonArray = jsonElement.getAsJsonArray();
boolean exist = false;
for (JsonElement element : jsonArray) {
for (Map.Entry<String, JsonElement> ob : ((JsonObject) element).entrySet()) {
JsonElement val = ob.getValue();
if (val != null && !val.isJsonNull()) {
if (exist) {
return val.getAsString().replace("%", "");
}
if (val.getAsString().equalsIgnoreCase(needed)) {
exist = true;
if (element.isJsonObject()) {
JsonObject jsonObject = element.getAsJsonObject();
if (jsonObject.has("name")
&& jsonObject.get("name").getAsString().equalsIgnoreCase(needed)) {
if (jsonObject.has("value")) {
return jsonObject.get("value").getAsString().replace("%", "");
} else {
return "";
}
}
}
@ -386,7 +388,8 @@ public class AndroidDeviceUtils {
return "";
}
private static List<ComplianceFeature> getComplianceFeatures(Object compliancePayload) throws PolicyComplianceException {
private static List<ComplianceFeature> getComplianceFeatures(Object compliancePayload)
throws PolicyComplianceException {
String compliancePayloadString = new Gson().toJson(compliancePayload);
if (compliancePayload == null) {
return null;

@ -57,7 +57,6 @@ public class DeviceManagementAdminServiceTests {
private void mockDeviceManagementService()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService"))
.toReturn(new DeviceManagementProviderServiceMock());
}

@ -1,3 +1,21 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.mocks;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;

@ -1,20 +1,3 @@
package org.wso2.carbon.mdm.services.android.mocks;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.policy.mgt.Profile;
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
import org.wso2.carbon.policy.mgt.common.PolicyInformationPoint;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.common.PolicyMonitoringTaskException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
@ -32,6 +15,23 @@ import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.mocks;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.policy.mgt.Profile;
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
import org.wso2.carbon.policy.mgt.common.PolicyInformationPoint;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.common.PolicyMonitoringTaskException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService;
import java.util.List;

@ -276,7 +276,26 @@ public class TestUtils {
operation.setActivityId(getActivity().getActivityId());
operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST);
operation.setId(1);
operation.setOperationResponse("[{\"name\":\"Widget%20Preview\",\"package\":\"com.android.widgetpreview\",\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false},{\"name\":\"com.android.gesture.builder\",\"package\":\"com.android.gesture.builder\",\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false},{\"name\":\"API%20Demos\",\"package\":\"com.example.android.apis\",\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false},{\"name\":\"WSO2%20Device%20Management%20Agent\",\"package\":\"org.wso2.iot.agent\",\"version\":\"3.1.21\",\"isSystemApp\":false,\"isActive\":true},{\"name\":\"com.android.smoketest.tests\",\"package\":\"com.android.smoketest.tests\",\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false},{\"name\":\"Sample%20Soft%20Keyboard\",\"package\":\"com.example.android.softkeyboard\",\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false},{\"name\":\"Example%20Wallpapers\",\"package\":\"com.example.android.livecubes\",\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false},{\"name\":\"com.android.smoketest\",\"package\":\"com.android.smoketest\",\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false}]");
operation.setOperationResponse("[{\"name\":\"Widget%20Preview\",\"package\":\"com.android.widgetpreview\"," +
"\"version\":\"7.1.1\",\"isSystemApp\":false,\"isActive\":false}," +
"{\"name\":\"com.android.gesture.builder\"," +
"\"package\":\"com.android.gesture.builder\",\"version\":\"7.1.1\"," +
"\"isSystemApp\":false,\"isActive\":false},{\"name\":\"API%20Demos\"," +
"\"package\":\"com.example.android.apis\",\"version\":\"7.1.1\"," +
"\"isSystemApp\":false,\"isActive\":false}," +
"{\"name\":\"WSO2%20Device%20Management%20Agent\"," +
"\"package\":\"org.wso2.iot.agent\",\"version\":\"3.1.21\"," +
"\"isSystemApp\":false,\"isActive\":true}," +
"{\"name\":\"com.android.smoketest.tests\"," +
"\"package\":\"com.android.smoketest.tests\",\"version\":\"7.1.1\"," +
"\"isSystemApp\":false,\"isActive\":false}," +
"{\"name\":\"Sample%20Soft%20Keyboard\"," +
"\"package\":\"com.example.android.softkeyboard\",\"version\":\"7.1.1\"," +
"\"isSystemApp\":false,\"isActive\":false},{\"name\":\"Example%20Wallpapers\"," +
"\"package\":\"com.example.android.livecubes\",\"version\":\"7.1.1\"," +
"\"isSystemApp\":false,\"isActive\":false},{\"name\":\"com.android.smoketest\"," +
"\"package\":\"com.android.smoketest\",\"version\":\"7.1.1\"," +
"\"isSystemApp\":false,\"isActive\":false}]");
operation.setStatus(Operation.Status.COMPLETED);
operations.add(operation);
return operations;
@ -288,7 +307,45 @@ public class TestUtils {
operation.setActivityId(getActivity().getActivityId());
operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO);
operation.setId(1);
operation.setOperationResponse("{\"description\":\"generic_x86\",\"deviceIdentifier\":\"1d9612def9d205f9\",\"enrolmentInfo\":null,\"name\":\"generic_x86\",\"properties\":[{\"name\":\"SERIAL\",\"value\":\"unknown\"},{\"name\":\"IMEI\",\"value\":null},{\"name\":\"IMSI\",\"value\":\"310260000000000\"},{\"name\":\"MAC\",\"value\":\"02:00:00:00:00:00\"},{\"name\":\"DEVICE_MODEL\",\"value\":\"Android SDK built for x86\"},{\"name\":\"VENDOR\",\"value\":\"unknown\"},{\"name\":\"OS_VERSION\",\"value\":\"7.1.1\"},{\"name\":\"OS_BUILD_DATE\",\"value\":\"1487782847000\"},{\"name\":\"DEVICE_NAME\",\"value\":\"generic_x86\"},{\"name\":\"LATITUDE\",\"value\":\"6.90988\"},{\"name\":\"LONGITUDE\",\"value\":\"79.85249999999999\"},{\"name\":\"NETWORK_INFO\",\"value\":\"[{\\\"name\\\":\\\"CONNECTION_TYPE\\\",\\\"value\\\":\\\"MOBILE\\\"},{\\\"name\\\":\\\"MOBILE_CONNECTION_TYPE\\\",\\\"value\\\":\\\"LTE\\\"},{\\\"name\\\":\\\"MOBILE_SIGNAL_STRENGTH\\\",\\\"value\\\":\\\"-89\\\"}]\"},{\"name\":\"CPU_INFO\",\"value\":\"[]\"},{\"name\":\"RAM_INFO\",\"value\":\"[{\\\"name\\\":\\\"TOTAL_MEMORY\\\",\\\"value\\\":\\\"1055113216\\\"},{\\\"name\\\":\\\"AVAILABLE_MEMORY\\\",\\\"value\\\":\\\"708997120\\\"},{\\\"name\\\":\\\"THRESHOLD\\\",\\\"value\\\":\\\"150994944\\\"},{\\\"name\\\":\\\"LOW_MEMORY\\\",\\\"value\\\":\\\"false\\\"}]\"},{\"name\":\"BATTERY_INFO\",\"value\":\"[{\\\"name\\\":\\\"BATTERY_LEVEL\\\",\\\"value\\\":\\\"100\\\"},{\\\"name\\\":\\\"SCALE\\\",\\\"value\\\":\\\"100\\\"},{\\\"name\\\":\\\"BATTERY_VOLTAGE\\\",\\\"value\\\":\\\"0\\\"},{\\\"name\\\":\\\"HEALTH\\\",\\\"value\\\":\\\"GOOD_CONDITION\\\"},{\\\"name\\\":\\\"STATUS\\\",\\\"value\\\":\\\"null\\\"},{\\\"name\\\":\\\"PLUGGED\\\",\\\"value\\\":\\\"AC\\\"}]\"},{\"name\":\"DEVICE_INFO\",\"value\":\"[{\\\"name\\\":\\\"ENCRYPTION_ENABLED\\\",\\\"value\\\":\\\"false\\\"},{\\\"name\\\":\\\"PASSCODE_ENABLED\\\",\\\"value\\\":\\\"true\\\"},{\\\"name\\\":\\\"BATTERY_LEVEL\\\",\\\"value\\\":\\\"100\\\"},{\\\"name\\\":\\\"INTERNAL_TOTAL_MEMORY\\\",\\\"value\\\":\\\"0.76\\\"},{\\\"name\\\":\\\"INTERNAL_AVAILABLE_MEMORY\\\",\\\"value\\\":\\\"0.67\\\"},{\\\"name\\\":\\\"EXTERNAL_TOTAL_MEMORY\\\",\\\"value\\\":\\\"0.1\\\"},{\\\"name\\\":\\\"EXTERNAL_AVAILABLE_MEMORY\\\",\\\"value\\\":\\\"0.1\\\"},{\\\"name\\\":\\\"OPERATOR\\\",\\\"value\\\":\\\"Android\\\"},{\\\"name\\\":\\\"PHONE_NUMBER\\\",\\\"value\\\":\\\"15555215554\\\"}]\"}]}");
operation.setOperationResponse("{\"description\":\"generic_x86\",\"deviceIdentifier\":\"1d9612def9d205f9\"," +
"\"enrolmentInfo\":null,\"name\":\"generic_x86\",\"properties\":[" +
"{\"name\":\"SERIAL\",\"value\":\"unknown\"}," +
"{\"name\":\"IMEI\",\"value\":null}," +
"{\"name\":\"IMSI\",\"value\":\"310260000000000\"}," +
"{\"name\":\"MAC\",\"value\":\"02:00:00:00:00:00\"}," +
"{\"name\":\"DEVICE_MODEL\",\"value\":\"Android SDK built for x86\"}," +
"{\"name\":\"VENDOR\",\"value\":\"unknown\"}," +
"{\"name\":\"OS_VERSION\",\"value\":\"7.1.1\"}," +
"{\"name\":\"OS_BUILD_DATE\",\"value\":\"1487782847000\"}," +
"{\"name\":\"DEVICE_NAME\",\"value\":\"generic_x86\"}," +
"{\"name\":\"LATITUDE\",\"value\":\"6.90988\"}," +
"{\"name\":\"LONGITUDE\",\"value\":\"79.85249999999999\"}," +
"{\"name\":\"NETWORK_INFO\",\"value\":\"[" +
"{\\\"name\\\":\\\"CONNECTION_TYPE\\\",\\\"value\\\":\\\"MOBILE\\\"}," +
"{\\\"name\\\":\\\"MOBILE_CONNECTION_TYPE\\\",\\\"value\\\":\\\"LTE\\\"}," +
"{\\\"name\\\":\\\"MOBILE_SIGNAL_STRENGTH\\\",\\\"value\\\":\\\"-89\\\"}]\"}," +
"{\"name\":\"CPU_INFO\",\"value\":\"[]\"},{\"name\":\"RAM_INFO\",\"value\":\"[" +
"{\\\"name\\\":\\\"TOTAL_MEMORY\\\",\\\"value\\\":\\\"1055113216\\\"}," +
"{\\\"name\\\":\\\"AVAILABLE_MEMORY\\\",\\\"value\\\":\\\"708997120\\\"}," +
"{\\\"name\\\":\\\"THRESHOLD\\\",\\\"value\\\":\\\"150994944\\\"}," +
"{\\\"name\\\":\\\"LOW_MEMORY\\\",\\\"value\\\":\\\"false\\\"}]\"}," +
"{\"name\":\"BATTERY_INFO\",\"value\":\"[" +
"{\\\"name\\\":\\\"BATTERY_LEVEL\\\",\\\"value\\\":\\\"100\\\"}," +
"{\\\"name\\\":\\\"SCALE\\\",\\\"value\\\":\\\"100\\\"}," +
"{\\\"BATTERY_VOLTAGE\\\":\\\"0\\\"}," +
"{\\\"name\\\":\\\"HEALTH\\\",\\\"value\\\":\\\"GOOD_CONDITION\\\"}," +
"{\\\"name\\\":\\\"STATUS\\\"}," +
"{\\\"name\\\":\\\"PLUGGED\\\",\\\"value\\\":\\\"AC\\\"}]\"}," +
"{\"name\":\"DEVICE_INFO\",\"value\":\"[" +
"{\\\"name\\\":\\\"ENCRYPTION_ENABLED\\\",\\\"value\\\":\\\"false\\\"}," +
"{\\\"name\\\":\\\"PASSCODE_ENABLED\\\",\\\"value\\\":\\\"true\\\"}," +
"{\\\"name\\\":\\\"BATTERY_LEVEL\\\",\\\"value\\\":\\\"100\\\"}," +
"{\\\"name\\\":\\\"INTERNAL_TOTAL_MEMORY\\\",\\\"value\\\":\\\"0.76\\\"}," +
"{\\\"name\\\":\\\"INTERNAL_AVAILABLE_MEMORY\\\",\\\"value\\\":\\\"0.67\\\"}," +
"{\\\"name\\\":\\\"EXTERNAL_TOTAL_MEMORY\\\",\\\"value\\\":\\\"0.1\\\"}," +
"{\\\"name\\\":\\\"EXTERNAL_AVAILABLE_MEMORY\\\",\\\"value\\\":\\\"0.1\\\"}," +
"{\\\"name\\\":\\\"OPERATOR\\\",\\\"value\\\":\\\"Android\\\"}," +
"{\\\"name\\\":\\\"PHONE_NUMBER\\\",\\\"value\\\":\\\"15555215554\\\"}]\"}]}");
operation.setStatus(Operation.Status.COMPLETED);
operations.add(operation);
return operations;

Loading…
Cancel
Save