blob: e610fd75772314fc4a9e5ca101ce798b8830171d [file] [log] [blame]
Yao Chenab273e22017-09-06 12:53:50 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Yao Chenb3561512017-11-21 18:07:17 -080017#define DEBUG true // STOPSHIP if true
Joe Onorato9fc9edf2017-10-15 20:08:52 -070018#include "Log.h"
David Chen21582962017-11-01 17:32:46 -070019#include "statslog.h"
Yao Chenab273e22017-09-06 12:53:50 -070020
yro947fbce2017-11-15 22:50:23 -080021#include <android-base/file.h>
22#include <dirent.h>
Joe Onorato9fc9edf2017-10-15 20:08:52 -070023#include "StatsLogProcessor.h"
yro947fbce2017-11-15 22:50:23 -080024#include "android-base/stringprintf.h"
Yao Chenb3561512017-11-21 18:07:17 -080025#include "guardrail/StatsdStats.h"
Joe Onorato9fc9edf2017-10-15 20:08:52 -070026#include "metrics/CountMetricProducer.h"
Chenjie Yu85ed8382017-12-14 16:48:54 -080027#include "external/StatsPullerManager.h"
Yangster-macd40053e2018-01-09 16:29:22 -080028#include "dimension.h"
29#include "field_util.h"
Joe Onorato9fc9edf2017-10-15 20:08:52 -070030#include "stats_util.h"
yro947fbce2017-11-15 22:50:23 -080031#include "storage/StorageManager.h"
Joe Onorato9fc9edf2017-10-15 20:08:52 -070032
yro00698da2017-09-15 10:06:40 -070033#include <log/log_event_list.h>
Yao Chenef99c4f2017-09-22 16:26:54 -070034#include <utils/Errors.h>
Yao Chenab273e22017-09-06 12:53:50 -070035
36using namespace android;
yro947fbce2017-11-15 22:50:23 -080037using android::base::StringPrintf;
yrob0378b02017-11-09 20:36:25 -080038using android::util::FIELD_COUNT_REPEATED;
yro17adac92017-11-08 23:16:29 -080039using android::util::FIELD_TYPE_BOOL;
40using android::util::FIELD_TYPE_FLOAT;
41using android::util::FIELD_TYPE_INT32;
42using android::util::FIELD_TYPE_INT64;
43using android::util::FIELD_TYPE_MESSAGE;
44using android::util::FIELD_TYPE_STRING;
45using android::util::ProtoOutputStream;
Yao Chen44cf27c2017-09-14 22:32:50 -070046using std::make_unique;
47using std::unique_ptr;
48using std::vector;
Bookatz906a35c2017-09-20 15:26:44 -070049
50namespace android {
51namespace os {
52namespace statsd {
Yao Chenab273e22017-09-06 12:53:50 -070053
yro947fbce2017-11-15 22:50:23 -080054// for ConfigMetricsReportList
yro17adac92017-11-08 23:16:29 -080055const int FIELD_ID_CONFIG_KEY = 1;
yro947fbce2017-11-15 22:50:23 -080056const int FIELD_ID_REPORTS = 2;
yro17adac92017-11-08 23:16:29 -080057// for ConfigKey
58const int FIELD_ID_UID = 1;
Yangster-mac94e197c2018-01-02 16:03:03 -080059const int FIELD_ID_ID = 2;
yro947fbce2017-11-15 22:50:23 -080060// for ConfigMetricsReport
61const int FIELD_ID_METRICS = 1;
62const int FIELD_ID_UID_MAP = 2;
63
yro03faf092017-12-12 00:17:50 -080064#define STATS_DATA_DIR "/data/misc/stats-data"
yro17adac92017-11-08 23:16:29 -080065
yro31eb67b2017-10-24 13:33:21 -070066StatsLogProcessor::StatsLogProcessor(const sp<UidMap>& uidMap,
Yangster-mace2cd6d52017-11-09 20:38:30 -080067 const sp<AnomalyMonitor>& anomalyMonitor,
Yangster-mac20877162017-12-22 17:19:39 -080068 const long timeBaseSec,
David Chen1d7b0cd2017-11-15 14:20:04 -080069 const std::function<void(const ConfigKey&)>& sendBroadcast)
Chenjie Yu85ed8382017-12-14 16:48:54 -080070 : mUidMap(uidMap),
71 mAnomalyMonitor(anomalyMonitor),
72 mSendBroadcast(sendBroadcast),
Yangster-mac20877162017-12-22 17:19:39 -080073 mTimeBaseSec(timeBaseSec) {
yro947fbce2017-11-15 22:50:23 -080074 // On each initialization of StatsLogProcessor, check stats-data directory to see if there is
75 // any left over data to be read.
76 StorageManager::sendBroadcast(STATS_DATA_DIR, mSendBroadcast);
Chenjie Yu85ed8382017-12-14 16:48:54 -080077 StatsPullerManager statsPullerManager;
78 statsPullerManager.SetTimeBaseSec(mTimeBaseSec);
Yao Chenab273e22017-09-06 12:53:50 -070079}
80
Yao Chenef99c4f2017-09-22 16:26:54 -070081StatsLogProcessor::~StatsLogProcessor() {
Yao Chenab273e22017-09-06 12:53:50 -070082}
83
Yangster-mace2cd6d52017-11-09 20:38:30 -080084void StatsLogProcessor::onAnomalyAlarmFired(
85 const uint64_t timestampNs,
86 unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>> anomalySet) {
Yangster-macb0d06282018-01-05 15:44:07 -080087 std::lock_guard<std::mutex> lock(mMetricsMutex);
Bookatzcc5adef22017-11-21 14:36:23 -080088 for (const auto& itr : mMetricsManagers) {
89 itr.second->onAnomalyAlarmFired(timestampNs, anomalySet);
Yangster-mace2cd6d52017-11-09 20:38:30 -080090 }
91}
92
Yangster-macd40053e2018-01-09 16:29:22 -080093void StatsLogProcessor::mapIsolatedUidToHostUidIfNecessaryLocked(LogEvent* event) const {
Yangster-mac7ba8fc32018-01-24 16:16:46 -080094 std::set<Field, FieldCmp> uidFields;
Yangster-mac68985802018-01-21 10:05:09 -080095 if (android::util::kAtomsWithAttributionChain.find(event->GetTagId()) !=
96 android::util::kAtomsWithAttributionChain.end()) {
Yangster-mac7ba8fc32018-01-24 16:16:46 -080097 FieldMatcher matcher;
98 buildAttributionUidFieldMatcher(event->GetTagId(), Position::ANY, &matcher);
99 findFields(event->getFieldValueMap(), matcher, &uidFields);
Yangster-mac68985802018-01-21 10:05:09 -0800100 } else if (android::util::kAtomsWithUidField.find(event->GetTagId()) !=
101 android::util::kAtomsWithUidField.end()) {
Yangster-mac7ba8fc32018-01-24 16:16:46 -0800102 FieldMatcher matcher;
103 buildSimpleAtomFieldMatcher(
104 event->GetTagId(), 1 /* uid is always the 1st field. */, &matcher);
105 findFields(event->getFieldValueMap(), matcher, &uidFields);
Yangster-mac68985802018-01-21 10:05:09 -0800106 }
107
Yangster-mac7ba8fc32018-01-24 16:16:46 -0800108 for (const auto& uidField : uidFields) {
109 DimensionsValue* value = event->findFieldValueOrNull(uidField);
Yangster-macd40053e2018-01-09 16:29:22 -0800110 if (value != nullptr && value->value_case() == DimensionsValue::ValueCase::kValueInt) {
111 const int uid = mUidMap->getHostUidOrSelf(value->value_int());
112 value->set_value_int(uid);
113 }
Yao Chen312e8982017-12-05 15:29:03 -0800114 }
Yangster-macd40053e2018-01-09 16:29:22 -0800115}
116
117void StatsLogProcessor::onIsolatedUidChangedEventLocked(const LogEvent& event) {
118 status_t err = NO_ERROR, err2 = NO_ERROR, err3 = NO_ERROR;
119 bool is_create = event.GetBool(3, &err);
120 auto parent_uid = int(event.GetLong(1, &err2));
121 auto isolated_uid = int(event.GetLong(2, &err3));
122 if (err == NO_ERROR && err2 == NO_ERROR && err3 == NO_ERROR) {
123 if (is_create) {
124 mUidMap->assignIsolatedUid(isolated_uid, parent_uid);
125 } else {
126 mUidMap->removeIsolatedUid(isolated_uid, parent_uid);
127 }
128 } else {
129 ALOGE("Failed to parse uid in the isolated uid change event.");
130 }
131}
132
133// TODO: what if statsd service restarts? How do we know what logs are already processed before?
134void StatsLogProcessor::OnLogEvent(LogEvent* event) {
135 std::lock_guard<std::mutex> lock(mMetricsMutex);
136 StatsdStats::getInstance().noteAtomLogged(
137 event->GetTagId(), event->GetTimestampNs() / NS_PER_SEC);
138
David Chen21582962017-11-01 17:32:46 -0700139 // Hard-coded logic to update the isolated uid's in the uid-map.
Stefan Lafonae2df012017-11-14 09:17:21 -0800140 // The field numbers need to be currently updated by hand with atoms.proto
Yangster-macd40053e2018-01-09 16:29:22 -0800141 if (event->GetTagId() == android::util::ISOLATED_UID_CHANGED) {
142 onIsolatedUidChangedEventLocked(*event);
David Chencfc311d2018-01-23 17:55:54 -0800143 }
144
145 if (mMetricsManagers.empty()) {
146 return;
147 }
148
Chenjie Yufa22d652018-02-05 14:37:48 -0800149 long curTime = time(nullptr);
150 if (curTime - mLastPullerCacheClearTimeSec > StatsdStats::kPullerCacheClearIntervalSec) {
151 mStatsPullerManager.ClearPullerCacheIfNecessary(curTime);
152 mLastPullerCacheClearTimeSec = curTime;
153 }
154
David Chencfc311d2018-01-23 17:55:54 -0800155 if (event->GetTagId() != android::util::ISOLATED_UID_CHANGED) {
Yangster-macd40053e2018-01-09 16:29:22 -0800156 // Map the isolated uid to host uid if necessary.
157 mapIsolatedUidToHostUidIfNecessaryLocked(event);
158 }
159
160 // pass the event to metrics managers.
161 for (auto& pair : mMetricsManagers) {
162 pair.second->onLogEvent(*event);
163 flushIfNecessaryLocked(event->GetTimestampNs(), pair.first, *(pair.second));
David Chen21582962017-11-01 17:32:46 -0700164 }
Yao Chenab273e22017-09-06 12:53:50 -0700165}
166
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700167void StatsLogProcessor::OnConfigUpdated(const ConfigKey& key, const StatsdConfig& config) {
Yangster-macb0d06282018-01-05 15:44:07 -0800168 std::lock_guard<std::mutex> lock(mMetricsMutex);
Yao Chenb3561512017-11-21 18:07:17 -0800169 ALOGD("Updated configuration for key %s", key.ToString().c_str());
Yao Chend10f7b12017-12-18 12:53:50 -0800170 sp<MetricsManager> newMetricsManager = new MetricsManager(key, config, mTimeBaseSec, mUidMap);
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700171 auto it = mMetricsManagers.find(key);
Yao Chen288c6002017-12-12 13:43:18 -0800172 if (it == mMetricsManagers.end() && mMetricsManagers.size() > StatsdStats::kMaxConfigCount) {
Yao Chenb3561512017-11-21 18:07:17 -0800173 ALOGE("Can't accept more configs!");
174 return;
Yao Chen44cf27c2017-09-14 22:32:50 -0700175 }
176
Yao Chencaf339d2017-10-06 16:01:10 -0700177 if (newMetricsManager->isConfigValid()) {
David Chend6896892017-10-25 11:49:03 -0700178 mUidMap->OnConfigUpdated(key);
Yangster-mace2cd6d52017-11-09 20:38:30 -0800179 newMetricsManager->setAnomalyMonitor(mAnomalyMonitor);
Yao Chen147ce602017-12-22 14:35:34 -0800180 if (newMetricsManager->shouldAddUidMapListener()) {
Yao Chend10f7b12017-12-18 12:53:50 -0800181 // We have to add listener after the MetricsManager is constructed because it's
182 // not safe to create wp or sp from this pointer inside its constructor.
183 mUidMap->addListener(newMetricsManager.get());
184 }
185 mMetricsManagers[key] = newMetricsManager;
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700186 // Why doesn't this work? mMetricsManagers.insert({key, std::move(newMetricsManager)});
Yao Chenb3561512017-11-21 18:07:17 -0800187 VLOG("StatsdConfig valid");
Yao Chencaf339d2017-10-06 16:01:10 -0700188 } else {
189 // If there is any error in the config, don't use it.
Yao Chenb3561512017-11-21 18:07:17 -0800190 ALOGE("StatsdConfig NOT valid");
Yao Chencaf339d2017-10-06 16:01:10 -0700191 }
yro00698da2017-09-15 10:06:40 -0700192}
Bookatz906a35c2017-09-20 15:26:44 -0700193
Yangster7c334a12017-11-22 14:24:24 -0800194size_t StatsLogProcessor::GetMetricsSize(const ConfigKey& key) const {
Yangster-macb0d06282018-01-05 15:44:07 -0800195 std::lock_guard<std::mutex> lock(mMetricsMutex);
Yao Chen729093d2017-10-16 10:33:26 -0700196 auto it = mMetricsManagers.find(key);
197 if (it == mMetricsManagers.end()) {
198 ALOGW("Config source %s does not exist", key.ToString().c_str());
David Chen1d7b0cd2017-11-15 14:20:04 -0800199 return 0;
Yao Chen729093d2017-10-16 10:33:26 -0700200 }
David Chen1d7b0cd2017-11-15 14:20:04 -0800201 return it->second->byteSize();
202}
203
Yao Chen884c8c12018-01-26 10:36:25 -0800204void StatsLogProcessor::dumpStates(FILE* out, bool verbose) {
205 std::lock_guard<std::mutex> lock(mMetricsMutex);
206 fprintf(out, "MetricsManager count: %lu\n", (unsigned long)mMetricsManagers.size());
207 for (auto metricsManager : mMetricsManagers) {
208 metricsManager.second->dumpStates(out, verbose);
209 }
210}
211
Yao Chen147ce602017-12-22 14:35:34 -0800212void StatsLogProcessor::onDumpReport(const ConfigKey& key, const uint64_t& dumpTimeStampNs,
213 ConfigMetricsReportList* report) {
Yangster-macb0d06282018-01-05 15:44:07 -0800214 std::lock_guard<std::mutex> lock(mMetricsMutex);
Yangster-mac20877162017-12-22 17:19:39 -0800215 auto it = mMetricsManagers.find(key);
216 if (it == mMetricsManagers.end()) {
217 ALOGW("Config source %s does not exist", key.ToString().c_str());
218 return;
219 }
220 report->mutable_config_key()->set_uid(key.GetUid());
Yangster-mac94e197c2018-01-02 16:03:03 -0800221 report->mutable_config_key()->set_id(key.GetId());
Yangster-mac20877162017-12-22 17:19:39 -0800222 ConfigMetricsReport* configMetricsReport = report->add_reports();
223 it->second->onDumpReport(dumpTimeStampNs, configMetricsReport);
224 // TODO: dump uid mapping.
225}
226
David Chen1d7b0cd2017-11-15 14:20:04 -0800227void StatsLogProcessor::onDumpReport(const ConfigKey& key, vector<uint8_t>* outData) {
Yangster-macb0d06282018-01-05 15:44:07 -0800228 std::lock_guard<std::mutex> lock(mMetricsMutex);
Yangster-mac86179502018-01-23 15:47:15 -0800229 onDumpReportLocked(key, outData);
230}
231
232void StatsLogProcessor::onDumpReportLocked(const ConfigKey& key, vector<uint8_t>* outData) {
David Chen1d7b0cd2017-11-15 14:20:04 -0800233 auto it = mMetricsManagers.find(key);
234 if (it == mMetricsManagers.end()) {
235 ALOGW("Config source %s does not exist", key.ToString().c_str());
236 return;
237 }
238
239 // This allows another broadcast to be sent within the rate-limit period if we get close to
240 // filling the buffer again soon.
David Chen1d7b0cd2017-11-15 14:20:04 -0800241 mLastBroadcastTimes.erase(key);
Yao Chen729093d2017-10-16 10:33:26 -0700242
yro17adac92017-11-08 23:16:29 -0800243 ProtoOutputStream proto;
244
yro947fbce2017-11-15 22:50:23 -0800245 // Start of ConfigKey.
yro17adac92017-11-08 23:16:29 -0800246 long long configKeyToken = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_CONFIG_KEY);
247 proto.write(FIELD_TYPE_INT32 | FIELD_ID_UID, key.GetUid());
Yangster-mac94e197c2018-01-02 16:03:03 -0800248 proto.write(FIELD_TYPE_INT64 | FIELD_ID_ID, (long long)key.GetId());
yro17adac92017-11-08 23:16:29 -0800249 proto.end(configKeyToken);
yro947fbce2017-11-15 22:50:23 -0800250 // End of ConfigKey.
yro17adac92017-11-08 23:16:29 -0800251
yro947fbce2017-11-15 22:50:23 -0800252 // Start of ConfigMetricsReport (reports).
253 long long reportsToken =
254 proto.start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_REPORTS);
255
256 // First, fill in ConfigMetricsReport using current data on memory, which
257 // starts from filling in StatsLogReport's.
Yao Chen288c6002017-12-12 13:43:18 -0800258 it->second->onDumpReport(&proto);
yro17adac92017-11-08 23:16:29 -0800259
260 // Fill in UidMap.
261 auto uidMap = mUidMap->getOutput(key);
262 const int uidMapSize = uidMap.ByteSize();
263 char uidMapBuffer[uidMapSize];
264 uidMap.SerializeToArray(&uidMapBuffer[0], uidMapSize);
265 proto.write(FIELD_TYPE_MESSAGE | FIELD_ID_UID_MAP, uidMapBuffer, uidMapSize);
266
yro947fbce2017-11-15 22:50:23 -0800267 // End of ConfigMetricsReport (reports).
268 proto.end(reportsToken);
269
270 // Then, check stats-data directory to see there's any file containing
271 // ConfigMetricsReport from previous shutdowns to concatenate to reports.
yro98a28502018-01-18 17:00:14 -0800272 StorageManager::appendConfigMetricsReport(proto);
yro947fbce2017-11-15 22:50:23 -0800273
David Chen1d7b0cd2017-11-15 14:20:04 -0800274 if (outData != nullptr) {
275 outData->clear();
276 outData->resize(proto.size());
277 size_t pos = 0;
278 auto iter = proto.data();
279 while (iter.readBuffer() != NULL) {
280 size_t toRead = iter.currentToRead();
281 std::memcpy(&((*outData)[pos]), iter.readBuffer(), toRead);
282 pos += toRead;
283 iter.rp()->move(toRead);
284 }
yro17adac92017-11-08 23:16:29 -0800285 }
Yao Chen69f1baf2017-11-27 17:25:36 -0800286 StatsdStats::getInstance().noteMetricsReportSent(key);
Yao Chen729093d2017-10-16 10:33:26 -0700287}
288
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700289void StatsLogProcessor::OnConfigRemoved(const ConfigKey& key) {
Yangster-macb0d06282018-01-05 15:44:07 -0800290 std::lock_guard<std::mutex> lock(mMetricsMutex);
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700291 auto it = mMetricsManagers.find(key);
292 if (it != mMetricsManagers.end()) {
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700293 mMetricsManagers.erase(it);
David Chend6896892017-10-25 11:49:03 -0700294 mUidMap->OnConfigRemoved(key);
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700295 }
Yao Chenb3561512017-11-21 18:07:17 -0800296 StatsdStats::getInstance().noteConfigRemoved(key);
David Chen1d7b0cd2017-11-15 14:20:04 -0800297
David Chen1d7b0cd2017-11-15 14:20:04 -0800298 mLastBroadcastTimes.erase(key);
Chenjie Yufa22d652018-02-05 14:37:48 -0800299
300 if (mMetricsManagers.empty()) {
301 mStatsPullerManager.ForceClearPullerCache();
302 }
Joe Onorato9fc9edf2017-10-15 20:08:52 -0700303}
304
Yangster-macb0d06282018-01-05 15:44:07 -0800305void StatsLogProcessor::flushIfNecessaryLocked(
306 uint64_t timestampNs, const ConfigKey& key, MetricsManager& metricsManager) {
David Chend9269e22017-12-05 13:43:51 -0800307 auto lastCheckTime = mLastByteSizeTimes.find(key);
308 if (lastCheckTime != mLastByteSizeTimes.end()) {
309 if (timestampNs - lastCheckTime->second < StatsdStats::kMinByteSizeCheckPeriodNs) {
310 return;
311 }
312 }
313
314 // We suspect that the byteSize() computation is expensive, so we set a rate limit.
315 size_t totalBytes = metricsManager.byteSize();
316 mLastByteSizeTimes[key] = timestampNs;
317 if (totalBytes >
318 StatsdStats::kMaxMetricsBytesPerConfig) { // Too late. We need to start clearing data.
Yao Chen288c6002017-12-12 13:43:18 -0800319 // TODO(b/70571383): By 12/15/2017 add API to drop data directly
320 ProtoOutputStream proto;
321 metricsManager.onDumpReport(&proto);
David Chen12942952017-12-04 14:28:43 -0800322 StatsdStats::getInstance().noteDataDropped(key);
323 VLOG("StatsD had to toss out metrics for %s", key.ToString().c_str());
David Chend9269e22017-12-05 13:43:51 -0800324 } else if (totalBytes > .9 * StatsdStats::kMaxMetricsBytesPerConfig) {
325 // Send broadcast so that receivers can pull data.
326 auto lastBroadcastTime = mLastBroadcastTimes.find(key);
327 if (lastBroadcastTime != mLastBroadcastTimes.end()) {
328 if (timestampNs - lastBroadcastTime->second < StatsdStats::kMinBroadcastPeriodNs) {
329 VLOG("StatsD would've sent a broadcast but the rate limit stopped us.");
David Chen1d7b0cd2017-11-15 14:20:04 -0800330 return;
331 }
332 }
333 mLastBroadcastTimes[key] = timestampNs;
Yao Chenb3561512017-11-21 18:07:17 -0800334 VLOG("StatsD requesting broadcast for %s", key.ToString().c_str());
David Chen1d7b0cd2017-11-15 14:20:04 -0800335 mSendBroadcast(key);
Yao Chenb3561512017-11-21 18:07:17 -0800336 StatsdStats::getInstance().noteBroadcastSent(key);
yro31eb67b2017-10-24 13:33:21 -0700337 }
338}
339
yro947fbce2017-11-15 22:50:23 -0800340void StatsLogProcessor::WriteDataToDisk() {
Yangster-macb0d06282018-01-05 15:44:07 -0800341 std::lock_guard<std::mutex> lock(mMetricsMutex);
yro947fbce2017-11-15 22:50:23 -0800342 for (auto& pair : mMetricsManagers) {
343 const ConfigKey& key = pair.first;
344 vector<uint8_t> data;
Yangster-mac86179502018-01-23 15:47:15 -0800345 onDumpReportLocked(key, &data);
yro947fbce2017-11-15 22:50:23 -0800346 // TODO: Add a guardrail to prevent accumulation of file on disk.
yro98a28502018-01-18 17:00:14 -0800347 string file_name = StringPrintf("%s/%ld_%d_%lld", STATS_DATA_DIR, time(nullptr),
348 key.GetUid(), (long long)key.GetId());
yro947fbce2017-11-15 22:50:23 -0800349 StorageManager::writeFile(file_name.c_str(), &data[0], data.size());
350 }
351}
352
Yao Chenef99c4f2017-09-22 16:26:54 -0700353} // namespace statsd
354} // namespace os
355} // namespace android