• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ABILITY_RUNTIME_CJ_APPLICATION_CONTEXT_FFI_H
17 #define OHOS_ABILITY_RUNTIME_CJ_APPLICATION_CONTEXT_FFI_H
18 
19 #include <cstdint>
20 #include <shared_mutex>
21 
22 #include "application_context.h"
23 #include "cj_ability_lifecycle_callback.h"
24 #include "cj_application_context.h"
25 #include "cj_application_state_change_callback.h"
26 #include "cj_common_ffi.h"
27 #include "cj_environment_callback.h"
28 #include "cj_macro.h"
29 #include "cj_utils_ffi.h"
30 #include "cj_want_ffi.h"
31 #include "ffi_remote_data.h"
32 #include "running_process_info.h"
33 #include "want.h"
34 #include "want_params.h"
35 
36 namespace OHOS {
37 namespace ApplicationContextCJ {
38 
39 struct CApplicationInfo {
40     const char *name;
41     const char *bundleName;
42 };
43 
44 extern "C" {
45 CJ_EXPORT int64_t FFIGetArea(int64_t id);
46 CJ_EXPORT CApplicationInfo *FFICJApplicationInfo(int64_t id);
47 CJ_EXPORT int32_t FfiCJApplicationContextOnOnEnvironment(int64_t id, void (*cfgCallback)(CConfiguration),
48                                                          void (*memCallback)(int32_t), int32_t *errCode);
49 CJ_EXPORT int32_t FfiCJApplicationContextOnOnAbilityLifecycle(int64_t id, CArrI64 cFuncIds, int32_t *errCode);
50 CJ_EXPORT int32_t FfiCJApplicationContextOnOnApplicationStateChange(int64_t id, void (*foregroundCallback)(void),
51                                                                     void (*backgroundCallback)(void), int32_t *errCode);
52 CJ_EXPORT void FfiCJApplicationContextOnOff(int64_t id, const char *type, int32_t callbackId, int32_t *errCode);
53 CJ_EXPORT void FfiCJApplicationContextSetFont(int64_t id, const char *font, int32_t *errCode);
54 CJ_EXPORT void FfiCJApplicationContextSetLanguage(int64_t id, const char *language, int32_t *errCode);
55 CJ_EXPORT void FfiCJApplicationContextSetColorMode(int64_t id, int32_t colorMode, int32_t *errCode);
56 CJ_EXPORT CArrProcessInformation FfiCJApplicationContextGetRunningProcessInformation(int64_t id, int32_t *errCode);
57 CJ_EXPORT void FfiCJApplicationContextKillAllProcesses(int64_t id, bool clearPageStack, int32_t *errCode);
58 CJ_EXPORT int32_t FfiCJApplicationContextGetCurrentAppCloneIndex(int64_t id, int32_t *errCode);
59 CJ_EXPORT void FfiCJApplicationContextRestartApp(int64_t id, WantHandle want, int32_t *errCode);
60 CJ_EXPORT void FfiCJApplicationContextClearUpApplicationData(int64_t id, int32_t *errCode);
61 CJ_EXPORT void FfiCJApplicationContextSetSupportedProcessCache(int64_t id, bool isSupported, int32_t *errCode);
62 };
63 } // namespace ApplicationContextCJ
64 } // namespace OHOS
65 #endif // OHOS_ABILITY_RUNTIME_CJ_APPLICATION_CONTEXT_H