Merge branch 'application-mgt-new' into 'application-mgt-new'

Fix app uninstall issue for Android

See merge request entgra/carbon-device-mgt!301
feature/appm-store/pbac
Dharmakeerthi Lasantha 5 years ago
commit c859ff9611

@ -686,6 +686,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return MDMAndroidOperationUtil.createInstallAppOperation(app);
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
app.setType(mobileAppType);
app.setAppIdentifier(application.getPackageName());
return MDMAndroidOperationUtil.createAppUninstallOperation(app);
} else {
String msg = "Invalid Action is found. Action: " + action;
@ -706,44 +707,20 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
app.setProperties(properties);
return MDMIOSOperationUtil.createInstallAppOperation(app);
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
app.setType(mobileAppType);
app.setAppIdentifier(application.getPackageName());
return MDMIOSOperationUtil.createAppUninstallOperation(app);
} else {
String msg = "Invalid Action is found. Action: " + action;
log.error(msg);
throw new ApplicationManagementException(msg);
}
} else {
if (ApplicationType.CUSTOM.toString().equalsIgnoreCase(application.getType())) {
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
ProfileOperation operation = new ProfileOperation();
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_INSTALL_APPLICATION);
operation.setType(Operation.Type.PROFILE);
CustomApplication customApplication = new CustomApplication();
customApplication.setType(application.getType());
customApplication.setUrl(application.getApplicationReleases().get(0).getInstallerPath());
operation.setPayLoad(customApplication.toJSON());
return operation;
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
ProfileOperation operation = new ProfileOperation();
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_UNINSTALL_APPLICATION);
operation.setType(Operation.Type.PROFILE);
CustomApplication customApplication = new CustomApplication();
customApplication.setType(application.getType());
//todo get application package name and set
operation.setPayLoad(customApplication.toJSON());
return MDMAndroidOperationUtil.createAppUninstallOperation(app);
} else {
String msg = "Invalid Action is found. Action: " + action;
log.error(msg);
throw new ApplicationManagementException(msg);
}
} else {
String msg = "Invalid device type is found. Device Type: " + deviceType;
log.error(msg);
throw new ApplicationManagementException(msg);
}
}
}
} catch (UnknownApplicationTypeException e) {
String msg = "Unknown Application type is found.";
log.error(msg, e);

Loading…
Cancel
Save