1 /* 2 * Copyright (C) 2007 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 com.android.AndroidConstants; 20 21 import java.io.File; 22 23 /** 24 * Constant definition class.<br> 25 * <br> 26 * Most constants have a prefix defining the content. 27 * <ul> 28 * <li><code>OS_</code> OS path constant. These paths are different depending on the platform.</li> 29 * <li><code>FN_</code> File name constant.</li> 30 * <li><code>FD_</code> Folder name constant.</li> 31 * </ul> 32 * 33 */ 34 public final class SdkConstants { 35 public final static int PLATFORM_UNKNOWN = 0; 36 public final static int PLATFORM_LINUX = 1; 37 public final static int PLATFORM_WINDOWS = 2; 38 public final static int PLATFORM_DARWIN = 3; 39 40 /** 41 * Returns current platform, one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN}, 42 * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}. 43 */ 44 public final static int CURRENT_PLATFORM = currentPlatform(); 45 46 /** 47 * Charset for the ini file handled by the SDK. 48 */ 49 public final static String INI_CHARSET = "UTF-8"; //$NON-NLS-1$ 50 51 /** An SDK Project's AndroidManifest.xml file */ 52 public static final String FN_ANDROID_MANIFEST_XML= "AndroidManifest.xml"; //$NON-NLS-1$ 53 /** pre-dex jar filename. i.e. "classes.jar" */ 54 public final static String FN_CLASSES_JAR = "classes.jar"; //$NON-NLS-1$ 55 /** Dex filename inside the APK. i.e. "classes.dex" */ 56 public final static String FN_APK_CLASSES_DEX = "classes.dex"; //$NON-NLS-1$ 57 58 /** An SDK Project's build.xml file */ 59 public final static String FN_BUILD_XML = "build.xml"; //$NON-NLS-1$ 60 61 /** Name of the framework library, i.e. "android.jar" */ 62 public static final String FN_FRAMEWORK_LIBRARY = "android.jar"; //$NON-NLS-1$ 63 /** Name of the layout attributes, i.e. "attrs.xml" */ 64 public static final String FN_ATTRS_XML = "attrs.xml"; //$NON-NLS-1$ 65 /** Name of the layout attributes, i.e. "attrs_manifest.xml" */ 66 public static final String FN_ATTRS_MANIFEST_XML = "attrs_manifest.xml"; //$NON-NLS-1$ 67 /** framework aidl import file */ 68 public static final String FN_FRAMEWORK_AIDL = "framework.aidl"; //$NON-NLS-1$ 69 /** framework renderscript folder */ 70 public static final String FN_FRAMEWORK_RENDERSCRIPT = "renderscript"; //$NON-NLS-1$ 71 /** framework include folder */ 72 public static final String FN_FRAMEWORK_INCLUDE = "include"; //$NON-NLS-1$ 73 /** framework include (clang) folder */ 74 public static final String FN_FRAMEWORK_INCLUDE_CLANG = "clang-include"; //$NON-NLS-1$ 75 /** layoutlib.jar file */ 76 public static final String FN_LAYOUTLIB_JAR = "layoutlib.jar"; //$NON-NLS-1$ 77 /** widget list file */ 78 public static final String FN_WIDGETS = "widgets.txt"; //$NON-NLS-1$ 79 /** Intent activity actions list file */ 80 public static final String FN_INTENT_ACTIONS_ACTIVITY = "activity_actions.txt"; //$NON-NLS-1$ 81 /** Intent broadcast actions list file */ 82 public static final String FN_INTENT_ACTIONS_BROADCAST = "broadcast_actions.txt"; //$NON-NLS-1$ 83 /** Intent service actions list file */ 84 public static final String FN_INTENT_ACTIONS_SERVICE = "service_actions.txt"; //$NON-NLS-1$ 85 /** Intent category list file */ 86 public static final String FN_INTENT_CATEGORIES = "categories.txt"; //$NON-NLS-1$ 87 88 /** annotations support jar */ 89 public static final String FN_ANNOTATIONS_JAR = "annotations.jar"; //$NON-NLS-1$ 90 91 /** platform build property file */ 92 public final static String FN_BUILD_PROP = "build.prop"; //$NON-NLS-1$ 93 /** plugin properties file */ 94 public final static String FN_PLUGIN_PROP = "plugin.prop"; //$NON-NLS-1$ 95 /** add-on manifest file */ 96 public final static String FN_MANIFEST_INI = "manifest.ini"; //$NON-NLS-1$ 97 /** add-on layout device XML file. */ 98 public final static String FN_DEVICES_XML = "devices.xml"; //$NON-NLS-1$ 99 /** hardware properties definition file */ 100 public final static String FN_HARDWARE_INI = "hardware-properties.ini"; //$NON-NLS-1$ 101 102 /** project property file */ 103 public final static String FN_PROJECT_PROPERTIES = "project.properties"; //$NON-NLS-1$ 104 105 /** project local property file */ 106 public final static String FN_LOCAL_PROPERTIES = "local.properties"; //$NON-NLS-1$ 107 108 /** project ant property file */ 109 public final static String FN_ANT_PROPERTIES = "ant.properties"; //$NON-NLS-1$ 110 111 /** Skin layout file */ 112 public final static String FN_SKIN_LAYOUT = "layout"; //$NON-NLS-1$ 113 114 /** dx.jar file */ 115 public static final String FN_DX_JAR = "dx.jar"; //$NON-NLS-1$ 116 117 /** dx executable (with extension for the current OS) */ 118 public final static String FN_DX = 119 "dx" + ext(".bat", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 120 121 /** aapt executable (with extension for the current OS) */ 122 public final static String FN_AAPT = 123 "aapt" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 124 125 /** aidl executable (with extension for the current OS) */ 126 public final static String FN_AIDL = 127 "aidl" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 128 129 /** renderscript executable (with extension for the current OS) */ 130 public final static String FN_RENDERSCRIPT = 131 "llvm-rs-cc" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 132 133 /** adb executable (with extension for the current OS) */ 134 public final static String FN_ADB = 135 "adb" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 136 137 /** emulator executable for the current OS */ 138 public final static String FN_EMULATOR = 139 "emulator" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 140 141 /** zipalign executable (with extension for the current OS) */ 142 public final static String FN_ZIPALIGN = 143 "zipalign" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 144 145 /** dexdump executable (with extension for the current OS) */ 146 public final static String FN_DEXDUMP = 147 "dexdump" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 148 149 /** proguard executable (with extension for the current OS) */ 150 public final static String FN_PROGUARD = 151 "proguard" + ext(".bat", ".sh"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 152 153 /** find_lock for Windows (with extension for the current OS) */ 154 public final static String FN_FIND_LOCK = 155 "find_lock" + ext(".exe", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 156 157 /** properties file for SDK Updater packages */ 158 public final static String FN_SOURCE_PROP = "source.properties"; //$NON-NLS-1$ 159 /** properties file for content hash of installed packages */ 160 public final static String FN_CONTENT_HASH_PROP = "content_hash.properties"; //$NON-NLS-1$ 161 /** properties file for the SDK */ 162 public final static String FN_SDK_PROP = "sdk.properties"; //$NON-NLS-1$ 163 164 /** 165 * filename for gdbserver. 166 */ 167 public final static String FN_GDBSERVER = "gdbserver"; //$NON-NLS-1$ 168 169 /** global Android proguard config file */ 170 public final static String FN_ANDROID_PROGUARD_FILE = "proguard-android.txt"; //$NON-NLS-1$ 171 /** default proguard config file with new file extension (for project specific stuff) */ 172 public final static String FN_PROJECT_PROGUARD_FILE = "proguard-project.txt"; //$NON-NLS-1$ 173 174 /* Folder Names for Android Projects . */ 175 176 /** Resources folder name, i.e. "res". */ 177 public final static String FD_RESOURCES = "res"; //$NON-NLS-1$ 178 /** Assets folder name, i.e. "assets" */ 179 public final static String FD_ASSETS = "assets"; //$NON-NLS-1$ 180 /** Default source folder name in an SDK project, i.e. "src". 181 * <p/> 182 * Note: this is not the same as {@link #FD_PKG_SOURCES} 183 * which is an SDK sources folder for packages. */ 184 public final static String FD_SOURCES = "src"; //$NON-NLS-1$ 185 /** Default generated source folder name, i.e. "gen" */ 186 public final static String FD_GEN_SOURCES = "gen"; //$NON-NLS-1$ 187 /** Default native library folder name inside the project, i.e. "libs" 188 * While the folder inside the .apk is "lib", we call that one libs because 189 * that's what we use in ant for both .jar and .so and we need to make the 2 development ways 190 * compatible. */ 191 public final static String FD_NATIVE_LIBS = "libs"; //$NON-NLS-1$ 192 /** Native lib folder inside the APK: "lib" */ 193 public final static String FD_APK_NATIVE_LIBS = "lib"; //$NON-NLS-1$ 194 /** Default output folder name, i.e. "bin" */ 195 public final static String FD_OUTPUT = "bin"; //$NON-NLS-1$ 196 /** Classes output folder name, i.e. "classes" */ 197 public final static String FD_CLASSES_OUTPUT = "classes"; //$NON-NLS-1$ 198 /** proguard output folder for mapping, etc.. files */ 199 public final static String FD_PROGUARD = "proguard"; //$NON-NLS-1$ 200 201 /* Folder Names for the Android SDK */ 202 203 /** Name of the SDK platforms folder. */ 204 public final static String FD_PLATFORMS = "platforms"; //$NON-NLS-1$ 205 /** Name of the SDK addons folder. */ 206 public final static String FD_ADDONS = "add-ons"; //$NON-NLS-1$ 207 /** Name of the SDK system-images folder. */ 208 public final static String FD_SYSTEM_IMAGES = "system-images"; //$NON-NLS-1$ 209 /** Name of the SDK sources folder where source packages are installed. 210 * <p/> 211 * Note this is not the same as {@link #FD_SOURCES} which is the folder name where sources 212 * are installed inside a project. */ 213 public final static String FD_PKG_SOURCES = "sources"; //$NON-NLS-1$ 214 /** Name of the SDK tools folder. */ 215 public final static String FD_TOOLS = "tools"; //$NON-NLS-1$ 216 /** Name of the SDK tools/support folder. */ 217 public final static String FD_SUPPORT = "support"; //$NON-NLS-1$ 218 /** Name of the SDK platform tools folder. */ 219 public final static String FD_PLATFORM_TOOLS = "platform-tools"; //$NON-NLS-1$ 220 /** Name of the SDK tools/lib folder. */ 221 public final static String FD_LIB = "lib"; //$NON-NLS-1$ 222 /** Name of the SDK docs folder. */ 223 public final static String FD_DOCS = "docs"; //$NON-NLS-1$ 224 /** Name of the doc folder containing API reference doc (javadoc) */ 225 public static final String FD_DOCS_REFERENCE = "reference"; //$NON-NLS-1$ 226 /** Name of the SDK images folder. */ 227 public final static String FD_IMAGES = "images"; //$NON-NLS-1$ 228 /** Name of the ABI to support. */ 229 public final static String ABI_ARMEABI = "armeabi"; //$NON-NLS-1$ 230 public final static String ABI_ARMEABI_V7A = "armeabi-v7a"; //$NON-NLS-1$ 231 public final static String ABI_INTEL_ATOM = "x86"; //$NON-NLS-1$ 232 public final static String ABI_MIPS = "mips"; //$NON-NLS-1$ 233 /** Name of the CPU arch to support. */ 234 public final static String CPU_ARCH_ARM = "arm"; //$NON-NLS-1$ 235 public final static String CPU_ARCH_INTEL_ATOM = "x86"; //$NON-NLS-1$ 236 public final static String CPU_ARCH_MIPS = "mips"; //$NON-NLS-1$ 237 /** Name of the CPU model to support. */ 238 public final static String CPU_MODEL_CORTEX_A8 = "cortex-a8"; //$NON-NLS-1$ 239 240 /** Name of the SDK skins folder. */ 241 public final static String FD_SKINS = "skins"; //$NON-NLS-1$ 242 /** Name of the SDK samples folder. */ 243 public final static String FD_SAMPLES = "samples"; //$NON-NLS-1$ 244 /** Name of the SDK extras folder. */ 245 public final static String FD_EXTRAS = "extras"; //$NON-NLS-1$ 246 /** Name of the SDK templates folder, i.e. "templates" */ 247 public final static String FD_TEMPLATES = "templates"; //$NON-NLS-1$ 248 /** Name of the SDK Ant folder, i.e. "ant" */ 249 public final static String FD_ANT = "ant"; //$NON-NLS-1$ 250 /** Name of the SDK data folder, i.e. "data" */ 251 public final static String FD_DATA = "data"; //$NON-NLS-1$ 252 /** Name of the SDK renderscript folder, i.e. "rs" */ 253 public final static String FD_RENDERSCRIPT = "rs"; //$NON-NLS-1$ 254 /** Name of the SDK resources folder, i.e. "res" */ 255 public final static String FD_RES = "res"; //$NON-NLS-1$ 256 /** Name of the SDK font folder, i.e. "fonts" */ 257 public final static String FD_FONTS = "fonts"; //$NON-NLS-1$ 258 /** Name of the android sources directory */ 259 public static final String FD_ANDROID_SOURCES = "sources"; //$NON-NLS-1$ 260 /** Name of the addon libs folder. */ 261 public final static String FD_ADDON_LIBS = "libs"; //$NON-NLS-1$ 262 263 /** Name of the cache folder in the $HOME/.android. */ 264 public final static String FD_CACHE = "cache"; //$NON-NLS-1$ 265 266 /** Namespace for the resource XML, i.e. "http://schemas.android.com/apk/res/android" */ 267 public final static String NS_RESOURCES = 268 "http://schemas.android.com/apk/res/android"; //$NON-NLS-1$ 269 270 /** The name of the uses-library that provides "android.test.runner" */ 271 public final static String ANDROID_TEST_RUNNER_LIB = 272 "android.test.runner"; //$NON-NLS-1$ 273 274 /* Folder path relative to the SDK root */ 275 /** Path of the documentation directory relative to the sdk folder. 276 * This is an OS path, ending with a separator. */ 277 public final static String OS_SDK_DOCS_FOLDER = FD_DOCS + File.separator; 278 279 /** Path of the tools directory relative to the sdk folder, or to a platform folder. 280 * This is an OS path, ending with a separator. */ 281 public final static String OS_SDK_TOOLS_FOLDER = FD_TOOLS + File.separator; 282 283 /** Path of the lib directory relative to the sdk folder, or to a platform folder. 284 * This is an OS path, ending with a separator. */ 285 public final static String OS_SDK_TOOLS_LIB_FOLDER = 286 OS_SDK_TOOLS_FOLDER + FD_LIB + File.separator; 287 288 /** 289 * Path of the lib directory relative to the sdk folder, or to a platform 290 * folder. This is an OS path, ending with a separator. 291 */ 292 public final static String OS_SDK_TOOLS_LIB_EMULATOR_FOLDER = OS_SDK_TOOLS_LIB_FOLDER 293 + "emulator" + File.separator; //$NON-NLS-1$ 294 295 /** Path of the platform tools directory relative to the sdk folder. 296 * This is an OS path, ending with a separator. */ 297 public final static String OS_SDK_PLATFORM_TOOLS_FOLDER = FD_PLATFORM_TOOLS + File.separator; 298 299 /** Path of the Platform tools Lib directory relative to the sdk folder. 300 * This is an OS path, ending with a separator. */ 301 public final static String OS_SDK_PLATFORM_TOOLS_LIB_FOLDER = 302 OS_SDK_PLATFORM_TOOLS_FOLDER + FD_LIB + File.separator; 303 304 /** Path of the bin folder of proguard folder relative to the sdk folder. 305 * This is an OS path, ending with a separator. */ 306 public final static String OS_SDK_TOOLS_PROGUARD_BIN_FOLDER = 307 SdkConstants.OS_SDK_TOOLS_FOLDER + 308 "proguard" + File.separator + //$NON-NLS-1$ 309 "bin" + File.separator; //$NON-NLS-1$ 310 311 /* Folder paths relative to a platform or add-on folder */ 312 313 /** Path of the images directory relative to a platform or addon folder. 314 * This is an OS path, ending with a separator. */ 315 public final static String OS_IMAGES_FOLDER = FD_IMAGES + File.separator; 316 317 /** Path of the skin directory relative to a platform or addon folder. 318 * This is an OS path, ending with a separator. */ 319 public final static String OS_SKINS_FOLDER = FD_SKINS + File.separator; 320 321 /* Folder paths relative to a Platform folder */ 322 323 /** Path of the data directory relative to a platform folder. 324 * This is an OS path, ending with a separator. */ 325 public final static String OS_PLATFORM_DATA_FOLDER = FD_DATA + File.separator; 326 327 /** Path of the renderscript directory relative to a platform folder. 328 * This is an OS path, ending with a separator. */ 329 public final static String OS_PLATFORM_RENDERSCRIPT_FOLDER = FD_RENDERSCRIPT + File.separator; 330 331 332 /** Path of the samples directory relative to a platform folder. 333 * This is an OS path, ending with a separator. */ 334 public final static String OS_PLATFORM_SAMPLES_FOLDER = FD_SAMPLES + File.separator; 335 336 /** Path of the resources directory relative to a platform folder. 337 * This is an OS path, ending with a separator. */ 338 public final static String OS_PLATFORM_RESOURCES_FOLDER = 339 OS_PLATFORM_DATA_FOLDER + FD_RES + File.separator; 340 341 /** Path of the fonts directory relative to a platform folder. 342 * This is an OS path, ending with a separator. */ 343 public final static String OS_PLATFORM_FONTS_FOLDER = 344 OS_PLATFORM_DATA_FOLDER + FD_FONTS + File.separator; 345 346 /** Path of the android source directory relative to a platform folder. 347 * This is an OS path, ending with a separator. */ 348 public final static String OS_PLATFORM_SOURCES_FOLDER = FD_ANDROID_SOURCES + File.separator; 349 350 /** Path of the android templates directory relative to a platform folder. 351 * This is an OS path, ending with a separator. */ 352 public final static String OS_PLATFORM_TEMPLATES_FOLDER = FD_TEMPLATES + File.separator; 353 354 /** Path of the Ant build rules directory relative to a platform folder. 355 * This is an OS path, ending with a separator. */ 356 public final static String OS_PLATFORM_ANT_FOLDER = FD_ANT + File.separator; 357 358 /** Path of the attrs.xml file relative to a platform folder. */ 359 public final static String OS_PLATFORM_ATTRS_XML = 360 OS_PLATFORM_RESOURCES_FOLDER + AndroidConstants.FD_RES_VALUES + File.separator + 361 FN_ATTRS_XML; 362 363 /** Path of the attrs_manifest.xml file relative to a platform folder. */ 364 public final static String OS_PLATFORM_ATTRS_MANIFEST_XML = 365 OS_PLATFORM_RESOURCES_FOLDER + AndroidConstants.FD_RES_VALUES + File.separator + 366 FN_ATTRS_MANIFEST_XML; 367 368 /** Path of the layoutlib.jar file relative to a platform folder. */ 369 public final static String OS_PLATFORM_LAYOUTLIB_JAR = 370 OS_PLATFORM_DATA_FOLDER + FN_LAYOUTLIB_JAR; 371 372 /** Path of the renderscript include folder relative to a platform folder. */ 373 public final static String OS_FRAMEWORK_RS = 374 FN_FRAMEWORK_RENDERSCRIPT + File.separator + FN_FRAMEWORK_INCLUDE; 375 /** Path of the renderscript (clang) include folder relative to a platform folder. */ 376 public final static String OS_FRAMEWORK_RS_CLANG = 377 FN_FRAMEWORK_RENDERSCRIPT + File.separator + FN_FRAMEWORK_INCLUDE_CLANG; 378 379 /* Folder paths relative to a addon folder */ 380 381 /** Path of the images directory relative to a folder folder. 382 * This is an OS path, ending with a separator. */ 383 public final static String OS_ADDON_LIBS_FOLDER = FD_ADDON_LIBS + File.separator; 384 385 /** Skin default **/ 386 public final static String SKIN_DEFAULT = "default"; //$NON-NLS-1$ 387 388 /** SDK property: ant templates revision */ 389 public final static String PROP_SDK_ANT_TEMPLATES_REVISION = 390 "sdk.ant.templates.revision"; //$NON-NLS-1$ 391 392 /** SDK property: default skin */ 393 public final static String PROP_SDK_DEFAULT_SKIN = "sdk.skin.default"; //$NON-NLS-1$ 394 395 /* Android Class Constants */ 396 public final static String CLASS_ACTIVITY = "android.app.Activity"; //$NON-NLS-1$ 397 public final static String CLASS_APPLICATION = "android.app.Application"; //$NON-NLS-1$ 398 public final static String CLASS_SERVICE = "android.app.Service"; //$NON-NLS-1$ 399 public final static String CLASS_BROADCASTRECEIVER = "android.content.BroadcastReceiver"; //$NON-NLS-1$ 400 public final static String CLASS_CONTENTPROVIDER = "android.content.ContentProvider"; //$NON-NLS-1$ 401 public final static String CLASS_INSTRUMENTATION = "android.app.Instrumentation"; //$NON-NLS-1$ 402 public final static String CLASS_INSTRUMENTATION_RUNNER = 403 "android.test.InstrumentationTestRunner"; //$NON-NLS-1$ 404 public final static String CLASS_BUNDLE = "android.os.Bundle"; //$NON-NLS-1$ 405 public final static String CLASS_R = "android.R"; //$NON-NLS-1$ 406 public final static String CLASS_MANIFEST_PERMISSION = "android.Manifest$permission"; //$NON-NLS-1$ 407 public final static String CLASS_INTENT = "android.content.Intent"; //$NON-NLS-1$ 408 public final static String CLASS_CONTEXT = "android.content.Context"; //$NON-NLS-1$ 409 public final static String CLASS_VIEW = "android.view.View"; //$NON-NLS-1$ 410 public final static String CLASS_VIEWGROUP = "android.view.ViewGroup"; //$NON-NLS-1$ 411 public final static String CLASS_NAME_LAYOUTPARAMS = "LayoutParams"; //$NON-NLS-1$ 412 public final static String CLASS_VIEWGROUP_LAYOUTPARAMS = 413 CLASS_VIEWGROUP + "$" + CLASS_NAME_LAYOUTPARAMS; //$NON-NLS-1$ 414 public final static String CLASS_NAME_FRAMELAYOUT = "FrameLayout"; //$NON-NLS-1$ 415 public final static String CLASS_FRAMELAYOUT = 416 "android.widget." + CLASS_NAME_FRAMELAYOUT; //$NON-NLS-1$ 417 public final static String CLASS_PREFERENCE = "android.preference.Preference"; //$NON-NLS-1$ 418 public final static String CLASS_NAME_PREFERENCE_SCREEN = "PreferenceScreen"; //$NON-NLS-1$ 419 public final static String CLASS_PREFERENCES = 420 "android.preference." + CLASS_NAME_PREFERENCE_SCREEN; //$NON-NLS-1$ 421 public final static String CLASS_PREFERENCEGROUP = "android.preference.PreferenceGroup"; //$NON-NLS-1$ 422 public final static String CLASS_PARCELABLE = "android.os.Parcelable"; //$NON-NLS-1$ 423 public static final String CLASS_FRAGMENT = "android.app.Fragment"; //$NON-NLS-1$ 424 public static final String CLASS_V4_FRAGMENT = "android.support.v4.app.Fragment"; //$NON-NLS-1$ 425 /** MockView is part of the layoutlib bridge and used to display classes that have 426 * no rendering in the graphical layout editor. */ 427 public final static String CLASS_MOCK_VIEW = "com.android.layoutlib.bridge.MockView"; //$NON-NLS-1$ 428 429 430 431 /** Returns the appropriate name for the 'android' command, which is 'android.exe' for 432 * Windows and 'android' for all other platforms. */ 433 public static String androidCmdName() { 434 String os = System.getProperty("os.name"); //$NON-NLS-1$ 435 String cmd = "android"; //$NON-NLS-1$ 436 if (os.startsWith("Windows")) { //$NON-NLS-1$ 437 cmd += ".bat"; //$NON-NLS-1$ 438 } 439 return cmd; 440 } 441 442 /** Returns the appropriate name for the 'mksdcard' command, which is 'mksdcard.exe' for 443 * Windows and 'mkdsdcard' for all other platforms. */ 444 public static String mkSdCardCmdName() { 445 String os = System.getProperty("os.name"); //$NON-NLS-1$ 446 String cmd = "mksdcard"; //$NON-NLS-1$ 447 if (os.startsWith("Windows")) { //$NON-NLS-1$ 448 cmd += ".exe"; //$NON-NLS-1$ 449 } 450 return cmd; 451 } 452 453 /** 454 * Returns current platform 455 * 456 * @return one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN}, 457 * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}. 458 */ 459 public static int currentPlatform() { 460 String os = System.getProperty("os.name"); //$NON-NLS-1$ 461 if (os.startsWith("Mac OS")) { //$NON-NLS-1$ 462 return PLATFORM_DARWIN; 463 } else if (os.startsWith("Windows")) { //$NON-NLS-1$ 464 return PLATFORM_WINDOWS; 465 } else if (os.startsWith("Linux")) { //$NON-NLS-1$ 466 return PLATFORM_LINUX; 467 } 468 469 return PLATFORM_UNKNOWN; 470 } 471 472 /** 473 * Returns current platform's UI name 474 * 475 * @return one of "Windows", "Mac OS X", "Linux" or "other". 476 */ 477 public static String currentPlatformName() { 478 String os = System.getProperty("os.name"); //$NON-NLS-1$ 479 if (os.startsWith("Mac OS")) { //$NON-NLS-1$ 480 return "Mac OS X"; //$NON-NLS-1$ 481 } else if (os.startsWith("Windows")) { //$NON-NLS-1$ 482 return "Windows"; //$NON-NLS-1$ 483 } else if (os.startsWith("Linux")) { //$NON-NLS-1$ 484 return "Linux"; //$NON-NLS-1$ 485 } 486 487 return "Other"; 488 } 489 490 private static String ext(String windowsExtension, String nonWindowsExtension) { 491 if (CURRENT_PLATFORM == PLATFORM_WINDOWS) { 492 return windowsExtension; 493 } else { 494 return nonWindowsExtension; 495 } 496 } 497 } 498