com.android.sdklib.ISystemImage Java Examples

The following examples show how to use com.android.sdklib.ISystemImage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateAvdVisualPanel3.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
public static boolean doesSystemImageSupportQemu2(SystemImageDescription description, FileOp fileOp) {
    if (description == null) {
        return false;
    }
    ISystemImage systemImage = description.getSystemImage();
    if (systemImage == null) {
        return false;
    }
    File location = systemImage.getLocation();
    if (!fileOp.isDirectory(location)) {
        return false;
    }
    String[] files = fileOp.list(location, null);
    if (files != null) {
        for (String filename : files) {
            if (filename.contains("kernel-ranchu")) {
                return true;
            }
        }
    }
    return false;
}
 
Example #2
Source File: LocalSysImgPkgInfo.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
static SystemImage getSystemImage(IPkgDesc desc, File localDir, @NonNull IFileOp fileOp) {
    final IdDisplay tag = desc.getTag();
    final String abi = desc.getPath();
    List<File> parsedSkins = PackageParserUtils.parseSkinFolder(new File(localDir, SdkConstants.FD_SKINS), fileOp);
    File[] skins = FileOp.EMPTY_FILE_ARRAY;
    if (!parsedSkins.isEmpty()) {
        skins = parsedSkins.toArray(new File[parsedSkins.size()]);
    }

    return new SystemImage(
      localDir,
      ISystemImage.LocationType.IN_SYSTEM_IMAGE,
      tag,
      desc.getVendor(),
      abi,
      skins);
}
 
Example #3
Source File: AddOnTarget.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public ISystemImage getSystemImage(@NonNull IdDisplay tag, @NonNull String abiType) {
    for (ISystemImage sysImg : mSystemImages) {
        if (sysImg.getTag().equals(tag) && sysImg.getAbiType().equals(abiType)) {
            return sysImg;
        }
    }
    return null;
}
 
Example #4
Source File: SystemImageDescription.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(ISystemImage o) {
    if (o instanceof RemoteSystemImage) {
        return myRemotePackage.compareTo(((RemoteSystemImage) o).myRemotePackage);
    }
    return 1;
}
 
Example #5
Source File: MissingTarget.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public ISystemImage getSystemImage(@NonNull IdDisplay tag, @NonNull String abiType) {
    for (ISystemImage image : mSystemImages) {
        if (tag.equals(image.getTag()) && abiType.equals(image.getAbiType())) {
            return image;
        }
    }
    return null;
}
 
Example #6
Source File: PlatformTarget.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public ISystemImage getSystemImage(@NonNull IdDisplay tag, @NonNull String abiType) {
    for (ISystemImage sysImg : mSystemImages) {
        if (sysImg.getTag().equals(tag) && sysImg.getAbiType().equals(abiType)) {
            return sysImg;
        }
    }
    return null;
}
 
Example #7
Source File: AddOnTarget.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public ISystemImage getSystemImage(@NonNull IdDisplay tag, @NonNull String abiType) {
    for (ISystemImage sysImg : mSystemImages) {
        if (sysImg.getTag().equals(tag) && sysImg.getAbiType().equals(abiType)) {
            return sysImg;
        }
    }
    return null;
}
 
Example #8
Source File: LocalSdk.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private static void addOrphanedSystemImage(ISystemImage image, IPkgDesc desc, Map<MissingTarget, MissingTarget> targets) {
    IdDisplay vendor = desc.getVendor();
    MissingTarget target = new MissingTarget(vendor == null ? null : vendor.getDisplay(), desc.getTag().getDisplay(), desc.getAndroidVersion());
    MissingTarget existing = targets.get(target);
    if (existing == null) {
        existing = target;
        targets.put(target, target);
    }
    existing.addSystemImage(image);
}
 
Example #9
Source File: PlatformTarget.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public ISystemImage getSystemImage(@NonNull IdDisplay tag, @NonNull String abiType) {
    for (ISystemImage sysImg : mSystemImages) {
        if (sysImg.getTag().equals(tag) && sysImg.getAbiType().equals(abiType)) {
            return sysImg;
        }
    }
    return null;
}
 
Example #10
Source File: MissingTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ISystemImage[] getSystemImages() {
    return mSystemImages.toArray(new ISystemImage[mSystemImages.size()]);
}
 
