2018-11-07 12:24:35 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
2018-04-13 13:48:15 -07:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SHELL_HOLDER_H_
|
|
|
|
|
#define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SHELL_HOLDER_H_
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
2018-07-26 12:49:34 -07:00
|
|
|
#include "flutter/fml/macros.h"
|
2018-04-13 13:48:15 -07:00
|
|
|
#include "flutter/fml/platform/android/jni_weak_ref.h"
|
2018-07-26 12:49:34 -07:00
|
|
|
#include "flutter/fml/unique_fd.h"
|
2018-04-13 13:48:15 -07:00
|
|
|
#include "flutter/lib/ui/window/viewport_metrics.h"
|
2020-01-08 19:36:10 -08:00
|
|
|
#include "flutter/runtime/window_data.h"
|
2018-04-13 13:48:15 -07:00
|
|
|
#include "flutter/shell/common/run_configuration.h"
|
|
|
|
|
#include "flutter/shell/common/shell.h"
|
|
|
|
|
#include "flutter/shell/common/thread_host.h"
|
|
|
|
|
#include "flutter/shell/platform/android/platform_view_android.h"
|
|
|
|
|
|
2019-04-09 17:10:46 -07:00
|
|
|
namespace flutter {
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
class AndroidShellHolder {
|
|
|
|
|
public:
|
2019-04-09 12:44:42 -07:00
|
|
|
AndroidShellHolder(flutter::Settings settings,
|
2018-08-07 12:42:22 -07:00
|
|
|
fml::jni::JavaObjectWeakGlobalRef java_object,
|
|
|
|
|
bool is_background_view);
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
~AndroidShellHolder();
|
|
|
|
|
|
|
|
|
|
bool IsValid() const;
|
|
|
|
|
|
|
|
|
|
void Launch(RunConfiguration configuration);
|
|
|
|
|
|
2019-04-09 12:44:42 -07:00
|
|
|
const flutter::Settings& GetSettings() const;
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
fml::WeakPtr<PlatformViewAndroid> GetPlatformView();
|
|
|
|
|
|
|
|
|
|
Rasterizer::Screenshot Screenshot(Rasterizer::ScreenshotType type,
|
|
|
|
|
bool base64_encode);
|
|
|
|
|
|
2019-04-09 12:44:42 -07:00
|
|
|
void UpdateAssetManager(fml::RefPtr<flutter::AssetManager> asset_manager);
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
private:
|
2019-04-09 12:44:42 -07:00
|
|
|
const flutter::Settings settings_;
|
2018-04-13 13:48:15 -07:00
|
|
|
const fml::jni::JavaObjectWeakGlobalRef java_object_;
|
|
|
|
|
fml::WeakPtr<PlatformViewAndroid> platform_view_;
|
|
|
|
|
ThreadHost thread_host_;
|
|
|
|
|
std::unique_ptr<Shell> shell_;
|
|
|
|
|
bool is_valid_ = false;
|
2018-04-30 10:44:01 -07:00
|
|
|
pthread_key_t thread_destruct_key_;
|
2019-05-20 16:52:16 -07:00
|
|
|
uint64_t next_pointer_flow_id_ = 0;
|
2018-04-30 10:44:01 -07:00
|
|
|
|
|
|
|
|
static void ThreadDestructCallback(void* value);
|
2018-04-13 13:48:15 -07:00
|
|
|
|
2018-07-26 12:49:34 -07:00
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(AndroidShellHolder);
|
2018-04-13 13:48:15 -07:00
|
|
|
};
|
|
|
|
|
|
2019-04-09 17:10:46 -07:00
|
|
|
} // namespace flutter
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SHELL_HOLDER_H_
|