Home | History | Annotate | Download | only in sdklib
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.sdklib;
     18 
     19 import java.util.Map;
     20 
     21 
     22 
     23 /**
     24  * A version of Android that applications can target when building.
     25  */
     26 public interface IAndroidTarget extends Comparable<IAndroidTarget> {
     27 
     28     /** OS Path to the "android.jar" file. */
     29     public final static int ANDROID_JAR         = 1;
     30     /** OS Path to the "framework.aidl" file. */
     31     public final static int ANDROID_AIDL        = 2;
     32     /** OS Path to "images" folder which contains the emulator system images. */
     33     public final static int IMAGES              = 3;
     34     /** OS Path to the "samples" folder which contains sample projects. */
     35     public final static int SAMPLES             = 4;
     36     /** OS Path to the "skins" folder which contains the emulator skins. */
     37     public final static int SKINS               = 5;
     38     /** OS Path to the "templates" folder which contains the templates for new projects. */
     39     public final static int TEMPLATES           = 6;
     40     /** OS Path to the "data" folder which contains data & libraries for the SDK tools. */
     41     public final static int DATA                = 7;
     42     /** OS Path to the "attrs.xml" file. */
     43     public final static int ATTRIBUTES          = 8;
     44     /** OS Path to the "attrs_manifest.xml" file. */
     45     public final static int MANIFEST_ATTRIBUTES = 9;
     46     /** OS Path to the "data/layoutlib.jar" library. */
     47     public final static int LAYOUT_LIB          = 10;
     48     /** OS Path to the "data/res" folder. */
     49     public final static int RESOURCES           = 11;
     50     /** OS Path to the "data/fonts" folder. */
     51     public final static int FONTS               = 12;
     52     /** OS Path to the "data/widgets.txt" file. */
     53     public final static int WIDGETS             = 13;
     54     /** OS Path to the "data/activity_actions.txt" file. */
     55     public final static int ACTIONS_ACTIVITY    = 14;
     56     /** OS Path to the "data/broadcast_actions.txt" file. */
     57     public final static int ACTIONS_BROADCAST   = 15;
     58     /** OS Path to the "data/service_actions.txt" file. */
     59     public final static int ACTIONS_SERVICE     = 16;
     60     /** OS Path to the "data/categories.txt" file. */
     61     public final static int CATEGORIES          = 17;
     62     /** OS Path to the "sources" folder. */
     63     public final static int SOURCES             = 18;
     64     /** OS Path to the target specific docs */
     65     public final static int DOCS                = 19;
     66     /** OS Path to the target's version of the aapt tool. */
     67     public final static int AAPT                = 20;
     68     /** OS Path to the target's version of the aidl tool. */
     69     public final static int AIDL                = 21;
     70     /** OS Path to the target's version of the dx too. */
     71     public final static int DX                  = 22;
     72     /** OS Path to the target's version of the dx.jar file. */
     73     public final static int DX_JAR              = 23;
     74     /** OS Path to the "ant" folder which contains the ant build rules (ver 2 and above) */
     75     public final static int ANT                 = 24;
     76 
     77     /**
     78      * Return value for {@link #getUsbVendorId()} meaning no USB vendor IDs are defined by the
     79      * Android target.
     80      */
     81     public final static int NO_USB_ID = 0;
     82 
     83     /** An optional library provided by an Android Target */
     84     public interface IOptionalLibrary {
     85         /** The name of the library, as used in the manifest (&lt;uses-library&gt;). */
     86         String getName();
     87         /** The file name of the jar file. */
     88         String getJarName();
     89         /** Absolute OS path to the jar file. */
     90         String getJarPath();
     91         /** Description of the library. */
     92         String getDescription();
     93     }
     94 
     95     /**
     96      * Returns the target location.
     97      */
     98     String getLocation();
     99 
    100     /**
    101      * Returns the name of the vendor of the target.
    102      */
    103     String getVendor();
    104 
    105     /**
    106      * Returns the name of the target.
    107      */
    108     String getName();
    109 
    110     /**
    111      * Returns the full name of the target, possibly including vendor name.
    112      */
    113     String getFullName();
    114 
    115     /**
    116      * Returns the name to be displayed when representing all the libraries this target contains.
    117      */
    118     String getClasspathName();
    119 
    120     /**
    121      * Returns the description of the target.
    122      */
    123     String getDescription();
    124 
    125     /**
    126      * Returns the version of the target. This is guaranteed to be non-null.
    127      */
    128     AndroidVersion getVersion();
    129 
    130     /**
    131      * Returns the platform version as a readable string.
    132      */
    133     public String getVersionName();
    134 
    135     /** Returns the revision number for the target. */
    136     int getRevision();
    137 
    138     /**
    139      * Returns true if the target is a standard Android platform.
    140      */
    141     boolean isPlatform();
    142 
    143     /**
    144      * Returns the parent target. This is likely to only be non <code>null</code> if
    145      * {@link #isPlatform()} returns <code>false</code>
    146      */
    147     IAndroidTarget getParent();
    148 
    149     /**
    150      * Returns the path of a platform component.
    151      * @param pathId the id representing the path to return. Any of the constants defined in the
    152      * {@link IAndroidTarget} interface can be used.
    153      */
    154     String getPath(int pathId);
    155 
    156     /**
    157      * Returns the available skins for this target.
    158      */
    159     String[] getSkins();
    160 
    161     /**
    162      * Returns the default skin for this target.
    163      */
    164     String getDefaultSkin();
    165 
    166     /**
    167      * Returns the available optional libraries for this target.
    168      * @return an array of optional libraries or <code>null</code> if there is none.
    169      */
    170     IOptionalLibrary[] getOptionalLibraries();
    171 
    172     /**
    173      * Returns the list of libraries available for a given platform.
    174      *
    175      * @return an array of libraries provided by the platform or <code>null</code> if there is none.
    176      */
    177     String[] getPlatformLibraries();
    178 
    179     /**
    180      * Return the value of a given property for this target.
    181      * @return the property value or <code>null</code> if it was not found.
    182      */
    183     String getProperty(String name);
    184 
    185     /**
    186      * Returns the value of a given property for this target as an Integer value.
    187      * <p/> If the value is missing or is not an integer, the method will return the given default
    188      * value.
    189      * @param name the name of the property to return
    190      * @param defaultValue the default value to return.
    191      *
    192      * @see Integer#decode(String)
    193      */
    194     Integer getProperty(String name, Integer defaultValue);
    195 
    196     /**
    197      * Returns the value of a given property for this target as a Boolean value.
    198      * <p/> If the value is missing or is not an boolean, the method will return the given default
    199      * value.
    200      *
    201      * @param name the name of the property to return
    202      * @param defaultValue the default value to return.
    203      *
    204      * @see Boolean#valueOf(String)
    205      */
    206 
    207     Boolean getProperty(String name, Boolean defaultValue);
    208 
    209     /**
    210      * Returns all the properties associated with this target. This can be null if the target has
    211      * no properties.
    212      */
    213     Map<String, String> getProperties();
    214 
    215     /**
    216      * Returns the USB Vendor ID for the vendor of this target.
    217      * <p/>If the target defines no USB Vendor ID, then the method return 0.
    218      */
    219     int getUsbVendorId();
    220 
    221     /**
    222      * Returns whether the given target is compatible with the receiver.
    223      * <p/>
    224      * This means that a project using the receiver's target can run on the given target.
    225      * <br/>
    226      * Example:
    227      * <pre>
    228      * CupcakeTarget.canRunOn(DonutTarget) == true
    229      * </pre>.
    230      *
    231      * @param target the IAndroidTarget to test.
    232      */
    233     boolean canRunOn(IAndroidTarget target);
    234 
    235     /**
    236      * Returns a string able to uniquely identify a target.
    237      * Typically the target will encode information such as api level, whether it's a platform
    238      * or add-on, and if it's an add-on vendor and add-on name.
    239      */
    240     String hashString();
    241 }
    242