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 "modules/audio_device/android/build_info.h" 12 13 #include "modules/utility/include/helpers_android.h" 14 15 namespace webrtc { 16 BuildInfo()17BuildInfo::BuildInfo() 18 : j_environment_(JVM::GetInstance()->environment()), 19 j_build_info_( 20 JVM::GetInstance()->GetClass("org/webrtc/voiceengine/BuildInfo")) {} 21 GetStringFromJava(const char * name)22std::string BuildInfo::GetStringFromJava(const char* name) { 23 jmethodID id = j_build_info_.GetStaticMethodId(name, "()Ljava/lang/String;"); 24 jstring j_string = 25 static_cast<jstring>(j_build_info_.CallStaticObjectMethod(id)); 26 return j_environment_->JavaToStdString(j_string); 27 } 28 GetDeviceModel()29std::string BuildInfo::GetDeviceModel() { 30 return GetStringFromJava("getDeviceModel"); 31 } 32 GetBrand()33std::string BuildInfo::GetBrand() { 34 return GetStringFromJava("getBrand"); 35 } 36 GetDeviceManufacturer()37std::string BuildInfo::GetDeviceManufacturer() { 38 return GetStringFromJava("getDeviceManufacturer"); 39 } 40 GetAndroidBuildId()41std::string BuildInfo::GetAndroidBuildId() { 42 return GetStringFromJava("getAndroidBuildId"); 43 } 44 GetBuildType()45std::string BuildInfo::GetBuildType() { 46 return GetStringFromJava("getBuildType"); 47 } 48 GetBuildRelease()49std::string BuildInfo::GetBuildRelease() { 50 return GetStringFromJava("getBuildRelease"); 51 } 52 GetSdkVersion()53SdkCode 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); 57 } 58 59 } // namespace webrtc 60