Use a ViewState to preserve refinement state

Refinement manager keeps its own state across config changes so that it
can receive callbacks on the ResultReceiver. ChooserActivity can watch
for the state of refinement completion and launch the refined TargetInfo
if refinement succeeds, otherwise just finish().

If onResume happens when refinement is in progress, ChooserActivity will
finish, as this is expected to be abandonment of the refinement process
without a result. But, onResume also happens during a config change
during refinement, and the activity must not finish in those cases. The
logic for this is contained within ChooserRefinementManager, with
ChooserActivity only needing to pass along a couple of lifecycle events.

Add a bunch of test coverage to new and old functionality.

Also fix some kotlin nullability errors in TargetInfo tests that sysui
studio was complaining about.

Bug: 279514914
Test: atest ChooserRefinementManagerTest
Test: manually test the refinement flow in Photos, both completing and
      cancelling the process, rotating at various points.
Change-Id: I2b22155894e29b062c78b4af20e8fe0683d40bea
5 files changed