Relands https://github.com/flutter/engine/pull/46440 with https://github.com/flutter/engine/pull/46842