Tim Cook has not been afraid to confront the government on issues he considers morally important.