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.platform.configuration/configuration.hbs 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.platform.configuration/configuration.hbs
index f264830e8..d37490287 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.platform.configuration/configuration.hbs
+++ 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.platform.configuration/configuration.hbs
@@ -71,6 +71,93 @@
+
+
+
+ Android KIOSK Provisioning Configs
+
+
+
+
+
+
+
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.platform.configuration/public/js/platform-configuration.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.platform.configuration/public/js/platform-configuration.js
index 5d75b35d9..f95947189 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.platform.configuration/public/js/platform-configuration.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.platform.configuration/public/js/platform-configuration.js
@@ -80,6 +80,15 @@ var configParams = {
"IOS_CONFIG_APNS_MODE": "iOSConfigAPNSMode"
};
+var kioskConfigs = {
+ "adminComponentName" : "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME",
+ "wifiSSID" : "android.app.extra.PROVISIONING_WIFI_SSID",
+ "wifiPassword" : "android.app.extra.PROVISIONING_WIFI_PASSWORD",
+ "skipEncryption" : "android.app.extra.PROVISIONING_SKIP_ENCRYPTION",
+ "checksum" : "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM",
+ "downloadURL" : "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION"
+};
+
$(document).ready(function () {
$("#fcm-inputs").hide();
tinymce.init({
@@ -111,21 +120,33 @@ $(document).ready(function () {
if (data != null && data.configuration != null) {
for (var i = 0; i < data.configuration.length; i++) {
var config = data.configuration[i];
- if (config.name == configParams["NOTIFIER_TYPE"]) {
+ if (config.name === configParams["NOTIFIER_TYPE"]) {
$("#android-config-notifier").val(config.value);
- if (config.value != notifierTypeConstants["FCM"]) {
+ if (config.value !== notifierTypeConstants["FCM"]) {
$("#fcm-inputs").hide();
$("#local-inputs").show();
} else {
$("#fcm-inputs").show();
$("#local-inputs").hide();
}
- } else if (config.name == configParams["NOTIFIER_FREQUENCY"]) {
+ } else if (config.name === configParams["NOTIFIER_FREQUENCY"]) {
$("input#android-config-notifier-frequency").val(config.value / 1000);
- } else if (config.name == configParams["FCM_API_KEY"]) {
+ } else if (config.name === configParams["FCM_API_KEY"]) {
$("input#android-config-fcm-api-key").val(config.value);
- } else if (config.name == configParams["ANDROID_EULA"]) {
+ } else if (config.name === configParams["ANDROID_EULA"]) {
$("#android-eula").val(config.value);
+ } else if (config.name === kioskConfigs["adminComponentName"]) {
+ $("input#android-kiosk-config-1").val(config.value);
+ } else if (config.name === kioskConfigs["wifiSSID"]) {
+ $("input#android-kiosk-config-2").val(config.value);
+ } else if (config.name === kioskConfigs["wifiPassword"]) {
+ $("input#android-kiosk-config-3").val(config.value);
+ } else if (config.name === kioskConfigs["checksum"]) {
+ $("input#android-kiosk-config-4").val(config.value);
+ } else if (config.name === kioskConfigs["downloadURL"]) {
+ $("input#android-kiosk-config-5").val(config.value);
+ } else if (config.name === kioskConfigs["skipEncryption"]) {
+ $("#android-kiosk-config-6").val(config.value);
}
}
}
@@ -161,13 +182,22 @@ $(document).ready(function () {
var androidLicense = tinyMCE.activeEditor.getContent();
var errorMsgWrapper = "#android-config-error-msg";
var errorMsg = "#android-config-error-msg span";
- if (notifierType == notifierTypeConstants["LOCAL"] && !notifierFrequency) {
+
+ // KIOSK configs
+ var adminComponentName = $("input#android-kiosk-config-1").val();
+ var checksum = $("input#android-kiosk-config-2").val();
+ var downloadUrl = $("input#android-kiosk-config-3").val();
+ var wifiSSID = $("input#android-kiosk-config-4").val();
+ var wifiPassword = $("input#android-kiosk-config-5").val();
+ var encryption = $("#android-kiosk-config-6").find("option:selected").attr("value");
+
+ if (notifierType === notifierTypeConstants["LOCAL"] && !notifierFrequency) {
$(errorMsg).text("Notifier frequency is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
- } else if (notifierType == notifierTypeConstants["LOCAL"] && !isPositiveInteger(notifierFrequency)) {
+ } else if (notifierType === notifierTypeConstants["LOCAL"] && !isPositiveInteger(notifierFrequency)) {
$(errorMsg).text("Provided notifier frequency is invalid. ");
$(errorMsgWrapper).removeClass("hidden");
- } else if (notifierType == notifierTypeConstants["FCM"] && !fcmAPIKey) {
+ } else if (notifierType === notifierTypeConstants["FCM"] && !fcmAPIKey) {
$(errorMsg).text("FCM API Key is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else {
@@ -205,10 +235,54 @@ $(document).ready(function () {
"contentType": "text"
};
+ var kioskAdminComponent = {
+ "name": kioskConfigs["adminComponentName"],
+ "value": adminComponentName,
+ "contentType": "text"
+ };
+
+ var kioskChecksum = {
+ "name": kioskConfigs["checksum"],
+ "value": checksum,
+ "contentType": "text"
+ };
+
+ var kioskDownloadURL = {
+ "name": kioskConfigs["downloadURL"],
+ "value": downloadUrl,
+ "contentType": "text"
+ };
+
+ var kioskWifiSSID = {
+ "name": kioskConfigs["wifiSSID"],
+ "value": wifiSSID,
+ "contentType": "text"
+ };
+
+ var kioskWifiPassword = {
+ "name": kioskConfigs["wifiPassword"],
+ "value": wifiPassword,
+ "contentType": "text"
+ };
+
+ var kioskEncryption = {
+ "name": kioskConfigs["skipEncryption"],
+ "value": encryption,
+ "contentType": "text"
+ };
+
configList.push(type);
configList.push(frequency);
configList.push(androidEula);
- if (notifierType == notifierTypeConstants["FCM"]) {
+
+ configList.push(kioskAdminComponent);
+ configList.push(kioskChecksum);
+ configList.push(kioskDownloadURL);
+ configList.push(kioskEncryption);
+ configList.push(kioskWifiSSID);
+ configList.push(kioskWifiPassword);
+
+ if (notifierType === notifierTypeConstants["FCM"]) {
configList.push(fcmKey);
configList.push(fcmId);
}
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/public/js/type-view.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.type-view/public/js/type-view.js
index 6375247c8..672d0b112 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/public/js/type-view.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.type-view/public/js/type-view.js
@@ -31,6 +31,15 @@ var backendEndBasePath = "/api/device-mgt/v1.0";
// });
//}
+var kioskConfigs = {
+ "adminComponentName" : "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME",
+ "wifiSSID" : "android.app.extra.PROVISIONING_WIFI_SSID",
+ "wifiPassword" : "android.app.extra.PROVISIONING_WIFI_PASSWORD",
+ "skipEncryption" : "android.app.extra.PROVISIONING_SKIP_ENCRYPTION",
+ "checksum" : "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM",
+ "downloadURL" : "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION"
+};
+
/*
* set popup maximum height function.
*/
@@ -72,6 +81,63 @@ function generateQRCode(qrCodeClass) {
});
}
+/*
+ * QR-code generation function for KIOSK.
+ */
+function generateKIOSKQRCode(qrCodeClass) {
+
+ var androidConfigAPI = "/api/device-mgt/android/v1.0/configuration";
+ var payload = {};
+
+ var isKioskConfigured = false;
+
+ invokerUtil.get(
+ androidConfigAPI,
+ function (data) {
+ data = JSON.parse(data);
+ if (data != null && data.configuration != null) {
+ for (var i = 0; i < data.configuration.length; i++) {
+ var config = data.configuration[i];
+
+ if (config.name === kioskConfigs["adminComponentName"]) {
+ isKioskConfigured = true;
+ payload[config.name] = config.value;
+ } else if (config.name === kioskConfigs["wifiSSID"]) {
+ payload[config.name] = config.value;
+ } else if (config.name === kioskConfigs["wifiPassword"]) {
+ payload[config.name] = config.value;
+ } else if (config.name === kioskConfigs["checksum"]) {
+ payload[config.name] = config.value;
+ } else if (config.name === kioskConfigs["downloadURL"]) {
+ payload[config.name] = config.value;
+ } else if (config.name === kioskConfigs["skipEncryption"]) {
+ payload[config.name] = Boolean(config.value);
+ }
+ }
+ }
+ }, function (data) {
+ console.log(data);
+ });
+
+ var aToken = $(".a-token");
+ var tokenPair = aToken.data("atoken");
+
+ var accessToken = {};
+ accessToken[kioskConfigs["accessToken"]] = tokenPair["accessToken"];
+ payload[kioskConfigs["androidExtra"]] = accessToken;
+
+ if (isKioskConfigured) {
+ $(qrCodeClass).qrcode({
+ text: JSON.stringify(payload),
+ width: 300,
+ height: 300
+ });
+ } else {
+ $("#kiosk_heading").hide();
+ $("#kiosk_content").hide();
+ }
+}
+
function toggleEnrollment() {
$(".modal-content").html($("#qr-code-modal").html());
generateQRCode(".modal-content .qr-code");
@@ -351,6 +417,7 @@ $(document).ready(function () {
$.sidebar_toggle();
generateQRCode(".enrollment-qr-container");
+ generateKIOSKQRCode(".kiosk-enrollment-qr-container");
if (typeof $.fn.collapse == 'function') {
$('.navbar-collapse.tiles').on('shown.bs.collapse', function () {
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/type-view.hbs 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/type-view.hbs
index 422f31e3d..75673b597 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/type-view.hbs
+++ 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/type-view.hbs
@@ -207,6 +207,22 @@
{{/if}}
+
+
+
PROVISION YOUR KIOSK DEVICE
+
+
+
+
+
+
+
+
+
Scan to provision the KIOSK device
+
+
+
+
{{#zone "topCss"}}
{{css "css/styles.css"}}
{{/zone}}
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/type-view.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.type-view/type-view.js
index 8d0ff38b3..8c872ae1a 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/type-view.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.type-view/type-view.js
@@ -23,6 +23,7 @@ function onRequest(context) {
viewModel["isVirtual"] = request.getParameter("type") == 'virtual';
viewModel["isCloud"] = isCloud;
viewModel["hostName"] = devicemgtProps["httpsURL"];
+ viewModel["accessToken"] = session.get("tokenPair");
if (isCloud) {
viewModel["enrollmentURL"] = "https://play.google.com/store/apps/details?id=org.wso2.iot.agent";
} else {