All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.android.sdklib.IAndroidTarget Maven / Gradle / Ivy

There is a newer version: 25.3.0
Show newest version
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.sdklib;

import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.sdklib.repository.descriptors.IdDisplay;

import java.io.File;
import java.util.List;
import java.util.Map;



/**
 * A version of Android that applications can target when building.
 */
public interface IAndroidTarget extends Comparable {

    /** OS Path to the "android.jar" file. */
    public static final int ANDROID_JAR         = 1;
    /** OS Path to the "framework.aidl" file. */
    public static final int ANDROID_AIDL        = 2;
    /** OS Path to the "samples" folder which contains sample projects. */
    public static final int SAMPLES             = 4;
    /** OS Path to the "skins" folder which contains the emulator skins. */
    public static final int SKINS               = 5;
    /** OS Path to the "templates" folder which contains the templates for new projects. */
    public static final int TEMPLATES           = 6;
    /** OS Path to the "data" folder which contains data & libraries for the SDK tools. */
    public static final int DATA                = 7;
    /** OS Path to the "attrs.xml" file. */
    public static final int ATTRIBUTES          = 8;
    /** OS Path to the "attrs_manifest.xml" file. */
    public static final int MANIFEST_ATTRIBUTES = 9;
    /** OS Path to the "data/layoutlib.jar" library. */
    public static final int LAYOUT_LIB          = 10;
    /** OS Path to the "data/res" folder. */
    public static final int RESOURCES           = 11;
    /** OS Path to the "data/fonts" folder. */
    public static final int FONTS               = 12;
    /** OS Path to the "data/widgets.txt" file. */
    public static final int WIDGETS             = 13;
    /** OS Path to the "data/activity_actions.txt" file. */
    public static final int ACTIONS_ACTIVITY    = 14;
    /** OS Path to the "data/broadcast_actions.txt" file. */
    public static final int ACTIONS_BROADCAST   = 15;
    /** OS Path to the "data/service_actions.txt" file. */
    public static final int ACTIONS_SERVICE     = 16;
    /** OS Path to the "data/categories.txt" file. */
    public static final int CATEGORIES          = 17;
    /** OS Path to the "sources" folder. */
    public static final int SOURCES             = 18;
    /** OS Path to the target specific docs */
    public static final int DOCS                = 19;
    /** OS Path to the "ant" folder which contains the ant build rules (ver 2 and above) */
    public static final int ANT                 = 24;
    /** OS Path to the "uiautomator.jar" file. */
    public static final int UI_AUTOMATOR_JAR    = 27;


    /**
     * Return value for {@link #getUsbVendorId()} meaning no USB vendor IDs are defined by the
     * Android target.
     */
    public static final int NO_USB_ID = 0;

    /** An optional library provided by an Android Target */
    public interface IOptionalLibrary {
        /** The name of the library, as used in the manifest (<uses-library>). */
        String getName();
        /** The file name of the jar file. */
        String getJarName();
        /** Absolute OS path to the jar file. */
        String getJarPath();
        /** Description of the library. */
        String getDescription();
    }

    /**
     * Returns the target location.
     */
    String getLocation();

    /**
     * Returns the name of the vendor of the target.
     */
    String getVendor();

    /**
     * Returns the name of the target.
     */
    String getName();

    /**
     * Returns the full name of the target, possibly including vendor name.
     */
    String getFullName();

    /**
     * Returns the name to be displayed when representing all the libraries this target contains.
     */
    String getClasspathName();

    /**
     * Returns the name to be displayed when representing all the libraries this target contains.
     */
    String getShortClasspathName();

    /**
     * Returns the description of the target.
     */
    String getDescription();

    /**
     * Returns the version of the target. This is guaranteed to be non-null.
     */
    @NonNull
    AndroidVersion getVersion();

    /**
     * Returns the platform version as a readable string.
     */
    public String getVersionName();

    /** Returns the revision number for the target. */
    int getRevision();

    /**
     * Returns true if the target is a standard Android platform.
     */
    boolean isPlatform();

