From 13620d5c114763270116f63e208ca59903945edb Mon Sep 17 00:00:00 2001 From: sandarudr Date: Thu, 17 Oct 2019 16:41:51 +0530 Subject: [PATCH 1/2] Add operation to enable/disable lock-task mode --- .../DeviceManagementAdminService.java | 66 ++ .../DeviceManagementAdminServiceImpl.java | 27 + .../android/util/AndroidConstants.java | 1 + .../src/main/webapp/META-INF/permissions.xml | 7 + .../DeviceManagementAdminServiceTests.java | 9 + .../public/js/operation-mod.js | 2 + .../private/config.json | 6 + .../android/impl/AndroidFeatureManager.java | 586 ++++++++++++++++++ .../main/resources/devicetypes/android.xml | 20 + 9 files changed, 724 insertions(+) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index beebf032c..5e1ddd7f1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -156,6 +156,12 @@ import java.util.List; key = "perm:android:reboot", permissions = {"/device-mgt/devices/owning-device/operations/android/reboot"} ), + @Scope( + name = "Change LockTask mode", + description = "Change LoockTask mode of KIOSK devices", + key = "perm:android:change-LockTask", + permissions = {"/device-mgt/devices/owning-device/operations/android/change-LockTask"} + ), @Scope( name = "Mute Device", description = "Mute Android devices", @@ -1055,6 +1061,66 @@ public interface DeviceManagementAdminService { required = true) List deviceIDs); + @POST + @Path("/change-LockTask") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Change LockTask mode of KIOSK Devices", + notes = "Enable or disable LockTask mode of KIOSK devices.", + response = Activity.class, + tags = "Android Device Management Administrative Service", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:change-LockTask") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the change LockTask operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding the new change LockTask operation.") + }) + Response changeLockTask( + @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ", + required = true) + List deviceIDs); + @POST @Path("/mute") @ApiOperation( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java index b8d1a7af9..03d7a9114 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java @@ -500,6 +500,33 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe } } + @POST + @Path("/change-LockTask") + @Override + public Response changeLockTask(List deviceIDs) { + if (log.isDebugEnabled()) { + log.debug("Invoking Android change LockTask mode operation"); + } + + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_TASK_MODE); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return Response.status(Response.Status.CREATED).entity(activity).build(); + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } catch (OperationManagementException e) { + String errorMessage = "Issue in retrieving operation management service instance"; + log.error(errorMessage, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + } + } + @POST @Path("/mute") @Override diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java index 787253c4a..18cd1d997 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java @@ -137,6 +137,7 @@ public final class AndroidConstants { public static final String ENCRYPT_STORAGE = "ENCRYPT_STORAGE"; public static final String DEVICE_RING = "DEVICE_RING"; public static final String DEVICE_REBOOT = "REBOOT"; + public static final String CHANGE_LOCK_TASK_MODE = "CHANGE_LOCK_TASK_MODE"; public static final String UPGRADE_FIRMWARE = "UPGRADE_FIRMWARE"; public static final String NOTIFICATION = "NOTIFICATION"; public static final String POLICY_BUNDLE = "POLICY_BUNDLE"; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml index 1c3c034b8..0b0e8150f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml @@ -249,6 +249,13 @@ POST + + Change LockTask mode + /device-mgt/admin/device/android/operation/change-LockTask + /admin/devices/change-LockTask + POST + + Ring device /device-mgt/admin/device/android/operation/ring diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java index 30e5474d7..a8a267beb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java @@ -169,6 +169,15 @@ public class DeviceManagementAdminServiceTests { Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); } + @Test + public void testChangeLockTask() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Response response = deviceManagementAdminService.changeLockTask(TestUtils.getDeviceIds()); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); + } + @Test public void testMuteDevice() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js index 06f588011..adb2d38d6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js @@ -745,6 +745,7 @@ var androidOperationModule = function () { "APPLICATION_LIST": "get-application-list", "DEVICE_RING": "ring", "DEVICE_REBOOT": "reboot", + "CHANGE_LOCK_TASK_MODE": "change-LockTask", "UPGRADE_FIRMWARE": "upgrade-firmware", "DEVICE_MUTE": "mute", "NOTIFICATION": "send-notification", @@ -775,6 +776,7 @@ var androidOperationModule = function () { "WIPE_DATA": "fw-delete", "DEVICE_RING": "fw-dial-up", "DEVICE_REBOOT": "fw-refresh", + "CHANGE_LOCK_TASK_MODE": "fw-mobile", "UPGRADE_FIRMWARE": "fw-hardware", "DEVICE_MUTE": "fw-mute", "NOTIFICATION": "fw-message", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/private/config.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/private/config.json index 82394b258..17511f509 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/private/config.json +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/private/config.json @@ -36,6 +36,7 @@ "perm:android:unlock-devices", "perm:android:control-camera", "perm:android:reboot", + "perm:android:change-LockTask", "perm:android:logcat", "perm:android:send-app-restrictions" ], @@ -74,6 +75,11 @@ "filter" : {"property" : "ownership", "value" : "COPE", "text": "This feature is only available in COPE/COSU"}, "permission": "/device-mgt/devices/owning-device/operations/android/reboot" }, + "CHANGE_LOCK_TASK_MODE": { + "icon": "fw-mobile", + "filter" : {"property" : "ownership", "value" : "COPE", "text": "This feature is only available in COSU(KIOSK)"}, + "permission": "/device-mgt/devices/owning-device/operations/android/change-LockTask" + }, "UPGRADE_FIRMWARE": { "icon": "fw-hardware", "filter" : {"property" : "ownership", "value" : "COPE", "text": "This feature is only available in COPE/COSU"}, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java new file mode 100644 index 000000000..6024b2415 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java @@ -0,0 +1,586 @@ +/* + * Copyright (c) 2015, 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. + * + */ + +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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.device.mgt.mobile.android.impl; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.Feature; +import org.wso2.carbon.device.mgt.common.FeatureManager; +import org.wso2.carbon.device.mgt.mobile.android.impl.dao.AndroidDAOFactory; +import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileDeviceManagementDAOException; +import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileDeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileFeatureDAO; +import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileFeature; +import org.wso2.carbon.device.mgt.mobile.android.impl.util.MobileDeviceManagementUtil; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class AndroidFeatureManager implements FeatureManager { + + private MobileFeatureDAO featureDAO; + private static final Log log = LogFactory.getLog(AndroidFeatureManager.class); + + public AndroidFeatureManager() { + MobileDeviceManagementDAOFactory daoFactory = new AndroidDAOFactory(); + this.featureDAO = daoFactory.getMobileFeatureDAO(); + } + + @Override + public boolean addFeature(Feature feature) throws DeviceManagementException { + try { + AndroidDAOFactory.beginTransaction(); + MobileFeature mobileFeature = MobileDeviceManagementUtil.convertToMobileFeature(feature); + featureDAO.addFeature(mobileFeature); + AndroidDAOFactory.commitTransaction(); + return true; + } catch (MobileDeviceManagementDAOException e) { + try { + AndroidDAOFactory.rollbackTransaction(); + } catch (MobileDeviceManagementDAOException e1) { + log.warn("Error occurred while roll-backing the transaction", e); + } + throw new DeviceManagementException("Error occurred while adding the feature", e); + } + } + + @Override + public boolean addFeatures(List features) throws DeviceManagementException { + List mobileFeatures = new ArrayList(features.size()); + for (Feature feature : features) { + mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature)); + } + try { + AndroidDAOFactory.beginTransaction(); + featureDAO.addFeatures(mobileFeatures); + AndroidDAOFactory.commitTransaction(); + return true; + } catch (MobileDeviceManagementDAOException e) { + try { + AndroidDAOFactory.rollbackTransaction(); + } catch (MobileDeviceManagementDAOException e1) { + log.warn("Error occurred while roll-backing the transaction", e); + } + throw new DeviceManagementException("Error occurred while adding the features", e); + } + } + + @Override + public Feature getFeature(String name) throws DeviceManagementException { + try { + MobileFeature mobileFeature = featureDAO.getFeatureByCode(name); + Feature feature = MobileDeviceManagementUtil.convertToFeature(mobileFeature); + return feature; + } catch (MobileDeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while retrieving the feature", e); + } + } + + @Override + public List getFeatures() throws DeviceManagementException { + try { + List mobileFeatures = featureDAO.getAllFeatures(); + return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect( + Collectors.toList()); + } catch (MobileDeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " + + "Android platform", e); + } + } + + @Override + public List getFeatures(String featureType) throws DeviceManagementException { + if (StringUtils.isEmpty(featureType)) { + return this.getFeatures(); + } + try { + List mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType); + return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect( + Collectors.toList()); + } catch (MobileDeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " + + "Android platform", e); + } + } + + @Override + public List getFeatures(String featureType, boolean isHidden) throws DeviceManagementException { + try { + List mobileFeatures; + if (StringUtils.isNotEmpty(featureType)) { + mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType, isHidden); + } else { + mobileFeatures = featureDAO.getAllFeatures(isHidden); + } + return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect( + Collectors.toList()); + } catch (MobileDeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " + + "Android platform", e); + } + } + + @Override + public boolean removeFeature(String code) throws DeviceManagementException { + boolean status; + try { + AndroidDAOFactory.beginTransaction(); + featureDAO.deleteFeatureByCode(code); + AndroidDAOFactory.commitTransaction(); + status = true; + } catch (MobileDeviceManagementDAOException e) { + try { + AndroidDAOFactory.rollbackTransaction(); + } catch (MobileDeviceManagementDAOException e1) { + log.warn("Error occurred while roll-backing the transaction", e); + } + throw new DeviceManagementException("Error occurred while removing the feature", e); + } + return status; + } + + @Override + public boolean addSupportedFeaturesToDB() throws DeviceManagementException { + synchronized (this) { + List supportedFeatures = getSupportedFeatures(); + List existingFeatures = this.getFeatures(); + List missingFeatures = MobileDeviceManagementUtil. + getMissingFeatures(supportedFeatures, existingFeatures); + if (missingFeatures.size() > 0) { + return this.addFeatures(missingFeatures); + } + return true; + } + } + + //Get the supported feature list. + private static List getSupportedFeatures() { + List supportedFeatures = new ArrayList(); + Feature feature = new Feature(); + feature.setCode("DEVICE_LOCK"); + feature.setName("Device Lock"); + feature.setDescription("Lock the device"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("DEVICE_LOCATION"); + feature.setName("Location"); + feature.setDescription("Request coordinates of device location"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("WIFI"); + feature.setName("wifi"); + feature.setDescription("Setting up wifi configuration"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("CAMERA"); + feature.setName("camera"); + feature.setDescription("Enable or disable camera"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("BACKUP_SERVICE"); + feature.setName("Set Backup Service"); + feature.setDescription("set backup service"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("EMAIL"); + feature.setName("Email"); + feature.setDescription("Configure email settings"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("DEVICE_MUTE"); + feature.setName("mute"); + feature.setDescription("Enable mute in the device"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("DEVICE_INFO"); + feature.setName("Device info"); + feature.setDescription("Request device information"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("ENTERPRISE_WIPE"); + feature.setName("Enterprise Wipe"); + feature.setDescription("Remove enterprise applications"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("CLEAR_PASSWORD"); + feature.setName("Clear Password"); + feature.setDescription("Clear current password"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("WIPE_DATA"); + feature.setName("Wipe Data"); + feature.setDescription("Factory reset the device"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("APPLICATION_LIST"); + feature.setName("Application List"); + feature.setDescription("Request list of current installed applications"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("CHANGE_LOCK_CODE"); + feature.setName("Change Lock-code"); + feature.setDescription("Change current lock code"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("INSTALL_APPLICATION"); + feature.setName("Install App"); + feature.setDescription("Install Enterprise or Market application"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("UNINSTALL_APPLICATION"); + feature.setName("Uninstall App"); + feature.setDescription("Uninstall application"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("BLACKLIST_APPLICATIONS"); + feature.setName("Blacklist app"); + feature.setDescription("Blacklist applications"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("ENCRYPT_STORAGE"); + feature.setName("Encrypt storage"); + feature.setDescription("Encrypt storage"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("DEVICE_RING"); + feature.setName("Ring"); + feature.setDescription("Ring the device"); + supportedFeatures.add(feature); + feature = new Feature(); + feature.setCode("PASSCODE_POLICY"); + feature.setName("Password Policy"); + feature.setDescription("Set passcode policy"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("NOTIFICATION"); + feature.setName("Message"); + feature.setDescription("Send message"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DEVICE_REBOOT"); + feature.setName("Reboot"); + feature.setDescription("Reboot the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("CHANGE_LOCK_TASK_MODE"); + feature.setName("Change LockTask Mode"); + feature.setDescription("Enable or disable LockTask mode of KIOSK device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("UPGRADE_FIRMWARE"); + feature.setName("Upgrade Firmware"); + feature.setDescription("Upgrade Firmware"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("VPN"); + feature.setName("Configure VPN"); + feature.setDescription("Configure VPN settings"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_ADJUST_VOLUME"); + feature.setName("Adjust Volume"); + feature.setDescription("allow or disallow user to change volume"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CONFIG_BLUETOOTH"); + feature.setName("Disallow bluetooth configuration"); + feature.setDescription("allow or disallow user to change bluetooth configurations"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CONFIG_CELL_BROADCASTS"); + feature.setName("Disallow cell broadcast configuration"); + feature.setDescription("allow or disallow user to change cell broadcast configurations"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CONFIG_CREDENTIALS"); + feature.setName("Disallow credential configuration"); + feature.setDescription("allow or disallow user to change user credentials"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CONFIG_MOBILE_NETWORKS"); + feature.setName("Disallow mobile network configure"); + feature.setDescription("allow or disallow user to change mobile networks configurations"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CONFIG_TETHERING"); + feature.setName("Disallow tethering configuration"); + feature.setDescription("allow or disallow user to change tethering configurations"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CONFIG_VPN"); + feature.setName("Disallow VPN configuration"); + feature.setDescription("allow or disallow user to change VPN configurations"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CONFIG_WIFI"); + feature.setName("Disallow WIFI configuration"); + feature.setDescription("allow or disallow user to change WIFI configurations"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_APPS_CONTROL"); + feature.setName("Disallow APP control configuration"); + feature.setDescription("allow or disallow user to change app control"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CREATE_WINDOWS"); + feature.setName("Disallow window creation"); + feature.setDescription("allow or disallow window creation"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_APPS_CONTROL"); + feature.setName("Disallow APP control configuration"); + feature.setDescription("allow or disallow user to change app control configurations"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_CROSS_PROFILE_COPY_PASTE"); + feature.setName("Disallow cross profile copy paste"); + feature.setDescription("allow or disallow cross profile copy paste"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_DEBUGGING_FEATURES"); + feature.setName("Disallow debugging features"); + feature.setDescription("allow or disallow debugging features"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_FACTORY_RESET"); + feature.setName("Disallow factory reset"); + feature.setDescription("allow or disallow factory reset"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_ADD_USER"); + feature.setName("Disallow add user"); + feature.setDescription("allow or disallow add user"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_INSTALL_APPS"); + feature.setName("Disallow install apps"); + feature.setDescription("allow or disallow install apps"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_INSTALL_UNKNOWN_SOURCES"); + feature.setName("Disallow install unknown sources"); + feature.setDescription("allow or disallow install unknown sources"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_MODIFY_ACCOUNTS"); + feature.setName("Disallow modify account"); + feature.setDescription("allow or disallow modify account"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_MOUNT_PHYSICAL_MEDIA"); + feature.setName("Disallow mount physical media"); + feature.setDescription("allow or disallow mount physical media."); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_NETWORK_RESET"); + feature.setName("Disallow network reset"); + feature.setDescription("allow or disallow network reset"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_OUTGOING_BEAM"); + feature.setName("Disallow outgoing beam"); + feature.setDescription("allow or disallow outgoing beam."); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_OUTGOING_CALLS"); + feature.setName("Disallow outgoing calls"); + feature.setDescription("allow or disallow outgoing calls"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_REMOVE_USER"); + feature.setName("Disallow remove users"); + feature.setDescription("allow or disallow remove users"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_SAFE_BOOT"); + feature.setName("Disallow safe boot"); + feature.setDescription("allow or disallow safe boot"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_SHARE_LOCATION"); + feature.setName("Disallow share location"); + feature.setDescription("allow or disallow share location."); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_SMS"); + feature.setName("Disallow sms"); + feature.setDescription("allow or disallow sms"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_UNINSTALL_APPS"); + feature.setName("Disallow uninstall app"); + feature.setDescription("allow or disallow uninstall app"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_UNMUTE_MICROPHONE"); + feature.setName("Disallow unmute mic"); + feature.setDescription("allow or disallow unmute mic"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_USB_FILE_TRANSFER"); + feature.setName("Disallow usb file transfer"); + feature.setDescription("allow or disallow usb file transfer"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("ALLOW_PARENT_PROFILE_APP_LINKING"); + feature.setName("Disallow parent profile app linking"); + feature.setDescription("allow or disallow parent profile app linking"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("ENSURE_VERIFY_APPS"); + feature.setName("Disallow ensure verify apps"); + feature.setDescription("allow or disallow ensure verify apps"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("AUTO_TIME"); + feature.setName("Allow auto timing"); + feature.setDescription("allow or disallow auto timing"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("REMOVE_DEVICE_OWNER"); + feature.setName("Remove device owner"); + feature.setDescription("remove device owner"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("LOGCAT"); + feature.setName("Fetch Logcat"); + feature.setDescription("Fetch device logcat"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DEVICE_UNLOCK"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_SET_WALLPAPER"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_SET_USER_ICON"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_REMOVE_MANAGEMENT_PROFILE"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_AUTOFILL"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_BLUETOOTH"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_BLUETOOTH_SHARING"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_REMOVE_USER"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("DISALLOW_DATA_ROAMING"); + feature.setName("Device Unlock"); + feature.setDescription("Unlock the device"); + supportedFeatures.add(feature); + + return supportedFeatures; + } +} \ No newline at end of file diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml index 6f99ea30c..40e84c21a 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml @@ -191,6 +191,26 @@ + + Change LockTask + Change LockTask mode of KIOSK device + + Upgrade Firmware Upgrade Firmware From 1e1d6153901af3c11353244965947a791b6e3c04 Mon Sep 17 00:00:00 2001 From: sandarudr Date: Fri, 18 Oct 2019 18:55:29 +0530 Subject: [PATCH 2/2] Remove unnecessary files --- .../android/impl/AndroidFeatureManager.java | 586 ------------------ 1 file changed, 586 deletions(-) delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java deleted file mode 100644 index 6024b2415..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Copyright (c) 2015, 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. - * - */ - -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. 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.device.mgt.mobile.android.impl; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.Feature; -import org.wso2.carbon.device.mgt.common.FeatureManager; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.AndroidDAOFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileDeviceManagementDAOException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileDeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileFeatureDAO; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileFeature; -import org.wso2.carbon.device.mgt.mobile.android.impl.util.MobileDeviceManagementUtil; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -public class AndroidFeatureManager implements FeatureManager { - - private MobileFeatureDAO featureDAO; - private static final Log log = LogFactory.getLog(AndroidFeatureManager.class); - - public AndroidFeatureManager() { - MobileDeviceManagementDAOFactory daoFactory = new AndroidDAOFactory(); - this.featureDAO = daoFactory.getMobileFeatureDAO(); - } - - @Override - public boolean addFeature(Feature feature) throws DeviceManagementException { - try { - AndroidDAOFactory.beginTransaction(); - MobileFeature mobileFeature = MobileDeviceManagementUtil.convertToMobileFeature(feature); - featureDAO.addFeature(mobileFeature); - AndroidDAOFactory.commitTransaction(); - return true; - } catch (MobileDeviceManagementDAOException e) { - try { - AndroidDAOFactory.rollbackTransaction(); - } catch (MobileDeviceManagementDAOException e1) { - log.warn("Error occurred while roll-backing the transaction", e); - } - throw new DeviceManagementException("Error occurred while adding the feature", e); - } - } - - @Override - public boolean addFeatures(List features) throws DeviceManagementException { - List mobileFeatures = new ArrayList(features.size()); - for (Feature feature : features) { - mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature)); - } - try { - AndroidDAOFactory.beginTransaction(); - featureDAO.addFeatures(mobileFeatures); - AndroidDAOFactory.commitTransaction(); - return true; - } catch (MobileDeviceManagementDAOException e) { - try { - AndroidDAOFactory.rollbackTransaction(); - } catch (MobileDeviceManagementDAOException e1) { - log.warn("Error occurred while roll-backing the transaction", e); - } - throw new DeviceManagementException("Error occurred while adding the features", e); - } - } - - @Override - public Feature getFeature(String name) throws DeviceManagementException { - try { - MobileFeature mobileFeature = featureDAO.getFeatureByCode(name); - Feature feature = MobileDeviceManagementUtil.convertToFeature(mobileFeature); - return feature; - } catch (MobileDeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving the feature", e); - } - } - - @Override - public List getFeatures() throws DeviceManagementException { - try { - List mobileFeatures = featureDAO.getAllFeatures(); - return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect( - Collectors.toList()); - } catch (MobileDeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " + - "Android platform", e); - } - } - - @Override - public List getFeatures(String featureType) throws DeviceManagementException { - if (StringUtils.isEmpty(featureType)) { - return this.getFeatures(); - } - try { - List mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType); - return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect( - Collectors.toList()); - } catch (MobileDeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " + - "Android platform", e); - } - } - - @Override - public List getFeatures(String featureType, boolean isHidden) throws DeviceManagementException { - try { - List mobileFeatures; - if (StringUtils.isNotEmpty(featureType)) { - mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType, isHidden); - } else { - mobileFeatures = featureDAO.getAllFeatures(isHidden); - } - return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect( - Collectors.toList()); - } catch (MobileDeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " + - "Android platform", e); - } - } - - @Override - public boolean removeFeature(String code) throws DeviceManagementException { - boolean status; - try { - AndroidDAOFactory.beginTransaction(); - featureDAO.deleteFeatureByCode(code); - AndroidDAOFactory.commitTransaction(); - status = true; - } catch (MobileDeviceManagementDAOException e) { - try { - AndroidDAOFactory.rollbackTransaction(); - } catch (MobileDeviceManagementDAOException e1) { - log.warn("Error occurred while roll-backing the transaction", e); - } - throw new DeviceManagementException("Error occurred while removing the feature", e); - } - return status; - } - - @Override - public boolean addSupportedFeaturesToDB() throws DeviceManagementException { - synchronized (this) { - List supportedFeatures = getSupportedFeatures(); - List existingFeatures = this.getFeatures(); - List missingFeatures = MobileDeviceManagementUtil. - getMissingFeatures(supportedFeatures, existingFeatures); - if (missingFeatures.size() > 0) { - return this.addFeatures(missingFeatures); - } - return true; - } - } - - //Get the supported feature list. - private static List getSupportedFeatures() { - List supportedFeatures = new ArrayList(); - Feature feature = new Feature(); - feature.setCode("DEVICE_LOCK"); - feature.setName("Device Lock"); - feature.setDescription("Lock the device"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("DEVICE_LOCATION"); - feature.setName("Location"); - feature.setDescription("Request coordinates of device location"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("WIFI"); - feature.setName("wifi"); - feature.setDescription("Setting up wifi configuration"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("CAMERA"); - feature.setName("camera"); - feature.setDescription("Enable or disable camera"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("BACKUP_SERVICE"); - feature.setName("Set Backup Service"); - feature.setDescription("set backup service"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("EMAIL"); - feature.setName("Email"); - feature.setDescription("Configure email settings"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("DEVICE_MUTE"); - feature.setName("mute"); - feature.setDescription("Enable mute in the device"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("DEVICE_INFO"); - feature.setName("Device info"); - feature.setDescription("Request device information"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("ENTERPRISE_WIPE"); - feature.setName("Enterprise Wipe"); - feature.setDescription("Remove enterprise applications"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("CLEAR_PASSWORD"); - feature.setName("Clear Password"); - feature.setDescription("Clear current password"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("WIPE_DATA"); - feature.setName("Wipe Data"); - feature.setDescription("Factory reset the device"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("APPLICATION_LIST"); - feature.setName("Application List"); - feature.setDescription("Request list of current installed applications"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("CHANGE_LOCK_CODE"); - feature.setName("Change Lock-code"); - feature.setDescription("Change current lock code"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("INSTALL_APPLICATION"); - feature.setName("Install App"); - feature.setDescription("Install Enterprise or Market application"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("UNINSTALL_APPLICATION"); - feature.setName("Uninstall App"); - feature.setDescription("Uninstall application"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("BLACKLIST_APPLICATIONS"); - feature.setName("Blacklist app"); - feature.setDescription("Blacklist applications"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("ENCRYPT_STORAGE"); - feature.setName("Encrypt storage"); - feature.setDescription("Encrypt storage"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("DEVICE_RING"); - feature.setName("Ring"); - feature.setDescription("Ring the device"); - supportedFeatures.add(feature); - feature = new Feature(); - feature.setCode("PASSCODE_POLICY"); - feature.setName("Password Policy"); - feature.setDescription("Set passcode policy"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("NOTIFICATION"); - feature.setName("Message"); - feature.setDescription("Send message"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DEVICE_REBOOT"); - feature.setName("Reboot"); - feature.setDescription("Reboot the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("CHANGE_LOCK_TASK_MODE"); - feature.setName("Change LockTask Mode"); - feature.setDescription("Enable or disable LockTask mode of KIOSK device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("UPGRADE_FIRMWARE"); - feature.setName("Upgrade Firmware"); - feature.setDescription("Upgrade Firmware"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("VPN"); - feature.setName("Configure VPN"); - feature.setDescription("Configure VPN settings"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_ADJUST_VOLUME"); - feature.setName("Adjust Volume"); - feature.setDescription("allow or disallow user to change volume"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CONFIG_BLUETOOTH"); - feature.setName("Disallow bluetooth configuration"); - feature.setDescription("allow or disallow user to change bluetooth configurations"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CONFIG_CELL_BROADCASTS"); - feature.setName("Disallow cell broadcast configuration"); - feature.setDescription("allow or disallow user to change cell broadcast configurations"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CONFIG_CREDENTIALS"); - feature.setName("Disallow credential configuration"); - feature.setDescription("allow or disallow user to change user credentials"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CONFIG_MOBILE_NETWORKS"); - feature.setName("Disallow mobile network configure"); - feature.setDescription("allow or disallow user to change mobile networks configurations"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CONFIG_TETHERING"); - feature.setName("Disallow tethering configuration"); - feature.setDescription("allow or disallow user to change tethering configurations"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CONFIG_VPN"); - feature.setName("Disallow VPN configuration"); - feature.setDescription("allow or disallow user to change VPN configurations"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CONFIG_WIFI"); - feature.setName("Disallow WIFI configuration"); - feature.setDescription("allow or disallow user to change WIFI configurations"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_APPS_CONTROL"); - feature.setName("Disallow APP control configuration"); - feature.setDescription("allow or disallow user to change app control"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CREATE_WINDOWS"); - feature.setName("Disallow window creation"); - feature.setDescription("allow or disallow window creation"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_APPS_CONTROL"); - feature.setName("Disallow APP control configuration"); - feature.setDescription("allow or disallow user to change app control configurations"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_CROSS_PROFILE_COPY_PASTE"); - feature.setName("Disallow cross profile copy paste"); - feature.setDescription("allow or disallow cross profile copy paste"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_DEBUGGING_FEATURES"); - feature.setName("Disallow debugging features"); - feature.setDescription("allow or disallow debugging features"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_FACTORY_RESET"); - feature.setName("Disallow factory reset"); - feature.setDescription("allow or disallow factory reset"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_ADD_USER"); - feature.setName("Disallow add user"); - feature.setDescription("allow or disallow add user"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_INSTALL_APPS"); - feature.setName("Disallow install apps"); - feature.setDescription("allow or disallow install apps"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_INSTALL_UNKNOWN_SOURCES"); - feature.setName("Disallow install unknown sources"); - feature.setDescription("allow or disallow install unknown sources"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_MODIFY_ACCOUNTS"); - feature.setName("Disallow modify account"); - feature.setDescription("allow or disallow modify account"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_MOUNT_PHYSICAL_MEDIA"); - feature.setName("Disallow mount physical media"); - feature.setDescription("allow or disallow mount physical media."); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_NETWORK_RESET"); - feature.setName("Disallow network reset"); - feature.setDescription("allow or disallow network reset"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_OUTGOING_BEAM"); - feature.setName("Disallow outgoing beam"); - feature.setDescription("allow or disallow outgoing beam."); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_OUTGOING_CALLS"); - feature.setName("Disallow outgoing calls"); - feature.setDescription("allow or disallow outgoing calls"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_REMOVE_USER"); - feature.setName("Disallow remove users"); - feature.setDescription("allow or disallow remove users"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_SAFE_BOOT"); - feature.setName("Disallow safe boot"); - feature.setDescription("allow or disallow safe boot"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_SHARE_LOCATION"); - feature.setName("Disallow share location"); - feature.setDescription("allow or disallow share location."); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_SMS"); - feature.setName("Disallow sms"); - feature.setDescription("allow or disallow sms"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_UNINSTALL_APPS"); - feature.setName("Disallow uninstall app"); - feature.setDescription("allow or disallow uninstall app"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_UNMUTE_MICROPHONE"); - feature.setName("Disallow unmute mic"); - feature.setDescription("allow or disallow unmute mic"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_USB_FILE_TRANSFER"); - feature.setName("Disallow usb file transfer"); - feature.setDescription("allow or disallow usb file transfer"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("ALLOW_PARENT_PROFILE_APP_LINKING"); - feature.setName("Disallow parent profile app linking"); - feature.setDescription("allow or disallow parent profile app linking"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("ENSURE_VERIFY_APPS"); - feature.setName("Disallow ensure verify apps"); - feature.setDescription("allow or disallow ensure verify apps"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("AUTO_TIME"); - feature.setName("Allow auto timing"); - feature.setDescription("allow or disallow auto timing"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("REMOVE_DEVICE_OWNER"); - feature.setName("Remove device owner"); - feature.setDescription("remove device owner"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("LOGCAT"); - feature.setName("Fetch Logcat"); - feature.setDescription("Fetch device logcat"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DEVICE_UNLOCK"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_SET_WALLPAPER"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_SET_USER_ICON"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_REMOVE_MANAGEMENT_PROFILE"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_AUTOFILL"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_BLUETOOTH"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_BLUETOOTH_SHARING"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_REMOVE_USER"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - feature = new Feature(); - feature.setCode("DISALLOW_DATA_ROAMING"); - feature.setName("Device Unlock"); - feature.setDescription("Unlock the device"); - supportedFeatures.add(feature); - - return supportedFeatures; - } -} \ No newline at end of file