OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chromecast/base/cast_sys_info_android.h" | |
6 | |
7 #include "base/android/build_info.h" | |
8 #include "base/android/jni_android.h" | |
9 #include "base/android/jni_string.h" | |
10 #include "base/strings/string_number_conversions.h" | |
11 #include "base/sys_info.h" | |
12 #include "chromecast/base/cast_sys_info_util.h" | |
13 #include "chromecast/base/version.h" | |
14 #include "jni/CastSysInfoAndroid_jni.h" | |
15 | |
16 namespace chromecast { | |
17 | |
18 namespace { | |
19 const char kBuildTypeUser[] = "user"; | |
20 } // namespace | |
21 | |
22 // static | |
23 bool CastSysInfoAndroid::RegisterJni(JNIEnv* env) { | |
24 return RegisterNativesImpl(env); | |
25 } | |
26 | |
27 // static | |
28 scoped_ptr<CastSysInfo> CreateSysInfo() { | |
29 return make_scoped_ptr(new CastSysInfoAndroid()); | |
30 } | |
31 | |
32 CastSysInfoAndroid::CastSysInfoAndroid() | |
33 : build_info_(base::android::BuildInfo::GetInstance()) { | |
34 } | |
35 | |
36 CastSysInfoAndroid::~CastSysInfoAndroid() { | |
37 } | |
38 | |
39 CastSysInfo::BuildType CastSysInfoAndroid::GetBuildType() { | |
40 if (CAST_IS_DEBUG_BUILD()) | |
41 return BUILD_ENG; | |
42 | |
43 int build_number; | |
44 if (!base::StringToInt(CAST_BUILD_INCREMENTAL, &build_number)) | |
45 build_number = 0; | |
46 | |
47 // Note: no way to determine which channel was used on play store. | |
48 if (strcmp(build_info_->build_type(), kBuildTypeUser) == 0 && | |
49 build_number > 0) { | |
50 return BUILD_PRODUCTION; | |
51 } | |
52 | |
53 // Dogfooders without a user system build should all still have non-Debug | |
54 // builds of the cast receiver APK, but with valid build numbers. | |
55 if (build_number > 0) | |
56 return BUILD_BETA; | |
57 | |
58 // Default to ENG build. | |
59 return BUILD_ENG; | |
60 } | |
61 | |
62 std::string CastSysInfoAndroid::GetSerialNumber() { | |
63 JNIEnv* env = base::android::AttachCurrentThread(); | |
64 return base::android::ConvertJavaStringToUTF8( | |
65 Java_CastSysInfoAndroid_getSerialNumber(env)); | |
66 } | |
67 | |
68 std::string CastSysInfoAndroid::GetProductName() { | |
69 return build_info_->device(); | |
70 } | |
71 | |
72 std::string CastSysInfoAndroid::GetDeviceModel() { | |
73 return build_info_->model(); | |
74 } | |
75 | |
76 std::string CastSysInfoAndroid::GetManufacturer() { | |
77 return build_info_->manufacturer(); | |
78 } | |
79 | |
80 std::string CastSysInfoAndroid::GetSystemBuildNumber() { | |
81 return base::SysInfo::GetAndroidBuildID(); | |
82 } | |
83 | |
84 std::string CastSysInfoAndroid::GetSystemReleaseChannel() { | |
85 return ""; | |
86 } | |
87 | |
88 std::string CastSysInfoAndroid::GetBoardName() { | |
89 return ""; | |
90 } | |
91 | |
92 std::string CastSysInfoAndroid::GetBoardRevision() { | |
93 return ""; | |
94 } | |
95 | |
96 std::string CastSysInfoAndroid::GetFactoryCountry() { | |
97 return ""; | |
98 } | |
99 | |
100 std::string CastSysInfoAndroid::GetFactoryLocale(std::string* second_locale) { | |
101 return ""; | |
102 } | |
103 | |
104 std::string CastSysInfoAndroid::GetWifiInterface() { | |
105 return ""; | |
106 } | |
107 | |
108 std::string CastSysInfoAndroid::GetApInterface() { | |
109 return ""; | |
110 } | |
111 | |
112 std::string CastSysInfoAndroid::GetGlVendor() { | |
113 return ""; | |
halliwell
2015/05/19 01:59:43
Slightly separate issue (and I can submit a separa
gunsch
2015/05/19 02:51:47
How about I add a NOTREACHED in each of these inst
halliwell
2015/05/19 03:36:18
Yes, guarding the callsite is correct. Not sure h
| |
114 } | |
115 | |
116 std::string CastSysInfoAndroid::GetGlRenderer() { | |
117 return ""; | |
118 } | |
119 | |
120 std::string CastSysInfoAndroid::GetGlVersion() { | |
121 return ""; | |
122 } | |
123 | |
124 } // namespace chromecast | |
OLD | NEW |