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 f264830e84..ec06c25f6f 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,92 @@
+
+
+
+ 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 5d75b35d91..e204ef96a2 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_PACKAGE_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-admin-component").val(config.value);
+ } else if (config.name === kioskConfigs["wifiSSID"]) {
+ $("input#android-kiosk-config-wifi-ssid").val(config.value);
+ } else if (config.name === kioskConfigs["wifiPassword"]) {
+ $("input#android-kiosk-config-wifi-password").val(config.value);
+ } else if (config.name === kioskConfigs["checksum"]) {
+ $("input#android-kiosk-config-checksum").val(config.value);
+ } else if (config.name === kioskConfigs["downloadURL"]) {
+ $("input#android-kiosk-config-download-url").val(config.value);
+ } else if (config.name === kioskConfigs["skipEncryption"]) {
+ $("#android-kiosk-config-encryption").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-admin-component").val();
+ var checksum = $("input#android-kiosk-config-checksum").val();
+ var downloadUrl = $("input#android-kiosk-config-download-url").val();
+ var wifiSSID = $("input#android-kiosk-config-wifi-ssid").val();
+ var wifiPassword = $("input#android-kiosk-config-wifi-password").val();
+ var encryption = $("#android-kiosk-config-encryption").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 6375247c8c..33740e0beb 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,17 @@ 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_PACKAGE_CHECKSUM",
+ "downloadURL" : "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION",
+ "androidExtra" : "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE",
+ "accessToken" : "android.app.extra.token"
+};
+
/*
* set popup maximum height function.
*/
@@ -72,6 +83,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 +419,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 422f31e3d5..75673b597a 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 8d0ff38b3e..8c872ae1a9 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 {