Merge "Rewrite battery history storage."