Restore cached timestamp correctly
Bug: 33751444 When reinitializing the calculator after restarting in RESULT state, we were reconstructing the last history entry from the main expression, without correctly restoring the timestamp. Instead read the expression, together with its timestamp, from the database. Correctly distinguish between result-already-saved and result-not-yet-saved states when evaluation completes. There may be very odd cases in which we generate an error the first time, setting the state to INIT, and successfully evaluate the second time (because we need less precision) that the old logic didn't handle. And testing for INIT_FOR_RESULT is cleaner anyway. (We can still, under very weird conditions, put expressions in the history that generate an error after evaluating correctly the first time. We should be robust against that already.) Add a couple of comments that would have made this easier to track down. Change-Id: I85756cca5d8fb76b2cbeb9ed32a788ae71b6d65e
Loading
Please register or sign in to comment