1db372d24Sopenharmony_ci/* 2db372d24Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3db372d24Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4db372d24Sopenharmony_ci * you may not use this file except in compliance with the License. 5db372d24Sopenharmony_ci * You may obtain a copy of the License at 6db372d24Sopenharmony_ci * 7db372d24Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8db372d24Sopenharmony_ci * 9db372d24Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10db372d24Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11db372d24Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12db372d24Sopenharmony_ci * See the License for the specific language governing permissions and 13db372d24Sopenharmony_ci * limitations under the License. 14db372d24Sopenharmony_ci */ 15db372d24Sopenharmony_ci 16db372d24Sopenharmony_ci#ifndef UI_APPEARANCE_ABILITY_CLIENT_H 17db372d24Sopenharmony_ci#define UI_APPEARANCE_ABILITY_CLIENT_H 18db372d24Sopenharmony_ci 19db372d24Sopenharmony_ci#include <string> 20db372d24Sopenharmony_ci#include "iremote_object.h" 21db372d24Sopenharmony_ci#include "refbase.h" 22db372d24Sopenharmony_ci#include "ui_appearance_ability_interface.h" 23db372d24Sopenharmony_ci 24db372d24Sopenharmony_cinamespace OHOS { 25db372d24Sopenharmony_cinamespace ArkUi::UiAppearance { 26db372d24Sopenharmony_ciclass UiAppearanceDeathRecipient : public IRemoteObject::DeathRecipient { 27db372d24Sopenharmony_cipublic: 28db372d24Sopenharmony_ci explicit UiAppearanceDeathRecipient() = default; 29db372d24Sopenharmony_ci ~UiAppearanceDeathRecipient() = default; 30db372d24Sopenharmony_ci void OnRemoteDied(const wptr<IRemoteObject>& object) override; 31db372d24Sopenharmony_ci}; 32db372d24Sopenharmony_ci 33db372d24Sopenharmony_ciclass UiAppearanceAbilityClient : public RefBase { 34db372d24Sopenharmony_cipublic: 35db372d24Sopenharmony_ci UiAppearanceAbilityClient() = default; 36db372d24Sopenharmony_ci ~UiAppearanceAbilityClient() = default; 37db372d24Sopenharmony_ci static sptr<UiAppearanceAbilityClient> GetInstance(); 38db372d24Sopenharmony_ci 39db372d24Sopenharmony_ci int32_t SetDarkMode(UiAppearanceAbilityInterface::DarkMode mode); 40db372d24Sopenharmony_ci int32_t GetDarkMode(); 41db372d24Sopenharmony_ci int32_t GetFontScale(std::string& fontScale); 42db372d24Sopenharmony_ci int32_t SetFontScale(std::string& fontScale); 43db372d24Sopenharmony_ci int32_t GetFontWeightScale(std::string& fontWeightScale); 44db372d24Sopenharmony_ci int32_t SetFontWeightScale(std::string& fontWeightScale); 45db372d24Sopenharmony_ci void OnRemoteSaDied(const wptr<IRemoteObject>& object); 46db372d24Sopenharmony_ci 47db372d24Sopenharmony_ciprivate: 48db372d24Sopenharmony_ci sptr<UiAppearanceAbilityInterface> GetUiAppearanceServiceProxy(); 49db372d24Sopenharmony_ci static sptr<UiAppearanceAbilityInterface> CreateUiAppearanceServiceProxy(); 50db372d24Sopenharmony_ci 51db372d24Sopenharmony_ci static inline std::mutex instanceLock_; 52db372d24Sopenharmony_ci static inline sptr<UiAppearanceAbilityClient> instance_; 53db372d24Sopenharmony_ci static inline sptr<UiAppearanceAbilityInterface> uiAppearanceServiceProxy_; 54db372d24Sopenharmony_ci static inline sptr<UiAppearanceDeathRecipient> deathRecipient_; 55db372d24Sopenharmony_ci}; 56db372d24Sopenharmony_ci} // namespace ArkUi::UiAppearance 57db372d24Sopenharmony_ci} // namespace OHOS 58db372d24Sopenharmony_ci#endif // UI_APPEARANCE_ABILITY_CLIENT_H