• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022-2025 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 UI_APPEARANCE_ABILITY_CLIENT_H
17 #define UI_APPEARANCE_ABILITY_CLIENT_H
18 
19 #include <string>
20 #include "iremote_object.h"
21 #include "refbase.h"
22 #include "iui_appearance_ability.h"
23 #include "ui_appearance_types.h"
24 
25 namespace OHOS {
26 namespace ArkUi::UiAppearance {
27 class UiAppearanceDeathRecipient : public IRemoteObject::DeathRecipient {
28 public:
29     explicit UiAppearanceDeathRecipient() = default;
30     ~UiAppearanceDeathRecipient() = default;
31     void OnRemoteDied(const wptr<IRemoteObject>& object) override;
32 };
33 
34 class __attribute__((visibility("default"))) UiAppearanceAbilityClient : public RefBase {
35 public:
36     UiAppearanceAbilityClient();
37     ~UiAppearanceAbilityClient() = default;
38     static sptr<UiAppearanceAbilityClient> GetInstance();
39 
40     int32_t SetDarkMode(DarkMode mode);
41     int32_t GetDarkMode();
42     int32_t GetFontScale(std::string& fontScale);
43     int32_t SetFontScale(std::string& fontScale);
44     int32_t GetFontWeightScale(std::string& fontWeightScale);
45     int32_t SetFontWeightScale(std::string& fontWeightScale);
46     void OnRemoteSaDied(const wptr<IRemoteObject>& object);
47 
48 private:
49     sptr<IUiAppearanceAbility> GetUiAppearanceServiceProxy();
50     sptr<IUiAppearanceAbility> CreateUiAppearanceServiceProxy();
51 
52     std::mutex serviceProxyLock_;
53     sptr<IUiAppearanceAbility> uiAppearanceServiceProxy_;
54 };
55 } // namespace ArkUi::UiAppearance
56 } // namespace OHOS
57 #endif // UI_APPEARANCE_ABILITY_CLIENT_H
58