Invalidate when switching to new consumer

- When switching to a new consumer, also invalidate the handler to
  clean up references held by that handler
- Also make sure that we calculate the task index used for logging
  prior to starting the task view since the handler can be invalidated
  between starting the activity and the callback happening

Bug: 185909226
Test: Presubmit
Change-Id: I20e06b5a6b31a5e242c6fc840bf4f215797eb12c
1 file changed