• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_DATAOBS_MGR_INNER_COMMON_H
17 #define OHOS_ABILITY_RUNTIME_DATAOBS_MGR_INNER_COMMON_H
18 
19 #include "data_ability_observer_interface.h"
20 #include <string>
21 
22 namespace OHOS {
23 namespace AAFwk {
24 
25 struct ObserverInfo {
ObserverInfoObserverInfo26     ObserverInfo() {}
ObserverInfoObserverInfo27     ObserverInfo(uint32_t tokenId, uint64_t fullTokenId, uint32_t firstCallerTokenId, int32_t userId, bool isExtension)
28         : tokenId(tokenId), fullTokenId(fullTokenId), firstCallerTokenId(firstCallerTokenId), userId(userId),
29           isExtension(isExtension) {}
30     uint32_t tokenId = 0;
31     uint64_t fullTokenId = 0;
32     uint32_t firstCallerTokenId = 0;
33     int32_t userId = -1;
34     int32_t callingUserId = -1;
35     bool isExtension = false;
36     std::string permission;
37     std::string errMsg;
38 };
39 
40 struct ObserverNode {
41     sptr<IDataAbilityObserver> observer_ = nullptr;
42     int32_t userId_ = -1;
43     uint32_t tokenId_ = 0;
44     uint32_t firstCallerTokenID_ = 0;
45     bool isExtension_ = false;
46     std::string permission_;
47 
ObserverNodeObserverNode48     ObserverNode(sptr<IDataAbilityObserver> observer, int32_t userId, uint32_t tokenId):observer_(observer),
49         userId_(userId), tokenId_(tokenId) {}
50 
51     bool operator==(struct ObserverNode other) const
52     {
53         return (observer_ == other.observer_) && (userId_ == other.userId_) && (tokenId_ == other.tokenId_);
54     }
55 };
56 
57 }  // namespace AAFwk
58 }  // namespace OHOS
59 #endif  // OHOS_ABILITY_RUNTIME_DATAOBS_MGR_INNER_COMMON_H