@Override
public Object run() {
checkValid();
checkRoot();
State state = target.getState();
if (EnumSet.of(State.UNINSTALLED).contains(state))
return null;
else if (EnumSet.of(State.INSTALL_FAILED, State.INSTALLING, State.RESOLVING, State.STARTING, State.STOPPING, State.UNINSTALLING).contains(state)) {
waitForStateChange();
target.uninstall();
}
else if (state.equals(State.ACTIVE)) {
new StopAction(requestor, target, disableRootCheck).run();
target.uninstall();
}
else
ResourceUninstaller.newInstance(requestor, target).uninstall();