Examples of IdDisplay


Examples of com.android.sdklib.repository.descriptors.IdDisplay

        if (matcher.matches()) {
            name = matcher.group(1);
        }

        // get tag
        IdDisplay tag = SystemImage.DEFAULT_TAG;
        String tagId   = properties == null ? null : properties.get(AVD_INI_TAG_ID);
        if (tagId != null) {
            String tagDisp = properties == null ? null : properties.get(AVD_INI_TAG_DISPLAY);
            if (tagDisp == null || tagDisp.isEmpty()) {
                tagDisp = LocalSysImgPkgInfo.tagIdToDisplay(tagId);
            }
            tag = new IdDisplay(tagId, tagDisp);
        }

        // get abi type
        String abiType = properties == null ? null : properties.get(AVD_INI_ABI_TYPE);
        // for the avds created previously without enhancement, i.e. They are created based
View Full Code Here

Examples of com.android.sdklib.repository.descriptors.IdDisplay

        if (tagDisp == null || tagDisp.isEmpty()) {
            tagDisp = LocalSysImgPkgInfo.tagIdToDisplay(tagId);
        }
        assert tagId   != null;
        assert tagDisp != null;
        mTag = new IdDisplay(tagId, tagDisp);

        mPkgDesc = PkgDesc.newSysImg(mVersion, mTag, mAbi, (MajorRevision) getRevision());
    }
View Full Code Here

Examples of com.android.sdklib.repository.descriptors.IdDisplay

     */
    public static Package createBroken(File abiDir, Properties props) {
        AndroidVersion version = null;
        String abiType = abiDir.getName();
        String error = null;
        IdDisplay tag = null;

        // Try to load the android version, tag & ABI from the sources.props.
        // If we don't find them, it would explain why this package is broken.
        if (props == null) {
            error = String.format("Missing file %1$s", SdkConstants.FN_SOURCE_PROP);
        } else {
            try {
                version = new AndroidVersion(props);

                tag = LocalSysImgPkgInfo.extractTagFromProps(props);
                String abi = props.getProperty(PkgProps.SYS_IMG_ABI);
                if (abi != null) {
                    abiType = abi;
                } else {
                    error = String.format("Invalid file %1$s: Missing property %2$s",
                            SdkConstants.FN_SOURCE_PROP,
                            PkgProps.SYS_IMG_ABI);
                }
            } catch (AndroidVersionException e) {
                error = String.format("Invalid file %1$s: %2$s",
                        SdkConstants.FN_SOURCE_PROP,
                        e.getMessage());
            }
        }

        try {
            // Try to parse the first number out of the platform folder name.
            // Also try to parse the tag if not known yet.
            // Folder structure should be:
            // Tools < 22.6 / API < 20: sdk/system-images/android-N/abi/
            // Tools >=22.6 / API >=20: sdk/system-images/android-N/tag/abi/
            String[] segments = abiDir.getAbsolutePath().split(Pattern.quote(File.separator));
            int len = segments.length;
            for (int i = len - 2; version == null && i >= 0; i--) {
                if (SdkConstants.FD_SYSTEM_IMAGES.equals(segments[i])) {
                    if (version == null) {
                        String platform = segments[i+1];
                        try {
                            platform = platform.replaceAll("[^0-9]+", " ").trim()//$NON-NLS-1$ //$NON-NLS-2$
                            int pos = platform.indexOf(' ');
                            if (pos >= 0) {
                                platform = platform.substring(0, pos);
                            }
                            int apiLevel = Integer.parseInt(platform);
                            version = new AndroidVersion(apiLevel, null /*codename*/);
                        } catch (Exception ignore) {}
                    }
                    if (tag == null && i+2 < len) {
                        // If we failed to find a tag id in the properties, check whether
                        // we can guess one from the system image folder path. It should
                        // match the limited tag id character set and not be one of the
                        // known ABIs.
                        String abiOrTag = segments[i+2].trim();
                        if (abiOrTag.matches("[A-Za-z0-9_-]+")) {
                            if (Abi.getEnum(abiOrTag) == null) {
                                tag = new IdDisplay(abiOrTag,
                                                    LocalSysImgPkgInfo.tagIdToDisplay(abiOrTag));
                            }
                        }
                    }
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.