From 807c8649481038bacbabc3de4e424a23710f09ba Mon Sep 17 00:00:00 2001 From: "tcdlpds@gmail.com" Date: Sat, 15 Feb 2020 03:24:14 +0530 Subject: [PATCH 1/2] Improve Android enrollment QR code generating logic --- .../android/core/impl/DeviceTypeCommonServiceImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/DeviceTypeCommonServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/DeviceTypeCommonServiceImpl.java index 03726cbf6..c3b16e75e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/DeviceTypeCommonServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/DeviceTypeCommonServiceImpl.java @@ -72,10 +72,6 @@ public class DeviceTypeCommonServiceImpl implements DeviceTypeCommonService { } for (ConfigurationEntry configEntry : platformConfiguration.getConfiguration()) { - if (AndroidConstants.PlatformConfigs.DefaultConfigs.DEFAULT_OWNERSHIP.equals(configEntry.getName())) { - defaultQREnrollmentPayload - .put(AndroidConstants.PlatformConfigs.DefaultConfigs.DEFAULT_OWNERSHIP, configEntry.getValue()); - } if (AndroidConstants.PlatformConfigs.DefaultConfigs.SERVER_IP.equals(configEntry.getName())) { defaultQREnrollmentPayload .put(AndroidConstants.PlatformConfigs.DefaultConfigs.SERVER_IP, configEntry.getValue()); @@ -110,6 +106,8 @@ public class DeviceTypeCommonServiceImpl implements DeviceTypeCommonService { } + defaultQREnrollmentPayload + .put(AndroidConstants.PlatformConfigs.DefaultConfigs.DEFAULT_OWNERSHIP, ownershipType.toUpperCase()); defaultQREnrollmentPayload.put(AndroidConstants.PlatformConfigs.DefaultConfigs.ACCESS_TOKEN, accessToken); qrEnrollmentPayload .put(AndroidConstants.PlatformConfigs.KioskConfigs.ANDROID_EXTRA, defaultQREnrollmentPayload); From 1cb1e1e76013477e6c2fd22877033a9221588f28 Mon Sep 17 00:00:00 2001 From: "tcdlpds@gmail.com" Date: Sat, 15 Feb 2020 04:15:58 +0530 Subject: [PATCH 2/2] Fix build failure --- .../DeviceManagementProviderServiceMock.java | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceManagementProviderServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceManagementProviderServiceMock.java index b23956885..630baf822 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceManagementProviderServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceManagementProviderServiceMock.java @@ -45,6 +45,7 @@ import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.StartupOperationConfig; +import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration; @@ -179,7 +180,8 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv return null; } - @Override public Device getDevice(DeviceData deviceData, boolean b) throws DeviceManagementException { + @Override + public Device getDevice(DeviceData deviceData, boolean b) throws DeviceManagementException { return null; } @@ -541,12 +543,14 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv return null; } - @Override public List getFilteredActivities(String operationCode, int limit, int offset) + @Override + public List getFilteredActivities(String operationCode, int limit, int offset) throws OperationManagementException { return null; } - @Override public int getTotalCountOfFilteredActivities(String operationCode) throws OperationManagementException { + @Override + public int getTotalCountOfFilteredActivities(String operationCode) throws OperationManagementException { return 0; } @@ -670,33 +674,40 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv return false; } - @Override public boolean addDeviceTypeVersion(DeviceTypeVersion deviceTypeVersion) + @Override + public boolean addDeviceTypeVersion(DeviceTypeVersion deviceTypeVersion) throws DeviceManagementException { return false; } - @Override public List getDeviceTypeVersions(String s) throws DeviceManagementException { + @Override + public List getDeviceTypeVersions(String s) throws DeviceManagementException { return null; } - @Override public boolean updateDeviceTypeVersion(DeviceTypeVersion deviceTypeVersion) + @Override + public boolean updateDeviceTypeVersion(DeviceTypeVersion deviceTypeVersion) throws DeviceManagementException { return false; } - @Override public boolean isDeviceTypeVersionChangeAuthorized(String s, String s1) throws DeviceManagementException { + @Override + public boolean isDeviceTypeVersionChangeAuthorized(String s, String s1) throws DeviceManagementException { return false; } - @Override public DeviceTypeVersion getDeviceTypeVersion(String s, String s1) throws DeviceManagementException { + @Override + public DeviceTypeVersion getDeviceTypeVersion(String s, String s1) throws DeviceManagementException { return null; } - @Override public boolean deleteDeviceTypeVersions(DeviceType deviceType) throws DeviceManagementException { + @Override + public boolean deleteDeviceTypeVersions(DeviceType deviceType) throws DeviceManagementException { return false; } - @Override public void disEnrollDevices(List list) throws DeviceManagementException { + @Override + public void disEnrollDevices(List list) throws DeviceManagementException { } @@ -719,11 +730,26 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv return null; } - @Override public PaginationResult getAppSubscribedDevices(int i, int i1, List list, String s) + @Override + public PaginationResult getAppSubscribedDevices(int i, int i1, List list, String s) throws DeviceManagementException { return null; } @Override - public boolean deleteDevices(List deviceIdentifiers) throws DeviceManagementException, InvalidDeviceException {return false;} + public PaginationResult getApplications(PaginationRequest paginationRequest) + throws ApplicationManagementException, DeviceTypeNotFoundException { + return null; + } + + @Override + public List getAppVersions(String s) throws ApplicationManagementException { + return null; + } + + @Override + public boolean deleteDevices(List deviceIdentifiers) + throws DeviceManagementException, InvalidDeviceException { + return false; + } }