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

Method OnAppInitWindow

camera/basic/src/main/cpp/android_main.cpp:88–105  ·  view source on GitHub ↗

* Handle Android System APP_CMD_INIT_WINDOW message * Request camera persmission from Java side * Create camera object if camera has been granted */

Source from the content-addressed store, hash-verified

86 * Create camera object if camera has been granted
87 */
88void CameraEngine::OnAppInitWindow(void) {
89 if (!cameraGranted_) {
90 // Not permitted to use camera yet, ask(again) and defer other events
91 RequestCameraPermission();
92 return;
93 }
94
95 rotation_ = GetDisplayRotation();
96
97 CreateCamera();
98 ASSERT(camera_, "CameraCreation Failed");
99
100 EnableUI();
101
102 // NativeActivity end is ready to display, start pulling images
103 cameraReady_ = true;
104 camera_->StartPreview(true);
105}
106
107/**
108 * Handle APP_CMD_TEMR_WINDOW

Callers 1

ProcessAndroidCmdFunction · 0.80

Calls 2

CreateCameraFunction · 0.85
StartPreviewMethod · 0.45

Tested by

no test coverage detected