Fix app uninstall issue for Android

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent a2bcc1c03f
commit 16ee8ec882

@ -686,6 +686,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return MDMAndroidOperationUtil.createInstallAppOperation(app); return MDMAndroidOperationUtil.createInstallAppOperation(app);
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
app.setType(mobileAppType); app.setType(mobileAppType);
app.setAppIdentifier(application.getPackageName());
return MDMAndroidOperationUtil.createAppUninstallOperation(app); return MDMAndroidOperationUtil.createAppUninstallOperation(app);
} else { } else {
String msg = "Invalid Action is found. Action: " + action; String msg = "Invalid Action is found. Action: " + action;
@ -706,6 +707,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
app.setProperties(properties); app.setProperties(properties);
return MDMIOSOperationUtil.createInstallAppOperation(app); return MDMIOSOperationUtil.createInstallAppOperation(app);
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
app.setType(mobileAppType);
app.setAppIdentifier(application.getPackageName());
return MDMIOSOperationUtil.createAppUninstallOperation(app); return MDMIOSOperationUtil.createAppUninstallOperation(app);
} else { } else {
String msg = "Invalid Action is found. Action: " + action; String msg = "Invalid Action is found. Action: " + action;
@ -713,35 +716,9 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg);
} }
} else { } else {
if (ApplicationType.CUSTOM.toString().equalsIgnoreCase(application.getType())) { String msg = "Invalid device type is found. Device Type: " + deviceType;
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { log.error(msg);
ProfileOperation operation = new ProfileOperation(); throw new ApplicationManagementException(msg);
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) { } catch (UnknownApplicationTypeException e) {

Loading…
Cancel
Save