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 16 #ifndef OHOS_ABILITY_RUNTIME_WANT_UTILS_H 17 #define OHOS_ABILITY_RUNTIME_WANT_UTILS_H 18 19 #include "want.h" 20 21 namespace OHOS { 22 namespace AAFwk { 23 /** 24 * @class WantUtils 25 * provides want utilities. 26 */ 27 class WantUtils final { 28 public: 29 /** 30 * ConvertToExplicitWant, convert implicit want to explicit want. 31 * 32 * @param want The implicit want. 33 * @param targetType AG find specific targetType. 34 * @return Error code of calling the function. 35 */ 36 static int32_t ConvertToExplicitWant(Want &want, uint32_t &targetType); 37 38 /** 39 * GetCallerBundleName, get caller bundle name. 40 * 41 * @param callerBundleName The caller bundle name. 42 * @return Error code of calling the function. 43 */ 44 static int32_t GetCallerBundleName(std::string &callerBundleName); 45 46 /** 47 * IsShortUrl, check if the want url is short url. 48 * 49 * @param want The implicit want. 50 * @return Flag if the want url is short url. 51 */ 52 static bool IsShortUrl(const Want &want); 53 54 /** 55 * IsAtomicService, check if the targetType is AtomicService. 56 * 57 * @param targetType targetType to be judged. 58 * @return Flag if the targetType is AtomicService. 59 */ 60 static bool IsAtomicService(uint32_t targetType); 61 62 /** 63 * IsNormalApp, check if the targetType is App. 64 * 65 * @param targetType targetType to be judged. 66 * @return Flag if the targetType is App. 67 */ 68 static bool IsNormalApp(uint32_t targetType); 69 }; 70 } // namespace AAFwk 71 } // namespace OHOS 72 #endif // OHOS_ABILITY_RUNTIME_WANT_UTILS_H