1 /* 2 * Copyright (c) 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 #include "lifecycle_future_callback.h" 17 #include "window_manager_hilog.h" 18 19 namespace OHOS { 20 namespace Rosen { 21 OnNotifyAttachState(bool isAttach)22void LifecycleFutureCallback::OnNotifyAttachState(bool isAttach) 23 { 24 if (isAttach) { 25 attachFuture_.SetValue(isAttach); 26 return; 27 } 28 detachFuture_.SetValue(isAttach); 29 } 30 GetAttachSyncResult(long timeOut)31void LifecycleFutureCallback::GetAttachSyncResult(long timeOut) 32 { 33 attachFuture_.GetResult(timeOut); 34 } 35 GetDetachSyncResult(long timeOut)36void LifecycleFutureCallback::GetDetachSyncResult(long timeOut) 37 { 38 detachFuture_.GetResult(timeOut); 39 } 40 ResetAttachLock()41void LifecycleFutureCallback::ResetAttachLock() 42 { 43 attachFuture_.ResetLock({}); 44 } 45 ResetDetachLock()46void LifecycleFutureCallback::ResetDetachLock() 47 { 48 detachFuture_.ResetLock({}); 49 } 50 } // namespace Rosen 51 } // namespace OHOS