Example #11
Source File: AddOnTarget.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new add-on
 * @param location the OS path location of the add-on
 * @param name the name of the add-on
 * @param vendor the vendor name of the add-on
 * @param revision the revision of the add-on
 * @param description the add-on description
 * @param systemImages list of supported system images. Can be null or empty.
 * @param libMap A map containing the optional libraries. The map key is the fully-qualified
 * library name. The value is a 2 string array with the .jar filename, and the description.
 * @param hasRenderingLibrary whether the addon has a custom layoutlib.jar
 * @param hasRenderingResources whether the add has custom framework resources.
 * @param basePlatform the platform the add-on is extending.
 */
public AddOnTarget(
        String location,
        String name,
        String vendor,
        int revision,
        String description,
        ISystemImage[] systemImages,
        Map<String, String[]> libMap,
        boolean hasRenderingLibrary,
        boolean hasRenderingResources,
        PlatformTarget basePlatform) {
    if (location.endsWith(File.separator) == false) {
        location = location + File.separator;
    }

    mLocation = location;
    mName = name;
    mVendor = vendor;
    mRevision = revision;
    mDescription = description;
    mHasRenderingLibrary = hasRenderingLibrary;
    mHasRenderingResources = hasRenderingResources;
    mBasePlatform = basePlatform;

    // If the add-on does not have any system-image of its own, the list here
    // is empty and it's up to the callers to query the parent platform.
    mSystemImages = systemImages == null ? new ISystemImage[0] : systemImages;
    Arrays.sort(mSystemImages);

    // handle the optional libraries.
    if (libMap != null) {
        mLibraries = new IOptionalLibrary[libMap.size()];
        int index = 0;
        for (Entry<String, String[]> entry : libMap.entrySet()) {
            String jarFile = entry.getValue()[0];
            String desc = entry.getValue()[1];
            mLibraries[index++] = new OptionalLibrary(jarFile,
                    mLocation + SdkConstants.OS_ADDON_LIBS_FOLDER + jarFile,
                    entry.getKey(), desc);
        }
    }
}
 
Example #12
Source File: SystemImageDescription.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
public ISystemImage getSystemImage() {
    return mySystemImage;
}
 
Example #13
Source File: SystemImageDescription.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
public SystemImageDescription(ISystemImage systemImage) {
    mySystemImage = systemImage;
}
 
Example #14
Source File: AddOnTarget.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
@Override
public ISystemImage[] getSystemImages() {
    return mSystemImages;
}
 
Example #15
Source File: FakeAndroidTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ISystemImage getSystemImage(IdDisplay tag, String abiType) {
    return null;
}
 
Example #16
Source File: FakeAndroidTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ISystemImage[] getSystemImages() {
    return new ISystemImage[0];
}
 
Example #17
Source File: PlatformTarget.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a Platform target.
 *
 * @param sdkOsPath the root folder of the SDK
 * @param platformOSPath the root folder of the platform component
 * @param apiVersion the API Level + codename.
 * @param versionName the version name of the platform.
 * @param revision the revision of the platform component.
 * @param layoutlibVersion The {@link LayoutlibVersion}. May be null.
 * @param systemImages list of supported system images
 * @param properties the platform properties
 */
public PlatformTarget(
        String sdkOsPath,
        String platformOSPath,
        AndroidVersion apiVersion,
        String versionName,
        int revision,
        LayoutlibVersion layoutlibVersion,
        ISystemImage[] systemImages,
        Map<String, String> properties,
        @NonNull BuildToolInfo buildToolInfo) {
    if (!platformOSPath.endsWith(File.separator)) {
        platformOSPath = platformOSPath + File.separator;
    }
    mRootFolderOsPath = platformOSPath;
    mProperties = Collections.unmodifiableMap(properties);
    mVersion = apiVersion;
    mVersionName = versionName;
    mRevision = revision;
    mLayoutlibVersion = layoutlibVersion;
    mBuildToolInfo = buildToolInfo;
    mSystemImages = systemImages == null ? new ISystemImage[0] : systemImages;
    Arrays.sort(mSystemImages);

    if (mVersion.isPreview()) {
        mName =  String.format(PLATFORM_NAME_PREVIEW, mVersionName);
    } else {
        mName = String.format(PLATFORM_NAME, mVersionName);
    }

    // pre-build the path to the platform components
    mPaths.put(ANDROID_JAR, mRootFolderOsPath + SdkConstants.FN_FRAMEWORK_LIBRARY);
    mPaths.put(UI_AUTOMATOR_JAR, mRootFolderOsPath + SdkConstants.FN_UI_AUTOMATOR_LIBRARY);
    mPaths.put(SOURCES, mRootFolderOsPath + SdkConstants.FD_ANDROID_SOURCES);
    mPaths.put(ANDROID_AIDL, mRootFolderOsPath + SdkConstants.FN_FRAMEWORK_AIDL);
    mPaths.put(SAMPLES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_SAMPLES_FOLDER);
    mPaths.put(SKINS, mRootFolderOsPath + SdkConstants.OS_SKINS_FOLDER);
    mPaths.put(TEMPLATES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_TEMPLATES_FOLDER);
    mPaths.put(DATA, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER);
    mPaths.put(ATTRIBUTES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_ATTRS_XML);
    mPaths.put(MANIFEST_ATTRIBUTES,
            mRootFolderOsPath + SdkConstants.OS_PLATFORM_ATTRS_MANIFEST_XML);
    mPaths.put(RESOURCES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_RESOURCES_FOLDER);
    mPaths.put(FONTS, mRootFolderOsPath + SdkConstants.OS_PLATFORM_FONTS_FOLDER);
    mPaths.put(LAYOUT_LIB, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_LAYOUTLIB_JAR);
    mPaths.put(WIDGETS, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_WIDGETS);
    mPaths.put(ACTIONS_ACTIVITY, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_ACTIONS_ACTIVITY);
    mPaths.put(ACTIONS_BROADCAST, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_ACTIONS_BROADCAST);
    mPaths.put(ACTIONS_SERVICE, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_ACTIONS_SERVICE);
    mPaths.put(CATEGORIES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_CATEGORIES);
    mPaths.put(ANT, mRootFolderOsPath + SdkConstants.OS_PLATFORM_ANT_FOLDER);
}
 
Example #18
Source File: MissingTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public void addSystemImage(ISystemImage image) {
    mSystemImages.add(image);
}
 
Example #19
Source File: AvdInfo.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/** Convenience function to return a more user friendly name of the abi type. */
@NonNull
public static String getPrettyAbiType(@NonNull ISystemImage sysImg) {
    return getPrettyAbiType(sysImg.getTag(), sysImg.getAbiType());
}
 
Example #20
Source File: PlatformTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ISystemImage[] getSystemImages() {
    return mSystemImages;
}
 
Example #21
Source File: PlatformTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a Platform target.
 *
 * @param sdkOsPath the root folder of the SDK
 * @param platformOSPath the root folder of the platform component
 * @param apiVersion the API Level + codename.
 * @param versionName the version name of the platform.
 * @param revision the revision of the platform component.
 * @param layoutlibVersion The {@link LayoutlibVersion}. May be null.
 * @param systemImages list of supported system images
 * @param properties the platform properties
 */
public PlatformTarget(
        String sdkOsPath,
        String platformOSPath,
        AndroidVersion apiVersion,
        String versionName,
        int revision,
        LayoutlibVersion layoutlibVersion,
        ISystemImage[] systemImages,
        Map<String, String> properties,
        List<OptionalLibrary> optionalLibraries,
        @NonNull BuildToolInfo buildToolInfo) {
    if (!platformOSPath.endsWith(File.separator)) {
        platformOSPath = platformOSPath + File.separator;
    }
    mRootFolderOsPath = platformOSPath;
    mProperties = Collections.unmodifiableMap(properties);
    mVersion = apiVersion;
    mVersionName = versionName;
    mRevision = revision;
    mLayoutlibVersion = layoutlibVersion;
    mBuildToolInfo = buildToolInfo;
    mSystemImages = systemImages == null ? new ISystemImage[0] : systemImages;
    Arrays.sort(mSystemImages);
    mOptionalLibraries = ImmutableList.copyOf(optionalLibraries);

    if (mVersion.isPreview()) {
        mName =  String.format(PLATFORM_NAME_PREVIEW, mVersionName);
    } else {
        mName = String.format(PLATFORM_NAME, mVersionName);
    }

    // pre-build the path to the platform components
    mPaths.put(ANDROID_JAR, mRootFolderOsPath + SdkConstants.FN_FRAMEWORK_LIBRARY);
    mPaths.put(UI_AUTOMATOR_JAR, mRootFolderOsPath + SdkConstants.FN_UI_AUTOMATOR_LIBRARY);
    mPaths.put(SOURCES, mRootFolderOsPath + SdkConstants.FD_ANDROID_SOURCES);
    mPaths.put(ANDROID_AIDL, mRootFolderOsPath + SdkConstants.FN_FRAMEWORK_AIDL);
    mPaths.put(SAMPLES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_SAMPLES_FOLDER);
    mPaths.put(SKINS, mRootFolderOsPath + SdkConstants.OS_SKINS_FOLDER);
    mPaths.put(TEMPLATES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_TEMPLATES_FOLDER);
    mPaths.put(DATA, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER);
    mPaths.put(ATTRIBUTES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_ATTRS_XML);
    mPaths.put(MANIFEST_ATTRIBUTES,
            mRootFolderOsPath + SdkConstants.OS_PLATFORM_ATTRS_MANIFEST_XML);
    mPaths.put(RESOURCES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_RESOURCES_FOLDER);
    mPaths.put(FONTS, mRootFolderOsPath + SdkConstants.OS_PLATFORM_FONTS_FOLDER);
    mPaths.put(LAYOUT_LIB, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_LAYOUTLIB_JAR);
    mPaths.put(WIDGETS, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_WIDGETS);
    mPaths.put(ACTIONS_ACTIVITY, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_ACTIONS_ACTIVITY);
    mPaths.put(ACTIONS_BROADCAST, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_ACTIONS_BROADCAST);
    mPaths.put(ACTIONS_SERVICE, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_ACTIONS_SERVICE);
    mPaths.put(CATEGORIES, mRootFolderOsPath + SdkConstants.OS_PLATFORM_DATA_FOLDER +
            SdkConstants.FN_INTENT_CATEGORIES);
    mPaths.put(ANT, mRootFolderOsPath + SdkConstants.OS_PLATFORM_ANT_FOLDER);
}
 
Example #22
Source File: AddOnTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ISystemImage[] getSystemImages() {
    return mSystemImages;
}
 
Example #23
Source File: PlatformTarget.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
@Override
public ISystemImage[] getSystemImages() {
    return mSystemImages;
}
 
Example #24
Source File: AddOnTarget.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new add-on
 * @param location the OS path location of the add-on
 * @param name the name of the add-on
 * @param vendor the vendor name of the add-on
 * @param revision the revision of the add-on
 * @param description the add-on description
 * @param systemImages list of supported system images. Can be null or empty.
 * @param libMap A map containing the optional libraries. The map key is the fully-qualified
 * library name. The value is a 2 string array with the .jar filename, and the description.
 * @param hasRenderingLibrary whether the addon has a custom layoutlib.jar
 * @param hasRenderingResources whether the add has custom framework resources.
 * @param basePlatform the platform the add-on is extending.
 */
public AddOnTarget(
        String location,
        String name,
        String vendor,
        int revision,
        String description,
        ISystemImage[] systemImages,
        Map<String, String[]> libMap,
        boolean hasRenderingLibrary,
        boolean hasRenderingResources,
        PlatformTarget basePlatform) {
    if (!location.endsWith(File.separator)) {
        location = location + File.separator;
    }

    mLocation = location;
    mName = name;
    mVendor = vendor;
    mRevision = revision;
    mDescription = description;
    mHasRenderingLibrary = hasRenderingLibrary;
    mHasRenderingResources = hasRenderingResources;
    mBasePlatform = basePlatform;

    // If the add-on does not have any system-image of its own, the list here
    // is empty and it's up to the callers to query the parent platform.
    mSystemImages = systemImages == null ? new ISystemImage[0] : systemImages;
    Arrays.sort(mSystemImages);

    // handle the optional libraries.
    if (libMap != null) {
        ImmutableList.Builder<OptionalLibrary> builder = ImmutableList.builder();
        for (Entry<String, String[]> entry : libMap.entrySet()) {
            String jarFile = entry.getValue()[0];
            String desc = entry.getValue()[1];
            builder.add(new OptionalLibraryImpl(
                    entry.getKey(),
                    new File(mLocation, SdkConstants.OS_ADDON_LIBS_FOLDER + jarFile),
                    desc,
                    true /*requireManifestEntry*/));
        }
        mLibraries = builder.build();
    } else {
        mLibraries = ImmutableList.of();
    }
}
 
Example #25
Source File: LocalAddonSysImgPkgInfo.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public ISystemImage getSystemImage() {
    return LocalSysImgPkgInfo.getSystemImage(mDesc, getLocalDir(), getLocalSdk().getFileOp());
}