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.
|
|
|
|
|
|
2017-03-22 15:42:51 -07:00
|
|
|
#include "flutter/fml/platform/android/jni_util.h"
|
2016-09-23 15:33:25 -07:00
|
|
|
#include "flutter/shell/platform/android/flutter_main.h"
|
|
|
|
|
#include "flutter/shell/platform/android/platform_view_android.h"
|
2016-10-24 16:14:37 -07:00
|
|
|
#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.
|
2017-03-22 15:42:51 -07:00
|
|
|
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
|
|
|
|
// Initialize the Java VM.
|
|
|
|
|
fml::jni::InitJavaVM(vm);
|
2016-01-06 13:41:52 -08:00
|
|
|
|
2017-03-22 15:42:51 -07:00
|
|
|
JNIEnv* env = fml::jni::AttachCurrentThread();
|
|
|
|
|
bool result = false;
|
2016-01-06 13:41:52 -08:00
|
|
|
|
2017-03-22 15:42:51 -07:00
|
|
|
// Register FlutterMain.
|
2019-04-09 17:10:46 -07:00
|
|
|
result = flutter::FlutterMain::Register(env);
|
2018-07-26 12:49:34 -07:00
|
|
|
FML_CHECK(result);
|
2017-03-22 15:42:51 -07:00
|
|
|
|
|
|
|
|
// Register PlatformView
|
2019-04-09 17:10:46 -07:00
|
|
|
result = flutter::PlatformViewAndroid::Register(env);
|
2018-07-26 12:49:34 -07:00
|
|
|
FML_CHECK(result);
|
2017-03-22 15:42:51 -07:00
|
|
|
|
|
|
|
|
// Register VSyncWaiter.
|
2019-04-09 17:10:46 -07:00
|
|
|
result = flutter::VsyncWaiterAndroid::Register(env);
|
2018-07-26 12:49:34 -07:00
|
|
|
FML_CHECK(result);
|
2017-03-22 15:42:51 -07:00
|
|
|
|
2015-01-30 14:05:57 -08:00
|
|
|
return JNI_VERSION_1_4;
|
|
|
|
|
}
|