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 #include "app_group_callback_stub.h"
17
18 namespace OHOS {
19 namespace DeviceUsageStats {
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)20 int32_t AppGroupCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel &reply,
21 MessageOption &option)
22 {
23 std::u16string descriptor = AppGroupCallbackStub::GetDescriptor();
24 std::u16string remoteDescriptor = data.ReadInterfaceToken();
25 if (descriptor != remoteDescriptor) {
26 BUNDLE_ACTIVE_LOGE("RegisterAppGroupCallBack OnRemoteRequest cannot get power mgr service");
27 return -1;
28 }
29 switch (code) {
30 case static_cast<uint32_t>(IAppGroupCallback::message::ON_BUNDLE_GROUP_CHANGED): {
31 std::shared_ptr<AppGroupCallbackInfo> groupInfo(
32 data.ReadParcelable<AppGroupCallbackInfo>());
33 if (!groupInfo) {
34 BUNDLE_ACTIVE_LOGE("RegisterAppGroupCallBack ReadParcelable<AbilityStateData> failed");
35 return -1;
36 }
37 OnAppGroupChanged(*(groupInfo.get()));
38 groupInfo = nullptr;
39 break;
40 }
41 default:
42 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
43 }
44 return 0;
45 }
46
OnAppGroupChanged(const AppGroupCallbackInfo & appGroupCallbackInfo)47 void AppGroupCallbackStub::OnAppGroupChanged(const AppGroupCallbackInfo &appGroupCallbackInfo)
48 {
49 }
50 } // namespace DeviceUsageStats
51 } // namespace OHOS
52
53