1 #ifndef DALI_INTEGRATION_ANDROID_FRAMEWORK_H
2 #define DALI_INTEGRATION_ANDROID_FRAMEWORK_H
5 * Copyright (c) 2019 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.
23 #include <android/asset_manager.h>
24 #include <android/asset_manager_jni.h>
25 #include <android/configuration.h>
26 #include <android/native_window.h>
27 #include <android/native_window_jni.h>
29 #ifndef _ANDROID_NATIVE_APP_GLUE_H
36 #include <dali/public-api/common/dali-common.h>
37 #include <dali/public-api/dali-adaptor-common.h>
42 namespace Internal DALI_INTERNAL
47 class AndroidFramework;
56 * AndroidFramework provides setter/getter for Android native interfaces for Android DALi Adaptor.
57 * It is also used to pass Android application events to Android DALi Adaptor.
59 class DALI_ADAPTOR_API AndroidFramework
63 * @brief Create a new Android framework instance. Can be only one per application.
65 * @return a reference to the framework
67 static AndroidFramework& New();
70 * @brief Delete an Android framework instance.
75 * @brief Sets the Android native application glue struct
76 * @param[in] application A pointer to the application glue struct
78 void SetNativeApplication( android_app* application );
81 * @brief Gets the Android native application glue struct
82 * @return the native application glue struct
84 android_app* GetNativeApplication() const;
87 * @brief Sets the Android JVM
88 * @param[in] jvm A pointer to Android JVM
90 void SetJVM( JavaVM* jvm );
94 * @return A pointer to JVM
96 JavaVM* GetJVM() const;
99 * Sets the Android application assets manager.
100 * @param[in] assets A pointer to assets manager
102 void SetApplicationAssets( AAssetManager* assets );
105 * @brief Gets the Android application assets manager.
106 * @return The application assets manager
108 AAssetManager* GetApplicationAssets() const;
111 * @brief Sets the Android application configuration
112 * @param[in] configuration A pointer to Android application configuration
114 void SetApplicationConfiguration( AConfiguration* configuration );
117 * @brief Gets the Android application configuration
118 * @return A Android application configuration
120 AConfiguration* GetApplicationConfiguration() const;
123 * @brief Sets the Android application native window
124 * @return A native window
126 void SetApplicationWindow( ANativeWindow* window );
129 * @brief Gets the Android application native window
130 * @param[in] window A native window
132 ANativeWindow* GetApplicationWindow() const;
135 * Invoked when the Android application is to be terminated.
140 * Invoked when the Android application is to be paused.
145 * Invoked when the Android application is to be resumed.
150 * Invoked when the Android application native window is created.
152 void OnWindowCreated( ANativeWindow* window );
155 * Invoked when the Android application native window is deleted.
157 void OnWindowDestroyed( ANativeWindow* window );
160 * @brief Returns a reference to the instance of the Android framework used by the current thread.
162 * @return A reference to the framework.
163 * @note This is only valid in the main thread.
165 static AndroidFramework& Get();
168 * @brief Virtual Destructor.
170 virtual ~AndroidFramework();
172 // Not copyable or movable
173 AndroidFramework( const AndroidFramework& ) = delete; ///< Deleted copy constructor
174 AndroidFramework( AndroidFramework&& ) = delete; ///< Deleted move constructor
175 AndroidFramework& operator=( const AndroidFramework& ) = delete; ///< Deleted copy assignment operator
176 AndroidFramework& operator=( AndroidFramework&& ) = delete; ///< Deleted move assignment operator
181 * @brief Create an uninitialized AndroidFramework.
185 Internal::Adaptor::AndroidFramework* mImpl; ///< Implementation object
186 friend class Internal::Adaptor::AndroidFramework;
189 } // namespace Integration
193 #endif // DALI_INTEGRATION_ANDROID_FRAMEWORK_H