henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 1 | /* |
| 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 Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame^] | 13 | #include "webrtc/modules/utility/include/helpers_android.h" |
henrika | b261989 | 2015-05-18 16:49:16 +0200 | [diff] [blame] | 14 | |
| 15 | namespace webrtc { |
| 16 | |
| 17 | BuildInfo::BuildInfo() |
| 18 | : j_environment_(JVM::GetInstance()->environment()), |
| 19 | j_build_info_(JVM::GetInstance()->GetClass( |
| 20 | "org/webrtc/voiceengine/BuildInfo")) { |
| 21 | } |
| 22 | |
| 23 | std::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 | |
| 30 | std::string BuildInfo::GetDeviceModel() { |
| 31 | return GetStringFromJava("getDeviceModel"); |
| 32 | } |
| 33 | |
| 34 | std::string BuildInfo::GetBrand() { |
| 35 | return GetStringFromJava("getBrand"); |
| 36 | } |
| 37 | |
| 38 | std::string BuildInfo::GetDeviceManufacturer() { |
| 39 | return GetStringFromJava("getDeviceManufacturer"); |
| 40 | } |
| 41 | |
| 42 | std::string BuildInfo::GetAndroidBuildId() { |
| 43 | return GetStringFromJava("getAndroidBuildId"); |
| 44 | } |
| 45 | |
| 46 | std::string BuildInfo::GetBuildType() { |
| 47 | return GetStringFromJava("getBuildType"); |
| 48 | } |
| 49 | |
| 50 | std::string BuildInfo::GetBuildRelease() { |
| 51 | return GetStringFromJava("getBuildRelease"); |
| 52 | } |
| 53 | |
| 54 | std::string BuildInfo::GetSdkVersion() { |
| 55 | return GetStringFromJava("getSdkVersion"); |
| 56 | } |
| 57 | |
| 58 | } // namespace webrtc |