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