Files

32 lines
995 B
C++
Raw Permalink Normal View History

2018-11-07 12:24:35 -08:00
// Copyright 2013 The Flutter Authors. All rights reserved.
2015-01-30 14:05:57 -08:00
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/fml/platform/android/jni_util.h"
#include "flutter/shell/platform/android/flutter_main.h"
#include "flutter/shell/platform/android/platform_view_android.h"
#include "flutter/shell/platform/android/vsync_waiter_android.h"
2015-01-30 14:05:57 -08:00
// This is called by the VM when the shared library is first loaded.
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
// Initialize the Java VM.
fml::jni::InitJavaVM(vm);
JNIEnv* env = fml::jni::AttachCurrentThread();
bool result = false;
// Register FlutterMain.
result = flutter::FlutterMain::Register(env);
2018-07-26 12:49:34 -07:00
FML_CHECK(result);
// Register PlatformView
result = flutter::PlatformViewAndroid::Register(env);
2018-07-26 12:49:34 -07:00
FML_CHECK(result);
// Register VSyncWaiter.
result = flutter::VsyncWaiterAndroid::Register(env);
2018-07-26 12:49:34 -07:00
FML_CHECK(result);
2015-01-30 14:05:57 -08:00
return JNI_VERSION_1_4;
}