From c9c4d7a64b0df4ea1ecd52a75a66f8b414cf2da8 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 6 Jun 2019 22:12:06 +0530 Subject: [PATCH] Android enterpise app install payload creation --- .../src/main/webapp/WEB-INF/web.xml | 19 ++++++++++--------- .../core/impl/SubscriptionManagerImpl.java | 3 +++ .../core/util/MDMAndroidOperationUtil.java | 4 +++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml index 63d4e111fc..15677f5277 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -47,15 +47,16 @@ - - - ApplicationMgt-Admin - /* - - - CONFIDENTIAL - - + + + + + + + + + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 13a7b2336c..8d0b07e007 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -50,6 +50,7 @@ import org.wso2.carbon.device.application.mgt.core.util.HelperUtil; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.app.mgt.MobileApp; +import org.wso2.carbon.device.mgt.common.app.mgt.MobileAppTypes; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.exceptions.UnknownApplicationTypeException; @@ -460,6 +461,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { MobileApp mobileApp = new MobileApp(); if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { + mobileApp.setType(MobileAppTypes.ENTERPRISE); + mobileApp.setLocation(application.getApplicationReleases().get(0).getInstallerPath()); return MDMAndroidOperationUtil.createInstallAppOperation(mobileApp); } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { return MDMAndroidOperationUtil.createAppUninstallOperation(mobileApp); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java index 85d3cb573d..2f73db6357 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -51,7 +51,9 @@ public class MDMAndroidOperationUtil { EnterpriseApplication enterpriseApplication = new EnterpriseApplication(); enterpriseApplication.setType(application.getType().toString()); - enterpriseApplication.setUrl(application.getLocation()); + //TODO: replace needs to be removed after doing the proper config update in application-mgt.xml + enterpriseApplication.setUrl(application.getLocation().replace("https://localhost:9443", + "http://192.168.8.6:9763")); operation.setPayLoad(enterpriseApplication.toJSON()); break; case PUBLIC: