1 package com.google.android.sysui; 2 3 import com.google.auto.service.AutoService; 4 5 import org.robolectric.android.plugins.AndroidLocalSdkProvider; 6 import org.robolectric.internal.dependency.DependencyResolver; 7 import org.robolectric.pluginapi.SdkProvider; 8 import org.robolectric.util.inject.Supercedes; 9 10 import java.io.File; 11 import java.nio.file.Path; 12 13 import javax.annotation.Priority; 14 import javax.inject.Inject; 15 16 /** 17 * SDK provider to latest system image from build server. 18 */ 19 @AutoService(SdkProvider.class) 20 @Priority(10) 21 @Supercedes(AndroidLocalSdkProvider.class) 22 public class ToTSdkProvider extends AndroidLocalSdkProvider { 23 24 @Inject ToTSdkProvider(DependencyResolver dependencyResolver)25 public ToTSdkProvider(DependencyResolver dependencyResolver) { 26 super(dependencyResolver); 27 } 28 29 @Override findTargetJar()30 protected Path findTargetJar() { 31 File jarDir = new File(BuildConfig.OUT_PATH, "android_all"); 32 for (File f : jarDir.listFiles()) { 33 if (f.isFile()) { 34 String name = f.getName(); 35 if (name.startsWith("android-all") && name.endsWith(".jar")) { 36 return f.toPath(); 37 } 38 } 39 } 40 return null; 41 } 42 } 43