• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 SYSTEM_EVENT_WRAPPER
17 #define SYSTEM_EVENT_WRAPPER
18 
19 #include <stdint.h>
20 
21 typedef struct {
22     uint32_t size;
23     const uint8_t *data;
24 } ConstAssetBlob;
25 
26 typedef struct {
27     uint32_t size;
28     const ConstAssetBlob *blob;
29 } ConstAssetBlobArray;
30 
31 typedef struct {
32     bool modify;
33     const char *blob;
34 } ModifyAssetBlob;
35 
36 typedef struct {
37     uint32_t size;
38     ModifyAssetBlob *blob;
39 } MutAssetBlobArray;
40 
41 typedef struct {
42     int32_t userId;
43     int32_t appIndex;
44     ConstAssetBlob owner;
45     ConstAssetBlob developerId;
46     ConstAssetBlobArray groupIds;
47     ConstAssetBlob bundleName;
48 } PackageInfo;
49 
50 typedef void (*OnPackageRemoved)(PackageInfo);
51 typedef void (*OnUserRemoved)(int32_t);
52 typedef void (*OnScreenOff)(void);
53 typedef void (*OnCharging)(void);
54 typedef void (*OnAppRestore)(int32_t, const uint8_t *, int32_t);
55 typedef void (*OnUserUnlocked)(int32_t);
56 
57 typedef struct {
58     OnPackageRemoved onPackageRemoved;
59     OnUserRemoved onUserRemoved;
60     OnScreenOff onScreenOff;
61     OnCharging onCharging;
62     OnAppRestore onAppRestore;
63     OnUserUnlocked onUserUnlocked;
64 } EventCallBack;
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 bool SubscribeSystemEvent(const EventCallBack eventCallBack);
71 bool UnSubscribeSystemEvent(void);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif // SYSTEM_EVENT_WRAPPER_H
78