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 int getFieldValue<int> (JNIEnv* env, jobject obj, jfieldID fieldId) in getFieldValue() argument
289 return env->GetIntField(obj, fieldId); in getFieldValue()
293 float getFieldValue<float> (JNIEnv* env, jobject obj, jfieldID fieldId) in getFieldValue() argument
296 return env->GetFloatField(obj, fieldId); in getFieldValue()
300 FieldType getField (JNIEnv* env, jobject obj, const char* fieldName) in getField() argument
302 const jclass cls = getObjectClass(env, obj); in getField()
303 const jfieldID fieldId = env->GetFieldID(cls, fieldName, getJNITypeStr<FieldType>()); in getField()
305 checkException(env); in getField()
308 return getFieldValue<FieldType>(env, obj, fieldId); in getField()
313 void describePlatform (JNIEnv* env, std::ostream& dst) in describePlatform() argument
341 …<< ": " << getStaticField<string>(env, s_stringFields[ndx].classPath, s_stringFields[ndx].fieldNam… in describePlatform()
344 dst << "Build.VERSION.SDK_INT: " << getStaticField<int>(env, versionClass, "SDK_INT") << "\n"; in describePlatform()
347 …const vector<string> supportedAbis = getStaticField<vector<string> >(env, buildClass, "SUPPORTED_A… in describePlatform()
358 vector<string> getSupportedABIs (JNIEnv* env) in getSupportedABIs() argument
360 return getStaticField<vector<string> >(env, "android/os/Build", "SUPPORTED_ABIS"); in getSupportedABIs()
363 bool supportsAny64BitABI (JNIEnv* env) in supportsAny64BitABI() argument
365 const vector<string> supportedAbis = getSupportedABIs(env); in supportsAny64BitABI()
379 const ScopedJNIEnv env(activity->vm); in supportsAny64BitABI() local
381 return supportsAny64BitABI(env.getEnv()); in supportsAny64BitABI()
384 jobject getPackageManager (JNIEnv* env, jobject activity) in getPackageManager() argument
386 const jclass activityCls = getObjectClass(env, activity); in getPackageManager()
387 …const jmethodID getPMID = getMethodID(env, activityCls, "getPackageManager", "()Landroid/conten… in getPackageManager()
388 const jobject packageManager = env->CallObjectMethod(activity, getPMID); in getPackageManager()
393 bool hasSystemFeature (JNIEnv* env, jobject activity, const char* name) in hasSystemFeature() argument
395 const LocalRef packageManager (env, getPackageManager(env, activity)); in hasSystemFeature()
396 const jclass pmCls = getObjectClass(env, *packageManager); in hasSystemFeature()
397 …const jmethodID hasFeatureID = getMethodID(env, pmCls, "hasSystemFeature", "(Ljava/lang/String;)Z… in hasSystemFeature()
398 const LocalRef nameStr (env, env->NewStringUTF(name)); in hasSystemFeature()
403 return env->CallBooleanMethodA(*packageManager, hasFeatureID, callArgs) == JNI_TRUE; in hasSystemFeature()
406 jobject getWindowManager (JNIEnv* env, jobject activity) in getWindowManager() argument
408 const jclass activityCls = getObjectClass(env, activity); in getWindowManager()
409 …const jmethodID getWMID = getMethodID(env, activityCls, "getWindowManager", "()Landroid/view/Wi… in getWindowManager()
410 const jobject windowManager = env->CallObjectMethod(activity, getWMID); in getWindowManager()
415 jobject getDefaultDisplay (JNIEnv* env, jobject windowManager) in getDefaultDisplay() argument
417 const jclass wmClass = getObjectClass(env, windowManager); in getDefaultDisplay()
418 …const jmethodID getDisplayID = getMethodID(env, wmClass, "getDefaultDisplay", "()Landroid/view/Di… in getDefaultDisplay()
419 const jobject display = env->CallObjectMethod(windowManager, getDisplayID); in getDefaultDisplay()
424 jobject createDisplayMetrics (JNIEnv* env) in createDisplayMetrics() argument
426 const jclass displayMetricsCls = findClass(env, "android/util/DisplayMetrics"); in createDisplayMetrics()
427 const jmethodID ctorId = getMethodID(env, displayMetricsCls, "<init>", "()V"); in createDisplayMetrics()
429 return env->NewObject(displayMetricsCls, ctorId); in createDisplayMetrics()
432 DisplayMetrics getDisplayMetrics (JNIEnv* env, jobject activity) in getDisplayMetrics() argument
434 const LocalRef windowManager (env, getWindowManager(env, activity)); in getDisplayMetrics()
435 const LocalRef defaultDisplay (env, getDefaultDisplay(env, *windowManager)); in getDisplayMetrics()
436 const LocalRef nativeMetrics (env, createDisplayMetrics(env)); in getDisplayMetrics()
437 const jclass displayCls = getObjectClass(env, *defaultDisplay); in getDisplayMetrics()
438 …const jmethodID getMetricsID = getMethodID(env, displayCls, "getMetrics", "(Landroid/util/Displa… in getDisplayMetrics()
445 env->CallVoidMethodA(*defaultDisplay, getMetricsID, callArgs); in getDisplayMetrics()
448 metrics.density = getField<float> (env, *nativeMetrics, "density"); in getDisplayMetrics()
449 metrics.densityDpi = getField<int> (env, *nativeMetrics, "densityDpi"); in getDisplayMetrics()
450 metrics.scaledDensity = getField<float> (env, *nativeMetrics, "scaledDensity"); in getDisplayMetrics()
451 metrics.widthPixels = getField<int> (env, *nativeMetrics, "widthPixels"); in getDisplayMetrics()
452 metrics.heightPixels = getField<int> (env, *nativeMetrics, "heightPixels"); in getDisplayMetrics()
453 metrics.xdpi = getField<float> (env, *nativeMetrics, "xdpi"); in getDisplayMetrics()
454 metrics.ydpi = getField<float> (env, *nativeMetrics, "ydpi"); in getDisplayMetrics()
573 const ScopedJNIEnv env(activity->vm); in getIntentStringExtra() local
575 return getIntentStringExtra(env.getEnv(), activity->clazz, name); in getIntentStringExtra()
580 const ScopedJNIEnv env(activity->vm); in setRequestedOrientation() local
582 setRequestedOrientation(env.getEnv(), activity->clazz, orientation); in setRequestedOrientation()
587 const ScopedJNIEnv env(activity->vm); in describePlatform() local
589 describePlatform(env.getEnv(), dst); in describePlatform()
594 const ScopedJNIEnv env(activity->vm); in hasSystemFeature() local
596 return hasSystemFeature(env.getEnv(), activity->clazz, name); in hasSystemFeature()
601 const ScopedJNIEnv env(activity->vm); in getDisplayMetrics() local
603 return getDisplayMetrics(env.getEnv(), activity->clazz); in getDisplayMetrics()