1 #ifndef DALI_INTEGRATION_ANDROID_FRAMEWORK_H
2 #define DALI_INTEGRATION_ANDROID_FRAMEWORK_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
24 #include <android/asset_manager.h>
25 #include <android/asset_manager_jni.h>
26 #include <android/configuration.h>
27 #include <android/native_window.h>
28 #include <android/native_window_jni.h>
31 #ifndef _ANDROID_NATIVE_APP_GLUE_H
38 #include <dali/public-api/common/dali-common.h>
39 #include <dali/public-api/dali-adaptor-common.h>
43 namespace Internal DALI_INTERNAL
47 class AndroidFramework;
50 } // namespace DALI_INTERNAL
55 * AndroidFramework provides setter/getter for Android native interfaces for Android DALi Adaptor.
56 * It is also used to pass Android application events to Android DALi Adaptor.
58 class DALI_ADAPTOR_API AndroidFramework
62 * @brief Create a new Android framework instance. Can be only one per application.
64 * @return a reference to the framework
66 static AndroidFramework& New();
69 * @brief Delete an Android framework instance.
74 * @brief Sets the Android native application glue struct
75 * @param[in] application A pointer to the application glue struct
77 void SetNativeApplication(android_app* application);
80 * @brief Gets the Android native application glue struct
81 * @return the native application glue struct
83 android_app* GetNativeApplication() const;
86 * @brief Sets the Android JVM
87 * @param[in] jvm A pointer to Android JVM
89 void SetJVM(JavaVM* jvm);
93 * @return A pointer to JVM
95 JavaVM* GetJVM() const;
98 * Sets the Android application assets manager.
99 * @param[in] assets A pointer to assets manager
101 void SetApplicationAssets(AAssetManager* assets);
104 * @brief Gets the Android application assets manager.
105 * @return The application assets manager
107 AAssetManager* GetApplicationAssets() const;
110 * Sets the Android application internal data path.
111 * @param[in] path A path to the application data path
113 void SetInternalDataPath(const std::string& path);
116 * Gets the Android application internal data path.
117 * @return The application data path
119 std::string GetInternalDataPath() const;
122 * @brief Sets the Android application configuration
123 * @param[in] configuration A pointer to Android application configuration
125 void SetApplicationConfiguration(AConfiguration* configuration);
128 * @brief Gets the Android application configuration
129 * @return A Android application configuration
131 AConfiguration* GetApplicationConfiguration() const;
134 * @brief Sets the Android application native window
135 * @return A native window
137 void SetApplicationWindow(ANativeWindow* window);
140 * @brief Gets the Android application native window
141 * @param[in] window A native window
143 ANativeWindow* GetApplicationWindow() const;
146 * Invoked when the Android application is to be terminated.
151 * Invoked when the Android application is to be paused.
156 * Invoked when the Android application is to be resumed.
161 * Invoked when the Android application native window is created.
163 void OnWindowCreated(ANativeWindow* window);
166 * Invoked when the Android application native window is deleted.
168 void OnWindowDestroyed(ANativeWindow* window);
171 * @brief Returns a reference to the instance of the Android framework used by the current thread.
173 * @return A reference to the framework.
174 * @note This is only valid in the main thread.
176 static AndroidFramework& Get();
179 * @brief Virtual Destructor.
181 virtual ~AndroidFramework();
183 // Not copyable or movable
184 AndroidFramework(const AndroidFramework&) = delete; ///< Deleted copy constructor
185 AndroidFramework(AndroidFramework&&) = delete; ///< Deleted move constructor
186 AndroidFramework& operator=(const AndroidFramework&) = delete; ///< Deleted copy assignment operator
187 AndroidFramework& operator=(AndroidFramework&&) = delete; ///< Deleted move assignment operator
191 * @brief Create an uninitialized AndroidFramework.
195 Internal::Adaptor::AndroidFramework* mImpl; ///< Implementation object
196 friend class Internal::Adaptor::AndroidFramework;
199 } // namespace Integration
203 #endif // DALI_INTEGRATION_ANDROID_FRAMEWORK_H