Home | History | Annotate | Download | only in shadows
      1 package org.robolectric.shadows;
      2 
      3 import android.app.QueuedWork;
      4 import android.os.Build;
      5 import org.robolectric.RuntimeEnvironment;
      6 import org.robolectric.annotation.Implements;
      7 import org.robolectric.annotation.Resetter;
      8 import org.robolectric.util.ReflectionHelpers;
      9 
     10 @Implements(value = QueuedWork.class, isInAndroidSdk = false)
     11 public class ShadowQueuedWork {
     12 
     13   @Resetter
     14   public static void reset() {
     15     QueuedWork.waitToFinish();
     16     if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.O) {
     17       ReflectionHelpers.setStaticField(QueuedWork.class, "sHandler", null);
     18     } else {
     19       ReflectionHelpers.setStaticField(QueuedWork.class, "sSingleThreadExecutor", null);
     20     }
     21   }
     22 }
     23