• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
main()22 int 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", "");
29         if (hwRev.find("PROTO") != std::string::npos ||
30             hwRev.find("EVT") != std::string::npos ||
31             hwRev.find("DVT") != std::string::npos ||
32             hwRev.find("PVT") != std::string::npos) {
33             runCommand("USF Registry", "/vendor/bin/usf_reg_edit save -");
34             dumpFileContent("USF Last Stat Buffer", "/data/vendor/sensors/debug/stats.history");
35         }
36     }
37     return 0;
38 }
39