blob: 6289697073994c0d1b81b6e4b7119f36e6ca4eed [file] [log] [blame]
henrikab2619892015-05-18 16:49:16 +02001/*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "webrtc/modules/audio_device/android/build_info.h"
12
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010013#include "webrtc/modules/utility/include/helpers_android.h"
henrikab2619892015-05-18 16:49:16 +020014
15namespace webrtc {
16
17BuildInfo::BuildInfo()
18 : j_environment_(JVM::GetInstance()->environment()),
19 j_build_info_(JVM::GetInstance()->GetClass(
20 "org/webrtc/voiceengine/BuildInfo")) {
21}
22
23std::string BuildInfo::GetStringFromJava(const char* name) {
24 jmethodID id = j_build_info_.GetStaticMethodId(name, "()Ljava/lang/String;");
25 jstring j_string = static_cast<jstring>(
26 j_build_info_.CallStaticObjectMethod(id));
27 return j_environment_->JavaToStdString(j_string);
28}
29
30std::string BuildInfo::GetDeviceModel() {
31 return GetStringFromJava("getDeviceModel");
32}
33
34std::string BuildInfo::GetBrand() {
35 return GetStringFromJava("getBrand");
36}
37
38std::string BuildInfo::GetDeviceManufacturer() {
39 return GetStringFromJava("getDeviceManufacturer");
40}
41
42std::string BuildInfo::GetAndroidBuildId() {
43 return GetStringFromJava("getAndroidBuildId");
44}
45
46std::string BuildInfo::GetBuildType() {
47 return GetStringFromJava("getBuildType");
48}
49
50std::string BuildInfo::GetBuildRelease() {
51 return GetStringFromJava("getBuildRelease");
52}
53
54std::string BuildInfo::GetSdkVersion() {
55 return GetStringFromJava("getSdkVersion");
56}
57
58} // namespace webrtc