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 ACCESS_CONTINUOUS_TASK_CALLBACK_INFO_H 17 #define ACCESS_CONTINUOUS_TASK_CALLBACK_INFO_H 18 19 #include <singleton.h> 20 #include <string> 21 22 #include "parcel.h" 23 #include "iremote_object.h" 24 25 namespace OHOS { 26 namespace Security { 27 namespace AccessToken { 28 enum class BackgroundMode { 29 DATA_TRANSFER = 1, 30 AUDIO_PLAYBACK, 31 AUDIO_RECORDING, 32 LOCATION, 33 BLUETOOTH_INTERACTION, 34 MULTI_DEVICE_CONNECTION, 35 WIFI_INTERACTION, 36 VOIP, 37 TASK_KEEPING, 38 }; 39 40 struct ContinuousTaskCallbackInfo : public Parcelable { 41 uint32_t typeId_ {0}; 42 int32_t creatorUid_ {0}; 43 pid_t creatorPid_ {0}; 44 std::string abilityName_ {""}; 45 bool isFromWebview_ {false}; 46 bool isBatchApi_ {false}; 47 std::vector<uint32_t> typeIds_ {}; 48 int32_t abilityId_ {-1}; 49 uint64_t tokenId_ {0}; 50 51 uint64_t GetFullTokenId() const; 52 uint32_t GetTypeId() const; 53 std::vector<uint32_t> GetTypeIds() const; 54 bool ReadFromParcel(Parcel &parcel); 55 bool Marshalling(Parcel &parcel) const override; 56 static ContinuousTaskCallbackInfo *Unmarshalling(Parcel &parcel); 57 }; 58 } // namespace AccessToken 59 } // namespace Security 60 } // namespace OHOS 61 #endif // ACCESS_CONTINUOUS_TASK_CALLBACK_INFO_H 62