blob: 4c406ce09fe243a4abd016a763c8cff7d3d68633 [file] [log] [blame]
Adam Shih9c934032022-10-17 13:36:58 +08001/*
2 * Copyright 2022 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#include <stdio.h>
17#include <string>
18#include <android-base/properties.h>
19#include <dump/pixel_dump.h>
20#include "DumpstateUtil.h"
21
22int main() {
23 setbuf(stdout, NULL);
24
25 runCommand("USF statistics", "/vendor/bin/usf_stats get --all");
26 if (!::android::os::dumpstate::PropertiesHelper::IsUserBuild()) {
27 // Not a user build, if this is also not a production device dump the USF registry.
28 std::string hwRev = ::android::base::GetProperty("ro.boot.hardware.revision", "");
Rick Chen35d4b2b2024-07-30 20:08:40 +080029 if (hwRev.find("DEV") != std::string::npos ||
30 hwRev.find("PROTO") != std::string::npos ||
Adam Shih9c934032022-10-17 13:36:58 +080031 hwRev.find("EVT") != std::string::npos ||
32 hwRev.find("DVT") != std::string::npos ||
33 hwRev.find("PVT") != std::string::npos) {
34 runCommand("USF Registry", "/vendor/bin/usf_reg_edit save -");
35 dumpFileContent("USF Last Stat Buffer", "/data/vendor/sensors/debug/stats.history");
36 }
37 }
38 return 0;
39}