Refactor confirmation logic
Shouldn't change behavior.
Split from I8205bb6.
Bug: T299394 Change-Id: I32876939d4f61c3be8e756c6eba6f74ea98c11f1