1 /* 2 * Copyright (c) 2024-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 OHOS_ABILITY_RUNTIME_GLOBAL_CONSTANT_H 17 #define OHOS_ABILITY_RUNTIME_GLOBAL_CONSTANT_H 18 19 namespace OHOS::AbilityRuntime { 20 namespace GlobalConstant { 21 constexpr int32_t MAX_APP_CLONE_INDEX = 1000; 22 23 constexpr int32_t TIMEOUT_UNIT_TIME = 1000; 24 constexpr int32_t TIMEOUT_UNIT_TIME_MICRO = 1000 * 1000; 25 26 constexpr int32_t PREPARE_TERMINATE_TIMEOUT_TIME = 10000; 27 constexpr int32_t DEFAULT_FFRT_TASK_TIMEOUT = 60 * 1000 * 1000; // 60s = 60 000 000us 28 constexpr int32_t FFRT_TASK_TIMEOUT = 5 * 1000 * 1000; // 5s 29 constexpr const char* LOW_MEMORY_KILL = "LowMemoryKill"; 30 31 #ifdef SUPPORT_ASAN 32 constexpr int32_t COLDSTART_TIMEOUT_MULTIPLE = 15000; 33 constexpr int32_t LOAD_TIMEOUT_MULTIPLE = 15000; 34 constexpr int32_t FOREGROUND_TIMEOUT_MULTIPLE = 7500; 35 constexpr int32_t BACKGROUND_TIMEOUT_MULTIPLE = 4500; 36 constexpr int32_t INSIGHT_INTENT_TIMEOUT_MULTIPLE = 15000; 37 constexpr int32_t ACTIVE_TIMEOUT_MULTIPLE = 7500; 38 constexpr int32_t TERMINATE_TIMEOUT_MULTIPLE = 15000; 39 constexpr int32_t INACTIVE_TIMEOUT_MULTIPLE = 800; 40 constexpr int32_t INACTIVE_TIMEOUT_MULTIPLE_NEW = 800; 41 constexpr int32_t DUMP_TIMEOUT_MULTIPLE = 1500; 42 constexpr int32_t SHAREDATA_TIMEOUT_MULTIPLE = 7500; 43 constexpr int32_t CONCURRENT_START_TIMEOUT = 10; 44 #else 45 constexpr int32_t COLDSTART_TIMEOUT_MULTIPLE = 10; 46 constexpr int32_t LOAD_TIMEOUT_MULTIPLE = 10; 47 constexpr int32_t FOREGROUND_TIMEOUT_MULTIPLE = 5; 48 constexpr int32_t BACKGROUND_TIMEOUT_MULTIPLE = 3; 49 constexpr int32_t INSIGHT_INTENT_TIMEOUT_MULTIPLE = 10; 50 constexpr int32_t ACTIVE_TIMEOUT_MULTIPLE = 5; 51 constexpr int32_t TERMINATE_TIMEOUT_MULTIPLE = 10; 52 constexpr int32_t INACTIVE_TIMEOUT_MULTIPLE = 1; 53 constexpr int32_t INACTIVE_TIMEOUT_MULTIPLE_NEW = 21; 54 constexpr int32_t DUMP_TIMEOUT_MULTIPLE = 1000; 55 constexpr int32_t SHAREDATA_TIMEOUT_MULTIPLE = 5; 56 constexpr int32_t CONCURRENT_START_TIMEOUT = 1; 57 constexpr int32_t TYPE_RESERVE = 1; 58 constexpr int32_t TYPE_OTHERS = 2; 59 #endif 60 61 constexpr int32_t MIGRATE_CLIENT_TIMEOUT_MULTIPLE = 3; 62 GetLoadTimeOutBase()63constexpr int32_t GetLoadTimeOutBase() 64 { 65 return TIMEOUT_UNIT_TIME * LOAD_TIMEOUT_MULTIPLE; 66 } 67 GetLoadAndInactiveTimeout()68constexpr int32_t GetLoadAndInactiveTimeout() 69 { 70 return TIMEOUT_UNIT_TIME * (LOAD_TIMEOUT_MULTIPLE + INACTIVE_TIMEOUT_MULTIPLE); 71 } 72 73 } // namespace GlobalConstant 74 } // namespace OHOS::AbilityRuntime 75 #endif // OHOS_ABILITY_RUNTIME_GLOBAL_CONSTANT_H