Lock ordering bug. The fix is to avoid having to hold both locks simultaneously in one prong of the deadlock. (Further strengthening: the code path for potentially acquiring both simultaneously now begins at a common method, ensuring that lock ordering is always consistent.) Change-Id: If9433aff8326fec2ba0e97e96ad2d835b01e2cda