The company is taking $19.5 billion in charges related to its EV investments as it tries to follow consumer trends.