1 /*
2  * Copyright (c) 2022 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 BUNDLE_ACTIVE_STUB_H
17 #define BUNDLE_ACTIVE_STUB_H
18 
19 #include <cstdint>
20 #include "ibundle_active_service.h"
21 #include "nocopyable.h"
22 
23 namespace OHOS {
24 namespace DeviceUsageStats {
25 class BundleActiveStub : public IRemoteStub<IBundleActiveService> {
26 public:
27     BundleActiveStub(bool serialInvokeFlag = true) : IRemoteStub<IBundleActiveService>(serialInvokeFlag) {}
28     ~BundleActiveStub() override = default;
29     DISALLOW_COPY_AND_MOVE(BundleActiveStub);
30     /*
31     * function: OnRemoteRequest, handle message from proxy.
32     * parameters: code, data, reply, option
33     * return: errorcode.
34     */
35     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel &reply,
36         MessageOption &option) override;
37 private:
38     ErrCode HandleReportEvent(MessageParcel& data, MessageParcel& reply);
39     ErrCode HandleIsBundleIdle(MessageParcel& data, MessageParcel& reply);
40     ErrCode HandleIsBundleUsePeriod(MessageParcel& data, MessageParcel& reply);
41     ErrCode HandleQueryBundleStatsInfoByInterval(MessageParcel& data, MessageParcel& reply);
42     ErrCode HandleQueryBundleEvents(MessageParcel& data, MessageParcel& reply);
43     ErrCode HandleQueryBundleStatsInfos(MessageParcel& data, MessageParcel& reply);
44     ErrCode HandleSetAppGroup(MessageParcel &data, MessageParcel &reply);
45     ErrCode HandleQueryCurrentBundleEvents(MessageParcel &data, MessageParcel &reply);
46     ErrCode HandleQueryModuleUsageRecords(MessageParcel &data, MessageParcel &reply);
47     ErrCode HandleQueryAppGroup(MessageParcel& data, MessageParcel& reply);
48     ErrCode HandleRegisterAppGroupCallBack(MessageParcel& data, MessageParcel& reply);
49     ErrCode HandleUnRegisterAppGroupCallBack(MessageParcel& data, MessageParcel& reply);
50     ErrCode HandleQueryDeviceEventStats(MessageParcel& data, MessageParcel& reply);
51     ErrCode HandleQueryNotificationEventStats(MessageParcel& data, MessageParcel& reply);
52 };
53 }  // namespace DeviceUsageStats
54 }  // namespace OHOS
55 #endif  // BUNDLE_ACTIVE_STUB_H
56 
57