[Base] Android JNIEnv attachment and LaunchWebBrowser

This commit is contained in:
Triang3l
2022-01-30 23:35:01 +03:00
parent 54b057a46b
commit 3f817fb241
7 changed files with 433 additions and 31 deletions

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2021 Ben Vanik. All rights reserved. *
* Copyright 2022 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -10,6 +10,7 @@
#ifndef XENIA_BASE_MAIN_ANDROID_H_
#define XENIA_BASE_MAIN_ANDROID_H_
#include <jni.h>
#include <cstdint>
#include "xenia/base/platform.h"
@@ -27,14 +28,22 @@ namespace xe {
// counting internally.
//
// In standalone console apps built with $(BUILD_EXECUTABLE), these functions
// must be called in `main`.
void InitializeAndroidAppFromMainThread(int32_t api_level);
// must be called in `main`, with a null main thread JNI environment.
void InitializeAndroidAppFromMainThread(int32_t api_level,
JNIEnv* main_thread_jni_env,
jobject application_context);
void ShutdownAndroidAppFromMainThread();
// May be the minimum supported level if the initialization was done without a
// configuration.
int32_t GetAndroidApiLevel();
// May return null if not in a Java VM process, or in case of a failure to
// attach on a non-main thread.
JNIEnv* GetAndroidThreadJNIEnv();
// Returns the global reference if in an application context, or null otherwise.
jobject GetAndroidApplicationContext();
} // namespace xe
#endif // XENIA_BASE_MAIN_ANDROID_H_