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 FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_FRAMEWORKS_INCLUDE_STANDBY_SERVICE_SUBSCRIBER_PROXY_H
17 #define FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_FRAMEWORKS_INCLUDE_STANDBY_SERVICE_SUBSCRIBER_PROXY_H
18 
19 #include <iremote_proxy.h>
20 
21 #include "istandby_service_subscriber.h"
22 
23 namespace OHOS {
24 namespace DevStandbyMgr {
25 class StandbyServiceSubscriberProxy : public IRemoteProxy<IStandbyServiceSubscriber> {
26 public:
27     StandbyServiceSubscriberProxy() = delete;
28     explicit StandbyServiceSubscriberProxy(const sptr<IRemoteObject>& impl);
29     ~StandbyServiceSubscriberProxy() override;
30     DISALLOW_COPY_AND_MOVE(StandbyServiceSubscriberProxy);
31 
32     /**
33      * @brief Called back when the standby state changed.
34      *
35      * @param napped The device is in the nap mode.
36      * @param sleeping The device is in the sleeping mode.
37      */
38     void OnDeviceIdleMode(bool napped, bool sleeping) override;
39 
40     /**
41      * @brief report change of allow list to subscriber.
42      *
43      * @param uid uid which changed happens in.
44      * @param name process name of uid.
45      * @param allowType The change of the chang.
46      * @param added add or removed.
47      */
48     void OnAllowListChanged(int32_t uid, const std::string& name, uint32_t allowType, bool added) override;
49 
50     /**
51      * @brief report power over used.
52      *
53      * @param module target callback module.
54      * @param level power overused level.
55      */
56     void OnPowerOverused(const std::string& module, uint32_t level) override;
57 
58 private:
59     static inline BrokerDelegator<StandbyServiceSubscriberProxy> delegator_;
60 };
61 }  // namespace DevStandbyMgr
62 }  // namespace OHOS
63 #endif  // FOUNDATION_RESOURCESCHEDULE_STANDBY_SERVICE_FRAMEWORKS_INCLUDE_STANDBY_SERVICE_SUBSCRIBER_PROXY_H