• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     /**
29      * Prefix used to build hash strings for platform targets
30      * @see SdkManager#getTargetFromHashString(String)
31      */
32     public static final String PLATFORM_HASH_PREFIX = "android-";
33 
34     /** OS Path to the "android.jar" file. */
35     public final static int ANDROID_JAR         = 1;
36     /** OS Path to the "framework.aidl" file. */
37     public final static int ANDROID_AIDL        = 2;
38     /** OS Path to the "samples" folder which contains sample projects. */
39     public final static int SAMPLES             = 4;
40     /** OS Path to the "skins" folder which contains the emulator skins. */
41     public final static int SKINS               = 5;
42     /** OS Path to the "templates" folder which contains the templates for new projects. */
43     public final static int TEMPLATES           = 6;
44     /** OS Path to the "data" folder which contains data & libraries for the SDK tools. */
45     public final static int DATA                = 7;
46     /** OS Path to the "attrs.xml" file. */
47     public final static int ATTRIBUTES          = 8;
48     /** OS Path to the "attrs_manifest.xml" file. */
49     public final static int MANIFEST_ATTRIBUTES = 9;
50     /** OS Path to the "data/layoutlib.jar" library. */
51     public final static int LAYOUT_LIB          = 10;
52     /** OS Path to the "data/res" folder. */
53     public final static int RESOURCES           = 11;
54     /** OS Path to the "data/fonts" folder. */
55     public final static int FONTS               = 12;
56     /** OS Path to the "data/widgets.txt" file. */
57     public final static int WIDGETS             = 13;
58     /** OS Path to the "data/activity_actions.txt" file. */
59     public final static int ACTIONS_ACTIVITY    = 14;
60     /** OS Path to the "data/broadcast_actions.txt" file. */
61     public final static int ACTIONS_BROADCAST   = 15;
62     /** OS Path to the "data/service_actions.txt" file. */
63     public final static int ACTIONS_SERVICE     = 16;
64     /** OS Path to the "data/categories.txt" file. */
65     public final static int CATEGORIES          = 17;
66     /** OS Path to the "sources" folder. */
67     public final static int SOURCES             = 18;
68     /** OS Path to the target specific docs */
69     public final static int DOCS                = 19;
70     /** OS Path to the target's version of the aapt tool.
71       * This is deprecated as aapt is now in the platform tools and not in the platform. */
72     @Deprecated
73     public final static int AAPT                = 20;
74     /** OS Path to the target's version of the aidl tool.
75       * This is deprecated as aidl is now in the platform tools and not in the platform. */
76     @Deprecated
77     public final static int AIDL                = 21;
78     /** OS Path to the target's version of the dx too.<br>
79      * This is deprecated as dx is now in the platform tools and not in the platform. */
80     @Deprecated
81     public final static int DX                  = 22;
82     /** OS Path to the target's version of the dx.jar file.<br>
83      * This is deprecated as dx.jar is now in the platform tools and not in the platform. */
84     @Deprecated
85     public final static int DX_JAR              = 23;
86     /** OS Path to the "ant" folder which contains the ant build rules (ver 2 and above) */
87     public final static int ANT                 = 24;
88     /** OS Path to the Renderscript include folder.
89       * This is deprecated as this is now in the platform tools and not in the platform. */
90     @Deprecated
91     public final static int ANDROID_RS          = 25;
92     /** OS Path to the Renderscript(clang) include folder.
93       * This is deprecated as this is now in the platform tools and not in the platform. */
94     @Deprecated
95     public final static int ANDROID_RS_CLANG    = 26;
96     /** OS Path to the "uiautomator.jar" file. */
97     public final static int UI_AUTOMATOR_JAR    = 27;
98 
99     /**
100      * Return value for {@link #getUsbVendorId()} meaning no USB vendor IDs are defined by the
101      * Android target.
102      */
103     public final static int NO_USB_ID = 0;
104 
105     /** An optional library provided by an Android Target */
106     public interface IOptionalLibrary {
107         /** The name of the library, as used in the manifest (&lt;uses-library&gt;). */
getName()108         String getName();
109         /** The file name of the jar file. */
getJarName()110         String getJarName();
111         /** Absolute OS path to the jar file. */
getJarPath()112         String getJarPath();
113         /** Description of the library. */
getDescription()114         String getDescription();
115     }
116 
117     /**
118      * Returns the target location.
119      */
getLocation()120     String getLocation();
121 
122     /**
123      * Returns the name of the vendor of the target.
124      */
getVendor()125     String getVendor();
126 
127     /**
128      * Returns the name of the target.
129      */
getName()130     String getName();
131 
132     /**
133      * Returns the full name of the target, possibly including vendor name.
134      */
getFullName()135     String getFullName();
136 
137     /**
138      * Returns the name to be displayed when representing all the libraries this target contains.
139      */
getClasspathName()140     String getClasspathName();
141 
142     /**
143      * Returns the name to be displayed when representing all the libraries this target contains.
144      */
getShortClasspathName()145     String getShortClasspathName();
146 
147     /**
148      * Returns the description of the target.
149      */
getDescription()150     String getDescription();
151 
152     /**
153      * Returns the version of the target. This is guaranteed to be non-null.
154      */
getVersion()155     AndroidVersion getVersion();
156 
157     /**
158      * Returns the platform version as a readable string.
159      */
getVersionName()160     public String getVersionName();
161 
162     /** Returns the revision number for the target. */
getRevision()163     int getRevision();
164 
165     /**
166      * Returns true if the target is a standard Android platform.
167      */
isPlatform()168     boolean isPlatform();
169 
170     /**
171      * Returns the parent target. This is likely to only be non <code>null</code> if
172      * {@link #isPlatform()} returns <code>false</code>
173      */
getParent()174     IAndroidTarget getParent();
175 
176     /**
177      * Returns the path of a platform component.
178      * @param pathId the id representing the path to return. Any of the constants defined in the
179      * {@link IAndroidTarget} interface can be used.
180      */
getPath(int pathId)181     String getPath(int pathId);
182 
183     /**
184      * Returns whether the target is able to render layouts.
185      */
hasRenderingLibrary()186     boolean hasRenderingLibrary();
187 
188     /**
189      * Returns the available skins for this target.
190      */
getSkins()191     String[] getSkins();
192 
193     /**
194      * Returns the default skin for this target.
195      */
getDefaultSkin()196     String getDefaultSkin();
197 
198     /**
199      * Returns the available optional libraries for this target.
200      * @return an array of optional libraries or <code>null</code> if there is none.
201      */
getOptionalLibraries()202     IOptionalLibrary[] getOptionalLibraries();
203 
204     /**
205      * Returns the list of libraries available for a given platform.
206      *
207      * @return an array of libraries provided by the platform or <code>null</code> if there is none.
208      */
getPlatformLibraries()209     String[] getPlatformLibraries();
210 
211     /**
212      * Return the value of a given property for this target.
213      * @return the property value or <code>null</code> if it was not found.
214      */
getProperty(String name)215     String getProperty(String name);
216 
217     /**
218      * Returns the value of a given property for this target as an Integer value.
219      * <p/> If the value is missing or is not an integer, the method will return the given default
220      * value.
221      * @param name the name of the property to return
222      * @param defaultValue the default value to return.
223      *
224      * @see Integer#decode(String)
225      */
getProperty(String name, Integer defaultValue)226     Integer getProperty(String name, Integer defaultValue);
227 
228     /**
229      * Returns the value of a given property for this target as a Boolean value.
230      * <p/> If the value is missing or is not an boolean, the method will return the given default
231      * value.
232      *
233      * @param name the name of the property to return
234      * @param defaultValue the default value to return.
235      *
236      * @see Boolean#valueOf(String)
237      */
238 
getProperty(String name, Boolean defaultValue)239     Boolean getProperty(String name, Boolean defaultValue);
240 
241     /**
242      * Returns all the properties associated with this target. This can be null if the target has
243      * no properties.
244      */
getProperties()245     Map<String, String> getProperties();
246 
247     /**
248      * Returns the USB Vendor ID for the vendor of this target.
249      * <p/>If the target defines no USB Vendor ID, then the method return 0.
250      */
getUsbVendorId()251     int getUsbVendorId();
252 
253     /**
254      * Returns an array of system images for this target.
255      * The array can be empty but not null.
256      */
getSystemImages()257     public ISystemImage[] getSystemImages();
258 
259     /**
260      * Returns the system image information for the given {@code abiType}.
261      *
262      * @param abiType An ABI type string.
263      * @return An existing {@link ISystemImage} for the requested {@code abiType}
264      *         or null if none exists for this type.
265      */
getSystemImage(String abiType)266     public ISystemImage getSystemImage(String abiType);
267 
268     /**
269      * Returns whether the given target is compatible with the receiver.
270      * <p/>
271      * This means that a project using the receiver's target can run on the given target.
272      * <br/>
273      * Example:
274      * <pre>
275      * CupcakeTarget.canRunOn(DonutTarget) == true
276      * </pre>.
277      *
278      * @param target the IAndroidTarget to test.
279      */
canRunOn(IAndroidTarget target)280     boolean canRunOn(IAndroidTarget target);
281 
282     /**
283      * Returns a string able to uniquely identify a target.
284      * Typically the target will encode information such as api level, whether it's a platform
285      * or add-on, and if it's an add-on vendor and add-on name.
286      */
hashString()287     String hashString();
288 }
289