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