Flush the bucket before creating a partial bucket.

- this is consistent with what we do in onConditionChanged, we first
call flushBucketIfNecessary and then pull the data
- fixed a bug when partial bucket is not created and previous full
bucket is dropped

There are lots of tests changed because the bucket is now flushed after
onDataPulled. Also the interval value/base change because of the flush
so the value has already become the base and the intervals have been
trimmed.

Test: atest statsd_test
Bug: 123985255
Change-Id: Ia1b07106656c1fb12e3d761c69998cde86d72239
3 files changed