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 20 21 /** 22 * A version of Android that applications can target when building. 23 */ 24 public interface IAndroidTarget extends Comparable<IAndroidTarget> { 25 26 /** OS Path to the "android.jar" file. */ 27 public final static int ANDROID_JAR = 1; 28 /** OS Path to the "framework.aidl" file. */ 29 public final static int ANDROID_AIDL = 2; 30 /** OS Path to "images" folder which contains the emulator system images. */ 31 public final static int IMAGES = 3; 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 public final static int AAPT = 20; 66 /** OS Path to the target's version of the aidl tool. */ 67 public final static int AIDL = 21; 68 /** OS Path to the target's version of the dx too. */ 69 public final static int DX = 22; 70 /** OS Path to the target's version of the dx.jar file. */ 71 public final static int DX_JAR = 23; 72 73 /** 74 * Return value for {@link #getUsbVendorId()} meaning no USB vendor IDs are defined by the 75 * Android target. 76 */ 77 public final static int NO_USB_ID = 0; 78 79 /** An optional library provided by an Android Target */ 80 public interface IOptionalLibrary { 81 /** The name of the library, as used in the manifest (<uses-library>). */ getName()82 String getName(); 83 /** The file name of the jar file. */ getJarName()84 String getJarName(); 85 /** Absolute OS path to the jar file. */ getJarPath()86 String getJarPath(); 87 /** Description of the library. */ getDescription()88 String getDescription(); 89 } 90 91 /** 92 * Returns the target location. 93 */ getLocation()94 String getLocation(); 95 96 /** 97 * Returns the name of the vendor of the target. 98 */ getVendor()99 String getVendor(); 100 101 /** 102 * Returns the name of the target. 103 */ getName()104 String getName(); 105 106 /** 107 * Returns the full name of the target, possibly including vendor name. 108 */ getFullName()109 String getFullName(); 110 111 /** 112 * Returns the name to be displayed when representing all the libraries this target contains. 113 */ getClasspathName()114 String getClasspathName(); 115 116 /** 117 * Returns the description of the target. 118 */ getDescription()119 String getDescription(); 120 121 /** 122 * Returns the version of the target. This is guaranteed to be non-null. 123 */ getVersion()124 AndroidVersion getVersion(); 125 126 /** 127 * Returns the platform version as a readable string. 128 */ getVersionName()129 public String getVersionName(); 130 131 /** Returns the revision number for the target. */ getRevision()132 int getRevision(); 133 134 /** 135 * Returns true if the target is a standard Android platform. 136 */ isPlatform()137 boolean isPlatform(); 138 139 /** 140 * Returns the parent target. This is likely to only be non <code>null</code> if 141 * {@link #isPlatform()} returns <code>false</code> 142 */ getParent()143 IAndroidTarget getParent(); 144 145 /** 146 * Returns the path of a platform component. 147 * @param pathId the id representing the path to return. Any of the constants defined in the 148 * {@link IAndroidTarget} interface can be used. 149 */ getPath(int pathId)150 String getPath(int pathId); 151 152 /** 153 * Returns the available skins for this target. 154 */ getSkins()155 String[] getSkins(); 156 157 /** 158 * Returns the default skin for this target. 159 */ getDefaultSkin()160 String getDefaultSkin(); 161 162 /** 163 * Returns the available optional libraries for this target. 164 * @return an array of optional libraries or <code>null</code> if there is none. 165 */ getOptionalLibraries()166 IOptionalLibrary[] getOptionalLibraries(); 167 168 /** 169 * Returns the list of libraries available for a given platform. 170 * 171 * @return an array of libraries provided by the platform or <code>null</code> if there is none. 172 */ getPlatformLibraries()173 String[] getPlatformLibraries(); 174 175 /** 176 * Returns the USB Vendor ID for the vendor of this target. 177 * <p/>If the target defines no USB Vendor ID, then the method return 0. 178 */ getUsbVendorId()179 int getUsbVendorId(); 180 181 /** 182 * Returns whether the given target is compatible with the receiver. 183 * <p/>A target is considered compatible if applications developed for the receiver can run on 184 * the given target. 185 * 186 * @param target the IAndroidTarget to test. 187 */ isCompatibleBaseFor(IAndroidTarget target)188 boolean isCompatibleBaseFor(IAndroidTarget target); 189 190 /** 191 * Returns a string able to uniquely identify a target. 192 * Typically the target will encode information such as api level, whether it's a platform 193 * or add-on, and if it's an add-on vendor and add-on name. 194 */ hashString()195 String hashString(); 196 } 197