• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 #include "common/libs/utils/device_type.h"
18 
19 namespace cuttlefish {
20 
21 // Parse device type from android-info.txt config field.
ParseDeviceType(std::string_view type_name)22 DeviceType ParseDeviceType(std::string_view type_name) {
23   if (type_name == "phone") {
24     return DeviceType::Phone;
25   } else if (type_name == "wear") {
26     return DeviceType::Wear;
27   } else if (type_name == "auto" || type_name == "auto_portrait" ||
28              type_name == "auto_dd" || type_name == "auto_md") {
29     return DeviceType::Auto;
30   } else if (type_name == "foldable") {
31     return DeviceType::Foldable;
32   } else if (type_name == "tv") {
33     return DeviceType::Tv;
34   } else if (type_name == "minidroid") {
35     return DeviceType::Minidroid;
36   } else if (type_name == "go") {
37     return DeviceType::Go;
38   } else {
39     return DeviceType::Unknown;
40   }
41 }
42 
43 }  // namespace cuttlefish
44