/* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.car; import android.annotation.Nullable; import android.annotation.SystemApi; import android.car.annotation.ApiRequirements; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; /** * Synchronous implementation for {@link ResultCallback}. * *
Can be used to get the results synchronously where {@link ResultCallback} is required.
* {@link #get()} and {@link #get(long, TimeUnit)} methods can be used to get the result.
*
* @param
* This method should be called internally only.
*/
@Override
@ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
public void onResult(V result) {
mResult.set(result);
mLatch.countDown();
}
}