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.
25 #include <android/asset_manager.h>
26 #include <android/asset_manager_jni.h>
27 #include <android/configuration.h>
28 #include <android/native_window.h>
29 #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>
44 namespace Internal DALI_INTERNAL
49 class AndroidFramework;
58 * AndroidFramework provides setter/getter for Android native interfaces for Android DALi Adaptor.
59 * It is also used to pass Android application events to Android DALi Adaptor.
61 class DALI_ADAPTOR_API AndroidFramework
65 * @brief Create a new Android framework instance. Can be only one per application.
67 * @return a reference to the framework
69 static AndroidFramework& New();
72 * @brief Delete an Android framework instance.
77 * @brief Sets the Android native application glue struct
78 * @param[in] application A pointer to the application glue struct
80 void SetNativeApplication( android_app* application );
83 * @brief Gets the Android native application glue struct
84 * @return the native application glue struct
86 android_app* GetNativeApplication() const;
89 * @brief Sets the Android JVM
90 * @param[in] jvm A pointer to Android JVM
92 void SetJVM( JavaVM* jvm );
96 * @return A pointer to JVM
98 JavaVM* GetJVM() const;
101 * Sets the Android application assets manager.
102 * @param[in] assets A pointer to assets manager
104 void SetApplicationAssets( AAssetManager* assets );
107 * @brief Gets the Android application assets manager.
108 * @return The application assets manager
110 AAssetManager* GetApplicationAssets() const;
113 * Sets the Android application internal data path.
114 * @param[in] path A path to the application data path
116 void SetInternalDataPath( const std::string& path );
119 * Gets the Android application internal data path.
120 * @return The application data path
122 std::string GetInternalDataPath() const;
125 * @brief Sets the Android application configuration
126 * @param[in] configuration A pointer to Android application configuration
128 void SetApplicationConfiguration( AConfiguration* configuration );
131 * @brief Gets the Android application configuration
132 * @return A Android application configuration
134 AConfiguration* GetApplicationConfiguration() const;
137 * @brief Sets the Android application native window
138 * @return A native window
140 void SetApplicationWindow( ANativeWindow* window );
143 * @brief Gets the Android application native window
144 * @param[in] window A native window
146 ANativeWindow* GetApplicationWindow() const;
149 * Invoked when the Android application is to be terminated.
154 * Invoked when the Android application is to be paused.
159 * Invoked when the Android application is to be resumed.
164 * Invoked when the Android application native window is created.
166 void OnWindowCreated( ANativeWindow* window );
169 * Invoked when the Android application native window is deleted.
171 void OnWindowDestroyed( ANativeWindow* window );
174 * @brief Returns a reference to the instance of the Android framework used by the current thread.
176 * @return A reference to the framework.
177 * @note This is only valid in the main thread.
179 static AndroidFramework& Get();
182 * @brief Virtual Destructor.
184 virtual ~AndroidFramework();
186 // Not copyable or movable
187 AndroidFramework( const AndroidFramework& ) = delete; ///< Deleted copy constructor
188 AndroidFramework( AndroidFramework&& ) = delete; ///< Deleted move constructor
189 AndroidFramework& operator=( const AndroidFramework& ) = delete; ///< Deleted copy assignment operator
190 AndroidFramework& operator=( AndroidFramework&& ) = delete; ///< Deleted move assignment operator
195 * @brief Create an uninitialized AndroidFramework.
199 Internal::Adaptor::AndroidFramework* mImpl; ///< Implementation object
200 friend class Internal::Adaptor::AndroidFramework;
203 } // namespace Integration
207 #endif // DALI_INTEGRATION_ANDROID_FRAMEWORK_H