Merge dup code at thread entry and param change

This CL is mostly just cleanup, but there are a couple of fixes marked
"FIX" below.

Merge the duplicate code that was at the beginning of threadLoop() and
after a parameter change.  cacheParameters_l() is now called at entry to
threadLoop() and after any parameter change.  It re-calculates all values
that are derived from parameters, and caches them in instance variables.

updateWaitTime_l():
 - FIX activeSleepTime depends on mWaitTimeMs, which was initially set
   to infinity.  updateWaitTime_l() was not called at entry to
   threadLoop(), so activeSleepTime was not set correctly before the
   first parameter change.

 - FIX reversed the order of calls after parameter change
   for the same reason so that updateWaitTime_l() is called before
   calculating values that are derived from wait time.

 - marked it private since now it's only called from DuplicatingThread

Change-Id: If2607d2ed66c6893d910433e48208a93c41fb7e9
2 files changed