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 #include "driver_extension_context.h"
17 
18 #include "ability_connection.h"
19 #include "ability_manager_client.h"
20 #include "hilog_wrapper.h"
21 #include "hitrace_meter.h"
22 
23 namespace OHOS {
24 namespace AbilityRuntime {
25 const size_t DriverExtensionContext::CONTEXT_TYPE_ID(std::hash<const char*> {} ("DriverExtensionContext"));
26 
UpdateDriverState()27 ErrCode DriverExtensionContext::UpdateDriverState()
28 {
29     HILOG_INFO("%{public}s begin.", __func__);
30     ErrCode err = ERR_OK;
31     if (err != ERR_OK) {
32         HILOG_ERROR("DriverContext::UpdateDriverState is failed %{public}d", err);
33     }
34     return err;
35 }
36 
GetAbilityInfoType() const37 AppExecFwk::AbilityType DriverExtensionContext::GetAbilityInfoType() const
38 {
39     std::shared_ptr<AppExecFwk::AbilityInfo> info = GetAbilityInfo();
40     if (info == nullptr) {
41         HILOG_ERROR("DriverContext::GetAbilityInfoType info == nullptr");
42         return AppExecFwk::AbilityType::UNKNOWN;
43     }
44 
45     return info->type;
46 }
47 }  // namespace AbilityRuntime
48 }  // namespace OHOS
49