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 public final static int ANDROID_RS = 25; 84 /** OS Path to the Renderscript(clang) include folder. */ 85 public final static int ANDROID_RS_CLANG = 26; 86 87 /** 88 * Return value for {@link #getUsbVendorId()} meaning no USB vendor IDs are defined by the 89 * Android target. 90 */ 91 public final static int NO_USB_ID = 0; 92 93 /** An optional library provided by an Android Target */ 94 public interface IOptionalLibrary { 95 /** The name of the library, as used in the manifest (<uses-library>). */ 96 String getName(); 97 /** The file name of the jar file. */ 98 String getJarName(); 99 /** Absolute OS path to the jar file. */ 100 String getJarPath(); 101 /** Description of the library. */ 102 String getDescription(); 103 } 104 105 /** 106 * Returns the target location. 107 */ 108 String getLocation(); 109 110 /** 111 * Returns the name of the vendor of the target. 112 */ 113 String getVendor(); 114 115 /** 116 * Returns the name of the target. 117 */ 118 String getName(); 119 120 /** 121 * Returns the full name of the target, possibly including vendor name. 122 */ 123 String getFullName(); 124 125 /** 126 * Returns the name to be displayed when representing all the libraries this target contains. 127 */ 128 String getClasspathName(); 129 130 /** 131 * Returns the name to be displayed when representing all the libraries this target contains. 132 */ 133 String getShortClasspathName(); 134 135 /** 136 * Returns the description of the target. 137 */ 138 String getDescription(); 139 140 /** 141 * Returns the version of the target. This is guaranteed to be non-null. 142 */ 143 AndroidVersion getVersion(); 144 145 /** 146 * Returns the platform version as a readable string. 147 */ 148 public String getVersionName(); 149 150 /** Returns the revision number for the target. */ 151 int getRevision(); 152 153 /** 154 * Returns true if the target is a standard Android platform. 155 */ 156 boolean isPlatform(); 157 158 /** 159 * Returns the parent target. This is likely to only be non <code>null</code> if 160 * {@link #isPlatform()} returns <code>false</code> 161 */ 162 IAndroidTarget getParent(); 163 164 /** 165 * Returns the path of a platform component. 166 * @param pathId the id representing the path to return. Any of the constants defined in the 167 * {@link IAndroidTarget} interface can be used. 168 */ 169 String getPath(int pathId); 170 171 /** 172 * Returns whether the target is able to render layouts. 173 */ 174 boolean hasRenderingLibrary(); 175 176 /** 177 * Returns the available skins for this target. 178 */ 179 String[] getSkins(); 180 181 /** 182 * Returns the default skin for this target. 183 */ 184 String getDefaultSkin(); 185 186 /** 187 * Returns the available optional libraries for this target. 188 * @return an array of optional libraries or <code>null</code> if there is none. 189 */ 190 IOptionalLibrary[] getOptionalLibraries(); 191 192 /** 193 * Returns the list of libraries available for a given platform. 194 * 195 * @return an array of libraries provided by the platform or <code>null</code> if there is none. 196 */ 197 String[] getPlatformLibraries(); 198 199 /** 200 * Return the value of a given property for this target. 201 * @return the property value or <code>null</code> if it was not found. 202 */ 203 String getProperty(String name); 204 205 /** 206 * Returns the value of a given property for this target as an Integer value. 207 * <p/> If the value is missing or is not an integer, the method will return the given default 208 * value. 209 * @param name the name of the property to return 210 * @param defaultValue the default value to return. 211 * 212 * @see Integer#decode(String) 213 */ 214 Integer getProperty(String name, Integer defaultValue); 215 216 /** 217 * Returns the value of a given property for this target as a Boolean value. 218 * <p/> If the value is missing or is not an boolean, the method will return the given default 219 * value. 220 * 221 * @param name the name of the property to return 222 * @param defaultValue the default value to return. 223 * 224 * @see Boolean#valueOf(String) 225 */ 226 227 Boolean getProperty(String name, Boolean defaultValue); 228 229 /** 230 * Returns all the properties associated with this target. This can be null if the target has 231 * no properties. 232 */ 233 Map<String, String> getProperties(); 234 235 /** 236 * Returns the USB Vendor ID for the vendor of this target. 237 * <p/>If the target defines no USB Vendor ID, then the method return 0. 238 */ 239 int getUsbVendorId(); 240 241 /** 242 * Returns an array of system images for this target. 243 * The array can be empty but not null. 244 */ 245 public ISystemImage[] getSystemImages(); 246 247 /** 248 * Returns the system image information for the given {@code abiType}. 249 * 250 * @param abiType An ABI type string. 251 * @return An existing {@link ISystemImage} for the requested {@code abiType} 252 * or null if none exists for this type. 253 */ 254 public ISystemImage getSystemImage(String abiType); 255 256 /** 257 * Returns whether the given target is compatible with the receiver. 258 * <p/> 259 * This means that a project using the receiver's target can run on the given target. 260 * <br/> 261 * Example: 262 * <pre> 263 * CupcakeTarget.canRunOn(DonutTarget) == true 264 * </pre>. 265 * 266 * @param target the IAndroidTarget to test. 267 */ 268 boolean canRunOn(IAndroidTarget target); 269 270 /** 271 * Returns a string able to uniquely identify a target. 272 * Typically the target will encode information such as api level, whether it's a platform 273 * or add-on, and if it's an add-on vendor and add-on name. 274 */ 275 String hashString(); 276 } 277