blob: 3628e408e5cc714c1ad89e037f224e96760a6a22 [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()
kwiberg1c7fdd82016-04-26 08:18:04 -070018 : j_environment_(JVM::GetInstance()->environment()),
19 j_build_info_(
20 JVM::GetInstance()->GetClass("org/webrtc/voiceengine/BuildInfo")) {}
henrikab2619892015-05-18 16:49:16 +020021
22std::string BuildInfo::GetStringFromJava(const char* name) {
23 jmethodID id = j_build_info_.GetStaticMethodId(name, "()Ljava/lang/String;");
24 jstring j_string = static_cast<jstring>(
25 j_build_info_.CallStaticObjectMethod(id));
26 return j_environment_->JavaToStdString(j_string);
27}
28
29std::string BuildInfo::GetDeviceModel() {
30 return GetStringFromJava("getDeviceModel");
31}
32
33std::string BuildInfo::GetBrand() {
34 return GetStringFromJava("getBrand");
35}
36
37std::string BuildInfo::GetDeviceManufacturer() {
38 return GetStringFromJava("getDeviceManufacturer");
39}
40
41std::string BuildInfo::GetAndroidBuildId() {
42 return GetStringFromJava("getAndroidBuildId");
43}
44
45std::string BuildInfo::GetBuildType() {
46 return GetStringFromJava("getBuildType");
47}
48
49std::string BuildInfo::GetBuildRelease() {
50 return GetStringFromJava("getBuildRelease");
51}
52
henrika918b5542016-09-19 15:44:09 +020053SdkCode BuildInfo::GetSdkVersion() {
54 jmethodID id = j_build_info_.GetStaticMethodId("getSdkVersion", "()I");
55 jint j_version = j_build_info_.CallStaticIntMethod(id);
56 return static_cast<SdkCode>(j_version);
henrikab2619892015-05-18 16:49:16 +020057}
58
59} // namespace webrtc