• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #ifndef UDMF_DIALOG_H
16 #define UDMF_DIALOG_H
17 
18 #include "error_code.h"
19 #include "ability_manager_interface.h"
20 #include "refbase.h"
21 
22 namespace OHOS::UDMF {
23 
24 class ProgressDialog {
25 public:
26     struct FocusedAppInfo {
27         int32_t windowId = 0;
28         sptr<IRemoteObject> abilityToken = nullptr;
29     };
30     struct ProgressMessageInfo {
31         std::string promptText { DEFAULT_LABEL };
32         std::string remoteDeviceName { DEFAULT_LABEL };
33         std::string progressKey { DEFAULT_LABEL };
34         bool isRemote { false };
35         int32_t windowId { 0 };
36         sptr<IRemoteObject> callerToken { nullptr };
37         sptr<IRemoteObject> clientCallback { nullptr };
38     };
39 
40     static ProgressDialog &GetInstance();
41     int32_t ShowProgress(const ProgressMessageInfo &message);
42     FocusedAppInfo GetFocusedAppInfo(void) const;
43 
44 private:
45     static sptr<OHOS::AAFwk::IAbilityManager> GetAbilityManagerService();
46 
47     static constexpr const char *DEFAULT_LABEL = "unknown";
48     static constexpr const char *PASTEBOARD_DIALOG_APP = "com.ohos.pasteboarddialog";
49     static constexpr const char *PASTEBOARD_PROGRESS_ABILITY = "PasteboardProgressAbility";
50 };
51 } // namespace UDMF::OHOS
52 #endif // UDMF_DIALOG_H