    /**
     * Returns the parent target. This is likely to only be non null if
     * {@link #isPlatform()} returns false
     */
    IAndroidTarget getParent();

    /**
     * Returns the path of a platform component.
     * @param pathId the id representing the path to return.
     *        Any of the constants defined in the {@link IAndroidTarget} interface can be used.
     */
    String getPath(int pathId);

    /**
     * Returns the path of a platform component.
     * 

* This is like the legacy {@link #getPath(int)} method except it returns a {@link File}. * * @param pathId the id representing the path to return. * Any of the constants defined in the {@link IAndroidTarget} interface can be used. */ File getFile(int pathId); /** * Returns a BuildToolInfo for backward compatibility. If an older SDK is used this will return * paths located in the platform-tools, otherwise it'll return paths located in the latest * build-tools. * @return a BuildToolInfo or null if none are available. */ BuildToolInfo getBuildToolInfo(); /** * Returns the boot classpath for this target. * In most case, this is similar to calling {@link #getPath(int)} with * {@link IAndroidTarget#ANDROID_JAR}. * * @return a non null list of the boot classpath. */ @NonNull List getBootClasspath(); /** * Returns whether the target is able to render layouts. */ boolean hasRenderingLibrary(); /** * Returns the available skin folders for this target. *

* To get the skin names, use {@link File#getName()}.
* Skins come either from: *

    *
  • a platform ({@code sdk/platforms/N/skins/name})
  • *
  • an add-on ({@code sdk/addons/name/skins/name})
  • *
  • a tagged system-image ({@code sdk/system-images/platform-N/tag/abi/skins/name}.)
  • *
* The array can be empty but not null. */ @NonNull File[] getSkins(); /** * Returns the default skin folder for this target. *

* To get the skin name, use {@link File#getName()}. */ @Nullable File getDefaultSkin(); /** * Returns the available optional libraries for this target. * @return an array of optional libraries or null if there is none. */ IOptionalLibrary[] getOptionalLibraries(); /** * Returns the list of libraries available for a given platform. * * @return an array of libraries provided by the platform or null if there is none. */ String[] getPlatformLibraries(); /** * Return the value of a given property for this target. * @return the property value or null if it was not found. */ String getProperty(String name); /** * Returns the value of a given property for this target as an Integer value. *

If the value is missing or is not an integer, the method will return the given default * value. * @param name the name of the property to return * @param defaultValue the default value to return. * * @see Integer#decode(String) */ Integer getProperty(String name, Integer defaultValue); /** * Returns the value of a given property for this target as a Boolean value. *

If the value is missing or is not an boolean, the method will return the given default * value. * * @param name the name of the property to return * @param defaultValue the default value to return. * * @see Boolean#valueOf(String) */ Boolean getProperty(String name, Boolean defaultValue); /** * Returns all the properties associated with this target. This can be null if the target has * no properties. */ Map getProperties(); /** * Returns the USB Vendor ID for the vendor of this target. *

If the target defines no USB Vendor ID, then the method return 0. */ int getUsbVendorId(); /** * Returns an array of system images for this target. * The array can be empty but not null. */ public ISystemImage[] getSystemImages(); /** * Returns the system image information for the given {@code tag} and {@code abiType}. * * @param tag A tag id-display. * @param abiType An ABI type string. * @return An existing {@link ISystemImage} for the requested {@code abiType} * or null if none exists for this type. */ @Nullable public ISystemImage getSystemImage(@NonNull IdDisplay tag, @NonNull String abiType); /** * Returns whether the given target is compatible with the receiver. *

* This means that a project using the receiver's target can run on the given target. *
* Example: *

     * CupcakeTarget.canRunOn(DonutTarget) == true
     * 
. * * @param target the IAndroidTarget to test. */ boolean canRunOn(IAndroidTarget target); /** * Returns a string able to uniquely identify a target. * Typically the target will encode information such as api level, whether it's a platform * or add-on, and if it's an add-on vendor and add-on name. *

* See {@link AndroidTargetHash} for helper methods to manipulate hash strings. */ String hashString(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy