Flutter Engine
The Flutter Engine
Functions
main_android.cpp File Reference
#include <jni.h>
#include <errno.h>
#include <android_native_app_glue.h>
#include "tools/sk_app/Application.h"
#include "tools/timer/Timer.h"

Go to the source code of this file.

Functions

void android_main (struct android_app *state)
 

Function Documentation

◆ android_main()

void android_main ( struct android_app *  state)

This is the main entry point of a native application that is using android_native_app_glue. It runs in its own thread, with its own event loop for receiving input events and doing other things.

Definition at line 23 of file main_android.cpp.

23 {
24 // Make sure glue isn't stripped.
25 app_dummy();
26
27 static const char* gCmdLine[] = {
28 "viewer",
29 "--skps",
30 "/data/local/tmp/skps",
31 // TODO: figure out how to use am start with extra params to pass in additional arguments at
32 // runtime
33 // "--atrace",
34 };
35
36 std::unique_ptr<Application> vkApp(Application::Create(std::size(gCmdLine),
37 const_cast<char**>(gCmdLine),
38 state));
39
40 // loop waiting for stuff to do.
41 while (!state->destroyRequested) {
42 struct android_poll_source* source = nullptr;
43 auto result = ALooper_pollOnce(-1, nullptr, nullptr, (void**)&source);
44
45 if (result == ALOOPER_POLL_ERROR) {
46 SkDEBUGFAIL("ALooper_pollOnce returned an error");
47 }
48 if (source != nullptr) {
49 source->process(state, source);
50 }
51 vkApp->onIdle();
52 }
53}
static sk_sp< Effect > Create()
Definition: RefCntTest.cpp:117
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
SkBitmap source
Definition: examples.cpp:28
AtkStateType state
GAsyncResult * result
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259