• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 
17 #define LOG_TAG "powerhal-libperfmgr"
18 #define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL)
19 
20 #include "Device.h"
21 
22 #include <android-base/logging.h>
23 #include <android-base/properties.h>
24 #include <utils/Trace.h>
25 
26 namespace aidl {
27 namespace google {
28 namespace hardware {
29 namespace power {
30 namespace impl {
31 namespace pixel {
32 
ReadDevice()33 Device ReadDevice() {
34     ATRACE_CALL();
35     const std::string deviceProperty = ::android::base::GetProperty("ro.product.device", "");
36     Device device;
37     if (deviceProperty == "raven") {
38         device = Device::RAVEN;
39     } else if (deviceProperty == "oriole") {
40         device = Device::ORIOLE;
41     } else {
42         LOG(WARNING) << "Failed to parse device property, setting to UNKNOWN: " << deviceProperty;
43         device = Device::UNKNOWN;
44     }
45     LOG(DEBUG) << "Parsed device: deviceProperty=" << deviceProperty
46                << ", device=" << static_cast<uint32_t>(device);
47     return device;
48 }
49 
50 }  // namespace pixel
51 }  // namespace impl
52 }  // namespace power
53 }  // namespace hardware
54 }  // namespace google
55 }  // namespace aidl
56