MCPcopy Create free account
hub / github.com/android/ndk-samples / RequestCameraPermission

Method RequestCameraPermission

camera/basic/src/main/cpp/camera_engine.cpp:124–140  ·  view source on GitHub ↗

* Initiate a Camera Run-time usage request to Java side implementation * [ The request result will be passed back in function * notifyCameraPermission()] */

Source from the content-addressed store, hash-verified

122 * notifyCameraPermission()]
123 */
124void CameraEngine::RequestCameraPermission() {
125 if (!app_) return;
126
127 JNIEnv* env;
128 ANativeActivity* activity = app_->activity;
129 activity->vm->GetEnv((void**)&env, JNI_VERSION_1_6);
130
131 activity->vm->AttachCurrentThread(&env, NULL);
132
133 jobject activityObj = env->NewGlobalRef(activity->clazz);
134 jclass clz = env->GetObjectClass(activityObj);
135 env->CallVoidMethod(activityObj,
136 env->GetMethodID(clz, "RequestCamera", "()V"));
137 env->DeleteGlobalRef(activityObj);
138
139 activity->vm->DetachCurrentThread();
140}
141/**
142 * Process to user's sensitivity and exposure value change
143 * all values are represented in int64_t even exposure is just int32_t

Callers

nothing calls this directly

Calls 3

AttachCurrentThreadMethod · 0.80
CallVoidMethodMethod · 0.80
DetachCurrentThreadMethod · 0.80

Tested by

no test coverage detected