1 /* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.work; 18 19 import android.support.annotation.WorkerThread; 20 21 import java.util.List; 22 23 /** 24 * Blocking methods for {@link WorkContinuation} operations. These methods are expected to be 25 * called from a background thread. 26 */ 27 public interface SynchronousWorkContinuation { 28 29 /** 30 * Enqueues the instance of {@link WorkContinuation} in a synchronous fashion. This method is 31 * expected to be called from a background thread and, upon successful execution, you can rely 32 * on that the work has been enqueued. 33 */ 34 @WorkerThread 35 void enqueueSync(); 36 37 /** 38 * Returns a {@link List} of {@link WorkStatus} that provides information about work, 39 * their progress, and any resulting output in the {@link WorkContinuation}. 40 * 41 * @return A {@link List} of {@link WorkStatus}es 42 */ 43 @WorkerThread 44 List<WorkStatus> getStatusesSync(); 45 } 46