-
+
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js
index 9b5370de6..5e0c71ac4 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js
@@ -114,7 +114,9 @@ var androidOperationConstants = {
"WIFI_OPERATION": "wifi",
"WIFI_OPERATION_CODE": "WIFI",
"APPLICATION_OPERATION":"app-restriction",
- "APPLICATION_OPERATION_CODE":"APP-RESTRICTION"
+ "APPLICATION_OPERATION_CODE":"APP-RESTRICTION",
+ "KIOSK_APPS_CODE":"KIOSK_APPS",
+ "KIOSK_APPS":"cosu-whitelisted-applications"
};
// Constants to define Android Operation Constants
@@ -491,6 +493,93 @@ validateStep["policy-profile"] = function () {
validationStatusArray.push(validationStatus);
+ }
+ if ($.inArray(androidOperationConstants["KIOSK_APPS_CODE"], configuredOperations) != -1) {
+ //If COSU whitelisting applications configured
+ operation = androidOperationConstants["KIOSK_APPS"];
+ // Initializing continueToCheckNextInputs to true
+ continueToCheckNextInputs = true;
+
+ var whitelistedApplicationsGridChildInputs = "div#cosu-whitelisted-applications .child-input";
+
+ if (continueToCheckNextInputs) {
+ if ($(whitelistedApplicationsGridChildInputs).length == 0) {
+ validationStatus = {
+ "error": true,
+ "subErrorMsg": "Applications are not provided in application whitelist list.",
+ "erroneousFeature": operation
+ };
+ continueToCheckNextInputs = false;
+ }
+ else {
+ childInputCount = 0;
+ childInputArray = [];
+ emptyChildInputCount = 0;
+ duplicatesExist = false;
+ // Looping through each child input
+ $(whitelistedApplicationsGridChildInputs).each(function () {
+ childInputCount++;
+ if (childInputCount % 2 == 0) {
+ // If child input is of second column
+ childInput = $(this).val();
+ childInputArray.push(childInput);
+ // Updating emptyChildInputCount
+ if (!childInput) {
+ // If child input field is empty
+ emptyChildInputCount++;
+ }
+ }
+ });
+ // Checking for duplicates
+ initialChildInputArrayLength = childInputArray.length;
+ if (emptyChildInputCount == 0 && initialChildInputArrayLength > 1) {
+ for (m = 0; m < (initialChildInputArrayLength - 1); m++) {
+ poppedChildInput = childInputArray.pop();
+ for (n = 0; n < childInputArray.length; n++) {
+ if (poppedChildInput == childInputArray[n]) {
+ duplicatesExist = true;
+ break;
+ }
+ }
+ if (duplicatesExist) {
+ break;
+ }
+ }
+ }
+ // Updating validationStatus
+ if (emptyChildInputCount > 0) {
+ // If empty child inputs are present
+ validationStatus = {
+ "error": true,
+ "subErrorMsg": "One or more package names of " +
+ "applications are empty.",
+ "erroneousFeature": operation
+ };
+ continueToCheckNextInputs = false;
+ } else if (duplicatesExist) {
+ // If duplicate input is present
+ validationStatus = {
+ "error": true,
+ "subErrorMsg": "Duplicate values exist with " +
+ "for package names.",
+ "erroneousFeature": operation
+ };
+ continueToCheckNextInputs = false;
+ }
+
+ }
+ }
+
+ if (continueToCheckNextInputs) {
+ validationStatus = {
+ "error": false,
+ "okFeature": operation
+ };
+ }
+
+ // Updating validationStatusArray with validationStatus
+ validationStatusArray.push(validationStatus);
+
}
}
} if (policy["platform"] == platformTypeConstants["WINDOWS"]) {
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-android.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-android.hbs
index 55f8e4859..73b101873 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-android.hbs
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-android.hbs
@@ -57,17 +57,6 @@
-
-
-
-
-
- COSU Configuration
-
-
-
-
-
@@ -106,14 +95,14 @@
-
+
Whitelist Apps (COSU)
-
-
-
+
+
+
@@ -1469,14 +1458,14 @@