The two biggest phone makers are having to adapt to stalling sales and unstinting competition from China