|
|
@ -534,7 +534,7 @@ CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPa
|
|
|
|
mRequestWakelockMid = env->GetMethodID(classService, "requestWakelock", "(Ljava/lang/String;J)V");
|
|
|
|
mRequestWakelockMid = env->GetMethodID(classService, "requestWakelock", "(Ljava/lang/String;J)V");
|
|
|
|
mReleaseWakelockMid = env->GetMethodID(classService, "releaseWakelock", "(Ljava/lang/String;)V");
|
|
|
|
mReleaseWakelockMid = env->GetMethodID(classService, "releaseWakelock", "(Ljava/lang/String;)V");
|
|
|
|
|
|
|
|
|
|
|
|
mGetSystemInfoMid = env->GetMethodID(classService, "getSystemInfo", "()Ljava/lang/String;");
|
|
|
|
mGetFlowInfoMid = env->GetMethodID(classService, "getFlowInfo", "()Ljava/lang/String;");
|
|
|
|
mInstallAppMid = env->GetMethodID(classService, "installApp", "(Ljava/lang/String;J)Z");
|
|
|
|
mInstallAppMid = env->GetMethodID(classService, "installApp", "(Ljava/lang/String;J)Z");
|
|
|
|
mRebootMid = env->GetMethodID(classService, "reboot", "(IJLjava/lang/String;)V");
|
|
|
|
mRebootMid = env->GetMethodID(classService, "reboot", "(IJLjava/lang/String;)V");
|
|
|
|
mEnableGpsMid = env->GetMethodID(classService, "enableGps", "(Z)V");
|
|
|
|
mEnableGpsMid = env->GetMethodID(classService, "enableGps", "(Z)V");
|
|
|
@ -886,6 +886,7 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
|
|
|
|
std::map<std::string, std::string> powerInfo;
|
|
|
|
std::map<std::string, std::string> powerInfo;
|
|
|
|
int res = 0;
|
|
|
|
int res = 0;
|
|
|
|
int bv = -1;
|
|
|
|
int bv = -1;
|
|
|
|
|
|
|
|
std::map<std::string, std::string> flowInfo;
|
|
|
|
|
|
|
|
|
|
|
|
for (std::map<std::string, std::string>::iterator it = properties.begin(); it != properties.end(); ++it)
|
|
|
|
for (std::map<std::string, std::string>::iterator it = properties.begin(); it != properties.end(); ++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1045,12 +1046,24 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it->second = std::to_string(m_signalLevel);
|
|
|
|
it->second = std::to_string(m_signalLevel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ((it->first == (PROP_MOBILE_FLOW_TX)) || (it->first == (PROP_MOBILE_FLOW_RX)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!flowInfo.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QueryFlowInfo(powerInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
auto it2 = flowInfo.find(it->first);
|
|
|
|
|
|
|
|
if (it2 != flowInfo.cend())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
it->second = it2->second;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
else if (startsWith(it->first, PROP_JAVA_PREFIX))
|
|
|
|
else if (startsWith(it->first, PROP_JAVA_PREFIX))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (powerInfo.empty())
|
|
|
|
if (powerInfo.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QueryPowerInfo(powerInfo);
|
|
|
|
QueryFlowInfo(powerInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
auto it2 = powerInfo.find(it->first);
|
|
|
|
auto it2 = powerInfo.find(it->first);
|
|
|
|
if (it2 != powerInfo.cend())
|
|
|
|
if (it2 != powerInfo.cend())
|
|
|
@ -1097,7 +1110,7 @@ std::string CPhoneDevice::QueryCpuTemperature()
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CPhoneDevice::QueryPowerInfo(std::map<std::string, std::string>& powerInfo)
|
|
|
|
void CPhoneDevice::QueryFlowInfo(std::map<std::string, std::string>&flowInfo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
JNIEnv* env = NULL;
|
|
|
|
JNIEnv* env = NULL;
|
|
|
|
jboolean ret = JNI_FALSE;
|
|
|
|
jboolean ret = JNI_FALSE;
|
|
|
@ -1107,7 +1120,7 @@ void CPhoneDevice::QueryPowerInfo(std::map<std::string, std::string>& powerInfo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ALOGE("Failed to get JNI Env");
|
|
|
|
ALOGE("Failed to get JNI Env");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jobject jobj = env->CallObjectMethod(m_javaService, mGetSystemInfoMid);
|
|
|
|
jobject jobj = env->CallObjectMethod(m_javaService, mGetFlowInfoMid);
|
|
|
|
std::string str = jstring2string(env, (jstring)jobj);
|
|
|
|
std::string str = jstring2string(env, (jstring)jobj);
|
|
|
|
if (didAttachThread)
|
|
|
|
if (didAttachThread)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1117,7 +1130,7 @@ void CPhoneDevice::QueryPowerInfo(std::map<std::string, std::string>& powerInfo)
|
|
|
|
if (!str.empty())
|
|
|
|
if (!str.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::map<std::string, std::string> queries = parseQuery(str);
|
|
|
|
std::map<std::string, std::string> queries = parseQuery(str);
|
|
|
|
powerInfo.swap(queries);
|
|
|
|
flowInfo.swap(queries);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|