Lines Matching refs:env
49 static status_t checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
50 if (env->ExceptionCheck()) {
52 LOGE_EX(env);
53 env->ExceptionClear();
62 MyMediaScannerClient(JNIEnv *env, jobject client)
63 : mEnv(env),
64 mClient(env->NewGlobalRef(client)),
71 env->FindClass(kClassMediaScannerClient);
76 mScanFileMethodID = env->GetMethodID(
81 mHandleStringTagMethodID = env->GetMethodID(
86 mSetMimeTypeMethodID = env->GetMethodID(
164 static MediaScanner *getNativeScanner_l(JNIEnv* env, jobject thiz)
166 return (MediaScanner *) env->GetIntField(thiz, fields.context);
169 static void setNativeScanner_l(JNIEnv* env, jobject thiz, MediaScanner *s)
171 env->SetIntField(thiz, fields.context, (int)s);
176 JNIEnv *env, jobject thiz, jstring path, jobject client)
179 MediaScanner *mp = getNativeScanner_l(env, thiz);
181 jniThrowException(env, kRunTimeException, "No scanner available");
186 jniThrowException(env, kIllegalArgumentException, NULL);
190 const char *pathStr = env->GetStringUTFChars(path, NULL);
195 MyMediaScannerClient myClient(env, client);
200 env->ReleaseStringUTFChars(path, pathStr);
205 JNIEnv *env, jobject thiz, jstring path,
211 MediaScanner *mp = getNativeScanner_l(env, thiz);
213 jniThrowException(env, kRunTimeException, "No scanner available");
218 jniThrowException(env, kIllegalArgumentException, NULL);
222 const char *pathStr = env->GetStringUTFChars(path, NULL);
228 (mimeType ? env->GetStringUTFChars(mimeType, NULL) : NULL);
231 env->ReleaseStringUTFChars(path, pathStr);
235 MyMediaScannerClient myClient(env, client);
240 env->ReleaseStringUTFChars(path, pathStr);
242 env->ReleaseStringUTFChars(mimeType, mimeTypeStr);
248 JNIEnv *env, jobject thiz, jstring locale)
251 MediaScanner *mp = getNativeScanner_l(env, thiz);
253 jniThrowException(env, kRunTimeException, "No scanner available");
258 jniThrowException(env, kIllegalArgumentException, NULL);
261 const char *localeStr = env->GetStringUTFChars(locale, NULL);
267 env->ReleaseStringUTFChars(locale, localeStr);
272 JNIEnv *env, jobject thiz, jobject fileDescriptor)
275 MediaScanner *mp = getNativeScanner_l(env, thiz);
277 jniThrowException(env, kRunTimeException, "No scanner available");
282 jniThrowException(env, kIllegalArgumentException, NULL);
286 int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
293 jbyteArray array = env->NewByteArray(len);
295 jbyte* bytes = env->GetByteArrayElements(array, NULL);
297 env->ReleaseByteArrayElements(array, bytes, 0);
305 env->ExceptionClear();
313 android_media_MediaScanner_native_init(JNIEnv *env)
316 jclass clazz = env->FindClass(kClassMediaScanner);
321 fields.context = env->GetFieldID(clazz, "mNativeContext", "I");
328 android_media_MediaScanner_native_setup(JNIEnv *env, jobject thiz)
334 jniThrowException(env, kRunTimeException, "Out of memory");
338 env->SetIntField(thiz, fields.context, (int)mp);
342 android_media_MediaScanner_native_finalize(JNIEnv *env, jobject thiz)
345 MediaScanner *mp = getNativeScanner_l(env, thiz);
350 setNativeScanner_l(env, thiz, 0);
399 int register_android_media_MediaScanner(JNIEnv *env)
401 return AndroidRuntime::registerNativeMethods(env,