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