An off-duty police officer who was bashed in Sydney's inner west remains in a serious condition as two men allegedly involved in the attack have been charged.