The smartphone maker has agreed to a takeover bid, but its struggles are far from over.