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

Function ProcessAndroidCmd

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

* Teamplate function for NativeActivity derived applications * Create/Delete camera object with * INIT_WINDOW/TERM_WINDOW command, ignoring other event. */

Source from the content-addressed store, hash-verified

33 * INIT_WINDOW/TERM_WINDOW command, ignoring other event.
34 */
35static void ProcessAndroidCmd(struct android_app* app, int32_t cmd) {
36 CameraEngine* engine = reinterpret_cast<CameraEngine*>(app->userData);
37 switch (cmd) {
38 case APP_CMD_INIT_WINDOW:
39 if (engine->AndroidApp()->window != NULL) {
40 engine->SaveNativeWinRes(ANativeWindow_getWidth(app->window),
41 ANativeWindow_getHeight(app->window),
42 ANativeWindow_getFormat(app->window));
43 engine->OnAppInitWindow();
44 }
45 break;
46 case APP_CMD_TERM_WINDOW:
47 engine->OnAppTermWindow();
48 ANativeWindow_setBuffersGeometry(
49 app->window, engine->GetSavedNativeWinWidth(),
50 engine->GetSavedNativeWinHeight(), engine->GetSavedNativeWinFormat());
51 break;
52 case APP_CMD_CONFIG_CHANGED:
53 engine->OnAppConfigChange();
54 break;
55 case APP_CMD_LOST_FOCUS:
56 break;
57 }
58}
59
60extern "C" void android_main(struct android_app* state) {
61 CameraEngine engine(state);

Callers

nothing calls this directly

Calls 8

AndroidAppMethod · 0.80
SaveNativeWinResMethod · 0.80
OnAppInitWindowMethod · 0.80
OnAppTermWindowMethod · 0.80
OnAppConfigChangeMethod · 0.80

Tested by

no test coverage detected