Lines Matching full:env
87 LocalRef (JNIEnv* env, jobject ref);
101 LocalRef::LocalRef (JNIEnv* env, jobject ref) in LocalRef() argument
102 : m_env(env) in LocalRef()
113 void checkException (JNIEnv* env) in checkException() argument
115 if (env->ExceptionCheck()) in checkException()
117 env->ExceptionDescribe(); in checkException()
118 env->ExceptionClear(); in checkException()
123 jclass findClass (JNIEnv* env, const char* className) in findClass() argument
125 const jclass cls = env->FindClass(className); in findClass()
127 checkException(env); in findClass()
133 jclass getObjectClass (JNIEnv* env, jobject object) in getObjectClass() argument
135 const jclass cls = env->GetObjectClass(object); in getObjectClass()
137 checkException(env); in getObjectClass()
143 jmethodID getMethodID (JNIEnv* env, jclass cls, const char* methodName, const char* signature) in getMethodID() argument
145 const jmethodID id = env->GetMethodID(cls, methodName, signature); in getMethodID()
147 checkException(env); in getMethodID()
153 string getStringValue (JNIEnv* env, jstring jniStr) in getStringValue() argument
155 const char* ptr = env->GetStringUTFChars(jniStr, DE_NULL); in getStringValue()
158 env->ReleaseStringUTFChars(jniStr, ptr); in getStringValue()
163 string getIntentStringExtra (JNIEnv* env, jobject activity, const char* name) in getIntentStringExtra() argument
167 const jclass activityCls = getObjectClass(env, activity); in getIntentStringExtra()
168 …const LocalRef intent (env, env->CallObjectMethod(activity, getMethodID(env, activityCls, "getIn… in getIntentStringExtra()
171 const LocalRef extraName (env, env->NewStringUTF(name)); in getIntentStringExtra()
172 const jclass intentCls = getObjectClass(env, *intent); in getIntentStringExtra()
178 …const LocalRef extraStr (env, env->CallObjectMethodA(*intent, getMethodID(env, intentCls, "getStr… in getIntentStringExtra()
181 return getStringValue(env, (jstring)*extraStr); in getIntentStringExtra()
186 void setRequestedOrientation (JNIEnv* env, jobject activity, ScreenOrientation orientation) in setRequestedOrientation() argument
188 const jclass activityCls = getObjectClass(env, activity); in setRequestedOrientation()
189 …const jmethodID setOrientationId = getMethodID(env, activityCls, "setRequestedOrientation", "(I)V"… in setRequestedOrientation()
191 env->CallVoidMethod(activity, setOrientationId, (int)orientation); in setRequestedOrientation()
222 FieldType getStaticFieldValue (JNIEnv* env, jclass cls, jfieldID fieldId);
225 int getStaticFieldValue<int> (JNIEnv* env, jclass cls, jfieldID fieldId) in getStaticFieldValue() argument
228 return env->GetStaticIntField(cls, fieldId); in getStaticFieldValue()
232 string getStaticFieldValue<string> (JNIEnv* env, jclass cls, jfieldID fieldId) in getStaticFieldValue() argument
234 const jstring jniStr = (jstring)env->GetStaticObjectField(cls, fieldId); in getStaticFieldValue()
237 return getStringValue(env, jniStr); in getStaticFieldValue()
243 vector<string> getStaticFieldValue<vector<string> > (JNIEnv* env, jclass cls, jfieldID fieldId) in getStaticFieldValue() argument
245 const jobjectArray array = (jobjectArray)env->GetStaticObjectField(cls, fieldId); in getStaticFieldValue()
248 checkException(env); in getStaticFieldValue()
252 const int numElements = env->GetArrayLength(array); in getStaticFieldValue()
256 const jstring jniStr = (jstring)env->GetObjectArrayElement(array, ndx); in getStaticFieldValue()
258 checkException(env); in getStaticFieldValue()
261 result.push_back(getStringValue(env, jniStr)); in getStaticFieldValue()
269 FieldType getStaticField (JNIEnv* env, const char* className, const char* fieldName) in getStaticField() argument
271 const jclass cls = findClass(env, className); in getStaticField()
272 const jfieldID fieldId = env->GetStaticFieldID(cls, fieldName, getJNITypeStr<FieldType>()); in getStaticField()
274 checkException(env); in getStaticField()
277 return getStaticFieldValue<FieldType>(env, cls, fieldId); in getStaticField()
283 FieldType getFieldValue (JNIEnv* env, jobject obj, jfieldID fieldId);
286 deInt64 getFieldValue<deInt64> (JNIEnv* env, jobject obj, jfieldID fieldId) in getFieldValue() argument
289 return env->GetLongField(obj, fieldId); in getFieldValue()
293 FieldType getField (JNIEnv* env, jobject obj, const char* fieldName) in getField() argument
295 const jclass cls = getObjectClass(env, obj); in getField()
296 const jfieldID fieldId = env->GetFieldID(cls, fieldName, getJNITypeStr<FieldType>()); in getField()
298 checkException(env); in getField()
301 return getFieldValue<FieldType>(env, obj, fieldId); in getField()
306 void describePlatform (JNIEnv* env, std::ostream& dst) in describePlatform() argument
334 …<< ": " << getStaticField<string>(env, s_stringFields[ndx].classPath, s_stringFields[ndx].fieldNam… in describePlatform()
337 dst << "Build.VERSION.SDK_INT: " << getStaticField<int>(env, versionClass, "SDK_INT") << "\n"; in describePlatform()
340 …const vector<string> supportedAbis = getStaticField<vector<string> >(env, buildClass, "SUPPORTED_A… in describePlatform()
370 const ScopedJNIEnv env(activity->vm); in getIntentStringExtra() local
372 return getIntentStringExtra(env.getEnv(), activity->clazz, name); in getIntentStringExtra()
377 const ScopedJNIEnv env(activity->vm); in setRequestedOrientation() local
379 setRequestedOrientation(env.getEnv(), activity->clazz, orientation); in setRequestedOrientation()
384 const ScopedJNIEnv env(activity->vm); in describePlatform() local
386 describePlatform(env.getEnv(), dst); in describePlatform()
392 JNIEnv* env = scopedJniEnv.getEnv(); in getTotalAndroidSystemMemory() local
396 const jclass activityManagerClass = findClass(env, "android/app/ActivityManager"); in getTotalAndroidSystemMemory()
397 …const LocalRef activityString (env, env->NewStringUTF("activity")); // Context.ACTIVITY_SERVICE … in getTotalAndroidSystemMemory()
398 const jclass activityClass = getObjectClass(env, activity->clazz); in getTotalAndroidSystemMemory()
399 …const jmethodID getServiceID = getMethodID(env, activityClass, "getSystemService", "(Ljava/lang/… in getTotalAndroidSystemMemory()
400 …LocalRef activityManager (env, env->CallObjectMethod(activity->clazz, getServiceID, *activitySt… in getTotalAndroidSystemMemory()
401 checkException(env); in getTotalAndroidSystemMemory()
406 const jclass memoryInfoClass = findClass(env, "android/app/ActivityManager$MemoryInfo"); in getTotalAndroidSystemMemory()
407 const jmethodID memoryInfoCtor = getMethodID(env, memoryInfoClass, "<init>", "()V"); in getTotalAndroidSystemMemory()
408 LocalRef memoryInfo (env, env->NewObject(memoryInfoClass, memoryInfoCtor)); in getTotalAndroidSystemMemory()
409 checkException(env); in getTotalAndroidSystemMemory()
414 …const jmethodID getMemoryInfoID = getMethodID(env, activityManagerClass, "getMemoryInfo", "(Land… in getTotalAndroidSystemMemory()
415 checkException(env); in getTotalAndroidSystemMemory()
416 env->CallVoidMethod(*activityManager, getMemoryInfoID, *memoryInfo); in getTotalAndroidSystemMemory()
419 return static_cast<size_t>(getField<deInt64>(env, *memoryInfo, "totalMem")); in getTotalAndroidSystemMemory()