PageRenderTime 56ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java

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