1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef BERBERIS_ANDROID_API_NATIVE_ACTIVITY_NATIVE_ACTIVITY_H_
18 #define BERBERIS_ANDROID_API_NATIVE_ACTIVITY_NATIVE_ACTIVITY_H_
19 
20 #include <stdint.h>
21 
22 #include <jni.h>
23 
24 #include "berberis/guest_state/guest_addr.h"
25 
26 struct ANativeActivity;
27 
28 namespace berberis {
29 
30 struct Guest_ANativeActivityCallbacks {
31   GuestAddr onStart;
32   GuestAddr onResume;
33   GuestAddr onSaveInstanceState;
34   GuestAddr onPause;
35   GuestAddr onStop;
36   GuestAddr onDestroy;
37   GuestAddr onWindowFocusChanged;
38   GuestAddr onNativeWindowCreated;
39   GuestAddr onNativeWindowResized;
40   GuestAddr onNativeWindowRedrawNeeded;
41   GuestAddr onNativeWindowDestroyed;
42   GuestAddr onInputQueueCreated;
43   GuestAddr onInputQueueDestroyed;
44   GuestAddr onContentRectChanged;
45   GuestAddr onConfigurationChanged;
46   GuestAddr onLowMemory;
47 };
48 
49 struct Guest_ANativeActivity {
50   GuestAddr callbacks;
51   GuestType<JavaVM*> vm;
52   GuestType<JNIEnv*> env;
53   jobject activity;
54   GuestAddr internalDataPath;
55   GuestAddr externalDataPath;
56   int32_t sdkVersion;
57   GuestAddr instance;
58   GuestAddr assetManager;
59   GuestAddr obbPath;
60   ANativeActivity* host_native_activity;
61 };
62 
63 }  // namespace berberis
64 
65 #endif  // BERBERIS_ANDROID_API_NATIVE_ACTIVITY_NATIVE_ACTIVITY_H_
66