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 int32_t userId; 33 int32_t appIndex; 34 ConstAssetBlob owner; 35 ConstAssetBlob developerId; 36 ConstAssetBlobArray groupIds; 37 ConstAssetBlob bundleName; 38 } PackageInfo; 39 40 typedef void (*OnPackageRemoved)(PackageInfo); 41 typedef void (*OnUserRemoved)(int32_t); 42 typedef void (*OnScreenOff)(void); 43 typedef void (*OnCharging)(void); 44 typedef void (*OnAppRestore)(int32_t, const uint8_t *, int32_t); 45 typedef void (*OnUserUnlocked)(int32_t); 46 47 typedef struct { 48 OnPackageRemoved onPackageRemoved; 49 OnUserRemoved onUserRemoved; 50 OnScreenOff onScreenOff; 51 OnCharging onCharging; 52 OnAppRestore onAppRestore; 53 OnUserUnlocked onUserUnlocked; 54 } EventCallBack; 55 56 #ifdef __cplusplus 57 extern "C" { 58 #endif 59 60 bool SubscribeSystemEvent(const EventCallBack eventCallBack); 61 bool UnSubscribeSystemEvent(void); 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 #endif // SYSTEM_EVENT_WRAPPER_H 68