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 OHOS_ABILITY_RUNTIME_DRIVER_EXTENSION_CONTEXT_H 17 #define OHOS_ABILITY_RUNTIME_DRIVER_EXTENSION_CONTEXT_H 18 19 #include "extension_context.h" 20 21 #include "ability_connect_callback.h" 22 #include "connection_manager.h" 23 #include "local_call_container.h" 24 #include "start_options.h" 25 #include "want.h" 26 27 namespace OHOS { 28 namespace AbilityRuntime { 29 /** 30 * @brief context supply for driver 31 * 32 */ 33 class DriverExtensionContext : public ExtensionContext { 34 public: 35 DriverExtensionContext() = default; 36 virtual ~DriverExtensionContext() = default; 37 38 /** 39 * @brief Update the state of driver. 40 * 41 * @return errCode ERR_OK on success, others on failure. 42 */ 43 ErrCode UpdateDriverState(); 44 45 using SelfType = DriverExtensionContext; 46 static const size_t CONTEXT_TYPE_ID; 47 48 protected: IsContext(size_t contextTypeId)49 bool IsContext(size_t contextTypeId) override 50 { 51 return contextTypeId == CONTEXT_TYPE_ID || ExtensionContext::IsContext(contextTypeId); 52 } 53 54 private: 55 /** 56 * @brief Get Current Ability Type 57 * 58 * @return Current Ability Type 59 */ 60 OHOS::AppExecFwk::AbilityType GetAbilityInfoType() const; 61 }; 62 } // namespace AbilityRuntime 63 } // namespace OHOS 64 #endif // OHOS_ABILITY_RUNTIME_DRIVER_EXTENSION_CONTEXT_H 65