Home | History | Annotate | Download | only in shadows
      1 package org.robolectric.shadows;
      2 
      3 import static android.os.Build.VERSION_CODES.KITKAT;
      4 
      5 import com.android.internal.os.BackgroundThread;
      6 import org.robolectric.annotation.Implements;
      7 import org.robolectric.annotation.Resetter;
      8 import org.robolectric.util.ReflectionHelpers;
      9 
     10 @Implements(value = BackgroundThread.class, isInAndroidSdk = false, inheritImplementationMethods = true, minSdk = KITKAT)
     11 public class ShadowBackgroundThread {
     12 
     13   @Resetter
     14   public static void reset() {
     15     BackgroundThread instance = ReflectionHelpers.getStaticField(BackgroundThread.class, "sInstance");
     16     if (instance != null) {
     17       instance.quit();
     18       ReflectionHelpers.setStaticField(BackgroundThread.class, "sInstance", null);
     19       ReflectionHelpers.setStaticField(BackgroundThread.class, "sHandler", null);
     20     }
     21   }
     22 }
     23