am eaa464e6: am a34fa95c: force inclusion of system log tags in the event-log-tags file
* commit 'eaa464e6c4064ce8359d3e5871e0d184388457b8':
force inclusion of system log tags in the event-log-tags file
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 2663780..4d50937 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -44,13 +44,31 @@
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system)
+
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libmediaplayerservice_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libmedia_jni_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libstagefright_omx_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/android-info.txt)
$(call add-clean-step, find $(PRODUCT_OUT) -name "*.apk" | xargs rm)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/app/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/*/LINKED)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
+# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/buildspec.mk.default b/buildspec.mk.default
index c568a82..46aee69 100644
--- a/buildspec.mk.default
+++ b/buildspec.mk.default
@@ -106,9 +106,9 @@
#WEBCORE_INSTRUMENTATION:=true
endif
-# To enable SVG in webcore define ENABLE_SVG:=true
+# To disable SVG in webcore define ENABLE_SVG:=false
ifndef ENABLE_SVG
-#ENABLE_SVG:=true
+#ENABLE_SVG:=false
endif
# when the build system changes such that this file must be updated, this
diff --git a/core/Makefile b/core/Makefile
index de65109..b7e481a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -15,15 +15,18 @@
# <dest file> is relative to $(PRODUCT_OUT), so it should look like,
# e.g., "system/etc/file.xml".
# The filter part means "only eval the copy-one-file rule if this
-# src:dest pair is the first one to match %:dest"
+# src:dest pair is the first one to match the same dest"
+unique_product_copy_files_destinations := $(sort \
+ $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
$(foreach cf,$(PRODUCT_COPY_FILES), \
- $(eval _src := $(call word-colon,1,$(cf))) \
- $(eval _dest := $(call word-colon,2,$(cf))) \
- $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
- $(if $(filter $(_src):$(_dest),$(firstword $(filter %:$(_dest),$(PRODUCT_COPY_FILES)))), \
- $(eval $(call copy-one-file,$(_src),$(_fulldest))),) \
- $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
- )
+ $(eval _src := $(call word-colon,1,$(cf))) \
+ $(eval _dest := $(call word-colon,2,$(cf))) \
+ $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
+ $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
+ $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
+ $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
+ $(unique_product_copy_files_destinations)))))
# -----------------------------------------------------------------
# docs/index.html
@@ -95,6 +98,14 @@
BUILD_DISPLAY_ID := $(build_desc)
endif
+# Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES
+product_property_override_locale_language := $(strip \
+ $(patsubst ro.product.locale.language=%,%,\
+ $(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES))))
+product_property_overrides_locale_region := $(strip \
+ $(patsubst ro.product.locale.region=%,%,\
+ $(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES))))
+
# Selects the first locale in the list given as the argument,
# and splits it into language and region, which each may be
# empty.
@@ -103,12 +114,13 @@
endef
# Selects the first locale in the list given as the argument
-# and returns the language (or the region)
+# and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES;
+# Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES.
define default-locale-language
-$(word 2, 2, $(call default-locale, $(1)))
+$(if $(product_property_override_locale_language),,$(word 1, $(call default-locale, $(1))))
endef
define default-locale-region
-$(word 3, 3, $(call default-locale, $(1)))
+$(if $(product_property_overrides_locale_region),,$(word 2, $(call default-locale, $(1))))
endef
BUILDINFO_SH := build/tools/buildinfo.sh
@@ -137,6 +149,7 @@
TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
+ TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
bash $(BUILDINFO_SH) > $@
$(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
@@ -720,7 +733,7 @@
$(ALL_DEFAULT_INSTALLED_MODULES))
ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
-## generate an ext2 image
+## generate an ext image
# $(1): output file
define build-systemimage-target
@echo "Target system fs image: $(1)"
@@ -838,7 +851,7 @@
$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
-## Generate an ext image
+## Generate an ext2 image
define build-userdataimage-target
$(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_DATA)
@@ -866,7 +879,7 @@
$(build-userdataimage-target)
.PHONY: userdataimage-nodeps
-userdataimage-nodeps: $(INTERNAL_USERIMAGES_DEPS)
+userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
$(build-userdataimage-target)
#######
@@ -911,6 +924,9 @@
$(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
$(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
$(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
+ $(HOST_OUT_EXECUTABLES)/genext2fs \
+ $(HOST_OUT_EXECUTABLES)/tune2fs \
+ $(HOST_OUT_EXECUTABLES)/e2fsck \
$(HOST_OUT_EXECUTABLES)/make_ext4fs
.PHONY: otatools
@@ -1140,8 +1156,12 @@
.PHONY: installed-file-list
installed-file-list: $(INSTALLED_FILES_FILE)
+ifneq ($(filter sdk,$(MAKECMDGOALS)),)
$(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE))
+endif
+ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
+endif
# -----------------------------------------------------------------
# A zip of the tests that are built when running "make tests".
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 54bbb68..b1480e1 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -220,6 +220,9 @@
aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources))
+ifeq (,$(TARGET_BUILD_APPS))
+LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
+endif
aidl_preprocess_import :=
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
ifdef LOCAL_SDK_VERSION
@@ -449,8 +452,10 @@
full_java_lib_deps += $(link_instr_intermediates_dir.COMMON)/classes.jar
endif
+jar_manifest_file :=
ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
+jar_manifest_file := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(jar_manifest_file)
else
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
endif
@@ -515,7 +520,7 @@
ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
@echo "Install: $@"
- $(copy-file-to-target)
+ $(copy-file-to-new-target)
else
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
@echo "Install: $@"
@@ -529,7 +534,7 @@
@echo "Install: $@"
$(copy-file-to-target)
-$(LOCAL_INSTALLED_MODULE) : | $(installed_odex)
+$(LOCAL_INSTALLED_MODULE) : $(installed_odex)
endif
endif # !LOCAL_UNINSTALLABLE_MODULE
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 792bd56..0d2e215 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -44,6 +44,7 @@
LOCAL_LDFLAGS:=
LOCAL_LDLIBS:=
LOCAL_AAPT_FLAGS:=
+LOCAL_AAPT_INCLUDE_ALL_RESOURCES:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
LOCAL_PREBUILT_LIBS:=
LOCAL_PREBUILT_EXECUTABLES:=
@@ -79,6 +80,7 @@
LOCAL_STRIP_MODULE:=
LOCAL_POST_PROCESS_COMMAND:=true
LOCAL_JNI_SHARED_LIBRARIES:=
+LOCAL_JNI_SHARED_LIBRARIES_ABI:=
LOCAL_JAR_MANIFEST:=
LOCAL_INSTRUMENTATION_FOR:=
LOCAL_MANIFEST_INSTRUMENTATION_FOR:=
@@ -92,12 +94,13 @@
LOCAL_NDK_VERSION:=
LOCAL_NO_EMMA_INSTRUMENT:=
LOCAL_NO_EMMA_COMPILE:=
-LOCAL_PROGUARD_ENABLED:= # '',optonly,full,custom
+LOCAL_PROGUARD_ENABLED:= # '',optonly,full,custom,disabled
LOCAL_PROGUARD_FLAGS:=
LOCAL_PROGUARD_FLAG_FILES:=
LOCAL_EMMA_COVERAGE_FILTER:=
LOCAL_WARNINGS_ENABLE:=
LOCAL_MANIFEST_FILE:=
+LOCAL_RENDERSCRIPT_INCLUDES:=
LOCAL_BUILD_HOST_DEX:=
LOCAL_DEX_PREOPT:=
LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,full
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index f7a1756..8b0a6c1 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -44,7 +44,7 @@
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
TARGET_TOOLS_PREFIX := \
- prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
+ prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-
endif
TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
@@ -60,8 +60,7 @@
TARGET_arm_CFLAGS := -O2 \
-fomit-frame-pointer \
-fstrict-aliasing \
- -funswitch-loops \
- -finline-limit=300
+ -funswitch-loops
# Modules can choose to compile some source as thumb. As
# non-thumb enabled targets are supported, this is treated
@@ -71,8 +70,7 @@
TARGET_thumb_CFLAGS := -mthumb \
-Os \
-fomit-frame-pointer \
- -fno-strict-aliasing \
- -finline-limit=64
+ -fno-strict-aliasing
else
TARGET_thumb_CFLAGS := $(TARGET_arm_CFLAGS)
endif
@@ -97,6 +95,7 @@
TARGET_GLOBAL_CFLAGS += \
-msoft-float -fpic \
-ffunction-sections \
+ -fdata-sections \
-funwind-tables \
-fstack-protector \
-Wa,--noexecstack \
@@ -118,6 +117,7 @@
TARGET_GLOBAL_LDFLAGS += \
-Wl,-z,noexecstack \
+ -Wl,--icf=safe \
$(arch_variant_ldflags)
# We only need thumb interworking in cases where thumb support
@@ -132,12 +132,15 @@
TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+# More flags/options can be added here
+ifeq ($(NEED_WORKAROUND_CORTEX_A9_745320),true)
+TARGET_GLOBAL_CFLAGS += -DWORKAROUND_CORTEX_A9_745320
+endif
+
TARGET_RELEASE_CFLAGS := \
-DNDEBUG \
-g \
-Wstrict-aliasing=2 \
- -finline-functions \
- -fno-inline-functions-called-once \
-fgcse-after-reload \
-frerun-cse-after-loop \
-frename-registers
@@ -206,7 +209,7 @@
$(libstdc++_root)/include \
$(KERNEL_HEADERS) \
$(libm_root)/include \
- $(libm_root)/include/arch/arm \
+ $(libm_root)/include/arm \
$(libthread_db_root)/include
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
@@ -276,8 +279,12 @@
$(TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_OBJECTS) \
- $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(call normalize-target-libraries,$(filter-out %libc_nomalloc.a,$(filter-out %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)))) \
+ -Wl,--start-group \
+ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
+ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(TARGET_FDO_LIB) \
$(TARGET_LIBGCC) \
+ -Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(TARGET_CRTEND_O))
endef
diff --git a/core/combo/TARGET_linux-sh.mk b/core/combo/TARGET_linux-sh.mk
index 1fac6a0..05d18d8 100644
--- a/core/combo/TARGET_linux-sh.mk
+++ b/core/combo/TARGET_linux-sh.mk
@@ -99,7 +99,7 @@
$(libstdc++_root)/include \
$(KERNEL_HEADERS) \
$(libm_root)/include \
- $(libm_root)/include/arch/sh \
+ $(libm_root)/include/sh \
$(libthread_db_root)/include
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index d4c04e7..f8c99fb 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -8,7 +8,7 @@
# COMMON_JAVAC -- Java compiler command with common arguments
# Whatever compiler is on this system.
-ifeq ($(HOST_OS), windows)
+ifeq ($(BUILD_OS), windows)
COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
-target 1.5 -Xmaxerrs 9999999
else
diff --git a/core/config.mk b/core/config.mk
index 9b588cf..6cf8f1f 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -61,6 +61,7 @@
BUILD_RAW_EXECUTABLE:= $(BUILD_SYSTEM)/raw_executable.mk
BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk
+BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk
BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk
BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk
BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk
@@ -70,6 +71,8 @@
BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk
BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
BUILD_KEY_CHAR_MAP := $(BUILD_SYSTEM)/key_char_map.mk
+BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
+BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
# ###############################################################
# Parse out any modifier targets.
@@ -214,11 +217,13 @@
MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh
MKEXT2BOOTIMG := external/genext2fs/mkbootimg_ext2.sh
MKTARBALL := build/tools/mktarball.sh
-TUNE2FS := tune2fs
-E2FSCK := e2fsck
+TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
+E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
PROGUARD := external/proguard/bin/proguard.sh
JAVATAGS := build/tools/java-event-log-tags.py
+LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
+LLVM_RS_LINK := $(HOST_OUT_EXECUTABLES)/llvm-rs-link$(HOST_EXECUTABLE_SUFFIX)
DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX)
DEXPREOPT := dalvik/tools/dex-preopt
@@ -268,6 +273,10 @@
HOST_JDK_TOOLS_JAR :=
else
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
+ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
+$(error Error: could not find jdk tools.jar, please install JDK6, \
+ which you can download from java.sun.com)
+endif
endif
# It's called md5 on Mac OS and md5sum on Linux
diff --git a/core/definitions.mk b/core/definitions.mk
index 975b6b5..1f3a446 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -249,6 +249,19 @@
endef
###########################################################
+## Find all of the RenderScript files under the named directories.
+## Meant to be used like:
+## SRC_FILES := $(call all-renderscript-files-under,src)
+###########################################################
+
+define all-renderscript-files-under
+$(patsubst ./%,%, \
+ $(shell cd $(LOCAL_PATH) ; \
+ find $(1) -name "*.rs" -and -not -name ".*") \
+ )
+endef
+
+###########################################################
## Find all of the html files under the named directories.
## Meant to be used like:
## SRC_FILES := $(call all-html-files-under,src tests)
@@ -523,6 +536,30 @@
endef
###########################################################
+## Run rot13 on a string
+## $(1): the string. Must be one line.
+###########################################################
+define rot13
+$(shell echo $(1) | tr 'a-zA-Z' 'n-za-mN-ZA-M')
+endef
+
+
+###########################################################
+## Returns true if $(1) and $(2) are equal. Returns
+## the empty string if they are not equal.
+###########################################################
+define streq
+$(strip $(if $(strip $(1)),\
+ $(if $(strip $(2)),\
+ $(if $(filter-out __,_$(subst $(strip $(1)),,$(strip $(2)))$(subst $(strip $(2)),,$(strip $(1)))_),,true), \
+ ),\
+ $(if $(strip $(2)),\
+ ,\
+ true)\
+ ))
+endef
+
+###########################################################
## Convert "a b c" into "a:b:c"
###########################################################
@@ -735,6 +772,28 @@
rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
endef
+###########################################################
+## Commands to compile RenderScript
+###########################################################
+
+define transform-renderscripts-to-java-and-bc
+@echo "RenderScript: $(PRIVATE_MODULE) <= $(PRIVATE_RS_SOURCE_FILES)"
+$(hide) rm -rf $(PRIVATE_RS_OUTPUT_DIR)
+$(hide) mkdir -p $(PRIVATE_RS_OUTPUT_DIR)/res/raw
+$(hide) mkdir -p $(PRIVATE_RS_OUTPUT_DIR)/src
+$(hide) $(LLVM_RS_CC) \
+ -o $(PRIVATE_RS_OUTPUT_DIR)/res/raw \
+ -p $(PRIVATE_RS_OUTPUT_DIR)/src \
+ -d $(PRIVATE_RS_OUTPUT_DIR) \
+ -a $@ -MD \
+ $(foreach inc,$(PRIVATE_RS_INCLUDES),$(addprefix -I , $(inc))) \
+ $(PRIVATE_RS_SOURCE_FILES)
+#$(hide) $(LLVM_RS_LINK) \
+# $(PRIVATE_RS_OUTPUT_DIR)/res/raw/*.bc
+$(hide) mkdir -p $(dir $@)
+$(hide) touch $@
+endef
+
###########################################################
## Commands for running aidl
@@ -980,6 +1039,24 @@
## Commands for running ar
###########################################################
+define _concat-if-arg2-not-empty
+$(if $(2),$(hide) $(1) $(2))
+endef
+
+# Split long argument list into smaller groups and call the command repeatedly
+#
+# $(1): the command without arguments
+# $(2): the arguments
+define split-long-arguments
+$(call _concat-if-arg2-not-empty,$(1),$(wordlist 1,500,$(2)))
+$(call _concat-if-arg2-not-empty,$(1),$(wordlist 501,1000,$(2)))
+$(call _concat-if-arg2-not-empty,$(1),$(wordlist 1001,1500,$(2)))
+$(call _concat-if-arg2-not-empty,$(1),$(wordlist 1501,2000,$(2)))
+$(call _concat-if-arg2-not-empty,$(1),$(wordlist 2001,2500,$(2)))
+$(call _concat-if-arg2-not-empty,$(1),$(wordlist 2501,3000,$(2)))
+$(call _concat-if-arg2-not-empty,$(1),$(wordlist 3001,99999,$(2)))
+endef
+
define extract-and-include-target-whole-static-libs
$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
$(hide) echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
@@ -1002,8 +1079,7 @@
@rm -f $@
$(extract-and-include-target-whole-static-libs)
@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
-$(hide) echo $(filter %.o, $^) | \
- xargs $(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@
+$(call split-long-arguments,$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^))
endef
###########################################################
@@ -1012,7 +1088,7 @@
define extract-and-include-host-whole-static-libs
$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
- @echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
+ $(hide) echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(lib)))_objs;\
rm -rf $$ldir; \
mkdir -p $$ldir; \
@@ -1032,8 +1108,7 @@
@rm -f $@
$(extract-and-include-host-whole-static-libs)
@echo "host StaticLib: $(PRIVATE_MODULE) ($@)"
-echo $(filter %.o, $^) | \
- xargs $(HOST_AR) $(HOST_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@
+$(call split-long-arguments,$(HOST_AR) $(HOST_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^))
endef
@@ -1264,7 +1339,7 @@
$(addprefix --min-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-code , $(PLATFORM_SDK_VERSION))) \
- $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-name , $(PLATFORM_VERSION))) \
+ $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-name , $(PLATFORM_VERSION)-$(BUILD_NUMBER))) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR))
endef
@@ -1303,7 +1378,12 @@
@$(call emit-line,$(wordlist 3401,3600,$(1)),$(2))
@$(call emit-line,$(wordlist 3601,3800,$(1)),$(2))
@$(call emit-line,$(wordlist 3801,4000,$(1)),$(2))
- @$(if $(wordlist 4001,4002,$(1)),$(error Too many words ($(words $(1)))))
+ @$(call emit-line,$(wordlist 4001,4200,$(1)),$(2))
+ @$(call emit-line,$(wordlist 4201,4400,$(1)),$(2))
+ @$(call emit-line,$(wordlist 4401,4600,$(1)),$(2))
+ @$(call emit-line,$(wordlist 4601,4800,$(1)),$(2))
+ @$(call emit-line,$(wordlist 4801,5000,$(1)),$(2))
+ @$(if $(wordlist 5001,5002,$(1)),$(error Too many words ($(words $(1)))))
endef
# For a list of jar files, unzip them to a specified directory,
@@ -1323,35 +1403,48 @@
done
endef
-# below we write the list of java files to java-source-list to avoid argument
-# list length problems with Cygwin we filter out duplicate java file names
-# because eclipse's compiler doesn't like them.
-define transform-java-to-classes.jar
-@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
+# Common definition to invoke javac on the host and target.
+#
+# Some historical notes:
+# - below we write the list of java files to java-source-list to avoid argument
+# list length problems with Cygwin
+# - we filter out duplicate java file names because eclipse's compiler
+# doesn't like them.
+#
+# $(1): javac
+# $(2): bootclasspath
+define compile-java
$(hide) rm -f $@
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
+$(hide) mkdir -p $(dir $@)
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
-$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES), \
- $(PRIVATE_CLASS_INTERMEDIATES_DIR))
+$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list)
$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list; \
fi
-$(hide) tr ' ' '\n' < $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list \
- | sort -u > $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list-uniq
-$(hide) $(TARGET_JAVAC) -encoding ascii $(PRIVATE_BOOTCLASSPATH) \
+$(hide) tr ' ' '\n' < $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))java-source-list \
+ | sort -u > $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))java-source-list-uniq
+$(hide) $(1) -encoding ascii \
+ $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \
+ $(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
+ $(2) \
$(addprefix -classpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \
- $(PRIVATE_JAVACFLAGS) $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \
- $(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
+ $(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \
-extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
- \@$(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list-uniq \
+ $(PRIVATE_JAVACFLAGS) \
+ \@$(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))java-source-list-uniq \
|| ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 )
$(hide) rm -f $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list
$(hide) rm -f $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list-uniq
-$(hide) mkdir -p $(dir $@)
$(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \
$@ $(PRIVATE_JAR_MANIFEST) -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .
+endef
+
+define transform-java-to-classes.jar
+@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
+$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
endef
@@ -1411,7 +1504,7 @@
$(addprefix --target-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(addprefix --product , $(TARGET_AAPT_CHARACTERISTICS)) \
$(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-code , $(PLATFORM_SDK_VERSION))) \
- $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-name , $(PLATFORM_VERSION))) \
+ $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-name , $(PLATFORM_VERSION)-$(BUILD_NUMBER))) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
-F $@
@@ -1419,8 +1512,8 @@
define add-jni-shared-libs-to-package
$(hide) rm -rf $(dir $@)lib
-$(hide) mkdir -p $(dir $@)lib/$(TARGET_CPU_ABI)
-$(hide) cp $(PRIVATE_JNI_SHARED_LIBRARIES) $(dir $@)lib/$(TARGET_CPU_ABI)
+$(hide) mkdir -p $(dir $@)lib/$(PRIVATE_JNI_SHARED_LIBRARIES_ABI)
+$(hide) cp $(PRIVATE_JNI_SHARED_LIBRARIES) $(dir $@)lib/$(PRIVATE_JNI_SHARED_LIBRARIES_ABI)
$(hide) (cd $(dir $@) && zip -r $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib
endef
@@ -1474,31 +1567,12 @@
# new prebuilt rules to work, we should change this to copy the
# resources to the out directory and then copy the resources.
-# Note: not using aapt tool for this because we aren't making
-# an android package for the host.
+# Note: we intentionally don't clean PRIVATE_CLASS_INTERMEDIATES_DIR
+# in transform-java-to-classes for the sake of vm-tests.
define transform-host-java-to-package
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
-@rm -f $@
-@rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
-@mkdir -p $(dir $@)
-@mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
-$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES), \
- $(PRIVATE_CLASS_INTERMEDIATES_DIR))
-$(call dump-words-to-file,$(sort\
- $(PRIVATE_JAVA_SOURCES)),\
- $(PRIVATE_INTERMEDIATES_DIR)/java-source-list-uniq)
-$(hide) $(HOST_JAVAC) -encoding ascii -g \
- $(PRIVATE_JAVACFLAGS) $(xlint_unchecked) \
- $(addprefix -classpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \
- -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR)\
- \@$(PRIVATE_INTERMEDIATES_DIR)/java-source-list-uniq || \
- ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 )
-$(hide) rm -f $(PRIVATE_INTERMEDIATES_DIR)/java-source-list
-$(hide) rm -f $(PRIVATE_INTERMEDIATES_DIR)/java-source-list-uniq
-$(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \
- $@ $(PRIVATE_JAR_MANIFEST) $(PRIVATE_EXTRA_JAR_ARGS) \
- -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .
+$(call compile-java,$(HOST_JAVAC),)
+$(hide) if [ ! -z "$(PRIVATE_EXTRA_JAR_ARGS)" ]; then jar uf $@ $(PRIVATE_EXTRA_JAR_ARGS); fi
endef
###########################################################
@@ -1561,9 +1635,12 @@
# Copy a single file from one place to another,
# preserving permissions and overwriting any existing
# file.
+# We disable the "-t" option for acp can not handle
+# high resolution timestamp correctly on file systems like ext4.
+# Therefore copy-file-to-target is the same as copy-file-to-new-target.
define copy-file-to-target
@mkdir -p $(dir $@)
-$(hide) $(ACP) -fpt $< $@
+$(hide) $(ACP) -fp $< $@
endef
# The same as copy-file-to-target, but use the local
@@ -1630,7 +1707,7 @@
endef
else
define transform-host-ranlib-copy-hack
-true
+@true
endef
endif
@@ -1640,7 +1717,7 @@
endef
else
define transform-ranlib-copy-hack
-true
+@true
endef
endif
@@ -1652,7 +1729,7 @@
# Command to copy the file with acp, if proguard is disabled.
define proguard-disabled-commands
@echo Copying: $@
-$(hide) $(ACP) $< $@
+$(hide) $(ACP) -fp $< $@
endef
# Command to call Proguard
@@ -1767,7 +1844,6 @@
endef
define add-radio-file-internal
INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(2)
-ALL_PREBUILT += $$(PRODUCT_OUT)/$(2)
$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) | $$(ACP)
$$(transform-prebuilt-to-target)
endef
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 6e0b093..4da2632 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -51,7 +51,7 @@
@echo "Dexpreopt Boot Jar: $$@"
$(hide) rm -f $$@
$(hide) mkdir -p $$(dir $$@)
- $(hide) $(ACP) -fpt $$< $$(PRIVATE_DBJ_JAR)
+ $(hide) $(ACP) -fp $$< $$(PRIVATE_DBJ_JAR)
$$(call dexpreopt-one-file,$$(PRIVATE_DBJ_JAR),$$@)
$(_dbj_jar_no_dex) : $(_dbj_src_jar) | $(ACP) $(AAPT)
@@ -60,6 +60,7 @@
$(eval _dbj_jar :=)
$(eval _dbj_odex :=)
+$(eval _dbj_jar_no_dex :=)
$(eval _dbj_src_jar :=)
endef
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 87576dc..505d127 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -40,11 +40,8 @@
LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)
endif
-ifeq ($(LOCAL_DROIDDOC_TEMPLATE_DIR),)
-LOCAL_DROIDDOC_TEMPLATE_DIR := $(SRC_DROIDDOC_DIR)/templates
-endif
ifeq ($(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR),)
-LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := $(SRC_DROIDDOC_DIR)/templates
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := $(SRC_DROIDDOC_DIR)/$(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
endif
ifeq ($(LOCAL_DROIDDOC_ASSET_DIR),)
@@ -125,26 +122,21 @@
##
droiddoc_templates := \
- $(shell find $(LOCAL_DROIDDOC_TEMPLATE_DIR) -type f) \
$(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f)
droiddoc := \
$(HOST_JDK_TOOLS_JAR) \
- $(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX) \
- $(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
- $(HOST_OUT_SHARED_LIBRARIES)/libclearsilver-jni$(HOST_JNILIB_SUFFIX)
+ $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/apicheck$(COMMON_JAVA_PACKAGE_SUFFIX)
+$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER)
$(full_target): PRIVATE_CURRENT_TIME := -hdf page.now "$(shell date "+%d %b %Y %k:%M")"
-$(full_target): PRIVATE_TEMPLATE_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR)
$(full_target): PRIVATE_CUSTOM_TEMPLATE_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
-$(full_target): PRIVATE_IN_ASSET_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_IN_CUSTOM_ASSET_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
$(full_target): PRIVATE_OUT_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_OUT_CUSTOM_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
ifneq ($(strip $(LOCAL_DROIDDOC_HTML_DIR)),)
-$(full_target): PRIVATE_DROIDDOC_HTML_DIR := $(foreach dir,$(LOCAL_DROIDDOC_HTML_DIR),-htmldir $(dir))
+$(full_target): PRIVATE_DROIDDOC_HTML_DIR := -htmldir $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR)
else
$(full_target): PRIVATE_DROIDDOC_HTML_DIR :=
endif
@@ -160,17 +152,14 @@
$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
$(hide) ( \
- LD_LIBRARY_PATH=$(HOST_OUT_SHARED_LIBRARIES) \
javadoc \
\@$(PRIVATE_SRC_LIST_FILE) \
- -J-Xmx768m \
- -J-Djava.library.path=$(HOST_OUT_SHARED_LIBRARIES) \
+ -J-Xmx1024m \
$(PRIVATE_PROFILING_OPTIONS) \
-quiet \
- -doclet DroidDoc \
+ -doclet com.google.doclava.Doclava \
-docletpath $(PRIVATE_DOCLETPATH) \
-templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
- -templatedir $(PRIVATE_TEMPLATE_DIR) \
$(PRIVATE_DROIDDOC_HTML_DIR) \
$(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
@@ -178,12 +167,6 @@
-d $(PRIVATE_OUT_DIR) \
$(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) \
$(PRIVATE_DROIDDOC_OPTIONS) \
- && rm -rf $(PRIVATE_OUT_ASSET_DIR) \
- && rm -rf $(PRIVATE_OUT_CUSTOM_ASSET_DIR) \
- && mkdir -p $(PRIVATE_OUT_ASSET_DIR) \
- && mkdir -p $(PRIVATE_OUT_CUSTOM_ASSET_DIR) \
- && cp -fr $(PRIVATE_IN_ASSET_DIR)/* $(PRIVATE_OUT_ASSET_DIR)/ \
- && cp -fr $(PRIVATE_IN_CUSTOM_ASSET_DIR)/* $(PRIVATE_OUT_CUSTOM_ASSET_DIR)/ \
&& touch -f $@ \
) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
@@ -204,7 +187,7 @@
javadoc \
$(PRIVATE_DROIDDOC_OPTIONS) \
\@$(PRIVATE_SRC_LIST_FILE) \
- -J-Xmx768m \
+ -J-Xmx1024m \
$(PRIVATE_PROFILING_OPTIONS) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
-sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
@@ -227,6 +210,8 @@
.PHONY: $(LOCAL_MODULE)-docs
$(LOCAL_MODULE)-docs : $(full_target)
+ifeq ($(strip $(LOCAL_UNINSTALLABLE_MODULE)),)
+
# Define a rule to create a zip of these docs.
out_zip := $(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip
$(out_zip): PRIVATE_DOCS_DIR := $(out_dir)
@@ -237,3 +222,5 @@
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rq $$F * )
$(call dist-for-goals,docs,$(out_zip))
+
+endif
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index 0c58559..c94d943 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -9,7 +9,7 @@
ABP:=$(ABP):$(TARGET_OUT_EXECUTABLES)
else
# this should be copied to HOST_OUT_EXECUTABLES instead
- ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.4.3/bin
+ ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin
endif
ANDROID_BUILD_PATHS := $(ABP)
ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index e4c99d5..800a9bf 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -230,6 +230,7 @@
TARGET_OUT_ETC := $(TARGET_OUT)/etc
TARGET_OUT_STATIC_LIBRARIES:= $(TARGET_OUT_INTERMEDIATES)/lib
TARGET_OUT_NOTICE_FILES:=$(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
+TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
TARGET_OUT_DATA := $(PRODUCT_OUT)/data
TARGET_OUT_DATA_EXECUTABLES:= $(TARGET_OUT_EXECUTABLES)
@@ -240,6 +241,7 @@
TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)
TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)
TARGET_OUT_DATA_STATIC_LIBRARIES:= $(TARGET_OUT_STATIC_LIBRARIES)
+TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
diff --git a/core/find-jdk-tools-jar.sh b/core/find-jdk-tools-jar.sh
index f555576..ed0b127 100755
--- a/core/find-jdk-tools-jar.sh
+++ b/core/find-jdk-tools-jar.sh
@@ -3,8 +3,7 @@
else
JAVAC=$(which javac)
if [ -z "$JAVAC" ] ; then
- echo "Please-install-JDK-6,-which-you-can-download-from-java.sun.com"
- exit 1
+ exit 1
fi
while [ -L $JAVAC ] ; do
LSLINE=$(ls -l $JAVAC)
diff --git a/core/help.mk b/core/help.mk
new file mode 100644
index 0000000..9e37f82
--- /dev/null
+++ b/core/help.mk
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ifeq ($(MAKECMDGOALS),help)
+dont_bother := true
+endif
+ifeq ($(MAKECMDGOALS),out)
+dont_bother := true
+endif
+
+.PHONY: help
+help:
+ @echo
+ @echo "Common make targets:"
+ @echo "----------------------------------------------------------------------------------"
+ @echo "droid Default target"
+ @echo "clean (aka clobber) equivalent to rm -rf out/"
+ @echo "snod Quickly rebuild the system image from built packages"
+ @echo "offline-sdk-docs Generate the HTML for the developer SDK docs"
+ @echo "doc-comment-check-docs Check HTML doc links & validity, without generating HTML"
+ @echo "libandroid_runtime All the JNI framework stuff"
+ @echo "framework All the java framework stuff"
+ @echo "services The system server (Java) and friends"
+ @echo "help You're reading it right now"
+
+.PHONY: out
+out:
+ @echo "I'm sure you're nice and all, but no thanks."
+
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 27174f2..322d10f 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -27,10 +27,14 @@
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
+full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
+full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_jar := $(intermediates.COMMON)/classes.jar
built_dex := $(intermediates.COMMON)/classes.dex
LOCAL_INTERMEDIATE_TARGETS += \
+ $(full_classes_compiled_jar) \
+ $(full_classes_jarjar_jar) \
$(full_classes_jar) \
$(built_dex)
@@ -47,10 +51,26 @@
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
-$(full_classes_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
-$(full_classes_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) $(jar_manifest_file)
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
+$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) $(jar_manifest_file)
$(transform-host-java-to-package)
+# Run jarjar if necessary, otherwise just copy the file.
+ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
+$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(JARJAR)
+ @echo JarJar: $@
+ $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+else
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+endif
+
+$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
$(built_dex): $(full_classes_jar) $(DX)
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
new file mode 100644
index 0000000..2a77f1e
--- /dev/null
+++ b/core/host_native_test.mk
@@ -0,0 +1,14 @@
+################################################
+## A thin wrapper around BUILD_HOST_EXECUTABLE
+## Common flags for host native tests are added.
+################################################
+
+LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
+LOCAL_C_INCLUDES += \
+ bionic/libstdc++/include \
+ external/gtest/include \
+ external/astl/include
+LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host libastl_host
+LOCAL_SHARED_LIBRARIES +=
+
+include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/java.mk b/core/java.mk
index 35b0343..949af3c 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -88,7 +88,7 @@
ifdef LOCAL_PROGUARD_ENABLED
proguard_jar_leaf := proguard.classes.jar
built_dex_intermediate_leaf := proguard.$(built_dex_intermediate_leaf)
-built_dex_leaf := progaurd.classes.dex
+built_dex_leaf := proguard.classes.dex
else
proguard_jar_leaf := noproguard.classes.jar
built_dex_intermediate_leaf := noproguard.$(built_dex_intermediate_leaf)
@@ -123,6 +123,42 @@
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
+###############################################################
+## .rs files: RenderScript sources to .java files and .bc files
+###############################################################
+renderscript_sources := $(filter %.rs,$(LOCAL_SRC_FILES))
+# Because names of the java files from RenderScript are unknown until the
+# .rs file(s) are compiled, we have to depend on a timestamp file.
+RenderScript_file_stamp :=
+ifneq ($(renderscript_sources),)
+renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
+RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
+renderscript_intermediate := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript
+
+# prepend the RenderScript system include path
+LOCAL_RENDERSCRIPT_INCLUDES := \
+ $(TOPDIR)external/clang/lib/Headers \
+ $(TOPDIR)frameworks/base/libs/rs/scriptc \
+ $(LOCAL_RENDERSCRIPT_INCLUDES)
+
+$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
+$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
+# By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
+# automatically found by the java compiling function transform-java-to-classes.jar.
+$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
+$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LLVM_RS_CC) $(LLVM_RS_LINK)
+ $(transform-renderscripts-to-java-and-bc)
+
+# include the dependency files (.d) generated by llvm-rs-cc.
+renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
+ $(patsubst %.rs,%.d, $(notdir $(renderscript_sources))))
+-include $(renderscript_generated_dep_files)
+
+LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
+# Make sure the generated resource will be added to the apk.
+LOCAL_RESOURCE_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript/res $(LOCAL_RESOURCE_DIR)
+endif
+
# TODO: It looks like the only thing we need from base_rules is
# all_java_sources. See if we can get that by adding a
# common_java.mk, and moving the include of base_rules.mk to
@@ -201,7 +237,7 @@
else
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
@echo Copying: $@
- $(hide) $(ACP) $< $@
+ $(hide) $(ACP) -fp $< $@
endif
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
@@ -239,7 +275,7 @@
# Keep a copy of the jar just before proguard processing.
$(full_classes_jar): $(full_classes_emma_jar) | $(ACP)
@echo Copying: $@
- $(hide) $(ACP) $< $@
+ $(hide) $(ACP) -fp $< $@
# Run proguard if necessary, otherwise just copy the file.
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
@@ -301,7 +337,7 @@
$(transform-classes.jar-to-dex)
$(built_dex): $(built_dex_intermediate) | $(ACP)
@echo Copying: $@
- $(hide) $(ACP) $< $@
+ $(hide) $(ACP) -fp $< $@
ifneq ($(GENERATE_DEX_DEBUG),)
$(install-dex-debug)
endif
diff --git a/core/java_library.mk b/core/java_library.mk
index abc4728..dbf6981 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -30,10 +30,12 @@
LOCAL_INTERMEDIATE_TARGETS += $(common_javalib.jar)
ifeq (true,$(WITH_DEXPREOPT))
+ifeq (,$(TARGET_BUILD_APPS))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
+endif
#################################
include $(BUILD_SYSTEM)/java.mk
diff --git a/core/legacy_prebuilts.mk b/core/legacy_prebuilts.mk
new file mode 100644
index 0000000..6a999c1
--- /dev/null
+++ b/core/legacy_prebuilts.mk
@@ -0,0 +1,127 @@
+#
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is the list of modules grandfathered to use ALL_PREBUILT
+
+# DO NOT ADD ANY NEW MODULE TO THIS FILE
+#
+# ALL_PREBUILT modules are hard to control and audit and we don't want
+# to add any new such module in the system
+
+GRANDFATHERED_ALL_PREBUILT := \
+ akmd2 \
+ am \
+ ap_gain.bin \
+ audio.conf \
+ auto_pairing.conf \
+ AVRCP.kl \
+ baseline11k.par \
+ baseline8k.par \
+ baseline.par \
+ basic.ok \
+ batch \
+ bitmap_size.txt \
+ blacklist.conf \
+ bmgr \
+ boolean.g2g \
+ bp.img \
+ brcm_guci_drv \
+ bypassfactory \
+ cacerts.bks \
+ cdt.bin \
+ chat-ril \
+ cmu6plus.ok.zip \
+ cpcap-key.kl \
+ data \
+ dbus.conf \
+ dev \
+ egl.cfg \
+ enroll.ok \
+ en-US-ttp.data \
+ firmware_error.565 \
+ firmware_install.565 \
+ ftmipcd \
+ generic11_f.swimdl \
+ generic11.lda \
+ generic11_m.swimdl \
+ generic8_f.swimdl \
+ generic8.lda \
+ generic8_m.swimdl \
+ generic.swiarb \
+ gps.conf \
+ gpsconfig.xml \
+ gps.stingray.so \
+ gralloc.omap3.so \
+ gralloc.tegra.so \
+ hosts \
+ hwcomposer.tegra.so \
+ ime \
+ init.goldfish.rc \
+ init.goldfish.sh \
+ init.olympus.rc \
+ init.rc \
+ init.sholes.rc \
+ init.stingray.rc \
+ input \
+ input.conf \
+ kernel \
+ lbl \
+ libEGL_POWERVR_SGX530_121.so \
+ libEGL_tegra.so \
+ libGLESv1_CM_POWERVR_SGX530_121.so \
+ libGLESv1_CM_tegra.so \
+ libGLESv2_POWERVR_SGX530_121.so \
+ libGLESv2_tegra.so \
+ libmdmctrl.a \
+ libmoto_ril.so \
+ libpppd_plugin-ril.so \
+ libril_rds.so \
+ location \
+ location.cfg \
+ main.conf \
+ mbm.bin \
+ mbm_consumer.bin \
+ mdm_panicd \
+ monkey \
+ network.conf \
+ phone_type_choice.g2g \
+ pm \
+ pppd-ril \
+ pppd-ril.options \
+ proc \
+ qwerty.kl \
+ radio.img \
+ rdl.bin \
+ RFFspeed_501.bmd \
+ RFFstd_501.bmd \
+ savebpver \
+ sbin \
+ sholes-keypad.kl \
+ suplcerts.bks \
+ svc \
+ sys \
+ system \
+ tcmd \
+ ueventd.goldfish.rc \
+ ueventd.olympus.rc \
+ ueventd.rc \
+ ueventd.stingray.rc \
+ VoiceDialer.g2g \
+ vold.fstab \
+ wl1271.bin \
+ zoneinfo.dat \
+ zoneinfo.idx \
+ zoneinfo.version
diff --git a/core/main.mk b/core/main.mk
index 3877bb2..6c53b8a 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -54,6 +54,9 @@
.PHONY: FORCE
FORCE:
+# Targets that provide quick help on the build system.
+include $(BUILD_SYSTEM)/help.mk
+
# Set up various standard variables based on configuration
# and host information.
include $(BUILD_SYSTEM)/config.mk
@@ -394,13 +397,16 @@
development/host \
development/tools/etc1tool \
development/tools/line_endings \
+ external/clang \
external/easymock \
external/expat \
external/libpng \
+ external/llvm \
external/qemu \
external/sqlite/dist \
external/zlib \
frameworks/base \
+ frameworks/compile \
sdk/emulator/mksdcard \
sdk/sdklauncher \
system/core/adb \
@@ -451,7 +457,6 @@
bionic \
system/core \
system/extras/ext4_utils \
- system/extras/su \
build/libs \
build/target \
build/tools/acp \
@@ -475,6 +480,13 @@
endif # !SDK_ONLY
+# Before we go and include all of the module makefiles, stash away
+# the PRODUCT_* values so that later we can verify they are not modified.
+stash_product_vars:=true
+ifeq ($(stash_product_vars),true)
+ $(call stash-product-vars, __STASHED)
+endif
+
ifneq ($(ONE_SHOT_MAKEFILE),)
# We've probably been invoked by the "mm" shell function
# with a subdirectory's makefile.
@@ -505,6 +517,26 @@
include $(subdir_makefiles)
endif # ONE_SHOT_MAKEFILE
+ifeq ($(stash_product_vars),true)
+ $(call assert-product-vars, __STASHED)
+endif
+
+include $(BUILD_SYSTEM)/legacy_prebuilts.mk
+ifneq ($(filter-out $(GRANDFATHERED_ALL_PREBUILT),$(strip $(notdir $(ALL_PREBUILT)))),)
+ $(warning *** Some files have been added to ALL_PREBUILT.)
+ $(warning *)
+ $(warning * ALL_PREBUILT is a deprecated mechanism that)
+ $(warning * should not be used for new files.)
+ $(warning * As an alternative, use PRODUCT_COPY_FILES in)
+ $(warning * the appropriate product definition.)
+ $(warning * build/target/product/core.mk is the product)
+ $(warning * definition used in all products.)
+ $(warning *)
+ $(foreach bad_prebuilt,$(filter-out $(GRANDFATHERED_ALL_PREBUILT),$(strip $(notdir $(ALL_PREBUILT)))),$(warning * unexpected $(bad_prebuilt) in ALL_PREBUILT))
+ $(warning *)
+ $(error ALL_PREBUILT contains unexpected files)
+endif
+
# -------------------------------------------------------------------
# All module makefiles have been included at this point.
# -------------------------------------------------------------------
@@ -551,6 +583,7 @@
)
m :=
r :=
+i :=
add-required-deps :=
# -------------------------------------------------------------------
@@ -688,6 +721,10 @@
.PHONY: userdataimage
userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
+ifneq (,$(filter userdataimage, $(MAKECMDGOALS)))
+$(call dist-for-goals, userdataimage, $(BUILT_USERDATAIMAGE_TARGET))
+endif
+
.PHONY: userdatatarball
userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
@@ -707,12 +744,15 @@
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_FILES_FILE)
+# dist_files only for putting your library into the dist directory with a full build.
+.PHONY: dist_files
+
ifeq ($(EMMA_INSTRUMENT),true)
- $(call dist-for-goals, droid, $(EMMA_META_ZIP))
+ $(call dist-for-goals, dist_files, $(EMMA_META_ZIP))
endif
-# dist_libraries only for putting your library into the dist directory with a full build.
-.PHONY: dist_libraries
+# Dist for droid if droid is among the cmd goals, or no cmd goal is given.
+ifneq ($(filter droid,$(MAKECMDGOALS))$(filter ||,|$(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))|),)
ifneq ($(TARGET_BUILD_APPS),)
# If this build is just for apps, only build apps and not the full system by default.
@@ -751,9 +791,10 @@
)
# Building a full system-- the default is to build droidcore
-droid: droidcore dist_libraries
+droid: droidcore dist_files
-endif
+endif # TARGET_BUILD_APPS
+endif # droid in $(MAKECMDGOALS)
.PHONY: droid tests
@@ -769,10 +810,26 @@
.PHONY: sdk
ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
sdk: $(ALL_SDK_TARGETS)
+ifneq ($(filter sdk,$(MAKECMDGOALS)),)
$(call dist-for-goals,sdk, \
$(ALL_SDK_TARGETS) \
$(SYMBOLS_ZIP) \
)
+endif
+
+.PHONY: samplecode
+sample_MODULES := $(sort $(call get-tagged-modules,samples))
+sample_APKS_DEST_PATH := $(TARGET_COMMON_OUT_ROOT)/samples
+sample_APKS_COLLECTION := \
+ $(foreach module,$(sample_MODULES),$(sample_APKS_DEST_PATH)/$(notdir $(module)))
+$(foreach module,$(sample_MODULES),$(eval $(call \
+ copy-one-file,$(module),$(sample_APKS_DEST_PATH)/$(notdir $(module)))))
+sample_ADDITIONAL_INSTALLED := \
+ $(filter-out $(modules_to_install) $(modules_to_check) $(ALL_PREBUILT),$(sample_MODULES))
+samplecode: $(sample_APKS_COLLECTION)
+ @echo "Collect sample code apks: $^"
+ # remove apks that are not intended to be installed.
+ rm -f $(sample_ADDITIONAL_INSTALLED)
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
diff --git a/core/native_test.mk b/core/native_test.mk
new file mode 100644
index 0000000..3253a5e
--- /dev/null
+++ b/core/native_test.mk
@@ -0,0 +1,18 @@
+###########################################
+## A thin wrapper around BUILD_EXECUTABLE
+## Common flags for native tests are added.
+###########################################
+
+LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
+LOCAL_C_INCLUDES += bionic \
+ bionic/libstdc++/include \
+ external/gtest/include \
+ external/stlport/stlport
+LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
+LOCAL_SHARED_LIBRARIES += libstlport
+
+ifndef LOCAL_MODULE_PATH
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+endif
+
+include $(BUILD_EXECUTABLE)
diff --git a/core/package.mk b/core/package.mk
index 6834995..57d6f4b 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -76,8 +76,6 @@
LOCAL_MODULE_TAGS := optional
endif
-#$(warning $(LOCAL_PATH) $(LOCAL_PACKAGE_NAME) $(sort $(LOCAL_MODULE_TAGS)))
-
ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
# Force localization check if it's not tagged as tests.
LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
@@ -97,11 +95,6 @@
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
$(LOCAL_RESOURCE_DIR)
-# this is an app, so add the system libraries to the search path
-LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
-
-#$(warning Finding assets for $(LOCAL_ASSET_DIR))
-
all_assets := $(call find-subdir-assets,$(LOCAL_ASSET_DIR))
all_assets := $(addprefix $(LOCAL_ASSET_DIR)/,$(patsubst assets/%,%,$(all_assets)))
@@ -155,12 +148,14 @@
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
ifeq (true,$(WITH_DEXPREOPT))
+ifeq (,$(TARGET_BUILD_APPS))
ifneq (,$(LOCAL_SRC_FILES))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
endif
+endif
# The dex files go in the package, so we don't
# want to install them separately for this module.
@@ -195,21 +190,19 @@
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
$(intermediates.COMMON)/public_resources.xml
$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
-$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(AAPT) | $(ACP)
+$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
@rm -f $@
$(create-resource-java-files)
$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
-name Manifest.java 2> /dev/null`; do \
- dir=`grep package $$GENERATED_MANIFEST_FILE | head -n1 | \
- awk '{print $$2}' | tr -d ";" | tr . /`; \
+ dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
$(ACP) -fpt $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
done;
$(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
-name R.java 2> /dev/null`; do \
- dir=`grep package $$GENERATED_R_FILE | head -n1 | \
- awk '{print $$2}' | tr -d ";" | tr . /`; \
+ dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
$(ACP) -fpt $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|| exit 31; \
@@ -228,7 +221,7 @@
# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
# can't know anything about PRODUCT. Clear it out just for this target.
$(resource_export_package): PRODUCT_AAPT_CONFIG :=
-$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(AAPT)
+$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-assets-to-package)
@@ -290,6 +283,16 @@
$(addsuffix $(so_suffix), \
$(LOCAL_JNI_SHARED_LIBRARIES)))
+# Set the abi directory used by the local JNI shared libraries.
+# (Doesn't change how the local shared libraries are compiled, just
+# sets where they are stored in the apk.)
+
+ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
+ jni_shared_libraries_abi := $(TARGET_CPU_ABI)
+else
+ jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
+endif
+
# Pick a key to sign the package with. If this package hasn't specified
# an explicit certificate, use the default.
# Secure release builds will have their packages signed after the fact,
@@ -327,8 +330,12 @@
$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT)
endif
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
+$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi)
ifneq ($(TARGET_BUILD_APPS),)
# Include all resources for unbundled apps.
+ LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
+endif
+ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true)
$(LOCAL_BUILT_MODULE): PRODUCT_AAPT_CONFIG :=
endif
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
diff --git a/core/pathmap.mk b/core/pathmap.mk
index fe7ba1a..428594f 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -89,6 +89,7 @@
wifi \
vpn \
keystore \
+ icu4j \
voip \
)
diff --git a/core/phony_package.mk b/core/phony_package.mk
new file mode 100644
index 0000000..3644db8
--- /dev/null
+++ b/core/phony_package.mk
@@ -0,0 +1,17 @@
+ifneq ($(strip $(LOCAL_SRC_FILES)),)
+$(error LOCAL_SRC_FILES are not allowed for phony packages)
+endif
+
+ifeq ($(strip $(LOCAL_REQUIRED_MODULES)),)
+$(error LOCAL_REQUIRED_MODULES is required for phony packages)
+endif
+
+LOCAL_MODULE_CLASS := FAKE
+LOCAL_MODULE_SUFFIX := -timestamp
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE):
+ $(hide) echo "Fake: $@"
+ $(hide) mkdir -p $(dir $@)
+ $(hide) touch $@
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index b4717e0..f5eebc8 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -45,10 +45,20 @@
ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
# while the deps should be in the common dir, so we make a copy in the common dir.
-common_library_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/$(notdir $(LOCAL_BUILT_MODULE))
-$(common_library_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
+# For nonstatic library, $(common_javalib_jar) is the dependency file,
+# while $(common_classes_jar) is used to link.
+common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
+common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
+
+$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
$(transform-prebuilt-to-target)
-endif
+
+$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
+ $(transform-prebuilt-to-target)
+
+# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
+$(LOCAL_BUILT_MODULE) : $(common_javalib_jar)
+endif # TARGET JAVA_LIBRARIES
ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
# The magic string "EXTERNAL" means this package will be signed with
diff --git a/core/prelink-linux-arm.map b/core/prelink-linux-arm.map
index 7daaf98..86cec55 100644
--- a/core/prelink-linux-arm.map
+++ b/core/prelink-linux-arm.map
@@ -19,27 +19,29 @@
#
# note: look at the LOAD sections in the library header:
#
-# arm-eabi-objdump -x <lib>
+# arm-linux-androideabi-objdump -x <lib>
#
# core system libraries
-libdl.so 0xAFF00000 # [<64K]
-libc.so 0xAFD00000 # [~2M]
-libstdc++.so 0xAFC00000 # [<64K]
-libm.so 0xAFB00000 # [~1M]
-liblog.so 0xAFA00000 # [<64K]
-libcutils.so 0xAF900000 # [~1M]
-libthread_db.so 0xAF800000 # [<64K]
-libz.so 0xAF700000 # [~1M]
-libevent.so 0xAF600000 # [???]
-libssl.so 0xAF400000 # [~2M]
-libcrypto.so 0xAF000000 # [~4M]
-libsysutils.so 0xAEF00000 # [~1M]
+libdl.so 0xB0100000 # [<64K]
+libc.so 0xAFF00000 # [~2M]
+libstdc++.so 0xAFE00000 # [<64K]
+libm.so 0xAFD00000 # [~1M]
+liblog.so 0xAFC00000 # [<64K]
+libcutils.so 0xAFB00000 # [~1M]
+libthread_db.so 0xAFA00000 # [<64K]
+libz.so 0xAF900000 # [~1M]
+libevent.so 0xAF800000 # [???]
+libssl.so 0xAF600000 # [~2M]
+libcrypto.so 0xAF200000 # [~4M]
+libsysutils.so 0xAF100000 # [~1M]
# bluetooth
-liba2dp.so 0xAEE00000 # [~1M]
-audio.so 0xAED00000 # [~1M]
-input.so 0xAEC00000 # [~1M]
+liba2dp.so 0xAF000000 # [~1M]
+input.so 0xAEF00000 # [~1M]
+audio.so 0xAEE00000 # [~1M]
+libglib.so 0xAED00000 # [~1M]
+network.so 0xAEC00000 # [~1M]
libbluetoothd.so 0xAEA00000 # [~2M]
libbluedroid.so 0xAE900000 # [<64K]
libbluetooth.so 0xAE800000 # [~1M]
@@ -110,75 +112,78 @@
# assorted system libraries
libsqlite.so 0xA8B00000 # [~2M]
libexpat.so 0xA8A00000 # [~1M]
-libwebcore.so 0xA8300000 # [~7M]
-libbinder.so 0xA8200000 # [~1M]
-libutils.so 0xA8100000 # [~1M]
-libcameraservice.so 0xA8000000 # [~1M]
-libhardware.so 0xA7F00000 # [<64K]
-libhardware_legacy.so 0xA7E00000 # [~1M]
-libapp_process.so 0xA7D00000 # [???]
-libsystem_server.so 0xA7C00000 # [~1M]
-libime.so 0xA7B00000 # [???]
-libgps.so 0xA7A00000 # [~1M]
-libcamera.so 0xA7900000 # [~1M]
-liboemcamera.so 0xA7700000 # [~2M]
-libdiskconfig.so 0xA7600000 # [<64K]
-libemoji.so 0xA7500000 # [<64K]
-libjni_latinime.so 0xA7400000 # [~1M]
-libjni_pinyinime.so 0xA7300000 # [~1M]
-libttssynthproxy.so 0xA7200000 # [~1M] for frameworks/base
-libttspico.so 0xA7000000 # [~2M] for external/svox
+libwebcore.so 0xA8200000 # [~8M]
+libbinder.so 0xA8100000 # [~1M]
+libutils.so 0xA8000000 # [~1M]
+libcameraservice.so 0xA7F00000 # [~1M]
+libhardware.so 0xA7E00000 # [<64K]
+libhardware_legacy.so 0xA7D00000 # [~1M]
+libapp_process.so 0xA7C00000 # [???]
+libsystem_server.so 0xA7B00000 # [~1M]
+libime.so 0xA7A00000 # [???]
+libgps.so 0xA7900000 # [~1M]
+libcamera.so 0xA7800000 # [~1M]
+liboemcamera.so 0xA7600000 # [~2M]
+libdiskconfig.so 0xA7500000 # [<64K]
+libemoji.so 0xA7400000 # [<64K]
+libjni_latinime.so 0xA7300000 # [~1M]
+libjni_pinyinime.so 0xA7200000 # [~1M]
+libttssynthproxy.so 0xA7100000 # [~1M] for frameworks/base
+libttspico.so 0xA6F00000 # [~2M] for external/svox
+libmtp.so 0xA6E00000 # [~1M]
+libusbhost.so 0xA6D00000 # [<64K]
+libinput.so 0xA6C00000 # [~1M]
# pv libraries
-libpvasf.so 0xA6F00000 # [???]
-libpvasfreg.so 0xA6E00000 # [???]
-libomx_sharedlibrary.so 0xA6D00000 # [~1M]
-libopencore_download.so 0xA6C00000 # [~1M]
-libopencore_downloadreg.so 0xA6B00000 # [~1M]
-libopencore_net_support.so 0xA6800000 # [~3M]
-libopencore_rtsp.so 0xA6200000 # [~6M]
-libopencore_rtspreg.so 0xA6100000 # [~1M]
-libopencore_author.so 0xA5D00000 # [~4M]
-libomx_aacdec_sharedlibrary.so 0xA5B00000 # [~2M]
-libomx_amrdec_sharedlibrary.so 0xA5A00000 # [~1M]
-libomx_amrenc_sharedlibrary.so 0xA5900000 # [~1M]
-libomx_avcdec_sharedlibrary.so 0xA5800000 # [~1M]
-libomx_avcenc_sharedlibrary.so 0xA5700000 # [???]
-libomx_m4vdec_sharedlibrary.so 0xA5600000 # [~1M]
-libomx_m4venc_sharedlibrary.so 0xA5500000 # [???]
-libomx_mp3dec_sharedlibrary.so 0xA5400000 # [~1M]
-libopencore_mp4local.so 0xA5200000 # [~2M]
-libopencore_mp4localreg.so 0xA5100000 # [~1M]
-libopencore_player.so 0xA4800000 # [~9M]
+libpvasf.so 0xA6B00000 # [???]
+libpvasfreg.so 0xA6A00000 # [???]
+libomx_sharedlibrary.so 0xA6900000 # [~1M]
+libopencore_download.so 0xA6800000 # [~1M]
+libopencore_downloadreg.so 0xA6700000 # [~1M]
+libopencore_net_support.so 0xA6400000 # [~3M]
+libopencore_rtsp.so 0xA5E00000 # [~6M]
+libopencore_rtspreg.so 0xA5D00000 # [~1M]
+libopencore_author.so 0xA5900000 # [~4M]
+libomx_aacdec_sharedlibrary.so 0xA5700000 # [~2M]
+libomx_amrdec_sharedlibrary.so 0xA5600000 # [~1M]
+libomx_amrenc_sharedlibrary.so 0xA5500000 # [~1M]
+libomx_avcdec_sharedlibrary.so 0xA5400000 # [~1M]
+libomx_avcenc_sharedlibrary.so 0xA5300000 # [???]
+libomx_m4vdec_sharedlibrary.so 0xA5200000 # [~1M]
+libomx_m4venc_sharedlibrary.so 0xA5100000 # [???]
+libomx_mp3dec_sharedlibrary.so 0xA5000000 # [~1M]
+libopencore_mp4local.so 0xA4E00000 # [~2M]
+libopencore_mp4localreg.so 0xA4D00000 # [~1M]
+libopencore_player.so 0xA4400000 # [~9M]
# opencore hardware support
-libmm-adspsvc.so 0xA4700000 # [<64K]
-libOmxCore.so 0xA4600000 # [<64K]
-libOmxMpeg4Dec.so 0xA4500000 # [~1M]
-libOmxH264Dec.so 0xA4400000 # [~1M]
-libOmxVidEnc.so 0xA4300000 # [~1M]
-libopencorehw.so 0xA4200000 # [~1M]
-libOmxVdec.so 0xA4100000 # [~1M]
-libmm-omxcore.so 0xA4000000 # [<64K]
+libmm-adspsvc.so 0xA4300000 # [<64K]
+libOmxCore.so 0xA4200000 # [<64K]
+libOmxMpeg4Dec.so 0xA4100000 # [~1M]
+libOmxH264Dec.so 0xA4000000 # [~1M]
+libOmxVidEnc.so 0xA3F00000 # [~1M]
+libopencorehw.so 0xA3E00000 # [~1M]
+libOmxVdec.so 0xA3D00000 # [~1M]
+libmm-omxcore.so 0xA3C00000 # [<64K]
# pv libraries
-libopencore_common.so 0xA3900000 # [~7M]
-libqcomm_omx.so 0xA3800000 # [<64K]
+libopencore_common.so 0xA3500000 # [~7M]
+libqcomm_omx.so 0xA3400000 # [<64K]
# stagefright libraries
-libstagefright_amrnb_common.so 0xA3700000 # [~1M]
-libstagefright_avc_common.so 0xA3600000 # [~1M]
-libstagefright_color_conversion.so 0xA3500000 # [<64K]
-libstagefright_omx.so 0xA3400000 # [~1M]
-libstagefrighthw.so 0xA3300000 # [~1M]
-libstagefright.so 0xA2F00000 # [~4M]
+libstagefright_amrnb_common.so 0xA3300000 # [~1M]
+libstagefright_avc_common.so 0xA3200000 # [~1M]
+libstagefright_color_conversion.so 0xA3100000 # [<64K]
+libstagefright_omx.so 0xA3000000 # [~1M]
+libstagefrighthw.so 0xA2F00000 # [~1M]
+libstagefright.so 0xA2B00000 # [~4M]
# libraries for specific hardware
-libgsl.so 0xA2E00000 # [~1M]
-libhtc_acoustic.so 0xA2D00000 # [<64K]
-libhtc_ril.so 0xA2C00000 # [~1M]
-liblvmxipc.so 0xA2B00000 # [~1M] for vendor/nxp
-libreference-cdma-sms.so 0xA2A00000 # [<64K] for hardware/ril
+libgsl.so 0xA2A00000 # [~1M]
+libhtc_acoustic.so 0xA2900000 # [<64K]
+libhtc_ril.so 0xA2800000 # [~1M]
+liblvmxipc.so 0xA2700000 # [~1M] for vendor/nxp
+libreference-cdma-sms.so 0xA2600000 # [<64K] for hardware/ril
# libraries for specific apps or temporary libraries
libcam_ipl.so 0x9F000000 # [???]
@@ -211,3 +216,5 @@
libzxing.so 0x9D000000 # [<64K] for goggles
libinterstitial.so 0x9CF00000 # [<64K] for goggles
liblept.so 0x9CA00000 # [~5M] for external/leptonica
+libbcc.so 0x9C600000 # [~4M] for external/llvm
+libchromium_net.so 0x9C400000 # [~2M] for exteral/webkit
diff --git a/core/product.mk b/core/product.mk
index 4a0ee01..249582b 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -187,3 +187,73 @@
define resolve-short-product-name
$(strip $(call _resolve-short-product-name,$(1)))
endef
+
+
+_product_stash_var_list := $(_product_var_list) \
+ TARGET_ARCH \
+ TARGET_ARCH_VARIANT \
+ TARGET_BOARD_PLATFORM \
+ TARGET_BOARD_PLATFORM_GPU \
+ TARGET_BOOTLOADER_BOARD_NAME \
+ TARGET_COMPRESS_MODULE_SYMBOLS \
+ TARGET_PRELINK_MODULE \
+ TARGET_NO_BOOTLOADER \
+ TARGET_NO_KERNEL \
+ TARGET_NO_RECOVERY \
+ TARGET_NO_RADIOIMAGE \
+ TARGET_HARDWARE_3D \
+ TARGET_PROVIDES_INIT_RC \
+ TARGET_CPU_ABI \
+ TARGET_CPU_ABI2 \
+ TARGET_CPU_SMP \
+
+
+_product_stash_var_list += \
+ BOARD_WPA_SUPPLICANT_DRIVER \
+ BOARD_WLAN_DEVICE \
+ BOARD_USES_GENERIC_AUDIO \
+ BOARD_KERNEL_CMDLINE \
+ BOARD_KERNEL_BASE \
+ BOARD_HAVE_BLUETOOTH \
+ BOARD_HAVE_BLUETOOTH_BCM \
+ BOARD_VENDOR_QCOM_AMSS_VERSION \
+ BOARD_VENDOR_USE_AKMD \
+ BOARD_EGL_CFG \
+ BOARD_BOOTIMAGE_PARTITION_SIZE \
+ BOARD_RECOVERYIMAGE_PARTITION_SIZE \
+ BOARD_SYSTEMIMAGE_PARTITION_SIZE \
+ BOARD_USERDATAIMAGE_PARTITION_SIZE \
+ BOARD_FLASH_BLOCK_SIZE \
+ BOARD_SYSTEMIMAGE_PARTITION_SIZE \
+ BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE \
+ BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION \
+ BOARD_INSTALLER_CMDLINE \
+
+
+#
+# Stash vaues of the variables in _product_stash_var_list.
+# $(1): Renamed prefix
+#
+define stash-product-vars
+$(foreach v,$(_product_stash_var_list), \
+ $(eval $(strip $(1))_$(call rot13,$(v)):=$$($$(v))) \
+ )
+endef
+
+#
+# Assert that the the variable stashed by stash-product-vars remains untouched.
+# $(1): The prefix as supplied to stash-product-vars
+#
+define assert-product-vars
+$(strip \
+ $(eval changed_variables:=)
+ $(foreach v,$(_product_stash_var_list), \
+ $(if $(call streq,$($(v)),$($(strip $(1))_$(call rot13,$(v)))),, \
+ $(eval $(warning $(v) has been modified: $($(v)))) \
+ $(eval $(warning previous value: $($(strip $(1))_$(call rot13,$(v))))) \
+ $(eval changed_variables := $(changed_variables) $(v))) \
+ ) \
+ $(if $(changed_variables),\
+ $(eval $(error The following variables have been changed: $(changed_variables))),)
+)
+endef
diff --git a/core/product_config.mk b/core/product_config.mk
index 70ac894..433fae2 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -194,8 +194,11 @@
$(call import-products, $(get-all-product-makefiles))
endif # TARGET_BUILD_APPS
$(check-all-products)
-#$(dump-products)
-#$(error done)
+
+ifneq ($(filter dump-products, $(MAKECMDGOALS)),)
+$(dump-products)
+$(error done)
+endif
# Convert a short name like "sooner" into the path to the product
# file defining that product.
diff --git a/core/tasks/apicheck.mk b/core/tasks/apicheck.mk
index 740668c..99a3227 100644
--- a/core/tasks/apicheck.mk
+++ b/core/tasks/apicheck.mk
@@ -19,6 +19,10 @@
ifneq ($(BUILD_TINY_ANDROID), true)
+APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
+APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
+APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)
+
.PHONY: checkapi
# eval this to define a rule that runs apicheck.
@@ -32,7 +36,7 @@
define check-api
$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(APICHECK)
@echo "Checking API:" $(1)
- $(hide) ( $(APICHECK) $(4) $(2) $(3) || ( $(5) ; exit 38 ) )
+ $(hide) ( $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)" $(4) $(2) $(3) || ( $(5) ; exit 38 ) )
$(hide) mkdir -p $$(dir $$@)
$(hide) touch $$@
checkapi: $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp
diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk
index 8c36ef6..8d7667b 100644
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -28,6 +28,10 @@
DDMLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/ddmlib-prebuilt.jar
junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar
HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar
+TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar
+CTS_TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar
+CTS_TF_EXEC_PATH := $(HOST_OUT_EXECUTABLES)/cts-tradefed
+CTS_TF_README_PATH := $(cts_tools_src_dir)/tradefed-host/README
CTS_CORE_CASE_LIST := \
android.core.tests.dom \
@@ -41,21 +45,21 @@
-include cts/CtsTestCaseList.mk
CTS_CASE_LIST := $(CTS_CORE_CASE_LIST) $(CTS_TEST_CASE_LIST)
-DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans
+DEFAULT_TEST_PLAN := $(cts_dir)/$(cts_name)/resource/plans
$(cts_dir)/all_cts_files_stamp: PRIVATE_JUNIT_HOST_JAR := $(junit_host_jar)
-include cts/CtsHostLibraryList.mk
-$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(ACP)
+$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(ACP)
# Make necessary directory for CTS
- @rm -rf $(PRIVATE_CTS_DIR)
- @mkdir -p $(TMP_DIR)
- @mkdir -p $(PRIVATE_DIR)/docs
- @mkdir -p $(PRIVATE_DIR)/tools
- @mkdir -p $(PRIVATE_DIR)/repository/testcases
- @mkdir -p $(PRIVATE_DIR)/repository/plans
+ $(hide) rm -rf $(PRIVATE_CTS_DIR)
+ $(hide) mkdir -p $(TMP_DIR)
+ $(hide) mkdir -p $(PRIVATE_DIR)/docs
+ $(hide) mkdir -p $(PRIVATE_DIR)/tools
+ $(hide) mkdir -p $(PRIVATE_DIR)/repository/testcases
+ $(hide) mkdir -p $(PRIVATE_DIR)/repository/plans
# Copy executable and JARs to CTS directory
- $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(CTS_EXECUTABLE_PATH) $(DDMLIB_JAR) $(PRIVATE_JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(PRIVATE_DIR)/tools
+ $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(CTS_EXECUTABLE_PATH) $(DDMLIB_JAR) $(PRIVATE_JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(PRIVATE_DIR)/tools
# Change mode of the executables
$(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH))
$(foreach apk,$(CTS_CASE_LIST), \
@@ -165,7 +169,7 @@
$(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name)
$(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp
$(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) $(CORE_VM_TEST_DESC)
- @echo "Package CTS: $@"
+ $(hide) echo "Package CTS: $@"
$(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME)
.PHONY: cts
diff --git a/core/user_tags.mk b/core/user_tags.mk
index 3eade8a..1b4ef65 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -38,6 +38,7 @@
am \
android \
android-common \
+ android-common-carousel \
android.policy \
androidprefs \
android.test.runner \
@@ -58,6 +59,7 @@
bb2sym \
bb_dump \
bbprof \
+ bcc \
bison \
bluetoothd \
bmgr \
@@ -67,12 +69,13 @@
cfassembler \
check_stack \
check_trace \
- clearsilver \
cmu2nuance \
com.android.inputmethod.pinyin.lib \
com.android.phone.common \
+ com.android.vcard \
commons-compress-1.0 \
copybit.qsd8k \
+ copybit.s5pc110 \
coverage \
cpufeatures \
cts \
@@ -81,12 +84,13 @@
dasm \
dbus-daemon \
ddmlib \
- ddmlibTests \
ddmlib-prebuilt \
+ ddmlibTests \
ddms \
ddmuilib \
debuggerd \
descGen \
+ dexgen \
dexpreopt \
dex-tools \
dhcpcd \
@@ -94,8 +98,8 @@
dhcpcd-run-hooks \
dictTest \
dnsmasq \
+ doclava \
draw9patch \
- droiddoc \
dumpeventlog \
dumpkey \
dump_regions \
@@ -105,7 +109,9 @@
e2fsck \
e2fsck_host \
easymock \
+ easymocklib \
edify \
+ elftree \
emmalib \
emulator \
emulator-arm \
@@ -147,9 +153,8 @@
ime \
init \
input \
- installd \
+ ip \
iptables \
- ip-up-vpn \
iself \
isprelinked \
jarjar \
@@ -175,7 +180,6 @@
layoutopt \
liba2dp \
libabi \
- libacc \
libandroid \
libandroid_runtime \
libandroid_servers \
@@ -224,14 +228,14 @@
libETC1 \
libexif \
libext \
- libext2fs \
- libext2fs_host \
libext2_blkid \
libext2_blkid_host \
libext2_com_err \
libext2_com_err_host \
libext2_e2p \
libext2_e2p_host \
+ libext2fs \
+ libext2fs_host \
libext2_profile \
libext2_profile_host \
libext2_uuid \
@@ -247,7 +251,6 @@
libGLESv1_CM \
libGLESv2 \
libglib \
- libglib_static \
libgui \
libhardware \
libhardware_legacy \
@@ -268,9 +271,11 @@
libmedia_jni \
libmediaplayerservice \
libmincrypt \
+ libminelf \
libminui \
libminzip \
libmtdutils \
+ libmtp \
libmusicbundle \
libneo_cgi \
libneo_cs \
@@ -283,17 +288,20 @@
libOpenSLESUT \
libpcap \
libpixelflinger \
- libpixelflinger_armv6 \
libpixelflinger_static \
libpng \
libpopt \
libpower \
+ libprotobuf-cpp-2.3.0-full \
+ libprotobuf-cpp-2.3.0-lite \
+ libprotobuf-java-2.3.0-lite \
+ libprotobuf-java-2.3.0-micro \
librecovery_ui_htc \
- libreference-cdma-sms \
libreference-ril \
libreverb \
libreverbwrapper \
libril \
+ librilproto-java \
librpc \
librtp_jni \
libsafe_iop \
@@ -347,6 +355,7 @@
libstagefright_rtsp \
libstagefright_vorbisdec \
libstagefright_vpxdec \
+ libstagefright_yuv \
libstdc++ \
libstlport \
libstlport_static \
@@ -364,6 +373,7 @@
libttssynthproxy \
libui \
libunz \
+ libusbhost \
libutil \
libutils \
libv8 \
@@ -380,6 +390,7 @@
lights.qsd8k \
line_endings \
linker \
+ llvm-rs-link \
localize \
logcat \
logwrapper \
@@ -402,9 +413,11 @@
mkstubs \
mkuserimg.sh \
mkyaffs2image \
+ mockrilcontroller \
monkey \
monkeyrunner \
MonkeyRunnerTest \
+ mtp \
mtpd \
ndc \
netcfg \
@@ -448,6 +461,7 @@
run-as \
runtime \
schedtest \
+ screenshot \
screenshot2 \
sdcard \
sdklauncher \
@@ -464,7 +478,6 @@
service \
servicemanager \
services \
- sh \
sig \
sig-check \
sig-create \
@@ -476,12 +489,14 @@
spec-progress \
sqlite3 \
stack_dump \
+ stingray-keypad.kcm \
stringtemplate \
surfaceflinger \
svc \
swing-worker-1.1 \
swt \
system_server \
+ tblgen \
tc \
temp_layoutlib \
test_g2g \
@@ -493,16 +508,13 @@
traceview \
tune2fs \
tune2fs_host \
- tuttle2.kcm \
uix \
usbtest \
vdc \
vm-tests \
vold \
wdsclient \
+ whisperd \
wpa_supplicant \
- wpa_supplicant.conf \
- xmlwriter \
yuv420sp2rgb \
zipalign
-
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 2f57cf7..23e45a2 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -41,7 +41,7 @@
# which is the version that we reveal to the end user.
# Update this value when the platform version changes (rather
# than overriding it somewhere else). Can be an arbitrary string.
- PLATFORM_VERSION := AOSP
+ PLATFORM_VERSION := 3.0
endif
ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -53,7 +53,7 @@
# intermediate builds). During development, this number remains at the
# SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
# the code-name of the new development work.
- PLATFORM_SDK_VERSION := 10
+ PLATFORM_SDK_VERSION := 11
endif
ifeq "" "$(PLATFORM_VERSION_CODENAME)"
diff --git a/envsetup.sh b/envsetup.sh
index 8289c82..4b2c19e 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -29,8 +29,8 @@
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
- CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
- make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1
+ (cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
+ make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1)
}
# Get the exact value of a build variable.
@@ -106,10 +106,11 @@
# and in with the new
CODE_REVIEWS=
prebuiltdir=$(getprebuilt)
- export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.3/bin
+ export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-linux-androideabi-4.4.x/bin
+ export ARM_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.3/bin
export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
export ANDROID_QTOOLS=$T/development/emulator/qtools
- export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_EABI_TOOLCHAIN$CODE_REVIEWS
+ export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ARM_EABI_TOOLCHAIN$CODE_REVIEWS
export PATH=$PATH$ANDROID_BUILD_PATHS
unset ANDROID_JAVA_TOOLCHAIN
@@ -543,6 +544,19 @@
printconfig
}
+# Tab completion for lunch.
+function _lunch()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ COMPREPLY=( $(compgen -W "${LUNCH_MENU_CHOICES[*]}" -- ${cur}) )
+ return 0
+}
+complete -F _lunch lunch
+
# Configures the build to build unbundled apps.
# Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME)
function tapas()
@@ -784,7 +798,7 @@
echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
echo >>"$OUT_ROOT/gdbclient.cmds" ""
- arm-eabi-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
+ arm-linux-androideabi-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
else
echo "Unable to determine build system output dir."
fi
@@ -906,10 +920,10 @@
{
# process standard adb options
local adbTarget=""
- if [ $1 = "-d" -o $1 = "-e" ]; then
+ if [ "$1" = "-d" -o "$1" = "-e" ]; then
adbTarget=$1
shift 1
- elif [ $1 = "-s" ]; then
+ elif [ "$1" = "-s" ]; then
adbTarget="$1 $2"
shift 2
fi
@@ -918,10 +932,9 @@
# runhat options
local targetPid=$1
- local outputFile=$2
if [ "$targetPid" = "" ]; then
- echo "Usage: runhat [ -d | -e | -s serial ] target-pid [output-file]"
+ echo "Usage: runhat [ -d | -e | -s serial ] target-pid"
return
fi
@@ -931,18 +944,14 @@
return
fi
- adb ${adbOptions} shell >/dev/null mkdir /data/misc
- adb ${adbOptions} shell chmod 777 /data/misc
-
- # send a SIGUSR1 to cause the hprof dump
+ # issue "am" command to cause the hprof dump
+ local devFile=/sdcard/hprof-$targetPid
echo "Poking $targetPid and waiting for data..."
- adb ${adbOptions} shell kill -10 $targetPid
+ adb ${adbOptions} shell am dumpheap $targetPid $devFile
echo "Press enter when logcat shows \"hprof: heap dump completed\""
echo -n "> "
read
- local availFiles=( $(adb ${adbOptions} shell ls /data/misc | grep '^heap-dump' | sed -e 's/.*heap-dump-/heap-dump-/' | sort -r | tr '[:space:][:cntrl:]' ' ') )
- local devFile=/data/misc/${availFiles[0]}
local localFile=/tmp/$$-hprof
echo "Retrieving file $devFile..."
@@ -993,6 +1002,21 @@
adb shell service call window 3
}
+function key_home()
+{
+ adb shell input keyevent 3
+}
+
+function key_back()
+{
+ adb shell input keyevent 4
+}
+
+function key_menu()
+{
+ adb shell input keyevent 82
+}
+
function smoketest()
{
if [ ! "$ANDROID_PRODUCT_OUT" ]; then
diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c
index 3cbe34a..23f1260 100644
--- a/libs/host/CopyFile.c
+++ b/libs/host/CopyFile.c
@@ -64,18 +64,19 @@
/*
* Returns true if the source file has high resolution modification
- * date. Cygwin doesn't support st_mtim in normal build, so always
- * return false.
+ * date. Cygwin/Mingw doesn't support st_mtim and always returns false.
*/
static bool isHiresMtime(const struct stat* pSrcStat)
{
-#if defined(WIN32) || defined(USE_MINGW)
- return 0;
-#elif defined(MACOSX_RSRC)
+#if HAVE_STAT_ST_MTIM
+#if defined(MACOSX_RSRC)
return pSrcStat->st_mtimespec.tv_nsec > 0;
#else
return pSrcStat->st_mtim.tv_nsec > 0;
#endif
+#else
+ return 0;
+#endif
}
/*
diff --git a/target/board/emulator/AndroidBoard.mk b/target/board/emulator/AndroidBoard.mk
index 09badee..7911f61 100644
--- a/target/board/emulator/AndroidBoard.mk
+++ b/target/board/emulator/AndroidBoard.mk
@@ -1,10 +1 @@
LOCAL_PATH := $(call my-dir)
-
-file := $(TARGET_OUT_KEYLAYOUT)/tuttle2.kl
-ALL_PREBUILT += $(file)
-$(file) : $(LOCAL_PATH)/tuttle2.kl | $(ACP)
- $(transform-prebuilt-to-target)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := tuttle2.kcm
-include $(BUILD_KEY_CHAR_MAP)
diff --git a/target/board/emulator/tuttle2.kcm b/target/board/emulator/tuttle2.kcm
deleted file mode 100644
index 0a2dd8c..0000000
--- a/target/board/emulator/tuttle2.kcm
+++ /dev/null
@@ -1,66 +0,0 @@
-[type=QWERTY]
-
-# keycode display number base caps fn caps_fn
-
-A 'A' '%' 'a' 'A' '%' 0x00
-B 'B' '=' 'b' 'B' '=' 0x00
-C 'C' '8' 'c' 'C' '8' 0x00E7
-D 'D' '5' 'd' 'D' '5' 0x00
-E 'E' '2' 'e' 'E' '2' 0x0301
-F 'F' '6' 'f' 'F' '6' 0x00A5
-G 'G' '-' 'g' 'G' '-' '_'
-H 'H' '[' 'h' 'H' '[' '{'
-I 'I' '$' 'i' 'I' '$' 0x0302
-J 'J' ']' 'j' 'J' ']' '}'
-K 'K' '"' 'k' 'K' '"' '~'
-L 'L' ''' 'l' 'L' ''' '`'
-M 'M' '>' 'm' 'M' '>' 0x00
-N 'N' '<' 'n' 'N' '<' 0x0303
-O 'O' '(' 'o' 'O' '(' 0x00
-P 'P' ')' 'p' 'P' ')' 0x00
-Q 'Q' '*' 'q' 'Q' '*' 0x0300
-R 'R' '3' 'r' 'R' '3' 0x20AC
-S 'S' '4' 's' 'S' '4' 0x00DF
-T 'T' '+' 't' 'T' '+' 0x00A3
-U 'U' '&' 'u' 'U' '&' 0x0308
-V 'V' '9' 'v' 'V' '9' '^'
-W 'W' '1' 'w' 'W' '1' 0x00
-X 'X' '7' 'x' 'X' '7' 0xEF00
-Y 'Y' '!' 'y' 'Y' '!' 0x00A1
-Z 'Z' '#' 'z' 'Z' '#' 0x00
-
-COMMA ',' ',' ',' ';' ';' '|'
-PERIOD '.' '.' '.' ':' ':' 0x2026
-AT '@' '0' '@' '0' '0' 0x2022
-SLASH '/' '/' '/' '?' '?' '\'
-
-SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
-ENTER 0xa 0xa 0xa 0xa 0xa 0xa
-
-# on pc keyboards
-TAB 0x9 0x9 0x9 0x9 0x9 0x9
-0 '0' '0' '0' ')' ')' ')'
-1 '1' '1' '1' '!' '!' '!'
-2 '2' '2' '2' '@' '@' '@'
-3 '3' '3' '3' '#' '#' '#'
-4 '4' '4' '4' '$' '$' '$'
-5 '5' '5' '5' '%' '%' '%'
-6 '6' '6' '6' '^' '^' '^'
-7 '7' '7' '7' '&' '&' '&'
-8 '8' '8' '8' '*' '*' '*'
-9 '9' '9' '9' '(' '(' '('
-
-GRAVE '`' '`' '`' '~' '`' '~'
-MINUS '-' '-' '-' '_' '-' '_'
-EQUALS '=' '=' '=' '+' '=' '+'
-LEFT_BRACKET '[' '[' '[' '{' '[' '{'
-RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
-BACKSLASH '\' '\' '\' '|' '\' '|'
-SEMICOLON ';' ';' ';' ':' ';' ':'
-APOSTROPHE ''' ''' ''' '"' ''' '"'
-STAR '*' '*' '*' '*' '*' '*'
-POUND '#' '#' '#' '#' '#' '#'
-PLUS '+' '+' '+' '+' '+' '+'
-
-
-
diff --git a/target/board/emulator/tuttle2.kl b/target/board/emulator/tuttle2.kl
deleted file mode 100644
index a48a5ab..0000000
--- a/target/board/emulator/tuttle2.kl
+++ /dev/null
@@ -1,74 +0,0 @@
-key 2 1
-key 3 2
-key 4 3
-key 5 4
-key 6 5
-key 7 6
-key 8 7
-key 9 8
-key 10 9
-key 11 0
-key 158 BACK WAKE_DROPPED
-key 230 SOFT_RIGHT WAKE
-key 60 SOFT_RIGHT WAKE
-key 107 ENDCALL WAKE_DROPPED
-key 62 ENDCALL WAKE_DROPPED
-key 229 MENU WAKE_DROPPED
-key 59 MENU WAKE_DROPPED
-key 228 POUND
-key 227 STAR
-key 231 CALL WAKE_DROPPED
-key 61 CALL WAKE_DROPPED
-key 232 DPAD_CENTER WAKE_DROPPED
-key 108 DPAD_DOWN WAKE_DROPPED
-key 103 DPAD_UP WAKE_DROPPED
-key 102 HOME WAKE
-key 105 DPAD_LEFT WAKE_DROPPED
-key 106 DPAD_RIGHT WAKE_DROPPED
-key 115 VOLUME_UP
-key 114 VOLUME_DOWN
-key 116 POWER WAKE
-key 212 SLASH
-
-key 16 Q
-key 17 W
-key 18 E
-key 19 R
-key 20 T
-key 21 Y
-key 22 U
-key 23 I
-key 24 O
-key 25 P
-
-key 30 A
-key 31 S
-key 32 D
-key 33 F
-key 34 G
-key 35 H
-key 36 J
-key 37 K
-key 38 L
-key 14 DEL
-
-key 44 Z
-key 45 X
-key 46 C
-key 47 V
-key 48 B
-key 49 N
-key 50 M
-key 51 COMMA
-key 52 PERIOD
-key 28 ENTER
-
-key 56 ALT_LEFT
-key 42 SHIFT_LEFT
-key 215 AT
-key 57 SPACE
-key 53 SLASH
-key 127 SYM
-key 100 ALT_RIGHT
-
-key 399 GRAVE
diff --git a/target/board/generic/AndroidBoard.mk b/target/board/generic/AndroidBoard.mk
index 09badee..7911f61 100644
--- a/target/board/generic/AndroidBoard.mk
+++ b/target/board/generic/AndroidBoard.mk
@@ -1,10 +1 @@
LOCAL_PATH := $(call my-dir)
-
-file := $(TARGET_OUT_KEYLAYOUT)/tuttle2.kl
-ALL_PREBUILT += $(file)
-$(file) : $(LOCAL_PATH)/tuttle2.kl | $(ACP)
- $(transform-prebuilt-to-target)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := tuttle2.kcm
-include $(BUILD_KEY_CHAR_MAP)
diff --git a/target/board/generic/tuttle2.kcm b/target/board/generic/tuttle2.kcm
deleted file mode 100644
index 0a2dd8c..0000000
--- a/target/board/generic/tuttle2.kcm
+++ /dev/null
@@ -1,66 +0,0 @@
-[type=QWERTY]
-
-# keycode display number base caps fn caps_fn
-
-A 'A' '%' 'a' 'A' '%' 0x00
-B 'B' '=' 'b' 'B' '=' 0x00
-C 'C' '8' 'c' 'C' '8' 0x00E7
-D 'D' '5' 'd' 'D' '5' 0x00
-E 'E' '2' 'e' 'E' '2' 0x0301
-F 'F' '6' 'f' 'F' '6' 0x00A5
-G 'G' '-' 'g' 'G' '-' '_'
-H 'H' '[' 'h' 'H' '[' '{'
-I 'I' '$' 'i' 'I' '$' 0x0302
-J 'J' ']' 'j' 'J' ']' '}'
-K 'K' '"' 'k' 'K' '"' '~'
-L 'L' ''' 'l' 'L' ''' '`'
-M 'M' '>' 'm' 'M' '>' 0x00
-N 'N' '<' 'n' 'N' '<' 0x0303
-O 'O' '(' 'o' 'O' '(' 0x00
-P 'P' ')' 'p' 'P' ')' 0x00
-Q 'Q' '*' 'q' 'Q' '*' 0x0300
-R 'R' '3' 'r' 'R' '3' 0x20AC
-S 'S' '4' 's' 'S' '4' 0x00DF
-T 'T' '+' 't' 'T' '+' 0x00A3
-U 'U' '&' 'u' 'U' '&' 0x0308
-V 'V' '9' 'v' 'V' '9' '^'
-W 'W' '1' 'w' 'W' '1' 0x00
-X 'X' '7' 'x' 'X' '7' 0xEF00
-Y 'Y' '!' 'y' 'Y' '!' 0x00A1
-Z 'Z' '#' 'z' 'Z' '#' 0x00
-
-COMMA ',' ',' ',' ';' ';' '|'
-PERIOD '.' '.' '.' ':' ':' 0x2026
-AT '@' '0' '@' '0' '0' 0x2022
-SLASH '/' '/' '/' '?' '?' '\'
-
-SPACE 0x20 0x20 0x20 0x20 0xEF01 0xEF01
-ENTER 0xa 0xa 0xa 0xa 0xa 0xa
-
-# on pc keyboards
-TAB 0x9 0x9 0x9 0x9 0x9 0x9
-0 '0' '0' '0' ')' ')' ')'
-1 '1' '1' '1' '!' '!' '!'
-2 '2' '2' '2' '@' '@' '@'
-3 '3' '3' '3' '#' '#' '#'
-4 '4' '4' '4' '$' '$' '$'
-5 '5' '5' '5' '%' '%' '%'
-6 '6' '6' '6' '^' '^' '^'
-7 '7' '7' '7' '&' '&' '&'
-8 '8' '8' '8' '*' '*' '*'
-9 '9' '9' '9' '(' '(' '('
-
-GRAVE '`' '`' '`' '~' '`' '~'
-MINUS '-' '-' '-' '_' '-' '_'
-EQUALS '=' '=' '=' '+' '=' '+'
-LEFT_BRACKET '[' '[' '[' '{' '[' '{'
-RIGHT_BRACKET ']' ']' ']' '}' ']' '}'
-BACKSLASH '\' '\' '\' '|' '\' '|'
-SEMICOLON ';' ';' ';' ':' ';' ':'
-APOSTROPHE ''' ''' ''' '"' ''' '"'
-STAR '*' '*' '*' '*' '*' '*'
-POUND '#' '#' '#' '#' '#' '#'
-PLUS '+' '+' '+' '+' '+' '+'
-
-
-
diff --git a/target/board/generic/tuttle2.kl b/target/board/generic/tuttle2.kl
deleted file mode 100644
index a78a6eb..0000000
--- a/target/board/generic/tuttle2.kl
+++ /dev/null
@@ -1,74 +0,0 @@
-key 2 1
-key 3 2
-key 4 3
-key 5 4
-key 6 5
-key 7 6
-key 8 7
-key 9 8
-key 10 9
-key 11 0
-key 158 BACK WAKE_DROPPED
-key 230 SOFT_RIGHT WAKE
-key 60 SOFT_RIGHT WAKE
-key 107 ENDCALL WAKE_DROPPED
-key 62 ENDCALL WAKE_DROPPED
-key 229 MENU WAKE_DROPPED
-key 59 MENU WAKE_DROPPED
-key 228 POUND
-key 227 STAR
-key 231 CALL WAKE_DROPPED
-key 61 CALL WAKE_DROPPED
-key 232 DPAD_CENTER WAKE_DROPPED
-key 108 DPAD_DOWN WAKE_DROPPED
-key 103 DPAD_UP WAKE_DROPPED
-key 102 HOME WAKE
-key 105 DPAD_LEFT WAKE_DROPPED
-key 106 DPAD_RIGHT WAKE_DROPPED
-key 115 VOLUME_UP
-key 114 VOLUME_DOWN
-key 116 POWER WAKE
-key 212 SLASH
-
-key 16 Q
-key 17 W
-key 18 E
-key 19 R
-key 20 T
-key 21 Y
-key 22 U
-key 23 I
-key 24 O
-key 25 P
-
-key 30 A
-key 31 S
-key 32 D
-key 33 F
-key 34 G
-key 35 H
-key 36 J
-key 37 K
-key 38 L
-key 14 DEL
-
-key 44 Z
-key 45 X
-key 46 C
-key 47 V
-key 48 B
-key 49 N
-key 50 M
-key 51 COMMA
-key 52 PERIOD
-key 28 ENTER
-
-key 56 ALT_LEFT
-key 42 SHIFT_LEFT
-key 215 AT
-key 57 SPACE
-key 53 SLASH
-key 127 SYM
-key 100 ALT_LEFT
-
-key 399 GRAVE
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 32416c5..b27721a 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -39,5 +39,6 @@
$(LOCAL_DIR)/full.mk \
$(LOCAL_DIR)/full_x86.mk \
$(LOCAL_DIR)/sdk.mk \
- $(LOCAL_DIR)/sim.mk
+ $(LOCAL_DIR)/sim.mk \
+ $(LOCAL_DIR)/large_emu_hw.mk
endif
diff --git a/target/product/core.mk b/target/product/core.mk
index 55d6c26..06b7003 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -28,22 +28,19 @@
com.android.location.provider.xml \
core \
core-junit \
- create_test_dmtrace \
dalvikvm \
dexdeps \
dexdump \
dexlist \
dexopt \
dmtracedump \
- dvz \
dx \
ext \
framework-res \
hprof-conv \
icu.dat \
+ installd \
ip-up-vpn \
- jasmin \
- jasmin.jar \
libcrypto \
libdex \
libdvm \
@@ -57,11 +54,11 @@
libssl \
libz \
sqlite-jdbc \
+ wpa_supplicant.conf \
Browser \
Contacts \
Home \
HTMLViewer \
- Phone \
ApplicationsProvider \
ContactsProvider \
DownloadProvider \
@@ -75,7 +72,9 @@
UserDictionaryProvider \
PackageInstaller \
DefaultContainerService \
- Bugreport
+ Bugreport \
+ ip \
+ screencap
# host-only dependencies
ifeq ($(WITH_HOST_DALVIK),true)
@@ -84,4 +83,3 @@
core-hostdex \
libjavacore-host
endif
-
diff --git a/target/product/full.mk b/target/product/full.mk
index c563bcc..8231e99 100644
--- a/target/product/full.mk
+++ b/target/product/full.mk
@@ -19,7 +19,7 @@
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
-$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk)
# Overrides
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index fb9b528..9ad45a9 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -15,8 +15,9 @@
#
# This is a build configuration for a full-featured build of the
-# Open-Source part of the tree. This is a base configuration to
-# bes used for AOSP builds on various target devices.
+# Open-Source part of the tree. It's geared toward a US-centric
+# build of the emulator, but all those aspects can be overridden
+# in inherited configurations.
PRODUCT_PACKAGES := \
OpenWnn \
@@ -28,13 +29,11 @@
# Additional settings used in all AOSP builds
PRODUCT_PROPERTY_OVERRIDES := \
- keyguard.no_require_sim=true \
ro.com.android.dateformat=MM-dd-yyyy \
- ro.com.android.dataroaming=true \
ro.config.ringtone=Ring_Synth_04.ogg \
ro.config.notification_sound=pixiedust.ogg
-# Put en_US first in the list, to make it default.
+# Put en_US first in the list, so make it default.
PRODUCT_LOCALES := en_US
# Get some sounds
@@ -43,7 +42,9 @@
# Get the TTS language packs
$(call inherit-product-if-exists, external/svox/pico/lang/all_pico_languages.mk)
-# Get the list of languages.
+# Get a list of languages.
$(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
+# Get everything else from the parent package
+$(call inherit-product, $(SRC_TARGET_DIR)/product/generic_no_telephony.mk)
+
diff --git a/target/product/full_base_telephony.mk b/target/product/full_base_telephony.mk
new file mode 100644
index 0000000..932ba95
--- /dev/null
+++ b/target/product/full_base_telephony.mk
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ keyguard.no_require_sim=true \
+ ro.com.android.dataroaming=true
+
+PRODUCT_COPY_FILES := \
+ development/data/etc/apns-conf.xml:system/etc/apns-conf.xml
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk)
diff --git a/target/product/full_x86.mk b/target/product/full_x86.mk
index affdc13..f137b8a 100644
--- a/target/product/full_x86.mk
+++ b/target/product/full_x86.mk
@@ -26,7 +26,7 @@
PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
endif
-$(call inherit-product, build/target/product/full.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
# Overrides
PRODUCT_NAME := full_x86
diff --git a/target/product/generic.mk b/target/product/generic.mk
index eed354a..dd0d663 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -14,36 +14,11 @@
# limitations under the License.
#
-# This is a generic product that isn't specialized for a specific device.
+# This is a generic phone product that isn't specialized for a specific device.
# It includes the base Android platform.
-PRODUCT_PACKAGES := \
- AccountAndSyncSettings \
- DeskClock \
- AlarmProvider \
- Bluetooth \
- Calculator \
- Calendar \
- Camera \
- CertInstaller \
- DrmProvider \
- Email \
- Gallery3D \
- LatinIME \
- Launcher2 \
- Mms \
- Music \
- Provision \
- Protips \
- QuickSearchBox \
- Settings \
- Sync \
- SystemUI \
- Updater \
- CalendarProvider \
- SyncProvider
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/generic_no_telephony.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk)
# Overrides
PRODUCT_BRAND := generic
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
new file mode 100644
index 0000000..db74a7f
--- /dev/null
+++ b/target/product/generic_no_telephony.mk
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a generic phone product that isn't specialized for a specific device.
+# It includes the base Android platform.
+
+PRODUCT_POLICY := android.policy_phone
+
+PRODUCT_PACKAGES := \
+ AccountAndSyncSettings \
+ DeskClock \
+ AlarmProvider \
+ Bluetooth \
+ Calculator \
+ Calendar \
+ Camera \
+ CertInstaller \
+ DrmProvider \
+ Email \
+ Gallery3D \
+ LatinIME \
+ Launcher2 \
+ Music \
+ Provision \
+ Phone \
+ QuickSearchBox \
+ Settings \
+ Sync \
+ SystemUI \
+ Updater \
+ CalendarProvider \
+ SyncProvider \
+ CryptKeeper
+
+PRODUCT_PACKAGES += \
+ icu.dat
+
+PRODUCT_PACKAGES += \
+ librs_jni \
+ libvideoeditor_jni \
+ libvideoeditorplayer \
+ libvideoeditor_core
+
+
+PRODUCT_COPY_FILES := \
+ system/bluetooth/data/audio.conf:system/etc/bluetooth/audio.conf \
+ system/bluetooth/data/auto_pairing.conf:system/etc/bluetooth/auto_pairing.conf \
+ system/bluetooth/data/blacklist.conf:system/etc/bluetooth/blacklist.conf \
+ system/bluetooth/data/input.conf:system/etc/bluetooth/input.conf \
+ system/bluetooth/data/main.nonsmartphone.conf:system/etc/bluetooth/main.conf \
+ system/bluetooth/data/network.conf:system/etc/bluetooth/network.conf
+
+$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
+$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+
+# Overrides
+PRODUCT_BRAND := generic
+PRODUCT_DEVICE := generic
+PRODUCT_NAME := generic_no_telephony
diff --git a/target/product/large_emu_hw.mk b/target/product/large_emu_hw.mk
new file mode 100644
index 0000000..07991ac
--- /dev/null
+++ b/target/product/large_emu_hw.mk
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a generic product for devices with large display but not specialized
+# for a specific device. It includes the base Android platform.
+
+PRODUCT_POLICY := android.policy_mid
+
+PRODUCT_PACKAGES := \
+ AccountAndSyncSettings \
+ CarHome \
+ DeskClock \
+ AlarmProvider \
+ Bluetooth \
+ Calculator \
+ Calendar \
+ Camera \
+ CertInstaller \
+ DrmProvider \
+ Email \
+ Gallery3D \
+ LatinIME \
+ Launcher2 \
+ Music \
+ Provision \
+ QuickSearchBox \
+ Settings \
+ Sync \
+ Updater \
+ CalendarProvider \
+ SyncProvider
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+
+# Overrides
+PRODUCT_BRAND := generic
+PRODUCT_DEVICE := generic
+PRODUCT_NAME := large_emu_hw
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 7a986bd..cfc518a 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -14,47 +14,52 @@
# limitations under the License.
#
+PRODUCT_POLICY := android.policy_phone
PRODUCT_PROPERTY_OVERRIDES :=
PRODUCT_PACKAGES := \
- SystemUI \
- AccountAndSyncSettings \
- Camera \
Calculator \
+ Camera \
DeskClock \
- Development \
- DrmProvider \
Email \
- Fallback \
Gallery \
- GPSEnable \
- Launcher2 \
- Protips \
Music \
Mms \
+ OpenWnn \
+ libWnnEngDic \
+ libWnnJpnDic \
+ libwnndict \
+ Phone \
+ PinyinIME \
+ Protips \
+ SoftKeyboard \
+ SystemUI \
+ Launcher2 \
+ AccountAndSyncSettings \
+ Development \
+ DrmProvider \
+ Fallback \
+ GPSEnable \
Settings \
SdkSetup \
CustomLocale \
gpstest \
sqlite3 \
LatinIME \
- PinyinIME \
- OpenWnn \
- libWnnEngDic \
- libWnnJpnDic \
- libwnndict \
CertInstaller \
LiveWallpapersPicker \
ApiDemos \
GestureBuilder \
- SoftKeyboard \
CubeLiveWallpapers \
QuickSearchBox \
- monkeyrunner \
- guavalib \
- jsr305lib \
+ WidgetPreview \
+ monkeyrunner \
+ guavalib \
+ jsr305lib \
jython \
- jsilver
+ jsilver \
+ librs_jni
+
# Host tools that are parts of the SDK.
# See development/build/sdk.atree
@@ -72,7 +77,7 @@
traceview \
android \
dexdump \
- monkeyrunner
+ monkeyrunner
# Native host Java libraries that are parts of the SDK.
# See development/build/sdk.atree
@@ -83,8 +88,8 @@
ddms \
ddmlib \
ddmuilib \
- hierarchyviewer \
draw9patch \
+ hierarchyviewer \
layoutopt \
uix \
traceview \
@@ -92,12 +97,9 @@
sdklib \
sdkuilib \
sdkmanager \
- swing-worker-1.1 \
groovy-all-1.7.0 \
commons-compress-1.0 \
emmalib \
- org-netbeans-api-visual \
- org-openide-util \
jcommon-1.0.12 \
jfreechart-1.0.9 \
jfreechart-1.0.9-swt \
@@ -106,9 +108,9 @@
org.eclipse.jface_3.4.2.M20090107-0800 \
osgi \
layoutlib \
- monkeyrunner \
- guavalib \
- jsr305lib \
+ monkeyrunner \
+ guavalib \
+ jsr305lib \
jython
PRODUCT_PACKAGE_OVERLAYS := development/sdk_overlay
@@ -119,16 +121,22 @@
frameworks/base/data/sounds/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
frameworks/base/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml
+$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
+$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
# Overrides
PRODUCT_BRAND := generic
PRODUCT_NAME := sdk
PRODUCT_DEVICE := generic
-PRODUCT_LOCALES := \
+
+# locale + densities. en_US is both first and in alphabetical order to
+# ensure this is the default locale.
+PRODUCT_LOCALES = \
ldpi \
hdpi \
mdpi \
+ en_US \
ar_EG \
ar_IL \
bg_BG \
diff --git a/tools/apicheck/src/Android.mk b/target/product/telephony.mk
similarity index 61%
rename from tools/apicheck/src/Android.mk
rename to target/product/telephony.mk
index c4e7c6e..d557887 100644
--- a/tools/apicheck/src/Android.mk
+++ b/target/product/telephony.mk
@@ -1,4 +1,5 @@
-# Copyright (C) 2008 The Android Open Source Project
+#
+# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -11,18 +12,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+#
-LOCAL_PATH := $(call my-dir)
+# This is the list of product-level settings that are specific
+# to products that have telephony hardware.
+PRODUCT_PACKAGES := \
+ Mms
-# apicheck java library
-# ============================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_JAR_MANIFEST := MANIFEST.mf
-
-LOCAL_MODULE:= apicheck
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
+PRODUCT_COPY_FILES := \
+ system/bluetooth/data/main.conf:system/etc/bluetooth/main.conf
diff --git a/tools/adbs b/tools/adbs
index 8277790..4fb94d5 100755
--- a/tools/adbs
+++ b/tools/adbs
@@ -144,23 +144,23 @@
uname = "darwin-ppc"
elif uname == "Linux":
uname = "linux-x86"
- prefix = "./prebuilt/" + uname + "/toolchain/arm-eabi-4.4.3/bin/"
- addr2line_cmd = prefix + "arm-eabi-addr2line"
+ prefix = "./prebuilt/" + uname + "/toolchain/arm-linux-androideabi-4.4.x/bin/"
+ addr2line_cmd = prefix + "arm-linux-androideabi-addr2line"
if (not os.path.exists(addr2line_cmd)):
try:
prefix = os.environ['ANDROID_BUILD_TOP'] + "/prebuilt/" + uname + \
- "/toolchain/arm-eabi-4.4.3/bin/"
+ "/toolchain/arm-linux-androideabi-4.4.x/bin/"
except:
prefix = "";
- addr2line_cmd = prefix + "arm-eabi-addr2line"
+ addr2line_cmd = prefix + "arm-linux-androideabi-addr2line"
if (not os.path.exists(addr2line_cmd)):
print addr2line_cmd + " not found!"
sys.exit(1)
- objdump_cmd = prefix + "arm-eabi-objdump"
- cppfilt_cmd = prefix + "arm-eabi-c++filt"
+ objdump_cmd = prefix + "arm-linux-androideabi-objdump"
+ cppfilt_cmd = prefix + "arm-linux-androideabi-c++filt"
###############################################################################
# look up the function and file/line number for a raw stack trace line
diff --git a/tools/apicheck/Android.mk b/tools/apicheck/Android.mk
index a2ff8a2..24f697c 100644
--- a/tools/apicheck/Android.mk
+++ b/tools/apicheck/Android.mk
@@ -29,16 +29,10 @@
include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/apicheck$(COMMON_JAVA_PACKAGE_SUFFIX)
+$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/apicheck | $(ACP)
@echo "Copy: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-new-target)
$(hide) chmod 755 $@
-# the other stuff
-# ============================================================
-subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
- src \
- ))
-
-include $(subdirs)
+# Apicheck is now part of Doclava -- See external/doclava.
diff --git a/tools/apicheck/etc/apicheck b/tools/apicheck/etc/apicheck
index 5d0480c..c710c46 100644
--- a/tools/apicheck/etc/apicheck
+++ b/tools/apicheck/etc/apicheck
@@ -16,6 +16,10 @@
# Set up prog to be the path of this script, including following symlinks,
# and set up progdir to be the fully-qualified pathname of its directory.
+#
+# The classpath and other java options used in apicheck are specified in
+# build/core/tasks/apicheck.mk.
+
prog="$0"
while [ -h "${prog}" ]; do
newProg=`/bin/ls -ld "${prog}"`
@@ -34,8 +38,6 @@
prog="${progdir}"/`basename "${prog}"`
cd "${oldwd}"
-libdir=`dirname $progdir`/framework
-
javaOpts=""
while expr "x$1" : 'x-J' >/dev/null; do
opt=`expr "x$1" : 'x-J\(.*\)'`
@@ -43,4 +45,4 @@
shift
done
-exec java $javaOpts -jar $libdir/apicheck.jar "$@"
+exec java $javaOpts com.google.doclava.apicheck.ApiCheck "$@"
diff --git a/tools/apicheck/src/MANIFEST.mf b/tools/apicheck/src/MANIFEST.mf
deleted file mode 100644
index e6dc263..0000000
--- a/tools/apicheck/src/MANIFEST.mf
+++ /dev/null
@@ -1,2 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: com.android.apicheck.ApiCheck
diff --git a/tools/apicheck/src/com/android/apicheck/AbstractMethodInfo.java b/tools/apicheck/src/com/android/apicheck/AbstractMethodInfo.java
deleted file mode 100644
index ca90820..0000000
--- a/tools/apicheck/src/com/android/apicheck/AbstractMethodInfo.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-
-public interface AbstractMethodInfo {
-
- public void addException(String exec);
- public void addParameter(ParameterInfo p);
-
-}
diff --git a/tools/apicheck/src/com/android/apicheck/ApiCheck.java b/tools/apicheck/src/com/android/apicheck/ApiCheck.java
deleted file mode 100644
index c8272dd..0000000
--- a/tools/apicheck/src/com/android/apicheck/ApiCheck.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Stack;
-
-public class ApiCheck {
- // parse out and consume the -whatever command line flags
- private static ArrayList<String[]> parseFlags(ArrayList<String> allArgs) {
- ArrayList<String[]> ret = new ArrayList<String[]>();
-
- int i;
- for (i = 0; i < allArgs.size(); i++) {
- // flags with one value attached
- String flag = allArgs.get(i);
- if (flag.equals("-error")
- || flag.equals("-warning")
- || flag.equals("-hide")) {
- String[] arg = new String[2];
- arg[0] = flag;
- arg[1] = allArgs.get(++i);
- ret.add(arg);
- } else {
- // we've consumed all of the -whatever args, so we're done
- break;
- }
- }
-
- // i now points to the first non-flag arg; strip what came before
- for (; i > 0; i--) {
- allArgs.remove(0);
- }
- return ret;
- }
-
- public static void main(String[] originalArgs) {
- // translate to an ArrayList<String> for munging
- ArrayList<String> args = new ArrayList<String>(originalArgs.length);
- for (String a: originalArgs) {
- args.add(a);
- }
-
- ArrayList<String[]> flags = ApiCheck.parseFlags(args);
- for (String[] a: flags) {
- if (a[0].equals("-error") || a[0].equals("-warning")
- || a[0].equals("-hide")) {
- try {
- int level = -1;
- if (a[0].equals("-error")) {
- level = Errors.ERROR;
- }
- else if (a[0].equals("-warning")) {
- level = Errors.WARNING;
- }
- else if (a[0].equals("-hide")) {
- level = Errors.HIDDEN;
- }
- Errors.setErrorLevel(Integer.parseInt(a[1]), level);
- }
- catch (NumberFormatException e) {
- System.err.println("Bad argument: " + a[0] + " " + a[1]);
- System.exit(2);
- }
- }
- }
-
- ApiCheck acheck = new ApiCheck();
-
- ApiInfo oldApi = acheck.parseApi(args.get(0));
- ApiInfo newApi = acheck.parseApi(args.get(1));
-
- // only run the consistency check if we haven't had XML parse errors
- if (!Errors.hadError) {
- oldApi.isConsistent(newApi);
- }
-
- Errors.printErrors();
- System.exit(Errors.hadError ? 1 : 0);
- }
-
- public ApiInfo parseApi(String xmlFile) {
- FileReader fileReader = null;
- try {
- XMLReader xmlreader = XMLReaderFactory.createXMLReader();
- MakeHandler handler = new MakeHandler();
- xmlreader.setContentHandler(handler);
- xmlreader.setErrorHandler(handler);
- fileReader = new FileReader(xmlFile);
- xmlreader.parse(new InputSource(fileReader));
- ApiInfo apiInfo = handler.getApi();
- apiInfo.resolveSuperclasses();
- return apiInfo;
- } catch (SAXParseException e) {
- Errors.error(Errors.PARSE_ERROR,
- new SourcePositionInfo(xmlFile, e.getLineNumber(), 0),
- e.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- Errors.error(Errors.PARSE_ERROR,
- new SourcePositionInfo(xmlFile, 0, 0), e.getMessage());
- } finally {
- if (fileReader != null) {
- try {
- fileReader.close();
- } catch (IOException ignored) {}
- }
- }
- return null;
- }
-
- private static class MakeHandler extends DefaultHandler {
-
- private ApiInfo mApi;
- private PackageInfo mCurrentPackage;
- private ClassInfo mCurrentClass;
- private AbstractMethodInfo mCurrentMethod;
- private Stack<ClassInfo> mClassScope = new Stack<ClassInfo>();
-
-
- public MakeHandler() {
- super();
- mApi = new ApiInfo();
- }
-
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) {
- if (qName.equals("package")) {
- mCurrentPackage = new PackageInfo(attributes.getValue("name"),
- SourcePositionInfo.fromXml(attributes.getValue("source")));
- } else if (qName.equals("class")
- || qName.equals("interface")) {
- // push the old outer scope for later recovery, then set
- // up the new current class object
- mClassScope.push(mCurrentClass);
- mCurrentClass = new ClassInfo(attributes.getValue("name"),
- mCurrentPackage,
- attributes.getValue("extends") ,
- qName.equals("interface"),
- Boolean.valueOf(
- attributes.getValue("abstract")),
- Boolean.valueOf(
- attributes.getValue("static")),
- Boolean.valueOf(
- attributes.getValue("final")),
- attributes.getValue("deprecated"),
- attributes.getValue("visibility"),
- SourcePositionInfo.fromXml(attributes.getValue("source")),
- mCurrentClass);
- } else if (qName.equals("method")) {
- mCurrentMethod = new MethodInfo(attributes.getValue("name"),
- attributes.getValue("return") ,
- Boolean.valueOf(
- attributes.getValue("abstract")),
- Boolean.valueOf(
- attributes.getValue("native")),
- Boolean.valueOf(
- attributes.getValue("synchronized")),
- Boolean.valueOf(
- attributes.getValue("static")),
- Boolean.valueOf(
- attributes.getValue("final")),
- attributes.getValue("deprecated"),
- attributes.getValue("visibility"),
- SourcePositionInfo.fromXml(attributes.getValue("source")),
- mCurrentClass);
- } else if (qName.equals("constructor")) {
- mCurrentMethod = new ConstructorInfo(attributes.getValue("name"),
- attributes.getValue("type") ,
- Boolean.valueOf(
- attributes.getValue("static")),
- Boolean.valueOf(
- attributes.getValue("final")),
- attributes.getValue("deprecated"),
- attributes.getValue("visibility"),
- SourcePositionInfo.fromXml(attributes.getValue("source")),
- mCurrentClass);
- } else if (qName.equals("field")) {
- FieldInfo fInfo = new FieldInfo(attributes.getValue("name"),
- attributes.getValue("type") ,
- Boolean.valueOf(
- attributes.getValue("transient")),
- Boolean.valueOf(
- attributes.getValue("volatile")),
- attributes.getValue("value"),
- Boolean.valueOf(
- attributes.getValue("static")),
- Boolean.valueOf(
- attributes.getValue("final")),
- attributes.getValue("deprecated"),
- attributes.getValue("visibility"),
- SourcePositionInfo.fromXml(attributes.getValue("source")),
- mCurrentClass);
- mCurrentClass.addField(fInfo);
- } else if (qName.equals("parameter")) {
- mCurrentMethod.addParameter(new ParameterInfo(attributes.getValue("type"),
- attributes.getValue("name")));
- } else if (qName.equals("exception")) {
- mCurrentMethod.addException(attributes.getValue("type"));
- } else if (qName.equals("implements")) {
- mCurrentClass.addInterface(attributes.getValue("name"));
- }
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) {
- if (qName.equals("method")) {
- mCurrentClass.addMethod((MethodInfo) mCurrentMethod);
- } else if (qName.equals("constructor")) {
- mCurrentClass.addConstructor((ConstructorInfo) mCurrentMethod);
- } else if (qName.equals("class")
- || qName.equals("interface")) {
- mCurrentPackage.addClass(mCurrentClass);
- mCurrentClass = mClassScope.pop();
- } else if (qName.equals("package")){
- mApi.addPackage(mCurrentPackage);
- }
- }
- public ApiInfo getApi() {
- return mApi;
- }
- }
-}
diff --git a/tools/apicheck/src/com/android/apicheck/ApiInfo.java b/tools/apicheck/src/com/android/apicheck/ApiInfo.java
deleted file mode 100644
index c237814..0000000
--- a/tools/apicheck/src/com/android/apicheck/ApiInfo.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-import java.util.*;
-
-public class ApiInfo {
-
- private HashMap<String, PackageInfo> mPackages;
- private HashMap<String, ClassInfo> mAllClasses;
-
- public ApiInfo() {
- mPackages = new HashMap<String, PackageInfo>();
- mAllClasses = new HashMap<String, ClassInfo>();
- }
-
- public ClassInfo findClass(String name) {
- return mAllClasses.get(name);
- }
-
- private void resolveInterfaces() {
- for (ClassInfo c : mAllClasses.values()) {
- c.resolveInterfaces(this);
- }
- }
-
- public boolean isConsistent(ApiInfo otherApi) {
- resolveInterfaces();
- boolean consistent = true;
- for (PackageInfo pInfo : mPackages.values()) {
- if (otherApi.getPackages().containsKey(pInfo.name())) {
- if (!pInfo.isConsistent(otherApi.getPackages().get(pInfo.name()))) {
- consistent = false;
- }
- } else {
- Errors.error(Errors.REMOVED_PACKAGE, pInfo.position(),
- "Removed package " + pInfo.name());
- consistent = false;
- }
- }
- for (PackageInfo pInfo : otherApi.mPackages.values()) {
- if (!pInfo.isInBoth()) {
- Errors.error(Errors.ADDED_PACKAGE, pInfo.position(),
- "Added package " + pInfo.name());
- consistent = false;
- }
- }
- return consistent;
- }
-
- public HashMap<String, PackageInfo> getPackages() {
- return mPackages;
- }
-
- public void addPackage(PackageInfo pInfo) {
- // track the set of organized packages in the API
- mPackages.put(pInfo.name(), pInfo);
-
- // accumulate a direct map of all the classes in the API
- for (ClassInfo cl: pInfo.allClasses().values()) {
- mAllClasses.put(cl.qualifiedName(), cl);
- }
- }
-
- public void resolveSuperclasses() {
- for (ClassInfo cl: mAllClasses.values()) {
- // java.lang.Object has no superclass
- if (!cl.qualifiedName().equals("java.lang.Object")) {
- String scName = cl.superclassName();
- if (scName == null) {
- scName = "java.lang.Object";
- }
-
- ClassInfo superclass = mAllClasses.get(scName);
- cl.setSuperClass(superclass);
- }
- }
- }
-}
diff --git a/tools/apicheck/src/com/android/apicheck/ClassInfo.java b/tools/apicheck/src/com/android/apicheck/ClassInfo.java
deleted file mode 100644
index e62a3d0..0000000
--- a/tools/apicheck/src/com/android/apicheck/ClassInfo.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-import java.util.*;
-
-public class ClassInfo {
- private String mName;
- private String mSuperClassName;
- private boolean mIsInterface;
- private boolean mIsAbstract;
- private boolean mIsStatic;
- private boolean mIsFinal;
- private String mDeprecated;
- private String mScope;
- private List<String> mInterfaceNames;
- private List<ClassInfo> mInterfaces;
- private HashMap<String, MethodInfo> mMethods;
- private HashMap<String, FieldInfo> mFields;
- private HashMap<String, ConstructorInfo> mConstructors;
- private boolean mExistsInBoth;
- private PackageInfo mPackage;
- private SourcePositionInfo mSourcePosition;
- private ClassInfo mSuperClass;
- private ClassInfo mParentClass;
-
- public ClassInfo(String name, PackageInfo pack, String superClass, boolean isInterface,
- boolean isAbstract, boolean isStatic, boolean isFinal, String deprecated,
- String visibility, SourcePositionInfo source, ClassInfo parent) {
- mName = name;
- mPackage = pack;
- mSuperClassName = superClass;
- mIsInterface = isInterface;
- mIsAbstract = isAbstract;
- mIsStatic = isStatic;
- mIsFinal = isFinal;
- mDeprecated = deprecated;
- mScope = visibility;
- mInterfaceNames = new ArrayList<String>();
- mInterfaces = new ArrayList<ClassInfo>();
- mMethods = new HashMap<String, MethodInfo>();
- mFields = new HashMap<String, FieldInfo>();
- mConstructors = new HashMap<String, ConstructorInfo>();
- mExistsInBoth = false;
- mSourcePosition = source;
- mParentClass = parent;
- }
-
- public String name() {
- return mName;
- }
-
- public String qualifiedName() {
- String parentQName = (mParentClass != null)
- ? (mParentClass.qualifiedName() + ".")
- : "";
- return mPackage.name() + "." + parentQName + name();
- }
-
- public String superclassName() {
- return mSuperClassName;
- }
-
- public SourcePositionInfo position() {
- return mSourcePosition;
- }
-
- public boolean isInterface() {
- return mIsInterface;
- }
-
- public boolean isFinal() {
- return mIsFinal;
- }
-
- // Find a superclass implementation of the given method. Looking at our superclass
- // instead of at 'this' is unusual, but it fits the point-of-call demands well.
- public MethodInfo overriddenMethod(MethodInfo candidate) {
- if (mSuperClass == null) {
- return null;
- }
-
- // does our immediate superclass have it?
- ClassInfo sup = mSuperClass;
- for (MethodInfo mi : sup.mMethods.values()) {
- if (mi.matches(candidate)) {
- // found it
- return mi;
- }
- }
-
- // no, so recurse
- if (sup.mSuperClass != null) {
- return mSuperClass.overriddenMethod(candidate);
- }
-
- // no parent, so we just don't have it
- return null;
- }
-
- // Find a superinterface declaration of the given method.
- public MethodInfo interfaceMethod(MethodInfo candidate) {
- for (ClassInfo interfaceInfo : mInterfaces) {
- for (MethodInfo mi : interfaceInfo.mMethods.values()) {
- if (mi.matches(candidate)) {
- return mi;
- }
- }
- }
- return (mSuperClass != null) ? mSuperClass.interfaceMethod(candidate) : null;
- }
-
- public boolean isConsistent(ClassInfo cl) {
- cl.mExistsInBoth = true;
- mExistsInBoth = true;
- boolean consistent = true;
-
- if (isInterface() != cl.isInterface()) {
- Errors.error(Errors.CHANGED_CLASS, cl.position(),
- "Class " + cl.qualifiedName()
- + " changed class/interface declaration");
- consistent = false;
- }
- for (String iface : mInterfaceNames) {
- boolean found = false;
- for (ClassInfo c = cl; c != null && !found; c = c.mSuperClass) {
- found = c.mInterfaceNames.contains(iface);
- }
- if (!found) {
- Errors.error(Errors.REMOVED_INTERFACE, cl.position(),
- "Class " + qualifiedName() + " no longer implements " + iface);
- }
- }
- for (String iface : cl.mInterfaceNames) {
- if (!mInterfaceNames.contains(iface)) {
- Errors.error(Errors.ADDED_INTERFACE, cl.position(),
- "Added interface " + iface + " to class "
- + qualifiedName());
- consistent = false;
- }
- }
-
- for (MethodInfo mInfo : mMethods.values()) {
- if (cl.mMethods.containsKey(mInfo.getHashableName())) {
- if (!mInfo.isConsistent(cl.mMethods.get(mInfo.getHashableName()))) {
- consistent = false;
- }
- } else {
- /* This class formerly provided this method directly, and now does not.
- * Check our ancestry to see if there's an inherited version that still
- * fulfills the API requirement.
- */
- MethodInfo mi = mInfo.containingClass().overriddenMethod(mInfo);
- if (mi == null) {
- mi = mInfo.containingClass().interfaceMethod(mInfo);
- }
- if (mi == null) {
- Errors.error(Errors.REMOVED_METHOD, mInfo.position(),
- "Removed public method " + mInfo.qualifiedName());
- consistent = false;
- }
- }
- }
- for (MethodInfo mInfo : cl.mMethods.values()) {
- if (!mInfo.isInBoth()) {
- /* Similarly to the above, do not fail if this "new" method is
- * really an override of an existing superclass method.
- */
- MethodInfo mi = mInfo.containingClass().overriddenMethod(mInfo);
- if (mi == null) {
- Errors.error(Errors.ADDED_METHOD, mInfo.position(),
- "Added public method " + mInfo.qualifiedName());
- consistent = false;
- }
- }
- }
-
- for (ConstructorInfo mInfo : mConstructors.values()) {
- if (cl.mConstructors.containsKey(mInfo.getHashableName())) {
- if (!mInfo.isConsistent(cl.mConstructors.get(mInfo.getHashableName()))) {
- consistent = false;
- }
- } else {
- Errors.error(Errors.REMOVED_METHOD, mInfo.position(),
- "Removed public constructor " + mInfo.prettySignature());
- consistent = false;
- }
- }
- for (ConstructorInfo mInfo : cl.mConstructors.values()) {
- if (!mInfo.isInBoth()) {
- Errors.error(Errors.ADDED_METHOD, mInfo.position(),
- "Added public constructor " + mInfo.prettySignature());
- consistent = false;
- }
- }
-
- for (FieldInfo mInfo : mFields.values()) {
- if (cl.mFields.containsKey(mInfo.name())) {
- if (!mInfo.isConsistent(cl.mFields.get(mInfo.name()))) {
- consistent = false;
- }
- } else {
- Errors.error(Errors.REMOVED_FIELD, mInfo.position(),
- "Removed field " + mInfo.qualifiedName());
- consistent = false;
- }
- }
- for (FieldInfo mInfo : cl.mFields.values()) {
- if (!mInfo.isInBoth()) {
- Errors.error(Errors.ADDED_FIELD, mInfo.position(),
- "Added public field " + mInfo.qualifiedName());
- consistent = false;
- }
- }
-
- if (mIsAbstract != cl.mIsAbstract) {
- consistent = false;
- Errors.error(Errors.CHANGED_ABSTRACT, cl.position(),
- "Class " + cl.qualifiedName() + " changed abstract qualifier");
- }
-
- if (mIsFinal != cl.mIsFinal) {
- consistent = false;
- Errors.error(Errors.CHANGED_FINAL, cl.position(),
- "Class " + cl.qualifiedName() + " changed final qualifier");
- }
-
- if (mIsStatic != cl.mIsStatic) {
- consistent = false;
- Errors.error(Errors.CHANGED_STATIC, cl.position(),
- "Class " + cl.qualifiedName() + " changed static qualifier");
- }
-
- if (!mScope.equals(cl.mScope)) {
- consistent = false;
- Errors.error(Errors.CHANGED_SCOPE, cl.position(),
- "Class " + cl.qualifiedName() + " scope changed from "
- + mScope + " to " + cl.mScope);
- }
-
- if (!mDeprecated.equals(cl.mDeprecated)) {
- consistent = false;
- Errors.error(Errors.CHANGED_DEPRECATED, cl.position(),
- "Class " + cl.qualifiedName() + " has changed deprecation state");
- }
-
- if (mSuperClassName != null) {
- if (cl.mSuperClassName == null || !mSuperClassName.equals(cl.mSuperClassName)) {
- consistent = false;
- Errors.error(Errors.CHANGED_SUPERCLASS, cl.position(),
- "Class " + qualifiedName() + " superclass changed from "
- + mSuperClassName + " to " + cl.mSuperClassName);
- }
- } else if (cl.mSuperClassName != null) {
- consistent = false;
- Errors.error(Errors.CHANGED_SUPERCLASS, cl.position(),
- "Class " + qualifiedName() + " superclass changed from "
- + "null to " + cl.mSuperClassName);
- }
-
- return consistent;
- }
-
- public void resolveInterfaces(ApiInfo apiInfo) {
- for (String interfaceName : mInterfaceNames) {
- mInterfaces.add(apiInfo.findClass(interfaceName));
- }
- }
-
- public void addInterface(String name) {
- mInterfaceNames.add(name);
- }
-
- public void addMethod(MethodInfo mInfo) {
- mMethods.put(mInfo.getHashableName(), mInfo);
- }
-
- public void addConstructor(ConstructorInfo cInfo) {
- mConstructors.put(cInfo.getHashableName(), cInfo);
-
- }
-
- public void addField(FieldInfo fInfo) {
- mFields.put(fInfo.name(), fInfo);
-
- }
-
- public void setSuperClass(ClassInfo superclass) {
- mSuperClass = superclass;
- }
-
- public boolean isInBoth() {
- return mExistsInBoth;
- }
-
- public Map<String, ConstructorInfo> allConstructors() {
- return mConstructors;
- }
-
- public Map<String, FieldInfo> allFields() {
- return mFields;
- }
-
- public Map<String, MethodInfo> allMethods() {
- return mMethods;
- }
-
- /**
- * Returns the class hierarchy for this class, starting with this class.
- */
- public Iterable<ClassInfo> hierarchy() {
- List<ClassInfo> result = new ArrayList<ClassInfo>(4);
- for (ClassInfo c = this; c != null; c = c.mSuperClass) {
- result.add(c);
- }
- return result;
- }
-}
diff --git a/tools/apicheck/src/com/android/apicheck/ConstructorInfo.java b/tools/apicheck/src/com/android/apicheck/ConstructorInfo.java
deleted file mode 100644
index f36c7cd..0000000
--- a/tools/apicheck/src/com/android/apicheck/ConstructorInfo.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-import java.util.*;
-
-public class ConstructorInfo implements AbstractMethodInfo {
-
- private String mName;
- private String mType;
- private boolean mIsStatic;
- private boolean mIsFinal;
- private String mDeprecated;
- private String mScope;
- private List<String> mExceptions;
- private List<ParameterInfo> mParameters;
- private boolean mExistsInBoth;
- private SourcePositionInfo mSourcePosition;
- private ClassInfo mClass;
-
- public ConstructorInfo(String name, String type, boolean isStatic, boolean isFinal,
- String deprecated, String scope, SourcePositionInfo pos, ClassInfo clazz) {
- mName = name;
- mType = type;
- mIsStatic = isStatic;
- mIsFinal = isFinal;
- mDeprecated= deprecated;
- mScope = scope;
- mExistsInBoth = false;
- mExceptions = new ArrayList<String>();
- mParameters = new ArrayList<ParameterInfo>();
- mSourcePosition = pos;
- mClass = clazz;
- }
-
- public void addParameter(ParameterInfo pInfo) {
- mParameters.add(pInfo);
- }
-
- public void addException(String exec) {
- mExceptions.add(exec);
- }
-
- public String getHashableName() {
- StringBuilder result = new StringBuilder();
- result.append(name());
- for (ParameterInfo pInfo : mParameters) {
- result.append(":").append(pInfo.getType());
- }
- return result.toString();
- }
-
- public boolean isInBoth() {
- return mExistsInBoth;
- }
-
- public SourcePositionInfo position() {
- return mSourcePosition;
- }
-
- public String name() {
- return mName;
- }
-
- public String qualifiedName() {
- String baseName = (mClass != null)
- ? (mClass.qualifiedName() + ".")
- : "";
- return baseName + name();
- }
-
- public String prettySignature() {
- String params = "";
- for (ParameterInfo pInfo : mParameters) {
- if (params.length() > 0) {
- params += ", ";
- }
- params += pInfo.getType();
- }
- return qualifiedName() + '(' + params + ')';
- }
-
- public boolean isConsistent(ConstructorInfo mInfo) {
- mInfo.mExistsInBoth = true;
- mExistsInBoth = true;
- boolean consistent = true;
-
- if (mIsFinal != mInfo.mIsFinal) {
- consistent = false;
- Errors.error(Errors.CHANGED_FINAL, mInfo.position(),
- "Constructor " + mInfo.qualifiedName() + " has changed 'final' qualifier");
- }
-
- if (mIsStatic != mInfo.mIsStatic) {
- consistent = false;
- Errors.error(Errors.CHANGED_FINAL, mInfo.position(),
- "Constructor " + mInfo.qualifiedName() + " has changed 'static' qualifier");
- }
-
- if (!mScope.equals(mInfo.mScope)) {
- consistent = false;
- Errors.error(Errors.CHANGED_SCOPE, mInfo.position(),
- "Constructor " + mInfo.qualifiedName() + " changed scope from "
- + mScope + " to " + mInfo.mScope);
- }
-
- if (!mDeprecated.equals(mInfo.mDeprecated)) {
- consistent = false;
- Errors.error(Errors.CHANGED_DEPRECATED, mInfo.position(),
- "Constructor " + mInfo.qualifiedName() + " has changed deprecation state");
- }
-
- for (String exec : mExceptions) {
- if (!mInfo.mExceptions.contains(exec)) {
- Errors.error(Errors.CHANGED_THROWS, mInfo.position(),
- "Constructor " + mInfo.qualifiedName() + " no longer throws exception "
- + exec);
- consistent = false;
- }
- }
-
- for (String exec : mInfo.mExceptions) {
- if (!mExceptions.contains(exec)) {
- Errors.error(Errors.CHANGED_THROWS, mInfo.position(),
- "Constructor " + mInfo.qualifiedName() + " added thrown exception "
- + exec);
- consistent = false;
- }
- }
-
- return consistent;
- }
-
-
-}
diff --git a/tools/apicheck/src/com/android/apicheck/Errors.java b/tools/apicheck/src/com/android/apicheck/Errors.java
deleted file mode 100644
index b0b620e..0000000
--- a/tools/apicheck/src/com/android/apicheck/Errors.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-
-import java.lang.Comparable;
-import java.util.TreeSet;
-
-public class Errors
-{
- public static boolean hadError = false;
- private static boolean warningsAreErrors = false;
- private static TreeSet<Message> allErrors = new TreeSet<Message>();
-
- private static class Message implements Comparable {
- SourcePositionInfo pos;
- String msg;
-
- Message(SourcePositionInfo p, String m) {
- pos = p;
- msg = m;
- }
-
- public int compareTo(Object o) {
- Message that = (Message)o;
- int r = this.pos.compareTo(that.pos);
- if (r != 0) return r;
- return this.msg.compareTo(that.msg);
- }
-
- @Override
- public String toString() {
- return this.pos.toString() + this.msg;
- }
- }
-
- public static void error(Error error, SourcePositionInfo where, String text) {
- if (error.level == HIDDEN) {
- return;
- }
-
- String which = (!warningsAreErrors && error.level == WARNING) ? " warning " : " error ";
- String message = which + error.code + ": " + text;
-
- if (where == null) {
- where = new SourcePositionInfo("unknown", 0, 0);
- }
-
- allErrors.add(new Message(where, message));
-
- if (error.level == ERROR || (warningsAreErrors && error.level == WARNING)) {
- hadError = true;
- }
- }
-
- public static void printErrors() {
- for (Message m: allErrors) {
- System.err.println(m.toString());
- }
- }
-
- public static int HIDDEN = 0;
- public static int WARNING = 1;
- public static int ERROR = 2;
-
- public static void setWarningsAreErrors(boolean val) {
- warningsAreErrors = val;
- }
-
- public static class Error {
- public int code;
- public int level;
-
- public Error(int code, int level)
- {
- this.code = code;
- this.level = level;
- }
- }
-
- public static Error PARSE_ERROR = new Error(1, ERROR);
- public static Error ADDED_PACKAGE = new Error(2, WARNING);
- public static Error ADDED_CLASS = new Error(3, WARNING);
- public static Error ADDED_METHOD = new Error(4, WARNING);
- public static Error ADDED_FIELD = new Error(5, WARNING);
- public static Error ADDED_INTERFACE = new Error(6, WARNING);
- public static Error REMOVED_PACKAGE = new Error(7, WARNING);
- public static Error REMOVED_CLASS = new Error(8, WARNING);
- public static Error REMOVED_METHOD = new Error(9, WARNING);
- public static Error REMOVED_FIELD = new Error(10, WARNING);
- public static Error REMOVED_INTERFACE = new Error(11, WARNING);
- public static Error CHANGED_STATIC = new Error(12, WARNING);
- public static Error CHANGED_FINAL = new Error(13, WARNING);
- public static Error CHANGED_TRANSIENT = new Error(14, WARNING);
- public static Error CHANGED_VOLATILE = new Error(15, WARNING);
- public static Error CHANGED_TYPE = new Error(16, WARNING);
- public static Error CHANGED_VALUE = new Error(17, WARNING);
- public static Error CHANGED_SUPERCLASS = new Error(18, WARNING);
- public static Error CHANGED_SCOPE = new Error(19, WARNING);
- public static Error CHANGED_ABSTRACT = new Error(20, WARNING);
- public static Error CHANGED_THROWS = new Error(21, WARNING);
- public static Error CHANGED_NATIVE = new Error(22, HIDDEN);
- public static Error CHANGED_CLASS = new Error(23, WARNING);
- public static Error CHANGED_DEPRECATED = new Error(24, WARNING);
- public static Error CHANGED_SYNCHRONIZED = new Error(25, ERROR);
-
- public static Error[] ERRORS = {
- PARSE_ERROR,
- ADDED_PACKAGE,
- ADDED_CLASS,
- ADDED_METHOD,
- ADDED_FIELD,
- ADDED_INTERFACE,
- REMOVED_PACKAGE,
- REMOVED_CLASS,
- REMOVED_METHOD,
- REMOVED_FIELD,
- REMOVED_INTERFACE,
- CHANGED_STATIC,
- CHANGED_FINAL,
- CHANGED_TRANSIENT,
- CHANGED_VOLATILE,
- CHANGED_TYPE,
- CHANGED_VALUE,
- CHANGED_SUPERCLASS,
- CHANGED_SCOPE,
- CHANGED_ABSTRACT,
- CHANGED_THROWS,
- CHANGED_NATIVE,
- CHANGED_CLASS,
- CHANGED_DEPRECATED,
- CHANGED_SYNCHRONIZED,
- };
-
- public static boolean setErrorLevel(int code, int level) {
- for (Error e: ERRORS) {
- if (e.code == code) {
- e.level = level;
- return true;
- }
- }
- return false;
- }
-}
diff --git a/tools/apicheck/src/com/android/apicheck/FieldInfo.java b/tools/apicheck/src/com/android/apicheck/FieldInfo.java
deleted file mode 100644
index d80d9f6..0000000
--- a/tools/apicheck/src/com/android/apicheck/FieldInfo.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-
-public class FieldInfo {
-
- private String mName;
- private String mType;
- private boolean mIsTransient;
- private boolean mIsVolatile;
- private String mValue;
- private boolean mIsStatic;
- private boolean mIsFinal;
- private String mDeprecated;
- private String mScope;
- private boolean mExistsInBoth;
- private SourcePositionInfo mSourcePosition;
- private ClassInfo mClass;
-
- public FieldInfo (String name, String type, boolean isTransient, boolean isVolatile,
- String value, boolean isStatic, boolean isFinal, String deprecated,
- String scope, SourcePositionInfo source, ClassInfo parent) {
- mName = name;
- mType = type;
- mIsTransient = isTransient;
- mIsVolatile = isVolatile;
- mValue = value;
- mIsStatic = isStatic;
- mIsFinal = isFinal;
- mDeprecated = deprecated;
- mScope = scope;
- mExistsInBoth = false;
- mSourcePosition = source;
- mClass = parent;
- }
-
- public boolean isInBoth() {
- return mExistsInBoth;
- }
- public SourcePositionInfo position() {
- return mSourcePosition;
- }
-
- public String name() {
- return mName;
- }
-
- public String qualifiedName() {
- String parentQName = (mClass != null)
- ? (mClass.qualifiedName() + ".")
- : "";
- return parentQName + name();
- }
-
- // Check the declared value with a typed comparison, not a string comparison,
- // to accommodate toolchains with different fp -> string conversions.
- public boolean valueEquals(FieldInfo other) {
- // Type mismatch means nonequal, as does a null/non-null mismatch
- if (!mType.equals(other.mType)
- || ((mValue == null) != (other.mValue == null))) {
- return false;
- }
-
- // Null values are considered equal
- if (mValue == null) {
- return true;
- }
-
- // Floating point gets an implementation-type comparison; all others just use the string
- // If float/double parse fails, fall back to string comparison -- it means that it's a
- // canonical droiddoc-generated constant expression that represents a NaN.
- try {
- if (mType.equals("float")) {
- float val = Float.parseFloat(mValue);
- float otherVal = Float.parseFloat(other.mValue);
- return (val == otherVal);
- } else if (mType.equals("double")) {
- double val = Double.parseDouble(mValue);
- double otherVal = Double.parseDouble(other.mValue);
- return (val == otherVal);
- }
- } catch (NumberFormatException e) {
- // fall through
- }
-
- return mValue.equals(other.mValue);
- }
-
- public boolean isConsistent(FieldInfo fInfo) {
- fInfo.mExistsInBoth = true;
- mExistsInBoth = true;
- boolean consistent = true;
- if (!mType.equals(fInfo.mType)) {
- Errors.error(Errors.CHANGED_TYPE, fInfo.position(),
- "Field " + fInfo.qualifiedName() + " has changed type");
- consistent = false;
- }
-
- if (!this.valueEquals(fInfo)) {
- Errors.error(Errors.CHANGED_VALUE, fInfo.position(),
- "Field " + fInfo.qualifiedName() + " has changed value from "
- + mValue + " to " + fInfo.mValue);
- consistent = false;
- }
-
- if (!mScope.equals(fInfo.mScope)) {
- Errors.error(Errors.CHANGED_SCOPE, fInfo.position(),
- "Method " + fInfo.qualifiedName() + " changed scope from "
- + mScope + " to " + fInfo.mScope);
- consistent = false;
- }
-
- if (mIsStatic != fInfo.mIsStatic) {
- Errors.error(Errors.CHANGED_STATIC, fInfo.position(),
- "Field " + fInfo.qualifiedName() + " has changed 'static' qualifier");
- consistent = false;
- }
-
- if (mIsFinal != fInfo.mIsFinal) {
- Errors.error(Errors.CHANGED_FINAL, fInfo.position(),
- "Field " + fInfo.qualifiedName() + " has changed 'final' qualifier");
- consistent = false;
- }
-
- if (mIsTransient != fInfo.mIsTransient) {
- Errors.error(Errors.CHANGED_TRANSIENT, fInfo.position(),
- "Field " + fInfo.qualifiedName() + " has changed 'transient' qualifier");
- consistent = false;
- }
-
- if (mIsVolatile != fInfo.mIsVolatile) {
- Errors.error(Errors.CHANGED_VOLATILE, fInfo.position(),
- "Field " + fInfo.qualifiedName() + " has changed 'volatile' qualifier");
- consistent = false;
- }
-
- if (!mDeprecated.equals(fInfo.mDeprecated)) {
- Errors.error(Errors.CHANGED_DEPRECATED, fInfo.position(),
- "Field " + fInfo.qualifiedName() + " has changed deprecation state");
- consistent = false;
- }
-
- return consistent;
- }
-
-}
diff --git a/tools/apicheck/src/com/android/apicheck/MethodInfo.java b/tools/apicheck/src/com/android/apicheck/MethodInfo.java
deleted file mode 100644
index e4e4537..0000000
--- a/tools/apicheck/src/com/android/apicheck/MethodInfo.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-import java.util.*;
-
-public class MethodInfo implements AbstractMethodInfo {
-
- private String mName;
- private String mReturn;
- private boolean mIsAbstract;
- private boolean mIsNative;
- private boolean mIsSynchronized;
- private boolean mIsStatic;
- private boolean mIsFinal;
- private String mDeprecated;
- private String mScope;
- private boolean mExistsInBoth;
- private List<ParameterInfo> mParameters;
- private List<String> mExceptions;
- private SourcePositionInfo mSourcePosition;
- private ClassInfo mClass;
-
- public MethodInfo (String name, String returnType, boolean isAbstract, boolean isNative,
- boolean isSynchronized, boolean isStatic, boolean isFinal, String deprecated
- , String scope, SourcePositionInfo source, ClassInfo parent) {
-
- mName = name;
- mReturn = returnType;
- mIsAbstract = isAbstract;
- mIsNative = isNative;
- mIsSynchronized = isSynchronized;
- mIsStatic = isStatic;
- mIsFinal = isFinal;
- mDeprecated = deprecated;
- mScope = scope;
- mParameters = new ArrayList<ParameterInfo>();
- mExceptions = new ArrayList<String>();
- mExistsInBoth = false;
- mSourcePosition = source;
- mClass = parent;
- }
-
-
- public String name() {
- return mName;
- }
-
- public String qualifiedName() {
- String parentQName = (mClass != null)
- ? (mClass.qualifiedName() + ".")
- : "";
- return parentQName + name();
- }
-
- public String prettySignature() {
- String params = "";
- for (ParameterInfo pInfo : mParameters) {
- if (params.length() > 0) {
- params += ", ";
- }
- params += pInfo.getType();
- }
- return qualifiedName() + '(' + params + ')';
- }
-
- public SourcePositionInfo position() {
- return mSourcePosition;
- }
-
- public ClassInfo containingClass() {
- return mClass;
- }
-
- public boolean matches(MethodInfo other) {
- return getSignature().equals(other.getSignature());
- }
-
- public boolean isConsistent(MethodInfo mInfo) {
- mInfo.mExistsInBoth = true;
- mExistsInBoth = true;
- boolean consistent = true;
- if (!mReturn.equals(mInfo.mReturn)) {
- consistent = false;
- Errors.error(Errors.CHANGED_TYPE, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " has changed return type from "
- + mReturn + " to " + mInfo.mReturn);
- }
-
- if (mIsAbstract != mInfo.mIsAbstract) {
- consistent = false;
- Errors.error(Errors.CHANGED_ABSTRACT, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " has changed 'abstract' qualifier");
- }
-
- if (mIsNative != mInfo.mIsNative) {
- consistent = false;
- Errors.error(Errors.CHANGED_NATIVE, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " has changed 'native' qualifier");
- }
-
- if (mIsFinal != mInfo.mIsFinal) {
- // Compiler-generated methods vary in their 'final' qual between versions of
- // the compiler, so this check needs to be quite narrow. A change in 'final'
- // status of a method is only relevant if (a) the method is not declared 'static'
- // and (b) the method's class is not itself 'final'.
- if (!mIsStatic) {
- if ((mClass == null) || (!mClass.isFinal())) {
- consistent = false;
- Errors.error(Errors.CHANGED_FINAL, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " has changed 'final' qualifier");
- }
- }
- }
-
- if (mIsStatic != mInfo.mIsStatic) {
- consistent = false;
- Errors.error(Errors.CHANGED_STATIC, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " has changed 'static' qualifier");
- }
-
- if (!mScope.equals(mInfo.mScope)) {
- consistent = false;
- Errors.error(Errors.CHANGED_SCOPE, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " changed scope from "
- + mScope + " to " + mInfo.mScope);
- }
-
- if (!mDeprecated.equals(mInfo.mDeprecated)) {
- Errors.error(Errors.CHANGED_DEPRECATED, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " has changed deprecation state");
- consistent = false;
- }
-
- if (mIsSynchronized != mInfo.mIsSynchronized) {
- Errors.error(Errors.CHANGED_SYNCHRONIZED, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " has changed 'synchronized' qualifier from " + mIsSynchronized + " to " + mInfo.mIsSynchronized);
- consistent = false;
- }
-
- for (String exec : mExceptions) {
- if (!mInfo.mExceptions.contains(exec)) {
- // exclude 'throws' changes to finalize() overrides with no arguments
- if (!name().equals("finalize") || (mParameters.size() > 0)) {
- Errors.error(Errors.CHANGED_THROWS, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " no longer throws exception "
- + exec);
- consistent = false;
- }
- }
- }
-
- for (String exec : mInfo.mExceptions) {
- // exclude 'throws' changes to finalize() overrides with no arguments
- if (!mExceptions.contains(exec)) {
- if (!name().equals("finalize") || (mParameters.size() > 0)) {
- Errors.error(Errors.CHANGED_THROWS, mInfo.position(),
- "Method " + mInfo.qualifiedName() + " added thrown exception "
- + exec);
- consistent = false;
- }
- }
- }
-
- return consistent;
- }
-
- public void addParameter(ParameterInfo pInfo) {
- mParameters.add(pInfo);
- }
-
- public void addException(String exc) {
- mExceptions.add(exc);
- }
-
- public String getParameterHash() {
- String hash = "";
- for (ParameterInfo pInfo : mParameters) {
- hash += ":" + pInfo.getType();
- }
- return hash;
- }
-
- public String getHashableName() {
- return name() + getParameterHash();
- }
-
- public String getSignature() {
- return name() + getParameterHash();
- }
-
- public boolean isInBoth() {
- return mExistsInBoth;
- }
-
-}
diff --git a/tools/apicheck/src/com/android/apicheck/PackageInfo.java b/tools/apicheck/src/com/android/apicheck/PackageInfo.java
deleted file mode 100644
index 2262f21..0000000
--- a/tools/apicheck/src/com/android/apicheck/PackageInfo.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-import java.util.*;
-
-public class PackageInfo {
- private String mName;
- private HashMap<String, ClassInfo> mClasses;
- private boolean mExistsInBoth;
- private SourcePositionInfo mPosition;
-
- public PackageInfo(String name, SourcePositionInfo position) {
- mName = name;
- mClasses = new HashMap<String, ClassInfo>();
- mExistsInBoth = false;
- mPosition = position;
- }
-
- public void addClass(ClassInfo cl) {
- mClasses.put(cl.name() , cl);
- }
-
- public HashMap<String, ClassInfo> allClasses() {
- return mClasses;
- }
-
- public String name() {
- return mName;
- }
-
- public SourcePositionInfo position() {
- return mPosition;
- }
-
- public boolean isConsistent(PackageInfo pInfo) {
- mExistsInBoth = true;
- pInfo.mExistsInBoth = true;
- boolean consistent = true;
- for (ClassInfo cInfo : mClasses.values()) {
- if (pInfo.mClasses.containsKey(cInfo.name())) {
- if (!cInfo.isConsistent(pInfo.mClasses.get(cInfo.name()))) {
- consistent = false;
- }
- } else {
- Errors.error(Errors.REMOVED_CLASS, cInfo.position(),
- "Removed public class " + cInfo.qualifiedName());
- consistent = false;
- }
- }
- for (ClassInfo cInfo : pInfo.mClasses.values()) {
- if (!cInfo.isInBoth()) {
- Errors.error(Errors.ADDED_CLASS, cInfo.position(),
- "Added class " + cInfo.name() + " to package "
- + pInfo.name());
- consistent = false;
- }
- }
- return consistent;
- }
-
- public boolean isInBoth() {
- return mExistsInBoth;
- }
-}
diff --git a/tools/apicheck/src/com/android/apicheck/ParameterInfo.java b/tools/apicheck/src/com/android/apicheck/ParameterInfo.java
deleted file mode 100644
index 5788814..0000000
--- a/tools/apicheck/src/com/android/apicheck/ParameterInfo.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-
-public class ParameterInfo {
- private String mType;
- private String mName;
-
- public ParameterInfo(String type, String name) {
- mType = type;
- mName = name;
- }
-
- public String getType() {
- return mType;
- }
-
- public String getName() {
- return mName;
- }
-}
diff --git a/tools/apicheck/src/com/android/apicheck/SourcePositionInfo.java b/tools/apicheck/src/com/android/apicheck/SourcePositionInfo.java
deleted file mode 100644
index 276771b..0000000
--- a/tools/apicheck/src/com/android/apicheck/SourcePositionInfo.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.apicheck;
-
-import java.lang.Comparable;
-
-public class SourcePositionInfo implements Comparable
-{
- public SourcePositionInfo() {
- this.file = "<unknown>";
- this.line = 0;
- this.column = 0;
- }
-
- public SourcePositionInfo(String file, int line, int column)
- {
- this.file = file;
- this.line = line;
- this.column = column;
- }
-
- public SourcePositionInfo(SourcePositionInfo that)
- {
- this.file = that.file;
- this.line = that.line;
- this.column = that.column;
- }
-
- /**
- * Given this position and str which occurs at that position, as well as str an index into str,
- * find the SourcePositionInfo.
- *
- * @throw StringIndexOutOfBoundsException if index > str.length()
- */
- public static SourcePositionInfo add(SourcePositionInfo that, String str, int index)
- {
- if (that == null) {
- return null;
- }
- int line = that.line;
- char prev = 0;
- for (int i=0; i<index; i++) {
- char c = str.charAt(i);
- if (c == '\r' || (c == '\n' && prev != '\r')) {
- line++;
- }
- prev = c;
- }
- return new SourcePositionInfo(that.file, line, 0);
- }
-
- public static SourcePositionInfo findBeginning(SourcePositionInfo that, String str)
- {
- if (that == null) {
- return null;
- }
- int line = that.line-1; // -1 because, well, it seems to work
- int prev = 0;
- for (int i=str.length()-1; i>=0; i--) {
- char c = str.charAt(i);
- if ((c == '\r' && prev != '\n') || (c == '\n')) {
- line--;
- }
- prev = c;
- }
- return new SourcePositionInfo(that.file, line, 0);
- }
-
- @Override
- public String toString()
- {
- if (this.file == null) {
- return "(unknown)";
- } else {
- if (this.line == 0) {
- return this.file + ':';
- } else {
- return this.file + ':' + this.line + ':';
- }
- }
- }
-
- public int compareTo(Object o) {
- SourcePositionInfo that = (SourcePositionInfo)o;
- int r = this.file.compareTo(that.file);
- if (r != 0) return r;
- return this.line - that.line;
- }
-
- /**
- * Build a SourcePositionInfo from the XML source= notation
- */
- public static SourcePositionInfo fromXml(String source) {
- if (source != null) {
- for (int i = 0; i < source.length(); i++) {
- if (source.charAt(i) == ':') {
- return new SourcePositionInfo(source.substring(0, i),
- Integer.parseInt(source.substring(i+1)), 0);
- }
- }
- }
-
- return new SourcePositionInfo("(unknown)", 0, 0);
- }
-
- public String file;
- public int line;
- public int column;
-}
diff --git a/tools/apriori/apriori.c b/tools/apriori/apriori.c
index d1807b3..b827375 100644
--- a/tools/apriori/apriori.c
+++ b/tools/apriori/apriori.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include <common.h>
#include <debug.h>
#include <libelf.h>
@@ -54,6 +55,154 @@
static source_t *sources = NULL;
+/* Retouch data is a very concise representation of the resolved relocations.
+ This data is used to randomize the location of prelinked libraries at
+ update time, on the device.
+ */
+
+// We will store retouch entries into this buffer, then dump them at the
+// end of the .so file before setup_prelink_info().
+#define RETOUCH_MAX_SIZE 600000
+static char *retouch_buf;
+static unsigned int retouch_byte_cnt;
+// Compression state.
+static int32_t offs_prev;
+static uint32_t cont_prev;
+
+#define false 0
+#define true 1
+
+void retouch_init(void) {
+ offs_prev = 0;
+ cont_prev = 0;
+ retouch_byte_cnt = 0;
+ retouch_buf = malloc(RETOUCH_MAX_SIZE+12);
+ FAILIF(retouch_buf == NULL,
+ "Could not allocate %d bytes.\n", RETOUCH_MAX_SIZE+12);
+}
+
+//
+// We use three encoding schemes; this takes care of much of the redundancy
+// inherent in lists of relocations:
+//
+// * two bytes, leading 1, 2b for d_offset ("s"), 13b for d_contents ("c")
+//
+// 76543210 76543210
+// 1ssccccc cccccccc
+//
+// * three bytes, leading 01, 2b for delta offset, 20b for delta contents
+//
+// 76543210 76543210 76543210
+// 01sscccc cccccccc cccccccc
+//
+// * eigth bytes, leading 00, 30b for offset, 32b for contents
+//
+// 76543210 76543210 76543210 76543210
+// 00ssssss ssssssss ssssssss ssssssss + 4 bytes contents
+//
+// NOTE 1: All deltas are w.r.t. the previous line in the list.
+// NOTE 2: Two-bit ("ss") offsets mean: "00"=4, "01"=8, "10"=12, and "11"=16.
+// NOTE 3: Delta contents are signed. To map back to a int32 we refill with 1s.
+// NOTE 4: Special encoding for -1 offset. Extended back to 32b when decoded.
+//
+
+void retouch_encode(int32_t offset, uint32_t contents) {
+ int64_t d_offs = offset-offs_prev;
+ int64_t d_cont = (int64_t)contents-(int64_t)cont_prev;
+
+ uint8_t output[8];
+ uint32_t output_size;
+
+ if ((d_offs > 3) &&
+ (d_offs % 4) == 0 &&
+ (d_offs / 4) < 5 &&
+ (d_cont < 4000) &&
+ (d_cont > -4000)) {
+ // we can fit in 2 bytes
+ output[0] =
+ 0x80 |
+ (((d_offs/4)-1) << 5) |
+ (((uint64_t)d_cont & 0x1f00) >> 8);
+ output[1] =
+ ((uint64_t)d_cont & 0xff);
+ output_size = 2;
+ } else if ((d_offs > 3) &&
+ (d_offs % 4) == 0 &&
+ (d_offs / 4) < 5 &&
+ (d_cont < 510000) &&
+ (d_cont > -510000)) {
+ // fit in 3 bytes
+ output[0] =
+ 0x40 |
+ (((d_offs/4)-1) << 4) |
+ (((uint64_t)d_cont & 0xf0000) >> 16);
+ output[1] =
+ ((uint64_t)d_cont & 0xff00) >> 8;
+ output[2] =
+ ((uint64_t)d_cont & 0xff);
+ output_size = 3;
+ } else {
+ // fit in 8 bytes; we can't support files bigger than (1GB-1)
+ // with this encoding: no library is that big anyway..
+ FAILIF(offset < -1 || offset > 0x3ffffffe, "Offset out of range.\n");
+ output[0] = (offset & 0x3f000000) >> 24;
+ output[1] = (offset & 0xff0000) >> 16;
+ output[2] = (offset & 0xff00) >> 8;
+ output[3] = (offset & 0xff);
+ output[4] = (contents & 0xff000000) >> 24;
+ output[5] = (contents & 0xff0000) >> 16;
+ output[6] = (contents & 0xff00) >> 8;
+ output[7] = (contents & 0xff);
+ output_size = 8;
+ }
+
+ // If this happens, the retouch buffer size can be bumped up.
+ // Currently, the largest case is libwebcore, at about 250K.
+ FAILIF((retouch_byte_cnt+output_size) > RETOUCH_MAX_SIZE,
+ "About to overflow retouch buffer.\n");
+
+ memcpy(retouch_buf+retouch_byte_cnt, output, output_size);
+ retouch_byte_cnt += output_size;
+
+ offs_prev = offset;
+ cont_prev = contents;
+}
+
+void retouch_dump(const char *fname, int elf_little,
+ unsigned int retouch_byte_cnt, char *retouch_buf) {
+ int fd = open(fname, O_WRONLY);
+ FAILIF(fd < 0,
+ "open(%s, O_WRONLY): %s (%d)\n" ,
+ fname, strerror(errno), errno);
+ off_t sz = lseek(fd, 0, SEEK_END);
+ FAILIF(sz == (off_t)-1,
+ "lseek(%d, 0, SEEK_END): %s (%d)!\n",
+ fd, strerror(errno), errno);
+
+ // The retouch blob ends with "RETOUCH XXXX", where XXXX is the 4-byte
+ // size of the retouch blob, in target endianness.
+ strncpy(retouch_buf+retouch_byte_cnt, "RETOUCH ", 8);
+ if (elf_little ^ is_host_little()) {
+ *(unsigned int *)(retouch_buf+retouch_byte_cnt+8) =
+ switch_endianness(retouch_byte_cnt);
+ } else {
+ *(unsigned int *)(retouch_buf+retouch_byte_cnt+8) =
+ retouch_byte_cnt;
+ }
+
+ int num_written = write(fd, retouch_buf, retouch_byte_cnt+12);
+ FAILIF(num_written < 0,
+ "write(%d, &info, sizeof(info)): %s (%d)\n",
+ fd, strerror(errno), errno);
+ FAILIF((retouch_byte_cnt+12) != num_written,
+ "Could not write %d bytes as expected (wrote %d bytes instead)!\n",
+ retouch_byte_cnt, num_written);
+ FAILIF(close(fd) < 0, "close(%d): %s (%d)!\n", fd, strerror(errno), errno);
+}
+
+/* End of retouch code.
+ */
+
#if defined(DEBUG) && 0
static void print_shdr(source_t *source, Elf_Scn *scn)
@@ -325,6 +474,9 @@
basename(source->name));
}
+ /* Save some of the info; needed for retouching (ASLR). */
+ retouch_init();
+
source->newelf_fd = open(source->output,
O_RDWR | O_CREAT,
0666);
@@ -615,15 +767,15 @@
strerror(errno),
errno);
- FAILIF(fstat(source->elf_fd, &source->elf_file_info) < 0,
- "fstat(%s(fd %d)): %s (%d)\n",
- source->name,
- source->elf_fd,
- strerror(errno),
- errno);
- INFO("File [%s]'s size is %lld bytes!\n",
- source->name,
- source->elf_file_info.st_size);
+ FAILIF(fstat(source->elf_fd, &source->elf_file_info) < 0,
+ "fstat(%s(fd %d)): %s (%d)\n",
+ source->name,
+ source->elf_fd,
+ strerror(errno),
+ errno);
+ INFO("File [%s]'s size is %lld bytes!\n",
+ source->name,
+ source->elf_file_info.st_size);
INFO("Calling elf_begin(%s)...\n", full_path);
@@ -775,6 +927,11 @@
function setup_prelink_info() below. */
INFO("%s: setting up prelink tag at end of file.\n",
source->output ? source->output : source->name);
+ retouch_encode(-1, source->base);
+ retouch_dump(source->output ? source->output : source->name,
+ source->elf_hdr.e_ident[EI_DATA] == ELFDATA2LSB,
+ retouch_byte_cnt,
+ retouch_buf);
setup_prelink_info(source->output ? source->output : source->name,
source->elf_hdr.e_ident[EI_DATA] == ELFDATA2LSB,
source->base);
@@ -785,6 +942,7 @@
#endif/*SUPPORT_ANDROID_PRELINK_TAGS*/
do_destroy_source(source);
+ if (retouch_buf != NULL) { free(retouch_buf); retouch_buf = NULL; }
if (source->shstrtab_data != NULL)
FREEIF(source->shstrtab_data->d_buf); /* adjust_elf */
@@ -1226,8 +1384,11 @@
rel->r_offset,
found_sym->st_value,
sym_source->base);
- if (!dry_run)
+ if (!dry_run) {
+ PRINT("WARNING: Relocation type not supported "
+ "for retouching!");
*dest = found_sym->st_value + sym_source->base;
+ }
}
num_relocations++;
break;
@@ -1240,8 +1401,15 @@
sname,
symname ?: "(symbol has no name)",
rel->r_offset, *dest, source->base);
- if (!dry_run)
+ if (!dry_run) {
*dest += source->base;
+
+ /* Output an entry for the ASLR touch-up process. */
+ retouch_encode(rel->r_offset
+ -shdr_mem.sh_addr
+ +shdr_mem.sh_offset,
+ *dest);
+ }
num_relocations++;
break;
case R_ARM_COPY:
@@ -1352,15 +1520,21 @@
ASSERT(data->d_buf != NULL);
ASSERT(data->d_size >= rel->r_offset -
shdr_mem.sh_addr);
- if (!dry_run)
- memcpy(dest, src, found_sym->st_size);
+ if (!dry_run) {
+ PRINT("WARNING: Relocation type not supported "
+ "for retouching!");
+ memcpy(dest, src, found_sym->st_size);
+ }
}
else {
ASSERT(src == NULL);
ASSERT(elf_ndxscn(src_scn) ==
elf_ndxscn(sym_source->bss.scn));
- if (!dry_run)
- memset(dest, 0, found_sym->st_size);
+ if (!dry_run) {
+ PRINT("WARNING: Relocation type not supported "
+ "for retouching!");
+ memset(dest, 0, found_sym->st_size);
+ }
}
}
}
diff --git a/tools/apriori/source.h b/tools/apriori/source.h
index a5d96bd..5381a29 100644
--- a/tools/apriori/source.h
+++ b/tools/apriori/source.h
@@ -62,7 +62,8 @@
Elf_Data *shstrtab_data;
int elf_fd;
int newelf_fd; /* fd of output file, -1 if output == NULL */
- struct stat elf_file_info;
+ int newelf_relo_fd; /* fd of relocaion output file */
+ struct stat elf_file_info;
GElf_Ehdr elf_hdr, oldelf_hdr;
size_t shstrndx;
int shnum; /* number of sections */
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index 6c85149..e3fe99c 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -25,8 +25,12 @@
echo "ro.product.cpu.abi2=$TARGET_CPU_ABI2"
fi
echo "ro.product.manufacturer=$PRODUCT_MANUFACTURER"
-echo "ro.product.locale.language=$PRODUCT_DEFAULT_LANGUAGE"
-echo "ro.product.locale.region=$PRODUCT_DEFAULT_REGION"
+if [ -n "$PRODUCT_DEFAULT_LANGUAGE" ] ; then
+ echo "ro.product.locale.language=$PRODUCT_DEFAULT_LANGUAGE"
+fi
+if [ -n "$PRODUCT_DEFAULT_REGION" ] ; then
+ echo "ro.product.locale.region=$PRODUCT_DEFAULT_REGION"
+fi
echo "ro.wifi.channels=$PRODUCT_DEFAULT_WIFI_CHANNELS"
echo "ro.board.platform=$TARGET_BOARD_PLATFORM"
@@ -36,5 +40,6 @@
echo "# Do not try to parse ro.build.description or .fingerprint"
echo "ro.build.description=$PRIVATE_BUILD_DESC"
echo "ro.build.fingerprint=$BUILD_FINGERPRINT"
+echo "ro.build.characteristics=$TARGET_AAPT_CHARACTERISTICS"
echo "# end build properties"
diff --git a/tools/droiddoc/Android.mk b/tools/droiddoc/Android.mk
index d2d7a95..ff08edc 100644
--- a/tools/droiddoc/Android.mk
+++ b/tools/droiddoc/Android.mk
@@ -14,5 +14,4 @@
LOCAL_PATH := $(call my-dir)
-include $(LOCAL_PATH)/src/Android.mk
-
+# Droiddoc is now Doclava -- See external/doclava.
diff --git a/tools/droiddoc/NOTICE b/tools/droiddoc/NOTICE
deleted file mode 100644
index 3f1b1bb..0000000
--- a/tools/droiddoc/NOTICE
+++ /dev/null
@@ -1,45 +0,0 @@
-
-Copyright (C) 2008 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-
-======================================================================
-
-jQuery 1.2.6 - New Wave Javascript
-
-Copyright (c) 2008 John Resig (jquery.com)
-Dual licensed under the MIT (MIT-LICENSE.txt)
-and GPL (GPL-LICENSE.txt) licenses.
-
-Copyright (c) 2009 John Resig, http://jquery.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/tools/droiddoc/src/Android.mk b/tools/droiddoc/src/Android.mk
deleted file mode 100644
index 30270b5..0000000
--- a/tools/droiddoc/src/Android.mk
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- AnnotationInstanceInfo.java \
- AnnotationValueInfo.java \
- AttributeInfo.java \
- AttrTagInfo.java \
- ClassInfo.java \
- DroidDoc.java \
- ClearPage.java \
- Comment.java \
- ContainerInfo.java \
- Converter.java \
- DocFile.java \
- DocInfo.java \
- Errors.java \
- FieldInfo.java \
- Hierarchy.java \
- InheritedTags.java \
- KeywordEntry.java \
- LinkReference.java \
- LiteralTagInfo.java \
- MemberInfo.java \
- MethodInfo.java \
- NavTree.java \
- PackageInfo.java \
- ParamTagInfo.java \
- ParameterInfo.java \
- ParsedTagInfo.java \
- Proofread.java \
- SampleCode.java \
- SampleTagInfo.java \
- Scoped.java \
- SeeTagInfo.java \
- SinceTagger.java \
- Sorter.java \
- SourcePositionInfo.java \
- Stubs.java \
- TagInfo.java \
- TextTagInfo.java \
- ThrowsTagInfo.java \
- TodoFile.java \
- TypeInfo.java
-
-LOCAL_JAVA_LIBRARIES := \
- apicheck \
- clearsilver
-
-LOCAL_CLASSPATH := \
- $(HOST_JDK_TOOLS_JAR)
-
-LOCAL_MODULE:= droiddoc
-
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/droiddoc/src/AnnotationInstanceInfo.java b/tools/droiddoc/src/AnnotationInstanceInfo.java
deleted file mode 100644
index c4abc7e..0000000
--- a/tools/droiddoc/src/AnnotationInstanceInfo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class AnnotationInstanceInfo
-{
- private ClassInfo mType;
- private AnnotationValueInfo[] mElementValues;
-
- public AnnotationInstanceInfo(ClassInfo type, AnnotationValueInfo[] elementValues)
- {
- mType = type;
- mElementValues = elementValues;
- }
-
- ClassInfo type()
- {
- return mType;
- }
-
- AnnotationValueInfo[] elementValues()
- {
- return mElementValues;
- }
-
- @Override
- public String toString()
- {
- StringBuilder str = new StringBuilder();
- str.append("@");
- str.append(mType.qualifiedName());
- str.append("(");
- AnnotationValueInfo[] values = mElementValues;
- final int N = values.length;
- for (int i=0; i<N; i++) {
- AnnotationValueInfo value = values[i];
- str.append(value.element().name());
- str.append("=");
- str.append(value.valueString());
- if (i != N-1) {
- str.append(",");
- }
- }
- str.append(")");
- return str.toString();
- }
-}
-
diff --git a/tools/droiddoc/src/AnnotationValueInfo.java b/tools/droiddoc/src/AnnotationValueInfo.java
deleted file mode 100644
index a2d869a..0000000
--- a/tools/droiddoc/src/AnnotationValueInfo.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class AnnotationValueInfo
-{
- private Object mValue;
- private String mString;
- private MethodInfo mElement;
-
- public AnnotationValueInfo(MethodInfo element)
- {
- mElement = element;
- }
-
- public void init(Object value)
- {
- mValue = value;
- }
-
- public MethodInfo element()
- {
- return mElement;
- }
-
- public Object value()
- {
- return mValue;
- }
-
- public String valueString()
- {
- Object v = mValue;
- if (v instanceof TypeInfo) {
- return ((TypeInfo)v).fullName();
- }
- else if (v instanceof FieldInfo) {
- StringBuilder str = new StringBuilder();
- FieldInfo f = (FieldInfo)v;
- str.append(f.containingClass().qualifiedName());
- str.append('.');
- str.append(f.name());
- return str.toString();
- }
- else if (v instanceof AnnotationInstanceInfo) {
- return v.toString();
- }
- else if (v instanceof AnnotationValueInfo[]) {
- StringBuilder str = new StringBuilder();
- AnnotationValueInfo[] array = (AnnotationValueInfo[])v;
- final int N = array.length;
- str.append("{");
- for (int i=0; i<array.length; i++) {
- str.append(array[i].valueString());
- if (i != N-1) {
- str.append(",");
- }
- }
- str.append("}");
- return str.toString();
- }
- else {
- return FieldInfo.constantLiteralValue(v);
- }
- }
-}
-
diff --git a/tools/droiddoc/src/AttrTagInfo.java b/tools/droiddoc/src/AttrTagInfo.java
deleted file mode 100644
index 7f1b4d9..0000000
--- a/tools/droiddoc/src/AttrTagInfo.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-
-
-public class AttrTagInfo extends TagInfo
-{
- private static final String REF_COMMAND = "ref";
- private static final String NAME_COMMAND = "name";
- private static final String DESCRIPTION_COMMAND = "description";
- private static final Pattern TEXT = Pattern.compile("(\\S+)\\s*(.*)", Pattern.DOTALL);
- private static final Pattern NAME_TEXT = Pattern.compile("(\\S+)(.*)",
- Pattern.DOTALL);
-
- private ContainerInfo mBase;
- private String mCommand;
-
- // if mCommand == "ref"
- private FieldInfo mRefField;
- private AttributeInfo mAttrInfo;
-
- // if mCommand == "name"
- private String mAttrName;
-
- // if mCommand == "description"
- private Comment mDescrComment;
-
- AttrTagInfo(String name, String kind, String text, ContainerInfo base,
- SourcePositionInfo position)
- {
- super(name, kind, text, position);
- mBase = base;
-
- parse(text, base, position);
- }
-
- void parse(String text, ContainerInfo base, SourcePositionInfo position) {
- Matcher m;
-
- m = TEXT.matcher(text);
- if (!m.matches()) {
- Errors.error(Errors.BAD_ATTR_TAG, position, "Bad @attr tag: " + text);
- return;
- }
-
- String command = m.group(1);
- String more = m.group(2);
-
- if (REF_COMMAND.equals(command)) {
- String ref = more.trim();
- LinkReference linkRef = LinkReference.parse(ref, mBase, position, false);
- if (!linkRef.good) {
- Errors.error(Errors.BAD_ATTR_TAG, position, "Unresolved @attr ref: " + ref);
- return;
- }
- if (!(linkRef.memberInfo instanceof FieldInfo)) {
- Errors.error(Errors.BAD_ATTR_TAG, position, "@attr must be a field: " + ref);
- return;
- }
- mCommand = command;
- mRefField = (FieldInfo)linkRef.memberInfo;
- }
- else if (NAME_COMMAND.equals(command)) {
- m = NAME_TEXT.matcher(more);
- if (!m.matches() || m.group(2).trim().length() != 0) {
- Errors.error(Errors.BAD_ATTR_TAG, position, "Bad @attr name tag: " + more);
- return;
- }
- mCommand = command;
- mAttrName = m.group(1);
- }
- else if (DESCRIPTION_COMMAND.equals(command)) {
- mCommand = command;
- mDescrComment = new Comment(more, base, position);
- }
- else {
- Errors.error(Errors.BAD_ATTR_TAG, position, "Bad @attr command: " + command);
- }
- }
-
- public FieldInfo reference() {
- return REF_COMMAND.equals(mCommand) ? mRefField : null;
- }
-
- @Override
- public String name() {
- return NAME_COMMAND.equals(mCommand) ? mAttrName : null;
- }
-
- public Comment description() {
- return DESCRIPTION_COMMAND.equals(mCommand) ? mDescrComment : null;
- }
-
- @Override
- public void makeHDF(HDF data, String base)
- {
- super.makeHDF(data, base);
- }
-
- public void setAttribute(AttributeInfo info) {
- mAttrInfo = info;
- }
-
- public static void makeReferenceHDF(HDF data, String base, AttrTagInfo[] tags)
- {
- int i=0;
- for (AttrTagInfo t: tags) {
- if (REF_COMMAND.equals(t.mCommand)) {
- if (t.mAttrInfo == null) {
- String msg = "ERROR: unlinked attr: " + t.mRefField.name();
- if (false) {
- System.out.println(msg);
- } else {
- throw new RuntimeException(msg);
- }
- } else {
- data.setValue(base + "." + i + ".name", t.mAttrInfo.name());
- data.setValue(base + "." + i + ".href", t.mAttrInfo.htmlPage());
- i++;
- }
- }
- }
- }
-
-}
diff --git a/tools/droiddoc/src/AttributeInfo.java b/tools/droiddoc/src/AttributeInfo.java
deleted file mode 100644
index a24106b..0000000
--- a/tools/droiddoc/src/AttributeInfo.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Comparator;
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-
-public class AttributeInfo {
- public static final Comparator<AttributeInfo> comparator = new Comparator<AttributeInfo>() {
- public int compare(AttributeInfo a, AttributeInfo b) {
- return a.name().compareTo(b.name());
- }
- };
-
- public FieldInfo attrField;
- public ArrayList<MethodInfo> methods = new ArrayList<MethodInfo>();
-
- private ClassInfo mClass;
- private String mName;
- private Comment mComment;
-
- public AttributeInfo(ClassInfo cl, FieldInfo f) {
- mClass = cl;
- attrField = f;
- }
-
- public String name() {
- if (mName == null) {
- for (AttrTagInfo comment: attrField.comment().attrTags()) {
- String n = comment.name();
- if (n != null) {
- mName = n;
- return n;
- }
- }
- }
- return mName;
- }
-
- public Comment comment() {
- if (mComment == null) {
- for (AttrTagInfo attr: attrField.comment().attrTags()) {
- Comment c = attr.description();
- if (c != null) {
- mComment = c;
- return c;
- }
- }
- }
- if (mComment == null) {
- return new Comment("", mClass, new SourcePositionInfo());
- }
- return mComment;
- }
-
- public String anchor() {
- return "attr_" + name();
- }
- public String htmlPage() {
- return mClass.htmlPage() + "#" + anchor();
- }
-
- public void makeHDF(HDF data, String base) {
- data.setValue(base + ".name", name());
- data.setValue(base + ".anchor", anchor());
- data.setValue(base + ".href", htmlPage());
- data.setValue(base + ".R.name", attrField.name());
- data.setValue(base + ".R.href", attrField.htmlPage());
- TagInfo.makeHDF(data, base + ".deprecated", attrField.comment().deprecatedTags());
- TagInfo.makeHDF(data, base + ".shortDescr", comment().briefTags());
- TagInfo.makeHDF(data, base + ".descr", comment().tags());
-
- int i=0;
- for (MethodInfo m: methods) {
- String s = base + ".methods." + i;
- data.setValue(s + ".href", m.htmlPage());
- data.setValue(s + ".name", m.name() + m.prettySignature());
- }
- }
-
- public boolean checkLevel() {
- return attrField.checkLevel();
- }
-}
-
diff --git a/tools/droiddoc/src/ClassInfo.java b/tools/droiddoc/src/ClassInfo.java
deleted file mode 100644
index f3f11de..0000000
--- a/tools/droiddoc/src/ClassInfo.java
+++ /dev/null
@@ -1,1464 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import com.sun.javadoc.*;
-import com.sun.tools.doclets.*;
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.*;
-import java.io.*;
-
-public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Scoped
-{
- public static final Comparator<ClassInfo> comparator = new Comparator<ClassInfo>() {
- public int compare(ClassInfo a, ClassInfo b) {
- return a.name().compareTo(b.name());
- }
- };
-
- public static final Comparator<ClassInfo> qualifiedComparator = new Comparator<ClassInfo>() {
- public int compare(ClassInfo a, ClassInfo b) {
- return a.qualifiedName().compareTo(b.qualifiedName());
- }
- };
-
- public ClassInfo(
- ClassDoc cl,
- String rawCommentText, SourcePositionInfo position,
- boolean isPublic, boolean isProtected, boolean isPackagePrivate,
- boolean isPrivate, boolean isStatic,
- boolean isInterface, boolean isAbstract, boolean isOrdinaryClass,
- boolean isException, boolean isError, boolean isEnum, boolean isAnnotation,
- boolean isFinal, boolean isIncluded, String name,
- String qualifiedName, String qualifiedTypeName, boolean isPrimitive)
- {
- super(rawCommentText, position);
-
- mClass = cl;
- mIsPublic = isPublic;
- mIsProtected = isProtected;
- mIsPackagePrivate = isPackagePrivate;
- mIsPrivate = isPrivate;
- mIsStatic = isStatic;
- mIsInterface = isInterface;
- mIsAbstract = isAbstract;
- mIsOrdinaryClass = isOrdinaryClass;
- mIsException = isException;
- mIsError = isError;
- mIsEnum = isEnum;
- mIsAnnotation = isAnnotation;
- mIsFinal = isFinal;
- mIsIncluded = isIncluded;
- mName = name;
- mQualifiedName = qualifiedName;
- mQualifiedTypeName = qualifiedTypeName;
- mIsPrimitive = isPrimitive;
- mNameParts = name.split("\\.");
- }
-
- public void init(TypeInfo typeInfo, ClassInfo[] interfaces, TypeInfo[] interfaceTypes,
- ClassInfo[] innerClasses,
- MethodInfo[] constructors, MethodInfo[] methods, MethodInfo[] annotationElements,
- FieldInfo[] fields, FieldInfo[] enumConstants,
- PackageInfo containingPackage, ClassInfo containingClass,
- ClassInfo superclass, TypeInfo superclassType, AnnotationInstanceInfo[] annotations)
- {
- mTypeInfo = typeInfo;
- mRealInterfaces = interfaces;
- mRealInterfaceTypes = interfaceTypes;
- mInnerClasses = innerClasses;
- mAllConstructors = constructors;
- mAllSelfMethods = methods;
- mAnnotationElements = annotationElements;
- mAllSelfFields = fields;
- mEnumConstants = enumConstants;
- mContainingPackage = containingPackage;
- mContainingClass = containingClass;
- mRealSuperclass = superclass;
- mRealSuperclassType = superclassType;
- mAnnotations = annotations;
-
- // after providing new methods and new superclass info,clear any cached
- // lists of self + superclass methods, ctors, etc.
- mSuperclassInit = false;
- mConstructors = null;
- mMethods = null;
- mSelfMethods = null;
- mFields = null;
- mSelfFields = null;
- mSelfAttributes = null;
- mDeprecatedKnown = false;
-
- Arrays.sort(mEnumConstants, FieldInfo.comparator);
- Arrays.sort(mInnerClasses, ClassInfo.comparator);
- }
-
- public void init2() {
- // calling this here forces the AttrTagInfo objects to be linked to the AttribtueInfo
- // objects
- selfAttributes();
- }
-
- public void init3(TypeInfo[] types, ClassInfo[] realInnerClasses){
- mTypeParameters = types;
- mRealInnerClasses = realInnerClasses;
- }
-
- public ClassInfo[] getRealInnerClasses(){
- return mRealInnerClasses;
- }
-
- public TypeInfo[] getTypeParameters(){
- return mTypeParameters;
- }
-
- public boolean checkLevel()
- {
- int val = mCheckLevel;
- if (val >= 0) {
- return val != 0;
- } else {
- boolean v = DroidDoc.checkLevel(mIsPublic, mIsProtected,
- mIsPackagePrivate, mIsPrivate, isHidden());
- mCheckLevel = v ? 1 : 0;
- return v;
- }
- }
-
- public int compareTo(Object that) {
- if (that instanceof ClassInfo) {
- return mQualifiedName.compareTo(((ClassInfo)that).mQualifiedName);
- } else {
- return this.hashCode() - that.hashCode();
- }
- }
-
- @Override
- public ContainerInfo parent()
- {
- return this;
- }
-
- public boolean isPublic()
- {
- return mIsPublic;
- }
-
- public boolean isProtected()
- {
- return mIsProtected;
- }
-
- public boolean isPackagePrivate()
- {
- return mIsPackagePrivate;
- }
-
- public boolean isPrivate()
- {
- return mIsPrivate;
- }
-
- public boolean isStatic()
- {
- return mIsStatic;
- }
-
- public boolean isInterface()
- {
- return mIsInterface;
- }
-
- public boolean isAbstract()
- {
- return mIsAbstract;
- }
-
- public PackageInfo containingPackage()
- {
- return mContainingPackage;
- }
-
- public ClassInfo containingClass()
- {
- return mContainingClass;
- }
-
- public boolean isOrdinaryClass()
- {
- return mIsOrdinaryClass;
- }
-
- public boolean isException()
- {
- return mIsException;
- }
-
- public boolean isError()
- {
- return mIsError;
- }
-
- public boolean isEnum()
- {
- return mIsEnum;
- }
-
- public boolean isAnnotation()
- {
- return mIsAnnotation;
- }
-
- public boolean isFinal()
- {
- return mIsFinal;
- }
-
- public boolean isIncluded()
- {
- return mIsIncluded;
- }
-
- public HashSet<String> typeVariables()
- {
- HashSet<String> result = TypeInfo.typeVariables(mTypeInfo.typeArguments());
- ClassInfo cl = containingClass();
- while (cl != null) {
- TypeInfo[] types = cl.asTypeInfo().typeArguments();
- if (types != null) {
- TypeInfo.typeVariables(types, result);
- }
- cl = cl.containingClass();
- }
- return result;
- }
-
- private static void gatherHiddenInterfaces(ClassInfo cl, HashSet<ClassInfo> interfaces) {
- for (ClassInfo iface: cl.mRealInterfaces) {
- if (iface.checkLevel()) {
- interfaces.add(iface);
- } else {
- gatherHiddenInterfaces(iface, interfaces);
- }
- }
- }
-
- public ClassInfo[] interfaces()
- {
- if (mInterfaces == null) {
- if (checkLevel()) {
- HashSet<ClassInfo> interfaces = new HashSet<ClassInfo>();
- ClassInfo superclass = mRealSuperclass;
- while (superclass != null && !superclass.checkLevel()) {
- gatherHiddenInterfaces(superclass, interfaces);
- superclass = superclass.mRealSuperclass;
- }
- gatherHiddenInterfaces(this, interfaces);
- mInterfaces = interfaces.toArray(new ClassInfo[interfaces.size()]);
- } else {
- // put something here in case someone uses it
- mInterfaces = mRealInterfaces;
- }
- Arrays.sort(mInterfaces, ClassInfo.qualifiedComparator);
- }
- return mInterfaces;
- }
-
- public ClassInfo[] realInterfaces()
- {
- return mRealInterfaces;
- }
-
- TypeInfo[] realInterfaceTypes()
- {
- return mRealInterfaceTypes;
- }
-
- public String name()
- {
- return mName;
- }
-
- public String[] nameParts()
- {
- return mNameParts;
- }
-
- public String leafName()
- {
- return mNameParts[mNameParts.length-1];
- }
-
- public String qualifiedName()
- {
- return mQualifiedName;
- }
-
- public String qualifiedTypeName()
- {
- return mQualifiedTypeName;
- }
-
- public boolean isPrimitive()
- {
- return mIsPrimitive;
- }
-
- public MethodInfo[] allConstructors() {
- return mAllConstructors;
- }
-
- public MethodInfo[] constructors()
- {
- if (mConstructors == null) {
- MethodInfo[] methods = mAllConstructors;
- ArrayList<MethodInfo> ctors = new ArrayList<MethodInfo>();
- for (int i=0; i<methods.length; i++) {
- MethodInfo m = methods[i];
- if (!m.isHidden()) {
- ctors.add(m);
- }
- }
- mConstructors = ctors.toArray(new MethodInfo[ctors.size()]);
- Arrays.sort(mConstructors, MethodInfo.comparator);
- }
- return mConstructors;
- }
-
- public ClassInfo[] innerClasses()
- {
- return mInnerClasses;
- }
-
- public TagInfo[] inlineTags()
- {
- return comment().tags();
- }
-
- public TagInfo[] firstSentenceTags()
- {
- return comment().briefTags();
- }
-
- public boolean isDeprecated() {
- boolean deprecated = false;
- if (!mDeprecatedKnown) {
- boolean commentDeprecated = (comment().deprecatedTags().length > 0);
- boolean annotationDeprecated = false;
- for (AnnotationInstanceInfo annotation : annotations()) {
- if (annotation.type().qualifiedName().equals("java.lang.Deprecated")) {
- annotationDeprecated = true;
- break;
- }
- }
-
- if (commentDeprecated != annotationDeprecated) {
- Errors.error(Errors.DEPRECATION_MISMATCH, position(),
- "Class " + qualifiedName()
- + ": @Deprecated annotation and @deprecated comment do not match");
- }
-
- mIsDeprecated = commentDeprecated | annotationDeprecated;
- mDeprecatedKnown = true;
- }
- return mIsDeprecated;
- }
-
- public TagInfo[] deprecatedTags()
- {
- // Should we also do the interfaces?
- return comment().deprecatedTags();
- }
-
- public MethodInfo[] methods()
- {
- if (mMethods == null) {
- TreeMap<String,MethodInfo> all = new TreeMap<String,MethodInfo>();
-
- ClassInfo[] ifaces = interfaces();
- for (ClassInfo iface: ifaces) {
- if (iface != null) {
- MethodInfo[] inhereted = iface.methods();
- for (MethodInfo method: inhereted) {
- String key = method.name() + method.signature();
- all.put(key, method);
- }
- }
- }
-
- ClassInfo superclass = superclass();
- if (superclass != null) {
- MethodInfo[] inhereted = superclass.methods();
- for (MethodInfo method: inhereted) {
- String key = method.name() + method.signature();
- all.put(key, method);
- }
- }
-
- MethodInfo[] methods = selfMethods();
- for (MethodInfo method: methods) {
- String key = method.name() + method.signature();
- MethodInfo old = all.put(key, method);
- }
-
- mMethods = all.values().toArray(new MethodInfo[all.size()]);
- }
- return mMethods;
- }
-
- public MethodInfo[] annotationElements()
- {
- return mAnnotationElements;
- }
-
- public AnnotationInstanceInfo[] annotations()
- {
- return mAnnotations;
- }
-
- private static void addFields(ClassInfo cl, TreeMap<String,FieldInfo> all)
- {
- FieldInfo[] fields = cl.fields();
- int N = fields.length;
- for (int i=0; i<N; i++) {
- FieldInfo f = fields[i];
- all.put(f.name(), f);
- }
- }
-
- public FieldInfo[] fields()
- {
- if (mFields == null) {
- int N;
- TreeMap<String,FieldInfo> all = new TreeMap<String,FieldInfo>();
-
- ClassInfo[] interfaces = interfaces();
- N = interfaces.length;
- for (int i=0; i<N; i++) {
- addFields(interfaces[i], all);
- }
-
- ClassInfo superclass = superclass();
- if (superclass != null) {
- addFields(superclass, all);
- }
-
- FieldInfo[] fields = selfFields();
- N = fields.length;
- for (int i=0; i<N; i++) {
- FieldInfo f = fields[i];
- if (!f.isHidden()) {
- String key = f.name();
- all.put(key, f);
- }
- }
-
- mFields = all.values().toArray(new FieldInfo[0]);
- }
- return mFields;
- }
-
- public void gatherFields(ClassInfo owner, ClassInfo cl, HashMap<String,FieldInfo> fields) {
- FieldInfo[] flds = cl.selfFields();
- for (FieldInfo f: flds) {
- if (f.checkLevel()) {
- fields.put(f.name(), f.cloneForClass(owner));
- }
- }
- }
-
- public FieldInfo[] selfFields()
- {
- if (mSelfFields == null) {
- HashMap<String,FieldInfo> fields = new HashMap<String,FieldInfo>();
- // our hidden parents
- if (mRealSuperclass != null && !mRealSuperclass.checkLevel()) {
- gatherFields(this, mRealSuperclass, fields);
- }
- for (ClassInfo iface: mRealInterfaces) {
- if (!iface.checkLevel()) {
- gatherFields(this, iface, fields);
- }
- }
- // mine
- FieldInfo[] selfFields = mAllSelfFields;
- for (int i=0; i<selfFields.length; i++) {
- FieldInfo f = selfFields[i];
- if (!f.isHidden()) {
- fields.put(f.name(), f);
- }
- }
- // combine and return in
- mSelfFields = fields.values().toArray(new FieldInfo[fields.size()]);
- Arrays.sort(mSelfFields, FieldInfo.comparator);
- }
- return mSelfFields;
- }
-
- public FieldInfo[] allSelfFields() {
- return mAllSelfFields;
- }
-
- public void gatherMethods(ClassInfo owner, ClassInfo cl, HashMap<String,MethodInfo> methods) {
- MethodInfo[] meth = cl.selfMethods();
- for (MethodInfo m: meth) {
- if (m.checkLevel()) {
- methods.put(m.name()+m.signature(), m.cloneForClass(owner));
- }
- }
- }
-
- public MethodInfo[] selfMethods()
- {
- if (mSelfMethods == null) {
- HashMap<String,MethodInfo> methods = new HashMap<String,MethodInfo>();
- // our hidden parents
- if (mRealSuperclass != null && !mRealSuperclass.checkLevel()) {
- gatherMethods(this, mRealSuperclass, methods);
- }
- for (ClassInfo iface: mRealInterfaces) {
- if (!iface.checkLevel()) {
- gatherMethods(this, iface, methods);
- }
- }
- // mine
- MethodInfo[] selfMethods = mAllSelfMethods;
- for (int i=0; i<selfMethods.length; i++) {
- MethodInfo m = selfMethods[i];
- if (m.checkLevel()) {
- methods.put(m.name()+m.signature(), m);
- }
- }
- // combine and return it
- mSelfMethods = methods.values().toArray(new MethodInfo[methods.size()]);
- Arrays.sort(mSelfMethods, MethodInfo.comparator);
- }
- return mSelfMethods;
- }
-
- public MethodInfo[] allSelfMethods() {
- return mAllSelfMethods;
- }
-
- public void addMethod(MethodInfo method) {
- MethodInfo[] methods = new MethodInfo[mAllSelfMethods.length + 1];
- int i = 0;
- for (MethodInfo m : mAllSelfMethods) {
- methods[i] = m;
- i++;
- }
- methods[i] = method;
- mAllSelfMethods = methods;
- }
-
- public AttributeInfo[] selfAttributes()
- {
- if (mSelfAttributes == null) {
- TreeMap<FieldInfo,AttributeInfo> attrs = new TreeMap<FieldInfo,AttributeInfo>();
-
- // the ones in the class comment won't have any methods
- for (AttrTagInfo tag: comment().attrTags()) {
- FieldInfo field = tag.reference();
- if (field != null) {
- AttributeInfo attr = attrs.get(field);
- if (attr == null) {
- attr = new AttributeInfo(this, field);
- attrs.put(field, attr);
- }
- tag.setAttribute(attr);
- }
- }
-
- // in the methods
- for (MethodInfo m: selfMethods()) {
- for (AttrTagInfo tag: m.comment().attrTags()) {
- FieldInfo field = tag.reference();
- if (field != null) {
- AttributeInfo attr = attrs.get(field);
- if (attr == null) {
- attr = new AttributeInfo(this, field);
- attrs.put(field, attr);
- }
- tag.setAttribute(attr);
- attr.methods.add(m);
- }
- }
- }
-
- //constructors too
- for (MethodInfo m: constructors()) {
- for (AttrTagInfo tag: m.comment().attrTags()) {
- FieldInfo field = tag.reference();
- if (field != null) {
- AttributeInfo attr = attrs.get(field);
- if (attr == null) {
- attr = new AttributeInfo(this, field);
- attrs.put(field, attr);
- }
- tag.setAttribute(attr);
- attr.methods.add(m);
- }
- }
- }
-
- mSelfAttributes = attrs.values().toArray(new AttributeInfo[attrs.size()]);
- Arrays.sort(mSelfAttributes, AttributeInfo.comparator);
- }
- return mSelfAttributes;
- }
-
- public FieldInfo[] enumConstants()
- {
- return mEnumConstants;
- }
-
- public ClassInfo superclass()
- {
- if (!mSuperclassInit) {
- if (this.checkLevel()) {
- // rearrange our little inheritance hierarchy, because we need to hide classes that
- // don't pass checkLevel
- ClassInfo superclass = mRealSuperclass;
- while (superclass != null && !superclass.checkLevel()) {
- superclass = superclass.mRealSuperclass;
- }
- mSuperclass = superclass;
- } else {
- mSuperclass = mRealSuperclass;
- }
- }
- return mSuperclass;
- }
-
- public ClassInfo realSuperclass()
- {
- return mRealSuperclass;
- }
-
- /** always the real superclass, not the collapsed one we get through superclass(),
- * also has the type parameter info if it's generic.
- */
- public TypeInfo superclassType()
- {
- return mRealSuperclassType;
- }
-
- public TypeInfo asTypeInfo()
- {
- return mTypeInfo;
- }
-
- TypeInfo[] interfaceTypes()
- {
- ClassInfo[] infos = interfaces();
- int len = infos.length;
- TypeInfo[] types = new TypeInfo[len];
- for (int i=0; i<len; i++) {
- types[i] = infos[i].asTypeInfo();
- }
- return types;
- }
-
- public String htmlPage()
- {
- String s = containingPackage().name();
- s = s.replace('.', '/');
- s += '/';
- s += name();
- s += ".html";
- s = DroidDoc.javadocDir + s;
- return s;
- }
-
- /** Even indirectly */
- public boolean isDerivedFrom(ClassInfo cl)
- {
- ClassInfo dad = this.superclass();
- if (dad != null) {
- if (dad.equals(cl)) {
- return true;
- } else {
- if (dad.isDerivedFrom(cl)) {
- return true;
- }
- }
- }
- for (ClassInfo iface: interfaces()) {
- if (iface.equals(cl)) {
- return true;
- } else {
- if (iface.isDerivedFrom(cl)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public void makeKeywordEntries(List<KeywordEntry> keywords)
- {
- if (!checkLevel()) {
- return;
- }
-
- String htmlPage = htmlPage();
- String qualifiedName = qualifiedName();
-
- keywords.add(new KeywordEntry(name(), htmlPage,
- "class in " + containingPackage().name()));
-
- FieldInfo[] fields = selfFields();
- FieldInfo[] enumConstants = enumConstants();
- MethodInfo[] ctors = constructors();
- MethodInfo[] methods = selfMethods();
-
- // enum constants
- for (FieldInfo field: enumConstants()) {
- if (field.checkLevel()) {
- keywords.add(new KeywordEntry(field.name(),
- htmlPage + "#" + field.anchor(),
- "enum constant in " + qualifiedName));
- }
- }
-
- // constants
- for (FieldInfo field: fields) {
- if (field.isConstant() && field.checkLevel()) {
- keywords.add(new KeywordEntry(field.name(),
- htmlPage + "#" + field.anchor(),
- "constant in " + qualifiedName));
- }
- }
-
- // fields
- for (FieldInfo field: fields) {
- if (!field.isConstant() && field.checkLevel()) {
- keywords.add(new KeywordEntry(field.name(),
- htmlPage + "#" + field.anchor(),
- "field in " + qualifiedName));
- }
- }
-
- // public constructors
- for (MethodInfo m: ctors) {
- if (m.isPublic() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "constructor in " + qualifiedName));
- }
- }
-
- // protected constructors
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PROTECTED)) {
- for (MethodInfo m: ctors) {
- if (m.isProtected() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "constructor in " + qualifiedName));
- }
- }
- }
-
- // package private constructors
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PACKAGE)) {
- for (MethodInfo m: ctors) {
- if (m.isPackagePrivate() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "constructor in " + qualifiedName));
- }
- }
- }
-
- // private constructors
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PRIVATE)) {
- for (MethodInfo m: ctors) {
- if (m.isPrivate() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "constructor in " + qualifiedName));
- }
- }
- }
-
- // public methods
- for (MethodInfo m: methods) {
- if (m.isPublic() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "method in " + qualifiedName));
- }
- }
-
- // protected methods
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PROTECTED)) {
- for (MethodInfo m: methods) {
- if (m.isProtected() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "method in " + qualifiedName));
- }
- }
- }
-
- // package private methods
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PACKAGE)) {
- for (MethodInfo m: methods) {
- if (m.isPackagePrivate() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "method in " + qualifiedName));
- }
- }
- }
-
- // private methods
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PRIVATE)) {
- for (MethodInfo m: methods) {
- if (m.isPrivate() && m.checkLevel()) {
- keywords.add(new KeywordEntry(m.name() + m.prettySignature(),
- htmlPage + "#" + m.anchor(),
- "method in " + qualifiedName));
- }
- }
- }
- }
-
- public void makeLink(HDF data, String base)
- {
- data.setValue(base + ".label", this.name());
- if (!this.isPrimitive() && this.isIncluded() && this.checkLevel()) {
- data.setValue(base + ".link", this.htmlPage());
- }
- }
-
- public static void makeLinkListHDF(HDF data, String base, ClassInfo[] classes) {
- final int N = classes.length;
- for (int i=0; i<N; i++) {
- ClassInfo cl = classes[i];
- if (cl.checkLevel()) {
- cl.asTypeInfo().makeHDF(data, base + "." + i);
- }
- }
- }
-
- /**
- * Used in lists of this class (packages, nested classes, known subclasses)
- */
- public void makeShortDescrHDF(HDF data, String base)
- {
- mTypeInfo.makeHDF(data, base + ".type");
- data.setValue(base + ".kind", this.kind());
- TagInfo.makeHDF(data, base + ".shortDescr", this.firstSentenceTags());
- TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags());
- data.setValue(base + ".since", getSince());
- }
-
- /**
- * Turns into the main class page
- */
- public void makeHDF(HDF data)
- {
- int i, j, n;
- String name = name();
- String qualified = qualifiedName();
- AttributeInfo[] selfAttributes = selfAttributes();
- MethodInfo[] methods = selfMethods();
- FieldInfo[] fields = selfFields();
- FieldInfo[] enumConstants = enumConstants();
- MethodInfo[] ctors = constructors();
- ClassInfo[] inners = innerClasses();
-
- // class name
- mTypeInfo.makeHDF(data, "class.type");
- mTypeInfo.makeQualifiedHDF(data, "class.qualifiedType");
- data.setValue("class.name", name);
- data.setValue("class.qualified", qualified);
- String scope = "";
- if (isProtected()) {
- data.setValue("class.scope", "protected");
- }
- else if (isPublic()) {
- data.setValue("class.scope", "public");
- }
- if (isStatic()) {
- data.setValue("class.static", "static");
- }
- if (isFinal()) {
- data.setValue("class.final", "final");
- }
- if (isAbstract() && !isInterface()) {
- data.setValue("class.abstract", "abstract");
- }
-
- // class info
- String kind = kind();
- if (kind != null) {
- data.setValue("class.kind", kind);
- }
- data.setValue("class.since", getSince());
-
- // the containing package -- note that this can be passed to type_link,
- // but it also contains the list of all of the packages
- containingPackage().makeClassLinkListHDF(data, "class.package");
-
- // inheritance hierarchy
- Vector<ClassInfo> superClasses = new Vector<ClassInfo>();
- superClasses.add(this);
- ClassInfo supr = superclass();
- while (supr != null) {
- superClasses.add(supr);
- supr = supr.superclass();
- }
- n = superClasses.size();
- for (i=0; i<n; i++) {
- supr = superClasses.elementAt(n-i-1);
-
- supr.asTypeInfo().makeQualifiedHDF(data, "class.inheritance." + i + ".class");
- supr.asTypeInfo().makeHDF(data, "class.inheritance." + i + ".short_class");
- j = 0;
- for (TypeInfo t: supr.interfaceTypes()) {
- t.makeHDF(data, "class.inheritance." + i + ".interfaces." + j);
- j++;
- }
- }
-
- // class description
- TagInfo.makeHDF(data, "class.descr", inlineTags());
- TagInfo.makeHDF(data, "class.seeAlso", comment().seeTags());
- TagInfo.makeHDF(data, "class.deprecated", deprecatedTags());
-
- // known subclasses
- TreeMap<String, ClassInfo> direct = new TreeMap<String, ClassInfo>();
- TreeMap<String, ClassInfo> indirect = new TreeMap<String, ClassInfo>();
- ClassInfo[] all = Converter.rootClasses();
- for (ClassInfo cl: all) {
- if (cl.superclass() != null && cl.superclass().equals(this)) {
- direct.put(cl.name(), cl);
- }
- else if (cl.isDerivedFrom(this)) {
- indirect.put(cl.name(), cl);
- }
- }
- // direct
- i = 0;
- for (ClassInfo cl: direct.values()) {
- if (cl.checkLevel()) {
- cl.makeShortDescrHDF(data, "class.subclasses.direct." + i);
- }
- i++;
- }
- // indirect
- i = 0;
- for (ClassInfo cl: indirect.values()) {
- if (cl.checkLevel()) {
- cl.makeShortDescrHDF(data, "class.subclasses.indirect." + i);
- }
- i++;
- }
-
- // nested classes
- i=0;
- for (ClassInfo inner: inners) {
- if (inner.checkLevel()) {
- inner.makeShortDescrHDF(data, "class.inners." + i);
- }
- i++;
- }
-
- // enum constants
- i=0;
- for (FieldInfo field: enumConstants) {
- if (field.isConstant()) {
- field.makeHDF(data, "class.enumConstants." + i);
- i++;
- }
- }
-
- // constants
- i=0;
- for (FieldInfo field: fields) {
- if (field.isConstant()) {
- field.makeHDF(data, "class.constants." + i);
- i++;
- }
- }
-
- // fields
- i=0;
- for (FieldInfo field: fields) {
- if (!field.isConstant()) {
- field.makeHDF(data, "class.fields." + i);
- i++;
- }
- }
-
- // public constructors
- i=0;
- for (MethodInfo ctor: ctors) {
- if (ctor.isPublic()) {
- ctor.makeHDF(data, "class.ctors.public." + i);
- i++;
- }
- }
-
- // protected constructors
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PROTECTED)) {
- i=0;
- for (MethodInfo ctor: ctors) {
- if (ctor.isProtected()) {
- ctor.makeHDF(data, "class.ctors.protected." + i);
- i++;
- }
- }
- }
-
- // package private constructors
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PACKAGE)) {
- i=0;
- for (MethodInfo ctor: ctors) {
- if (ctor.isPackagePrivate()) {
- ctor.makeHDF(data, "class.ctors.package." + i);
- i++;
- }
- }
- }
-
- // private constructors
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PRIVATE)) {
- i=0;
- for (MethodInfo ctor: ctors) {
- if (ctor.isPrivate()) {
- ctor.makeHDF(data, "class.ctors.private." + i);
- i++;
- }
- }
- }
-
- // public methods
- i=0;
- for (MethodInfo method: methods) {
- if (method.isPublic()) {
- method.makeHDF(data, "class.methods.public." + i);
- i++;
- }
- }
-
- // protected methods
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PROTECTED)) {
- i=0;
- for (MethodInfo method: methods) {
- if (method.isProtected()) {
- method.makeHDF(data, "class.methods.protected." + i);
- i++;
- }
- }
- }
-
- // package private methods
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PACKAGE)) {
- i=0;
- for (MethodInfo method: methods) {
- if (method.isPackagePrivate()) {
- method.makeHDF(data, "class.methods.package." + i);
- i++;
- }
- }
- }
-
- // private methods
- if (DroidDoc.checkLevel(DroidDoc.SHOW_PRIVATE)) {
- i=0;
- for (MethodInfo method: methods) {
- if (method.isPrivate()) {
- method.makeHDF(data, "class.methods.private." + i);
- i++;
- }
- }
- }
-
- // xml attributes
- i=0;
- for (AttributeInfo attr: selfAttributes) {
- if (attr.checkLevel()) {
- attr.makeHDF(data, "class.attrs." + i);
- i++;
- }
- }
-
- // inherited methods
- Set<ClassInfo> interfaces = new TreeSet<ClassInfo>();
- addInterfaces(interfaces(), interfaces);
- ClassInfo cl = superclass();
- i=0;
- while (cl != null) {
- addInterfaces(cl.interfaces(), interfaces);
- makeInheritedHDF(data, i, cl);
- cl = cl.superclass();
- i++;
- }
- for (ClassInfo iface: interfaces) {
- makeInheritedHDF(data, i, iface);
- i++;
- }
- }
-
- private static void addInterfaces(ClassInfo[] ifaces, Set<ClassInfo> out)
- {
- for (ClassInfo cl: ifaces) {
- out.add(cl);
- addInterfaces(cl.interfaces(), out);
- }
- }
-
- private static void makeInheritedHDF(HDF data, int index, ClassInfo cl)
- {
- int i;
-
- String base = "class.inherited." + index;
- data.setValue(base + ".qualified", cl.qualifiedName());
- if (cl.checkLevel()) {
- data.setValue(base + ".link", cl.htmlPage());
- }
- String kind = cl.kind();
- if (kind != null) {
- data.setValue(base + ".kind", kind);
- }
-
- if (cl.mIsIncluded) {
- data.setValue(base + ".included", "true");
- }
-
- // xml attributes
- i=0;
- for (AttributeInfo attr: cl.selfAttributes()) {
- attr.makeHDF(data, base + ".attrs." + i);
- i++;
- }
-
- // methods
- i=0;
- for (MethodInfo method: cl.selfMethods()) {
- method.makeHDF(data, base + ".methods." + i);
- i++;
- }
-
- // fields
- i=0;
- for (FieldInfo field: cl.selfFields()) {
- if (!field.isConstant()) {
- field.makeHDF(data, base + ".fields." + i);
- i++;
- }
- }
-
- // constants
- i=0;
- for (FieldInfo field: cl.selfFields()) {
- if (field.isConstant()) {
- field.makeHDF(data, base + ".constants." + i);
- i++;
- }
- }
- }
-
- @Override
- public boolean isHidden()
- {
- int val = mHidden;
- if (val >= 0) {
- return val != 0;
- } else {
- boolean v = isHiddenImpl();
- mHidden = v ? 1 : 0;
- return v;
- }
- }
-
- public boolean isHiddenImpl()
- {
- ClassInfo cl = this;
- while (cl != null) {
- PackageInfo pkg = cl.containingPackage();
- if (pkg != null && pkg.isHidden()) {
- return true;
- }
- if (cl.comment().isHidden()) {
- return true;
- }
- cl = cl.containingClass();
- }
- return false;
- }
-
- private MethodInfo matchMethod(MethodInfo[] methods, String name,
- String[] params, String[] dimensions)
- {
- int len = methods.length;
- for (int i=0; i<len; i++) {
- MethodInfo method = methods[i];
- if (method.name().equals(name)) {
- if (params == null) {
- return method;
- } else {
- if (method.matchesParams(params, dimensions)) {
- return method;
- }
- }
- }
- }
- return null;
- }
-
- public MethodInfo findMethod(String name,
- String[] params, String[] dimensions)
- {
- // first look on our class, and our superclasses
-
- // for methods
- MethodInfo rv;
- rv = matchMethod(methods(), name, params, dimensions);
-
- if (rv != null) {
- return rv;
- }
-
- // for constructors
- rv = matchMethod(constructors(), name, params, dimensions);
- if (rv != null) {
- return rv;
- }
-
- // then recursively look at our containing class
- ClassInfo containing = containingClass();
- if (containing != null) {
- return containing.findMethod(name, params, dimensions);
- }
-
- return null;
- }
-
- private ClassInfo searchInnerClasses(String[] nameParts, int index)
- {
- String part = nameParts[index];
-
- ClassInfo[] inners = mInnerClasses;
- for (ClassInfo in: inners) {
- String[] innerParts = in.nameParts();
- if (part.equals(innerParts[innerParts.length-1])) {
- if (index == nameParts.length-1) {
- return in;
- } else {
- return in.searchInnerClasses(nameParts, index+1);
- }
- }
- }
- return null;
- }
-
- public ClassInfo extendedFindClass(String className)
- {
- // ClassDoc.findClass has this bug that we're working around here:
- // If you have a class PackageManager with an inner class PackageInfo
- // and you call it with "PackageInfo" it doesn't find it.
- return searchInnerClasses(className.split("\\."), 0);
- }
-
- public ClassInfo findClass(String className)
- {
- return Converter.obtainClass(mClass.findClass(className));
- }
-
- public ClassInfo findInnerClass(String className)
- {
- // ClassDoc.findClass won't find inner classes. To deal with that,
- // we try what they gave us first, but if that didn't work, then
- // we see if there are any periods in className, and start searching
- // from there.
- String[] nodes = className.split("\\.");
- ClassDoc cl = mClass;
- for (String n: nodes) {
- cl = cl.findClass(n);
- if (cl == null) {
- return null;
- }
- }
- return Converter.obtainClass(cl);
- }
-
- public FieldInfo findField(String name)
- {
- // first look on our class, and our superclasses
- for (FieldInfo f: fields()) {
- if (f.name().equals(name)) {
- return f;
- }
- }
-
- // then look at our enum constants (these are really fields, maybe
- // they should be mixed into fields(). not sure)
- for (FieldInfo f: enumConstants()) {
- if (f.name().equals(name)) {
- return f;
- }
- }
-
- // then recursively look at our containing class
- ClassInfo containing = containingClass();
- if (containing != null) {
- return containing.findField(name);
- }
-
- return null;
- }
-
- public static ClassInfo[] sortByName(ClassInfo[] classes)
- {
- int i;
- Sorter[] sorted = new Sorter[classes.length];
- for (i=0; i<sorted.length; i++) {
- ClassInfo cl = classes[i];
- sorted[i] = new Sorter(cl.name(), cl);
- }
-
- Arrays.sort(sorted);
-
- ClassInfo[] rv = new ClassInfo[classes.length];
- for (i=0; i<rv.length; i++) {
- rv[i] = (ClassInfo)sorted[i].data;
- }
-
- return rv;
- }
-
- public boolean equals(ClassInfo that)
- {
- if (that != null) {
- return this.qualifiedName().equals(that.qualifiedName());
- } else {
- return false;
- }
- }
-
- public void setNonWrittenConstructors(MethodInfo[] nonWritten) {
- mNonWrittenConstructors = nonWritten;
- }
-
- public MethodInfo[] getNonWrittenConstructors() {
- return mNonWrittenConstructors;
- }
-
- public String kind()
- {
- if (isOrdinaryClass()) {
- return "class";
- }
- else if (isInterface()) {
- return "interface";
- }
- else if (isEnum()) {
- return "enum";
- }
- else if (isError()) {
- return "class";
- }
- else if (isException()) {
- return "class";
- }
- else if (isAnnotation()) {
- return "@interface";
- }
- return null;
- }
-
- public void setHiddenMethods(MethodInfo[] mInfo){
- mHiddenMethods = mInfo;
- }
- public MethodInfo[] getHiddenMethods(){
- return mHiddenMethods;
- }
- @Override
- public String toString(){
- return this.qualifiedName();
- }
-
- public void setReasonIncluded(String reason) {
- mReasonIncluded = reason;
- }
-
- public String getReasonIncluded() {
- return mReasonIncluded;
- }
-
- private ClassDoc mClass;
-
- // ctor
- private boolean mIsPublic;
- private boolean mIsProtected;
- private boolean mIsPackagePrivate;
- private boolean mIsPrivate;
- private boolean mIsStatic;
- private boolean mIsInterface;
- private boolean mIsAbstract;
- private boolean mIsOrdinaryClass;
- private boolean mIsException;
- private boolean mIsError;
- private boolean mIsEnum;
- private boolean mIsAnnotation;
- private boolean mIsFinal;
- private boolean mIsIncluded;
- private String mName;
- private String mQualifiedName;
- private String mQualifiedTypeName;
- private boolean mIsPrimitive;
- private TypeInfo mTypeInfo;
- private String[] mNameParts;
-
- // init
- private ClassInfo[] mRealInterfaces;
- private ClassInfo[] mInterfaces;
- private TypeInfo[] mRealInterfaceTypes;
- private ClassInfo[] mInnerClasses;
- private MethodInfo[] mAllConstructors;
- private MethodInfo[] mAllSelfMethods;
- private MethodInfo[] mAnnotationElements; // if this class is an annotation
- private FieldInfo[] mAllSelfFields;
- private FieldInfo[] mEnumConstants;
- private PackageInfo mContainingPackage;
- private ClassInfo mContainingClass;
- private ClassInfo mRealSuperclass;
- private TypeInfo mRealSuperclassType;
- private ClassInfo mSuperclass;
- private AnnotationInstanceInfo[] mAnnotations;
- private boolean mSuperclassInit;
- private boolean mDeprecatedKnown;
-
- // lazy
- private MethodInfo[] mConstructors;
- private ClassInfo[] mRealInnerClasses;
- private MethodInfo[] mSelfMethods;
- private FieldInfo[] mSelfFields;
- private AttributeInfo[] mSelfAttributes;
- private MethodInfo[] mMethods;
- private FieldInfo[] mFields;
- private TypeInfo[] mTypeParameters;
- private MethodInfo[] mHiddenMethods;
- private int mHidden = -1;
- private int mCheckLevel = -1;
- private String mReasonIncluded;
- private MethodInfo[] mNonWrittenConstructors;
- private boolean mIsDeprecated;
-}
diff --git a/tools/droiddoc/src/ClearPage.java b/tools/droiddoc/src/ClearPage.java
deleted file mode 100644
index 016ca93..0000000
--- a/tools/droiddoc/src/ClearPage.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import com.sun.javadoc.*;
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ClearPage
-{
- /*
- public ClearPage()
- {
- String templ = "templates/index.cs";
- String filename = "docs/index.html";
-
- data.setValue("A.B.C", "1");
- data.setValue("A.B.D", "2");
- }
- */
-
- public static ArrayList<String> hdfFiles = new ArrayList<String>();
-
- private static ArrayList<String> mTemplateDirs = new ArrayList<String>();
- private static boolean mTemplateDirSet = false;
-
- public static String outputDir = "docs";
- public static List<String> htmlDirs = new ArrayList<String>();
- public static String toroot = null;
-
- public static void addTemplateDir(String dir)
- {
- mTemplateDirSet = true;
- mTemplateDirs.add(dir);
-
- File hdfFile = new File(dir, "data.hdf");
- if (hdfFile.canRead()) {
- hdfFiles.add(hdfFile.getPath());
- }
- }
-
- private static int countSlashes(String s)
- {
- final int N = s.length();
- int slashcount = 0;
- for (int i=0; i<N; i++) {
- if (s.charAt(i) == '/') {
- slashcount++;
- }
- }
- return slashcount;
- }
-
- public static void write(HDF data, String templ, String filename)
- {
- write(data, templ, filename, false);
- }
-
- public static void write(HDF data, String templ, String filename, boolean fullPath)
- {
- if (!htmlDirs.isEmpty()) {
- data.setValue("hasindex", "true");
- }
-
- String toroot;
- if (ClearPage.toroot != null) {
- toroot = ClearPage.toroot;
- } else {
- int slashcount = countSlashes(filename);
- if (slashcount > 0) {
- toroot = "";
- for (int i=0; i<slashcount; i++) {
- toroot += "../";
- }
- } else {
- toroot = "./";
- }
- }
- data.setValue("toroot", toroot);
-
- data.setValue("filename", filename);
-
- if (!fullPath) {
- filename = outputDir + "/" + filename;
- }
-
- int i=0;
- if (!htmlDirs.isEmpty()) {
- for (String dir : htmlDirs) {
- data.setValue("hdf.loadpaths." + i, dir);
- i++;
- }
- }
- if (mTemplateDirSet) {
- for (String dir: mTemplateDirs) {
- data.setValue("hdf.loadpaths." + i, dir);
- i++;
- }
- } else {
- data.setValue("hdf.loadpaths." + i, "templates");
- }
-
- CS cs = new CS(data);
- cs.parseFile(templ);
-
- File file = new File(outputFilename(filename));
-
- ensureDirectory(file);
-
- OutputStreamWriter stream = null;
- try {
- stream = new OutputStreamWriter(
- new FileOutputStream(file), "UTF-8");
- String rendered = cs.render();
- stream.write(rendered, 0, rendered.length());
- }
- catch (IOException e) {
- System.out.println("error: " + e.getMessage() + "; when writing file: " + filename);
- }
- finally {
- if (stream != null) {
- try {
- stream.close();
- }
- catch (IOException e) {
- }
- }
- }
- }
-
- // recursively create the directories to the output
- public static void ensureDirectory(File f)
- {
- File parent = f.getParentFile();
- if (parent != null) {
- parent.mkdirs();
- }
- }
-
- public static void copyFile(File from, String toPath)
- {
- File to = new File(outputDir + "/" + toPath);
- FileInputStream in;
- FileOutputStream out;
- try {
- if (!from.exists()) {
- throw new IOException();
- }
- in = new FileInputStream(from);
- }
- catch (IOException e) {
- System.err.println(from.getAbsolutePath() + ": Error opening file");
- return ;
- }
- ensureDirectory(to);
- try {
- out = new FileOutputStream(to);
- }
- catch (IOException e) {
- System.err.println(from.getAbsolutePath() + ": Error opening file");
- return ;
- }
-
- long sizel = from.length();
- final int maxsize = 64*1024;
- int size = sizel > maxsize ? maxsize : (int)sizel;
- byte[] buf = new byte[size];
- while (true) {
- try {
- size = in.read(buf);
- }
- catch (IOException e) {
- System.err.println(from.getAbsolutePath()
- + ": error reading file");
- break;
- }
- if (size > 0) {
- try {
- out.write(buf, 0, size);
- }
- catch (IOException e) {
- System.err.println(from.getAbsolutePath()
- + ": error writing file");
- }
- } else {
- break;
- }
- }
- try {
- in.close();
- }
- catch (IOException e) {
- }
- try {
- out.close();
- }
- catch (IOException e) {
- }
- }
-
- /** Takes a string that ends w/ .html and changes the .html to htmlExtension */
- public static String outputFilename(String htmlFile) {
- if (!DroidDoc.htmlExtension.equals(".html") && htmlFile.endsWith(".html")) {
- return htmlFile.substring(0, htmlFile.length()-5) + DroidDoc.htmlExtension;
- } else {
- return htmlFile;
- }
- }
-
-}
diff --git a/tools/droiddoc/src/Comment.java b/tools/droiddoc/src/Comment.java
deleted file mode 100644
index 68b6d20..0000000
--- a/tools/droiddoc/src/Comment.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.ArrayList;
-
-public class Comment
-{
- static final Pattern LEADING_WHITESPACE = Pattern.compile(
- "^[ \t\n\r]*(.*)$",
- Pattern.DOTALL);
-
- static final Pattern TAG_BEGIN = Pattern.compile(
- "[\r\n][\r\n \t]*@",
- Pattern.DOTALL);
-
- static final Pattern TAG = Pattern.compile(
- "(@[^ \t\r\n]+)[ \t\r\n]+(.*)",
- Pattern.DOTALL);
-
- static final Pattern INLINE_TAG = Pattern.compile(
- "(.*?)\\{(@[^ \t\r\n\\}]+)[ \t\r\n]*(.*?)\\}",
- Pattern.DOTALL);
-
- static final Pattern FIRST_SENTENCE = Pattern.compile(
- "((.*?)\\.)[ \t\r\n\\<](.*)",
- Pattern.DOTALL);
-
- private static final String[] KNOWN_TAGS = new String[] {
- "@author",
- "@since",
- "@version",
- "@deprecated",
- "@undeprecate",
- "@docRoot",
- "@sdkCurrent",
- "@inheritDoc",
- "@more",
- "@code",
- "@samplecode",
- "@sample",
- "@include",
- "@serial",
- };
-
- public Comment(String text, ContainerInfo base, SourcePositionInfo sp)
- {
- mText = text;
- mBase = base;
- // sp now points to the end of the text, not the beginning!
- mPosition = SourcePositionInfo.findBeginning(sp, text);
- }
-
- private void parseRegex(String text)
- {
- Matcher m;
-
- m = LEADING_WHITESPACE.matcher(text);
- m.matches();
- text = m.group(1);
-
- m = TAG_BEGIN.matcher(text);
-
- int start = 0;
- int end = 0;
- while (m.find()) {
- end = m.start();
-
- tag(text, start, end);
-
- start = m.end()-1; // -1 is the @
- }
- end = text.length();
- tag(text, start, end);
- }
-
- private void tag(String text, int start, int end)
- {
- SourcePositionInfo pos = SourcePositionInfo.add(mPosition, mText, start);
-
- if (start >= 0 && end > 0 && (end-start) > 0) {
- text = text.substring(start, end);
-
- Matcher m = TAG.matcher(text);
- if (m.matches()) {
- // out of line tag
- tag(m.group(1), m.group(2), false, pos);
- } else {
- // look for inline tags
- m = INLINE_TAG.matcher(text);
- start = 0;
- while (m.find()) {
- String str = m.group(1);
- String tagname = m.group(2);
- String tagvalue = m.group(3);
- tag(null, m.group(1), true, pos);
- tag(tagname, tagvalue, true, pos);
- start = m.end();
- }
- int len = text.length();
- if (start != len) {
- tag(null, text.substring(start), true, pos);
- }
- }
- }
- }
-
- private void tag(String name, String text, boolean isInline, SourcePositionInfo pos)
- {
- /*
- String s = isInline ? "inline" : "outofline";
- System.out.println("---> " + s
- + " name=[" + name + "] text=[" + text + "]");
- */
- if (name == null) {
- mInlineTagsList.add(new TextTagInfo("Text", "Text", text, pos));
- }
- else if (name.equals("@param")) {
- mParamTagsList.add(new ParamTagInfo("@param", "@param", text, mBase, pos));
- }
- else if (name.equals("@see")) {
- mSeeTagsList.add(new SeeTagInfo("@see", "@see", text, mBase, pos));
- }
- else if (name.equals("@link") || name.equals("@linkplain")) {
- mInlineTagsList.add(new SeeTagInfo(name, "@see", text, mBase, pos));
- }
- else if (name.equals("@throws") || name.equals("@exception")) {
- mThrowsTagsList.add(new ThrowsTagInfo("@throws", "@throws", text, mBase, pos));
- }
- else if (name.equals("@return")) {
- mReturnTagsList.add(new ParsedTagInfo("@return", "@return", text, mBase, pos));
- }
- else if (name.equals("@deprecated")) {
- if (text.length() == 0) {
- Errors.error(Errors.MISSING_COMMENT, pos,
- "@deprecated tag with no explanatory comment");
- text = "No replacement.";
- }
- mDeprecatedTagsList.add(new ParsedTagInfo("@deprecated", "@deprecated", text, mBase, pos));
- }
- else if (name.equals("@literal")) {
- mInlineTagsList.add(new LiteralTagInfo(name, name, text, pos));
- }
- else if (name.equals("@hide") || name.equals("@pending") || name.equals("@doconly")) {
- // nothing
- }
- else if (name.equals("@attr")) {
- AttrTagInfo tag = new AttrTagInfo("@attr", "@attr", text, mBase, pos);
- mAttrTagsList.add(tag);
- Comment c = tag.description();
- if (c != null) {
- for (TagInfo t: c.tags()) {
- mInlineTagsList.add(t);
- }
- }
- }
- else if (name.equals("@undeprecate")) {
- mUndeprecateTagsList.add(new TextTagInfo("@undeprecate", "@undeprecate", text, pos));
- }
- else if (name.equals("@include") || name.equals("@sample")) {
- mInlineTagsList.add(new SampleTagInfo(name, "@include", text, mBase, pos));
- }
- else {
- boolean known = false;
- for (String s: KNOWN_TAGS) {
- if (s.equals(name)) {
- known = true;
- break;
- }
- }
- if (!known) {
- known = DroidDoc.knownTags.contains(name);
- }
- if (!known) {
- Errors.error(Errors.UNKNOWN_TAG, pos == null ? null : new SourcePositionInfo(pos),
- "Unknown tag: " + name);
- }
- TagInfo t = new TextTagInfo(name, name, text, pos);
- if (isInline) {
- mInlineTagsList.add(t);
- } else {
- mTagsList.add(t);
- }
- }
- }
-
- private void parseBriefTags()
- {
- int N = mInlineTagsList.size();
-
- // look for "@more" tag, which means that we might go past the first sentence.
- int more = -1;
- for (int i=0; i<N; i++) {
- if (mInlineTagsList.get(i).name().equals("@more")) {
- more = i;
- }
- }
- if (more >= 0) {
- for (int i=0; i<more; i++) {
- mBriefTagsList.add(mInlineTagsList.get(i));
- }
- } else {
- for (int i=0; i<N; i++) {
- TagInfo t = mInlineTagsList.get(i);
- if (t.name().equals("Text")) {
- Matcher m = FIRST_SENTENCE.matcher(t.text());
- if (m.matches()) {
- String text = m.group(1);
- TagInfo firstSentenceTag = new TagInfo(t.name(), t.kind(), text, t.position());
- mBriefTagsList.add(firstSentenceTag);
- break;
- }
- }
- mBriefTagsList.add(t);
-
- }
- }
- }
-
- public TagInfo[] tags()
- {
- init();
- return mInlineTags;
- }
-
- public TagInfo[] tags(String name)
- {
- init();
- ArrayList<TagInfo> results = new ArrayList<TagInfo>();
- int N = mInlineTagsList.size();
- for (int i=0; i<N; i++) {
- TagInfo t = mInlineTagsList.get(i);
- if (t.name().equals(name)) {
- results.add(t);
- }
- }
- return results.toArray(new TagInfo[results.size()]);
- }
-
- public ParamTagInfo[] paramTags()
- {
- init();
- return mParamTags;
- }
-
- public SeeTagInfo[] seeTags()
- {
- init();
- return mSeeTags;
- }
-
- public ThrowsTagInfo[] throwsTags()
- {
- init();
- return mThrowsTags;
- }
-
- public TagInfo[] returnTags()
- {
- init();
- return mReturnTags;
- }
-
- public TagInfo[] deprecatedTags()
- {
- init();
- return mDeprecatedTags;
- }
-
- public TagInfo[] undeprecateTags()
- {
- init();
- return mUndeprecateTags;
- }
-
- public AttrTagInfo[] attrTags()
- {
- init();
- return mAttrTags;
- }
-
- public TagInfo[] briefTags()
- {
- init();
- return mBriefTags;
- }
-
- public boolean isHidden()
- {
- if (mHidden >= 0) {
- return mHidden != 0;
- } else {
- if (DroidDoc.checkLevel(DroidDoc.SHOW_HIDDEN)) {
- mHidden = 0;
- return false;
- }
- boolean b = mText.indexOf("@hide") >= 0 || mText.indexOf("@pending") >= 0;
- mHidden = b ? 1 : 0;
- return b;
- }
- }
-
- public boolean isDocOnly() {
- if (mDocOnly >= 0) {
- return mDocOnly != 0;
- } else {
- boolean b = (mText != null) && (mText.indexOf("@doconly") >= 0);
- mDocOnly = b ? 1 : 0;
- return b;
- }
- }
-
- private void init()
- {
- if (!mInitialized) {
- initImpl();
- }
- }
-
- private void initImpl()
- {
- isHidden();
- isDocOnly();
-
- // Don't bother parsing text if we aren't generating documentation.
- if (DroidDoc.parseComments()) {
- parseRegex(mText);
- parseBriefTags();
- } else {
- // Forces methods to be recognized by findOverriddenMethods in MethodInfo.
- mInlineTagsList.add(new TextTagInfo("Text", "Text", mText,
- SourcePositionInfo.add(mPosition, mText, 0)));
- }
-
- mText = null;
- mInitialized = true;
-
- mInlineTags = mInlineTagsList.toArray(new TagInfo[mInlineTagsList.size()]);
- mParamTags = mParamTagsList.toArray(new ParamTagInfo[mParamTagsList.size()]);
- mSeeTags = mSeeTagsList.toArray(new SeeTagInfo[mSeeTagsList.size()]);
- mThrowsTags = mThrowsTagsList.toArray(new ThrowsTagInfo[mThrowsTagsList.size()]);
- mReturnTags = ParsedTagInfo.joinTags(mReturnTagsList.toArray(
- new ParsedTagInfo[mReturnTagsList.size()]));
- mDeprecatedTags = ParsedTagInfo.joinTags(mDeprecatedTagsList.toArray(
- new ParsedTagInfo[mDeprecatedTagsList.size()]));
- mUndeprecateTags = mUndeprecateTagsList.toArray(new TagInfo[mUndeprecateTagsList.size()]);
- mAttrTags = mAttrTagsList.toArray(new AttrTagInfo[mAttrTagsList.size()]);
- mBriefTags = mBriefTagsList.toArray(new TagInfo[mBriefTagsList.size()]);
-
- mParamTagsList = null;
- mSeeTagsList = null;
- mThrowsTagsList = null;
- mReturnTagsList = null;
- mDeprecatedTagsList = null;
- mUndeprecateTagsList = null;
- mAttrTagsList = null;
- mBriefTagsList = null;
- }
-
- boolean mInitialized;
- int mHidden = -1;
- int mDocOnly = -1;
- String mText;
- ContainerInfo mBase;
- SourcePositionInfo mPosition;
- int mLine = 1;
-
- TagInfo[] mInlineTags;
- TagInfo[] mTags;
- ParamTagInfo[] mParamTags;
- SeeTagInfo[] mSeeTags;
- ThrowsTagInfo[] mThrowsTags;
- TagInfo[] mBriefTags;
- TagInfo[] mReturnTags;
- TagInfo[] mDeprecatedTags;
- TagInfo[] mUndeprecateTags;
- AttrTagInfo[] mAttrTags;
-
- ArrayList<TagInfo> mInlineTagsList = new ArrayList<TagInfo>();
- ArrayList<TagInfo> mTagsList = new ArrayList<TagInfo>();
- ArrayList<ParamTagInfo> mParamTagsList = new ArrayList<ParamTagInfo>();
- ArrayList<SeeTagInfo> mSeeTagsList = new ArrayList<SeeTagInfo>();
- ArrayList<ThrowsTagInfo> mThrowsTagsList = new ArrayList<ThrowsTagInfo>();
- ArrayList<TagInfo> mBriefTagsList = new ArrayList<TagInfo>();
- ArrayList<ParsedTagInfo> mReturnTagsList = new ArrayList<ParsedTagInfo>();
- ArrayList<ParsedTagInfo> mDeprecatedTagsList = new ArrayList<ParsedTagInfo>();
- ArrayList<TagInfo> mUndeprecateTagsList = new ArrayList<TagInfo>();
- ArrayList<AttrTagInfo> mAttrTagsList = new ArrayList<AttrTagInfo>();
-
-
-}
diff --git a/tools/droiddoc/src/ContainerInfo.java b/tools/droiddoc/src/ContainerInfo.java
deleted file mode 100644
index b8a3e10..0000000
--- a/tools/droiddoc/src/ContainerInfo.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public interface ContainerInfo
-{
- public String qualifiedName();
- public boolean checkLevel();
-}
diff --git a/tools/droiddoc/src/Converter.java b/tools/droiddoc/src/Converter.java
deleted file mode 100644
index ee911f4..0000000
--- a/tools/droiddoc/src/Converter.java
+++ /dev/null
@@ -1,755 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import com.sun.javadoc.*;
-import com.sun.tools.doclets.*;
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-
-public class Converter
-{
- private static RootDoc root;
-
- public static void makeInfo(RootDoc r)
- {
- root = r;
-
- int N, i;
-
- // create the objects
- ClassDoc[] classDocs = r.classes();
- N = classDocs.length;
- for (i=0; i<N; i++) {
- Converter.obtainClass(classDocs[i]);
- }
- ArrayList<ClassInfo> classesNeedingInit2 = new ArrayList<ClassInfo>();
- // fill in the fields that reference other classes
- while (mClassesNeedingInit.size() > 0) {
- i = mClassesNeedingInit.size()-1;
- ClassNeedingInit clni = mClassesNeedingInit.get(i);
- mClassesNeedingInit.remove(i);
-
- initClass(clni.c, clni.cl);
- classesNeedingInit2.add(clni.cl);
- }
- mClassesNeedingInit = null;
- for (ClassInfo cl: classesNeedingInit2) {
- cl.init2();
- }
-
- finishAnnotationValueInit();
-
- // fill in the "root" stuff
- mRootClasses = Converter.convertClasses(r.classes());
- }
-
- private static ClassInfo[] mRootClasses;
- public static ClassInfo[] rootClasses()
- {
- return mRootClasses;
- }
-
- public static ClassInfo[] allClasses() {
- return (ClassInfo[])mClasses.all();
- }
-
- private static void initClass(ClassDoc c, ClassInfo cl)
- {
- MethodDoc[] annotationElements;
- if (c instanceof AnnotationTypeDoc) {
- annotationElements = ((AnnotationTypeDoc)c).elements();
- } else {
- annotationElements = new MethodDoc[0];
- }
- cl.init(Converter.obtainType(c),
- Converter.convertClasses(c.interfaces()),
- Converter.convertTypes(c.interfaceTypes()),
- Converter.convertClasses(c.innerClasses()),
- Converter.convertMethods(c.constructors(false)),
- Converter.convertMethods(c.methods(false)),
- Converter.convertMethods(annotationElements),
- Converter.convertFields(c.fields(false)),
- Converter.convertFields(c.enumConstants()),
- Converter.obtainPackage(c.containingPackage()),
- Converter.obtainClass(c.containingClass()),
- Converter.obtainClass(c.superclass()),
- Converter.obtainType(c.superclassType()),
- Converter.convertAnnotationInstances(c.annotations())
- );
- cl.setHiddenMethods(Converter.getHiddenMethods(c.methods(false)));
- cl.setNonWrittenConstructors(Converter.convertNonWrittenConstructors(c.constructors(false)));
- cl.init3(Converter.convertTypes(c.typeParameters()), Converter.convertClasses(c.innerClasses(false)));
- }
-
- public static ClassInfo obtainClass(String className)
- {
- return Converter.obtainClass(root.classNamed(className));
- }
-
- public static PackageInfo obtainPackage(String packageName)
- {
- return Converter.obtainPackage(root.packageNamed(packageName));
- }
-
- private static TagInfo convertTag(Tag tag)
- {
- return new TextTagInfo(tag.name(), tag.kind(), tag.text(),
- Converter.convertSourcePosition(tag.position()));
- }
-
- private static ThrowsTagInfo convertThrowsTag(ThrowsTag tag,
- ContainerInfo base)
- {
- return new ThrowsTagInfo(tag.name(), tag.text(), tag.kind(),
- Converter.obtainClass(tag.exception()),
- tag.exceptionComment(), base,
- Converter.convertSourcePosition(tag.position()));
- }
-
- private static ParamTagInfo convertParamTag(ParamTag tag,
- ContainerInfo base)
- {
- return new ParamTagInfo(tag.name(), tag.kind(), tag.text(),
- tag.isTypeParameter(), tag.parameterComment(),
- tag.parameterName(),
- base,
- Converter.convertSourcePosition(tag.position()));
- }
-
- private static SeeTagInfo convertSeeTag(SeeTag tag, ContainerInfo base)
- {
- return new SeeTagInfo(tag.name(), tag.kind(), tag.text(), base,
- Converter.convertSourcePosition(tag.position()));
- }
-
- private static SourcePositionInfo convertSourcePosition(SourcePosition sp)
- {
- if (sp == null) {
- return null;
- }
- return new SourcePositionInfo(sp.file().toString(), sp.line(),
- sp.column());
- }
-
- public static TagInfo[] convertTags(Tag[] tags, ContainerInfo base)
- {
- int len = tags.length;
- TagInfo[] out = new TagInfo[len];
- for (int i=0; i<len; i++) {
- Tag t = tags[i];
- /*
- System.out.println("Tag name='" + t.name() + "' kind='"
- + t.kind() + "'");
- */
- if (t instanceof SeeTag) {
- out[i] = Converter.convertSeeTag((SeeTag)t, base);
- }
- else if (t instanceof ThrowsTag) {
- out[i] = Converter.convertThrowsTag((ThrowsTag)t, base);
- }
- else if (t instanceof ParamTag) {
- out[i] = Converter.convertParamTag((ParamTag)t, base);
- }
- else {
- out[i] = Converter.convertTag(t);
- }
- }
- return out;
- }
-
- public static ClassInfo[] convertClasses(ClassDoc[] classes)
- {
- if (classes == null) return null;
- int N = classes.length;
- ClassInfo[] result = new ClassInfo[N];
- for (int i=0; i<N; i++) {
- result[i] = Converter.obtainClass(classes[i]);
- }
- return result;
- }
-
- private static ParameterInfo convertParameter(Parameter p, SourcePosition pos)
- {
- if (p == null) return null;
- ParameterInfo pi = new ParameterInfo(p.name(), p.typeName(),
- Converter.obtainType(p.type()),
- Converter.convertSourcePosition(pos));
- return pi;
- }
-
- private static ParameterInfo[] convertParameters(Parameter[] p, MemberDoc m)
- {
- SourcePosition pos = m.position();
- int len = p.length;
- ParameterInfo[] q = new ParameterInfo[len];
- for (int i=0; i<len; i++) {
- q[i] = Converter.convertParameter(p[i], pos);
- }
- return q;
- }
-
- private static TypeInfo[] convertTypes(Type[] p)
- {
- if (p == null) return null;
- int len = p.length;
- TypeInfo[] q = new TypeInfo[len];
- for (int i=0; i<len; i++) {
- q[i] = Converter.obtainType(p[i]);
- }
- return q;
- }
-
- private Converter()
- {
- }
-
- private static class ClassNeedingInit
- {
- ClassNeedingInit(ClassDoc c, ClassInfo cl)
- {
- this.c = c;
- this.cl = cl;
- }
- ClassDoc c;
- ClassInfo cl;
- };
- private static ArrayList<ClassNeedingInit> mClassesNeedingInit
- = new ArrayList<ClassNeedingInit>();
-
- static ClassInfo obtainClass(ClassDoc o)
- {
- return (ClassInfo)mClasses.obtain(o);
- }
- private static Cache mClasses = new Cache()
- {
- @Override
- protected Object make(Object o)
- {
- ClassDoc c = (ClassDoc)o;
- ClassInfo cl = new ClassInfo(
- c,
- c.getRawCommentText(),
- Converter.convertSourcePosition(c.position()),
- c.isPublic(),
- c.isProtected(),
- c.isPackagePrivate(),
- c.isPrivate(),
- c.isStatic(),
- c.isInterface(),
- c.isAbstract(),
- c.isOrdinaryClass(),
- c.isException(),
- c.isError(),
- c.isEnum(),
- (c instanceof AnnotationTypeDoc),
- c.isFinal(),
- c.isIncluded(),
- c.name(),
- c.qualifiedName(),
- c.qualifiedTypeName(),
- c.isPrimitive());
- if (mClassesNeedingInit != null) {
- mClassesNeedingInit.add(new ClassNeedingInit(c, cl));
- }
- return cl;
- }
- @Override
- protected void made(Object o, Object r)
- {
- if (mClassesNeedingInit == null) {
- initClass((ClassDoc)o, (ClassInfo)r);
- ((ClassInfo)r).init2();
- }
- }
- @Override
- ClassInfo[] all()
- {
- return (ClassInfo[])mCache.values().toArray(new ClassInfo[mCache.size()]);
- }
- };
-
- private static MethodInfo[] getHiddenMethods(MethodDoc[] methods){
- if (methods == null) return null;
- ArrayList<MethodInfo> out = new ArrayList<MethodInfo>();
- int N = methods.length;
- for (int i=0; i<N; i++) {
- MethodInfo m = Converter.obtainMethod(methods[i]);
- //System.out.println(m.toString() + ": ");
- //for (TypeInfo ti : m.getTypeParameters()){
- // if (ti.asClassInfo() != null){
- //System.out.println(" " +ti.asClassInfo().toString());
- //} else {
- //System.out.println(" null");
- //}
- //}
- if (m.isHidden()) {
- out.add(m);
- }
- }
- return out.toArray(new MethodInfo[out.size()]);
- }
-
- /**
- * Convert MethodDoc[] into MethodInfo[]. Also filters according
- * to the -private, -public option, because the filtering doesn't seem
- * to be working in the ClassDoc.constructors(boolean) call.
- */
- private static MethodInfo[] convertMethods(MethodDoc[] methods)
- {
- if (methods == null) return null;
- ArrayList<MethodInfo> out = new ArrayList<MethodInfo>();
- int N = methods.length;
- for (int i=0; i<N; i++) {
- MethodInfo m = Converter.obtainMethod(methods[i]);
- //System.out.println(m.toString() + ": ");
- //for (TypeInfo ti : m.getTypeParameters()){
- // if (ti.asClassInfo() != null){
- //System.out.println(" " +ti.asClassInfo().toString());
- //} else {
- //System.out.println(" null");
- //}
- //}
- if (m.checkLevel()) {
- out.add(m);
- }
- }
- return out.toArray(new MethodInfo[out.size()]);
- }
-
- private static MethodInfo[] convertMethods(ConstructorDoc[] methods)
- {
- if (methods == null) return null;
- ArrayList<MethodInfo> out = new ArrayList<MethodInfo>();
- int N = methods.length;
- for (int i=0; i<N; i++) {
- MethodInfo m = Converter.obtainMethod(methods[i]);
- if (m.checkLevel()) {
- out.add(m);
- }
- }
- return out.toArray(new MethodInfo[out.size()]);
- }
-
- private static MethodInfo[] convertNonWrittenConstructors(ConstructorDoc[] methods)
- {
- if (methods == null) return null;
- ArrayList<MethodInfo> out = new ArrayList<MethodInfo>();
- int N = methods.length;
- for (int i=0; i<N; i++) {
- MethodInfo m = Converter.obtainMethod(methods[i]);
- if (!m.checkLevel()) {
- out.add(m);
- }
- }
- return out.toArray(new MethodInfo[out.size()]);
- }
-
- private static MethodInfo obtainMethod(MethodDoc o)
- {
- return (MethodInfo)mMethods.obtain(o);
- }
- private static MethodInfo obtainMethod(ConstructorDoc o)
- {
- return (MethodInfo)mMethods.obtain(o);
- }
- private static Cache mMethods = new Cache()
- {
- @Override
- protected Object make(Object o)
- {
- if (o instanceof AnnotationTypeElementDoc) {
- AnnotationTypeElementDoc m = (AnnotationTypeElementDoc)o;
- MethodInfo result = new MethodInfo(
- m.getRawCommentText(),
- Converter.convertTypes(m.typeParameters()),
- m.name(), m.signature(),
- Converter.obtainClass(m.containingClass()),
- Converter.obtainClass(m.containingClass()),
- m.isPublic(), m.isProtected(),
- m.isPackagePrivate(), m.isPrivate(),
- m.isFinal(), m.isStatic(), m.isSynthetic(),
- m.isAbstract(), m.isSynchronized(), m.isNative(), true,
- "annotationElement",
- m.flatSignature(),
- Converter.obtainMethod(m.overriddenMethod()),
- Converter.obtainType(m.returnType()),
- Converter.convertParameters(m.parameters(), m),
- Converter.convertClasses(m.thrownExceptions()),
- Converter.convertSourcePosition(m.position()),
- Converter.convertAnnotationInstances(m.annotations())
- );
- result.setVarargs(m.isVarArgs());
- result.init(Converter.obtainAnnotationValue(m.defaultValue(), result));
- return result;
- }
- else if (o instanceof MethodDoc) {
- MethodDoc m = (MethodDoc)o;
- MethodInfo result = new MethodInfo(
- m.getRawCommentText(),
- Converter.convertTypes(m.typeParameters()),
- m.name(), m.signature(),
- Converter.obtainClass(m.containingClass()),
- Converter.obtainClass(m.containingClass()),
- m.isPublic(), m.isProtected(),
- m.isPackagePrivate(), m.isPrivate(),
- m.isFinal(), m.isStatic(), m.isSynthetic(),
- m.isAbstract(), m.isSynchronized(), m.isNative(), false,
- "method",
- m.flatSignature(),
- Converter.obtainMethod(m.overriddenMethod()),
- Converter.obtainType(m.returnType()),
- Converter.convertParameters(m.parameters(), m),
- Converter.convertClasses(m.thrownExceptions()),
- Converter.convertSourcePosition(m.position()),
- Converter.convertAnnotationInstances(m.annotations())
- );
- result.setVarargs(m.isVarArgs());
- result.init(null);
- return result;
- }
- else {
- ConstructorDoc m = (ConstructorDoc)o;
- MethodInfo result = new MethodInfo(
- m.getRawCommentText(),
- Converter.convertTypes(m.typeParameters()),
- m.name(), m.signature(),
- Converter.obtainClass(m.containingClass()),
- Converter.obtainClass(m.containingClass()),
- m.isPublic(), m.isProtected(),
- m.isPackagePrivate(), m.isPrivate(),
- m.isFinal(), m.isStatic(), m.isSynthetic(),
- false, m.isSynchronized(), m.isNative(), false,
- "constructor",
- m.flatSignature(),
- null,
- null,
- Converter.convertParameters(m.parameters(), m),
- Converter.convertClasses(m.thrownExceptions()),
- Converter.convertSourcePosition(m.position()),
- Converter.convertAnnotationInstances(m.annotations())
- );
- result.setVarargs(m.isVarArgs());
- result.init(null);
- return result;
- }
- }
- };
-
-
- private static FieldInfo[] convertFields(FieldDoc[] fields)
- {
- if (fields == null) return null;
- ArrayList<FieldInfo> out = new ArrayList<FieldInfo>();
- int N = fields.length;
- for (int i=0; i<N; i++) {
- FieldInfo f = Converter.obtainField(fields[i]);
- if (f.checkLevel()) {
- out.add(f);
- }
- }
- return out.toArray(new FieldInfo[out.size()]);
- }
-
- private static FieldInfo obtainField(FieldDoc o)
- {
- return (FieldInfo)mFields.obtain(o);
- }
- private static FieldInfo obtainField(ConstructorDoc o)
- {
- return (FieldInfo)mFields.obtain(o);
- }
- private static Cache mFields = new Cache()
- {
- @Override
- protected Object make(Object o)
- {
- FieldDoc f = (FieldDoc)o;
- return new FieldInfo(f.name(),
- Converter.obtainClass(f.containingClass()),
- Converter.obtainClass(f.containingClass()),
- f.isPublic(), f.isProtected(),
- f.isPackagePrivate(), f.isPrivate(),
- f.isFinal(), f.isStatic(), f.isTransient(), f.isVolatile(),
- f.isSynthetic(),
- Converter.obtainType(f.type()),
- f.getRawCommentText(), f.constantValue(),
- Converter.convertSourcePosition(f.position()),
- Converter.convertAnnotationInstances(f.annotations())
- );
- }
- };
-
- private static PackageInfo obtainPackage(PackageDoc o)
- {
- return (PackageInfo)mPackagees.obtain(o);
- }
- private static Cache mPackagees = new Cache()
- {
- @Override
- protected Object make(Object o)
- {
- PackageDoc p = (PackageDoc)o;
- return new PackageInfo(p, p.name(),
- Converter.convertSourcePosition(p.position()));
- }
- };
-
- private static TypeInfo obtainType(Type o)
- {
- return (TypeInfo)mTypes.obtain(o);
- }
- private static Cache mTypes = new Cache()
- {
- @Override
- protected Object make(Object o)
- {
- Type t = (Type)o;
- String simpleTypeName;
- if (t instanceof ClassDoc) {
- simpleTypeName = ((ClassDoc)t).name();
- } else {
- simpleTypeName = t.simpleTypeName();
- }
- TypeInfo ti = new TypeInfo(t.isPrimitive(), t.dimension(),
- simpleTypeName, t.qualifiedTypeName(),
- Converter.obtainClass(t.asClassDoc()));
- return ti;
- }
- @Override
- protected void made(Object o, Object r)
- {
- Type t = (Type)o;
- TypeInfo ti = (TypeInfo)r;
- if (t.asParameterizedType() != null) {
- ti.setTypeArguments(Converter.convertTypes(
- t.asParameterizedType().typeArguments()));
- }
- else if (t instanceof ClassDoc) {
- ti.setTypeArguments(Converter.convertTypes(((ClassDoc)t).typeParameters()));
- }
- else if (t.asTypeVariable() != null) {
- ti.setBounds(null, Converter.convertTypes((t.asTypeVariable().bounds())));
- ti.setIsTypeVariable(true);
- }
- else if (t.asWildcardType() != null) {
- ti.setIsWildcard(true);
- ti.setBounds(Converter.convertTypes(t.asWildcardType().superBounds()),
- Converter.convertTypes(t.asWildcardType().extendsBounds()));
- }
- }
- @Override
- protected Object keyFor(Object o)
- {
- Type t = (Type)o;
- String keyString = o.getClass().getName() + "/" + o.toString() + "/";
- if (t.asParameterizedType() != null){
- keyString += t.asParameterizedType().toString() +"/";
- if (t.asParameterizedType().typeArguments() != null){
- for(Type ty : t.asParameterizedType().typeArguments()){
- keyString += ty.toString() + "/";
- }
- }
- }else{
- keyString += "NoParameterizedType//";
- }
- if (t.asTypeVariable() != null){
- keyString += t.asTypeVariable().toString() +"/";
- if (t.asTypeVariable().bounds() != null){
- for(Type ty : t.asTypeVariable().bounds()){
- keyString += ty.toString() + "/";
- }
- }
- }else{
- keyString += "NoTypeVariable//";
- }
- if (t.asWildcardType() != null){
- keyString += t.asWildcardType().toString() +"/";
- if (t.asWildcardType().superBounds() != null){
- for(Type ty : t.asWildcardType().superBounds()){
- keyString += ty.toString() + "/";
- }
- }
- if (t.asWildcardType().extendsBounds() != null){
- for(Type ty : t.asWildcardType().extendsBounds()){
- keyString += ty.toString() + "/";
- }
- }
- }else{
- keyString += "NoWildCardType//";
- }
-
-
-
- return keyString;
- }
- };
-
-
-
- private static MemberInfo obtainMember(MemberDoc o)
- {
- return (MemberInfo)mMembers.obtain(o);
- }
- private static Cache mMembers = new Cache()
- {
- @Override
- protected Object make(Object o)
- {
- if (o instanceof MethodDoc) {
- return Converter.obtainMethod((MethodDoc)o);
- }
- else if (o instanceof ConstructorDoc) {
- return Converter.obtainMethod((ConstructorDoc)o);
- }
- else if (o instanceof FieldDoc) {
- return Converter.obtainField((FieldDoc)o);
- }
- else {
- return null;
- }
- }
- };
-
- private static AnnotationInstanceInfo[] convertAnnotationInstances(AnnotationDesc[] orig)
- {
- int len = orig.length;
- AnnotationInstanceInfo[] out = new AnnotationInstanceInfo[len];
- for (int i=0; i<len; i++) {
- out[i] = Converter.obtainAnnotationInstance(orig[i]);
- }
- return out;
- }
-
-
- private static AnnotationInstanceInfo obtainAnnotationInstance(AnnotationDesc o)
- {
- return (AnnotationInstanceInfo)mAnnotationInstances.obtain(o);
- }
- private static Cache mAnnotationInstances = new Cache()
- {
- @Override
- protected Object make(Object o)
- {
- AnnotationDesc a = (AnnotationDesc)o;
- ClassInfo annotationType = Converter.obtainClass(a.annotationType());
- AnnotationDesc.ElementValuePair[] ev = a.elementValues();
- AnnotationValueInfo[] elementValues = new AnnotationValueInfo[ev.length];
- for (int i=0; i<ev.length; i++) {
- elementValues[i] = obtainAnnotationValue(ev[i].value(),
- Converter.obtainMethod(ev[i].element()));
- }
- return new AnnotationInstanceInfo(annotationType, elementValues);
- }
- };
-
-
- private abstract static class Cache
- {
- void put(Object key, Object value)
- {
- mCache.put(key, value);
- }
- Object obtain(Object o)
- {
- if (o == null ) {
- return null;
- }
- Object k = keyFor(o);
- Object r = mCache.get(k);
- if (r == null) {
- r = make(o);
- mCache.put(k, r);
- made(o, r);
- }
- return r;
- }
- protected HashMap<Object,Object> mCache = new HashMap<Object,Object>();
- protected abstract Object make(Object o);
- protected void made(Object o, Object r)
- {
- }
- protected Object keyFor(Object o) { return o; }
- Object[] all() { return null; }
- }
-
- // annotation values
- private static HashMap<AnnotationValue,AnnotationValueInfo> mAnnotationValues = new HashMap();
- private static HashSet<AnnotationValue> mAnnotationValuesNeedingInit = new HashSet();
-
- private static AnnotationValueInfo obtainAnnotationValue(AnnotationValue o, MethodInfo element)
- {
- if (o == null) {
- return null;
- }
- AnnotationValueInfo v = mAnnotationValues.get(o);
- if (v != null) return v;
- v = new AnnotationValueInfo(element);
- mAnnotationValues.put(o, v);
- if (mAnnotationValuesNeedingInit != null) {
- mAnnotationValuesNeedingInit.add(o);
- } else {
- initAnnotationValue(o, v);
- }
- return v;
- }
-
- private static void initAnnotationValue(AnnotationValue o, AnnotationValueInfo v) {
- Object orig = o.value();
- Object converted;
- if (orig instanceof Type) {
- // class literal
- converted = Converter.obtainType((Type)orig);
- }
- else if (orig instanceof FieldDoc) {
- // enum constant
- converted = Converter.obtainField((FieldDoc)orig);
- }
- else if (orig instanceof AnnotationDesc) {
- // annotation instance
- converted = Converter.obtainAnnotationInstance((AnnotationDesc)orig);
- }
- else if (orig instanceof AnnotationValue[]) {
- AnnotationValue[] old = (AnnotationValue[])orig;
- AnnotationValueInfo[] array = new AnnotationValueInfo[old.length];
- for (int i=0; i<array.length; i++) {
- array[i] = Converter.obtainAnnotationValue(old[i], null);
- }
- converted = array;
- }
- else {
- converted = orig;
- }
- v.init(converted);
- }
-
- private static void finishAnnotationValueInit()
- {
- int depth = 0;
- while (mAnnotationValuesNeedingInit.size() > 0) {
- HashSet<AnnotationValue> set = mAnnotationValuesNeedingInit;
- mAnnotationValuesNeedingInit = new HashSet();
- for (AnnotationValue o: set) {
- AnnotationValueInfo v = mAnnotationValues.get(o);
- initAnnotationValue(o, v);
- }
- depth++;
- }
- mAnnotationValuesNeedingInit = null;
- }
-}
diff --git a/tools/droiddoc/src/DocFile.java b/tools/droiddoc/src/DocFile.java
deleted file mode 100644
index 180fdcd..0000000
--- a/tools/droiddoc/src/DocFile.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.*;
-import java.io.*;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-
-public class DocFile
-{
- private static final Pattern LINE = Pattern.compile("(.*)[\r]?\n",
- Pattern.MULTILINE);
- private static final Pattern PROP = Pattern.compile("([^=]+)=(.*)");
-
- public static String readFile(String filename)
- {
- try {
- File f = new File(filename);
- int length = (int)f.length();
- FileInputStream is = new FileInputStream(f);
- InputStreamReader reader = new InputStreamReader(is, "UTF-8");
- char[] buf = new char[length];
- int index = 0;
- int amt;
- while (true) {
- amt = reader.read(buf, index, length-index);
-
- if (amt < 1) {
- break;
- }
-
- index += amt;
- }
- return new String(buf, 0, index);
- }
- catch (IOException e) {
- return null;
- }
- }
-
- public static void writePage(String docfile, String relative,
- String outfile)
- {
- HDF hdf = DroidDoc.makeHDF();
-
- /*
- System.out.println("docfile='" + docfile
- + "' relative='" + relative + "'"
- + "' outfile='" + outfile + "'");
- */
-
- String filedata = readFile(docfile);
-
- // The document is properties up until the line "@jd:body".
- // Any blank lines are ignored.
- int start = -1;
- int lineno = 1;
- Matcher lines = LINE.matcher(filedata);
- String line = null;
- while (lines.find()) {
- line = lines.group(1);
- if (line.length() > 0) {
- if (line.equals("@jd:body")) {
- start = lines.end();
- break;
- }
- Matcher prop = PROP.matcher(line);
- if (prop.matches()) {
- String key = prop.group(1);
- String value = prop.group(2);
- hdf.setValue(key, value);
- } else {
- break;
- }
- }
- lineno++;
- }
- if (start < 0) {
- System.err.println(docfile + ":" + lineno + ": error parsing docfile");
- if (line != null) {
- System.err.println(docfile + ":" + lineno + ":" + line);
- }
- System.exit(1);
- }
-
- // if they asked to only be for a certain template, maybe skip it
- String fromTemplate = hdf.getValue("template.which", "");
- String fromPage = hdf.getValue("page.onlyfortemplate", "");
- if (!"".equals(fromPage) && !fromTemplate.equals(fromPage)) {
- return;
- }
-
- // and the actual text after that
- String commentText = filedata.substring(start);
-
- Comment comment = new Comment(commentText, null,
- new SourcePositionInfo(docfile, lineno, 1));
- TagInfo[] tags = comment.tags();
-
- TagInfo.makeHDF(hdf, "root.descr", tags);
-
- hdf.setValue("commentText", commentText);
-
- // write the page using the appropriate root template, based on the
- // whichdoc value supplied by build
- String fromWhichmodule = hdf.getValue("android.whichmodule", "");
- if (fromWhichmodule.equals("online-pdk")) {
- //leaving this in just for temporary compatibility with pdk doc
- hdf.setValue("online-pdk", "true");
- // add any conditional login for root template here (such as
- // for custom left nav based on tab etc.
- ClearPage.write(hdf, "docpage.cs", outfile);
- } else {
- if (outfile.indexOf("sdk/") != -1) {
- hdf.setValue("sdk", "true");
- if ((outfile.indexOf("index.html") != -1) && (outfile.indexOf("preview/") == -1)) {
- ClearPage.write(hdf, "sdkpage.cs", outfile);
- } else {
- ClearPage.write(hdf, "docpage.cs", outfile);
- }
- } else if (outfile.indexOf("guide/") != -1) {
- hdf.setValue("guide", "true");
- ClearPage.write(hdf, "docpage.cs", outfile);
- } else if (outfile.indexOf("resources/") != -1) {
- hdf.setValue("resources", "true");
- ClearPage.write(hdf, "docpage.cs", outfile);
- } else {
- ClearPage.write(hdf, "nosidenavpage.cs", outfile);
- }
- }
- } //writePage
-}
diff --git a/tools/droiddoc/src/DocInfo.java b/tools/droiddoc/src/DocInfo.java
deleted file mode 100644
index 3abb367..0000000
--- a/tools/droiddoc/src/DocInfo.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public abstract class DocInfo
-{
- public DocInfo(String rawCommentText, SourcePositionInfo sp)
- {
- mRawCommentText = rawCommentText;
- mPosition = sp;
- }
-
- public boolean isHidden()
- {
- return comment().isHidden();
- }
-
- public boolean isDocOnly() {
- return comment().isDocOnly();
- }
-
- public String getRawCommentText()
- {
- return mRawCommentText;
- }
-
- public Comment comment()
- {
- if (mComment == null) {
- mComment = new Comment(mRawCommentText, parent(), mPosition);
- }
- return mComment;
- }
-
- public SourcePositionInfo position()
- {
- return mPosition;
- }
-
- public abstract ContainerInfo parent();
-
- public void setSince(String since) {
- mSince = since;
- }
-
- public String getSince() {
- return mSince;
- }
-
- private String mRawCommentText;
- Comment mComment;
- SourcePositionInfo mPosition;
- private String mSince;
-}
-
diff --git a/tools/droiddoc/src/DroidDoc.java b/tools/droiddoc/src/DroidDoc.java
deleted file mode 100644
index dfdbda6..0000000
--- a/tools/droiddoc/src/DroidDoc.java
+++ /dev/null
@@ -1,1465 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import com.sun.javadoc.*;
-
-import org.clearsilver.HDF;
-
-import java.util.*;
-import java.io.*;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-public class DroidDoc
-{
- private static final String SDK_CONSTANT_ANNOTATION = "android.annotation.SdkConstant";
- private static final String SDK_CONSTANT_TYPE_ACTIVITY_ACTION = "android.annotation.SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION";
- private static final String SDK_CONSTANT_TYPE_BROADCAST_ACTION = "android.annotation.SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION";
- private static final String SDK_CONSTANT_TYPE_SERVICE_ACTION = "android.annotation.SdkConstant.SdkConstantType.SERVICE_INTENT_ACTION";
- private static final String SDK_CONSTANT_TYPE_CATEGORY = "android.annotation.SdkConstant.SdkConstantType.INTENT_CATEGORY";
- private static final String SDK_CONSTANT_TYPE_FEATURE = "android.annotation.SdkConstant.SdkConstantType.FEATURE";
- private static final String SDK_WIDGET_ANNOTATION = "android.annotation.Widget";
- private static final String SDK_LAYOUT_ANNOTATION = "android.annotation.Layout";
-
- private static final int TYPE_NONE = 0;
- private static final int TYPE_WIDGET = 1;
- private static final int TYPE_LAYOUT = 2;
- private static final int TYPE_LAYOUT_PARAM = 3;
-
- public static final int SHOW_PUBLIC = 0x00000001;
- public static final int SHOW_PROTECTED = 0x00000003;
- public static final int SHOW_PACKAGE = 0x00000007;
- public static final int SHOW_PRIVATE = 0x0000000f;
- public static final int SHOW_HIDDEN = 0x0000001f;
-
- public static int showLevel = SHOW_PROTECTED;
-
- public static final String javadocDir = "reference/";
- public static String htmlExtension;
-
- public static RootDoc root;
- public static ArrayList<String[]> mHDFData = new ArrayList<String[]>();
- public static Map<Character,String> escapeChars = new HashMap<Character,String>();
- public static String title = "";
- public static SinceTagger sinceTagger = new SinceTagger();
- public static HashSet<String> knownTags = new HashSet<String>();
-
- private static boolean parseComments = false;
- private static boolean generateDocs = true;
-
- /**
- * Returns true if we should parse javadoc comments,
- * reporting errors in the process.
- */
- public static boolean parseComments() {
- return generateDocs || parseComments;
- }
-
- public static boolean checkLevel(int level)
- {
- return (showLevel & level) == level;
- }
-
- public static boolean checkLevel(boolean pub, boolean prot, boolean pkgp,
- boolean priv, boolean hidden)
- {
- int level = 0;
- if (hidden && !checkLevel(SHOW_HIDDEN)) {
- return false;
- }
- if (pub && checkLevel(SHOW_PUBLIC)) {
- return true;
- }
- if (prot && checkLevel(SHOW_PROTECTED)) {
- return true;
- }
- if (pkgp && checkLevel(SHOW_PACKAGE)) {
- return true;
- }
- if (priv && checkLevel(SHOW_PRIVATE)) {
- return true;
- }
- return false;
- }
-
- public static boolean start(RootDoc r)
- {
- String keepListFile = null;
- String proofreadFile = null;
- String todoFile = null;
- String sdkValuePath = null;
- ArrayList<SampleCode> sampleCodes = new ArrayList<SampleCode>();
- String stubsDir = null;
- //Create the dependency graph for the stubs directory
- boolean apiXML = false;
- boolean offlineMode = false;
- String apiFile = null;
- String debugStubsFile = "";
- HashSet<String> stubPackages = null;
- ArrayList<String> knownTagsFiles = new ArrayList<String>();
-
- root = r;
-
- String[][] options = r.options();
- for (String[] a: options) {
- if (a[0].equals("-d")) {
- ClearPage.outputDir = a[1];
- }
- else if (a[0].equals("-templatedir")) {
- ClearPage.addTemplateDir(a[1]);
- }
- else if (a[0].equals("-hdf")) {
- mHDFData.add(new String[] {a[1], a[2]});
- }
- else if (a[0].equals("-knowntags")) {
- knownTagsFiles.add(a[1]);
- }
- else if (a[0].equals("-toroot")) {
- ClearPage.toroot = a[1];
- }
- else if (a[0].equals("-samplecode")) {
- sampleCodes.add(new SampleCode(a[1], a[2], a[3]));
- }
- else if (a[0].equals("-htmldir")) {
- ClearPage.htmlDirs.add(a[1]);
- }
- else if (a[0].equals("-title")) {
- DroidDoc.title = a[1];
- }
- else if (a[0].equals("-werror")) {
- Errors.setWarningsAreErrors(true);
- }
- else if (a[0].equals("-error") || a[0].equals("-warning")
- || a[0].equals("-hide")) {
- try {
- int level = -1;
- if (a[0].equals("-error")) {
- level = Errors.ERROR;
- }
- else if (a[0].equals("-warning")) {
- level = Errors.WARNING;
- }
- else if (a[0].equals("-hide")) {
- level = Errors.HIDDEN;
- }
- Errors.setErrorLevel(Integer.parseInt(a[1]), level);
- }
- catch (NumberFormatException e) {
- // already printed below
- return false;
- }
- }
- else if (a[0].equals("-keeplist")) {
- keepListFile = a[1];
- }
- else if (a[0].equals("-proofread")) {
- proofreadFile = a[1];
- }
- else if (a[0].equals("-todo")) {
- todoFile = a[1];
- }
- else if (a[0].equals("-public")) {
- showLevel = SHOW_PUBLIC;
- }
- else if (a[0].equals("-protected")) {
- showLevel = SHOW_PROTECTED;
- }
- else if (a[0].equals("-package")) {
- showLevel = SHOW_PACKAGE;
- }
- else if (a[0].equals("-private")) {
- showLevel = SHOW_PRIVATE;
- }
- else if (a[0].equals("-hidden")) {
- showLevel = SHOW_HIDDEN;
- }
- else if (a[0].equals("-stubs")) {
- stubsDir = a[1];
- }
- else if (a[0].equals("-stubpackages")) {
- stubPackages = new HashSet();
- for (String pkg: a[1].split(":")) {
- stubPackages.add(pkg);
- }
- }
- else if (a[0].equals("-sdkvalues")) {
- sdkValuePath = a[1];
- }
- else if (a[0].equals("-apixml")) {
- apiXML = true;
- apiFile = a[1];
- }
- else if (a[0].equals("-nodocs")) {
- generateDocs = false;
- }
- else if (a[0].equals("-parsecomments")) {
- parseComments = true;
- }
- else if (a[0].equals("-since")) {
- sinceTagger.addVersion(a[1], a[2]);
- }
- else if (a[0].equals("-offlinemode")) {
- offlineMode = true;
- }
- }
-
- if (!readKnownTagsFiles(knownTags, knownTagsFiles)) {
- return false;
- }
-
- // read some prefs from the template
- if (!readTemplateSettings()) {
- return false;
- }
-
- // Set up the data structures
- Converter.makeInfo(r);
-
- if (generateDocs) {
- long startTime = System.nanoTime();
-
- // Apply @since tags from the XML file
- sinceTagger.tagAll(Converter.rootClasses());
-
- // Files for proofreading
- if (proofreadFile != null) {
- Proofread.initProofread(proofreadFile);
- }
- if (todoFile != null) {
- TodoFile.writeTodoFile(todoFile);
- }
-
- // HTML Pages
- if (!ClearPage.htmlDirs.isEmpty()) {
- writeHTMLPages();
- }
-
- // Navigation tree
- NavTree.writeNavTree(javadocDir);
-
- // Packages Pages
- writePackages(javadocDir
- + (!ClearPage.htmlDirs.isEmpty()
- ? "packages" + htmlExtension
- : "index" + htmlExtension));
-
- // Classes
- writeClassLists();
- writeClasses();
- writeHierarchy();
- // writeKeywords();
-
- // Lists for JavaScript
- writeLists();
- if (keepListFile != null) {
- writeKeepList(keepListFile);
- }
-
- // Sample Code
- for (SampleCode sc: sampleCodes) {
- sc.write(offlineMode);
- }
-
- // Index page
- writeIndex();
-
- Proofread.finishProofread(proofreadFile);
-
- if (sdkValuePath != null) {
- writeSdkValues(sdkValuePath);
- }
-
- long time = System.nanoTime() - startTime;
- System.out.println("DroidDoc took " + (time / 1000000000) + " sec. to write docs to "
- + ClearPage.outputDir);
- }
-
- // Stubs
- if (stubsDir != null) {
- Stubs.writeStubs(stubsDir, apiXML, apiFile, stubPackages);
- }
-
- Errors.printErrors();
- return !Errors.hadError;
- }
-
- private static void writeIndex() {
- HDF data = makeHDF();
- ClearPage.write(data, "index.cs", javadocDir + "index" + htmlExtension);
- }
-
- private static boolean readTemplateSettings()
- {
- HDF data = makeHDF();
- htmlExtension = data.getValue("template.extension", ".html");
- int i=0;
- while (true) {
- String k = data.getValue("template.escape." + i + ".key", "");
- String v = data.getValue("template.escape." + i + ".value", "");
- if ("".equals(k)) {
- break;
- }
- if (k.length() != 1) {
- System.err.println("template.escape." + i + ".key must have a length of 1: " + k);
- return false;
- }
- escapeChars.put(k.charAt(0), v);
- i++;
- }
- return true;
- }
-
- private static boolean readKnownTagsFiles(HashSet<String> knownTags,
- ArrayList<String> knownTagsFiles) {
- for (String fn: knownTagsFiles) {
- BufferedReader in = null;
- try {
- in = new BufferedReader(new FileReader(fn));
- int lineno = 0;
- boolean fail = false;
- while (true) {
- lineno++;
- String line = in.readLine();
- if (line == null) {
- break;
- }
- line = line.trim();
- if (line.length() == 0) {
- continue;
- } else if (line.charAt(0) == '#') {
- continue;
- }
- String[] words = line.split("\\s+", 2);
- if (words.length == 2) {
- if (words[1].charAt(0) != '#') {
- System.err.println(fn + ":" + lineno
- + ": Only one tag allowed per line: " + line);
- fail = true;
- continue;
- }
- }
- knownTags.add(words[0]);
- }
- if (fail) {
- return false;
- }
- } catch (IOException ex) {
- System.err.println("Error reading file: " + fn + " (" + ex.getMessage() + ")");
- return false;
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- }
- }
- return true;
- }
-
- public static String escape(String s) {
- if (escapeChars.size() == 0) {
- return s;
- }
- StringBuffer b = null;
- int begin = 0;
- final int N = s.length();
- for (int i=0; i<N; i++) {
- char c = s.charAt(i);
- String mapped = escapeChars.get(c);
- if (mapped != null) {
- if (b == null) {
- b = new StringBuffer(s.length() + mapped.length());
- }
- if (begin != i) {
- b.append(s.substring(begin, i));
- }
- b.append(mapped);
- begin = i+1;
- }
- }
- if (b != null) {
- if (begin != N) {
- b.append(s.substring(begin, N));
- }
- return b.toString();
- }
- return s;
- }
-
- public static void setPageTitle(HDF data, String title)
- {
- String s = title;
- if (DroidDoc.title.length() > 0) {
- s += " - " + DroidDoc.title;
- }
- data.setValue("page.title", s);
- }
-
- public static LanguageVersion languageVersion()
- {
- return LanguageVersion.JAVA_1_5;
- }
-
- public static int optionLength(String option)
- {
- if (option.equals("-d")) {
- return 2;
- }
- if (option.equals("-templatedir")) {
- return 2;
- }
- if (option.equals("-hdf")) {
- return 3;
- }
- if (option.equals("-knowntags")) {
- return 2;
- }
- if (option.equals("-toroot")) {
- return 2;
- }
- if (option.equals("-samplecode")) {
- return 4;
- }
- if (option.equals("-htmldir")) {
- return 2;
- }
- if (option.equals("-title")) {
- return 2;
- }
- if (option.equals("-werror")) {
- return 1;
- }
- if (option.equals("-hide")) {
- return 2;
- }
- if (option.equals("-warning")) {
- return 2;
- }
- if (option.equals("-error")) {
- return 2;
- }
- if (option.equals("-keeplist")) {
- return 2;
- }
- if (option.equals("-proofread")) {
- return 2;
- }
- if (option.equals("-todo")) {
- return 2;
- }
- if (option.equals("-public")) {
- return 1;
- }
- if (option.equals("-protected")) {
- return 1;
- }
- if (option.equals("-package")) {
- return 1;
- }
- if (option.equals("-private")) {
- return 1;
- }
- if (option.equals("-hidden")) {
- return 1;
- }
- if (option.equals("-stubs")) {
- return 2;
- }
- if (option.equals("-stubpackages")) {
- return 2;
- }
- if (option.equals("-sdkvalues")) {
- return 2;
- }
- if (option.equals("-apixml")) {
- return 2;
- }
- if (option.equals("-nodocs")) {
- return 1;
- }
- if (option.equals("-parsecomments")) {
- return 1;
- }
- if (option.equals("-since")) {
- return 3;
- }
- if (option.equals("-offlinemode")) {
- return 1;
- }
- return 0;
- }
-
- public static boolean validOptions(String[][] options, DocErrorReporter r)
- {
- for (String[] a: options) {
- if (a[0].equals("-error") || a[0].equals("-warning")
- || a[0].equals("-hide")) {
- try {
- Integer.parseInt(a[1]);
- }
- catch (NumberFormatException e) {
- r.printError("bad -" + a[0] + " value must be a number: "
- + a[1]);
- return false;
- }
- }
- }
-
- return true;
- }
-
- public static HDF makeHDF()
- {
- HDF data = new HDF();
-
- for (String[] p: mHDFData) {
- data.setValue(p[0], p[1]);
- }
-
- try {
- for (String p: ClearPage.hdfFiles) {
- data.readFile(p);
- }
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- return data;
- }
-
- public static HDF makePackageHDF()
- {
- HDF data = makeHDF();
- ClassInfo[] classes = Converter.rootClasses();
-
- SortedMap<String, PackageInfo> sorted = new TreeMap<String, PackageInfo>();
- for (ClassInfo cl: classes) {
- PackageInfo pkg = cl.containingPackage();
- String name;
- if (pkg == null) {
- name = "";
- } else {
- name = pkg.name();
- }
- sorted.put(name, pkg);
- }
-
- int i = 0;
- for (String s: sorted.keySet()) {
- PackageInfo pkg = sorted.get(s);
-
- if (pkg.isHidden()) {
- continue;
- }
- Boolean allHidden = true;
- int pass = 0;
- ClassInfo[] classesToCheck = null;
- while (pass < 5 ) {
- switch(pass) {
- case 0:
- classesToCheck = pkg.ordinaryClasses();
- break;
- case 1:
- classesToCheck = pkg.enums();
- break;
- case 2:
- classesToCheck = pkg.errors();
- break;
- case 3:
- classesToCheck = pkg.exceptions();
- break;
- case 4:
- classesToCheck = pkg.interfaces();
- break;
- default:
- System.err.println("Error reading package: " + pkg.name());
- break;
- }
- for (ClassInfo cl : classesToCheck) {
- if (!cl.isHidden()) {
- allHidden = false;
- break;
- }
- }
- if (!allHidden) {
- break;
- }
- pass++;
- }
- if (allHidden) {
- continue;
- }
-
- data.setValue("reference", "true");
- data.setValue("docs.packages." + i + ".name", s);
- data.setValue("docs.packages." + i + ".link", pkg.htmlPage());
- data.setValue("docs.packages." + i + ".since", pkg.getSince());
- TagInfo.makeHDF(data, "docs.packages." + i + ".shortDescr",
- pkg.firstSentenceTags());
- i++;
- }
-
- sinceTagger.writeVersionNames(data);
- return data;
- }
-
- public static void writeDirectory(File dir, String relative)
- {
- File[] files = dir.listFiles();
- int i, count = files.length;
- for (i=0; i<count; i++) {
- File f = files[i];
- if (f.isFile()) {
- String templ = relative + f.getName();
- int len = templ.length();
- if (len > 3 && ".cs".equals(templ.substring(len-3))) {
- HDF data = makeHDF();
- String filename = templ.substring(0,len-3) + htmlExtension;
- ClearPage.write(data, templ, filename);
- }
- else if (len > 3 && ".jd".equals(templ.substring(len-3))) {
- String filename = templ.substring(0,len-3) + htmlExtension;
- DocFile.writePage(f.getAbsolutePath(), relative, filename);
- }
- else {
- ClearPage.copyFile(f, templ);
- }
- }
- else if (f.isDirectory()) {
- writeDirectory(f, relative + f.getName() + "/");
- }
- }
- }
-
- public static void writeHTMLPages()
- {
- for (String htmlDir : ClearPage.htmlDirs) {
- File f = new File(htmlDir);
- if (!f.isDirectory()) {
- System.err.println("htmlDir not a directory: " + htmlDir);
- continue;
- }
- writeDirectory(f, "");
- }
- }
-
- public static void writeLists()
- {
- HDF data = makeHDF();
-
- ClassInfo[] classes = Converter.rootClasses();
-
- SortedMap<String, Object> sorted = new TreeMap<String, Object>();
- for (ClassInfo cl: classes) {
- if (cl.isHidden()) {
- continue;
- }
- sorted.put(cl.qualifiedName(), cl);
- PackageInfo pkg = cl.containingPackage();
- String name;
- if (pkg == null) {
- name = "";
- } else {
- name = pkg.name();
- }
- sorted.put(name, pkg);
- }
-
- int i = 0;
- for (String s: sorted.keySet()) {
- data.setValue("docs.pages." + i + ".id" , ""+i);
- data.setValue("docs.pages." + i + ".label" , s);
-
- Object o = sorted.get(s);
- if (o instanceof PackageInfo) {
- PackageInfo pkg = (PackageInfo)o;
- data.setValue("docs.pages." + i + ".link" , pkg.htmlPage());
- data.setValue("docs.pages." + i + ".type" , "package");
- }
- else if (o instanceof ClassInfo) {
- ClassInfo cl = (ClassInfo)o;
- data.setValue("docs.pages." + i + ".link" , cl.htmlPage());
- data.setValue("docs.pages." + i + ".type" , "class");
- }
- i++;
- }
-
- ClearPage.write(data, "lists.cs", javadocDir + "lists.js");
- }
-
- public static void cantStripThis(ClassInfo cl, HashSet<ClassInfo> notStrippable) {
- if (!notStrippable.add(cl)) {
- // slight optimization: if it already contains cl, it already contains
- // all of cl's parents
- return;
- }
- ClassInfo supr = cl.superclass();
- if (supr != null) {
- cantStripThis(supr, notStrippable);
- }
- for (ClassInfo iface: cl.interfaces()) {
- cantStripThis(iface, notStrippable);
- }
- }
-
- private static String getPrintableName(ClassInfo cl) {
- ClassInfo containingClass = cl.containingClass();
- if (containingClass != null) {
- // This is an inner class.
- String baseName = cl.name();
- baseName = baseName.substring(baseName.lastIndexOf('.') + 1);
- return getPrintableName(containingClass) + '$' + baseName;
- }
- return cl.qualifiedName();
- }
-
- /**
- * Writes the list of classes that must be present in order to
- * provide the non-hidden APIs known to javadoc.
- *
- * @param filename the path to the file to write the list to
- */
- public static void writeKeepList(String filename) {
- HashSet<ClassInfo> notStrippable = new HashSet<ClassInfo>();
- ClassInfo[] all = Converter.allClasses();
- Arrays.sort(all); // just to make the file a little more readable
-
- // If a class is public and not hidden, then it and everything it derives
- // from cannot be stripped. Otherwise we can strip it.
- for (ClassInfo cl: all) {
- if (cl.isPublic() && !cl.isHidden()) {
- cantStripThis(cl, notStrippable);
- }
- }
- PrintStream stream = null;
- try {
- stream = new PrintStream(filename);
- for (ClassInfo cl: notStrippable) {
- stream.println(getPrintableName(cl));
- }
- }
- catch (FileNotFoundException e) {
- System.err.println("error writing file: " + filename);
- }
- finally {
- if (stream != null) {
- stream.close();
- }
- }
- }
-
- private static PackageInfo[] sVisiblePackages = null;
- public static PackageInfo[] choosePackages() {
- if (sVisiblePackages != null) {
- return sVisiblePackages;
- }
-
- ClassInfo[] classes = Converter.rootClasses();
- SortedMap<String, PackageInfo> sorted = new TreeMap<String, PackageInfo>();
- for (ClassInfo cl: classes) {
- PackageInfo pkg = cl.containingPackage();
- String name;
- if (pkg == null) {
- name = "";
- } else {
- name = pkg.name();
- }
- sorted.put(name, pkg);
- }
-
- ArrayList<PackageInfo> result = new ArrayList();
-
- for (String s: sorted.keySet()) {
- PackageInfo pkg = sorted.get(s);
-
- if (pkg.isHidden()) {
- continue;
- }
- Boolean allHidden = true;
- int pass = 0;
- ClassInfo[] classesToCheck = null;
- while (pass < 5 ) {
- switch(pass) {
- case 0:
- classesToCheck = pkg.ordinaryClasses();
- break;
- case 1:
- classesToCheck = pkg.enums();
- break;
- case 2:
- classesToCheck = pkg.errors();
- break;
- case 3:
- classesToCheck = pkg.exceptions();
- break;
- case 4:
- classesToCheck = pkg.interfaces();
- break;
- default:
- System.err.println("Error reading package: " + pkg.name());
- break;
- }
- for (ClassInfo cl : classesToCheck) {
- if (!cl.isHidden()) {
- allHidden = false;
- break;
- }
- }
- if (!allHidden) {
- break;
- }
- pass++;
- }
- if (allHidden) {
- continue;
- }
-
- result.add(pkg);
- }
-
- sVisiblePackages = result.toArray(new PackageInfo[result.size()]);
- return sVisiblePackages;
- }
-
- public static void writePackages(String filename)
- {
- HDF data = makePackageHDF();
-
- int i = 0;
- for (PackageInfo pkg: choosePackages()) {
- writePackage(pkg);
-
- data.setValue("docs.packages." + i + ".name", pkg.name());
- data.setValue("docs.packages." + i + ".link", pkg.htmlPage());
- TagInfo.makeHDF(data, "docs.packages." + i + ".shortDescr",
- pkg.firstSentenceTags());
-
- i++;
- }
-
- setPageTitle(data, "Package Index");
-
- TagInfo.makeHDF(data, "root.descr",
- Converter.convertTags(root.inlineTags(), null));
-
- ClearPage.write(data, "packages.cs", filename);
- ClearPage.write(data, "package-list.cs", javadocDir + "package-list");
-
- Proofread.writePackages(filename,
- Converter.convertTags(root.inlineTags(), null));
- }
-
- public static void writePackage(PackageInfo pkg)
- {
- // these this and the description are in the same directory,
- // so it's okay
- HDF data = makePackageHDF();
-
- String name = pkg.name();
-
- data.setValue("package.name", name);
- data.setValue("package.since", pkg.getSince());
- data.setValue("package.descr", "...description...");
-
- makeClassListHDF(data, "package.interfaces",
- ClassInfo.sortByName(pkg.interfaces()));
- makeClassListHDF(data, "package.classes",
- ClassInfo.sortByName(pkg.ordinaryClasses()));
- makeClassListHDF(data, "package.enums",
- ClassInfo.sortByName(pkg.enums()));
- makeClassListHDF(data, "package.exceptions",
- ClassInfo.sortByName(pkg.exceptions()));
- makeClassListHDF(data, "package.errors",
- ClassInfo.sortByName(pkg.errors()));
- TagInfo.makeHDF(data, "package.shortDescr",
- pkg.firstSentenceTags());
- TagInfo.makeHDF(data, "package.descr", pkg.inlineTags());
-
- String filename = pkg.htmlPage();
- setPageTitle(data, name);
- ClearPage.write(data, "package.cs", filename);
-
- filename = pkg.fullDescriptionHtmlPage();
- setPageTitle(data, name + " Details");
- ClearPage.write(data, "package-descr.cs", filename);
-
- Proofread.writePackage(filename, pkg.inlineTags());
- }
-
- public static void writeClassLists()
- {
- int i;
- HDF data = makePackageHDF();
-
- ClassInfo[] classes = PackageInfo.filterHidden(
- Converter.convertClasses(root.classes()));
- if (classes.length == 0) {
- return ;
- }
-
- Sorter[] sorted = new Sorter[classes.length];
- for (i=0; i<sorted.length; i++) {
- ClassInfo cl = classes[i];
- String name = cl.name();
- sorted[i] = new Sorter(name, cl);
- }
-
- Arrays.sort(sorted);
-
- // make a pass and resolve ones that have the same name
- int firstMatch = 0;
- String lastName = sorted[0].label;
- for (i=1; i<sorted.length; i++) {
- String s = sorted[i].label;
- if (!lastName.equals(s)) {
- if (firstMatch != i-1) {
- // there were duplicates
- for (int j=firstMatch; j<i; j++) {
- PackageInfo pkg = ((ClassInfo)sorted[j].data).containingPackage();
- if (pkg != null) {
- sorted[j].label = sorted[j].label + " (" + pkg.name() + ")";
- }
- }
- }
- firstMatch = i;
- lastName = s;
- }
- }
-
- // and sort again
- Arrays.sort(sorted);
-
- for (i=0; i<sorted.length; i++) {
- String s = sorted[i].label;
- ClassInfo cl = (ClassInfo)sorted[i].data;
- char first = Character.toUpperCase(s.charAt(0));
- cl.makeShortDescrHDF(data, "docs.classes." + first + '.' + i);
- }
-
- setPageTitle(data, "Class Index");
- ClearPage.write(data, "classes.cs", javadocDir + "classes" + htmlExtension);
- }
-
- // we use the word keywords because "index" means something else in html land
- // the user only ever sees the word index
-/* public static void writeKeywords()
- {
- ArrayList<KeywordEntry> keywords = new ArrayList<KeywordEntry>();
-
- ClassInfo[] classes = PackageInfo.filterHidden(Converter.convertClasses(root.classes()));
-
- for (ClassInfo cl: classes) {
- cl.makeKeywordEntries(keywords);
- }
-
- HDF data = makeHDF();
-
- Collections.sort(keywords);
-
- int i=0;
- for (KeywordEntry entry: keywords) {
- String base = "keywords." + entry.firstChar() + "." + i;
- entry.makeHDF(data, base);
- i++;
- }
-
- setPageTitle(data, "Index");
- ClearPage.write(data, "keywords.cs", javadocDir + "keywords" + htmlExtension);
- } */
-
- public static void writeHierarchy()
- {
- ClassInfo[] classes = Converter.rootClasses();
- ArrayList<ClassInfo> info = new ArrayList<ClassInfo>();
- for (ClassInfo cl: classes) {
- if (!cl.isHidden()) {
- info.add(cl);
- }
- }
- HDF data = makePackageHDF();
- Hierarchy.makeHierarchy(data, info.toArray(new ClassInfo[info.size()]));
- setPageTitle(data, "Class Hierarchy");
- ClearPage.write(data, "hierarchy.cs", javadocDir + "hierarchy" + htmlExtension);
- }
-
- public static void writeClasses()
- {
- ClassInfo[] classes = Converter.rootClasses();
-
- for (ClassInfo cl: classes) {
- HDF data = makePackageHDF();
- if (!cl.isHidden()) {
- writeClass(cl, data);
- }
- }
- }
-
- public static void writeClass(ClassInfo cl, HDF data)
- {
- cl.makeHDF(data);
-
- setPageTitle(data, cl.name());
- ClearPage.write(data, "class.cs", cl.htmlPage());
-
- Proofread.writeClass(cl.htmlPage(), cl);
- }
-
- public static void makeClassListHDF(HDF data, String base,
- ClassInfo[] classes)
- {
- for (int i=0; i<classes.length; i++) {
- ClassInfo cl = classes[i];
- if (!cl.isHidden()) {
- cl.makeShortDescrHDF(data, base + "." + i);
- }
- }
- }
-
- public static String linkTarget(String source, String target)
- {
- String[] src = source.split("/");
- String[] tgt = target.split("/");
-
- int srclen = src.length;
- int tgtlen = tgt.length;
-
- int same = 0;
- while (same < (srclen-1)
- && same < (tgtlen-1)
- && (src[same].equals(tgt[same]))) {
- same++;
- }
-
- String s = "";
-
- int up = srclen-same-1;
- for (int i=0; i<up; i++) {
- s += "../";
- }
-
-
- int N = tgtlen-1;
- for (int i=same; i<N; i++) {
- s += tgt[i] + '/';
- }
- s += tgt[tgtlen-1];
-
- return s;
- }
-
- /**
- * Returns true if the given element has an @hide or @pending annotation.
- */
- private static boolean hasHideAnnotation(Doc doc) {
- String comment = doc.getRawCommentText();
- return comment.indexOf("@hide") != -1 || comment.indexOf("@pending") != -1;
- }
-
- /**
- * Returns true if the given element is hidden.
- */
- private static boolean isHidden(Doc doc) {
- // Methods, fields, constructors.
- if (doc instanceof MemberDoc) {
- return hasHideAnnotation(doc);
- }
-
- // Classes, interfaces, enums, annotation types.
- if (doc instanceof ClassDoc) {
- ClassDoc classDoc = (ClassDoc) doc;
-
- // Check the containing package.
- if (hasHideAnnotation(classDoc.containingPackage())) {
- return true;
- }
-
- // Check the class doc and containing class docs if this is a
- // nested class.
- ClassDoc current = classDoc;
- do {
- if (hasHideAnnotation(current)) {
- return true;
- }
-
- current = current.containingClass();
- } while (current != null);
- }
-
- return false;
- }
-
- /**
- * Filters out hidden elements.
- */
- private static Object filterHidden(Object o, Class<?> expected) {
- if (o == null) {
- return null;
- }
-
- Class type = o.getClass();
- if (type.getName().startsWith("com.sun.")) {
- // TODO: Implement interfaces from superclasses, too.
- return Proxy.newProxyInstance(type.getClassLoader(),
- type.getInterfaces(), new HideHandler(o));
- } else if (o instanceof Object[]) {
- Class<?> componentType = expected.getComponentType();
- Object[] array = (Object[]) o;
- List<Object> list = new ArrayList<Object>(array.length);
- for (Object entry : array) {
- if ((entry instanceof Doc) && isHidden((Doc) entry)) {
- continue;
- }
- list.add(filterHidden(entry, componentType));
- }
- return list.toArray(
- (Object[]) Array.newInstance(componentType, list.size()));
- } else {
- return o;
- }
- }
-
- /**
- * Filters hidden elements out of method return values.
- */
- private static class HideHandler implements InvocationHandler {
-
- private final Object target;
-
- public HideHandler(Object target) {
- this.target = target;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- String methodName = method.getName();
- if (args != null) {
- if (methodName.equals("compareTo") ||
- methodName.equals("equals") ||
- methodName.equals("overrides") ||
- methodName.equals("subclassOf")) {
- args[0] = unwrap(args[0]);
- }
- }
-
- if (methodName.equals("getRawCommentText")) {
- return filterComment((String) method.invoke(target, args));
- }
-
- // escape "&" in disjunctive types.
- if (proxy instanceof Type && methodName.equals("toString")) {
- return ((String) method.invoke(target, args))
- .replace("&", "&");
- }
-
- try {
- return filterHidden(method.invoke(target, args),
- method.getReturnType());
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
-
- private String filterComment(String s) {
- if (s == null) {
- return null;
- }
-
- s = s.trim();
-
- // Work around off by one error
- while (s.length() >= 5
- && s.charAt(s.length() - 5) == '{') {
- s += " ";
- }
-
- return s;
- }
-
- private static Object unwrap(Object proxy) {
- if (proxy instanceof Proxy)
- return ((HideHandler)Proxy.getInvocationHandler(proxy)).target;
- return proxy;
- }
- }
-
- public static String scope(Scoped scoped) {
- if (scoped.isPublic()) {
- return "public";
- }
- else if (scoped.isProtected()) {
- return "protected";
- }
- else if (scoped.isPackagePrivate()) {
- return "";
- }
- else if (scoped.isPrivate()) {
- return "private";
- }
- else {
- throw new RuntimeException("invalid scope for object " + scoped);
- }
- }
-
- /**
- * Collect the values used by the Dev tools and write them in files packaged with the SDK
- * @param output the ouput directory for the files.
- */
- private static void writeSdkValues(String output) {
- ArrayList<String> activityActions = new ArrayList<String>();
- ArrayList<String> broadcastActions = new ArrayList<String>();
- ArrayList<String> serviceActions = new ArrayList<String>();
- ArrayList<String> categories = new ArrayList<String>();
- ArrayList<String> features = new ArrayList<String>();
-
- ArrayList<ClassInfo> layouts = new ArrayList<ClassInfo>();
- ArrayList<ClassInfo> widgets = new ArrayList<ClassInfo>();
- ArrayList<ClassInfo> layoutParams = new ArrayList<ClassInfo>();
-
- ClassInfo[] classes = Converter.allClasses();
-
- // Go through all the fields of all the classes, looking SDK stuff.
- for (ClassInfo clazz : classes) {
-
- // first check constant fields for the SdkConstant annotation.
- FieldInfo[] fields = clazz.allSelfFields();
- for (FieldInfo field : fields) {
- Object cValue = field.constantValue();
- if (cValue != null) {
- AnnotationInstanceInfo[] annotations = field.annotations();
- if (annotations.length > 0) {
- for (AnnotationInstanceInfo annotation : annotations) {
- if (SDK_CONSTANT_ANNOTATION.equals(annotation.type().qualifiedName())) {
- AnnotationValueInfo[] values = annotation.elementValues();
- if (values.length > 0) {
- String type = values[0].valueString();
- if (SDK_CONSTANT_TYPE_ACTIVITY_ACTION.equals(type)) {
- activityActions.add(cValue.toString());
- } else if (SDK_CONSTANT_TYPE_BROADCAST_ACTION.equals(type)) {
- broadcastActions.add(cValue.toString());
- } else if (SDK_CONSTANT_TYPE_SERVICE_ACTION.equals(type)) {
- serviceActions.add(cValue.toString());
- } else if (SDK_CONSTANT_TYPE_CATEGORY.equals(type)) {
- categories.add(cValue.toString());
- } else if (SDK_CONSTANT_TYPE_FEATURE.equals(type)) {
- features.add(cValue.toString());
- }
- }
- break;
- }
- }
- }
- }
- }
-
- // Now check the class for @Widget or if its in the android.widget package
- // (unless the class is hidden or abstract, or non public)
- if (clazz.isHidden() == false && clazz.isPublic() && clazz.isAbstract() == false) {
- boolean annotated = false;
- AnnotationInstanceInfo[] annotations = clazz.annotations();
- if (annotations.length > 0) {
- for (AnnotationInstanceInfo annotation : annotations) {
- if (SDK_WIDGET_ANNOTATION.equals(annotation.type().qualifiedName())) {
- widgets.add(clazz);
- annotated = true;
- break;
- } else if (SDK_LAYOUT_ANNOTATION.equals(annotation.type().qualifiedName())) {
- layouts.add(clazz);
- annotated = true;
- break;
- }
- }
- }
-
- if (annotated == false) {
- // lets check if this is inside android.widget
- PackageInfo pckg = clazz.containingPackage();
- String packageName = pckg.name();
- if ("android.widget".equals(packageName) ||
- "android.view".equals(packageName)) {
- // now we check what this class inherits either from android.view.ViewGroup
- // or android.view.View, or android.view.ViewGroup.LayoutParams
- int type = checkInheritance(clazz);
- switch (type) {
- case TYPE_WIDGET:
- widgets.add(clazz);
- break;
- case TYPE_LAYOUT:
- layouts.add(clazz);
- break;
- case TYPE_LAYOUT_PARAM:
- layoutParams.add(clazz);
- break;
- }
- }
- }
- }
- }
-
- // now write the files, whether or not the list are empty.
- // the SDK built requires those files to be present.
-
- Collections.sort(activityActions);
- writeValues(output + "/activity_actions.txt", activityActions);
-
- Collections.sort(broadcastActions);
- writeValues(output + "/broadcast_actions.txt", broadcastActions);
-
- Collections.sort(serviceActions);
- writeValues(output + "/service_actions.txt", serviceActions);
-
- Collections.sort(categories);
- writeValues(output + "/categories.txt", categories);
-
- Collections.sort(features);
- writeValues(output + "/features.txt", features);
-
- // before writing the list of classes, we do some checks, to make sure the layout params
- // are enclosed by a layout class (and not one that has been declared as a widget)
- for (int i = 0 ; i < layoutParams.size();) {
- ClassInfo layoutParamClass = layoutParams.get(i);
- ClassInfo containingClass = layoutParamClass.containingClass();
- if (containingClass == null || layouts.indexOf(containingClass) == -1) {
- layoutParams.remove(i);
- } else {
- i++;
- }
- }
-
- writeClasses(output + "/widgets.txt", widgets, layouts, layoutParams);
- }
-
- /**
- * Writes a list of values into a text files.
- * @param pathname the absolute os path of the output file.
- * @param values the list of values to write.
- */
- private static void writeValues(String pathname, ArrayList<String> values) {
- FileWriter fw = null;
- BufferedWriter bw = null;
- try {
- fw = new FileWriter(pathname, false);
- bw = new BufferedWriter(fw);
-
- for (String value : values) {
- bw.append(value).append('\n');
- }
- } catch (IOException e) {
- // pass for now
- } finally {
- try {
- if (bw != null) bw.close();
- } catch (IOException e) {
- // pass for now
- }
- try {
- if (fw != null) fw.close();
- } catch (IOException e) {
- // pass for now
- }
- }
- }
-
- /**
- * Writes the widget/layout/layout param classes into a text files.
- * @param pathname the absolute os path of the output file.
- * @param widgets the list of widget classes to write.
- * @param layouts the list of layout classes to write.
- * @param layoutParams the list of layout param classes to write.
- */
- private static void writeClasses(String pathname, ArrayList<ClassInfo> widgets,
- ArrayList<ClassInfo> layouts, ArrayList<ClassInfo> layoutParams) {
- FileWriter fw = null;
- BufferedWriter bw = null;
- try {
- fw = new FileWriter(pathname, false);
- bw = new BufferedWriter(fw);
-
- // write the 3 types of classes.
- for (ClassInfo clazz : widgets) {
- writeClass(bw, clazz, 'W');
- }
- for (ClassInfo clazz : layoutParams) {
- writeClass(bw, clazz, 'P');
- }
- for (ClassInfo clazz : layouts) {
- writeClass(bw, clazz, 'L');
- }
- } catch (IOException e) {
- // pass for now
- } finally {
- try {
- if (bw != null) bw.close();
- } catch (IOException e) {
- // pass for now
- }
- try {
- if (fw != null) fw.close();
- } catch (IOException e) {
- // pass for now
- }
- }
- }
-
- /**
- * Writes a class name and its super class names into a {@link BufferedWriter}.
- * @param writer the BufferedWriter to write into
- * @param clazz the class to write
- * @param prefix the prefix to put at the beginning of the line.
- * @throws IOException
- */
- private static void writeClass(BufferedWriter writer, ClassInfo clazz, char prefix)
- throws IOException {
- writer.append(prefix).append(clazz.qualifiedName());
- ClassInfo superClass = clazz;
- while ((superClass = superClass.superclass()) != null) {
- writer.append(' ').append(superClass.qualifiedName());
- }
- writer.append('\n');
- }
-
- /**
- * Checks the inheritance of {@link ClassInfo} objects. This method return
- * <ul>
- * <li>{@link #TYPE_LAYOUT}: if the class extends <code>android.view.ViewGroup</code></li>
- * <li>{@link #TYPE_WIDGET}: if the class extends <code>android.view.View</code></li>
- * <li>{@link #TYPE_LAYOUT_PARAM}: if the class extends <code>android.view.ViewGroup$LayoutParams</code></li>
- * <li>{@link #TYPE_NONE}: in all other cases</li>
- * </ul>
- * @param clazz the {@link ClassInfo} to check.
- */
- private static int checkInheritance(ClassInfo clazz) {
- if ("android.view.ViewGroup".equals(clazz.qualifiedName())) {
- return TYPE_LAYOUT;
- } else if ("android.view.View".equals(clazz.qualifiedName())) {
- return TYPE_WIDGET;
- } else if ("android.view.ViewGroup.LayoutParams".equals(clazz.qualifiedName())) {
- return TYPE_LAYOUT_PARAM;
- }
-
- ClassInfo parent = clazz.superclass();
- if (parent != null) {
- return checkInheritance(parent);
- }
-
- return TYPE_NONE;
- }
-}
diff --git a/tools/droiddoc/src/Errors.java b/tools/droiddoc/src/Errors.java
deleted file mode 100644
index 0a91abc..0000000
--- a/tools/droiddoc/src/Errors.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-public class Errors
-{
- public static boolean hadError = false;
- private static boolean warningsAreErrors = false;
- private static TreeSet<Message> allErrors = new TreeSet<Message>();
-
- private static class Message implements Comparable {
- SourcePositionInfo pos;
- int level;
- String msg;
-
- Message(SourcePositionInfo p, int l, String m) {
- pos = p;
- level = l;
- msg = m;
- }
-
- public int compareTo(Object o) {
- Message that = (Message)o;
- int r = this.pos.compareTo(that.pos);
- if (r != 0) return r;
- return this.msg.compareTo(that.msg);
- }
-
- @Override
- public String toString() {
- String whereText = this.pos == null ? "unknown: " : this.pos.toString() + ':';
- return whereText + this.msg;
- }
- }
-
- public static void error(Error error, SourcePositionInfo where, String text) {
- if (error.level == HIDDEN) {
- return;
- }
-
- int level = (!warningsAreErrors && error.level == WARNING) ? WARNING : ERROR;
- String which = level == WARNING ? " warning " : " error ";
- String message = which + error.code + ": " + text;
-
- if (where == null) {
- where = new SourcePositionInfo("unknown", 0, 0);
- }
-
- allErrors.add(new Message(where, level, message));
-
- if (error.level == ERROR || (warningsAreErrors && error.level == WARNING)) {
- hadError = true;
- }
- }
-
- public static void printErrors() {
- for (Message m: allErrors) {
- if (m.level == WARNING) {
- System.err.println(m.toString());
- }
- }
- for (Message m: allErrors) {
- if (m.level == ERROR) {
- System.err.println(m.toString());
- }
- }
- }
-
- public static int HIDDEN = 0;
- public static int WARNING = 1;
- public static int ERROR = 2;
-
- public static void setWarningsAreErrors(boolean val) {
- warningsAreErrors = val;
- }
-
- public static class Error {
- public int code;
- public int level;
-
- public Error(int code, int level)
- {
- this.code = code;
- this.level = level;
- }
- }
-
- public static Error UNRESOLVED_LINK = new Error(1, WARNING);
- public static Error BAD_INCLUDE_TAG = new Error(2, WARNING);
- public static Error UNKNOWN_TAG = new Error(3, WARNING);
- public static Error UNKNOWN_PARAM_TAG_NAME = new Error(4, WARNING);
- public static Error UNDOCUMENTED_PARAMETER = new Error(5, HIDDEN);
- public static Error BAD_ATTR_TAG = new Error(6, ERROR);
- public static Error BAD_INHERITDOC = new Error(7, HIDDEN);
- public static Error HIDDEN_LINK = new Error(8, WARNING);
- public static Error HIDDEN_CONSTRUCTOR = new Error(9, WARNING);
- public static Error UNAVAILABLE_SYMBOL = new Error(10, ERROR);
- public static Error HIDDEN_SUPERCLASS = new Error(11, WARNING);
- public static Error DEPRECATED = new Error(12, HIDDEN);
- public static Error DEPRECATION_MISMATCH = new Error(13, WARNING);
- public static Error MISSING_COMMENT = new Error(14, WARNING);
- public static Error IO_ERROR = new Error(15, HIDDEN);
- public static Error NO_SINCE_DATA = new Error(16, HIDDEN);
-
- public static Error[] ERRORS = {
- UNRESOLVED_LINK,
- BAD_INCLUDE_TAG,
- UNKNOWN_TAG,
- UNKNOWN_PARAM_TAG_NAME,
- UNDOCUMENTED_PARAMETER,
- BAD_ATTR_TAG,
- BAD_INHERITDOC,
- HIDDEN_LINK,
- HIDDEN_CONSTRUCTOR,
- UNAVAILABLE_SYMBOL,
- HIDDEN_SUPERCLASS,
- DEPRECATED,
- DEPRECATION_MISMATCH,
- MISSING_COMMENT,
- IO_ERROR,
- NO_SINCE_DATA,
- };
-
- public static boolean setErrorLevel(int code, int level) {
- for (Error e: ERRORS) {
- if (e.code == code) {
- e.level = level;
- return true;
- }
- }
- return false;
- }
-}
diff --git a/tools/droiddoc/src/FieldInfo.java b/tools/droiddoc/src/FieldInfo.java
deleted file mode 100644
index d9371e8..0000000
--- a/tools/droiddoc/src/FieldInfo.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-
-import java.util.Comparator;
-
-public class FieldInfo extends MemberInfo
-{
- public static final Comparator<FieldInfo> comparator = new Comparator<FieldInfo>() {
- public int compare(FieldInfo a, FieldInfo b) {
- return a.name().compareTo(b.name());
- }
- };
-
- public FieldInfo(String name, ClassInfo containingClass, ClassInfo realContainingClass,
- boolean isPublic, boolean isProtected,
- boolean isPackagePrivate, boolean isPrivate,
- boolean isFinal, boolean isStatic, boolean isTransient, boolean isVolatile,
- boolean isSynthetic, TypeInfo type, String rawCommentText,
- Object constantValue,
- SourcePositionInfo position,
- AnnotationInstanceInfo[] annotations)
- {
- super(rawCommentText, name, null, containingClass, realContainingClass,
- isPublic, isProtected, isPackagePrivate, isPrivate,
- isFinal, isStatic, isSynthetic, chooseKind(isFinal, isStatic), position,
- annotations);
- mIsTransient = isTransient;
- mIsVolatile = isVolatile;
- mType = type;
- mConstantValue = constantValue;
- }
-
- public FieldInfo cloneForClass(ClassInfo newContainingClass) {
- return new FieldInfo(name(), newContainingClass, realContainingClass(),
- isPublic(), isProtected(), isPackagePrivate(),
- isPrivate(), isFinal(), isStatic(), isTransient(), isVolatile(),
- isSynthetic(), mType, getRawCommentText(), mConstantValue, position(),
- annotations());
- }
-
- static String chooseKind(boolean isFinal, boolean isStatic)
- {
- if (isStatic && isFinal) {
- return "constant";
- } else {
- return "field";
- }
- }
-
- public TypeInfo type()
- {
- return mType;
- }
-
- public boolean isConstant()
- {
- return isStatic() && isFinal();
- }
-
- public TagInfo[] firstSentenceTags()
- {
- return comment().briefTags();
- }
-
- public TagInfo[] inlineTags()
- {
- return comment().tags();
- }
-
- public Object constantValue()
- {
- return mConstantValue;
- }
-
- public String constantLiteralValue()
- {
- return constantLiteralValue(mConstantValue);
- }
-
- public boolean isDeprecated() {
- boolean deprecated = false;
- if (!mDeprecatedKnown) {
- boolean commentDeprecated = (comment().deprecatedTags().length > 0);
- boolean annotationDeprecated = false;
- for (AnnotationInstanceInfo annotation : annotations()) {
- if (annotation.type().qualifiedName().equals("java.lang.Deprecated")) {
- annotationDeprecated = true;
- break;
- }
- }
-
- if (commentDeprecated != annotationDeprecated) {
- Errors.error(Errors.DEPRECATION_MISMATCH, position(),
- "Field " + mContainingClass.qualifiedName() + "." + name()
- + ": @Deprecated annotation and @deprecated comment do not match");
- }
-
- mIsDeprecated = commentDeprecated | annotationDeprecated;
- mDeprecatedKnown = true;
- }
- return mIsDeprecated;
- }
-
- public static String constantLiteralValue(Object val)
- {
- String str = null;
- if (val != null) {
- if (val instanceof Boolean
- || val instanceof Byte
- || val instanceof Short
- || val instanceof Integer)
- {
- str = val.toString();
- }
- //catch all special values
- else if (val instanceof Double){
- Double dbl = (Double) val;
- if (dbl.toString().equals("Infinity")){
- str = "(1.0 / 0.0)";
- } else if (dbl.toString().equals("-Infinity")) {
- str = "(-1.0 / 0.0)";
- } else if (dbl.isNaN()) {
- str = "(0.0 / 0.0)";
- } else {
- str = dbl.toString();
- }
- }
- else if (val instanceof Long) {
- str = val.toString() + "L";
- }
- else if (val instanceof Float) {
- Float fl = (Float) val;
- if (fl.toString().equals("Infinity")) {
- str = "(1.0f / 0.0f)";
- } else if (fl.toString().equals("-Infinity")) {
- str = "(-1.0f / 0.0f)";
- } else if (fl.isNaN()) {
- str = "(0.0f / 0.0f)";
- } else {
- str = val.toString() + "f";
- }
- }
- else if (val instanceof Character) {
- str = String.format("\'\\u%04x\'", val);
- }
- else if (val instanceof String) {
- str = "\"" + javaEscapeString((String)val) + "\"";
- }
- else {
- str = "<<<<" +val.toString() + ">>>>";
- }
- }
- if (str == null) {
- str = "null";
- }
- return str;
- }
-
- public static String javaEscapeString(String str) {
- String result = "";
- final int N = str.length();
- for (int i=0; i<N; i++) {
- char c = str.charAt(i);
- if (c == '\\') {
- result += "\\\\";
- }
- else if (c == '\t') {
- result += "\\t";
- }
- else if (c == '\b') {
- result += "\\b";
- }
- else if (c == '\r') {
- result += "\\r";
- }
- else if (c == '\n') {
- result += "\\n";
- }
- else if (c == '\f') {
- result += "\\f";
- }
- else if (c == '\'') {
- result += "\\'";
- }
- else if (c == '\"') {
- result += "\\\"";
- }
- else if (c >= ' ' && c <= '~') {
- result += c;
- }
- else {
- result += String.format("\\u%04x", new Integer((int)c));
- }
- }
- return result;
- }
-
-
- public void makeHDF(HDF data, String base)
- {
- data.setValue(base + ".kind", kind());
- type().makeHDF(data, base + ".type");
- data.setValue(base + ".name", name());
- data.setValue(base + ".href", htmlPage());
- data.setValue(base + ".anchor", anchor());
- TagInfo.makeHDF(data, base + ".shortDescr", firstSentenceTags());
- TagInfo.makeHDF(data, base + ".descr", inlineTags());
- TagInfo.makeHDF(data, base + ".deprecated", comment().deprecatedTags());
- TagInfo.makeHDF(data, base + ".seeAlso", comment().seeTags());
- data.setValue(base + ".since", getSince());
- data.setValue(base + ".final", isFinal() ? "final" : "");
- data.setValue(base + ".static", isStatic() ? "static" : "");
- if (isPublic()) {
- data.setValue(base + ".scope", "public");
- }
- else if (isProtected()) {
- data.setValue(base + ".scope", "protected");
- }
- else if (isPackagePrivate()) {
- data.setValue(base + ".scope", "");
- }
- else if (isPrivate()) {
- data.setValue(base + ".scope", "private");
- }
- Object val = mConstantValue;
- if (val != null) {
- String dec = null;
- String hex = null;
- String str = null;
-
- if (val instanceof Boolean) {
- str = ((Boolean)val).toString();
- }
- else if (val instanceof Byte) {
- dec = String.format("%d", val);
- hex = String.format("0x%02x", val);
- }
- else if (val instanceof Character) {
- dec = String.format("\'%c\'", val);
- hex = String.format("0x%04x", val);
- }
- else if (val instanceof Double) {
- str = ((Double)val).toString();
- }
- else if (val instanceof Float) {
- str = ((Float)val).toString();
- }
- else if (val instanceof Integer) {
- dec = String.format("%d", val);
- hex = String.format("0x%08x", val);
- }
- else if (val instanceof Long) {
- dec = String.format("%d", val);
- hex = String.format("0x%016x", val);
- }
- else if (val instanceof Short) {
- dec = String.format("%d", val);
- hex = String.format("0x%04x", val);
- }
- else if (val instanceof String) {
- str = "\"" + ((String)val) + "\"";
- }
- else {
- str = "";
- }
-
- if (dec != null && hex != null) {
- data.setValue(base + ".constantValue.dec", DroidDoc.escape(dec));
- data.setValue(base + ".constantValue.hex", DroidDoc.escape(hex));
- }
- else {
- data.setValue(base + ".constantValue.str", DroidDoc.escape(str));
- data.setValue(base + ".constantValue.isString", "1");
- }
- }
- }
-
- @Override
- public boolean isExecutable()
- {
- return false;
- }
-
- public boolean isTransient()
- {
- return mIsTransient;
- }
-
- public boolean isVolatile()
- {
- return mIsVolatile;
- }
-
- boolean mIsTransient;
- boolean mIsVolatile;
- boolean mDeprecatedKnown;
- boolean mIsDeprecated;
- TypeInfo mType;
- Object mConstantValue;
-}
-
diff --git a/tools/droiddoc/src/Hierarchy.java b/tools/droiddoc/src/Hierarchy.java
deleted file mode 100755
index ac5e1dc..0000000
--- a/tools/droiddoc/src/Hierarchy.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.HashMap;
-import java.util.TreeSet;
-import java.util.Set;
-import org.clearsilver.HDF;
-
-public class Hierarchy
-{
- public static void makeHierarchy(HDF hdf, ClassInfo[] classes)
- {
- HashMap<String,TreeSet<String>> nodes
- = new HashMap<String,TreeSet<String>>();
-
- for (ClassInfo cl: classes) {
- String name = cl.qualifiedName();
-
- TreeSet<String> me = nodes.get(name);
- if (me == null) {
- me = new TreeSet<String>();
- nodes.put(name, me);
- }
-
- ClassInfo superclass = cl.superclass();
- String sname = superclass != null
- ? superclass.qualifiedName() : null;
- if (sname != null) {
- TreeSet<String> s = nodes.get(sname);
- if (s == null) {
- s = new TreeSet<String>();
- nodes.put(sname, s);
- }
- s.add(name);
- }
- }
-
- /*
- Set<String> keys = nodes.keySet();
- for (String n: keys) {
- System.out.println("class: " + n);
-
- TreeSet<String> values = nodes.get(n);
- for (String v: values) {
- System.out.println(" - " + v);
- }
- }
- */
-
- int depth = depth(nodes, "java.lang.Object");
-
- hdf.setValue("classes.0", "");
- hdf.setValue("colspan", "" + depth);
-
- recurse(nodes, "java.lang.Object", hdf.getObj("classes.0"),depth,depth);
-
- if (false) {
- Set<String> keys = nodes.keySet();
- if (keys.size() > 0) {
- System.err.println("The following classes are hidden but"
- + " are superclasses of not-hidden classes");
- for (String n: keys) {
- System.err.println(" " + n);
- }
- }
- }
- }
-
- private static int depth(HashMap<String,TreeSet<String>> nodes,
- String name)
- {
- int d = 0;
- TreeSet<String> derived = nodes.get(name);
- if (derived != null && derived.size() > 0) {
- for (String s: derived) {
- int n = depth(nodes, s);
- if (n > d) {
- d = n;
- }
- }
- }
- return d + 1;
- }
-
- private static boolean exists(ClassInfo cl)
- {
- return cl != null && !cl.isHidden() && cl.isIncluded();
- }
-
- private static void recurse(HashMap<String,TreeSet<String>> nodes,
- String name, HDF hdf,
- int totalDepth, int remainingDepth)
- {
- int i;
-
- hdf.setValue("indent", "" + (totalDepth-remainingDepth-1));
- hdf.setValue("colspan", "" + remainingDepth);
-
- ClassInfo cl = Converter.obtainClass(name);
-
- hdf.setValue("class.label", cl.name());
- hdf.setValue("class.qualified", cl.qualifiedName());
- if (cl.checkLevel()) {
- hdf.setValue("class.link", cl.htmlPage());
- }
-
- if (exists(cl)) {
- hdf.setValue("exists", "1");
- }
-
- i = 0;
- for (ClassInfo iface: cl.interfaces()) {
- hdf.setValue("interfaces." + i + ".class.label", iface.name());
- hdf.setValue("interfaces." + i + ".class.qualified", iface.qualifiedName());
- if (iface.checkLevel()) {
- hdf.setValue("interfaces." + i + ".class.link", iface.htmlPage());
- }
- if (exists(cl)) {
- hdf.setValue("interfaces." + i + ".exists", "1");
- }
- i++;
- }
-
- TreeSet<String> derived = nodes.get(name);
- if (derived != null && derived.size() > 0) {
- hdf.setValue("derived", "");
- HDF children = hdf.getObj("derived");
- i = 0;
- remainingDepth--;
- for (String s: derived) {
- String index = "" + i;
- children.setValue(index, "");
- recurse(nodes, s, children.getObj(index), totalDepth,
- remainingDepth);
- i++;
- }
- }
-
- nodes.remove(name);
- }
-}
-
diff --git a/tools/droiddoc/src/InheritedTags.java b/tools/droiddoc/src/InheritedTags.java
deleted file mode 100644
index 242170c..0000000
--- a/tools/droiddoc/src/InheritedTags.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.*;
-import java.io.*;
-
-public interface InheritedTags
-{
- TagInfo[] tags();
- InheritedTags inherited();
-}
-
diff --git a/tools/droiddoc/src/KeywordEntry.java b/tools/droiddoc/src/KeywordEntry.java
deleted file mode 100644
index 7e5e357..0000000
--- a/tools/droiddoc/src/KeywordEntry.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-
-class KeywordEntry implements Comparable
-{
- KeywordEntry(String label, String href, String comment)
- {
- this.label = label;
- this.href = href;
- this.comment = comment;
- }
-
- public void makeHDF(HDF data, String base)
- {
- data.setValue(base + ".label", this.label);
- data.setValue(base + ".href", this.href);
- data.setValue(base + ".comment", this.comment);
- }
-
- public char firstChar()
- {
- return Character.toUpperCase(this.label.charAt(0));
- }
-
- public int compareTo(Object that)
- {
- return this.label.compareToIgnoreCase(((KeywordEntry)that).label);
- }
-
- private String label;
- private String href;
- private String comment;
-}
-
-
diff --git a/tools/droiddoc/src/LinkReference.java b/tools/droiddoc/src/LinkReference.java
deleted file mode 100644
index b1f998a..0000000
--- a/tools/droiddoc/src/LinkReference.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.ArrayList;
-
-/**
- * Class that represents what you see in an link or see tag. This is
- * factored out of SeeTagInfo so it can be used elsewhere (like AttrTagInfo).
- */
-public class LinkReference {
-
- /** The original text. */
- public String text;
-
- /** The kind of this tag, if we have a new suggestion after parsing. */
- public String kind;
-
- /** The user visible text. */
- public String label;
-
- /** The link. */
- public String href;
-
- /** The {@link PackageInfo} if any. */
- public PackageInfo packageInfo;
-
- /** The {@link ClassInfo} if any. */
- public ClassInfo classInfo;
-
- /** The {@link MemberInfo} if any. */
- public MemberInfo memberInfo;
-
- /** The name of the referenced member PackageInfo} if any. */
- public String referencedMemberName;
-
- /** Set to true if everything is a-ok */
- public boolean good;
-
- /**
- * regex pattern to use when matching explicit "<a href" reference text
- */
- private static final Pattern HREF_PATTERN
- = Pattern.compile("^<a href=\"([^\"]*)\">([^<]*)</a>[ \n\r\t]*$",
- Pattern.CASE_INSENSITIVE);
-
- /**
- * regex pattern to use when matching double-quoted reference text
- */
- private static final Pattern QUOTE_PATTERN
- = Pattern.compile("^\"([^\"]*)\"[ \n\r\t]*$");
-
- /**
- * Parse and resolve a link string.
- *
- * @param text the original text
- * @param base the class or whatever that this link is on
- * @param pos the original position in the source document
- * @return a new link reference. It always returns something. If there was an
- * error, it logs it and fills in href and label with error text.
- */
- public static LinkReference parse(String text, ContainerInfo base, SourcePositionInfo pos,
- boolean printOnErrors) {
- LinkReference result = new LinkReference();
- result.text = text;
-
- int index;
- int len = text.length();
- int pairs = 0;
- int pound = -1;
- // split the string
- done: {
- for (index=0; index<len; index++) {
- char c = text.charAt(index);
- switch (c)
- {
- case '(':
- pairs++;
- break;
- case '[':
- pairs++;
- break;
- case ')':
- pairs--;
- break;
- case ']':
- pairs--;
- break;
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- if (pairs == 0) {
- break done;
- }
- break;
- case '#':
- if (pound < 0) {
- pound = index;
- }
- break;
- }
- }
- }
- if (index == len && pairs != 0) {
- Errors.error(Errors.UNRESOLVED_LINK, pos,
- "unable to parse link/see tag: " + text.trim());
- return result;
- }
-
- int linkend = index;
-
- for (; index<len; index++) {
- char c = text.charAt(index);
- if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n')) {
- break;
- }
- }
-
- result.label = text.substring(index);
-
- String ref;
- String mem;
- if (pound == 0) {
- ref = null;
- mem = text.substring(1, linkend);
- }
- else if (pound > 0) {
- ref = text.substring(0, pound);
- mem = text.substring(pound+1, linkend);
- }
- else {
- ref = text.substring(0, linkend);
- mem = null;
- }
-
- // parse parameters, if any
- String[] params = null;
- String[] paramDimensions = null;
- if (mem != null) {
- index = mem.indexOf('(');
- if (index > 0) {
- ArrayList<String> paramList = new ArrayList<String>();
- ArrayList<String> paramDimensionList = new ArrayList<String>();
- len = mem.length();
- int start = index+1;
- final int START = 0;
- final int TYPE = 1;
- final int NAME = 2;
- int dimension = 0;
- int arraypair = 0;
- int state = START;
- int typestart = 0;
- int typeend = -1;
- for (int i=start; i<len; i++) {
- char c = mem.charAt(i);
- switch (state)
- {
- case START:
- if (c!=' ' && c!='\t' && c!='\r' && c!='\n') {
- state = TYPE;
- typestart = i;
- }
- break;
- case TYPE:
- if (c == '[') {
- if (typeend < 0) {
- typeend = i;
- }
- dimension++;
- arraypair++;
- }
- else if (c == ']') {
- arraypair--;
- }
- else if (c==' ' || c=='\t' || c=='\r' || c=='\n') {
- if (typeend < 0) {
- typeend = i;
- }
- }
- else {
- if (typeend >= 0 || c == ')' || c == ',') {
- if (typeend < 0) {
- typeend = i;
- }
- String s = mem.substring(typestart, typeend);
- paramList.add(s);
- s = "";
- for (int j=0; j<dimension; j++) {
- s += "[]";
- }
- paramDimensionList.add(s);
- state = START;
- typeend = -1;
- dimension = 0;
- if (c == ',' || c == ')') {
- state = START;
- } else {
- state = NAME;
- }
- }
- }
- break;
- case NAME:
- if (c == ',' || c == ')') {
- state = START;
- }
- break;
- }
-
- }
- params = paramList.toArray(new String[paramList.size()]);
- paramDimensions = paramDimensionList.toArray(new String[paramList.size()]);
- mem = mem.substring(0, index);
- }
- }
-
- ClassInfo cl = null;
- if (base instanceof ClassInfo) {
- cl = (ClassInfo)base;
- }
-
- if (ref == null) {
- // no class or package was provided, assume it's this class
- if (cl != null) {
- result.classInfo = cl;
- }
- } else {
- // they provided something, maybe it's a class or a package
- if (cl != null) {
- result.classInfo = cl.extendedFindClass(ref);
- if (result.classInfo == null) {
- result.classInfo = cl.findClass(ref);
- }
- if (result.classInfo == null) {
- result.classInfo = cl.findInnerClass(ref);
- }
- }
- if (result.classInfo == null) {
- result.classInfo = Converter.obtainClass(ref);
- }
- if (result.classInfo == null) {
- result.packageInfo = Converter.obtainPackage(ref);
- }
- }
-
- if (result.classInfo != null && mem != null) {
- // it's either a field or a method, prefer a field
- if (params == null) {
- FieldInfo field = result.classInfo.findField(mem);
- // findField looks in containing classes, so it might actually
- // be somewhere else; link to where it really is, not what they
- // typed.
- if (field != null) {
- result.classInfo = field.containingClass();
- result.memberInfo = field;
- }
- }
- if (result.memberInfo == null) {
- MethodInfo method = result.classInfo.findMethod(mem, params, paramDimensions);
- if (method != null) {
- result.classInfo = method.containingClass();
- result.memberInfo = method;
- }
- }
- }
-
- result.referencedMemberName = mem;
- if (params != null) {
- result.referencedMemberName = result.referencedMemberName + '(';
- len = params.length;
- if (len > 0) {
- len--;
- for (int i=0; i<len; i++) {
- result.referencedMemberName = result.referencedMemberName + params[i]
- + paramDimensions[i] + ", ";
- }
- result.referencedMemberName = result.referencedMemberName + params[len]
- + paramDimensions[len];
- }
- result.referencedMemberName = result.referencedMemberName + ")";
- }
-
- // debugging spew
- if (false) {
- result.label = result.label + "/" + ref + "/" + mem + '/';
- if (params != null) {
- for (int i=0; i<params.length; i++) {
- result.label += params[i] + "|";
- }
- }
-
- FieldInfo f = (result.memberInfo instanceof FieldInfo)
- ? (FieldInfo)result.memberInfo
- : null;
- MethodInfo m = (result.memberInfo instanceof MethodInfo)
- ? (MethodInfo)result.memberInfo
- : null;
- result.label = result.label
- + "/package=" + (result.packageInfo!=null?result.packageInfo.name():"")
- + "/class=" + (result.classInfo!=null?result.classInfo.qualifiedName():"")
- + "/field=" + (f!=null?f.name():"")
- + "/method=" + (m!=null?m.name():"");
-
- }
-
- MethodInfo method = null;
- boolean skipHref = false;
-
- if (result.memberInfo != null && result.memberInfo.isExecutable()) {
- method = (MethodInfo)result.memberInfo;
- }
-
- if (text.startsWith("\"")) {
- // literal quoted reference (e.g., a book title)
- Matcher matcher = QUOTE_PATTERN.matcher(text);
- if (! matcher.matches()) {
- Errors.error(Errors.UNRESOLVED_LINK, pos,
- "unbalanced quoted link/see tag: " + text.trim());
- result.makeError();
- return result;
- }
- skipHref = true;
- result.label = matcher.group(1);
- result.kind = "@seeJustLabel";
- }
- else if (text.startsWith("<")) {
- // explicit "<a href" form
- Matcher matcher = HREF_PATTERN.matcher(text);
- if (! matcher.matches()) {
- Errors.error(Errors.UNRESOLVED_LINK, pos,
- "invalid <a> link/see tag: " + text.trim());
- result.makeError();
- return result;
- }
- result.href = matcher.group(1);
- result.label = matcher.group(2);
- result.kind = "@seeHref";
- }
- else if (result.packageInfo != null) {
- result.href = result.packageInfo.htmlPage();
- if (result.label.length() == 0) {
- result.href = result.packageInfo.htmlPage();
- result.label = result.packageInfo.name();
- }
- }
- else if (result.classInfo != null && result.referencedMemberName == null) {
- // class reference
- if (result.label.length() == 0) {
- result.label = result.classInfo.name();
- }
- result.href = result.classInfo.htmlPage();
- }
- else if (result.memberInfo != null) {
- // member reference
- ClassInfo containing = result.memberInfo.containingClass();
- if (result.memberInfo.isExecutable()) {
- if (result.referencedMemberName.indexOf('(') < 0) {
- result.referencedMemberName += method.flatSignature();
- }
- }
- if (result.label.length() == 0) {
- result.label = result.referencedMemberName;
- }
- result.href = containing.htmlPage() + '#' + result.memberInfo.anchor();
- }
-
- if (result.href == null && !skipHref) {
- if (printOnErrors && (base == null || base.checkLevel())) {
- Errors.error(Errors.UNRESOLVED_LINK, pos,
- "Unresolved link/see tag \"" + text.trim()
- + "\" in " + ((base != null) ? base.qualifiedName() : "[null]"));
- }
- result.makeError();
- }
- else if (result.memberInfo != null && !result.memberInfo.checkLevel()) {
- if (printOnErrors && (base == null || base.checkLevel())) {
- Errors.error(Errors.HIDDEN_LINK, pos,
- "Link to hidden member: " + text.trim());
- result.href = null;
- }
- result.kind = "@seeJustLabel";
- }
- else if (result.classInfo != null && !result.classInfo.checkLevel()) {
- if (printOnErrors && (base == null || base.checkLevel())) {
- Errors.error(Errors.HIDDEN_LINK, pos,
- "Link to hidden class: " + text.trim() + " label=" + result.label);
- result.href = null;
- }
- result.kind = "@seeJustLabel";
- }
- else if (result.packageInfo != null && !result.packageInfo.checkLevel()) {
- if (printOnErrors && (base == null || base.checkLevel())) {
- Errors.error(Errors.HIDDEN_LINK, pos,
- "Link to hidden package: " + text.trim());
- result.href = null;
- }
- result.kind = "@seeJustLabel";
- }
-
- result.good = true;
-
- return result;
- }
-
- public boolean checkLevel() {
- if (memberInfo != null) {
- return memberInfo.checkLevel();
- }
- if (classInfo != null) {
- return classInfo.checkLevel();
- }
- if (packageInfo != null) {
- return packageInfo.checkLevel();
- }
- return false;
- }
-
- /** turn this LinkReference into one with an error message */
- private void makeError() {
- //this.href = "ERROR(" + this.text.trim() + ")";
- this.href = null;
- if (this.label == null) {
- this.label = "";
- }
- this.label = "ERROR(" + this.label + "/" + text.trim() + ")";
- }
-
- /** private. **/
- private LinkReference() {
- }
-}
diff --git a/tools/droiddoc/src/LiteralTagInfo.java b/tools/droiddoc/src/LiteralTagInfo.java
deleted file mode 100644
index b39490d..0000000
--- a/tools/droiddoc/src/LiteralTagInfo.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class LiteralTagInfo extends TagInfo
-{
- private static String encode(String t)
- {
- t = t.replace("&", "&");
- t = t.replace("<", "<");
- t = t.replace(">", ">");
- return t;
- }
-
- public LiteralTagInfo(String n, String k, String t, SourcePositionInfo sp)
- {
- super("Text", "Text", encode(t), sp);
- }
-}
diff --git a/tools/droiddoc/src/MemberInfo.java b/tools/droiddoc/src/MemberInfo.java
deleted file mode 100644
index 05da583..0000000
--- a/tools/droiddoc/src/MemberInfo.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public abstract class MemberInfo extends DocInfo implements Comparable, Scoped
-{
- public MemberInfo(String rawCommentText, String name, String signature,
- ClassInfo containingClass, ClassInfo realContainingClass,
- boolean isPublic, boolean isProtected,
- boolean isPackagePrivate, boolean isPrivate,
- boolean isFinal, boolean isStatic, boolean isSynthetic,
- String kind,
- SourcePositionInfo position,
- AnnotationInstanceInfo[] annotations)
- {
- super(rawCommentText, position);
- mName = name;
- mSignature = signature;
- mContainingClass = containingClass;
- mRealContainingClass = realContainingClass;
- mIsPublic = isPublic;
- mIsProtected = isProtected;
- mIsPackagePrivate = isPackagePrivate;
- mIsPrivate = isPrivate;
- mIsFinal = isFinal;
- mIsStatic = isStatic;
- mIsSynthetic = isSynthetic;
- mKind = kind;
- mAnnotations = annotations;
- }
-
- public abstract boolean isExecutable();
-
- public String anchor()
- {
- if (mSignature != null) {
- return mName + mSignature;
- } else {
- return mName;
- }
- }
-
- public String htmlPage() {
- return mContainingClass.htmlPage() + "#" + anchor();
- }
-
- public int compareTo(Object that) {
- return this.htmlPage().compareTo(((MemberInfo)that).htmlPage());
- }
-
- public String name()
- {
- return mName;
- }
-
- public String signature()
- {
- return mSignature;
- }
-
- public ClassInfo realContainingClass()
- {
- return mRealContainingClass;
- }
-
- public ClassInfo containingClass()
- {
- return mContainingClass;
- }
-
- public boolean isPublic()
- {
- return mIsPublic;
- }
-
- public boolean isProtected()
- {
- return mIsProtected;
- }
-
- public boolean isPackagePrivate()
- {
- return mIsPackagePrivate;
- }
-
- public boolean isPrivate()
- {
- return mIsPrivate;
- }
-
- public boolean isStatic()
- {
- return mIsStatic;
- }
-
- public boolean isFinal()
- {
- return mIsFinal;
- }
-
- public boolean isSynthetic()
- {
- return mIsSynthetic;
- }
-
- @Override
- public ContainerInfo parent()
- {
- return mContainingClass;
- }
-
- public boolean checkLevel()
- {
- return DroidDoc.checkLevel(mIsPublic, mIsProtected,
- mIsPackagePrivate, mIsPrivate, isHidden());
- }
-
- public String kind()
- {
- return mKind;
- }
-
- public AnnotationInstanceInfo[] annotations()
- {
- return mAnnotations;
- }
-
- ClassInfo mContainingClass;
- ClassInfo mRealContainingClass;
- String mName;
- String mSignature;
- boolean mIsPublic;
- boolean mIsProtected;
- boolean mIsPackagePrivate;
- boolean mIsPrivate;
- boolean mIsFinal;
- boolean mIsStatic;
- boolean mIsSynthetic;
- String mKind;
- private AnnotationInstanceInfo[] mAnnotations;
-
-}
-
diff --git a/tools/droiddoc/src/MethodInfo.java b/tools/droiddoc/src/MethodInfo.java
deleted file mode 100644
index 7f96b80..0000000
--- a/tools/droiddoc/src/MethodInfo.java
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-
-import java.util.*;
-
-public class MethodInfo extends MemberInfo
-{
- public static final Comparator<MethodInfo> comparator = new Comparator<MethodInfo>() {
- public int compare(MethodInfo a, MethodInfo b) {
- return a.name().compareTo(b.name());
- }
- };
-
- private class InlineTags implements InheritedTags
- {
- public TagInfo[] tags()
- {
- return comment().tags();
- }
- public InheritedTags inherited()
- {
- MethodInfo m = findOverriddenMethod(name(), signature());
- if (m != null) {
- return m.inlineTags();
- } else {
- return null;
- }
- }
- }
-
- private static void addInterfaces(ClassInfo[] ifaces, ArrayList<ClassInfo> queue)
- {
- for (ClassInfo i: ifaces) {
- queue.add(i);
- }
- for (ClassInfo i: ifaces) {
- addInterfaces(i.interfaces(), queue);
- }
- }
-
- // first looks for a superclass, and then does a breadth first search to
- // find the least far away match
- public MethodInfo findOverriddenMethod(String name, String signature)
- {
- if (mReturnType == null) {
- // ctor
- return null;
- }
- if (mOverriddenMethod != null) {
- return mOverriddenMethod;
- }
-
- ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>();
- addInterfaces(containingClass().interfaces(), queue);
- for (ClassInfo iface: queue) {
- for (MethodInfo me: iface.methods()) {
- if (me.name().equals(name)
- && me.signature().equals(signature)
- && me.inlineTags().tags() != null
- && me.inlineTags().tags().length > 0) {
- return me;
- }
- }
- }
- return null;
- }
-
- private static void addRealInterfaces(ClassInfo[] ifaces, ArrayList<ClassInfo> queue)
- {
- for (ClassInfo i: ifaces) {
- queue.add(i);
- if (i.realSuperclass() != null && i.realSuperclass().isAbstract()) {
- queue.add(i.superclass());
- }
- }
- for (ClassInfo i: ifaces) {
- addInterfaces(i.realInterfaces(), queue);
- }
- }
-
- public MethodInfo findRealOverriddenMethod(String name, String signature, HashSet notStrippable) {
- if (mReturnType == null) {
- // ctor
- return null;
- }
- if (mOverriddenMethod != null) {
- return mOverriddenMethod;
- }
-
- ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>();
- if (containingClass().realSuperclass() != null &&
- containingClass().realSuperclass().isAbstract()) {
- queue.add(containingClass());
- }
- addInterfaces(containingClass().realInterfaces(), queue);
- for (ClassInfo iface: queue) {
- for (MethodInfo me: iface.methods()) {
- if (me.name().equals(name)
- && me.signature().equals(signature)
- && me.inlineTags().tags() != null
- && me.inlineTags().tags().length > 0
- && notStrippable.contains(me.containingClass())) {
- return me;
- }
- }
- }
- return null;
- }
-
- public MethodInfo findSuperclassImplementation(HashSet notStrippable) {
- if (mReturnType == null) {
- // ctor
- return null;
- }
- if (mOverriddenMethod != null) {
- // Even if we're told outright that this was the overridden method, we want to
- // be conservative and ignore mismatches of parameter types -- they arise from
- // extending generic specializations, and we want to consider the derived-class
- // method to be a non-override.
- if (this.signature().equals(mOverriddenMethod.signature())) {
- return mOverriddenMethod;
- }
- }
-
- ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>();
- if (containingClass().realSuperclass() != null &&
- containingClass().realSuperclass().isAbstract()) {
- queue.add(containingClass());
- }
- addInterfaces(containingClass().realInterfaces(), queue);
- for (ClassInfo iface: queue) {
- for (MethodInfo me: iface.methods()) {
- if (me.name().equals(this.name())
- && me.signature().equals(this.signature())
- && notStrippable.contains(me.containingClass())) {
- return me;
- }
- }
- }
- return null;
- }
-
- public ClassInfo findRealOverriddenClass(String name, String signature) {
- if (mReturnType == null) {
- // ctor
- return null;
- }
- if (mOverriddenMethod != null) {
- return mOverriddenMethod.mRealContainingClass;
- }
-
- ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>();
- if (containingClass().realSuperclass() != null &&
- containingClass().realSuperclass().isAbstract()) {
- queue.add(containingClass());
- }
- addInterfaces(containingClass().realInterfaces(), queue);
- for (ClassInfo iface: queue) {
- for (MethodInfo me: iface.methods()) {
- if (me.name().equals(name)
- && me.signature().equals(signature)
- && me.inlineTags().tags() != null
- && me.inlineTags().tags().length > 0) {
- return iface;
- }
- }
- }
- return null;
- }
-
- private class FirstSentenceTags implements InheritedTags
- {
- public TagInfo[] tags()
- {
- return comment().briefTags();
- }
- public InheritedTags inherited()
- {
- MethodInfo m = findOverriddenMethod(name(), signature());
- if (m != null) {
- return m.firstSentenceTags();
- } else {
- return null;
- }
- }
- }
-
- private class ReturnTags implements InheritedTags {
- public TagInfo[] tags() {
- return comment().returnTags();
- }
- public InheritedTags inherited() {
- MethodInfo m = findOverriddenMethod(name(), signature());
- if (m != null) {
- return m.returnTags();
- } else {
- return null;
- }
- }
- }
-
- public boolean isDeprecated() {
- boolean deprecated = false;
- if (!mDeprecatedKnown) {
- boolean commentDeprecated = (comment().deprecatedTags().length > 0);
- boolean annotationDeprecated = false;
- for (AnnotationInstanceInfo annotation : annotations()) {
- if (annotation.type().qualifiedName().equals("java.lang.Deprecated")) {
- annotationDeprecated = true;
- break;
- }
- }
-
- if (commentDeprecated != annotationDeprecated) {
- Errors.error(Errors.DEPRECATION_MISMATCH, position(),
- "Method " + mContainingClass.qualifiedName() + "." + name()
- + ": @Deprecated annotation and @deprecated doc tag do not match");
- }
-
- mIsDeprecated = commentDeprecated | annotationDeprecated;
- mDeprecatedKnown = true;
- }
- return mIsDeprecated;
- }
-
- public TypeInfo[] getTypeParameters(){
- return mTypeParameters;
- }
-
- public MethodInfo cloneForClass(ClassInfo newContainingClass) {
- MethodInfo result = new MethodInfo(getRawCommentText(), mTypeParameters,
- name(), signature(), newContainingClass, realContainingClass(),
- isPublic(), isProtected(), isPackagePrivate(), isPrivate(), isFinal(), isStatic(),
- isSynthetic(), mIsAbstract, mIsSynchronized, mIsNative, mIsAnnotationElement,
- kind(), mFlatSignature, mOverriddenMethod,
- mReturnType, mParameters, mThrownExceptions, position(), annotations());
- result.init(mDefaultAnnotationElementValue);
- return result;
- }
-
- public MethodInfo(String rawCommentText, TypeInfo[] typeParameters, String name,
- String signature, ClassInfo containingClass, ClassInfo realContainingClass,
- boolean isPublic, boolean isProtected,
- boolean isPackagePrivate, boolean isPrivate,
- boolean isFinal, boolean isStatic, boolean isSynthetic,
- boolean isAbstract, boolean isSynchronized, boolean isNative,
- boolean isAnnotationElement, String kind,
- String flatSignature, MethodInfo overriddenMethod,
- TypeInfo returnType, ParameterInfo[] parameters,
- ClassInfo[] thrownExceptions, SourcePositionInfo position,
- AnnotationInstanceInfo[] annotations)
- {
- // Explicitly coerce 'final' state of Java6-compiled enum values() method, to match
- // the Java5-emitted base API description.
- super(rawCommentText, name, signature, containingClass, realContainingClass,
- isPublic, isProtected, isPackagePrivate, isPrivate,
- ((name.equals("values") && containingClass.isEnum()) ? true : isFinal),
- isStatic, isSynthetic, kind, position, annotations);
-
- // The underlying MethodDoc for an interface's declared methods winds up being marked
- // non-abstract. Correct that here by looking at the immediate-parent class, and marking
- // this method abstract if it is an unimplemented interface method.
- if (containingClass.isInterface()) {
- isAbstract = true;
- }
-
- mReasonOpened = "0:0";
- mIsAnnotationElement = isAnnotationElement;
- mTypeParameters = typeParameters;
- mIsAbstract = isAbstract;
- mIsSynchronized = isSynchronized;
- mIsNative = isNative;
- mFlatSignature = flatSignature;
- mOverriddenMethod = overriddenMethod;
- mReturnType = returnType;
- mParameters = parameters;
- mThrownExceptions = thrownExceptions;
- }
-
- public void init(AnnotationValueInfo defaultAnnotationElementValue)
- {
- mDefaultAnnotationElementValue = defaultAnnotationElementValue;
- }
-
- public boolean isAbstract()
- {
- return mIsAbstract;
- }
-
- public boolean isSynchronized()
- {
- return mIsSynchronized;
- }
-
- public boolean isNative()
- {
- return mIsNative;
- }
-
- public String flatSignature()
- {
- return mFlatSignature;
- }
-
- public InheritedTags inlineTags()
- {
- return new InlineTags();
- }
-
- public InheritedTags firstSentenceTags()
- {
- return new FirstSentenceTags();
- }
-
- public InheritedTags returnTags() {
- return new ReturnTags();
- }
-
- public TypeInfo returnType()
- {
- return mReturnType;
- }
-
- public String prettySignature()
- {
- String s = "(";
- int N = mParameters.length;
- for (int i=0; i<N; i++) {
- ParameterInfo p = mParameters[i];
- TypeInfo t = p.type();
- if (t.isPrimitive()) {
- s += t.simpleTypeName();
- } else {
- s += t.asClassInfo().name();
- }
- if (i != N-1) {
- s += ',';
- }
- }
- s += ')';
- return s;
- }
-
- /**
- * Returns a name consistent with the {@link
- * com.android.apicheck.MethodInfo#getHashableName()}.
- */
- public String getHashableName() {
- StringBuilder result = new StringBuilder();
- result.append(name());
- for (int p = 0; p < mParameters.length; p++) {
- result.append(":");
- if (p == mParameters.length - 1 && isVarArgs()) {
- // TODO: note that this does not attempt to handle hypothetical
- // vararg methods whose last parameter is a list of arrays, e.g.
- // "Object[]...".
- result.append(mParameters[p].type().fullNameNoDimension(typeVariables()))
- .append("...");
- } else {
- result.append(mParameters[p].type().fullName(typeVariables()));
- }
- }
- return result.toString();
- }
-
- private boolean inList(ClassInfo item, ThrowsTagInfo[] list)
- {
- int len = list.length;
- String qn = item.qualifiedName();
- for (int i=0; i<len; i++) {
- ClassInfo ex = list[i].exception();
- if (ex != null && ex.qualifiedName().equals(qn)) {
- return true;
- }
- }
- return false;
- }
-
- public ThrowsTagInfo[] throwsTags()
- {
- if (mThrowsTags == null) {
- ThrowsTagInfo[] documented = comment().throwsTags();
- ArrayList<ThrowsTagInfo> rv = new ArrayList<ThrowsTagInfo>();
-
- int len = documented.length;
- for (int i=0; i<len; i++) {
- rv.add(documented[i]);
- }
-
- ClassInfo[] all = mThrownExceptions;
- len = all.length;
- for (int i=0; i<len; i++) {
- ClassInfo cl = all[i];
- if (documented == null || !inList(cl, documented)) {
- rv.add(new ThrowsTagInfo("@throws", "@throws",
- cl.qualifiedName(), cl, "",
- containingClass(), position()));
- }
- }
- mThrowsTags = rv.toArray(new ThrowsTagInfo[rv.size()]);
- }
- return mThrowsTags;
- }
-
- private static int indexOfParam(String name, String[] list)
- {
- final int N = list.length;
- for (int i=0; i<N; i++) {
- if (name.equals(list[i])) {
- return i;
- }
- }
- return -1;
- }
-
- public ParamTagInfo[] paramTags()
- {
- if (mParamTags == null) {
- final int N = mParameters.length;
-
- String[] names = new String[N];
- String[] comments = new String[N];
- SourcePositionInfo[] positions = new SourcePositionInfo[N];
-
- // get the right names so we can handle our names being different from
- // our parent's names.
- for (int i=0; i<N; i++) {
- names[i] = mParameters[i].name();
- comments[i] = "";
- positions[i] = mParameters[i].position();
- }
-
- // gather our comments, and complain about misnamed @param tags
- for (ParamTagInfo tag: comment().paramTags()) {
- int index = indexOfParam(tag.parameterName(), names);
- if (index >= 0) {
- comments[index] = tag.parameterComment();
- positions[index] = tag.position();
- } else {
- Errors.error(Errors.UNKNOWN_PARAM_TAG_NAME, tag.position(),
- "@param tag with name that doesn't match the parameter list: '"
- + tag.parameterName() + "'");
- }
- }
-
- // get our parent's tags to fill in the blanks
- MethodInfo overridden = this.findOverriddenMethod(name(), signature());
- if (overridden != null) {
- ParamTagInfo[] maternal = overridden.paramTags();
- for (int i=0; i<N; i++) {
- if (comments[i].equals("")) {
- comments[i] = maternal[i].parameterComment();
- positions[i] = maternal[i].position();
- }
- }
- }
-
- // construct the results, and cache them for next time
- mParamTags = new ParamTagInfo[N];
- for (int i=0; i<N; i++) {
- mParamTags[i] = new ParamTagInfo("@param", "@param", names[i] + " " + comments[i],
- parent(), positions[i]);
-
- // while we're here, if we find any parameters that are still undocumented at this
- // point, complain. (this warning is off by default, because it's really, really
- // common; but, it's good to be able to enforce it)
- if (comments[i].equals("")) {
- Errors.error(Errors.UNDOCUMENTED_PARAMETER, positions[i],
- "Undocumented parameter '" + names[i] + "' on method '"
- + name() + "'");
- }
- }
- }
- return mParamTags;
- }
-
- public SeeTagInfo[] seeTags()
- {
- SeeTagInfo[] result = comment().seeTags();
- if (result == null) {
- if (mOverriddenMethod != null) {
- result = mOverriddenMethod.seeTags();
- }
- }
- return result;
- }
-
- public TagInfo[] deprecatedTags()
- {
- TagInfo[] result = comment().deprecatedTags();
- if (result.length == 0) {
- if (comment().undeprecateTags().length == 0) {
- if (mOverriddenMethod != null) {
- result = mOverriddenMethod.deprecatedTags();
- }
- }
- }
- return result;
- }
-
- public ParameterInfo[] parameters()
- {
- return mParameters;
- }
-
-
- public boolean matchesParams(String[] params, String[] dimensions)
- {
- if (mParamStrings == null) {
- ParameterInfo[] mine = mParameters;
- int len = mine.length;
- if (len != params.length) {
- return false;
- }
- for (int i=0; i<len; i++) {
- TypeInfo t = mine[i].type();
- if (!t.dimension().equals(dimensions[i])) {
- return false;
- }
- String qn = t.qualifiedTypeName();
- String s = params[i];
- int slen = s.length();
- int qnlen = qn.length();
- if (!(qn.equals(s) ||
- ((slen+1)<qnlen && qn.charAt(qnlen-slen-1)=='.'
- && qn.endsWith(s)))) {
- return false;
- }
- }
- }
- return true;
- }
-
- public void makeHDF(HDF data, String base)
- {
- data.setValue(base + ".kind", kind());
- data.setValue(base + ".name", name());
- data.setValue(base + ".href", htmlPage());
- data.setValue(base + ".anchor", anchor());
-
- if (mReturnType != null) {
- returnType().makeHDF(data, base + ".returnType", false, typeVariables());
- data.setValue(base + ".abstract", mIsAbstract ? "abstract" : "");
- }
-
- data.setValue(base + ".synchronized", mIsSynchronized ? "synchronized" : "");
- data.setValue(base + ".final", isFinal() ? "final" : "");
- data.setValue(base + ".static", isStatic() ? "static" : "");
-
- TagInfo.makeHDF(data, base + ".shortDescr", firstSentenceTags());
- TagInfo.makeHDF(data, base + ".descr", inlineTags());
- TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags());
- TagInfo.makeHDF(data, base + ".seeAlso", seeTags());
- data.setValue(base + ".since", getSince());
- ParamTagInfo.makeHDF(data, base + ".paramTags", paramTags());
- AttrTagInfo.makeReferenceHDF(data, base + ".attrRefs", comment().attrTags());
- ThrowsTagInfo.makeHDF(data, base + ".throws", throwsTags());
- ParameterInfo.makeHDF(data, base + ".params", parameters(), isVarArgs(), typeVariables());
- if (isProtected()) {
- data.setValue(base + ".scope", "protected");
- }
- else if (isPublic()) {
- data.setValue(base + ".scope", "public");
- }
- TagInfo.makeHDF(data, base + ".returns", returnTags());
-
- if (mTypeParameters != null) {
- TypeInfo.makeHDF(data, base + ".generic.typeArguments", mTypeParameters, false);
- }
- }
-
- public HashSet<String> typeVariables()
- {
- HashSet<String> result = TypeInfo.typeVariables(mTypeParameters);
- ClassInfo cl = containingClass();
- while (cl != null) {
- TypeInfo[] types = cl.asTypeInfo().typeArguments();
- if (types != null) {
- TypeInfo.typeVariables(types, result);
- }
- cl = cl.containingClass();
- }
- return result;
- }
-
- @Override
- public boolean isExecutable()
- {
- return true;
- }
-
- public ClassInfo[] thrownExceptions()
- {
- return mThrownExceptions;
- }
-
- public String typeArgumentsName(HashSet<String> typeVars)
- {
- if (mTypeParameters == null || mTypeParameters.length == 0) {
- return "";
- } else {
- return TypeInfo.typeArgumentsName(mTypeParameters, typeVars);
- }
- }
-
- public boolean isAnnotationElement()
- {
- return mIsAnnotationElement;
- }
-
- public AnnotationValueInfo defaultAnnotationElementValue()
- {
- return mDefaultAnnotationElementValue;
- }
-
- public void setVarargs(boolean set){
- mIsVarargs = set;
- }
- public boolean isVarArgs(){
- return mIsVarargs;
- }
-
- @Override
- public String toString(){
- return this.name();
- }
-
- public void setReason(String reason) {
- mReasonOpened = reason;
- }
-
- public String getReason() {
- return mReasonOpened;
- }
-
- private String mFlatSignature;
- private MethodInfo mOverriddenMethod;
- private TypeInfo mReturnType;
- private boolean mIsAnnotationElement;
- private boolean mIsAbstract;
- private boolean mIsSynchronized;
- private boolean mIsNative;
- private boolean mIsVarargs;
- private boolean mDeprecatedKnown;
- private boolean mIsDeprecated;
- private ParameterInfo[] mParameters;
- private ClassInfo[] mThrownExceptions;
- private String[] mParamStrings;
- ThrowsTagInfo[] mThrowsTags;
- private ParamTagInfo[] mParamTags;
- private TypeInfo[] mTypeParameters;
- private AnnotationValueInfo mDefaultAnnotationElementValue;
- private String mReasonOpened;
-}
-
diff --git a/tools/droiddoc/src/NavTree.java b/tools/droiddoc/src/NavTree.java
deleted file mode 100644
index 0469fdc..0000000
--- a/tools/droiddoc/src/NavTree.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-
-import java.util.ArrayList;
-
-public class NavTree {
-
- public static void writeNavTree(String dir) {
- ArrayList<Node> children = new ArrayList();
- for (PackageInfo pkg: DroidDoc.choosePackages()) {
- children.add(makePackageNode(pkg));
- }
- Node node = new Node("Reference", dir + "packages.html", children, null);
-
- StringBuilder buf = new StringBuilder();
- if (false) {
- // if you want a root node
- buf.append("[");
- node.render(buf);
- buf.append("]");
- } else {
- // if you don't want a root node
- node.renderChildren(buf);
- }
-
- HDF data = DroidDoc.makeHDF();
- data.setValue("reference_tree", buf.toString());
- ClearPage.write(data, "navtree_data.cs", "navtree_data.js");
- }
-
- private static Node makePackageNode(PackageInfo pkg) {
- ArrayList<Node> children = new ArrayList();
-
- children.add(new Node("Description", pkg.fullDescriptionHtmlPage(), null, null));
-
- addClassNodes(children, "Interfaces", pkg.interfaces());
- addClassNodes(children, "Classes", pkg.ordinaryClasses());
- addClassNodes(children, "Enums", pkg.enums());
- addClassNodes(children, "Exceptions", pkg.exceptions());
- addClassNodes(children, "Errors", pkg.errors());
-
- return new Node(pkg.name(), pkg.htmlPage(), children, pkg.getSince());
- }
-
- private static void addClassNodes(ArrayList<Node> parent, String label, ClassInfo[] classes) {
- ArrayList<Node> children = new ArrayList();
-
- for (ClassInfo cl: classes) {
- if (cl.checkLevel()) {
- children.add(new Node(cl.name(), cl.htmlPage(), null, cl.getSince()));
- }
- }
-
- if (children.size() > 0) {
- parent.add(new Node(label, null, children, null));
- }
- }
-
- private static class Node {
- private String mLabel;
- private String mLink;
- ArrayList<Node> mChildren;
- private String mSince;
-
- Node(String label, String link, ArrayList<Node> children, String since) {
- mLabel = label;
- mLink = link;
- mChildren = children;
- mSince = since;
- }
-
- static void renderString(StringBuilder buf, String s) {
- if (s == null) {
- buf.append("null");
- } else {
- buf.append('"');
- final int N = s.length();
- for (int i=0; i<N; i++) {
- char c = s.charAt(i);
- if (c >= ' ' && c <= '~' && c != '"' && c != '\\') {
- buf.append(c);
- } else {
- buf.append("\\u");
- for (int j=0; i<4; i++) {
- char x = (char)(c & 0x000f);
- if (x > 10) {
- x = (char)(x - 10 + 'a');
- } else {
- x = (char)(x + '0');
- }
- buf.append(x);
- c >>= 4;
- }
- }
- }
- buf.append('"');
- }
- }
-
- void renderChildren(StringBuilder buf) {
- ArrayList<Node> list = mChildren;
- if (list == null || list.size() == 0) {
- // We output null for no children. That way empty lists here can just
- // be a byproduct of how we generate the lists.
- buf.append("null");
- } else {
- buf.append("[ ");
- final int N = list.size();
- for (int i=0; i<N; i++) {
- list.get(i).render(buf);
- if (i != N-1) {
- buf.append(", ");
- }
- }
- buf.append(" ]\n");
- }
- }
-
- void render(StringBuilder buf) {
- buf.append("[ ");
- renderString(buf, mLabel);
- buf.append(", ");
- renderString(buf, mLink);
- buf.append(", ");
- renderChildren(buf);
- buf.append(", ");
- renderString(buf, mSince);
- buf.append(" ]");
- }
- }
-}
diff --git a/tools/droiddoc/src/PackageInfo.java b/tools/droiddoc/src/PackageInfo.java
deleted file mode 100644
index 17ad1b7..0000000
--- a/tools/droiddoc/src/PackageInfo.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import com.sun.javadoc.*;
-import com.sun.tools.doclets.*;
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.*;
-import java.io.*;
-
-public class PackageInfo extends DocInfo implements ContainerInfo
-{
- public static final Comparator<PackageInfo> comparator = new Comparator<PackageInfo>() {
- public int compare(PackageInfo a, PackageInfo b) {
- return a.name().compareTo(b.name());
- }
- };
-
- public PackageInfo(PackageDoc pkg, String name, SourcePositionInfo position)
- {
- super(pkg.getRawCommentText(), position);
- mName = name;
-
- if (pkg == null) {
- throw new RuntimeException("pkg is null");
- }
- mPackage = pkg;
- }
-
- public String htmlPage()
- {
- String s = mName;
- s = s.replace('.', '/');
- s += "/package-summary.html";
- s = DroidDoc.javadocDir + s;
- return s;
- }
-
- public String fullDescriptionHtmlPage() {
- String s = mName;
- s = s.replace('.', '/');
- s += "/package-descr.html";
- s = DroidDoc.javadocDir + s;
- return s;
- }
-
- @Override
- public ContainerInfo parent()
- {
- return null;
- }
-
- @Override
- public boolean isHidden()
- {
- return comment().isHidden();
- }
-
- public boolean checkLevel() {
- // TODO should return false if all classes are hidden but the package isn't.
- // We don't have this so I'm not doing it now.
- return !isHidden();
- }
-
- public String name()
- {
- return mName;
- }
-
- public String qualifiedName()
- {
- return mName;
- }
-
- public TagInfo[] inlineTags()
- {
- return comment().tags();
- }
-
- public TagInfo[] firstSentenceTags()
- {
- return comment().briefTags();
- }
-
- public static ClassInfo[] filterHidden(ClassInfo[] classes)
- {
- ArrayList<ClassInfo> out = new ArrayList<ClassInfo>();
-
- for (ClassInfo cl: classes) {
- if (!cl.isHidden()) {
- out.add(cl);
- }
- }
-
- return out.toArray(new ClassInfo[0]);
- }
-
- public void makeLink(HDF data, String base)
- {
- if (checkLevel()) {
- data.setValue(base + ".link", htmlPage());
- }
- data.setValue(base + ".name", name());
- data.setValue(base + ".since", getSince());
- }
-
- public void makeClassLinkListHDF(HDF data, String base)
- {
- makeLink(data, base);
- ClassInfo.makeLinkListHDF(data, base + ".interfaces", interfaces());
- ClassInfo.makeLinkListHDF(data, base + ".classes", ordinaryClasses());
- ClassInfo.makeLinkListHDF(data, base + ".enums", enums());
- ClassInfo.makeLinkListHDF(data, base + ".exceptions", exceptions());
- ClassInfo.makeLinkListHDF(data, base + ".errors", errors());
- data.setValue(base + ".since", getSince());
- }
-
- public ClassInfo[] interfaces()
- {
- if (mInterfaces == null) {
- mInterfaces = ClassInfo.sortByName(filterHidden(Converter.convertClasses(
- mPackage.interfaces())));
- }
- return mInterfaces;
- }
-
- public ClassInfo[] ordinaryClasses()
- {
- if (mOrdinaryClasses == null) {
- mOrdinaryClasses = ClassInfo.sortByName(filterHidden(Converter.convertClasses(
- mPackage.ordinaryClasses())));
- }
- return mOrdinaryClasses;
- }
-
- public ClassInfo[] enums()
- {
- if (mEnums == null) {
- mEnums = ClassInfo.sortByName(filterHidden(Converter.convertClasses(mPackage.enums())));
- }
- return mEnums;
- }
-
- public ClassInfo[] exceptions()
- {
- if (mExceptions == null) {
- mExceptions = ClassInfo.sortByName(filterHidden(Converter.convertClasses(
- mPackage.exceptions())));
- }
- return mExceptions;
- }
-
- public ClassInfo[] errors()
- {
- if (mErrors == null) {
- mErrors = ClassInfo.sortByName(filterHidden(Converter.convertClasses(
- mPackage.errors())));
- }
- return mErrors;
- }
-
- // in hashed containers, treat the name as the key
- @Override
- public int hashCode() {
- return mName.hashCode();
- }
-
- private String mName;
- private PackageDoc mPackage;
- private ClassInfo[] mInterfaces;
- private ClassInfo[] mOrdinaryClasses;
- private ClassInfo[] mEnums;
- private ClassInfo[] mExceptions;
- private ClassInfo[] mErrors;
-}
-
diff --git a/tools/droiddoc/src/ParamTagInfo.java b/tools/droiddoc/src/ParamTagInfo.java
deleted file mode 100644
index d6f2b6b..0000000
--- a/tools/droiddoc/src/ParamTagInfo.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-
-public class ParamTagInfo extends ParsedTagInfo
-{
- static final Pattern PATTERN = Pattern.compile(
- "([^ \t\r\n]+)[ \t\r\n]+(.*)",
- Pattern.DOTALL);
-
- private boolean mIsTypeParameter;
- private String mParameterComment;
- private String mParameterName;
-
- ParamTagInfo(String name, String kind, String text, ContainerInfo base,
- SourcePositionInfo sp)
- {
- super(name, kind, text, base, sp);
-
- Matcher m = PATTERN.matcher(text);
- if (m.matches()) {
- mParameterName = m.group(1);
- mParameterComment = m.group(2);
- int len = mParameterName.length();
- mIsTypeParameter = len > 2
- && mParameterName.charAt(0) == '<'
- && mParameterName.charAt(len-1) == '>';
- } else {
- mParameterName = text.trim();
- mParameterComment = "";
- mIsTypeParameter = false;
- }
- setCommentText(mParameterComment);
- }
-
- ParamTagInfo(String name, String kind, String text,
- boolean isTypeParameter, String parameterComment,
- String parameterName, ContainerInfo base,
- SourcePositionInfo sp)
- {
- super(name, kind, text, base, sp);
- mIsTypeParameter = isTypeParameter;
- mParameterComment = parameterComment;
- mParameterName = parameterName;
- }
-
- public boolean isTypeParameter()
- {
- return mIsTypeParameter;
- }
-
- public String parameterComment()
- {
- return mParameterComment;
- }
-
- public String parameterName()
- {
- return mParameterName;
- }
-
- @Override
- public void makeHDF(HDF data, String base)
- {
- data.setValue(base + ".name", parameterName());
- data.setValue(base + ".isTypeParameter", isTypeParameter() ? "1" : "0");
- TagInfo.makeHDF(data, base + ".comment", commentTags());
- }
-
- public static void makeHDF(HDF data, String base, ParamTagInfo[] tags)
- {
- for (int i=0; i<tags.length; i++) {
- // don't output if the comment is ""
- if (!"".equals(tags[i].parameterComment())) {
- tags[i].makeHDF(data, base + "." + i);
- }
- }
- }
-}
diff --git a/tools/droiddoc/src/ParameterInfo.java b/tools/droiddoc/src/ParameterInfo.java
deleted file mode 100644
index 44608be..0000000
--- a/tools/droiddoc/src/ParameterInfo.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.HashSet;
-
-public class ParameterInfo
-{
- ParameterInfo(String name, String typeName, TypeInfo type, SourcePositionInfo position)
- {
- mName = name;
- mTypeName = typeName;
- mType = type;
- mPosition = position;
- }
-
- TypeInfo type()
- {
- return mType;
- }
-
- String name()
- {
- return mName;
- }
-
- String typeName()
- {
- return mTypeName;
- }
-
- SourcePositionInfo position()
- {
- return mPosition;
- }
-
- public void makeHDF(HDF data, String base, boolean isLastVararg,
- HashSet<String> typeVariables)
- {
- data.setValue(base + ".name", this.name());
- type().makeHDF(data, base + ".type", isLastVararg, typeVariables);
- }
-
- public static void makeHDF(HDF data, String base, ParameterInfo[] params,
- boolean isVararg, HashSet<String> typeVariables)
- {
- for (int i=0; i<params.length; i++) {
- params[i].makeHDF(data, base + "." + i,
- isVararg && (i == params.length - 1), typeVariables);
- }
- }
-
- String mName;
- String mTypeName;
- TypeInfo mType;
- SourcePositionInfo mPosition;
-}
-
diff --git a/tools/droiddoc/src/ParsedTagInfo.java b/tools/droiddoc/src/ParsedTagInfo.java
deleted file mode 100755
index c2e4806..0000000
--- a/tools/droiddoc/src/ParsedTagInfo.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.ArrayList;
-
-public class ParsedTagInfo extends TagInfo
-{
- private ContainerInfo mContainer;
- private String mCommentText;
- private Comment mComment;
-
- ParsedTagInfo(String name, String kind, String text, ContainerInfo base, SourcePositionInfo sp)
- {
- super(name, kind, text, SourcePositionInfo.findBeginning(sp, text));
- mContainer = base;
- mCommentText = text;
- }
-
- public TagInfo[] commentTags()
- {
- if (mComment == null) {
- mComment = new Comment(mCommentText, mContainer, position());
- }
- return mComment.tags();
- }
-
- protected void setCommentText(String comment)
- {
- mCommentText = comment;
- }
-
- public static <T extends ParsedTagInfo> TagInfo[]
- joinTags(T[] tags)
- {
- ArrayList<TagInfo> list = new ArrayList<TagInfo>();
- final int N = tags.length;
- for (int i=0; i<N; i++) {
- TagInfo[] t = tags[i].commentTags();
- final int M = t.length;
- for (int j=0; j<M; j++) {
- list.add(t[j]);
- }
- }
- return list.toArray(new TagInfo[list.size()]);
- }
-}
diff --git a/tools/droiddoc/src/Proofread.java b/tools/droiddoc/src/Proofread.java
deleted file mode 100644
index ec9f523..0000000
--- a/tools/droiddoc/src/Proofread.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-import java.io.FileWriter;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-public class Proofread
-{
- static FileWriter out = null;
- static final Pattern WHITESPACE = Pattern.compile("\\r?\\n");
- static final String INDENT = " ";
- static final String NEWLINE = "\n" + INDENT;
-
- public static void initProofread(String filename)
- {
- try {
- out = new FileWriter(filename);
- out.write("javadoc proofread file: " + filename + "\n");
- }
- catch (IOException e) {
- if (out != null) {
- try {
- out.close();
- }
- catch (IOException ex) {
- }
- out = null;
- }
- System.err.println("error opening file: " + filename);
- }
- }
-
- public static void finishProofread(String filename)
- {
- if (out == null) {
- return;
- }
-
- try {
- out.close();
- }
- catch (IOException e) {
- }
- }
-
- public static void write(String s)
- {
- if (out == null) {
- return ;
- }
- try {
- out.write(s);
- }
- catch (IOException e) {
- }
- }
-
- public static void writeIndented(String s)
- {
- s = s.trim();
- Matcher m = WHITESPACE.matcher(s);
- s = m.replaceAll(NEWLINE);
- write(INDENT);
- write(s);
- write("\n");
- }
-
- public static void writeFileHeader(String filename)
- {
- write("\n\n=== ");
- write(filename);
- write(" ===\n");
- }
-
- public static void writeTagList(TagInfo[] tags)
- {
- if (out == null) {
- return;
- }
-
- for (TagInfo t: tags) {
- String k = t.kind();
- if ("Text".equals(t.name())) {
- writeIndented(t.text());
- }
- else if ("@more".equals(k)) {
- writeIndented("");
- }
- else if ("@see".equals(k)) {
- SeeTagInfo see = (SeeTagInfo)t;
- String label = see.label();
- if (label == null) {
- label = "";
- }
- writeIndented("{" + see.name() + " ... " + label + "}");
- }
- else if ("@code".equals(k)) {
- writeIndented(t.text());
- }
- else if ("@samplecode".equals(k)) {
- writeIndented(t.text());
- }
- else {
- writeIndented("{" + (t.name() != null ? t.name() : "") + "/" +
- t.text() + "}");
- }
- }
- }
-
- public static void writePackages(String filename, TagInfo[] tags)
- {
- if (out == null) {
- return;
- }
-
- writeFileHeader(filename);
- writeTagList(tags);
- }
-
- public static void writePackage(String filename, TagInfo[] tags)
- {
- if (out == null) {
- return;
- }
-
- writeFileHeader(filename);
- writeTagList(tags);
- }
-
- public static void writeClass(String filename, ClassInfo cl)
- {
- if (out == null) {
- return;
- }
-
- writeFileHeader(filename);
- writeTagList(cl.inlineTags());
-
- // enum constants
- for (FieldInfo f: cl.enumConstants()) {
- write("ENUM: " + f.name() + "\n");
- writeTagList(f.inlineTags());
- }
-
- // fields
- for (FieldInfo f: cl.selfFields()) {
- write("FIELD: " + f.name() + "\n");
- writeTagList(f.inlineTags());
- }
-
- // constructors
- for (MethodInfo m: cl.constructors()) {
- write("CONSTRUCTOR: " + m.name() + "\n");
- writeTagList(m.inlineTags().tags());
- }
-
- // methods
- for (MethodInfo m: cl.selfMethods()) {
- write("METHOD: " + m.name() + "\n");
- writeTagList(m.inlineTags().tags());
- }
- }
-}
diff --git a/tools/droiddoc/src/SampleCode.java b/tools/droiddoc/src/SampleCode.java
deleted file mode 100644
index bf54445..0000000
--- a/tools/droiddoc/src/SampleCode.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.*;
-import java.io.*;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-
-public class SampleCode {
- String mSource;
- String mDest;
- String mTitle;
-
- public SampleCode(String source, String dest, String title) {
- mSource = source;
- mTitle = title;
- int len = dest.length();
- if (len > 1 && dest.charAt(len-1) != '/') {
- mDest = dest + '/';
- } else {
- mDest = dest;
- }
- }
-
- public void write(boolean offlineMode) {
- File f = new File(mSource);
- if (!f.isDirectory()) {
- System.out.println("-samplecode not a directory: " + mSource);
- return;
- }
- if (offlineMode) writeIndexOnly(f, mDest, offlineMode);
- else writeDirectory(f, mDest);
- }
-
- public static String convertExtension(String s, String ext) {
- return s.substring(0, s.lastIndexOf('.')) + ext;
- }
-
- public static String[] IMAGES = { ".png", ".jpg", ".gif" };
- public static String[] TEMPLATED = { ".java", ".xml" };
-
- public static boolean inList(String s, String[] list) {
- for (String t: list) {
- if (s.endsWith(t)) {
- return true;
- }
- }
- return false;
- }
-
- public void writeDirectory(File dir, String relative) {
- TreeSet<String> dirs = new TreeSet<String>();
- TreeSet<String> files = new TreeSet<String>();
-
- String subdir = relative; //.substring(mDest.length());
-
- for (File f: dir.listFiles()) {
- String name = f.getName();
- if (name.startsWith(".") || name.startsWith("_")) {
- continue;
- }
- if (f.isFile()) {
- String out = relative + name;
-
- if (inList(out, IMAGES)) {
- // copied directly
- ClearPage.copyFile(f, out);
- writeImagePage(f, convertExtension(out, DroidDoc.htmlExtension), subdir);
- files.add(name);
- }
- if (inList(out, TEMPLATED)) {
- // copied and goes through the template
- ClearPage.copyFile(f, out);
- writePage(f, convertExtension(out, DroidDoc.htmlExtension), subdir);
- files.add(name);
- }
- // else ignored
- }
- else if (f.isDirectory()) {
- writeDirectory(f, relative + name + "/");
- dirs.add(name);
- }
- }
-
- // write the index page
- int i;
-
- HDF hdf = writeIndex(dir);
- hdf.setValue("subdir", subdir);
- i=0;
- for (String d: dirs) {
- hdf.setValue("subdirs." + i + ".name", d);
- i++;
- }
- i=0;
- for (String f: files) {
- hdf.setValue("files." + i + ".name", f);
- hdf.setValue("files." + i + ".href", convertExtension(f, ".html"));
- i++;
- }
-
- ClearPage.write(hdf, "sampleindex.cs", relative + "/index" + DroidDoc.htmlExtension);
- }
-
- public void writeIndexOnly(File dir, String relative, Boolean offline) {
- HDF hdf = writeIndex(dir);
- if (!offline) relative = "/" + relative;
- ClearPage.write(hdf, "sampleindex.cs", relative + "index" +
- DroidDoc.htmlExtension);
- }
-
- public HDF writeIndex(File dir) {
- HDF hdf = DroidDoc.makeHDF();
-
- hdf.setValue("page.title", dir.getName() + " - " + mTitle);
- hdf.setValue("projectTitle", mTitle);
-
- String filename = dir.getPath() + "/_index.html";
- String summary = SampleTagInfo.readFile(new SourcePositionInfo(filename,
- -1,-1), filename, "sample code", true, false, true);
-
- if (summary == null) {
- summary = "";
- }
- hdf.setValue("summary", summary);
-
- return hdf;
- }
-
- public void writePage(File f, String out, String subdir) {
- String name = f.getName();
-
- String filename = f.getPath();
- String data = SampleTagInfo.readFile(new SourcePositionInfo(filename, -1,-1), filename,
- "sample code", true, true, true);
- data = DroidDoc.escape(data);
-
- HDF hdf = DroidDoc.makeHDF();
-
- hdf.setValue("page.title", name);
- hdf.setValue("subdir", subdir);
- hdf.setValue("realFile", name);
- hdf.setValue("fileContents", data);
-
- ClearPage.write(hdf, "sample.cs", out);
- }
-
- public void writeImagePage(File f, String out, String subdir) {
- String name = f.getName();
-
- String data = "<img src=\"" + name + "\" title=\"" + name + "\" />";
-
- HDF hdf = DroidDoc.makeHDF();
-
- hdf.setValue("page.title", name);
- hdf.setValue("subdir", subdir);
- hdf.setValue("realFile", name);
- hdf.setValue("fileContents", data);
-
- ClearPage.write(hdf, "sample.cs", out);
- }
-}
diff --git a/tools/droiddoc/src/SampleTagInfo.java b/tools/droiddoc/src/SampleTagInfo.java
deleted file mode 100644
index c7ad1cc..0000000
--- a/tools/droiddoc/src/SampleTagInfo.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-
-import java.io.Reader;
-import java.io.IOException;
-import java.io.FileReader;
-import java.io.LineNumberReader;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-/*
- * SampleTagInfo copies text from a given file into the javadoc comment.
- *
- * The @include tag copies the text verbatim from the given file.
- *
- * The @sample tag copies the text from the given file, stripping leading and
- * trailing whitespace, and reducing the indent level of the text to the indent
- * level of the first non-whitespace line.
- *
- * Both tags accept either a filename and an id or just a filename. If no id
- * is provided, the entire file is copied. If an id is provided, the lines
- * in the given file between the first two lines containing BEGIN_INCLUDE(id)
- * and END_INCLUDE(id), for the given id, are copied. The id may be only
- * letters, numbers and underscore (_).
- *
- * Four examples:
- * {@include samples/ApiDemos/src/com/google/app/Notification1.java}
- * {@sample samples/ApiDemos/src/com/google/app/Notification1.java}
- * {@include samples/ApiDemos/src/com/google/app/Notification1.java Bleh}
- * {@sample samples/ApiDemos/src/com/google/app/Notification1.java Bleh}
- *
- */
-public class SampleTagInfo extends TagInfo
-{
- static final int STATE_BEGIN = 0;
- static final int STATE_MATCHING = 1;
-
- static final Pattern TEXT = Pattern.compile(
- "[\r\n \t]*([^\r\n \t]*)[\r\n \t]*([0-9A-Za-z_]*)[\r\n \t]*",
- Pattern.DOTALL);
-
- private static final String BEGIN_INCLUDE = "BEGIN_INCLUDE";
- private static final String END_INCLUDE = "END_INCLUDE";
-
- private ContainerInfo mBase;
- private String mIncluded;
-
- public static String escapeHtml(String str) {
- return str.replace("&", "&").replace("<", "<").replace(">", ">");
- }
-
- private static boolean isIncludeLine(String str) {
- return str.indexOf(BEGIN_INCLUDE)>=0 || str.indexOf(END_INCLUDE)>=0;
- }
-
- SampleTagInfo(String name, String kind, String text, ContainerInfo base,
- SourcePositionInfo position)
- {
- super(name, kind, text, position);
- mBase = base;
-
- Matcher m = TEXT.matcher(text);
- if (!m.matches()) {
- Errors.error(Errors.BAD_INCLUDE_TAG, position, "Bad @include tag: "
- + text);
- return;
- }
- String filename = m.group(1);
- String id = m.group(2);
- boolean trim = "@sample".equals(name);
-
- if (id == null || "".equals(id)) {
- mIncluded = readFile(position, filename, id, trim, true, false);
- } else {
- mIncluded = loadInclude(position, filename, id, trim);
- }
-
- if (mIncluded == null) {
- Errors.error(Errors.BAD_INCLUDE_TAG, position, "include tag '" + id
- + "' not found in file: " + filename);
- }
- }
-
- static String getTrimString(String line)
- {
- int i = 0;
- int len = line.length();
- for (; i<len; i++) {
- char c = line.charAt(i);
- if (c != ' ' && c != '\t') {
- break;
- }
- }
- if (i == len) {
- return null;
- } else {
- return line.substring(0, i);
- }
- }
-
- static String loadInclude(SourcePositionInfo pos, String filename,
- String id, boolean trim)
- {
- Reader input = null;
- StringBuilder result = new StringBuilder();
-
- String begin = BEGIN_INCLUDE + "(" + id + ")";
- String end = END_INCLUDE + "(" + id + ")";
-
- try {
- input = new FileReader(filename);
- LineNumberReader lines = new LineNumberReader(input);
-
- int state = STATE_BEGIN;
-
- int trimLength = -1;
- String trimString = null;
- int trailing = 0;
-
- while (true) {
- String line = lines.readLine();
- if (line == null) {
- return null;
- }
- switch (state) {
- case STATE_BEGIN:
- if (line.indexOf(begin) >= 0) {
- state = STATE_MATCHING;
- }
- break;
- case STATE_MATCHING:
- if (line.indexOf(end) >= 0) {
- return result.substring(0);
- } else {
- boolean empty = "".equals(line.trim());
- if (trim) {
- if (isIncludeLine(line)) {
- continue;
- }
- if (trimLength < 0 && !empty) {
- trimString = getTrimString(line);
- if (trimString != null) {
- trimLength = trimString.length();
- }
- }
- if (trimLength >= 0 && line.length() > trimLength) {
- boolean trimThisLine = true;
- for (int i=0; i<trimLength; i++) {
- if (line.charAt(i) != trimString.charAt(i)){
- trimThisLine = false;
- break;
- }
- }
- if (trimThisLine) {
- line = line.substring(trimLength);
- }
- }
- if (trimLength >= 0) {
- if (!empty) {
- for (int i=0; i<trailing; i++) {
- result.append('\n');
- }
- line = escapeHtml(line);
- result.append(line);
- trailing = 1; // add \n next time, maybe
- } else {
- trailing++;
- }
- }
- } else {
- result.append(line);
- result.append('\n');
- }
- }
- break;
- }
- }
- }
- catch (IOException e) {
- Errors.error(Errors.BAD_INCLUDE_TAG, pos, "Error reading file for"
- + " include \"" + id + "\" " + filename);
- }
- finally {
- if (input != null) {
- try {
- input.close();
- }
- catch (IOException ex) {
- }
- }
- }
- Errors.error(Errors.BAD_INCLUDE_TAG, pos, "Did not find " + end
- + " in file " + filename);
- return null;
- }
-
- static String readFile(SourcePositionInfo pos, String filename,
- String id, boolean trim, boolean escape,
- boolean errorOk)
- {
- Reader input = null;
- StringBuilder result = new StringBuilder();
- int trailing = 0;
- boolean started = false;
- try {
- input = new FileReader(filename);
- LineNumberReader lines = new LineNumberReader(input);
-
- while (true) {
- String line = lines.readLine();
- if (line == null) {
- break;
- }
- if (trim) {
- if (isIncludeLine(line)) {
- continue;
- }
- if (!"".equals(line.trim())) {
- if (started) {
- for (int i=0; i<trailing; i++) {
- result.append('\n');
- }
- }
- if (escape) {
- line = escapeHtml(line);
- }
- result.append(line);
- trailing = 1; // add \n next time, maybe
- started = true;
- } else {
- if (started) {
- trailing++;
- }
- }
- } else {
- result.append(line);
- result.append('\n');
- }
- }
- }
- catch (IOException e) {
- if (errorOk) {
- return null;
- } else {
- Errors.error(Errors.BAD_INCLUDE_TAG, pos, "Error reading file for"
- + " include \"" + id + "\" " + filename);
- }
- }
- finally {
- if (input != null) {
- try {
- input.close();
- }
- catch (IOException ex) {
- }
- }
- }
- return result.substring(0);
- }
-
- @Override
- public void makeHDF(HDF data, String base)
- {
- data.setValue(base + ".name", name());
- data.setValue(base + ".kind", kind());
- if (mIncluded != null) {
- data.setValue(base + ".text", mIncluded);
- } else {
- data.setValue(base + ".text", "INCLUDE_ERROR");
- }
- }
-}
-
diff --git a/tools/droiddoc/src/Scoped.java b/tools/droiddoc/src/Scoped.java
deleted file mode 100644
index cca61ed..0000000
--- a/tools/droiddoc/src/Scoped.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public interface Scoped {
- boolean isPublic();
- boolean isProtected();
- boolean isPackagePrivate();
- boolean isPrivate();
- boolean isHidden();
-}
diff --git a/tools/droiddoc/src/SeeTagInfo.java b/tools/droiddoc/src/SeeTagInfo.java
deleted file mode 100644
index 8420ed3..0000000
--- a/tools/droiddoc/src/SeeTagInfo.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.ArrayList;
-
-public class SeeTagInfo extends TagInfo
-{
- private ContainerInfo mBase;
- LinkReference mLink;
-
- SeeTagInfo(String name, String kind, String text, ContainerInfo base,
- SourcePositionInfo position)
- {
- super(name, kind, text, position);
- mBase = base;
- }
-
- protected LinkReference linkReference() {
- if (mLink == null) {
- mLink = LinkReference.parse(text(), mBase, position(),
- (!"@see".equals(name())) && (mBase != null ? mBase.checkLevel() : true));
- }
- return mLink;
- }
-
- public String label()
- {
- return linkReference().label;
- }
-
- @Override
- public void makeHDF(HDF data, String base)
- {
- LinkReference linkRef = linkReference();
- if (linkRef.kind != null) {
- // if they have a better suggestion about "kind" use that.
- // do this before super.makeHDF() so it picks it up
- setKind(linkRef.kind);
- }
-
- super.makeHDF(data, base);
-
- data.setValue(base + ".label", linkRef.label);
- if (linkRef.href != null) {
- data.setValue(base + ".href", linkRef.href);
- }
- }
-
- public boolean checkLevel() {
- return linkReference().checkLevel();
- }
-
- public static void makeHDF(HDF data, String base, SeeTagInfo[] tags)
- {
- int j=0;
- for (SeeTagInfo tag: tags) {
- if (tag.mBase.checkLevel() && tag.checkLevel()) {
- tag.makeHDF(data, base + "." + j);
- j++;
- }
- }
- }
-}
diff --git a/tools/droiddoc/src/SinceTagger.java b/tools/droiddoc/src/SinceTagger.java
deleted file mode 100644
index a1bce55..0000000
--- a/tools/droiddoc/src/SinceTagger.java
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
-
-import com.android.apicheck.ApiCheck;
-import com.android.apicheck.ApiInfo;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Collections;
-
-import org.clearsilver.HDF;
-
-/**
- * Applies version information to the DroidDoc class model from apicheck XML
- * files. Sample usage:
- * <pre>
- * ClassInfo[] classInfos = ...
- *
- * SinceTagger sinceTagger = new SinceTagger()
- * sinceTagger.addVersion("frameworks/base/api/1.xml", "Android 1.0")
- * sinceTagger.addVersion("frameworks/base/api/2.xml", "Android 1.5")
- * sinceTagger.tagAll(...);
- * </pre>
- */
-public class SinceTagger {
-
- private final Map<String, String> xmlToName
- = new LinkedHashMap<String, String>();
-
- /**
- * Specifies the apicheck XML file and the API version it holds. Calls to
- * this method should be called in order from oldest version to newest.
- */
- public void addVersion(String file, String name) {
- xmlToName.put(file, name);
- }
-
- public void tagAll(ClassInfo[] classDocs) {
- // read through the XML files in order, applying their since information
- // to the Javadoc models
- for (Map.Entry<String, String> versionSpec : xmlToName.entrySet()) {
- String xmlFile = versionSpec.getKey();
- String versionName = versionSpec.getValue();
- ApiInfo specApi = new ApiCheck().parseApi(xmlFile);
-
- applyVersionsFromSpec(versionName, specApi, classDocs);
- }
-
- if (!xmlToName.isEmpty()) {
- warnForMissingVersions(classDocs);
- }
- }
-
- /**
- * Writes an index of the version names to {@code data}.
- */
- public void writeVersionNames(HDF data) {
- int index = 1;
- for (String version : xmlToName.values()) {
- data.setValue("since." + index + ".name", version);
- index++;
- }
- }
-
- /**
- * Applies the version information to {@code classDocs} where not already
- * present.
- *
- * @param versionName the version name
- * @param specApi the spec for this version. If a symbol is in this spec, it
- * was present in the named version
- * @param classDocs the doc model to update
- */
- private void applyVersionsFromSpec(String versionName,
- ApiInfo specApi, ClassInfo[] classDocs) {
- for (ClassInfo classDoc : classDocs) {
- com.android.apicheck.PackageInfo packageSpec
- = specApi.getPackages().get(classDoc.containingPackage().name());
-
- if (packageSpec == null) {
- continue;
- }
-
- com.android.apicheck.ClassInfo classSpec
- = packageSpec.allClasses().get(classDoc.name());
-
- if (classSpec == null) {
- continue;
- }
-
- versionPackage(versionName, classDoc.containingPackage());
- versionClass(versionName, classDoc);
- versionConstructors(versionName, classSpec, classDoc);
- versionFields(versionName, classSpec, classDoc);
- versionMethods(versionName, classSpec, classDoc);
- }
- }
-
- /**
- * Applies version information to {@code doc} where not already present.
- */
- private void versionPackage(String versionName, PackageInfo doc) {
- if (doc.getSince() == null) {
- doc.setSince(versionName);
- }
- }
-
- /**
- * Applies version information to {@code doc} where not already present.
- */
- private void versionClass(String versionName, ClassInfo doc) {
- if (doc.getSince() == null) {
- doc.setSince(versionName);
- }
- }
-
- /**
- * Applies version information from {@code spec} to {@code doc} where not
- * already present.
- */
- private void versionConstructors(String versionName,
- com.android.apicheck.ClassInfo spec, ClassInfo doc) {
- for (MethodInfo constructor : doc.constructors()) {
- if (constructor.getSince() == null
- && spec.allConstructors().containsKey(constructor.getHashableName())) {
- constructor.setSince(versionName);
- }
- }
- }
-
- /**
- * Applies version information from {@code spec} to {@code doc} where not
- * already present.
- */
- private void versionFields(String versionName,
- com.android.apicheck.ClassInfo spec, ClassInfo doc) {
- for (FieldInfo field : doc.fields()) {
- if (field.getSince() == null
- && spec.allFields().containsKey(field.name())) {
- field.setSince(versionName);
- }
- }
- }
-
- /**
- * Applies version information from {@code spec} to {@code doc} where not
- * already present.
- */
- private void versionMethods(String versionName,
- com.android.apicheck.ClassInfo spec, ClassInfo doc) {
- for (MethodInfo method : doc.methods()) {
- if (method.getSince() != null) {
- continue;
- }
-
- for (com.android.apicheck.ClassInfo superclass : spec.hierarchy()) {
- if (superclass.allMethods().containsKey(method.getHashableName())) {
- method.setSince(versionName);
- break;
- }
- }
- }
- }
-
- /**
- * Warns if any symbols are missing version information. When configured
- * properly, this will yield zero warnings because {@code apicheck}
- * guarantees that all symbols are present in the most recent API.
- */
- private void warnForMissingVersions(ClassInfo[] classDocs) {
- for (ClassInfo claz : classDocs) {
- if (!checkLevelRecursive(claz)) {
- continue;
- }
-
- if (claz.getSince() == null) {
- Errors.error(Errors.NO_SINCE_DATA, claz.position(),
- "XML missing class " + claz.qualifiedName());
- }
-
- for (FieldInfo field : missingVersions(claz.fields())) {
- Errors.error(Errors.NO_SINCE_DATA, field.position(),
- "XML missing field " + claz.qualifiedName()
- + "#" + field.name());
- }
-
- for (MethodInfo constructor : missingVersions(claz.constructors())) {
- Errors.error(Errors.NO_SINCE_DATA, constructor.position(),
- "XML missing constructor " + claz.qualifiedName()
- + "#" + constructor.getHashableName());
- }
-
- for (MethodInfo method : missingVersions(claz.methods())) {
- Errors.error(Errors.NO_SINCE_DATA, method.position(),
- "XML missing method " + claz.qualifiedName()
- + "#" + method.getHashableName());
- }
- }
- }
-
- /**
- * Returns the DocInfos in {@code all} that are documented but do not have
- * since tags.
- */
- private <T extends MemberInfo> Iterable<T> missingVersions(T[] all) {
- List<T> result = Collections.emptyList();
- for (T t : all) {
- // if this member has version info or isn't documented, skip it
- if (t.getSince() != null
- || t.isHidden()
- || !checkLevelRecursive(t.realContainingClass())) {
- continue;
- }
-
- if (result.isEmpty()) {
- result = new ArrayList<T>(); // lazily construct a mutable list
- }
- result.add(t);
- }
- return result;
- }
-
- /**
- * Returns true if {@code claz} and all containing classes are documented.
- * The result may be used to filter out members that exist in the API
- * data structure but aren't a part of the API.
- */
- private boolean checkLevelRecursive(ClassInfo claz) {
- for (ClassInfo c = claz; c != null; c = c.containingClass()) {
- if (!c.checkLevel()) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/tools/droiddoc/src/Sorter.java b/tools/droiddoc/src/Sorter.java
deleted file mode 100644
index 92039d4..0000000
--- a/tools/droiddoc/src/Sorter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class Sorter implements Comparable
-{
- public String label;
- public Object data;
-
- public Sorter(String l, Object d)
- {
- label = l;
- data = d;
- }
-
- public int compareTo(Object other)
- {
- return label.compareToIgnoreCase(((Sorter)other).label);
- }
-}
diff --git a/tools/droiddoc/src/SourcePositionInfo.java b/tools/droiddoc/src/SourcePositionInfo.java
deleted file mode 100644
index ac605ec..0000000
--- a/tools/droiddoc/src/SourcePositionInfo.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class SourcePositionInfo implements Comparable
-{
- public SourcePositionInfo() {
- this.file = "<unknown>";
- this.line = 0;
- this.column = 0;
- }
-
- public SourcePositionInfo(String file, int line, int column)
- {
- this.file = file;
- this.line = line;
- this.column = column;
- }
-
- public SourcePositionInfo(SourcePositionInfo that)
- {
- this.file = that.file;
- this.line = that.line;
- this.column = that.column;
- }
-
- /**
- * Given this position and str which occurs at that position, as well as str an index into str,
- * find the SourcePositionInfo.
- *
- * @throw StringIndexOutOfBoundsException if index > str.length()
- */
- public static SourcePositionInfo add(SourcePositionInfo that, String str, int index)
- {
- if (that == null) {
- return null;
- }
- int line = that.line;
- char prev = 0;
- for (int i=0; i<index; i++) {
- char c = str.charAt(i);
- if (c == '\r' || (c == '\n' && prev != '\r')) {
- line++;
- }
- prev = c;
- }
- return new SourcePositionInfo(that.file, line, 0);
- }
-
- public static SourcePositionInfo findBeginning(SourcePositionInfo that, String str)
- {
- if (that == null) {
- return null;
- }
- int line = that.line-1; // -1 because, well, it seems to work
- int prev = 0;
- for (int i=str.length()-1; i>=0; i--) {
- char c = str.charAt(i);
- if ((c == '\r' && prev != '\n') || (c == '\n')) {
- line--;
- }
- prev = c;
- }
- return new SourcePositionInfo(that.file, line, 0);
- }
-
- @Override
- public String toString()
- {
- return file + ':' + line;
- }
-
- public int compareTo(Object o) {
- SourcePositionInfo that = (SourcePositionInfo)o;
- int r = this.file.compareTo(that.file);
- if (r != 0) return r;
- return this.line - that.line;
- }
-
- public String file;
- public int line;
- public int column;
-}
diff --git a/tools/droiddoc/src/Stubs.java b/tools/droiddoc/src/Stubs.java
deleted file mode 100644
index b988ef5..0000000
--- a/tools/droiddoc/src/Stubs.java
+++ /dev/null
@@ -1,999 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.Comparator;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.PrintStream;
-
-public class Stubs {
- private static HashSet<ClassInfo> notStrippable;
- public static void writeStubs(String stubsDir, Boolean writeXML, String xmlFile,
- HashSet<String> stubPackages) {
- // figure out which classes we need
- notStrippable = new HashSet();
- ClassInfo[] all = Converter.allClasses();
- File xml = new File(xmlFile);
- xml.getParentFile().mkdirs();
- PrintStream xmlWriter = null;
- if (writeXML) {
- try {
- xmlWriter = new PrintStream(xml);
- } catch (FileNotFoundException e) {
- Errors.error(Errors.IO_ERROR, new SourcePositionInfo(xmlFile, 0, 0),
- "Cannot open file for write.");
- }
- }
- // If a class is public or protected, not hidden, and marked as included,
- // then we can't strip it
- for (ClassInfo cl: all) {
- if (cl.checkLevel() && cl.isIncluded()) {
- cantStripThis(cl, notStrippable, "0:0");
- }
- }
-
- // complain about anything that looks includeable but is not supposed to
- // be written, e.g. hidden things
- for (ClassInfo cl: notStrippable) {
- if (!cl.isHidden()) {
- MethodInfo[] methods = cl.selfMethods();
- for (MethodInfo m: methods) {
- if (m.isHidden()) {
- Errors.error(Errors.UNAVAILABLE_SYMBOL,
- m.position(), "Reference to hidden method "
- + m.name());
- } else if (m.isDeprecated()) {
- // don't bother reporting deprecated methods
- // unless they are public
- Errors.error(Errors.DEPRECATED,
- m.position(), "Method "
- + cl.qualifiedName() + "." + m.name()
- + " is deprecated");
- }
-
- ClassInfo returnClass = m.returnType().asClassInfo();
- if (returnClass != null && returnClass.isHidden()) {
- Errors.error(Errors.UNAVAILABLE_SYMBOL, m.position(),
- "Method " + cl.qualifiedName() + "." + m.name()
- + " returns unavailable type " + returnClass.name());
- }
-
- ParameterInfo[] params = m.parameters();
- for (ParameterInfo p: params) {
- TypeInfo t = p.type();
- if (!t.isPrimitive()) {
- if (t.asClassInfo().isHidden()) {
- Errors.error(Errors.UNAVAILABLE_SYMBOL,
- m.position(), "Parameter of hidden type "
- + t.fullName() + " in "
- + cl.qualifiedName() + "." + m.name() + "()");
- }
- }
- }
- }
-
- // annotations are handled like methods
- methods = cl.annotationElements();
- for (MethodInfo m: methods) {
- if (m.isHidden()) {
- Errors.error(Errors.UNAVAILABLE_SYMBOL,
- m.position(), "Reference to hidden annotation "
- + m.name());
- }
-
- ClassInfo returnClass = m.returnType().asClassInfo();
- if (returnClass != null && returnClass.isHidden()) {
- Errors.error(Errors.UNAVAILABLE_SYMBOL,
- m.position(), "Annotation '" + m.name()
- + "' returns unavailable type " + returnClass.name());
- }
-
- ParameterInfo[] params = m.parameters();
- for (ParameterInfo p: params) {
- TypeInfo t = p.type();
- if (!t.isPrimitive()) {
- if (t.asClassInfo().isHidden()) {
- Errors.error(Errors.UNAVAILABLE_SYMBOL,
- p.position(), "Reference to unavailable annotation class "
- + t.fullName());
- }
- }
- }
- }
- } else if (cl.isDeprecated()) {
- // not hidden, but deprecated
- Errors.error(Errors.DEPRECATED,
- cl.position(), "Class " + cl.qualifiedName()
- + " is deprecated");
- }
- }
-
- // write out the stubs
- HashMap<PackageInfo, List<ClassInfo>> packages = new HashMap<PackageInfo, List<ClassInfo>>();
- for (ClassInfo cl: notStrippable) {
- if (!cl.isDocOnly()) {
- if (stubPackages == null || stubPackages.contains(cl.containingPackage().name())) {
- writeClassFile(stubsDir, cl);
- if (packages.containsKey(cl.containingPackage())) {
- packages.get(cl.containingPackage()).add(cl);
- } else {
- ArrayList<ClassInfo> classes = new ArrayList<ClassInfo>();
- classes.add(cl);
- packages.put(cl.containingPackage(), classes);
- }
- }
- }
- }
-
- // write out the XML
- if (writeXML && xmlWriter != null) {
- writeXML(xmlWriter, packages, notStrippable);
- }
-
- if (xmlWriter != null) {
- xmlWriter.close();
- }
-
- }
-
- public static void cantStripThis(ClassInfo cl, HashSet<ClassInfo> notStrippable, String why) {
-
- if (!notStrippable.add(cl)) {
- // slight optimization: if it already contains cl, it already contains
- // all of cl's parents
- return;
- }
- cl.setReasonIncluded(why);
-
- // cant strip annotations
- /*if (cl.annotations() != null){
- for (AnnotationInstanceInfo ai : cl.annotations()){
- if (ai.type() != null){
- cantStripThis(ai.type(), notStrippable, "1:" + cl.qualifiedName());
- }
- }
- }*/
- // cant strip any public fields or their generics
- if (cl.allSelfFields() != null){
- for (FieldInfo fInfo : cl.allSelfFields()){
- if (fInfo.type() != null){
- if (fInfo.type().asClassInfo() != null){
- cantStripThis(fInfo.type().asClassInfo(), notStrippable,
- "2:" + cl.qualifiedName());
- }
- if (fInfo.type().typeArguments() != null){
- for (TypeInfo tTypeInfo : fInfo.type().typeArguments()){
- if (tTypeInfo.asClassInfo() != null){
- cantStripThis(tTypeInfo.asClassInfo(), notStrippable,
- "3:" + cl.qualifiedName());
- }
- }
- }
- }
- }
- }
- //cant strip any of the type's generics
- if (cl.asTypeInfo() != null){
- if (cl.asTypeInfo().typeArguments() != null){
- for (TypeInfo tInfo : cl.asTypeInfo().typeArguments()){
- if (tInfo.asClassInfo() != null){
- cantStripThis(tInfo.asClassInfo(), notStrippable, "4:" + cl.qualifiedName());
- }
- }
- }
- }
- //cant strip any of the annotation elements
- //cantStripThis(cl.annotationElements(), notStrippable);
- // take care of methods
- cantStripThis(cl.allSelfMethods(), notStrippable);
- cantStripThis(cl.allConstructors(), notStrippable);
- // blow the outer class open if this is an inner class
- if(cl.containingClass() != null){
- cantStripThis(cl.containingClass(), notStrippable, "5:" + cl.qualifiedName());
- }
- // blow open super class and interfaces
- ClassInfo supr = cl.realSuperclass();
- if (supr != null) {
- if (supr.isHidden()) {
- // cl is a public class declared as extending a hidden superclass.
- // this is not a desired practice but it's happened, so we deal
- // with it by stripping off the superclass relation for purposes of
- // generating the doc & stub information, and proceeding normally.
- cl.init(cl.asTypeInfo(), cl.realInterfaces(), cl.realInterfaceTypes(),
- cl.innerClasses(), cl.allConstructors(), cl.allSelfMethods(),
- cl.annotationElements(), cl.allSelfFields(), cl.enumConstants(),
- cl.containingPackage(), cl.containingClass(),
- null, null, cl.annotations());
- Errors.error(Errors.HIDDEN_SUPERCLASS,
- cl.position(), "Public class " + cl.qualifiedName()
- + " stripped of unavailable superclass "
- + supr.qualifiedName());
- } else {
- cantStripThis(supr, notStrippable, "6:" + cl.realSuperclass().name()
- + cl.qualifiedName());
- }
- }
- }
-
- private static void cantStripThis(MethodInfo[] mInfos , HashSet<ClassInfo> notStrippable) {
- //for each method, blow open the parameters, throws and return types. also blow open their generics
- if (mInfos != null){
- for (MethodInfo mInfo : mInfos){
- if (mInfo.getTypeParameters() != null){
- for (TypeInfo tInfo : mInfo.getTypeParameters()){
- if (tInfo.asClassInfo() != null){
- cantStripThis(tInfo.asClassInfo(), notStrippable, "8:" +
- mInfo.realContainingClass().qualifiedName() + ":" +
- mInfo.name());
- }
- }
- }
- if (mInfo.parameters() != null){
- for (ParameterInfo pInfo : mInfo.parameters()){
- if (pInfo.type() != null && pInfo.type().asClassInfo() != null){
- cantStripThis(pInfo.type().asClassInfo(), notStrippable,
- "9:"+ mInfo.realContainingClass().qualifiedName()
- + ":" + mInfo.name());
- if (pInfo.type().typeArguments() != null){
- for (TypeInfo tInfoType : pInfo.type().typeArguments()){
- if (tInfoType.asClassInfo() != null){
- ClassInfo tcl = tInfoType.asClassInfo();
- if (tcl.isHidden()) {
- Errors.error(Errors.UNAVAILABLE_SYMBOL, mInfo.position(),
- "Parameter of hidden type "
- + tInfoType.fullName() + " in "
- + mInfo.containingClass().qualifiedName()
- + '.' + mInfo.name() + "()");
- } else {
- cantStripThis(tcl, notStrippable,
- "10:" +
- mInfo.realContainingClass().qualifiedName() + ":" +
- mInfo.name());
- }
- }
- }
- }
- }
- }
- }
- for (ClassInfo thrown : mInfo.thrownExceptions()){
- cantStripThis(thrown, notStrippable, "11:" +
- mInfo.realContainingClass().qualifiedName()
- +":" + mInfo.name());
- }
- if (mInfo.returnType() != null && mInfo.returnType().asClassInfo() != null){
- cantStripThis(mInfo.returnType().asClassInfo(), notStrippable,
- "12:" + mInfo.realContainingClass().qualifiedName() +
- ":" + mInfo.name());
- if (mInfo.returnType().typeArguments() != null){
- for (TypeInfo tyInfo: mInfo.returnType().typeArguments() ){
- if (tyInfo.asClassInfo() != null){
- cantStripThis(tyInfo.asClassInfo(), notStrippable,
- "13:" +
- mInfo.realContainingClass().qualifiedName()
- + ":" + mInfo.name());
- }
- }
- }
- }
- }
- }
- }
-
- static String javaFileName(ClassInfo cl) {
- String dir = "";
- PackageInfo pkg = cl.containingPackage();
- if (pkg != null) {
- dir = pkg.name();
- dir = dir.replace('.', '/') + '/';
- }
- return dir + cl.name() + ".java";
- }
-
- static void writeClassFile(String stubsDir, ClassInfo cl) {
- // inner classes are written by their containing class
- if (cl.containingClass() != null) {
- return;
- }
-
- // Work around the bogus "Array" class we invent for
- // Arrays.copyOf's Class<? extends T[]> newType parameter. (http://b/2715505)
- if (cl.containingPackage() != null && cl.containingPackage().name().equals("")) {
- return;
- }
-
- String filename = stubsDir + '/' + javaFileName(cl);
- File file = new File(filename);
- ClearPage.ensureDirectory(file);
-
- PrintStream stream = null;
- try {
- stream = new PrintStream(file);
- writeClassFile(stream, cl);
- }
- catch (FileNotFoundException e) {
- System.err.println("error writing file: " + filename);
- }
- finally {
- if (stream != null) {
- stream.close();
- }
- }
- }
-
- static void writeClassFile(PrintStream stream, ClassInfo cl) {
- PackageInfo pkg = cl.containingPackage();
- if (pkg != null) {
- stream.println("package " + pkg.name() + ";");
- }
- writeClass(stream, cl);
- }
-
- static void writeClass(PrintStream stream, ClassInfo cl) {
- writeAnnotations(stream, cl.annotations());
-
- stream.print(DroidDoc.scope(cl) + " ");
- if (cl.isAbstract() && !cl.isAnnotation() && !cl.isInterface()) {
- stream.print("abstract ");
- }
- if (cl.isStatic()){
- stream.print("static ");
- }
- if (cl.isFinal() && !cl.isEnum()) {
- stream.print("final ");
- }
- if (false) {
- stream.print("strictfp ");
- }
-
- HashSet<String> classDeclTypeVars = new HashSet();
- String leafName = cl.asTypeInfo().fullName(classDeclTypeVars);
- int bracket = leafName.indexOf('<');
- if (bracket < 0) bracket = leafName.length() - 1;
- int period = leafName.lastIndexOf('.', bracket);
- if (period < 0) period = -1;
- leafName = leafName.substring(period+1);
-
- String kind = cl.kind();
- stream.println(kind + " " + leafName);
-
- TypeInfo base = cl.superclassType();
-
- if (!"enum".equals(kind)) {
- if (base != null && !"java.lang.Object".equals(base.qualifiedTypeName())) {
- stream.println(" extends " + base.fullName(classDeclTypeVars));
- }
- }
-
- TypeInfo[] interfaces = cl.realInterfaceTypes();
- List<TypeInfo> usedInterfaces = new ArrayList<TypeInfo>();
- for (TypeInfo iface : interfaces) {
- if (notStrippable.contains(iface.asClassInfo())
- && !iface.asClassInfo().isDocOnly()) {
- usedInterfaces.add(iface);
- }
- }
- if (usedInterfaces.size() > 0 && !cl.isAnnotation()) {
- // can java annotations extend other ones?
- if (cl.isInterface() || cl.isAnnotation()) {
- stream.print(" extends ");
- } else {
- stream.print(" implements ");
- }
- String comma = "";
- for (TypeInfo iface: usedInterfaces) {
- stream.print(comma + iface.fullName(classDeclTypeVars));
- comma = ", ";
- }
- stream.println();
- }
-
- stream.println("{");
-
- FieldInfo[] enumConstants = cl.enumConstants();
- int N = enumConstants.length;
- for (int i=0; i<N; i++) {
- FieldInfo field = enumConstants[i];
- if (!field.constantLiteralValue().equals("null")){
- stream.println(field.name() + "(" + field.constantLiteralValue()
- + (i==N-1 ? ");" : "),"));
- }else{
- stream.println(field.name() + "(" + (i==N-1 ? ");" : "),"));
- }
- }
-
- for (ClassInfo inner: cl.getRealInnerClasses()) {
- if (notStrippable.contains(inner)
- && !inner.isDocOnly()){
- writeClass(stream, inner);
- }
- }
-
-
- for (MethodInfo method: cl.constructors()) {
- if (!method.isDocOnly()) {
- writeMethod(stream, method, true);
- }
- }
-
- boolean fieldNeedsInitialization = false;
- boolean staticFieldNeedsInitialization = false;
- for (FieldInfo field: cl.allSelfFields()) {
- if (!field.isDocOnly()) {
- if (!field.isStatic() && field.isFinal() && !fieldIsInitialized(field)) {
- fieldNeedsInitialization = true;
- }
- if (field.isStatic() && field.isFinal() && !fieldIsInitialized(field)) {
- staticFieldNeedsInitialization = true;
- }
- }
- }
-
- // The compiler includes a default public constructor that calls the super classes
- // default constructor in the case where there are no written constructors.
- // So, if we hide all the constructors, java may put in a constructor
- // that calls a nonexistent super class constructor. So, if there are no constructors,
- // and the super class doesn't have a default constructor, write in a private constructor
- // that works. TODO -- we generate this as protected, but we really should generate
- // it as private unless it also exists in the real code.
- if ((cl.constructors().length == 0 && (cl.getNonWrittenConstructors().length != 0
- || fieldNeedsInitialization))
- && !cl.isAnnotation()
- && !cl.isInterface()
- && !cl.isEnum() ) {
- //Errors.error(Errors.HIDDEN_CONSTRUCTOR,
- // cl.position(), "No constructors " +
- // "found and superclass has no parameterless constructor. A constructor " +
- // "that calls an appropriate superclass constructor " +
- // "was automatically written to stubs.\n");
- stream.println(cl.leafName()
- + "() { " + superCtorCall(cl,null)
- + "throw new" + " RuntimeException(\"Stub!\"); }");
- }
-
- for (MethodInfo method: cl.allSelfMethods()) {
- if (cl.isEnum()) {
- if (("values".equals(method.name())
- && "()".equals(method.signature()))
- || ("valueOf".equals(method.name())
- && "(java.lang.String)".equals(method.signature()))) {
- // skip these two methods on enums, because they're synthetic,
- // although for some reason javadoc doesn't mark them as synthetic,
- // maybe because they still want them documented
- continue;
- }
- }
- if (!method.isDocOnly()) {
- writeMethod(stream, method, false);
- }
- }
- //Write all methods that are hidden, but override abstract methods or interface methods.
- //These can't be hidden.
- for (MethodInfo method : cl.getHiddenMethods()){
- MethodInfo overriddenMethod = method.findRealOverriddenMethod(method.name(), method.signature(), notStrippable);
- ClassInfo classContainingMethod = method.findRealOverriddenClass(method.name(),
- method.signature());
- if (overriddenMethod != null && !overriddenMethod.isHidden()
- && !overriddenMethod.isDocOnly() &&
- (overriddenMethod.isAbstract() ||
- overriddenMethod.containingClass().isInterface())) {
- method.setReason("1:" + classContainingMethod.qualifiedName());
- cl.addMethod(method);
- writeMethod(stream, method, false);
- }
- }
-
- for (MethodInfo element: cl.annotationElements()) {
- if (!element.isDocOnly()) {
- writeAnnotationElement(stream, element);
- }
- }
-
- for (FieldInfo field: cl.allSelfFields()) {
- if (!field.isDocOnly()) {
- writeField(stream, field);
- }
- }
-
- if (staticFieldNeedsInitialization) {
- stream.print("static { ");
- for (FieldInfo field: cl.allSelfFields()) {
- if (!field.isDocOnly() && field.isStatic() && field.isFinal()
- && !fieldIsInitialized(field) && field.constantValue() == null) {
- stream.print(field.name() + " = " + field.type().defaultValue()
- + "; ");
- }
- }
- stream.println("}");
- }
-
- stream.println("}");
- }
-
-
- static void writeMethod(PrintStream stream, MethodInfo method, boolean isConstructor) {
- String comma;
-
- stream.print(DroidDoc.scope(method) + " ");
- if (method.isStatic()) {
- stream.print("static ");
- }
- if (method.isFinal()) {
- stream.print("final ");
- }
- if (method.isAbstract()) {
- stream.print("abstract ");
- }
- if (method.isSynchronized()) {
- stream.print("synchronized ");
- }
- if (method.isNative()) {
- stream.print("native ");
- }
- if (false /*method.isStictFP()*/) {
- stream.print("strictfp ");
- }
-
- stream.print(method.typeArgumentsName(new HashSet()) + " ");
-
- if (!isConstructor) {
- stream.print(method.returnType().fullName(method.typeVariables()) + " ");
- }
- String n = method.name();
- int pos = n.lastIndexOf('.');
- if (pos >= 0) {
- n = n.substring(pos + 1);
- }
- stream.print(n + "(");
- comma = "";
- int count = 1;
- int size = method.parameters().length;
- for (ParameterInfo param: method.parameters()) {
- stream.print(comma + fullParameterTypeName(method, param.type(), count == size)
- + " " + param.name());
- comma = ", ";
- count++;
- }
- stream.print(")");
-
- comma = "";
- if (method.thrownExceptions().length > 0) {
- stream.print(" throws ");
- for (ClassInfo thrown: method.thrownExceptions()) {
- stream.print(comma + thrown.qualifiedName());
- comma = ", ";
- }
- }
- if (method.isAbstract() || method.isNative() || method.containingClass().isInterface()) {
- stream.println(";");
- } else {
- stream.print(" { ");
- if (isConstructor) {
- stream.print(superCtorCall(method.containingClass(), method.thrownExceptions()));
- }
- stream.println("throw new RuntimeException(\"Stub!\"); }");
- }
- }
-
- static void writeField(PrintStream stream, FieldInfo field) {
- stream.print(DroidDoc.scope(field) + " ");
- if (field.isStatic()) {
- stream.print("static ");
- }
- if (field.isFinal()) {
- stream.print("final ");
- }
- if (field.isTransient()) {
- stream.print("transient ");
- }
- if (field.isVolatile()) {
- stream.print("volatile ");
- }
-
- stream.print(field.type().fullName());
- stream.print(" ");
- stream.print(field.name());
-
- if (fieldIsInitialized(field)) {
- stream.print(" = " + field.constantLiteralValue());
- }
-
- stream.println(";");
- }
-
- static boolean fieldIsInitialized(FieldInfo field) {
- return (field.isFinal() && field.constantValue() != null)
- || !field.type().dimension().equals("")
- || field.containingClass().isInterface();
- }
-
- // Returns 'true' if the method is an @Override of a visible parent
- // method implementation, and thus does not affect the API.
- static boolean methodIsOverride(MethodInfo mi) {
- // Abstract/static/final methods are always listed in the API description
- if (mi.isAbstract() || mi.isStatic() || mi.isFinal()) {
- return false;
- }
-
- // Find any relevant ancestor declaration and inspect it
- MethodInfo om = mi.findSuperclassImplementation(notStrippable);
- if (om != null) {
- // Visibility mismatch is an API change, so check for it
- if (mi.mIsPrivate == om.mIsPrivate
- && mi.mIsPublic == om.mIsPublic
- && mi.mIsProtected == om.mIsProtected) {
- // Look only for overrides of an ancestor class implementation,
- // not of e.g. an abstract or interface method declaration
- if (!om.isAbstract()) {
- // If the parent is hidden, we can't rely on it to provide
- // the API
- if (!om.isHidden()) {
- // If the only "override" turns out to be in our own class
- // (which sometimes happens in concrete subclasses of
- // abstract base classes), it's not really an override
- if (!mi.mContainingClass.equals(om.mContainingClass)) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- static boolean canCallMethod(ClassInfo from, MethodInfo m) {
- if (m.isPublic() || m.isProtected()) {
- return true;
- }
- if (m.isPackagePrivate()) {
- String fromPkg = from.containingPackage().name();
- String pkg = m.containingClass().containingPackage().name();
- if (fromPkg.equals(pkg)) {
- return true;
- }
- }
- return false;
- }
-
- // call a constructor, any constructor on this class's superclass.
- static String superCtorCall(ClassInfo cl, ClassInfo[] thrownExceptions) {
- ClassInfo base = cl.realSuperclass();
- if (base == null) {
- return "";
- }
- HashSet<String> exceptionNames = new HashSet<String>();
- if (thrownExceptions != null ){
- for (ClassInfo thrown : thrownExceptions){
- exceptionNames.add(thrown.name());
- }
- }
- MethodInfo[] ctors = base.constructors();
- MethodInfo ctor = null;
- //bad exception indicates that the exceptions thrown by the super constructor
- //are incompatible with the constructor we're using for the sub class.
- Boolean badException = false;
- for (MethodInfo m: ctors) {
- if (canCallMethod(cl, m)) {
- if (m.thrownExceptions() != null){
- for (ClassInfo thrown : m.thrownExceptions()){
- if (!exceptionNames.contains(thrown.name())){
- badException = true;
- }
- }
- }
- if (badException){
- badException = false;
- continue;
- }
- // if it has no args, we're done
- if (m.parameters().length == 0) {
- return "";
- }
- ctor = m;
- }
- }
- if (ctor != null) {
- String result = "";
- result+= "super(";
- ParameterInfo[] params = ctor.parameters();
- int N = params.length;
- for (int i=0; i<N; i++) {
- TypeInfo t = params[i].type();
- if (t.isPrimitive() && t.dimension().equals("")) {
- String n = t.simpleTypeName();
- if (("byte".equals(n)
- || "short".equals(n)
- || "int".equals(n)
- || "long".equals(n)
- || "float".equals(n)
- || "double".equals(n)) && t.dimension().equals("")) {
- result += "0";
- }
- else if ("char".equals(n)) {
- result += "'\\0'";
- }
- else if ("boolean".equals(n)) {
- result += "false";
- }
- else {
- result += "<<unknown-" + n + ">>";
- }
- } else {
- //put null in each super class method. Cast null to the correct type
- //to avoid collisions with other constructors. If the type is generic
- //don't cast it
- result += (!t.isTypeVariable() ? "(" + t.qualifiedTypeName() + t.dimension() +
- ")" : "") + "null";
- }
- if (i != N-1) {
- result += ",";
- }
- }
- result += "); ";
- return result;
- } else {
- return "";
- }
- }
-
- static void writeAnnotations(PrintStream stream, AnnotationInstanceInfo[] annotations) {
- for (AnnotationInstanceInfo ann: annotations) {
- if (!ann.type().isHidden()) {
- stream.println(ann.toString());
- }
- }
- }
-
- static void writeAnnotationElement(PrintStream stream, MethodInfo ann) {
- stream.print(ann.returnType().fullName());
- stream.print(" ");
- stream.print(ann.name());
- stream.print("()");
- AnnotationValueInfo def = ann.defaultAnnotationElementValue();
- if (def != null) {
- stream.print(" default ");
- stream.print(def.valueString());
- }
- stream.println(";");
- }
-
- static void writeXML(PrintStream xmlWriter, HashMap<PackageInfo, List<ClassInfo>> allClasses,
- HashSet notStrippable) {
- // extract the set of packages, sort them by name, and write them out in that order
- Set<PackageInfo> allClassKeys = allClasses.keySet();
- PackageInfo[] allPackages = allClassKeys.toArray(new PackageInfo[allClassKeys.size()]);
- Arrays.sort(allPackages, PackageInfo.comparator);
-
- xmlWriter.println("<api>");
- for (PackageInfo pack : allPackages) {
- writePackageXML(xmlWriter, pack, allClasses.get(pack), notStrippable);
- }
- xmlWriter.println("</api>");
- }
-
- static void writePackageXML(PrintStream xmlWriter, PackageInfo pack, List<ClassInfo> classList,
- HashSet notStrippable) {
- ClassInfo[] classes = classList.toArray(new ClassInfo[classList.size()]);
- Arrays.sort(classes, ClassInfo.comparator);
- // Work around the bogus "Array" class we invent for
- // Arrays.copyOf's Class<? extends T[]> newType parameter. (http://b/2715505)
- if (pack.name().equals("")) {
- return;
- }
- xmlWriter.println("<package name=\"" + pack.name() + "\"\n"
- //+ " source=\"" + pack.position() + "\"\n"
- + ">");
- for (ClassInfo cl : classes) {
- writeClassXML(xmlWriter, cl, notStrippable);
- }
- xmlWriter.println("</package>");
-
-
- }
-
- static void writeClassXML(PrintStream xmlWriter, ClassInfo cl, HashSet notStrippable) {
- String scope = DroidDoc.scope(cl);
- String deprecatedString = "";
- String declString = (cl.isInterface()) ? "interface" : "class";
- if (cl.isDeprecated()) {
- deprecatedString = "deprecated";
- } else {
- deprecatedString = "not deprecated";
- }
- xmlWriter.println("<" + declString + " name=\"" + cl.name() + "\"");
- if (!cl.isInterface() && !cl.qualifiedName().equals("java.lang.Object")) {
- xmlWriter.println(" extends=\"" + ((cl.realSuperclass() == null)
- ? "java.lang.Object"
- : cl.realSuperclass().qualifiedName()) + "\"");
- }
- xmlWriter.println(" abstract=\"" + cl.isAbstract() + "\"\n"
- + " static=\"" + cl.isStatic() + "\"\n"
- + " final=\"" + cl.isFinal() + "\"\n"
- + " deprecated=\"" + deprecatedString + "\"\n"
- + " visibility=\"" + scope + "\"\n"
- //+ " source=\"" + cl.position() + "\"\n"
- + ">");
-
- ClassInfo[] interfaces = cl.realInterfaces();
- Arrays.sort(interfaces, ClassInfo.comparator);
- for (ClassInfo iface : interfaces) {
- if (notStrippable.contains(iface)) {
- xmlWriter.println("<implements name=\"" + iface.qualifiedName() + "\">");
- xmlWriter.println("</implements>");
- }
- }
-
- MethodInfo[] constructors = cl.constructors();
- Arrays.sort(constructors, MethodInfo.comparator);
- for (MethodInfo mi : constructors) {
- writeConstructorXML(xmlWriter, mi);
- }
-
- MethodInfo[] methods = cl.allSelfMethods();
- Arrays.sort(methods, MethodInfo.comparator);
- for (MethodInfo mi : methods) {
- if (!methodIsOverride(mi)) {
- writeMethodXML(xmlWriter, mi);
- }
- }
-
- FieldInfo[] fields = cl.allSelfFields();
- Arrays.sort(fields, FieldInfo.comparator);
- for (FieldInfo fi : fields) {
- writeFieldXML(xmlWriter, fi);
- }
- xmlWriter.println("</" + declString + ">");
-
- }
-
- static void writeMethodXML(PrintStream xmlWriter, MethodInfo mi) {
- String scope = DroidDoc.scope(mi);
-
- String deprecatedString = "";
- if (mi.isDeprecated()) {
- deprecatedString = "deprecated";
- } else {
- deprecatedString = "not deprecated";
- }
- xmlWriter.println("<method name=\"" + mi.name() + "\"\n"
- + ((mi.returnType() != null)
- ? " return=\"" + makeXMLcompliant(fullParameterTypeName(mi, mi.returnType(), false)) + "\"\n"
- : "")
- + " abstract=\"" + mi.isAbstract() + "\"\n"
- + " native=\"" + mi.isNative() + "\"\n"
- + " synchronized=\"" + mi.isSynchronized() + "\"\n"
- + " static=\"" + mi.isStatic() + "\"\n"
- + " final=\"" + mi.isFinal() + "\"\n"
- + " deprecated=\""+ deprecatedString + "\"\n"
- + " visibility=\"" + scope + "\"\n"
- //+ " source=\"" + mi.position() + "\"\n"
- + ">");
-
- // write parameters in declaration order
- int numParameters = mi.parameters().length;
- int count = 0;
- for (ParameterInfo pi : mi.parameters()) {
- count++;
- writeParameterXML(xmlWriter, mi, pi, count == numParameters);
- }
-
- // but write exceptions in canonicalized order
- ClassInfo[] exceptions = mi.thrownExceptions();
- Arrays.sort(exceptions, ClassInfo.comparator);
- for (ClassInfo pi : exceptions) {
- xmlWriter.println("<exception name=\"" + pi.name() +"\" type=\"" + pi.qualifiedName()
- + "\">");
- xmlWriter.println("</exception>");
- }
- xmlWriter.println("</method>");
- }
-
- static void writeConstructorXML(PrintStream xmlWriter, MethodInfo mi) {
- String scope = DroidDoc.scope(mi);
- String deprecatedString = "";
- if (mi.isDeprecated()) {
- deprecatedString = "deprecated";
- } else {
- deprecatedString = "not deprecated";
- }
- xmlWriter.println("<constructor name=\"" + mi.name() + "\"\n"
- + " type=\"" + mi.containingClass().qualifiedName() + "\"\n"
- + " static=\"" + mi.isStatic() + "\"\n"
- + " final=\"" + mi.isFinal() + "\"\n"
- + " deprecated=\"" + deprecatedString + "\"\n"
- + " visibility=\"" + scope +"\"\n"
- //+ " source=\"" + mi.position() + "\"\n"
- + ">");
-
- int numParameters = mi.parameters().length;
- int count = 0;
- for (ParameterInfo pi : mi.parameters()) {
- count++;
- writeParameterXML(xmlWriter, mi, pi, count == numParameters);
- }
-
- ClassInfo[] exceptions = mi.thrownExceptions();
- Arrays.sort(exceptions, ClassInfo.comparator);
- for (ClassInfo pi : exceptions) {
- xmlWriter.println("<exception name=\"" + pi.name() +"\" type=\"" + pi.qualifiedName()
- + "\">");
- xmlWriter.println("</exception>");
- }
- xmlWriter.println("</constructor>");
- }
-
- static void writeParameterXML(PrintStream xmlWriter, MethodInfo method,
- ParameterInfo pi, boolean isLast) {
- xmlWriter.println("<parameter name=\"" + pi.name() + "\" type=\"" +
- makeXMLcompliant(fullParameterTypeName(method, pi.type(), isLast)) + "\">");
- xmlWriter.println("</parameter>");
- }
-
- static void writeFieldXML(PrintStream xmlWriter, FieldInfo fi) {
- String scope = DroidDoc.scope(fi);
- String deprecatedString = "";
- if (fi.isDeprecated()) {
- deprecatedString = "deprecated";
- } else {
- deprecatedString = "not deprecated";
- }
- //need to make sure value is valid XML
- String value = makeXMLcompliant(fi.constantLiteralValue());
-
- String fullTypeName = makeXMLcompliant(fi.type().qualifiedTypeName())
- + fi.type().dimension();
-
- xmlWriter.println("<field name=\"" + fi.name() +"\"\n"
- + " type=\"" + fullTypeName + "\"\n"
- + " transient=\"" + fi.isTransient() + "\"\n"
- + " volatile=\"" + fi.isVolatile() + "\"\n"
- + (fieldIsInitialized(fi) ? " value=\"" + value + "\"\n" : "")
- + " static=\"" + fi.isStatic() + "\"\n"
- + " final=\"" + fi.isFinal() + "\"\n"
- + " deprecated=\"" + deprecatedString + "\"\n"
- + " visibility=\"" + scope + "\"\n"
- //+ " source=\"" + fi.position() + "\"\n"
- + ">");
- xmlWriter.println("</field>");
- }
-
- static String makeXMLcompliant(String s) {
- String returnString = "";
- returnString = s.replaceAll("&", "&");
- returnString = returnString.replaceAll("<", "<");
- returnString = returnString.replaceAll(">", ">");
- returnString = returnString.replaceAll("\"", """);
- returnString = returnString.replaceAll("'", "&pos;");
- return returnString;
- }
-
- static String fullParameterTypeName(MethodInfo method, TypeInfo type, boolean isLast) {
- String fullTypeName = type.fullName(method.typeVariables());
- if (isLast && method.isVarArgs()) {
- // TODO: note that this does not attempt to handle hypothetical
- // vararg methods whose last parameter is a list of arrays, e.g.
- // "Object[]...".
- fullTypeName = type.fullNameNoDimension(method.typeVariables()) + "...";
- }
- return fullTypeName;
- }
-}
diff --git a/tools/droiddoc/src/TagInfo.java b/tools/droiddoc/src/TagInfo.java
deleted file mode 100644
index d25c500..0000000
--- a/tools/droiddoc/src/TagInfo.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-
-public class TagInfo
-{
- private String mName;
- private String mText;
- private String mKind;
- private SourcePositionInfo mPosition;
-
- TagInfo(String n, String k, String t, SourcePositionInfo sp)
- {
- mName = n;
- mText = t;
- mKind = k;
- mPosition = sp;
- }
-
- String name()
- {
- return mName;
- }
-
- String text()
- {
- return mText;
- }
-
- String kind()
- {
- return mKind;
- }
-
- SourcePositionInfo position() {
- return mPosition;
- }
-
- void setKind(String kind) {
- mKind = kind;
- }
-
- public void makeHDF(HDF data, String base)
- {
- data.setValue(base + ".name", name());
- data.setValue(base + ".text", text());
- data.setValue(base + ".kind", kind());
- }
-
- public static void makeHDF(HDF data, String base, TagInfo[] tags)
- {
- makeHDF(data, base, tags, null, 0, 0);
- }
-
- public static void makeHDF(HDF data, String base, InheritedTags tags)
- {
- makeHDF(data, base, tags.tags(), tags.inherited(), 0, 0);
- }
-
- private static int makeHDF(HDF data, String base, TagInfo[] tags,
- InheritedTags inherited, int j, int depth)
- {
- int i;
- int len = tags.length;
- if (len == 0 && inherited != null) {
- j = makeHDF(data, base, inherited.tags(), inherited.inherited(), j, depth+1);
- } else {
- for (i=0; i<len; i++, j++) {
- TagInfo t = tags[i];
- if (inherited != null && t.name().equals("@inheritDoc")) {
- j = makeHDF(data, base, inherited.tags(),
- inherited.inherited(), j, depth+1);
- } else {
- if (t.name().equals("@inheritDoc")) {
- Errors.error(Errors.BAD_INHERITDOC, t.mPosition,
- "@inheritDoc on class/method that is not inherited");
- }
- t.makeHDF(data, base + "." + j);
- }
- }
- }
- return j;
- }
-}
-
diff --git a/tools/droiddoc/src/TextTagInfo.java b/tools/droiddoc/src/TextTagInfo.java
deleted file mode 100644
index dcdfdd9..0000000
--- a/tools/droiddoc/src/TextTagInfo.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class TextTagInfo extends TagInfo {
- TextTagInfo(String n, String k, String t, SourcePositionInfo p) {
- super(n, k, DroidDoc.escape(t), p);
- }
-}
diff --git a/tools/droiddoc/src/ThrowsTagInfo.java b/tools/droiddoc/src/ThrowsTagInfo.java
deleted file mode 100644
index 318a57d..0000000
--- a/tools/droiddoc/src/ThrowsTagInfo.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-public class ThrowsTagInfo extends ParsedTagInfo
-{
- static final Pattern PATTERN = Pattern.compile(
- "(\\S+)\\s+(.*)",
- Pattern.DOTALL);
- private ClassInfo mException;
-
- public ThrowsTagInfo(String name, String kind, String text,
- ContainerInfo base, SourcePositionInfo sp)
- {
- super(name, kind, text, base, sp);
-
- Matcher m = PATTERN.matcher(text);
- if (m.matches()) {
- setCommentText(m.group(2));
- String className = m.group(1);
- if (base instanceof ClassInfo) {
- mException = ((ClassInfo)base).findClass(className);
- }
- if (mException == null) {
- mException = Converter.obtainClass(className);
- }
- }
- }
-
- public ThrowsTagInfo(String name, String kind, String text,
- ClassInfo exception, String exceptionComment,
- ContainerInfo base, SourcePositionInfo sp)
- {
- super(name, kind, text, base, sp);
- mException = exception;
- setCommentText(exceptionComment);
- }
-
- public ClassInfo exception()
- {
- return mException;
- }
-
- public TypeInfo exceptionType()
- {
- if (mException != null) {
- return mException.asTypeInfo();
- } else {
- return null;
- }
- }
-
- public static void makeHDF(HDF data, String base, ThrowsTagInfo[] tags)
- {
- for (int i=0; i<tags.length; i++) {
- TagInfo.makeHDF(data, base + '.' + i + ".comment",
- tags[i].commentTags());
- if (tags[i].exceptionType() != null) {
- tags[i].exceptionType().makeHDF(data, base + "." + i + ".type");
- }
- }
- }
-
-
-}
-
diff --git a/tools/droiddoc/src/TodoFile.java b/tools/droiddoc/src/TodoFile.java
deleted file mode 100644
index ebef27e..0000000
--- a/tools/droiddoc/src/TodoFile.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.*;
-import java.io.*;
-
-public class TodoFile {
-
- public static final String MISSING = "No description text";
-
- public static boolean areTagsUseful(InheritedTags tags) {
- while (tags != null) {
- if (areTagsUseful(tags.tags())) {
- return true;
- }
- tags = tags.inherited();
- }
- return false;
- }
-
- public static boolean areTagsUseful(TagInfo[] tags) {
- for (TagInfo t: tags) {
- if ("Text".equals(t.name()) && t.text().trim().length() != 0) {
- return true;
- }
- if ("@inheritDoc".equals(t.name())) {
- return true;
- }
- }
- return false;
- }
-
- public static void setHDF(HDF data, String base, SourcePositionInfo pos, String name,
- String descr) {
- data.setValue(base + ".pos", pos.toString());
- data.setValue(base + ".name", name);
- data.setValue(base + ".descr", descr);
- }
-
- static class PackageStats {
- String name;
- public int total;
- public int errors;
- }
-
- public static String percent(int a, int b) {
- return ""+Math.round((((b-a)/(float)b))*100) + "%";
- }
-
- public static void writeTodoFile(String filename) {
- HDF data = DroidDoc.makeHDF();
- DroidDoc.setPageTitle(data, "Missing Documentation");
- TreeMap<String,PackageStats> packageStats = new TreeMap<String,PackageStats>();
-
- ClassInfo[] classes = Converter.rootClasses();
- Arrays.sort(classes);
-
- int classIndex = 0;
-
- for (ClassInfo cl: classes) {
- if (cl.isHidden()) {
- continue;
- }
-
- String classBase = "classes." + classIndex;
-
- String base = classBase + ".errors.";
- int errors = 0;
- int total = 1;
-
- if (!areTagsUseful(cl.inlineTags())) {
- setHDF(data, base + errors, cl.position(), "<class comment>", MISSING);
- errors++;
- }
-
-
- for (MethodInfo m: cl.constructors()) {
- boolean good = true;
- total++;
- if (m.checkLevel()) {
- if (!areTagsUseful(m.inlineTags())) {
- setHDF(data, base + errors, m.position(), m.name() + m.prettySignature(),
- MISSING);
- good = false;
- }
- }
- if (!good) {
- errors++;
- }
- }
-
- for (MethodInfo m: cl.selfMethods()) {
- boolean good = true;
- total++;
- if (m.checkLevel()) {
- if (!areTagsUseful(m.inlineTags())) {
- setHDF(data, base + errors, m.position(), m.name() + m.prettySignature(),
- MISSING);
- good = false;
- }
- }
- if (!good) {
- errors++;
- }
- }
-
-
- for (FieldInfo f: cl.enumConstants()) {
- boolean good = true;
- total++;
- if (f.checkLevel()) {
- if (!areTagsUseful(f.inlineTags())) {
- setHDF(data, base + errors, f.position(), f.name(), MISSING);
- good = false;
- }
- }
- if (!good) {
- errors++;
- }
- }
-
- for (FieldInfo f: cl.selfFields()) {
- boolean good = true;
- total++;
- if (f.checkLevel()) {
- if (!areTagsUseful(f.inlineTags())) {
- setHDF(data, base + errors, f.position(), f.name(), MISSING);
- good = false;
- }
- }
- if (!good) {
- errors++;
- }
- }
-
- if (errors > 0) {
- data.setValue(classBase + ".qualified", cl.qualifiedName());
- data.setValue(classBase + ".errorCount", ""+errors);
- data.setValue(classBase + ".totalCount", ""+total);
- data.setValue(classBase + ".percentGood", percent(errors, total));
- }
-
- PackageInfo pkg = cl.containingPackage();
- String pkgName = pkg != null ? pkg.name() : "";
- PackageStats ps = packageStats.get(pkgName);
- if (ps == null) {
- ps = new PackageStats();
- ps.name = pkgName;
- packageStats.put(pkgName, ps);
- }
- ps.total += total;
- ps.errors += errors;
-
- classIndex++;
- }
-
- int allTotal = 0;
- int allErrors = 0;
-
- int i = 0;
- for (PackageStats ps: packageStats.values()) {
- data.setValue("packages." + i + ".name", ""+ps.name);
- data.setValue("packages." + i + ".errorCount", ""+ps.errors);
- data.setValue("packages." + i + ".totalCount", ""+ps.total);
- data.setValue("packages." + i + ".percentGood", percent(ps.errors, ps.total));
-
- allTotal += ps.total;
- allErrors += ps.errors;
-
- i++;
- }
-
- data.setValue("all.errorCount", ""+allErrors);
- data.setValue("all.totalCount", ""+allTotal);
- data.setValue("all.percentGood", percent(allErrors, allTotal));
-
- ClearPage.write(data, "todo.cs", filename, true);
- }
-}
-
diff --git a/tools/droiddoc/src/TypeInfo.java b/tools/droiddoc/src/TypeInfo.java
deleted file mode 100644
index 45e9db9..0000000
--- a/tools/droiddoc/src/TypeInfo.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.clearsilver.HDF;
-import org.clearsilver.CS;
-import java.util.*;
-import java.io.*;
-
-public class TypeInfo
-{
- public TypeInfo(boolean isPrimitive, String dimension,
- String simpleTypeName, String qualifiedTypeName,
- ClassInfo cl)
- {
- mIsPrimitive = isPrimitive;
- mDimension = dimension;
- mSimpleTypeName = simpleTypeName;
- mQualifiedTypeName = qualifiedTypeName;
- mClass = cl;
- }
-
- public ClassInfo asClassInfo()
- {
- return mClass;
- }
-
- public boolean isPrimitive()
- {
- return mIsPrimitive;
- }
-
- public String dimension()
- {
- return mDimension;
- }
-
- public String simpleTypeName()
- {
- return mSimpleTypeName;
- }
-
- public String qualifiedTypeName()
- {
- return mQualifiedTypeName;
- }
-
- public String fullName()
- {
- if (mFullName != null) {
- return mFullName;
- } else {
- return fullName(new HashSet());
- }
- }
-
- public static String typeArgumentsName(TypeInfo[] args, HashSet<String> typeVars)
- {
- String result = "<";
- for (int i=0; i<args.length; i++) {
- result += args[i].fullName(typeVars);
- if (i != args.length-1) {
- result += ", ";
- }
- }
- result += ">";
- return result;
- }
-
- public String fullName(HashSet<String> typeVars)
- {
- mFullName = fullNameNoDimension(typeVars) + mDimension;
- return mFullName;
- }
-
- public String fullNameNoDimension(HashSet<String> typeVars)
- {
- String fullName = null;
- if (mIsTypeVariable) {
- if (typeVars.contains(mQualifiedTypeName)) {
- // don't recurse forever with the parameters. This handles
- // Enum<K extends Enum<K>>
- return mQualifiedTypeName;
- }
- typeVars.add(mQualifiedTypeName);
- }
-/*
- if (fullName != null) {
- return fullName;
- }
-*/
- fullName = mQualifiedTypeName;
- if (mTypeArguments != null && mTypeArguments.length > 0) {
- fullName += typeArgumentsName(mTypeArguments, typeVars);
- }
- else if (mSuperBounds != null && mSuperBounds.length > 0) {
- fullName += " super " + mSuperBounds[0].fullName(typeVars);
- for (int i=1; i<mSuperBounds.length; i++) {
- fullName += " & " + mSuperBounds[i].fullName(typeVars);
- }
- }
- else if (mExtendsBounds != null && mExtendsBounds.length > 0) {
- fullName += " extends " + mExtendsBounds[0].fullName(typeVars);
- for (int i=1; i<mExtendsBounds.length; i++) {
- fullName += " & " + mExtendsBounds[i].fullName(typeVars);
- }
- }
- return fullName;
- }
-
- public TypeInfo[] typeArguments()
- {
- return mTypeArguments;
- }
-
- public void makeHDF(HDF data, String base)
- {
- makeHDFRecursive(data, base, false, false, new HashSet<String>());
- }
-
- public void makeQualifiedHDF(HDF data, String base)
- {
- makeHDFRecursive(data, base, true, false, new HashSet<String>());
- }
-
- public void makeHDF(HDF data, String base, boolean isLastVararg,
- HashSet<String> typeVariables)
- {
- makeHDFRecursive(data, base, false, isLastVararg, typeVariables);
- }
-
- public void makeQualifiedHDF(HDF data, String base, HashSet<String> typeVariables)
- {
- makeHDFRecursive(data, base, true, false, typeVariables);
- }
-
- private void makeHDFRecursive(HDF data, String base, boolean qualified,
- boolean isLastVararg, HashSet<String> typeVars)
- {
- String label = qualified ? qualifiedTypeName() : simpleTypeName();
- label += (isLastVararg) ? "..." : dimension();
- data.setValue(base + ".label", label);
- ClassInfo cl = asClassInfo();
- if (mIsTypeVariable || mIsWildcard) {
- // could link to an @param tag on the class to describe this
- // but for now, just don't make it a link
- }
- else if (!isPrimitive() && cl != null && cl.isIncluded()) {
- data.setValue(base + ".link", cl.htmlPage());
- data.setValue(base + ".since", cl.getSince());
- }
-
- if (mIsTypeVariable) {
- if (typeVars.contains(qualifiedTypeName())) {
- // don't recurse forever with the parameters. This handles
- // Enum<K extends Enum<K>>
- return;
- }
- typeVars.add(qualifiedTypeName());
- }
- if (mTypeArguments != null) {
- TypeInfo.makeHDF(data, base + ".typeArguments", mTypeArguments, qualified, typeVars);
- }
- if (mSuperBounds != null) {
- TypeInfo.makeHDF(data, base + ".superBounds", mSuperBounds, qualified, typeVars);
- }
- if (mExtendsBounds != null) {
- TypeInfo.makeHDF(data, base + ".extendsBounds", mExtendsBounds, qualified, typeVars);
- }
- }
-
- public static void makeHDF(HDF data, String base, TypeInfo[] types, boolean qualified,
- HashSet<String> typeVariables)
- {
- final int N = types.length;
- for (int i=0; i<N; i++) {
- types[i].makeHDFRecursive(data, base + "." + i, qualified, false, typeVariables);
- }
- }
-
- public static void makeHDF(HDF data, String base, TypeInfo[] types, boolean qualified)
- {
- makeHDF(data, base, types, qualified, new HashSet<String>());
- }
-
- void setTypeArguments(TypeInfo[] args)
- {
- mTypeArguments = args;
- }
-
- void setBounds(TypeInfo[] superBounds, TypeInfo[] extendsBounds)
- {
- mSuperBounds = superBounds;
- mExtendsBounds = extendsBounds;
- }
-
- void setIsTypeVariable(boolean b)
- {
- mIsTypeVariable = b;
- }
-
- void setIsWildcard(boolean b)
- {
- mIsWildcard = b;
- }
-
- static HashSet<String> typeVariables(TypeInfo[] params)
- {
- return typeVariables(params, new HashSet());
- }
-
- static HashSet<String> typeVariables(TypeInfo[] params, HashSet<String> result)
- {
- for (TypeInfo t: params) {
- if (t.mIsTypeVariable) {
- result.add(t.mQualifiedTypeName);
- }
- }
- return result;
- }
-
-
- public boolean isTypeVariable()
- {
- return mIsTypeVariable;
- }
-
- public String defaultValue() {
- if (mIsPrimitive) {
- if ("boolean".equals(mSimpleTypeName)) {
- return "false";
- } else {
- return "0";
- }
- } else {
- return "null";
- }
- }
-
- @Override
- public String toString(){
- String returnString = "";
- returnString += "Primitive?: " + mIsPrimitive + " TypeVariable?: " +
- mIsTypeVariable + " Wildcard?: " + mIsWildcard + " Dimension: " + mDimension
- + " QualifedTypeName: " + mQualifiedTypeName;
-
- if (mTypeArguments != null){
- returnString += "\nTypeArguments: ";
- for (TypeInfo tA : mTypeArguments){
- returnString += tA.qualifiedTypeName() + "(" + tA + ") ";
- }
- }
- if (mSuperBounds != null){
- returnString += "\nSuperBounds: ";
- for (TypeInfo tA : mSuperBounds){
- returnString += tA.qualifiedTypeName() + "(" + tA + ") ";
- }
- }
- if (mExtendsBounds != null){
- returnString += "\nExtendsBounds: ";
- for (TypeInfo tA : mExtendsBounds){
- returnString += tA.qualifiedTypeName() + "(" + tA + ") ";
- }
- }
- return returnString;
- }
-
- private boolean mIsPrimitive;
- private boolean mIsTypeVariable;
- private boolean mIsWildcard;
- private String mDimension;
- private String mSimpleTypeName;
- private String mQualifiedTypeName;
- private ClassInfo mClass;
- private TypeInfo[] mTypeArguments;
- private TypeInfo[] mSuperBounds;
- private TypeInfo[] mExtendsBounds;
- private String mFullName;
-}
diff --git a/tools/droiddoc/templates/assets/android-developer-docs-devguide.css b/tools/droiddoc/templates-pdk/assets/android-developer-docs-devguide.css
similarity index 100%
rename from tools/droiddoc/templates/assets/android-developer-docs-devguide.css
rename to tools/droiddoc/templates-pdk/assets/android-developer-docs-devguide.css
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates-pdk/assets/android-developer-docs.css
similarity index 92%
copy from tools/droiddoc/templates/assets/android-developer-docs.css
copy to tools/droiddoc/templates-pdk/assets/android-developer-docs.css
index 1672c93..bc9e98b 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates-pdk/assets/android-developer-docs.css
@@ -34,6 +34,10 @@
font-size:12px;
}
+#side-nav.not-resizable {
+ background:url('images/sidenav-rule.png') no-repeat 243px 0;
+}
+
#resize-packages-nav {
/* keeps the resize handle below the h-scroll handle */
height:270px;
@@ -726,36 +730,34 @@
padding:0;
}
-p.note, div.note,
-p.caution, div.caution,
-p.warning, div.warning {
+p.note, p.caution, p.warning {
margin: 1em;
padding: 0 0 0 .5em;
border-left: 4px solid;
}
-p.special-note,
-div.special-note {
+p.special-note {
background-color:#EBF3DB;
padding:10px 20px;
margin:0 0 1em;
}
-p.note,
-div.note {
+p.note {
border-color: #99aacc;
}
-p.warning,
-div.warning {
+p.warning {
border-color: #aa0033;
}
-p.caution,
-div.caution {
+p.caution {
border-color: #ffcf00;
}
+p.warning b, p.warning strong {
+ font-weight: bold;
+}
+
li p.note, li p.warning {
margin: .5em 0 0 0;
padding: .2em .5em .2em .9em;
@@ -941,7 +943,7 @@
}
.sidebox p {
- margin-bottom: .75em;
+ margin-bottom: .25em;
}
.sidebox ul {
@@ -1052,7 +1054,7 @@
margin: 0;
padding: 0;
}
-
+
ol.toc li li {
padding: 0;
margin: 0 0 0 1em;
@@ -1179,76 +1181,6 @@
float: right;
}
-/* 200px */
-.g-tpl-200 .g-unit,
-.g-unit .g-tpl-200 .g-unit,
-.g-unit .g-unit .g-tpl-200 .g-unit {
- display: block;
- margin: 0 0 0 200px;
- width: auto;
- float: none;
-}
-.g-unit .g-unit .g-tpl-200 .g-first,
-.g-unit .g-tpl-200 .g-first,
-.g-tpl-200 .g-first {
- display: block;
- margin: 0;
- width: 200px;
- float: left;
-}
-/* 200px alt */
-.g-tpl-200-alt .g-unit,
-.g-unit .g-tpl-200-alt .g-unit,
-.g-unit .g-unit .g-tpl-200-alt .g-unit {
- display: block;
- margin: 0 200px 0 0;
- width: auto;
- float: none;
-}
-.g-unit .g-unit .g-tpl-200-alt .g-first,
-.g-unit .g-tpl-200-alt .g-first,
-.g-tpl-200-alt .g-first {
- display: block;
- margin: 0;
- width: 200px;
- float: right;
-}
-
-/* 190px */
-.g-tpl-190 .g-unit,
-.g-unit .g-tpl-190 .g-unit,
-.g-unit .g-unit .g-tpl-190 .g-unit {
- display: block;
- margin: 0 0 0 190px;
- width: auto;
- float: none;
-}
-.g-unit .g-unit .g-tpl-190 .g-first,
-.g-unit .g-tpl-190 .g-first,
-.g-tpl-190 .g-first {
- display: block;
- margin: 0;
- width: 190px;
- float: left;
-}
-/* 190px alt */
-.g-tpl-190-alt .g-unit,
-.g-unit .g-tpl-190-alt .g-unit,
-.g-unit .g-unit .g-tpl-190-alt .g-unit {
- display: block;
- margin: 0 190px 0 0;
- width: auto;
- float: none;
-}
-.g-unit .g-unit .g-tpl-190-alt .g-first,
-.g-unit .g-tpl-190-alt .g-first,
-.g-tpl-190-alt .g-first {
- display: block;
- margin: 0;
- width: 190px;
- float: right;
-}
-
/* 180px */
.g-tpl-180 .g-unit,
.g-unit .g-tpl-180 .g-unit,
@@ -1284,7 +1216,7 @@
float: right;
}
-
+
/* JQUERY RESIZABLE STYLES */
.ui-resizable { position: relative; }
.ui-resizable-handle { position: absolute; display: none; font-size: 0.1px; z-index:1; }
@@ -1320,7 +1252,7 @@
#body-content {
position:inherit;
}
-
+
#doc-content {
margin-left:0 !important;
height:auto !important;
diff --git a/tools/droiddoc/templates-pdk/assets/android-developer-reference.js b/tools/droiddoc/templates-pdk/assets/android-developer-reference.js
new file mode 100644
index 0000000..daddde0
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/android-developer-reference.js
@@ -0,0 +1,390 @@
+
+/* API LEVEL TOGGLE */
+addLoadEvent(changeApiLevel);
+
+var API_LEVEL_ENABLED_COOKIE = "api_level_enabled";
+var API_LEVEL_COOKIE = "api_level";
+var minLevel = 1;
+
+function toggleApiLevelSelector(checkbox) {
+ var date = new Date();
+ date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
+ var expiration = date.toGMTString();
+ if (checkbox.checked) {
+ $("#apiLevelSelector").removeAttr("disabled");
+ $("#api-level-toggle label").removeClass("disabled");
+ writeCookie(API_LEVEL_ENABLED_COOKIE, 1, null, expiration);
+ } else {
+ $("#apiLevelSelector").attr("disabled","disabled");
+ $("#api-level-toggle label").addClass("disabled");
+ writeCookie(API_LEVEL_ENABLED_COOKIE, 0, null, expiration);
+ }
+ changeApiLevel();
+}
+
+function buildApiLevelSelector() {
+ var maxLevel = SINCE_DATA.length;
+ var userApiLevelEnabled = readCookie(API_LEVEL_ENABLED_COOKIE);
+ var userApiLevel = readCookie(API_LEVEL_COOKIE);
+ userApiLevel = userApiLevel == 0 ? maxLevel : userApiLevel; // If there's no cookie (zero), use the max by default
+
+ if (userApiLevelEnabled == 0) {
+ $("#apiLevelSelector").attr("disabled","disabled");
+ } else {
+ $("#apiLevelCheckbox").attr("checked","checked");
+ $("#api-level-toggle label").removeClass("disabled");
+ }
+
+ minLevel = $("body").attr("class");
+ var select = $("#apiLevelSelector").html("").change(changeApiLevel);
+ for (var i = maxLevel-1; i >= 0; i--) {
+ var option = $("<option />").attr("value",""+SINCE_DATA[i]).append(""+SINCE_DATA[i]);
+ // if (SINCE_DATA[i] < minLevel) option.addClass("absent"); // always false for strings (codenames)
+ select.append(option);
+ }
+
+ // get the DOM element and use setAttribute cuz IE6 fails when using jquery .attr('selected',true)
+ var selectedLevelItem = $("#apiLevelSelector option[value='"+userApiLevel+"']").get(0);
+ selectedLevelItem.setAttribute('selected',true);
+}
+
+function changeApiLevel() {
+ var maxLevel = SINCE_DATA.length;
+ var userApiLevelEnabled = readCookie(API_LEVEL_ENABLED_COOKIE);
+ var selectedLevel = maxLevel;
+
+ if (userApiLevelEnabled == 0) {
+ toggleVisisbleApis(selectedLevel, "body");
+ } else {
+ selectedLevel = $("#apiLevelSelector option:selected").val();
+ toggleVisisbleApis(selectedLevel, "body");
+
+ var date = new Date();
+ date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
+ var expiration = date.toGMTString();
+ writeCookie(API_LEVEL_COOKIE, selectedLevel, null, expiration);
+ }
+
+ if (selectedLevel < minLevel) {
+ var thing = ($("#jd-header").html().indexOf("package") != -1) ? "package" : "class";
+ $("#naMessage").show().html("<div><p><strong>This " + thing + " is not available with API Level " + selectedLevel + ".</strong></p>"
+ + "<p>To use this " + thing + ", your application must specify API Level " + minLevel + " or higher in its manifest "
+ + "and be compiled against a version of the Android library that supports an equal or higher API Level. To reveal this "
+ + "document, change the value of the API Level filter above.</p>"
+ + "<p><a href='" +toRoot+ "guide/appendix/api-levels.html'>What is the API Level?</a></p></div>");
+ } else {
+ $("#naMessage").hide();
+ }
+}
+
+function toggleVisisbleApis(selectedLevel, context) {
+ var apis = $(".api",context);
+ apis.each(function(i) {
+ var obj = $(this);
+ var className = obj.attr("class");
+ var apiLevelIndex = className.lastIndexOf("-")+1;
+ var apiLevelEndIndex = className.indexOf(" ", apiLevelIndex);
+ apiLevelEndIndex = apiLevelEndIndex != -1 ? apiLevelEndIndex : className.length;
+ var apiLevel = className.substring(apiLevelIndex, apiLevelEndIndex);
+ if (apiLevel > selectedLevel) obj.addClass("absent").attr("title","Requires API Level "+apiLevel+" or higher");
+ else obj.removeClass("absent").removeAttr("title");
+ });
+}
+
+/* NAVTREE */
+
+function new_node(me, mom, text, link, children_data, api_level)
+{
+ var node = new Object();
+ node.children = Array();
+ node.children_data = children_data;
+ node.depth = mom.depth + 1;
+
+ node.li = document.createElement("li");
+ mom.get_children_ul().appendChild(node.li);
+
+ node.label_div = document.createElement("div");
+ node.label_div.className = "label";
+ if (api_level != null) {
+ $(node.label_div).addClass("api");
+ $(node.label_div).addClass("api-level-"+api_level);
+ }
+ node.li.appendChild(node.label_div);
+ node.label_div.style.paddingLeft = 10*node.depth + "px";
+
+ if (children_data == null) {
+ // 12 is the width of the triangle and padding extra space
+ node.label_div.style.paddingLeft = ((10*node.depth)+12) + "px";
+ } else {
+ node.label_div.style.paddingLeft = 10*node.depth + "px";
+ node.expand_toggle = document.createElement("a");
+ node.expand_toggle.href = "javascript:void(0)";
+ node.expand_toggle.onclick = function() {
+ if (node.expanded) {
+ $(node.get_children_ul()).slideUp("fast");
+ node.plus_img.src = me.toroot + "assets/images/triangle-closed-small.png";
+ node.expanded = false;
+ } else {
+ expand_node(me, node);
+ }
+ };
+ node.label_div.appendChild(node.expand_toggle);
+
+ node.plus_img = document.createElement("img");
+ node.plus_img.src = me.toroot + "assets/images/triangle-closed-small.png";
+ node.plus_img.className = "plus";
+ node.plus_img.border = "0";
+ node.expand_toggle.appendChild(node.plus_img);
+
+ node.expanded = false;
+ }
+
+ var a = document.createElement("a");
+ node.label_div.appendChild(a);
+ node.label = document.createTextNode(text);
+ a.appendChild(node.label);
+ if (link) {
+ a.href = me.toroot + link;
+ } else {
+ if (children_data != null) {
+ a.className = "nolink";
+ a.href = "javascript:void(0)";
+ a.onclick = node.expand_toggle.onclick;
+ // This next line shouldn't be necessary. I'll buy a beer for the first
+ // person who figures out how to remove this line and have the link
+ // toggle shut on the first try. --joeo@android.com
+ node.expanded = false;
+ }
+ }
+
+
+ node.children_ul = null;
+ node.get_children_ul = function() {
+ if (!node.children_ul) {
+ node.children_ul = document.createElement("ul");
+ node.children_ul.className = "children_ul";
+ node.children_ul.style.display = "none";
+ node.li.appendChild(node.children_ul);
+ }
+ return node.children_ul;
+ };
+
+ return node;
+}
+
+function expand_node(me, node)
+{
+ if (node.children_data && !node.expanded) {
+ if (node.children_visited) {
+ $(node.get_children_ul()).slideDown("fast");
+ } else {
+ get_node(me, node);
+ if ($(node.label_div).hasClass("absent")) $(node.get_children_ul()).addClass("absent");
+ $(node.get_children_ul()).slideDown("fast");
+ }
+ node.plus_img.src = me.toroot + "assets/images/triangle-opened-small.png";
+ node.expanded = true;
+
+ // perform api level toggling because new nodes are new to the DOM
+ var selectedLevel = $("#apiLevelSelector option:selected").val();
+ toggleVisisbleApis(selectedLevel, "#side-nav");
+ }
+}
+
+function get_node(me, mom)
+{
+ mom.children_visited = true;
+ for (var i in mom.children_data) {
+ var node_data = mom.children_data[i];
+ mom.children[i] = new_node(me, mom, node_data[0], node_data[1],
+ node_data[2], node_data[3]);
+ }
+}
+
+function this_page_relative(toroot)
+{
+ var full = document.location.pathname;
+ var file = "";
+ if (toroot.substr(0, 1) == "/") {
+ if (full.substr(0, toroot.length) == toroot) {
+ return full.substr(toroot.length);
+ } else {
+ // the file isn't under toroot. Fail.
+ return null;
+ }
+ } else {
+ if (toroot != "./") {
+ toroot = "./" + toroot;
+ }
+ do {
+ if (toroot.substr(toroot.length-3, 3) == "../" || toroot == "./") {
+ var pos = full.lastIndexOf("/");
+ file = full.substr(pos) + file;
+ full = full.substr(0, pos);
+ toroot = toroot.substr(0, toroot.length-3);
+ }
+ } while (toroot != "" && toroot != "/");
+ return file.substr(1);
+ }
+}
+
+function find_page(url, data)
+{
+ var nodes = data;
+ var result = null;
+ for (var i in nodes) {
+ var d = nodes[i];
+ if (d[1] == url) {
+ return new Array(i);
+ }
+ else if (d[2] != null) {
+ result = find_page(url, d[2]);
+ if (result != null) {
+ return (new Array(i).concat(result));
+ }
+ }
+ }
+ return null;
+}
+
+function load_navtree_data(toroot) {
+ var navtreeData = document.createElement("script");
+ navtreeData.setAttribute("type","text/javascript");
+ navtreeData.setAttribute("src", toroot+"navtree_data.js");
+ $("head").append($(navtreeData));
+}
+
+function init_default_navtree(toroot) {
+ init_navtree("nav-tree", toroot, NAVTREE_DATA);
+
+ // perform api level toggling because because the whole tree is new to the DOM
+ var selectedLevel = $("#apiLevelSelector option:selected").val();
+ toggleVisisbleApis(selectedLevel, "#side-nav");
+}
+
+function init_navtree(navtree_id, toroot, root_nodes)
+{
+ var me = new Object();
+ me.toroot = toroot;
+ me.node = new Object();
+
+ me.node.li = document.getElementById(navtree_id);
+ me.node.children_data = root_nodes;
+ me.node.children = new Array();
+ me.node.children_ul = document.createElement("ul");
+ me.node.get_children_ul = function() { return me.node.children_ul; };
+ //me.node.children_ul.className = "children_ul";
+ me.node.li.appendChild(me.node.children_ul);
+ me.node.depth = 0;
+
+ get_node(me, me.node);
+
+ me.this_page = this_page_relative(toroot);
+ me.breadcrumbs = find_page(me.this_page, root_nodes);
+ if (me.breadcrumbs != null && me.breadcrumbs.length != 0) {
+ var mom = me.node;
+ for (var i in me.breadcrumbs) {
+ var j = me.breadcrumbs[i];
+ mom = mom.children[j];
+ expand_node(me, mom);
+ }
+ mom.label_div.className = mom.label_div.className + " selected";
+ addLoadEvent(function() {
+ scrollIntoView("nav-tree");
+ });
+ }
+}
+
+/* TOGGLE INHERITED MEMBERS */
+
+/* Toggle an inherited class (arrow toggle)
+ * @param linkObj The link that was clicked.
+ * @param expand 'true' to ensure it's expanded. 'false' to ensure it's closed.
+ * 'null' to simply toggle.
+ */
+function toggleInherited(linkObj, expand) {
+ var base = linkObj.getAttribute("id");
+ var list = document.getElementById(base + "-list");
+ var summary = document.getElementById(base + "-summary");
+ var trigger = document.getElementById(base + "-trigger");
+ var a = $(linkObj);
+ if ( (expand == null && a.hasClass("closed")) || expand ) {
+ list.style.display = "none";
+ summary.style.display = "block";
+ trigger.src = toRoot + "assets/images/triangle-opened.png";
+ a.removeClass("closed");
+ a.addClass("opened");
+ } else if ( (expand == null && a.hasClass("opened")) || (expand == false) ) {
+ list.style.display = "block";
+ summary.style.display = "none";
+ trigger.src = toRoot + "assets/images/triangle-closed.png";
+ a.removeClass("opened");
+ a.addClass("closed");
+ }
+ return false;
+}
+
+/* Toggle all inherited classes in a single table (e.g. all inherited methods)
+ * @param linkObj The link that was clicked.
+ * @param expand 'true' to ensure it's expanded. 'false' to ensure it's closed.
+ * 'null' to simply toggle.
+ */
+function toggleAllInherited(linkObj, expand) {
+ var a = $(linkObj);
+ var table = $(a.parent().parent().parent()); // ugly way to get table/tbody
+ var expandos = $(".jd-expando-trigger", table);
+ if ( (expand == null && a.text() == "[Expand]") || expand ) {
+ expandos.each(function(i) {
+ toggleInherited(this, true);
+ });
+ a.text("[Collapse]");
+ } else if ( (expand == null && a.text() == "[Collapse]") || (expand == false) ) {
+ expandos.each(function(i) {
+ toggleInherited(this, false);
+ });
+ a.text("[Expand]");
+ }
+ return false;
+}
+
+/* Toggle all inherited members in the class (link in the class title)
+ */
+function toggleAllClassInherited() {
+ var a = $("#toggleAllClassInherited"); // get toggle link from class title
+ var toggles = $(".toggle-all", $("#doc-content"));
+ if (a.text() == "[Expand All]") {
+ toggles.each(function(i) {
+ toggleAllInherited(this, true);
+ });
+ a.text("[Collapse All]");
+ } else {
+ toggles.each(function(i) {
+ toggleAllInherited(this, false);
+ });
+ a.text("[Expand All]");
+ }
+ return false;
+}
+
+/* Expand all inherited members in the class. Used when initiating page search */
+function ensureAllInheritedExpanded() {
+ var toggles = $(".toggle-all", $("#doc-content"));
+ toggles.each(function(i) {
+ toggleAllInherited(this, true);
+ });
+ $("#toggleAllClassInherited").text("[Collapse All]");
+}
+
+
+/* HANDLE KEY EVENTS
+ * - Listen for Ctrl+F (Cmd on Mac) and expand all inherited members (to aid page search)
+ */
+var agent = navigator['userAgent'].toLowerCase();
+var mac = agent.indexOf("macintosh") != -1;
+
+$(document).keydown( function(e) {
+var control = mac ? e.metaKey && !e.ctrlKey : e.ctrlKey; // get ctrl key
+ if (control && e.which == 70) { // 70 is "F"
+ ensureAllInheritedExpanded();
+ }
+});
\ No newline at end of file
diff --git a/tools/droiddoc/templates/assets/carousel.js b/tools/droiddoc/templates-pdk/assets/carousel.js
similarity index 100%
rename from tools/droiddoc/templates/assets/carousel.js
rename to tools/droiddoc/templates-pdk/assets/carousel.js
diff --git a/tools/droiddoc/templates/assets/images/android-developers-logo.png b/tools/droiddoc/templates-pdk/assets/images/android-developers-logo.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/android-developers-logo.png
rename to tools/droiddoc/templates-pdk/assets/images/android-developers-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/android_wrench.png b/tools/droiddoc/templates-pdk/assets/images/android_wrench.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/android_wrench.png
rename to tools/droiddoc/templates-pdk/assets/images/android_wrench.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_bluelink_down.png b/tools/droiddoc/templates-pdk/assets/images/arrow_bluelink_down.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/arrow_bluelink_down.png
rename to tools/droiddoc/templates-pdk/assets/images/arrow_bluelink_down.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_bluelink_up.png b/tools/droiddoc/templates-pdk/assets/images/arrow_bluelink_up.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/arrow_bluelink_up.png
rename to tools/droiddoc/templates-pdk/assets/images/arrow_bluelink_up.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_left_off.jpg b/tools/droiddoc/templates-pdk/assets/images/arrow_left_off.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/arrow_left_off.jpg
rename to tools/droiddoc/templates-pdk/assets/images/arrow_left_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_left_on.jpg b/tools/droiddoc/templates-pdk/assets/images/arrow_left_on.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/arrow_left_on.jpg
rename to tools/droiddoc/templates-pdk/assets/images/arrow_left_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_right_off.jpg b/tools/droiddoc/templates-pdk/assets/images/arrow_right_off.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/arrow_right_off.jpg
rename to tools/droiddoc/templates-pdk/assets/images/arrow_right_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_right_on.jpg b/tools/droiddoc/templates-pdk/assets/images/arrow_right_on.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/arrow_right_on.jpg
rename to tools/droiddoc/templates-pdk/assets/images/arrow_right_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_community_leftDiv.jpg b/tools/droiddoc/templates-pdk/assets/images/bg_community_leftDiv.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/bg_community_leftDiv.jpg
rename to tools/droiddoc/templates-pdk/assets/images/bg_community_leftDiv.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_fade.jpg b/tools/droiddoc/templates-pdk/assets/images/bg_fade.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/bg_fade.jpg
rename to tools/droiddoc/templates-pdk/assets/images/bg_fade.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_images_sprite.png b/tools/droiddoc/templates-pdk/assets/images/bg_images_sprite.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/bg_images_sprite.png
rename to tools/droiddoc/templates-pdk/assets/images/bg_images_sprite.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_logo.png b/tools/droiddoc/templates-pdk/assets/images/bg_logo.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/bg_logo.png
rename to tools/droiddoc/templates-pdk/assets/images/bg_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/body-gradient-tab.png b/tools/droiddoc/templates-pdk/assets/images/body-gradient-tab.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/body-gradient-tab.png
rename to tools/droiddoc/templates-pdk/assets/images/body-gradient-tab.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/body-gradient.png b/tools/droiddoc/templates-pdk/assets/images/body-gradient.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/body-gradient.png
rename to tools/droiddoc/templates-pdk/assets/images/body-gradient.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/developers-logo.png b/tools/droiddoc/templates-pdk/assets/images/developers-logo.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/developers-logo.png
rename to tools/droiddoc/templates-pdk/assets/images/developers-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/grad-rule-qv.png b/tools/droiddoc/templates-pdk/assets/images/grad-rule-qv.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/grad-rule-qv.png
rename to tools/droiddoc/templates-pdk/assets/images/grad-rule-qv.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/assets/images/home/Android_Dev_Lab_l.png b/tools/droiddoc/templates-pdk/assets/images/home/Android_Dev_Lab_l.png
new file mode 100644
index 0000000..8259981
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/home/Android_Dev_Lab_l.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/IO-logo.png b/tools/droiddoc/templates-pdk/assets/images/home/IO-logo.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/IO-logo.png
rename to tools/droiddoc/templates-pdk/assets/images/home/IO-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/assets/images/home/adc2_l.png b/tools/droiddoc/templates-pdk/assets/images/home/adc2_l.png
new file mode 100644
index 0000000..ac51a1e
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/home/adc2_l.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/assets/images/home/adc2_s.png b/tools/droiddoc/templates-pdk/assets/images/home/adc2_s.png
new file mode 100644
index 0000000..9cbfd4e
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/home/adc2_s.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/android_adc.png b/tools/droiddoc/templates-pdk/assets/images/home/android_adc.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/android_adc.png
rename to tools/droiddoc/templates-pdk/assets/images/home/android_adc.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_announcement.png b/tools/droiddoc/templates-pdk/assets/images/home/bg_home_announcement.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/bg_home_announcement.png
rename to tools/droiddoc/templates-pdk/assets/images/home/bg_home_announcement.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_bottom.jpg b/tools/droiddoc/templates-pdk/assets/images/home/bg_home_bottom.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/bg_home_bottom.jpg
rename to tools/droiddoc/templates-pdk/assets/images/home/bg_home_bottom.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_carousel.png b/tools/droiddoc/templates-pdk/assets/images/home/bg_home_carousel.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/bg_home_carousel.png
rename to tools/droiddoc/templates-pdk/assets/images/home/bg_home_carousel.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_carousel_board.png b/tools/droiddoc/templates-pdk/assets/images/home/bg_home_carousel_board.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/bg_home_carousel_board.png
rename to tools/droiddoc/templates-pdk/assets/images/home/bg_home_carousel_board.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_carousel_wheel.png b/tools/droiddoc/templates-pdk/assets/images/home/bg_home_carousel_wheel.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/bg_home_carousel_wheel.png
rename to tools/droiddoc/templates-pdk/assets/images/home/bg_home_carousel_wheel.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/carousel_buttons_sprite.png b/tools/droiddoc/templates-pdk/assets/images/home/carousel_buttons_sprite.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/carousel_buttons_sprite.png
rename to tools/droiddoc/templates-pdk/assets/images/home/carousel_buttons_sprite.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/assets/images/home/devphone-large.png b/tools/droiddoc/templates-pdk/assets/images/home/devphone-large.png
new file mode 100755
index 0000000..6221e0a
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/home/devphone-large.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/assets/images/home/devphone-small.png b/tools/droiddoc/templates-pdk/assets/images/home/devphone-small.png
new file mode 100755
index 0000000..b8487f5
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/home/devphone-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/donut-android.png b/tools/droiddoc/templates-pdk/assets/images/home/donut-android.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/donut-android.png
rename to tools/droiddoc/templates-pdk/assets/images/home/donut-android.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/eclair-android.png b/tools/droiddoc/templates-pdk/assets/images/home/eclair-android.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/eclair-android.png
rename to tools/droiddoc/templates-pdk/assets/images/home/eclair-android.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/assets/images/home/froyo-android.png b/tools/droiddoc/templates-pdk/assets/images/home/froyo-android.png
new file mode 100644
index 0000000..84ec5ec
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/home/froyo-android.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/assets/images/home/gdc-logo.png b/tools/droiddoc/templates-pdk/assets/images/home/gdc-logo.png
new file mode 100644
index 0000000..85617b8
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/home/gdc-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/io-large.png b/tools/droiddoc/templates-pdk/assets/images/home/io-large.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/io-large.png
rename to tools/droiddoc/templates-pdk/assets/images/home/io-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/io-small.png b/tools/droiddoc/templates-pdk/assets/images/home/io-small.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/io-small.png
rename to tools/droiddoc/templates-pdk/assets/images/home/io-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/maps-large.png b/tools/droiddoc/templates-pdk/assets/images/home/maps-large.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/maps-large.png
rename to tools/droiddoc/templates-pdk/assets/images/home/maps-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/maps-small.png b/tools/droiddoc/templates-pdk/assets/images/home/maps-small.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/maps-small.png
rename to tools/droiddoc/templates-pdk/assets/images/home/maps-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/market-large.png b/tools/droiddoc/templates-pdk/assets/images/home/market-large.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/market-large.png
rename to tools/droiddoc/templates-pdk/assets/images/home/market-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/market-small.png b/tools/droiddoc/templates-pdk/assets/images/home/market-small.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/market-small.png
rename to tools/droiddoc/templates-pdk/assets/images/home/market-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/sdk-large.png b/tools/droiddoc/templates-pdk/assets/images/home/sdk-large.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/sdk-large.png
rename to tools/droiddoc/templates-pdk/assets/images/home/sdk-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/sdk-small.png b/tools/droiddoc/templates-pdk/assets/images/home/sdk-small.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/sdk-small.png
rename to tools/droiddoc/templates-pdk/assets/images/home/sdk-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/hr_gray_main.jpg b/tools/droiddoc/templates-pdk/assets/images/hr_gray_main.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/hr_gray_main.jpg
rename to tools/droiddoc/templates-pdk/assets/images/hr_gray_main.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/hr_gray_side.jpg b/tools/droiddoc/templates-pdk/assets/images/hr_gray_side.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/hr_gray_side.jpg
rename to tools/droiddoc/templates-pdk/assets/images/hr_gray_side.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_contribute.jpg b/tools/droiddoc/templates-pdk/assets/images/icon_contribute.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/icon_contribute.jpg
rename to tools/droiddoc/templates-pdk/assets/images/icon_contribute.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_download.jpg b/tools/droiddoc/templates-pdk/assets/images/icon_download.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/icon_download.jpg
rename to tools/droiddoc/templates-pdk/assets/images/icon_download.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_download2.jpg b/tools/droiddoc/templates-pdk/assets/images/icon_download2.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/icon_download2.jpg
rename to tools/droiddoc/templates-pdk/assets/images/icon_download2.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_guidelines_logo.png b/tools/droiddoc/templates-pdk/assets/images/icon_guidelines_logo.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/icon_guidelines_logo.png
rename to tools/droiddoc/templates-pdk/assets/images/icon_guidelines_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_market.jpg b/tools/droiddoc/templates-pdk/assets/images/icon_market.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/icon_market.jpg
rename to tools/droiddoc/templates-pdk/assets/images/icon_market.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_robot.jpg b/tools/droiddoc/templates-pdk/assets/images/icon_robot.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/icon_robot.jpg
rename to tools/droiddoc/templates-pdk/assets/images/icon_robot.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_world.jpg b/tools/droiddoc/templates-pdk/assets/images/icon_world.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/icon_world.jpg
rename to tools/droiddoc/templates-pdk/assets/images/icon_world.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/left_off.jpg b/tools/droiddoc/templates-pdk/assets/images/left_off.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/left_off.jpg
rename to tools/droiddoc/templates-pdk/assets/images/left_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/left_on.jpg b/tools/droiddoc/templates-pdk/assets/images/left_on.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/left_on.jpg
rename to tools/droiddoc/templates-pdk/assets/images/left_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/logo_breadcrumbz.jpg b/tools/droiddoc/templates-pdk/assets/images/logo_breadcrumbz.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/logo_breadcrumbz.jpg
rename to tools/droiddoc/templates-pdk/assets/images/logo_breadcrumbz.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/open_source.png b/tools/droiddoc/templates-pdk/assets/images/open_source.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/open_source.png
rename to tools/droiddoc/templates-pdk/assets/images/open_source.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/preliminary.png b/tools/droiddoc/templates-pdk/assets/images/preliminary.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/preliminary.png
rename to tools/droiddoc/templates-pdk/assets/images/preliminary.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-e.gif b/tools/droiddoc/templates-pdk/assets/images/resizable-e.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/images/resizable-e.gif
rename to tools/droiddoc/templates-pdk/assets/images/resizable-e.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-e2.gif b/tools/droiddoc/templates-pdk/assets/images/resizable-e2.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/images/resizable-e2.gif
rename to tools/droiddoc/templates-pdk/assets/images/resizable-e2.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-eg.gif b/tools/droiddoc/templates-pdk/assets/images/resizable-eg.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/images/resizable-eg.gif
rename to tools/droiddoc/templates-pdk/assets/images/resizable-eg.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-s.gif b/tools/droiddoc/templates-pdk/assets/images/resizable-s.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/images/resizable-s.gif
rename to tools/droiddoc/templates-pdk/assets/images/resizable-s.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-s2.gif b/tools/droiddoc/templates-pdk/assets/images/resizable-s2.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/images/resizable-s2.gif
rename to tools/droiddoc/templates-pdk/assets/images/resizable-s2.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-sg.gif b/tools/droiddoc/templates-pdk/assets/images/resizable-sg.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/images/resizable-sg.gif
rename to tools/droiddoc/templates-pdk/assets/images/resizable-sg.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/sidenav-rule.png b/tools/droiddoc/templates-pdk/assets/images/sidenav-rule.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/sidenav-rule.png
rename to tools/droiddoc/templates-pdk/assets/images/sidenav-rule.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_off.jpg b/tools/droiddoc/templates-pdk/assets/images/slide_off.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_off.jpg
rename to tools/droiddoc/templates-pdk/assets/images/slide_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_on.jpg b/tools/droiddoc/templates-pdk/assets/images/slide_on.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_on.jpg
rename to tools/droiddoc/templates-pdk/assets/images/slide_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/spacer.gif b/tools/droiddoc/templates-pdk/assets/images/spacer.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/images/spacer.gif
rename to tools/droiddoc/templates-pdk/assets/images/spacer.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-closed-small.png b/tools/droiddoc/templates-pdk/assets/images/triangle-closed-small.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/triangle-closed-small.png
rename to tools/droiddoc/templates-pdk/assets/images/triangle-closed-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-closed.png b/tools/droiddoc/templates-pdk/assets/images/triangle-closed.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/triangle-closed.png
rename to tools/droiddoc/templates-pdk/assets/images/triangle-closed.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-opened-small.png b/tools/droiddoc/templates-pdk/assets/images/triangle-opened-small.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/triangle-opened-small.png
rename to tools/droiddoc/templates-pdk/assets/images/triangle-opened-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-opened.png b/tools/droiddoc/templates-pdk/assets/images/triangle-opened.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/triangle-opened.png
rename to tools/droiddoc/templates-pdk/assets/images/triangle-opened.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/uiguidelines1.png b/tools/droiddoc/templates-pdk/assets/images/uiguidelines1.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/uiguidelines1.png
rename to tools/droiddoc/templates-pdk/assets/images/uiguidelines1.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/video-droid.png b/tools/droiddoc/templates-pdk/assets/images/video-droid.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/video-droid.png
rename to tools/droiddoc/templates-pdk/assets/images/video-droid.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/jdiff_logo.gif b/tools/droiddoc/templates-pdk/assets/jdiff_logo.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/jdiff_logo.gif
rename to tools/droiddoc/templates-pdk/assets/jdiff_logo.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/jquery-history.js b/tools/droiddoc/templates-pdk/assets/jquery-history.js
similarity index 100%
rename from tools/droiddoc/templates/assets/jquery-history.js
rename to tools/droiddoc/templates-pdk/assets/jquery-history.js
diff --git a/tools/droiddoc/templates/assets/jquery-resizable.min.js b/tools/droiddoc/templates-pdk/assets/jquery-resizable.min.js
similarity index 100%
rename from tools/droiddoc/templates/assets/jquery-resizable.min.js
rename to tools/droiddoc/templates-pdk/assets/jquery-resizable.min.js
diff --git a/tools/droiddoc/templates/assets/prettify.js b/tools/droiddoc/templates-pdk/assets/prettify.js
similarity index 100%
rename from tools/droiddoc/templates/assets/prettify.js
rename to tools/droiddoc/templates-pdk/assets/prettify.js
diff --git a/tools/droiddoc/templates/assets/search_autocomplete.js b/tools/droiddoc/templates-pdk/assets/search_autocomplete.js
similarity index 100%
rename from tools/droiddoc/templates/assets/search_autocomplete.js
rename to tools/droiddoc/templates-pdk/assets/search_autocomplete.js
diff --git a/tools/droiddoc/templates/assets/style.css b/tools/droiddoc/templates-pdk/assets/style.css
similarity index 100%
rename from tools/droiddoc/templates/assets/style.css
rename to tools/droiddoc/templates-pdk/assets/style.css
diff --git a/tools/droiddoc/templates/assets/triangle-none.gif b/tools/droiddoc/templates-pdk/assets/triangle-none.gif
similarity index 100%
rename from tools/droiddoc/templates/assets/triangle-none.gif
rename to tools/droiddoc/templates-pdk/assets/triangle-none.gif
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/components/left_nav.cs b/tools/droiddoc/templates-pdk/components/left_nav.cs
new file mode 100644
index 0000000..a6d0ae3
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/components/left_nav.cs
@@ -0,0 +1,15 @@
+<?cs def:custom_left_nav() ?>
+ <?cs if:doc.hidenav != "true" ?>
+ <?cs if:doc.type == "source" ?>
+ <?cs call:source_nav() ?>
+ <?cs elif:doc.type == "porting" ?>
+ <?cs call:porting_nav() ?>
+ <?cs elif:doc.type == "compatibility" ?>
+ <?cs call:compatibility_nav() ?>
+ <?cs elif:doc.type == "community" ?>
+ <?cs call:community_nav() ?>
+ <?cs elif:doc.type == "about" ?>
+ <?cs call:about_nav() ?>
+ <?cs /if ?>
+ <?cs /if ?>
+<?cs /def ?>
diff --git a/tools/droiddoc/templates-pdk/components/masthead.cs b/tools/droiddoc/templates-pdk/components/masthead.cs
new file mode 100644
index 0000000..cab58d7
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/components/masthead.cs
@@ -0,0 +1,36 @@
+<?cs
+def:custom_masthead() ?>
+ <div id="header">
+ <div id="headerLeft">
+ <a href="<?cs var:toroot?>" tabindex="-1"><img
+ src="<?cs var:toroot ?>assets/images/open_source.png" alt="Android Open Source Project" /></a>
+ <ul class="<?cs if:home ?>home<?cs
+ elif:doc.type == "source" ?>source<?cs
+ elif:doc.type == "porting" ?>porting<?cs
+ elif:doc.type == "compatibility" ?>compatibility<?cs
+ elif:doc.type == "community" ?>community<?cs
+ elif:doc.type == "about" ?>about<?cs /if ?>">
+ <li id="home-link"><a href="<?cs var:toroot ?>index.html"><span>Home</span></a></li>
+ <li id="source-link"><a href="<?cs var:toroot ?>source/index.html"
+ onClick="return loadLast('source')"><span>Source</span></a></li>
+ <li id="porting-link"><a href="<?cs var:toroot ?>porting/index.html"
+ onClick="return loadLast('porting')"><span>Porting</span></a></li>
+ <li id="compatibility-link"><a href="<?cs var:toroot ?>compatibility/index.html"
+ onClick="return loadLast('compatibility')"><span>Compatibility</span></a></li>
+ <li id="community-link"><a href="<?cs var:toroot ?>community/index.html"
+ onClick="return loadLast('community')"><span>Community</span></a></li>
+ <li id="about-link"><a href="<?cs var:toroot ?>about/index.html"
+ onClick="return loadLast('about')"><span>About</span></a></li>
+ </ul>
+ </div>
+ <div id="headerRight">
+ <div id="headerLinks">
+ <!-- <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" /> -->
+ <span class="text">
+ <!-- <a href="#">English</a> | -->
+ <a href="http://www.android.com">Android.com</a>
+ </span>
+ </div>
+ </div><!-- headerRight -->
+ </div><!-- header --><?cs
+/def ?><?cs # custom_masthead ?>
diff --git a/tools/droiddoc/templates-pdk/customization.cs b/tools/droiddoc/templates-pdk/customization.cs
deleted file mode 100644
index 3e9be06..0000000
--- a/tools/droiddoc/templates-pdk/customization.cs
+++ /dev/null
@@ -1,182 +0,0 @@
-<?cs # This file defines custom definitions for the masthead (logo, searchbox, tabs, etc) and
-left nav (toc) that gets placed on all pages, for the open source site?>
-
-<?cs
-def:custom_masthead() ?>
- <div id="header">
- <div id="headerLeft">
- <a href="<?cs var:toroot?>" tabindex="-1"><img
- src="<?cs var:toroot ?>assets/images/open_source.png" alt="Android Open Source Project" /></a>
- <ul class="<?cs if:home ?>home<?cs
- elif:doc.type == "source" ?>source<?cs
- elif:doc.type == "porting" ?>porting<?cs
- elif:doc.type == "compatibility" ?>compatibility<?cs
- elif:doc.type == "downloads" ?>downloads<?cs
- elif:doc.type == "community" ?>community<?cs
- elif:doc.type == "about" ?>about<?cs /if ?>">
- <li id="home-link"><a href="<?cs var:toroot ?>index.html"><span>Home</span></a></li>
- <li id="source-link"><a href="<?cs var:toroot ?>source/index.html"
- onClick="return loadLast('source')"><span>Source</span></a></li>
- <li id="porting-link"><a href="<?cs var:toroot ?>porting/index.html"
- onClick="return loadLast('porting')"><span>Porting</span></a></li>
- <li id="compatibility-link"><a href="<?cs var:toroot ?>compatibility/index.html"
- onClick="return loadLast('compatibility')"><span>Compatibility</span></a></li>
- <li id="community-link"><a href="<?cs var:toroot ?>community/index.html"
- onClick="return loadLast('community')"><span>Community</span></a></li>
- <li id="downloads-link"><a href="<?cs var:toroot ?>downloads/index.html"
- onClick="return loadLast('downloads')"><span>Downloads</span></a></li>
- <li id="about-link"><a href="<?cs var:toroot ?>about/index.html"
- onClick="return loadLast('about')"><span>About</span></a></li>
- </ul>
- </div>
- <div id="headerRight">
- <div id="headerLinks">
- <!-- <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" /> -->
- <span class="text">
- <!-- <a href="#">English</a> | -->
- <a href="http://www.android.com">Android.com</a>
- </span>
- </div>
- </div><!-- headerRight -->
- </div><!-- header --><?cs
-/def ?><?cs # custom_masthead ?>
-
-
-<?cs def:community_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first side-nav-resizable" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../development/pdk/docs/community/community_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
- </div>
-<?cs /def ?>
-
-<?cs def:about_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first side-nav-resizable" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../development/pdk/docs/about/about_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
- </div>
-<?cs /def ?>
-
-<?cs def:porting_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first side-nav-resizable" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../development/pdk/docs/porting/porting_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
- </div>
-<?cs /def ?>
-
-<?cs def:source_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first side-nav-resizable" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../development/pdk/docs/source/source_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
- </div>
-<?cs /def ?>
-
-<?cs def:downloads_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first side-nav-resizable" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../development/pdk/docs/downloads/downloads_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
- </div>
-<?cs /def ?>
-
-<?cs def:compatibility_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first side-nav-resizable" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../development/pdk/docs/compatibility/compatibility_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
- </div>
-<?cs /def ?>
-
-<?cs def:custom_left_nav() ?>
- <?cs if:doc.hidenav != "true" ?>
- <?cs if:doc.type == "source" ?>
- <?cs call:source_nav() ?>
- <?cs elif:doc.type == "porting" ?>
- <?cs call:porting_nav() ?>
- <?cs elif:doc.type == "compatibility" ?>
- <?cs call:compatibility_nav() ?>
- <?cs elif:doc.type == "downloads" ?>
- <?cs call:downloads_nav() ?>
- <?cs elif:doc.type == "community" ?>
- <?cs call:community_nav() ?>
- <?cs elif:doc.type == "about" ?>
- <?cs call:about_nav() ?>
- <?cs /if ?>
- <?cs /if ?>
-<?cs /def ?>
-
-<?cs # appears at the bottom of every page ?><?cs
-def:custom_cc_copyright() ?>
- Except as noted, this content is
- licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
- Creative Commons Attribution 2.5</a>. For details and
- restrictions, see the <a href="http://developer.android.com/license.html">Content
- License</a>.<?cs
-/def ?>
-
-<?cs
-def:custom_copyright() ?>
- Except as noted, this content is licensed under <a
- href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
- For details and restrictions, see the <a href="http://developer.android.com/license.html">
- Content License</a>.<?cs
-/def ?>
-
-<?cs
-def:custom_footerlinks() ?>
- <p>
- <a href="http://www.android.com/terms.html">Site Terms of Service</a> -
- <a href="http://www.android.com/privacy.html">Privacy Policy</a> -
- <a href="http://www.android.com/branding.html">Brand Guidelines</a>
- </p><?cs
-/def ?>
-
-<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
-def:custom_buildinfo() ?>
- Android <?cs var:sdk.platform.version ?> r<?cs var:sdk.rel.id ?> - <?cs var:page.now ?>
-<?cs /def ?>
diff --git a/tools/droiddoc/templates-pdk/customizations.cs b/tools/droiddoc/templates-pdk/customizations.cs
new file mode 100644
index 0000000..b0f90a7
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/customizations.cs
@@ -0,0 +1,91 @@
+<?cs # This file defines custom definitions for the masthead (logo, searchbox, tabs, etc) and
+left nav (toc) that gets placed on all pages, for the open source site. See also the components/
+directory. ?>
+
+<?cs def:community_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first side-nav-resizable" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../development/pdk/docs/community/community_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ addLoadEvent(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+ </div>
+<?cs /def ?>
+<?cs def:about_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first side-nav-resizable" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../development/pdk/docs/about/about_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ addLoadEvent(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+ </div>
+<?cs /def ?>
+<?cs def:porting_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first side-nav-resizable" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../development/pdk/docs/porting/porting_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ addLoadEvent(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+ </div>
+<?cs /def ?>
+<?cs def:source_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first side-nav-resizable" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../development/pdk/docs/source/source_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ addLoadEvent(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+ </div>
+<?cs /def ?>
+<?cs def:compatibility_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first side-nav-resizable" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../development/pdk/docs/compatibility/compatibility_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ addLoadEvent(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+ </div>
+<?cs /def ?>
+<?cs def:custom_cc_copyright() ?>
+<?cs /def ?>
+
+<?cs def:custom_copyright() ?>
+<?cs /def ?>
+
+<?cs
+def:custom_footerlinks() ?>
+ <p>
+ <a href="http://www.android.com/terms.html">Site Terms of Service</a> -
+ <a href="http://www.android.com/privacy.html">Privacy Policy</a>
+ </p><?cs
+/def ?>
+
+<?cs # appears on the right side of the blue bar at the bottom off every page ?>
+<?cs def:custom_buildinfo() ?>
+<?cs /def ?>
diff --git a/tools/droiddoc/templates/footer.cs b/tools/droiddoc/templates-pdk/footer.cs
similarity index 100%
rename from tools/droiddoc/templates/footer.cs
rename to tools/droiddoc/templates-pdk/footer.cs
diff --git a/tools/droiddoc/templates-pdk/head_tag.cs b/tools/droiddoc/templates-pdk/head_tag.cs
index 915dc0e..cccbb14 100644
--- a/tools/droiddoc/templates-pdk/head_tag.cs
+++ b/tools/droiddoc/templates-pdk/head_tag.cs
@@ -1,6 +1,6 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>assets-pdk/favicon.ico" />
+<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>assets/favicon.ico" />
<title><?cs
if:page.title ?><?cs
var:page.title ?><?cs
@@ -9,7 +9,7 @@
/if ?> | <?cs
/if ?>Android Open Source</title>
<link href="<?cs var:toroot ?>assets/android-developer-docs-devguide.css" rel="stylesheet" type="text/css" />
-<link href="<?cs var:toroot ?>assets-pdk/pdk-local.css" rel="stylesheet" type="text/css" />
+<!-- <link href="<?cs var:toroot ?>assets-pdk/pdk-local.css" rel="stylesheet" type="text/css" /> -->
<script src="<?cs var:toroot ?>assets/search_autocomplete.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/android-developer-docs.js" type="text/javascript"></script>
@@ -28,7 +28,7 @@
}
}
</script>
-<script type="text/javascript>
+<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("pre").addClass("prettyprint");
});
diff --git a/tools/droiddoc/templates/trailer.cs b/tools/droiddoc/templates-pdk/trailer.cs
similarity index 100%
rename from tools/droiddoc/templates/trailer.cs
rename to tools/droiddoc/templates-pdk/trailer.cs
diff --git a/tools/droiddoc/templates-sdk/assets-sdk/placeholder b/tools/droiddoc/templates-sdk/assets-sdk/placeholder
deleted file mode 100644
index e69de29..0000000
--- a/tools/droiddoc/templates-sdk/assets-sdk/placeholder
+++ /dev/null
diff --git a/tools/droiddoc/templates/assets/android-developer-core.css b/tools/droiddoc/templates-sdk/assets/android-developer-core.css
similarity index 99%
rename from tools/droiddoc/templates/assets/android-developer-core.css
rename to tools/droiddoc/templates-sdk/assets/android-developer-core.css
index 40ab2fd..37acc23 100644
--- a/tools/droiddoc/templates/assets/android-developer-core.css
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-core.css
@@ -197,7 +197,7 @@
#body-content {
/* "Preliminary" watermark for preview releases and interim builds.
- background:transparent url(images/preliminary.png) repeat scroll 0 0; */
+ background:transparent url(images/preliminary.png) repeat scroll 0 0; */
margin:0;
position:relative;
width:100%;
diff --git a/tools/droiddoc/templates/assets/android-developer-docs-devguide.css b/tools/droiddoc/templates-sdk/assets/android-developer-docs-devguide.css
similarity index 100%
copy from tools/droiddoc/templates/assets/android-developer-docs-devguide.css
copy to tools/droiddoc/templates-sdk/assets/android-developer-docs-devguide.css
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates-sdk/assets/android-developer-docs.css
similarity index 95%
rename from tools/droiddoc/templates/assets/android-developer-docs.css
rename to tools/droiddoc/templates-sdk/assets/android-developer-docs.css
index 1672c93..c8699c5 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-docs.css
@@ -61,7 +61,7 @@
}
#side-nav ul ul {
- margin: .35em 0 0 0;
+ margin: .5em 0 0 0;
padding: 0;
}
@@ -517,16 +517,24 @@
}
#jd-content h3 {
- font-size:1.2em;
- color:#222;
- padding: .75em 0 .65em 0;
- margin:0;
+ font-size:1.3em;
+ color:#3a3a3a;
+ padding: 0;
+ margin: 1.5em 0 .65em 0;
}
#jd-content h4 {
font-size:1.1em;
- margin-bottom:.5em;
- color:#222;
+ color:#3a3a3a;
+ padding: 0;
+ margin: 1.25em 0 .65em 0;
+}
+
+#jd-content h5 {
+ font-size:1.0em;
+ color:#3a3a3a;
+ padding: 0;
+ margin: 1em 0 .65em 0;
}
#jd-content .small-header {
@@ -688,22 +696,6 @@
-webkit-border-radius:5px;
}
-.toggle-content-toggleme {
- display:none;
-}
-
-.toggle-content-button {
- font-size:.9em;
- line-height:.9em;
- text-decoration:none;
- position:relative;
- top:5px;
-}
-
-.toggle-content-button:hover {
- text-decoration:underline;
-}
-
div.special p {
margin: .5em 0 0 0;
}
@@ -756,11 +748,21 @@
border-color: #ffcf00;
}
-li p.note, li p.warning {
+li .note,
+li .caution,
+li .warning {
margin: .5em 0 0 0;
padding: .2em .5em .2em .9em;
}
+/* Makes sure the first paragraph does not add top-whitespace within the box*/
+li .note>p:first-child,
+li .caution>p:first-child,
+li .warning>p:first-child {
+ margin-top:0;
+ padding-top:0;
+}
+
dl.xml dt {
font-variant:small-caps;
font-size:1.2em;
@@ -789,7 +791,8 @@
padding-left:1em;
}
-.new {
+.new,
+.new-child {
font-size: .78em;
font-weight: bold;
color: #ff3d3d;
@@ -798,6 +801,10 @@
line-height:.9em;
}
+.toggle-list.open .new-child {
+ display:none;
+}
+
pre.classic {
background-color:transparent;
border:none;
@@ -830,6 +837,27 @@
margin: 0 0 0.5em 1em; /* matches default table left-margin */
}
+
+/* toggle for misc content (such as long sample code)
+ see toggleContent() script in android-developer-docs.js */
+.toggle-content.closed .toggle-content-toggleme {
+ display:none;
+}
+
+.toggle-content a[href="#"] {
+ text-decoration:none;
+ color:inherit;
+}
+
+.toggle-content-toggleme {
+ padding-bottom:1px; /* fixes animation bounce due to margins */
+}
+
+#jd-content .toggle-content img.toggle-content-img {
+ margin:0;
+}
+
+
/* BEGIN quickview sidebar element styles */
#qv-wrapper {
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
similarity index 77%
rename from tools/droiddoc/templates/assets/android-developer-docs.js
rename to tools/droiddoc/templates-sdk/assets/android-developer-docs.js
index 5262bd8..97b831a 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.js
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
@@ -27,10 +27,10 @@
var agent = navigator['userAgent'].toLowerCase();
// If a mobile phone, set flag and do mobile setup
-if ((agent.indexOf("mobile") != -1) || // android, iphone, ipod
+if ((agent.indexOf("mobile") != -1) || // android, iphone, ipod
(agent.indexOf("blackberry") != -1) ||
(agent.indexOf("webos") != -1) ||
- (agent.indexOf("mini") != -1)) { // opera mini browsers
+ (agent.indexOf("mini") != -1)) { // opera mini browsers
isMobile = true;
addLoadEvent(mobileSetup);
// If not a mobile browser, set the onresize event for IE6, and others
@@ -126,7 +126,7 @@
expiration = date.toGMTString();
}
document.cookie = cookie_namespace + section + cookie + "=" + val + "; expires=" + expiration+"; path=/";
-}
+}
function init() {
$("#side-nav").css({position:"absolute",left:0});
@@ -164,11 +164,84 @@
}
}
- if (devdocNav.length) { // only dev guide and sdk
- highlightNav(location.href);
+ if (devdocNav.length) { // only dev guide, resources, and sdk
+ tryPopulateResourcesNav();
+ highlightNav(location.href);
}
}
+function tryPopulateResourcesNav() {
+ var sampleList = $('#devdoc-nav-sample-list');
+ var articleList = $('#devdoc-nav-article-list');
+ var tutorialList = $('#devdoc-nav-tutorial-list');
+ var topicList = $('#devdoc-nav-topic-list');
+
+ if (!topicList.length || !ANDROID_TAGS || !ANDROID_RESOURCES)
+ return;
+
+ var topics = [];
+ for (var topic in ANDROID_TAGS['topic']) {
+ topics.push({name:topic,title:ANDROID_TAGS['topic'][topic]});
+ }
+ topics.sort(function(x,y){ return (x.title < y.title) ? -1 : 1; });
+ for (var i = 0; i < topics.length; i++) {
+ topicList.append(
+ $('<li>').append(
+ $('<a>')
+ .attr('href', toRoot + "resources/browser.html?tag=" + topics[i].name)
+ .append($('<span>')
+ .addClass('en')
+ .html(topics[i].title)
+ )
+ )
+ );
+ }
+
+ var _renderResourceList = function(tag, listNode) {
+ var resources = [];
+ var tags;
+ var resource;
+ var i, j;
+ for (i = 0; i < ANDROID_RESOURCES.length; i++) {
+ resource = ANDROID_RESOURCES[i];
+ tags = resource.tags || [];
+ var hasTag = false;
+ for (j = 0; j < tags.length; j++)
+ if (tags[j] == tag) {
+ hasTag = true;
+ break;
+ }
+ if (!hasTag)
+ continue;
+ resources.push(resource);
+ }
+ //resources.sort(function(x,y){ return (x.title.en < y.title.en) ? -1 : 1; });
+ for (i = 0; i < resources.length; i++) {
+ resource = resources[i];
+ var listItemNode = $('<li>').append(
+ $('<a>')
+ .attr('href', toRoot + "resources/" + resource.path)
+ .append($('<span>')
+ .addClass('en')
+ .html(resource.title.en)
+ )
+ );
+ tags = resource.tags || [];
+ for (j = 0; j < tags.length; j++) {
+ if (tags[j] == 'new') {
+ listItemNode.get(0).innerHTML += ' <span class="new">new!</span>';
+ break;
+ }
+ }
+ listNode.append(listItemNode);
+ }
+ };
+
+ _renderResourceList('sample', sampleList);
+ _renderResourceList('article', articleList);
+ _renderResourceList('tutorial', tutorialList);
+}
+
function highlightNav(fullPageName) {
var lastSlashPos = fullPageName.lastIndexOf("/");
var firstSlashPos;
@@ -182,17 +255,23 @@
if (lastSlashPos == (fullPageName.length - 1)) { // if the url ends in slash (add 'index.html')
fullPageName = fullPageName + "index.html";
}
- var htmlPos = fullPageName.lastIndexOf(".html", fullPageName.length);
- var pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5);
+ // First check if the exact URL, with query string and all, is in the navigation menu
+ var pathPageName = fullPageName.substr(firstSlashPos);
var link = $("#devdoc-nav a[href$='"+ pathPageName+"']");
- if ((link.length == 0) && ((fullPageName.indexOf("/guide/") != -1) || (fullPageName.indexOf("/resources/") != -1))) {
-// if there's no match, then let's backstep through the directory until we find an index.html page that matches our ancestor directories (only for dev guide and resources)
- lastBackstep = pathPageName.lastIndexOf("/");
- while (link.length == 0) {
- backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep);
- link = $("#devdoc-nav a[href$='"+ pathPageName.slice(0, backstepDirectory + 1)+"index.html']");
- lastBackstep = pathPageName.lastIndexOf("/", lastBackstep - 1);
- if (lastBackstep == 0) break;
+ if (link.length == 0) {
+ var htmlPos = fullPageName.lastIndexOf(".html", fullPageName.length);
+ pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5); // +5 advances past ".html"
+ link = $("#devdoc-nav a[href$='"+ pathPageName+"']");
+ if ((link.length == 0) && ((fullPageName.indexOf("/guide/") != -1) || (fullPageName.indexOf("/resources/") != -1))) {
+ // if there's no match, then let's backstep through the directory until we find an index.html page
+ // that matches our ancestor directories (only for dev guide and resources)
+ lastBackstep = pathPageName.lastIndexOf("/");
+ while (link.length == 0) {
+ backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep);
+ link = $("#devdoc-nav a[href$='"+ pathPageName.slice(0, backstepDirectory + 1)+"index.html']");
+ lastBackstep = pathPageName.lastIndexOf("/", lastBackstep - 1);
+ if (lastBackstep == 0) break;
+ }
}
}
@@ -437,12 +516,12 @@
function changeTabLang(lang) {
var nodes = $("#header-tabs").find("."+lang);
- for (i=0; i < nodes.length; i++) { // for each node in this language
+ for (i=0; i < nodes.length; i++) { // for each node in this language
var node = $(nodes[i]);
- node.siblings().css("display","none"); // hide all siblings
- if (node.not(":empty").length != 0) { //if this languages node has a translation, show it
+ node.siblings().css("display","none"); // hide all siblings
+ if (node.not(":empty").length != 0) { //if this languages node has a translation, show it
node.css("display","inline");
- } else { //otherwise, show English instead
+ } else { //otherwise, show English instead
node.css("display","none");
node.siblings().filter(".en").css("display","inline");
}
@@ -451,12 +530,12 @@
function changeNavLang(lang) {
var nodes = $("#side-nav").find("."+lang);
- for (i=0; i < nodes.length; i++) { // for each node in this language
+ for (i=0; i < nodes.length; i++) { // for each node in this language
var node = $(nodes[i]);
- node.siblings().css("display","none"); // hide all siblings
- if (node.not(":empty").length != 0) { // if this languages node has a translation, show it
+ node.siblings().css("display","none"); // hide all siblings
+ if (node.not(":empty").length != 0) { // if this languages node has a translation, show it
node.css("display","inline");
- } else { // otherwise, show English instead
+ } else { // otherwise, show English instead
node.css("display","none");
node.siblings().filter(".en").css("display","inline");
}
@@ -496,16 +575,22 @@
}
+/* Used to hide and reveal supplemental content, such as long code samples.
+ See the companion CSS in android-developer-docs.css */
function toggleContent(obj) {
- var button = $(obj);
- var div = $(obj.parentNode);
+ var div = $(obj.parentNode.parentNode);
var toggleMe = $(".toggle-content-toggleme",div);
- if (button.hasClass("show")) {
+ if (div.hasClass("closed")) { // if it's closed, open it
toggleMe.slideDown();
- button.removeClass("show").addClass("hide");
- } else {
- toggleMe.slideUp();
- button.removeClass("hide").addClass("show");
+ $(".toggle-content-text", obj).toggle();
+ div.removeClass("closed").addClass("open");
+ $(".toggle-content-img", div).attr("title", "hide").attr("src", toRoot + "assets/images/triangle-opened.png");
+ } else { // if it's open, close it
+ toggleMe.slideUp('fast', function() { // Wait until the animation is done before closing arrow
+ $(".toggle-content-text", obj).toggle();
+ div.removeClass("open").addClass("closed");
+ $(".toggle-content-img", div).attr("title", "show").attr("src", toRoot + "assets/images/triangle-closed.png");
+ });
}
- $("span", button).toggle();
+ return false;
}
diff --git a/tools/droiddoc/templates/assets/android-developer-reference.js b/tools/droiddoc/templates-sdk/assets/android-developer-reference.js
similarity index 100%
rename from tools/droiddoc/templates/assets/android-developer-reference.js
rename to tools/droiddoc/templates-sdk/assets/android-developer-reference.js
diff --git a/tools/droiddoc/templates-sdk/assets/android-developer-resource-browser.css b/tools/droiddoc/templates-sdk/assets/android-developer-resource-browser.css
new file mode 100644
index 0000000..a454caa
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-resource-browser.css
@@ -0,0 +1,31 @@
+/* Resource Browser */
+
+#resource-browser-results .no-results {
+ font-style: italic;
+ display: none;
+}
+
+#resource-browser-results .result {
+ position: relative;
+ padding-left: 84px;
+ background: transparent none no-repeat scroll 4px 12px;
+ border-bottom: 1px solid #ddd;
+}
+
+#resource-browser-results .tagged-article {
+ background-image: url(images/resource-article.png);
+}
+
+#resource-browser-results .tagged-sample {
+ background-image: url(images/resource-sample.png);
+}
+
+#resource-browser-results .tagged-tutorial {
+ background-image: url(images/resource-tutorial.png);
+}
+
+#resource-browser-results .resource-meta {
+ margin-top: -1em;
+ font-size: 0.85em;
+ font-weight: normal;
+}
diff --git a/tools/droiddoc/templates-sdk/assets/android-developer-resource-browser.js b/tools/droiddoc/templates-sdk/assets/android-developer-resource-browser.js
new file mode 100644
index 0000000..dc65aa2
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-resource-browser.js
@@ -0,0 +1,235 @@
+(function() { // anonymize
+
+var allTags = {};
+var loadedResults = [];
+
+/**
+ * Initialization code run upon the DOM being ready.
+ */
+$(document).ready(function() {
+ // Parse page query parameters.
+ var params = parseParams(document.location.search);
+ params.tag = params.tag ? makeArray(params.tag) : null;
+
+ // Load tag and resource dataset.
+ loadTags();
+ loadResources();
+
+ showResults(params);
+
+ // Watch for keypresses in the keyword filter textbox, and update
+ // search results to reflect the keyword filter.
+ $('#resource-browser-keyword-filter').keyup(function() {
+ // Filter results on screen by keyword.
+ var keywords = $(this).val().split(/\s+/g);
+ for (var i = 0; i < loadedResults.length; i++) {
+ var hide = false;
+ for (var j = 0; j < keywords.length; j++) {
+ if (!resultMatchesKeyword(loadedResults[i].result, keywords[j])) {
+ hide = true;
+ break;
+ }
+ }
+
+ loadedResults[i].node[hide ? 'hide' : 'show']();
+ }
+ });
+});
+
+/**
+ * Returns whether or not the given search result contains the given keyword.
+ */
+function resultMatchesKeyword(result, keyword) {
+ keyword = keyword.toLowerCase();
+ if (result.title &&
+ result.title.en.toLowerCase().indexOf(keyword) >= 0)
+ return true;
+ else if (result.description &&
+ result.description.en.toLowerCase().indexOf(keyword) >= 0)
+ return true;
+ else if (result.topicsHtml &&
+ result.topicsHtml.replace(/\<.*?\>/g,'').toLowerCase().indexOf(keyword) >= 0)
+ return true;
+ return false;
+}
+
+/**
+ * Populates the allTags array with tag data from the ANDROID_TAGS
+ * variable in the resource data JS file.
+ */
+function loadTags() {
+ for (var tagClass in ANDROID_TAGS) {
+ for (var tag in ANDROID_TAGS[tagClass]) {
+ allTags[tag] = {
+ displayTag: ANDROID_TAGS[tagClass][tag],
+ tagClass: tagClass
+ };
+ }
+ }
+}
+
+/**
+ * Massage the ANDROID_RESOURCES resource list in the resource data JS file.
+ */
+function loadResources() {
+ for (var i = 0; i < ANDROID_RESOURCES.length; i++) {
+ var resource = ANDROID_RESOURCES[i];
+
+ // Convert the tags array to a tags hash for easier querying.
+ resource.tagsHash = {};
+ for (var j = 0; j < resource.tags.length; j++)
+ resource.tagsHash[resource.tags[j]] = true;
+
+ // Determine the type and topics of the resource by inspecting its tags.
+ resource.topics = [];
+ for (tag in resource.tagsHash)
+ if (tag in allTags) {
+ if (allTags[tag].tagClass == 'type') {
+ resource.type = tag;
+ } else if (allTags[tag].tagClass == 'topic') {
+ resource.topics.push(tag);
+ }
+ }
+
+ // Add a humanized topics list string.
+ resource.topicsHtml = humanizeList(resource.topics, function(item) {
+ return '<strong>' + allTags[item].displayTag + '</strong>';
+ });
+ }
+}
+
+/**
+ * Loads resources for the given query parameters.
+ */
+function showResults(params) {
+ loadedResults = [];
+ $('#resource-browser-search-params').empty();
+ $('#resource-browser-results').empty();
+
+ var i, j;
+ var searchTags = [];
+ if (params.tag) {
+ for (i = 0; i < params.tag.length; i++) {
+ var tag = params.tag[i];
+ if (tag.toLowerCase() in allTags) {
+ searchTags.push(tag.toLowerCase());
+ }
+ }
+ }
+
+ if (searchTags.length) {
+ // Show query params.
+ var taggedWithHtml = ['Showing technical resources tagged with '];
+ taggedWithHtml.push(humanizeList(searchTags, function(item) {
+ return '<strong>' + allTags[item].displayTag + '</strong>';
+ }));
+ $('#resource-browser-search-params').html(taggedWithHtml.join('') + ':');
+ } else {
+ $('#resource-browser-search-params').html('Showing all technical resources:');
+ }
+
+ var results = [];
+
+ // Create the list of resources to show.
+ for (i = 0; i < ANDROID_RESOURCES.length; i++) {
+ var resource = ANDROID_RESOURCES[i];
+ var skip = false;
+
+ if (searchTags.length) {
+ for (j = 0; j < searchTags.length; j++)
+ if (!(searchTags[j] in resource.tagsHash)) {
+ skip = true;
+ break;
+ }
+
+ if (skip)
+ continue;
+
+ results.push(resource);
+ continue;
+ }
+
+ results.push(resource);
+ }
+
+ // Format and show the list of resource results.
+ if (results.length) {
+ $('#resource-browser-results .no-results').hide();
+ for (i = 0; i < results.length; i++) {
+ var result = results[i];
+ var resultJqNode = $(tmpl('tmpl_resource_browser_result', result));
+ for (tag in result.tagsHash)
+ resultJqNode.addClass('tagged-' + tag);
+ $('#resource-browser-results').append(resultJqNode);
+
+ loadedResults.push({ node: resultJqNode, result: result });
+ }
+ } else {
+ $('#resource-browser-results .no-results').show();
+ }
+}
+
+/**
+ * Formats the given array into a human readable, English string, ala
+ * 'a, b and c', with an optional item formatter/wrapper function.
+ */
+function humanizeList(arr, itemFormatter) {
+ itemFormatter = itemFormatter || function(o){ return o; };
+ arr = arr || [];
+
+ var out = [];
+ for (var i = 0; i < arr.length; i++) {
+ out.push(itemFormatter(arr[i]) +
+ ((i < arr.length - 2) ? ', ' : '') +
+ ((i == arr.length - 2) ? ' and ' : ''));
+ }
+
+ return out.join('');
+}
+
+/**
+ * Parses a parameter string, i.e. foo=1&bar=2 into
+ * a dictionary object.
+ */
+function parseParams(paramStr) {
+ var params = {};
+ paramStr = paramStr.replace(/^[?#]/, '');
+
+ var pairs = paramStr.split('&');
+ for (var i = 0; i < pairs.length; i++) {
+ var p = pairs[i].split('=');
+ var key = p[0] ? decodeURIComponent(p[0]) : p[0];
+ var val = p[1] ? decodeURIComponent(p[1]) : p[1];
+ if (val === '0')
+ val = 0;
+ if (val === '1')
+ val = 1;
+
+ if (key in params) {
+ // Handle array values.
+ params[key] = makeArray(params[key]);
+ params[key].push(val);
+ } else {
+ params[key] = val;
+ }
+ }
+
+ return params;
+}
+
+/**
+ * Returns the argument as a single-element array, or the argument itself
+ * if it's already an array.
+ */
+function makeArray(o) {
+ if (!o)
+ return [];
+
+ if (typeof o === 'object' && 'splice' in o) {
+ return o;
+ } else {
+ return [o];
+ }
+}
+
+})();
diff --git a/tools/droiddoc/templates/assets/carousel.js b/tools/droiddoc/templates-sdk/assets/carousel.js
similarity index 100%
copy from tools/droiddoc/templates/assets/carousel.js
copy to tools/droiddoc/templates-sdk/assets/carousel.js
diff --git a/tools/droiddoc/templates-sdk/assets/customizations.js b/tools/droiddoc/templates-sdk/assets/customizations.js
new file mode 100644
index 0000000..5258902
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/customizations.js
@@ -0,0 +1,14 @@
+function showApiWarning(thing, selectedLevel, minLevel) {
+ if (selectedLevel < minLevel) {
+ $("#naMessage").show().html("<div><p><strong>This " + thing + " is not available with API Level " + selectedLevel + ".</strong></p>"
+ + "<p>To use this " + thing + ", your application must specify API Level " + minLevel + " or higher in its manifest "
+ + "and be compiled against a version of the Android library that supports an equal or higher API Level. To reveal this "
+ + "document, change the value of the API Level filter above.</p>"
+ + "<p><a href='" +toRoot+ "guide/appendix/api-levels.html'>What is the API Level?</a></p></div>");
+ } else {
+ $("#naMessage").hide();
+ }
+}
+
+// Direct searches to search.html
+HAS_SEARCH_PAGE = true;
diff --git a/tools/droiddoc/templates/assets/images/android-developers-logo.png b/tools/droiddoc/templates-sdk/assets/images/android-developers-logo.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/android-developers-logo.png
copy to tools/droiddoc/templates-sdk/assets/images/android-developers-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/android_wrench.png b/tools/droiddoc/templates-sdk/assets/images/android_wrench.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/android_wrench.png
copy to tools/droiddoc/templates-sdk/assets/images/android_wrench.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_bluelink_down.png b/tools/droiddoc/templates-sdk/assets/images/arrow_bluelink_down.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/arrow_bluelink_down.png
copy to tools/droiddoc/templates-sdk/assets/images/arrow_bluelink_down.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_bluelink_up.png b/tools/droiddoc/templates-sdk/assets/images/arrow_bluelink_up.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/arrow_bluelink_up.png
copy to tools/droiddoc/templates-sdk/assets/images/arrow_bluelink_up.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_left_off.jpg b/tools/droiddoc/templates-sdk/assets/images/arrow_left_off.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/arrow_left_off.jpg
copy to tools/droiddoc/templates-sdk/assets/images/arrow_left_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_left_on.jpg b/tools/droiddoc/templates-sdk/assets/images/arrow_left_on.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/arrow_left_on.jpg
copy to tools/droiddoc/templates-sdk/assets/images/arrow_left_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_right_off.jpg b/tools/droiddoc/templates-sdk/assets/images/arrow_right_off.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/arrow_right_off.jpg
copy to tools/droiddoc/templates-sdk/assets/images/arrow_right_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/arrow_right_on.jpg b/tools/droiddoc/templates-sdk/assets/images/arrow_right_on.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/arrow_right_on.jpg
copy to tools/droiddoc/templates-sdk/assets/images/arrow_right_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_community_leftDiv.jpg b/tools/droiddoc/templates-sdk/assets/images/bg_community_leftDiv.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/bg_community_leftDiv.jpg
copy to tools/droiddoc/templates-sdk/assets/images/bg_community_leftDiv.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_fade.jpg b/tools/droiddoc/templates-sdk/assets/images/bg_fade.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/bg_fade.jpg
copy to tools/droiddoc/templates-sdk/assets/images/bg_fade.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_images_sprite.png b/tools/droiddoc/templates-sdk/assets/images/bg_images_sprite.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/bg_images_sprite.png
copy to tools/droiddoc/templates-sdk/assets/images/bg_images_sprite.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/bg_logo.png b/tools/droiddoc/templates-sdk/assets/images/bg_logo.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/bg_logo.png
copy to tools/droiddoc/templates-sdk/assets/images/bg_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/body-gradient-tab.png b/tools/droiddoc/templates-sdk/assets/images/body-gradient-tab.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/body-gradient-tab.png
copy to tools/droiddoc/templates-sdk/assets/images/body-gradient-tab.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/body-gradient.png b/tools/droiddoc/templates-sdk/assets/images/body-gradient.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/body-gradient.png
copy to tools/droiddoc/templates-sdk/assets/images/body-gradient.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/developers-logo.png b/tools/droiddoc/templates-sdk/assets/images/developers-logo.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/developers-logo.png
copy to tools/droiddoc/templates-sdk/assets/images/developers-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/grad-rule-qv.png b/tools/droiddoc/templates-sdk/assets/images/grad-rule-qv.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/grad-rule-qv.png
copy to tools/droiddoc/templates-sdk/assets/images/grad-rule-qv.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/Android_Dev_Lab_l.png b/tools/droiddoc/templates-sdk/assets/images/home/Android_Dev_Lab_l.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/Android_Dev_Lab_l.png
rename to tools/droiddoc/templates-sdk/assets/images/home/Android_Dev_Lab_l.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/IO-logo.png b/tools/droiddoc/templates-sdk/assets/images/home/IO-logo.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/IO-logo.png
copy to tools/droiddoc/templates-sdk/assets/images/home/IO-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/adc2_l.png b/tools/droiddoc/templates-sdk/assets/images/home/adc2_l.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/adc2_l.png
rename to tools/droiddoc/templates-sdk/assets/images/home/adc2_l.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/adc2_s.png b/tools/droiddoc/templates-sdk/assets/images/home/adc2_s.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/adc2_s.png
rename to tools/droiddoc/templates-sdk/assets/images/home/adc2_s.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/android_adc.png b/tools/droiddoc/templates-sdk/assets/images/home/android_adc.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/android_adc.png
copy to tools/droiddoc/templates-sdk/assets/images/home/android_adc.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_announcement.png b/tools/droiddoc/templates-sdk/assets/images/home/bg_home_announcement.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/bg_home_announcement.png
copy to tools/droiddoc/templates-sdk/assets/images/home/bg_home_announcement.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_bottom.jpg b/tools/droiddoc/templates-sdk/assets/images/home/bg_home_bottom.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/bg_home_bottom.jpg
copy to tools/droiddoc/templates-sdk/assets/images/home/bg_home_bottom.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_carousel.png b/tools/droiddoc/templates-sdk/assets/images/home/bg_home_carousel.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/bg_home_carousel.png
copy to tools/droiddoc/templates-sdk/assets/images/home/bg_home_carousel.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_carousel_board.png b/tools/droiddoc/templates-sdk/assets/images/home/bg_home_carousel_board.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/bg_home_carousel_board.png
copy to tools/droiddoc/templates-sdk/assets/images/home/bg_home_carousel_board.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/bg_home_carousel_wheel.png b/tools/droiddoc/templates-sdk/assets/images/home/bg_home_carousel_wheel.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/bg_home_carousel_wheel.png
copy to tools/droiddoc/templates-sdk/assets/images/home/bg_home_carousel_wheel.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/carousel_buttons_sprite.png b/tools/droiddoc/templates-sdk/assets/images/home/carousel_buttons_sprite.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/carousel_buttons_sprite.png
copy to tools/droiddoc/templates-sdk/assets/images/home/carousel_buttons_sprite.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/devphone-large.png b/tools/droiddoc/templates-sdk/assets/images/home/devphone-large.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/devphone-large.png
rename to tools/droiddoc/templates-sdk/assets/images/home/devphone-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/devphone-small.png b/tools/droiddoc/templates-sdk/assets/images/home/devphone-small.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/devphone-small.png
rename to tools/droiddoc/templates-sdk/assets/images/home/devphone-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/donut-android.png b/tools/droiddoc/templates-sdk/assets/images/home/donut-android.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/donut-android.png
copy to tools/droiddoc/templates-sdk/assets/images/home/donut-android.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/eclair-android.png b/tools/droiddoc/templates-sdk/assets/images/home/eclair-android.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/eclair-android.png
copy to tools/droiddoc/templates-sdk/assets/images/home/eclair-android.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/froyo-android.png b/tools/droiddoc/templates-sdk/assets/images/home/froyo-android.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/froyo-android.png
rename to tools/droiddoc/templates-sdk/assets/images/home/froyo-android.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/gdc-logo.png b/tools/droiddoc/templates-sdk/assets/images/home/gdc-logo.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/gdc-logo.png
rename to tools/droiddoc/templates-sdk/assets/images/home/gdc-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/gingerdroid.png b/tools/droiddoc/templates-sdk/assets/images/home/gingerdroid.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/gingerdroid.png
rename to tools/droiddoc/templates-sdk/assets/images/home/gingerdroid.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/home/honeycomb-android.png b/tools/droiddoc/templates-sdk/assets/images/home/honeycomb-android.png
new file mode 100644
index 0000000..6cc5031
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/home/honeycomb-android.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/io-large.png b/tools/droiddoc/templates-sdk/assets/images/home/io-large.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/io-large.png
copy to tools/droiddoc/templates-sdk/assets/images/home/io-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/io-small.png b/tools/droiddoc/templates-sdk/assets/images/home/io-small.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/io-small.png
copy to tools/droiddoc/templates-sdk/assets/images/home/io-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/maps-large.png b/tools/droiddoc/templates-sdk/assets/images/home/maps-large.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/maps-large.png
copy to tools/droiddoc/templates-sdk/assets/images/home/maps-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/maps-small.png b/tools/droiddoc/templates-sdk/assets/images/home/maps-small.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/maps-small.png
copy to tools/droiddoc/templates-sdk/assets/images/home/maps-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/market-large.png b/tools/droiddoc/templates-sdk/assets/images/home/market-large.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/market-large.png
copy to tools/droiddoc/templates-sdk/assets/images/home/market-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/market-small.png b/tools/droiddoc/templates-sdk/assets/images/home/market-small.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/market-small.png
copy to tools/droiddoc/templates-sdk/assets/images/home/market-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/sdk-large.png b/tools/droiddoc/templates-sdk/assets/images/home/sdk-large.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/sdk-large.png
copy to tools/droiddoc/templates-sdk/assets/images/home/sdk-large.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/sdk-small.png b/tools/droiddoc/templates-sdk/assets/images/home/sdk-small.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/home/sdk-small.png
copy to tools/droiddoc/templates-sdk/assets/images/home/sdk-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/tv_l.png b/tools/droiddoc/templates-sdk/assets/images/home/tv_l.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/tv_l.png
rename to tools/droiddoc/templates-sdk/assets/images/home/tv_l.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/home/tv_s.png b/tools/droiddoc/templates-sdk/assets/images/home/tv_s.png
similarity index 100%
rename from tools/droiddoc/templates/assets/images/home/tv_s.png
rename to tools/droiddoc/templates-sdk/assets/images/home/tv_s.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/hr_gray_main.jpg b/tools/droiddoc/templates-sdk/assets/images/hr_gray_main.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/hr_gray_main.jpg
copy to tools/droiddoc/templates-sdk/assets/images/hr_gray_main.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/hr_gray_side.jpg b/tools/droiddoc/templates-sdk/assets/images/hr_gray_side.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/hr_gray_side.jpg
copy to tools/droiddoc/templates-sdk/assets/images/hr_gray_side.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_contribute.jpg b/tools/droiddoc/templates-sdk/assets/images/icon_contribute.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/icon_contribute.jpg
copy to tools/droiddoc/templates-sdk/assets/images/icon_contribute.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_download.jpg b/tools/droiddoc/templates-sdk/assets/images/icon_download.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/icon_download.jpg
copy to tools/droiddoc/templates-sdk/assets/images/icon_download.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_download2.jpg b/tools/droiddoc/templates-sdk/assets/images/icon_download2.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/icon_download2.jpg
copy to tools/droiddoc/templates-sdk/assets/images/icon_download2.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_guidelines_logo.png b/tools/droiddoc/templates-sdk/assets/images/icon_guidelines_logo.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/icon_guidelines_logo.png
copy to tools/droiddoc/templates-sdk/assets/images/icon_guidelines_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_market.jpg b/tools/droiddoc/templates-sdk/assets/images/icon_market.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/icon_market.jpg
copy to tools/droiddoc/templates-sdk/assets/images/icon_market.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_robot.jpg b/tools/droiddoc/templates-sdk/assets/images/icon_robot.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/icon_robot.jpg
copy to tools/droiddoc/templates-sdk/assets/images/icon_robot.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/icon_world.jpg b/tools/droiddoc/templates-sdk/assets/images/icon_world.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/icon_world.jpg
copy to tools/droiddoc/templates-sdk/assets/images/icon_world.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/left_off.jpg b/tools/droiddoc/templates-sdk/assets/images/left_off.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/left_off.jpg
copy to tools/droiddoc/templates-sdk/assets/images/left_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/left_on.jpg b/tools/droiddoc/templates-sdk/assets/images/left_on.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/left_on.jpg
copy to tools/droiddoc/templates-sdk/assets/images/left_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/logo_breadcrumbz.jpg b/tools/droiddoc/templates-sdk/assets/images/logo_breadcrumbz.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/logo_breadcrumbz.jpg
copy to tools/droiddoc/templates-sdk/assets/images/logo_breadcrumbz.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/open_source.png b/tools/droiddoc/templates-sdk/assets/images/open_source.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/open_source.png
copy to tools/droiddoc/templates-sdk/assets/images/open_source.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/preliminary.png b/tools/droiddoc/templates-sdk/assets/images/preliminary.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/preliminary.png
copy to tools/droiddoc/templates-sdk/assets/images/preliminary.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-e.gif b/tools/droiddoc/templates-sdk/assets/images/resizable-e.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/images/resizable-e.gif
copy to tools/droiddoc/templates-sdk/assets/images/resizable-e.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-e2.gif b/tools/droiddoc/templates-sdk/assets/images/resizable-e2.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/images/resizable-e2.gif
copy to tools/droiddoc/templates-sdk/assets/images/resizable-e2.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-eg.gif b/tools/droiddoc/templates-sdk/assets/images/resizable-eg.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/images/resizable-eg.gif
copy to tools/droiddoc/templates-sdk/assets/images/resizable-eg.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-s.gif b/tools/droiddoc/templates-sdk/assets/images/resizable-s.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/images/resizable-s.gif
copy to tools/droiddoc/templates-sdk/assets/images/resizable-s.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-s2.gif b/tools/droiddoc/templates-sdk/assets/images/resizable-s2.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/images/resizable-s2.gif
copy to tools/droiddoc/templates-sdk/assets/images/resizable-s2.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/resizable-sg.gif b/tools/droiddoc/templates-sdk/assets/images/resizable-sg.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/images/resizable-sg.gif
copy to tools/droiddoc/templates-sdk/assets/images/resizable-sg.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-article.png b/tools/droiddoc/templates-sdk/assets/images/resource-article.png
new file mode 100644
index 0000000..416493f
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-article.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-big-article.png b/tools/droiddoc/templates-sdk/assets/images/resource-big-article.png
new file mode 100644
index 0000000..7273275
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-big-article.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-big-sample.png b/tools/droiddoc/templates-sdk/assets/images/resource-big-sample.png
new file mode 100644
index 0000000..59b6b68
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-big-sample.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-big-tutorial.png b/tools/droiddoc/templates-sdk/assets/images/resource-big-tutorial.png
new file mode 100644
index 0000000..c32e89a
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-big-tutorial.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-big-video.png b/tools/droiddoc/templates-sdk/assets/images/resource-big-video.png
new file mode 100644
index 0000000..59d46a0
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-big-video.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-sample.png b/tools/droiddoc/templates-sdk/assets/images/resource-sample.png
new file mode 100644
index 0000000..f7a411c
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-sample.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-tutorial.png b/tools/droiddoc/templates-sdk/assets/images/resource-tutorial.png
new file mode 100644
index 0000000..10a14fe
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-tutorial.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-video.png b/tools/droiddoc/templates-sdk/assets/images/resource-video.png
new file mode 100644
index 0000000..8fd5cae
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-video.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/right_off.jpg b/tools/droiddoc/templates-sdk/assets/images/right_off.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/right_off.jpg
rename to tools/droiddoc/templates-sdk/assets/images/right_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/right_on.jpg b/tools/droiddoc/templates-sdk/assets/images/right_on.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/right_on.jpg
rename to tools/droiddoc/templates-sdk/assets/images/right_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/sidenav-rule.png b/tools/droiddoc/templates-sdk/assets/images/sidenav-rule.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/sidenav-rule.png
copy to tools/droiddoc/templates-sdk/assets/images/sidenav-rule.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_1.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_1.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_1.jpg
rename to tools/droiddoc/templates-sdk/assets/images/slide_1.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_2.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_2.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_2.jpg
rename to tools/droiddoc/templates-sdk/assets/images/slide_2.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_3.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_3.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_3.jpg
rename to tools/droiddoc/templates-sdk/assets/images/slide_3.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_large_1.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_large_1.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_large_1.jpg
rename to tools/droiddoc/templates-sdk/assets/images/slide_large_1.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_large_2.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_large_2.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_large_2.jpg
rename to tools/droiddoc/templates-sdk/assets/images/slide_large_2.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_large_3.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_large_3.jpg
similarity index 100%
rename from tools/droiddoc/templates/assets/images/slide_large_3.jpg
rename to tools/droiddoc/templates-sdk/assets/images/slide_large_3.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_off.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_off.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/slide_off.jpg
copy to tools/droiddoc/templates-sdk/assets/images/slide_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/slide_on.jpg b/tools/droiddoc/templates-sdk/assets/images/slide_on.jpg
similarity index 100%
copy from tools/droiddoc/templates/assets/images/slide_on.jpg
copy to tools/droiddoc/templates-sdk/assets/images/slide_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/spacer.gif b/tools/droiddoc/templates-sdk/assets/images/spacer.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/images/spacer.gif
copy to tools/droiddoc/templates-sdk/assets/images/spacer.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-closed-small.png b/tools/droiddoc/templates-sdk/assets/images/triangle-closed-small.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/triangle-closed-small.png
copy to tools/droiddoc/templates-sdk/assets/images/triangle-closed-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-closed.png b/tools/droiddoc/templates-sdk/assets/images/triangle-closed.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/triangle-closed.png
copy to tools/droiddoc/templates-sdk/assets/images/triangle-closed.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-opened-small.png b/tools/droiddoc/templates-sdk/assets/images/triangle-opened-small.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/triangle-opened-small.png
copy to tools/droiddoc/templates-sdk/assets/images/triangle-opened-small.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/triangle-opened.png b/tools/droiddoc/templates-sdk/assets/images/triangle-opened.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/triangle-opened.png
copy to tools/droiddoc/templates-sdk/assets/images/triangle-opened.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/uiguidelines1.png b/tools/droiddoc/templates-sdk/assets/images/uiguidelines1.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/uiguidelines1.png
copy to tools/droiddoc/templates-sdk/assets/images/uiguidelines1.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/images/video-droid.png b/tools/droiddoc/templates-sdk/assets/images/video-droid.png
similarity index 100%
copy from tools/droiddoc/templates/assets/images/video-droid.png
copy to tools/droiddoc/templates-sdk/assets/images/video-droid.png
Binary files differ
diff --git a/tools/droiddoc/templates/assets/jdiff_logo.gif b/tools/droiddoc/templates-sdk/assets/jdiff_logo.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/jdiff_logo.gif
copy to tools/droiddoc/templates-sdk/assets/jdiff_logo.gif
Binary files differ
diff --git a/tools/droiddoc/templates/assets/jquery-history.js b/tools/droiddoc/templates-sdk/assets/jquery-history.js
similarity index 100%
copy from tools/droiddoc/templates/assets/jquery-history.js
copy to tools/droiddoc/templates-sdk/assets/jquery-history.js
diff --git a/tools/droiddoc/templates/assets/jquery-resizable.min.js b/tools/droiddoc/templates-sdk/assets/jquery-resizable.min.js
similarity index 100%
copy from tools/droiddoc/templates/assets/jquery-resizable.min.js
copy to tools/droiddoc/templates-sdk/assets/jquery-resizable.min.js
diff --git a/tools/droiddoc/templates-sdk/assets/microtemplate.js b/tools/droiddoc/templates-sdk/assets/microtemplate.js
new file mode 100644
index 0000000..ada1235
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/microtemplate.js
@@ -0,0 +1,35 @@
+// Simple JavaScript Templating
+// John Resig - http://ejohn.org/ - MIT Licensed
+(function(){
+ var cache = {};
+
+ this.tmpl = function tmpl(str, data){
+ // Figure out if we're getting a template, or if we need to
+ // load the template - and be sure to cache the result.
+ var fn = !/\W/.test(str) ?
+ cache[str] = cache[str] ||
+ tmpl(document.getElementById(str).innerHTML) :
+
+ // Generate a reusable function that will serve as a template
+ // generator (and which will be cached).
+ new Function("obj",
+ "var p=[],print=function(){p.push.apply(p,arguments);};" +
+
+ // Introduce the data as local variables using with(){}
+ "with(obj){p.push('" +
+
+ // Convert the template into pure JavaScript
+ str
+ .replace(/[\r\t\n]/g, " ")
+ .split("<%").join("\t")
+ .replace(/((^|%>)[^\t]*)'/g, "$1\r")
+ .replace(/\t=(.*?)%>/g, "',$1,'")
+ .split("\t").join("');")
+ .split("%>").join("p.push('")
+ .split("\r").join("\\'")
+ + "');}return p.join('');");
+
+ // Provide some basic currying to the user
+ return data ? fn( data ) : fn;
+ };
+})();
\ No newline at end of file
diff --git a/tools/droiddoc/templates/assets/prettify.js b/tools/droiddoc/templates-sdk/assets/prettify.js
similarity index 100%
copy from tools/droiddoc/templates/assets/prettify.js
copy to tools/droiddoc/templates-sdk/assets/prettify.js
diff --git a/tools/droiddoc/templates/assets/search_autocomplete.js b/tools/droiddoc/templates-sdk/assets/search_autocomplete.js
similarity index 100%
copy from tools/droiddoc/templates/assets/search_autocomplete.js
copy to tools/droiddoc/templates-sdk/assets/search_autocomplete.js
diff --git a/tools/droiddoc/templates/assets/style.css b/tools/droiddoc/templates-sdk/assets/style.css
similarity index 100%
copy from tools/droiddoc/templates/assets/style.css
copy to tools/droiddoc/templates-sdk/assets/style.css
diff --git a/tools/droiddoc/templates/assets/triangle-none.gif b/tools/droiddoc/templates-sdk/assets/triangle-none.gif
similarity index 100%
copy from tools/droiddoc/templates/assets/triangle-none.gif
copy to tools/droiddoc/templates-sdk/assets/triangle-none.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs
new file mode 100644
index 0000000..e521489
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/components/masthead.cs
@@ -0,0 +1,60 @@
+<?cs def:custom_masthead() ?>
+ <div id="header">
+ <div id="headerLeft">
+ <a href="<?cs var:toroot ?>index.html" tabindex="-1"><img
+ src="<?cs var:toroot ?>assets/images/bg_logo.png" alt="Android Developers" /></a>
+ <?cs include:"header_tabs.cs" ?> <?cs # The links are extracted so we can better manage localization ?>
+ </div>
+ <div id="headerRight">
+ <div id="headerLinks">
+ <?cs if:template.showLanguageMenu ?>
+ <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="Language:" />
+ <span id="language">
+ <select name="language" onChange="changeLangPref(this.value, true)">
+ <option value="en">English </option>
+ <option value="ja">日本語</option>
+ <?cs #
+ <option value="de">Deutsch</option>
+ <option value="es">Español</option>
+ <option value="fr">Français</option>
+ <option value="it">Italiano</option>
+ <option value="zh-CN">中文 (简体)</option>
+ <option value="zh-TW">中文 (繁體)</option>
+ ?>
+ </select>
+ <script type="text/javascript">
+ <!--
+ loadLangPref();
+ //-->
+ </script>
+ </span>
+ <?cs /if ?>
+ <a href="http://www.android.com">Android.com</a>
+ </div><?cs
+ call:default_search_box() ?><?cs
+ if:reference ?>
+ <div id="api-level-toggle">
+ <input type="checkbox" id="apiLevelCheckbox" onclick="toggleApiLevelSelector(this)" />
+ <label for="apiLevelCheckbox" class="disabled">Filter by API Level: </label>
+ <select id="apiLevelSelector">
+ <!-- option elements added by buildApiLevelSelector() -->
+ </select>
+ </div>
+ <script>
+ var SINCE_DATA = [ <?cs
+ each:since = since ?>'<?cs
+ var:since.name ?>'<?cs
+ if:!last(since) ?>, <?cs /if ?><?cs
+ /each
+ ?> ];
+ buildApiLevelSelector();
+ </script><?cs
+ /if ?>
+ </div><!-- headerRight -->
+ <script type="text/javascript">
+ <!--
+ changeTabLang(getLangPref());
+ //-->
+ </script>
+ </div><!-- header --><?cs
+/def ?>
\ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk/customization.cs b/tools/droiddoc/templates-sdk/customization.cs
deleted file mode 100644
index 907f0f7..0000000
--- a/tools/droiddoc/templates-sdk/customization.cs
+++ /dev/null
@@ -1,252 +0,0 @@
-<?cs # This default template file is meant to be replaced. ?>
-<?cs # Use the -tempatedir arg to javadoc to set your own directory with a replacement for this file in it. ?>
-
-
-<?cs # The default search box that goes in the header ?><?cs
-def:default_search_box() ?>
- <div id="search" >
- <div id="searchForm">
- <form accept-charset="utf-8" class="gsc-search-box"
- onsubmit="return submit_search()">
- <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
- <tr>
- <td class="gsc-input">
- <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
- title="search developer docs" name="q"
- value="search developer docs"
- onFocus="search_focus_changed(this, true)"
- onBlur="search_focus_changed(this, false)"
- onkeydown="return search_changed(event, true, '<?cs var:toroot?>')"
- onkeyup="return search_changed(event, false, '<?cs var:toroot?>')" />
- <div id="search_filtered_div" class="no-display">
- <table id="search_filtered" cellspacing=0>
- </table>
- </div>
- </td>
- <td class="gsc-search-button">
- <input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />
- </td>
- <td class="gsc-clear-button">
- <div title="clear results" class="gsc-clear-button"> </div>
- </td>
- </tr></tbody>
- </table>
- </form>
- </div><!-- searchForm -->
- </div><!-- search --><?cs
-/def ?>
-
-<?cs
-def:custom_masthead() ?>
- <div id="header">
- <div id="headerLeft">
- <a href="<?cs var:toroot ?>index.html" tabindex="-1"><img
- src="<?cs var:toroot ?>assets/images/bg_logo.png" alt="Android Developers" /></a>
- <?cs include:"header_tabs.cs" ?> <?cs # The links are extracted so we can better manage localization ?>
- </div>
- <div id="headerRight">
- <div id="headerLinks">
- <?cs if:template.showLanguageMenu ?>
- <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="Language:" />
- <span id="language">
- <select name="language" onChange="changeLangPref(this.value, true)">
- <option value="en">English </option>
- <option value="ja">日本語</option>
- <?cs #
- <option value="de">Deutsch</option>
- <option value="es">Español</option>
- <option value="fr">Français</option>
- <option value="it">Italiano</option>
- <option value="zh-CN">中文 (简体)</option>
- <option value="zh-TW">中文 (繁體)</option>
- ?>
- </select>
- <script type="text/javascript">
- <!--
- loadLangPref();
- //-->
- </script>
- </span>
- <?cs /if ?>
- <a href="http://www.android.com">Android.com</a>
- </div><?cs
- call:default_search_box() ?><?cs
- if:reference ?>
- <div id="api-level-toggle">
- <input type="checkbox" id="apiLevelCheckbox" onclick="toggleApiLevelSelector(this)" />
- <label for="apiLevelCheckbox" class="disabled">Filter by API Level: </label>
- <select id="apiLevelSelector">
- <!-- option elements added by buildApiLevelSelector() -->
- </select>
- </div>
- <script>
- var SINCE_DATA = [ <?cs
- each:since = since ?>'<?cs
- var:since.name ?>'<?cs
- if:!last(since) ?>, <?cs /if ?><?cs
- /each
- ?> ];
- buildApiLevelSelector();
- </script><?cs
- /if ?>
- </div><!-- headerRight -->
- <script type="text/javascript">
- <!--
- changeTabLang(getLangPref());
- //-->
- </script>
- </div><!-- header --><?cs
-/def ?>
-
-<?cs
-def:sdk_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
-<?cs /def ?>
-
-<?cs
-def:resources_tab_nav() ?>
- <div class="g-section g-tpl-200" id="body-content">
- <div class="g-unit g-first" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../frameworks/base/docs/html/resources/resources_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
-<?cs /def ?>
-
-<?cs
-def:guide_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first" id="side-nav">
- <div id="devdoc-nav"><?cs
- include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- addLoadEvent(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
-<?cs /def ?>
-
-<?cs # The default side navigation for the reference docs ?><?cs
-def:default_left_nav() ?>
- <div class="g-section g-tpl-240" id="body-content">
- <div class="g-unit g-first" id="side-nav">
- <div id="swapper">
- <div id="nav-panels">
- <div id="resize-packages-nav">
- <div id="packages-nav">
- <div id="index-links"><nobr>
- <a href="<?cs var:toroot ?>reference/packages.html" <?cs if:(page.title == "Package Index") ?>class="selected"<?cs /if ?> >Package Index</a> |
- <a href="<?cs var:toroot ?>reference/classes.html" <?cs if:(page.title == "Class Index") ?>class="selected"<?cs /if ?>>Class Index</a></nobr>
- </div>
- <ul>
- <?cs call:package_link_list(docs.packages) ?>
- </ul><br/>
- </div> <!-- end packages -->
- </div> <!-- end resize-packages -->
- <div id="classes-nav"><?cs
- if:subcount(class.package) ?>
- <ul>
- <?cs call:list("Interfaces", class.package.interfaces) ?>
- <?cs call:list("Classes", class.package.classes) ?>
- <?cs call:list("Enums", class.package.enums) ?>
- <?cs call:list("Exceptions", class.package.exceptions) ?>
- <?cs call:list("Errors", class.package.errors) ?>
- </ul><?cs
- elif:subcount(package) ?>
- <ul>
- <?cs call:class_link_list("Interfaces", package.interfaces) ?>
- <?cs call:class_link_list("Classes", package.classes) ?>
- <?cs call:class_link_list("Enums", package.enums) ?>
- <?cs call:class_link_list("Exceptions", package.exceptions) ?>
- <?cs call:class_link_list("Errors", package.errors) ?>
- </ul><?cs
- else ?>
- <script>
- /*addLoadEvent(maxPackageHeight);*/
- </script>
- <p style="padding:10px">Select a package to view its members</p><?cs
- /if ?><br/>
- </div><!-- end classes -->
- </div><!-- end nav-panels -->
- <div id="nav-tree" style="display:none">
- <div id="index-links"><nobr>
- <a href="<?cs var:toroot ?>reference/packages.html" <?cs if:(page.title == "Package Index") ?>class="selected"<?cs /if ?> >Package Index</a> |
- <a href="<?cs var:toroot ?>reference/classes.html" <?cs if:(page.title == "Class Index") ?>class="selected"<?cs /if ?>>Class Index</a></nobr>
- </div>
- </div><!-- end nav-tree -->
- </div><!-- end swapper -->
- </div> <!-- end side-nav -->
- <script>
- if (!isMobile) {
- $("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
- chooseDefaultNav();
- if ($("#nav-tree").is(':visible')) {
- init_default_navtree("<?cs var:toroot ?>");
- } else {
- addLoadEvent(function() {
- scrollIntoView("packages-nav");
- scrollIntoView("classes-nav");
- });
- }
- $("#swapper").css({borderBottom:"2px solid #aaa"});
- } else {
- swapNav(); // tree view should be used on mobile
- }
- </script><?cs
-/def ?>
-
-<?cs
-def:custom_left_nav() ?><?cs
- if:guide ?><?cs
- call:guide_nav() ?><?cs
- elif:resources ?><?cs
- call:resources_tab_nav() ?><?cs
- elif:sdk ?><?cs
- call:sdk_nav() ?><?cs
- else ?><?cs
- call:default_left_nav() ?><?cs
- /if ?><?cs
-/def ?>
-
-<?cs # appears at the bottom of every page ?><?cs
-def:custom_cc_copyright() ?>
- Except as noted, this content is
- licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
- Creative Commons Attribution 2.5</a>. For details and
- restrictions, see the <a href="<?cs var:toroot ?>license.html">Content
- License</a>.<?cs
-/def ?>
-
-<?cs
-def:custom_copyright() ?>
- Except as noted, this content is licensed under <a
- href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
- For details and restrictions, see the <a href="<?cs var:toroot ?>license.html">
- Content License</a>.<?cs
-/def ?>
-
-<?cs
-def:custom_footerlinks() ?>
- <p>
- <a href="http://www.android.com/terms.html">Site Terms of Service</a> -
- <a href="http://www.android.com/privacy.html">Privacy Policy</a> -
- <a href="http://www.android.com/branding.html">Brand Guidelines</a>
- </p><?cs
-/def ?>
-
-<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
-def:custom_buildinfo() ?>
- Android <?cs var:sdk.version ?> r<?cs var:sdk.rel.id ?> - <?cs var:page.now ?>
-<?cs /def ?>
diff --git a/tools/droiddoc/templates-sdk/customizations.cs b/tools/droiddoc/templates-sdk/customizations.cs
new file mode 100644
index 0000000..cfeab16
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/customizations.cs
@@ -0,0 +1,151 @@
+<?cs
+def:sdk_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+<?cs /def ?>
+<?cs
+def:resources_tab_nav() ?>
+ <div class="g-section g-tpl-200" id="body-content">
+ <div class="g-unit g-first" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../frameworks/base/docs/html/resources/resources_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ addLoadEvent(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+<?cs
+def:guide_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first" id="side-nav">
+ <div id="devdoc-nav"><?cs
+ include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ addLoadEvent(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
+<?cs # The default side navigation for the reference docs ?><?cs
+def:default_left_nav() ?>
+ <div class="g-section g-tpl-240" id="body-content">
+ <div class="g-unit g-first" id="side-nav">
+ <div id="swapper">
+ <div id="nav-panels">
+ <div id="resize-packages-nav">
+ <div id="packages-nav">
+ <div id="index-links"><nobr>
+ <a href="<?cs var:toroot ?>reference/packages.html" <?cs if:(page.title == "Package Index") ?>class="selected"<?cs /if ?> >Package Index</a> |
+ <a href="<?cs var:toroot ?>reference/classes.html" <?cs if:(page.title == "Class Index") ?>class="selected"<?cs /if ?>>Class Index</a></nobr>
+ </div>
+ <ul>
+ <?cs call:package_link_list(docs.packages) ?>
+ </ul><br/>
+ </div> <!-- end packages -->
+ </div> <!-- end resize-packages -->
+ <div id="classes-nav"><?cs
+ if:subcount(class.package) ?>
+ <ul>
+ <?cs call:list("Interfaces", class.package.interfaces) ?>
+ <?cs call:list("Classes", class.package.classes) ?>
+ <?cs call:list("Enums", class.package.enums) ?>
+ <?cs call:list("Exceptions", class.package.exceptions) ?>
+ <?cs call:list("Errors", class.package.errors) ?>
+ </ul><?cs
+ elif:subcount(package) ?>
+ <ul>
+ <?cs call:class_link_list("Interfaces", package.interfaces) ?>
+ <?cs call:class_link_list("Classes", package.classes) ?>
+ <?cs call:class_link_list("Enums", package.enums) ?>
+ <?cs call:class_link_list("Exceptions", package.exceptions) ?>
+ <?cs call:class_link_list("Errors", package.errors) ?>
+ </ul><?cs
+ else ?>
+ <script>
+ /*addLoadEvent(maxPackageHeight);*/
+ </script>
+ <p style="padding:10px">Select a package to view its members</p><?cs
+ /if ?><br/>
+ </div><!-- end classes -->
+ </div><!-- end nav-panels -->
+ <div id="nav-tree" style="display:none">
+ <div id="index-links"><nobr>
+ <a href="<?cs var:toroot ?>reference/packages.html" <?cs if:(page.title == "Package Index") ?>class="selected"<?cs /if ?> >Package Index</a> |
+ <a href="<?cs var:toroot ?>reference/classes.html" <?cs if:(page.title == "Class Index") ?>class="selected"<?cs /if ?>>Class Index</a></nobr>
+ </div>
+ </div><!-- end nav-tree -->
+ </div><!-- end swapper -->
+ </div> <!-- end side-nav -->
+ <script>
+ if (!isMobile) {
+ $("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
+ chooseDefaultNav();
+ if ($("#nav-tree").is(':visible')) {
+ init_default_navtree("<?cs var:toroot ?>");
+ } else {
+ addLoadEvent(function() {
+ scrollIntoView("packages-nav");
+ scrollIntoView("classes-nav");
+ });
+ }
+ $("#swapper").css({borderBottom:"2px solid #aaa"});
+ } else {
+ swapNav(); // tree view should be used on mobile
+ }
+ </script><?cs
+/def ?>
+
+<?cs
+def:custom_left_nav() ?><?cs
+ if:guide ?><?cs
+ call:guide_nav() ?><?cs
+ elif:resources ?><?cs
+ call:resources_tab_nav() ?><?cs
+ elif:sdk ?><?cs
+ call:sdk_nav() ?><?cs
+ else ?><?cs
+ call:default_left_nav() ?><?cs
+ /if ?><?cs
+/def ?>
+
+<?cs # appears at the bottom of every page ?><?cs
+def:custom_cc_copyright() ?>
+ Except as noted, this content is
+ licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
+ Creative Commons Attribution 2.5</a>. For details and
+ restrictions, see the <a href="<?cs var:toroot ?>license.html">Content
+ License</a>.<?cs
+/def ?>
+
+<?cs
+def:custom_copyright() ?>
+ Except as noted, this content is licensed under <a
+ href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
+ For details and restrictions, see the <a href="<?cs var:toroot ?>license.html">
+ Content License</a>.<?cs
+/def ?>
+
+<?cs
+def:custom_footerlinks() ?>
+ <p>
+ <a href="http://www.android.com/terms.html">Site Terms of Service</a> -
+ <a href="http://www.android.com/privacy.html">Privacy Policy</a> -
+ <a href="http://www.android.com/branding.html">Brand Guidelines</a>
+ </p><?cs
+/def ?>
+
+<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
+def:custom_buildinfo() ?>
+ Android <?cs var:sdk.version ?> r<?cs var:sdk.rel.id ?> - <?cs var:page.now ?>
+<?cs /def ?>
+
diff --git a/tools/droiddoc/templates/footer.cs b/tools/droiddoc/templates-sdk/footer.cs
similarity index 100%
copy from tools/droiddoc/templates/footer.cs
copy to tools/droiddoc/templates-sdk/footer.cs
diff --git a/tools/droiddoc/templates/head_tag.cs b/tools/droiddoc/templates-sdk/head_tag.cs
similarity index 92%
rename from tools/droiddoc/templates/head_tag.cs
rename to tools/droiddoc/templates-sdk/head_tag.cs
index 5a7fd40..fd8aad6 100644
--- a/tools/droiddoc/templates/head_tag.cs
+++ b/tools/droiddoc/templates-sdk/head_tag.cs
@@ -20,6 +20,9 @@
if:reference ?>
<script src="<?cs var:toroot ?>assets/android-developer-reference.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>navtree_data.js" type="text/javascript"></script><?cs
+/if ?><?cs
+if:resources ?>
+<script src="<?cs var:toroot ?>resources/resources-data.js" type="text/javascript"></script><?cs
/if ?>
<noscript>
<style type="text/css">
@@ -31,4 +34,4 @@
#resize-packages-nav{border-bottom:3px solid #666;}
</style>
</noscript>
-</head>
+</head>
\ No newline at end of file
diff --git a/tools/droiddoc/templates/sampleindex.cs b/tools/droiddoc/templates-sdk/sampleindex.cs
similarity index 66%
rename from tools/droiddoc/templates/sampleindex.cs
rename to tools/droiddoc/templates-sdk/sampleindex.cs
index 8a75298..81ba68c 100644
--- a/tools/droiddoc/templates/sampleindex.cs
+++ b/tools/droiddoc/templates-sdk/sampleindex.cs
@@ -10,17 +10,17 @@
<a name="top"></a>
<div class="g-unit" id="doc-content">
<div id="jd-header" class="guide-header">
- <span class="crumb"> </span>
+ <span class="crumb">
+ <a href="<?cs var:toroot ?>resources/browser.html?tag=sample">Sample Code</a> >
+ </span>
<h1><?cs var:page.title ?></h1>
</div>
<div id="jd-content">
+<p><a href="../index.html">← Back</a></p>
<?cs var:summary ?>
-<?cs if:android.whichdoc == "online" ?><?cs
- # If this is the online docs, build the src code navigation links ?>
-
<?cs if:subcount(subdirs) ?>
<h2>Subdirectories</h2>
<ul class="nolist">
@@ -41,17 +41,6 @@
</ul>
<?cs /if ?>
-<?cs else ?><?cs
- # else, this means it's offline docs,
- so don't show src links (we don't have the pages!) ?>
-
-<p>You can find the source code for this sample in your SDK at:</p>
-<p style="margin-left:2em">
-<code><em><sdk></em>/platforms/android-<em><version></em>/samples/</code>
-</p>
-
-<?cs /if ?><?cs # end if/else online docs ?>
-
</div><!-- end jd-content -->
<?cs include:"footer.cs" ?>
diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs
index 6c35b81..7756440 100644
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -209,8 +209,22 @@
$("#next-steps").show();
}
</script>
- <?cs /if ?> <?cs # end if online ?>
+ <?cs else ?> <?cs # end if online ?>
+ <?cs if:sdk.preview ?>
+ <p>Welcome developers! We are pleased to provide you with a preview SDK for the upcoming
+ Android 3.0 release, to give you a head-start on developing applications for it.
+ </p>
+
+ <p>See the <a
+ href="<?cs var:toroot ?>sdk/preview/start.html">Getting Started</a> document for more information
+ about how to set up the preview SDK and get started.</p>
+ <style type="text/css">
+ .non-preview { display:none; }
+ </style>
+ <?cs /if ?>
+ <?cs /if ?> <?cs # end if/else online ?>
+
<?cs /if ?> <?cs # end if/else NDK ?>
<?cs /if ?> <?cs # end if/else redirect ?>
diff --git a/tools/droiddoc/templates/trailer.cs b/tools/droiddoc/templates-sdk/trailer.cs
similarity index 100%
copy from tools/droiddoc/templates/trailer.cs
copy to tools/droiddoc/templates-sdk/trailer.cs
diff --git a/tools/droiddoc/templates/class.cs b/tools/droiddoc/templates/class.cs
deleted file mode 100644
index d2add18..0000000
--- a/tools/droiddoc/templates/class.cs
+++ /dev/null
@@ -1,623 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<body class="<?cs var:class.since ?>">
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content">
-
-<div id="api-info-block">
-
-<?cs # are there inherited members ?>
-<?cs each:cl=class.inherited ?>
- <?cs if:subcount(cl.methods) ?>
- <?cs set:inhmethods = #1 ?>
- <?cs /if ?>
- <?cs if:subcount(cl.constants) ?>
- <?cs set:inhconstants = #1 ?>
- <?cs /if ?>
- <?cs if:subcount(cl.fields) ?>
- <?cs set:inhfields = #1 ?>
- <?cs /if ?>
- <?cs if:subcount(cl.attrs) ?>
- <?cs set:inhattrs = #1 ?>
- <?cs /if ?>
-<?cs /each ?>
-
-<div class="sum-details-links">
-Summary:
-<?cs if:subcount(class.inners) ?>
- <a href="#nestedclasses">Nested Classes</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.attrs) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#lattrs">XML Attrs</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:inhattrs ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#inhattrs">Inherited XML Attrs</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.enumConstants) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#enumconstants">Enums</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.constants) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#constants">Constants</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:inhconstants ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#inhconstants">Inherited Constants</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.fields) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#lfields">Fields</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:inhfields ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#inhfields">Inherited Fields</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.ctors.public) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#pubctors">Ctors</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.ctors.protected) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#proctors">Protected Ctors</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.methods.public) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#pubmethods">Methods</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:subcount(class.methods.protected) ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#promethods">Protected Methods</a>
- <?cs set:linkcount = #1 ?>
-<?cs /if ?>
-<?cs if:inhmethods ?>
- <?cs if:linkcount ?>| <?cs /if ?><a href="#inhmethods">Inherited Methods</a>
-<?cs /if ?>
-<?cs if:inhattrs || inhconstants || inhfields || inhmethods || subcount(class.subclasses.direct) || subcount(class.subclasses.indirect) ?>
-| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
-<?cs /if ?>
-</div><!-- end sum-details-links -->
-<div class="api-level">
- <?cs call:since_tags(class) ?>
-</div>
-</div><!-- end api-info-block -->
-
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ======== START OF CLASS DATA ======== -->
-
-<div id="jd-header">
- <?cs var:class.scope ?>
- <?cs var:class.static ?>
- <?cs var:class.final ?>
- <?cs var:class.abstract ?>
- <?cs var:class.kind ?>
-<h1><?cs var:class.name ?></h1>
-
-<?cs set:colspan = subcount(class.inheritance) ?>
-<?cs each:supr = class.inheritance ?>
- <?cs if:colspan == 2 ?>
- extends <?cs call:type_link(supr.short_class) ?><br/>
- <?cs /if ?>
- <?cs if:last(supr) && subcount(supr.interfaces) ?>
- implements
- <?cs each:t=supr.interfaces ?>
- <?cs call:type_link(t) ?>
- <?cs /each ?>
- <?cs /if ?>
- <?cs set:colspan = colspan-1 ?>
-<?cs /each ?>
-
-</div><!-- end header -->
-
-<div id="naMessage"></div>
-
-<div id="jd-content" class="api apilevel-<?cs var:class.since ?>">
-<table class="jd-inheritance-table">
-<?cs set:colspan = subcount(class.inheritance) ?>
-<?cs each:supr = class.inheritance ?>
- <tr>
- <?cs loop:i = 1, (subcount(class.inheritance)-colspan), 1 ?>
- <td class="jd-inheritance-space"> <?cs if:(subcount(class.inheritance)-colspan) == i ?> ↳<?cs /if ?></td>
- <?cs /loop ?>
- <td colspan="<?cs var:colspan ?>" class="jd-inheritance-class-cell"><?cs
- if:colspan == 1
- ?><?cs call:class_name(class.qualifiedType) ?><?cs
- else
- ?><?cs call:type_link(supr.class) ?><?cs
- /if ?></td>
- </tr>
- <?cs set:colspan = colspan-1 ?>
-<?cs /each ?>
-</table>
-
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-
-<?cs if:subcount(class.subclasses.direct) ?>
-<table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="12" style="border:none;margin:0;padding:0;">
-<?cs call:expando_trigger("subclasses-direct", "closed") ?>Known Direct Subclasses
-<?cs call:expandable_class_list("subclasses-direct", class.subclasses.direct, "list") ?>
-</td></tr></table>
-<?cs /if ?>
-
-<?cs if:subcount(class.subclasses.indirect) ?>
-<table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="12" style="border:none;margin:0;padding:0;">
-<?cs call:expando_trigger("subclasses-indirect", "closed") ?>Known Indirect Subclasses
-<?cs call:expandable_class_list("subclasses-indirect", class.subclasses.indirect, "list") ?>
-</td></tr></table>
-<?cs /if ?>
-
-<div class="jd-descr">
-<?cs call:deprecated_warning(class) ?>
-<?cs if:subcount(class.descr) ?>
-<h2>Class Overview</h2>
-<p><?cs call:tag_list(class.descr) ?></p>
-<?cs /if ?>
-
-<?cs call:see_also_tags(class.seeAlso) ?>
-
-</div><!-- jd-descr -->
-
-
-<?cs # summary macros ?>
-
-<?cs def:write_method_summary(methods, included) ?>
-<?cs set:count = #1 ?>
-<?cs each:method = methods ?>
- <?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:method.since ?>" >
- <td class="jd-typecol"><nobr>
- <?cs var:method.abstract ?>
- <?cs var:method.synchronized ?>
- <?cs var:method.final ?>
- <?cs var:method.static ?>
- <?cs call:type_link(method.generic) ?>
- <?cs call:type_link(method.returnType) ?></nobr>
- </td>
- <td class="jd-linkcol" width="100%"><nobr>
- <span class="sympad"><?cs call:cond_link(method.name, toroot, method.href, included) ?></span>(<?cs call:parameter_list(method.params) ?>)</nobr>
- <?cs if:subcount(method.shortDescr) || subcount(method.deprecated) ?>
- <div class="jd-descrdiv"><?cs call:short_descr(method) ?></div>
- <?cs /if ?>
- </td></tr>
-<?cs set:count = count + #1 ?>
-<?cs /each ?>
-<?cs /def ?>
-
-<?cs def:write_field_summary(fields, included) ?>
-<?cs set:count = #1 ?>
- <?cs each:field=fields ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:field.since ?>" >
- <td class="jd-typecol"><nobr>
- <?cs var:field.scope ?>
- <?cs var:field.static ?>
- <?cs var:field.final ?>
- <?cs call:type_link(field.type) ?></nobr></td>
- <td class="jd-linkcol"><?cs call:cond_link(field.name, toroot, field.href, included) ?></td>
- <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?></td>
- </tr>
- <?cs set:count = count + #1 ?>
- <?cs /each ?>
-<?cs /def ?>
-
-<?cs def:write_constant_summary(fields, included) ?>
-<?cs set:count = #1 ?>
- <?cs each:field=fields ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:field.since ?>" >
- <td class="jd-typecol"><?cs call:type_link(field.type) ?></td>
- <td class="jd-linkcol"><?cs call:cond_link(field.name, toroot, field.href, included) ?></td>
- <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?></td>
- </tr>
- <?cs set:count = count + #1 ?>
- <?cs /each ?>
-<?cs /def ?>
-
-<?cs def:write_attr_summary(attrs, included) ?>
-<?cs set:count = #1 ?>
- <tr>
- <td><nobr><em>Attribute Name</em></nobr></td>
- <td><nobr><em>Related Method</em></nobr></td>
- <td><nobr><em>Description</em></nobr></td>
- </tr>
- <?cs each:attr=attrs ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:attr.since ?>" >
- <td class="jd-linkcol"><?cs if:included ?><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs /if ?><?cs var:attr.name ?><?cs if:included ?></a><?cs /if ?></td>
- <td class="jd-linkcol"><?cs each:m=attr.methods ?>
- <?cs call:cond_link(m.name, toroot, m.href, included) ?>
- <?cs /each ?>
- </td>
- <td class="jd-descrcol" width="100%"><?cs call:short_descr(attr) ?> </td>
- </tr>
- <?cs set:count = count + #1 ?>
- <?cs /each ?>
-<?cs /def ?>
-
-<?cs def:write_inners_summary(classes) ?>
-<?cs set:count = #1 ?>
- <?cs each:cl=class.inners ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.since ?>" >
- <td class="jd-typecol"><nobr>
- <?cs var:cl.scope ?>
- <?cs var:cl.static ?>
- <?cs var:cl.final ?>
- <?cs var:cl.abstract ?>
- <?cs var:cl.kind ?></nobr></td>
- <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
- <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?> </td>
- </tr>
- <?cs set:count = count + #1 ?>
- <?cs /each ?>
-<?cs /def ?>
-
-<?cs # end macros ?>
-
-<div class="jd-descr">
-<h2>Summary</h2>
-
-<?cs if:subcount(class.inners) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ======== NESTED CLASS SUMMARY ======== -->
-<table id="nestedclasses" class="jd-sumtable"><tr><th colspan="12">Nested Classes</th></tr>
-<?cs call:write_inners_summary(class.inners) ?>
-<?cs /if ?>
-
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<?cs if:subcount(class.attrs) ?>
-<!-- =========== FIELD SUMMARY =========== -->
-<table id="lattrs" class="jd-sumtable"><tr><th colspan="12">XML Attributes</th></tr>
-<?cs call:write_attr_summary(class.attrs, 1) ?>
-<?cs /if ?>
-
-<?cs # if there are inherited attrs, write the table ?>
-<?cs if:inhattrs ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- =========== FIELD SUMMARY =========== -->
-<table id="inhattrs" class="jd-sumtable"><tr><th>
- <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
- <div style="clear:left;">Inherited XML Attributes</div></th></tr>
-<?cs each:cl=class.inherited ?>
-<?cs if:subcount(cl.attrs) ?>
-<tr class="api apilevel-<?cs var:cl.since ?>" >
-<td colspan="12">
-<?cs call:expando_trigger("inherited-attrs-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
-<?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?>
-<div id="inherited-attrs-<?cs var:cl.qualified ?>">
- <div id="inherited-attrs-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
- </div>
- <div id="inherited-attrs-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando">
- <?cs call:write_attr_summary(cl.attrs, cl.included) ?></table>
- </div>
-</div>
-</td></tr>
-<?cs /if ?>
-<?cs /each ?>
-</table>
-<?cs /if ?>
-
-<?cs if:subcount(class.enumConstants) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- =========== ENUM CONSTANT SUMMARY =========== -->
-<table id="enumconstants" class="jd-sumtable"><tr><th colspan="12">Enum Values</th></tr>
-<?cs set:count = #1 ?>
- <?cs each:field=class.enumConstants ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:field.since ?>" >
- <td class="jd-descrcol"><?cs call:type_link(field.type) ?> </td>
- <td class="jd-linkcol"><?cs call:cond_link(field.name, toroot, field.href, cl.included) ?> </td>
- <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?> </td>
- </tr>
- <?cs set:count = count + #1 ?>
- <?cs /each ?>
-<?cs /if ?>
-
-<?cs if:subcount(class.constants) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- =========== ENUM CONSTANT SUMMARY =========== -->
-<table id="constants" class="jd-sumtable"><tr><th colspan="12">Constants</th></tr>
-<?cs call:write_constant_summary(class.constants, 1) ?>
-</table>
-<?cs /if ?>
-
-<?cs # if there are inherited constants, write the table ?>
-<?cs if:inhconstants ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- =========== ENUM CONSTANT SUMMARY =========== -->
-<table id="inhconstants" class="jd-sumtable"><tr><th>
- <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
- <div style="clear:left;">Inherited Constants</div></th></tr>
-<?cs each:cl=class.inherited ?>
-<?cs if:subcount(cl.constants) ?>
-<tr class="api apilevel-<?cs var:cl.since ?>" >
-<td colspan="12">
-<?cs call:expando_trigger("inherited-constants-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
-<?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?>
-<div id="inherited-constants-<?cs var:cl.qualified ?>">
- <div id="inherited-constants-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
- </div>
- <div id="inherited-constants-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando">
- <?cs call:write_constant_summary(cl.constants, cl.included) ?></table>
- </div>
-</div>
-</td></tr>
-<?cs /if ?>
-<?cs /each ?>
-</table>
-<?cs /if ?>
-
-<?cs if:subcount(class.fields) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- =========== FIELD SUMMARY =========== -->
-<table id="lfields" class="jd-sumtable"><tr><th colspan="12">Fields</th></tr>
-<?cs call:write_field_summary(class.fields, 1) ?>
-</table>
-<?cs /if ?>
-
-<?cs # if there are inherited fields, write the table ?>
-<?cs if:inhfields ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- =========== FIELD SUMMARY =========== -->
-<table id="inhfields" class="jd-sumtable"><tr><th>
- <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
- <div style="clear:left;">Inherited Fields</div></th></tr>
-<?cs each:cl=class.inherited ?>
-<?cs if:subcount(cl.fields) ?>
-<tr class="api apilevel-<?cs var:cl.since ?>" >
-<td colspan="12">
-<?cs call:expando_trigger("inherited-fields-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
-<?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?>
-<div id="inherited-fields-<?cs var:cl.qualified ?>">
- <div id="inherited-fields-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
- </div>
- <div id="inherited-fields-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando">
- <?cs call:write_field_summary(cl.fields, cl.included) ?></table>
- </div>
-</div>
-</td></tr>
-<?cs /if ?>
-<?cs /each ?>
-</table>
-<?cs /if ?>
-
-<?cs if:subcount(class.ctors.public) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ======== CONSTRUCTOR SUMMARY ======== -->
-<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
-<?cs call:write_method_summary(class.ctors.public, 1) ?>
-</table>
-<?cs /if ?>
-
-<?cs if:subcount(class.ctors.protected) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ======== CONSTRUCTOR SUMMARY ======== -->
-<table id="proctors" class="jd-sumtable"><tr><th colspan="12">Protected Constructors</th></tr>
-<?cs call:write_method_summary(class.ctors.protected, 1) ?>
-</table>
-<?cs /if ?>
-
-<?cs if:subcount(class.methods.public) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========== METHOD SUMMARY =========== -->
-<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
-<?cs call:write_method_summary(class.methods.public, 1) ?>
-</table>
-<?cs /if ?>
-
-<?cs if:subcount(class.methods.protected) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========== METHOD SUMMARY =========== -->
-<table id="promethods" class="jd-sumtable"><tr><th colspan="12">Protected Methods</th></tr>
-<?cs call:write_method_summary(class.methods.protected, 1) ?>
-</table>
-<?cs /if ?>
-
-<?cs # if there are inherited methods, write the table ?>
-<?cs if:inhmethods ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========== METHOD SUMMARY =========== -->
-<table id="inhmethods" class="jd-sumtable"><tr><th>
- <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
- <div style="clear:left;">Inherited Methods</div></th></tr>
-<?cs each:cl=class.inherited ?>
-<?cs if:subcount(cl.methods) ?>
-<tr class="api apilevel-<?cs var:cl.since ?>" >
-<td colspan="12"><?cs call:expando_trigger("inherited-methods-"+cl.qualified, "closed") ?>
-From <?cs var:cl.kind ?> <?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?>
-<div id="inherited-methods-<?cs var:cl.qualified ?>">
- <div id="inherited-methods-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
- </div>
- <div id="inherited-methods-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando">
- <?cs call:write_method_summary(cl.methods, cl.included) ?></table>
- </div>
-</div>
-</td></tr>
-<?cs /if ?>
-<?cs /each ?>
-</table>
-<?cs /if ?>
-
-</div><!-- jd-descr (summary) -->
-
-<!-- Details -->
-
-<?cs def:write_field_details(fields) ?>
-<?cs each:field=fields ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
-<A NAME="<?cs var:field.anchor ?>"></A>
-<?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
-<div class="jd-details api apilevel-<?cs var:field.since ?>">
- <h4 class="jd-details-title">
- <span class="normal">
- <?cs var:field.scope ?>
- <?cs var:field.static ?>
- <?cs var:field.final ?>
- <?cs call:type_link(field.type) ?>
- </span>
- <?cs var:field.name ?>
- </h4>
- <div class="api-level">
- <?cs call:since_tags(field) ?>
- </div>
- <div class="jd-details-descr">
- <?cs call:description(field) ?>
- <?cs if:subcount(field.constantValue) ?>
- <div class="jd-tagdata">
- <span class="jd-tagtitle">Constant Value: </span>
- <span>
- <?cs if:field.constantValue.isString ?>
- <?cs var:field.constantValue.str ?>
- <?cs else ?>
- <?cs var:field.constantValue.dec ?>
- (<?cs var:field.constantValue.hex ?>)
- <?cs /if ?>
- </span>
- </div>
- <?cs /if ?>
- </div>
-</div>
-<?cs /each ?>
-<?cs /def ?>
-
-<?cs def:write_method_details(methods) ?>
-<?cs each:method=methods ?>
-<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
-<A NAME="<?cs var:method.anchor ?>"></A>
-<?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
-<div class="jd-details api apilevel-<?cs var:method.since ?>">
- <h4 class="jd-details-title">
- <span class="normal">
- <?cs var:method.scope ?>
- <?cs var:method.static ?>
- <?cs var:method.final ?>
- <?cs var:method.abstract ?>
- <?cs var:method.synchronized ?>
- <?cs call:type_link(method.returnType) ?>
- </span>
- <span class="sympad"><?cs var:method.name ?></span>
- <span class="normal">(<?cs call:parameter_list(method.params) ?>)</span>
- </h4>
- <div class="api-level">
- <?cs call:since_tags(method) ?>
- </div>
- <div class="jd-details-descr">
- <?cs call:description(method) ?>
- </div>
-</div>
-<?cs /each ?>
-<?cs /def ?>
-
-<?cs def:write_attr_details(attrs) ?>
-<?cs each:attr=attrs ?>
-<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
-<A NAME="<?cs var:attr.anchor ?>"></A>
-<?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
-<div class="jd-details api apilevel-<?cs var:attr.since ?>">
- <h4 class="jd-details-title"><?cs var:attr.name ?>
- </h4>
- <div class="api-level">
- <?cs call:since_tags(attr) ?>
- </div>
- <div class="jd-details-descr">
- <?cs call:description(attr) ?>
-
- <div class="jd-tagdata">
- <h5 class="jd-tagtitle">Related Methods</h5>
- <ul class="nolist">
- <?cs each:m=attr.methods ?>
- <li><a href="<?cs var:toroot ?><?cs var:m.href ?>"><?cs var:m.name ?></a></li>
- <?cs /each ?>
- </ul>
- </div>
- </div>
-</div>
-<?cs /each ?>
-<?cs /def ?>
-
-
-<!-- XML Attributes -->
-<?cs if:subcount(class.attrs) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= FIELD DETAIL ======== -->
-<h2>XML Attributes</h2>
-<?cs call:write_attr_details(class.attrs) ?>
-<?cs /if ?>
-
-<!-- Enum Values -->
-<?cs if:subcount(class.enumConstants) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= ENUM CONSTANTS DETAIL ======== -->
-<h2>Enum Values</h2>
-<?cs call:write_field_details(class.enumConstants) ?>
-<?cs /if ?>
-
-<!-- Constants -->
-<?cs if:subcount(class.constants) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= ENUM CONSTANTS DETAIL ======== -->
-<h2>Constants</h2>
-<?cs call:write_field_details(class.constants) ?>
-<?cs /if ?>
-
-<!-- Fields -->
-<?cs if:subcount(class.fields) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= FIELD DETAIL ======== -->
-<h2>Fields</h2>
-<?cs call:write_field_details(class.fields) ?>
-<?cs /if ?>
-
-<!-- Public ctors -->
-<?cs if:subcount(class.ctors.public) ?>
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= CONSTRUCTOR DETAIL ======== -->
-<h2>Public Constructors</h2>
-<?cs call:write_method_details(class.ctors.public) ?>
-<?cs /if ?>
-
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= CONSTRUCTOR DETAIL ======== -->
-<!-- Protected ctors -->
-<?cs if:subcount(class.ctors.protected) ?>
-<h2>Protected Constructors</h2>
-<?cs call:write_method_details(class.ctors.protected) ?>
-<?cs /if ?>
-
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= METHOD DETAIL ======== -->
-<!-- Public methdos -->
-<?cs if:subcount(class.methods.public) ?>
-<h2>Public Methods</h2>
-<?cs call:write_method_details(class.methods.public) ?>
-<?cs /if ?>
-
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ========= METHOD DETAIL ======== -->
-<?cs if:subcount(class.methods.protected) ?>
-<h2>Protected Methods</h2>
-<?cs call:write_method_details(class.methods.protected) ?>
-<?cs /if ?>
-
-<?cs # the next two lines must be exactly like this to be parsed by eclipse ?>
-<!-- ========= END OF CLASS DATA ========= -->
-<A NAME="navbar_top"></A>
-
-<?cs include:"footer.cs" ?>
-</div> <!-- jd-content -->
-
-</div><!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
diff --git a/tools/droiddoc/templates/classes.cs b/tools/droiddoc/templates/classes.cs
deleted file mode 100644
index 5a8315f..0000000
--- a/tools/droiddoc/templates/classes.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content">
-
-<div id="jd-header">
-<h1><?cs var:page.title ?></h1>
-</div>
-
-<div id="jd-content">
-
-<div class="jd-letterlist"><?cs each:letter=docs.classes ?>
- <a href="#letter_<?cs name:letter ?>"><?cs name:letter ?></a><?cs /each?>
-</div>
-
-<?cs each:letter=docs.classes ?>
-<?cs set:count = #1 ?>
-<h2 id="letter_<?cs name:letter ?>"><?cs name:letter ?></h2>
-<table class="jd-sumtable">
- <?cs set:cur_row = #0 ?>
- <?cs each:cl = letter ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.since ?>" >
- <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
- <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?> </td>
- </tr>
- <?cs set:count = count + #1 ?>
- <?cs /each ?>
-</table>
-<?cs /each ?>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end jd-content -->
-</div><!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/tools/droiddoc/templates/customization.cs b/tools/droiddoc/templates/customization.cs
deleted file mode 100644
index f6a5c1a..0000000
--- a/tools/droiddoc/templates/customization.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-<?cs # This default template file is meant to be replaced. ?>
-<?cs # Use the -templatedir arg to javadoc to set your own directory with a ?>
-<?cs # replacement for this file in it. ?>
-
-
-<?cs def:default_search_box() ?><?cs /def ?>
-<?cs def:default_left_nav() ?><?cs /def ?>
-
-<?cs # appears at the top of every page ?><?cs
-def:custom_masthead() ?>
- <div id="header">
- <div id="headerLeft">
- <a href="<?cs var:toroot ?>index.html" tabindex="-1"><?cs var:page.title ?></a>
- </div>
- <div id="headerRight">
- <?cs if:!online-pdk ?>
- <?cs call:default_search_box() ?>
- <?cs /if ?>
- </div><!-- headerRight -->
- </div><!-- header --><?cs
-/def ?>
-
-<?cs # appear at the bottom of every page ?>
-<?cs def:custom_copyright() ?><?cs /def ?>
-<?cs def:custom_cc_copyright() ?><?cs /def ?>
-<?cs def:custom_footerlinks() ?><?cs /def ?>
-<?cs def:custom_buildinfo() ?>Build <?cs var:page.build ?> - <?cs var:page.now ?><?cs /def ?>
-
-<?cs # appears on the side of the page ?>
-<?cs def:custom_left_nav() ?><?cs call:default_left_nav() ?><?cs /def ?>
-
diff --git a/tools/droiddoc/templates/docpage.cs b/tools/droiddoc/templates/docpage.cs
deleted file mode 100644
index 9d85c6f..0000000
--- a/tools/droiddoc/templates/docpage.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<body class="gc-documentation">
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content"><a name="top"></a>
-
-<div id="jd-header" class="guide-header">
- <span class="crumb">
- <?cs if:parent.link ?>
- <a href="<?cs var:parent.link ?>"><?cs var:parent.title ?></a> >
- <?cs else ?>
- <?cs /if ?>
- </span>
-<h1><?cs var:page.title ?></h1>
-</div>
-
- <div id="jd-content">
-
- <div class="jd-descr">
- <?cs call:tag_list(root.descr) ?>
- </div>
-
- <a href="#top" style="float:right">↑ Go to top</a>
- <?cs if:parent.link ?>
- <p><a href="<?cs var:parent.link ?>">← Back to <?cs var:parent.title ?></a></p>
- <?cs /if ?>
- </div>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
-
-
-
diff --git a/tools/droiddoc/templates/doctype.cs b/tools/droiddoc/templates/doctype.cs
deleted file mode 100644
index 763b073..0000000
--- a/tools/droiddoc/templates/doctype.cs
+++ /dev/null
@@ -1 +0,0 @@
-<!DOCTYPE html>
\ No newline at end of file
diff --git a/tools/droiddoc/templates/header.cs b/tools/droiddoc/templates/header.cs
deleted file mode 100644
index e8301be..0000000
--- a/tools/droiddoc/templates/header.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-<?cs call:custom_masthead() ?>
-<?cs call:custom_left_nav() ?>
-
diff --git a/tools/droiddoc/templates/hierarchy.cs b/tools/droiddoc/templates/hierarchy.cs
deleted file mode 100644
index a607ffd..0000000
--- a/tools/droiddoc/templates/hierarchy.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-<?cs include:"macros.cs" ?>
-<html>
-<style>
- .jd-hierarchy-spacer {
- width: 15px;
- }
- .jd-hierarchy-data {
- text-align: left;
- vertical-align: top;
- }
-</style>
-<?cs include:"head_tag.cs" ?>
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content">
-
-<div id="jd-header">
-<h1><?cs var:page.title ?></h1>
-</div>
-
-<div id="jd-content">
-
-<div style="margin-left: 20px; margin-right: 20px;">
-
-<?cs def:hierarchy_list(classes) ?>
-<?cs each:cl = classes ?>
-<tr>
- <?cs loop:x=#0,cl.indent,#1 ?><td class="jd-hierarchy-spacer"></td><?cs /loop ?>
- <td class="jd-hierarchy-data" colspan="<?cs var:cl.colspan ?>">
- <?cs if:cl.exists ?>
- <?cs call:type_link(cl.class) ?>
- <?cs else ?>
- <?cs var:cl.value ?>
- <?cs /if ?>
- </td>
- <td class="jd-hierarchy-data">
- <?cs each:iface = cl.interfaces ?>
- <?cs if:iface.exists ?>
- <?cs call:type_link(iface.class) ?>
- <?cs else ?>
- <?cs var:iface.value ?>
- <?cs /if ?>
- <?cs /each ?>
-
- </td>
-</tr>
-<?cs call:hierarchy_list(cl.derived) ?>
-<?cs /each ?>
-<?cs /def ?>
-
-
-<table border="0" cellpadding="0" cellspacing="1">
-<th class="jd-hierarchy-data" colspan="<?cs var:colspan ?>">Class</th>
-<th class="jd-hierarchy-data">Interfaces</th>
-<?cs call:hierarchy_list(classes) ?>
-</table>
-
-</div>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end jd-content -->
-</div><!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
-
diff --git a/tools/droiddoc/templates/index.cs b/tools/droiddoc/templates/index.cs
deleted file mode 100644
index 15a6a59..0000000
--- a/tools/droiddoc/templates/index.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<head>
-<meta http-equiv="refresh" content="0;url=packages.html">
-</head>
-<body>
-<?cs include:"analytics.cs" ?>
-</body>
-</html>
\ No newline at end of file
diff --git a/tools/droiddoc/templates/keywords.cs b/tools/droiddoc/templates/keywords.cs
deleted file mode 100644
index 0c8d4e3..0000000
--- a/tools/droiddoc/templates/keywords.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content">
-
-<div id="jd-header">
-<h1><?cs var:page.title ?></h1>
-</div>
-
-<div id="jd-content">
-
-<div class="jd-letterlist"><?cs each:letter=keywords ?>
- <a href="#letter_<?cs name:letter ?>"><?cs name:letter ?></a><?cs /each?>
-</div>
-
-<?cs each:letter=keywords ?>
-<a name="letter_<?cs name:letter ?>"></a>
-<h2><?cs name:letter ?></h2>
-<ul class="jd-letterentries">
-<?cs each:entry=letter
-?> <li><a href="<?cs var:toroot ?><?cs var:entry.href ?>"><?cs var:entry.label
- ?></a> <font class="jd-letterentrycomments">(<?cs var:entry.comment ?>)</font></li>
-<?cs /each
-?></ul>
-
-<?cs /each ?>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end jd-content -->
-</div><!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
diff --git a/tools/droiddoc/templates/lists.cs b/tools/droiddoc/templates/lists.cs
deleted file mode 100644
index 0af32b2..0000000
--- a/tools/droiddoc/templates/lists.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-var DATA = [
-<?cs each:page = docs.pages
-?> { id:<?cs var: page.id ?>, label:"<?cs var:page.label ?>", link:"<?cs var:page.link ?>", type:"<?cs var:page.type ?>" }<?cs if:!last(page) ?>,<?cs /if ?>
-<?cs /each ?>
- ];
diff --git a/tools/droiddoc/templates/macros.cs b/tools/droiddoc/templates/macros.cs
deleted file mode 100644
index b5fd3f2..0000000
--- a/tools/droiddoc/templates/macros.cs
+++ /dev/null
@@ -1,266 +0,0 @@
-<?cs # A link to a package ?><?cs
-def:package_link(pkg)) ?>
- <a href="<?cs var:toroot ?><?cs var:pkg.link ?>"><?cs var:pkg.name ?></a><?cs
-/def ?>
-
-<?cs # A link to a type, or not if it's a primitive type
- link: whether to create a link at the top level, always creates links in
- recursive invocations.
- Expects the following fields:
- .name
- .link
- .isPrimitive
- .superBounds.N.(more links) (... super ... & ...)
- .extendsBounds.N.(more links) (... extends ... & ...)
- .typeArguments.N.(more links) (< ... >)
-?><?cs
-def:type_link_impl(type, link) ?><?cs
- if:type.link && link=="true" ?><a href="<?cs var:toroot ?><?cs var:type.link ?>"><?cs /if
- ?><?cs var:type.label ?><?cs if:type.link && link=="true" ?></a><?cs /if ?><?cs
- if:subcount(type.extendsBounds) ?><?cs
- each:t=type.extendsBounds ?><?cs
- if:first(t) ?> extends <?cs else ?> & <?cs /if ?><?cs
- call:type_link_impl(t, "true") ?><?cs
- /each ?><?cs
- /if ?><?cs
- if:subcount(type.superBounds) ?><?cs
- each:t=type.superBounds ?><?cs
- if:first(t) ?> super <?cs else ?> & <?cs /if ?><?cs
- call:type_link_impl(t, "true") ?><?cs
- /each ?><?cs
- /if ?><?cs
- if:subcount(type.typeArguments)
- ?><<?cs each:t=type.typeArguments ?><?cs call:type_link_impl(t, "true") ?><?cs
- if:!last(t) ?>, <?cs /if ?><?cs
- /each ?>><?cs
- /if ?><?cs
-/def ?>
-
-<?cs def:class_name(type) ?><?cs call:type_link_impl(type, "false") ?><?cs /def ?>
-<?cs def:type_link(type) ?><?cs call:type_link_impl(type, "true") ?><?cs /def ?>
-
-<?cs # a conditional link.
- if the "condition" parameter evals to true then the link is displayed
- otherwise only the text is displayed
-?><?cs
-def:cond_link(text, root, path, condition) ?><?cs
- if:condition ?><a href="<?cs var:root ?><?cs var:path ?>"><?cs /if ?><?cs var:text ?><?cs if:condition ?></a><?cs /if ?><?cs
-/def ?>
-
-
-<?cs # A comma separated parameter list ?><?cs
-def:parameter_list(params) ?><?cs
- each:param = params ?><?cs
- call:type_link(param.type)?> <?cs
- var:param.name ?><?cs
- if: name(param)!=subcount(params)-1?>, <?cs /if ?><?cs
- /each ?><?cs
-/def ?>
-
-<?cs # Print a list of tags (e.g. description text ?><?cs
-def:tag_list(tags) ?><?cs
- each:tag = tags ?><?cs
- if:tag.name == "Text" ?><?cs var:tag.text?><?cs
- elif:tag.kind == "@more" ?><p><?cs
- elif:tag.kind == "@see" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs var:tag.label ?></a></code><?cs
- elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs
- elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs
- elif:tag.kind == "@code" ?><code><?cs var:tag.text ?></code><?cs
- elif:tag.kind == "@samplecode" ?><pre><?cs var:tag.text ?></pre><?cs
- elif:tag.name == "@sample" ?><pre><?cs var:tag.text ?></pre><?cs
- elif:tag.name == "@include" ?><?cs var:tag.text ?><?cs
- elif:tag.kind == "@docRoot" ?><?cs var:toroot ?><?cs
- elif:tag.kind == "@sdkCurrent" ?><?cs var:sdk.current ?><?cs
- elif:tag.kind == "@sdkCurrentVersion" ?><?cs var:sdk.version ?><?cs
- elif:tag.kind == "@sdkCurrentRelId" ?><?cs var:sdk.rel.id ?><?cs
- elif:tag.kind == "@sdkPlatformVersion" ?><?cs var:sdk.platform.version ?><?cs
- elif:tag.kind == "@sdkPlatformApiLevel" ?><?cs var:sdk.platform.apiLevel ?><?cs
- elif:tag.kind == "@sdkPlatformMajorMinor" ?><?cs var:sdk.platform.majorMinor ?><?cs
- elif:tag.kind == "@sdkPlatformReleaseDate" ?><?cs var:sdk.platform.releaseDate ?><?cs
- elif:tag.kind == "@sdkPlatformDeployableDate" ?><?cs var:sdk.platform.deployableDate ?><?cs
- elif:tag.kind == "@adtZipVersion" ?><?cs var:adt.zip.version ?><?cs
- elif:tag.kind == "@adtZipDownload" ?><?cs var:adt.zip.download ?><?cs
- elif:tag.kind == "@adtZipBytes" ?><?cs var:adt.zip.bytes ?><?cs
- elif:tag.kind == "@adtZipChecksum" ?><?cs var:adt.zip.checksum ?><?cs
- elif:tag.kind == "@inheritDoc" ?><?cs # This is the case when @inheritDoc is in something
- that doesn't inherit from anything?><?cs
- elif:tag.kind == "@attr" ?><?cs
- else ?>{<?cs var:tag.name?> <?cs var:tag.text ?>}<?cs
- /if ?><?cs
- /each ?><?cs
-/def ?>
-
-<?cs # The message about This xxx is deprecated. ?><?cs
-def:deprecated_text(kind) ?>
- This <?cs var:kind ?> is deprecated.<?cs
-/def ?>
-
-<?cs # Show the short-form description of something. These come from shortDescr and deprecated ?><?cs
-def:short_descr(obj) ?><?cs
- if:subcount(obj.deprecated) ?>
- <em><?cs call:deprecated_text(obj.kind) ?>
- <?cs call:tag_list(obj.deprecated) ?></em><?cs
- else ?><?cs call:tag_list(obj.shortDescr) ?><?cs
- /if ?><?cs
-/def ?>
-
-<?cs # Show the red box with the deprecated warning ?><?cs
-def:deprecated_warning(obj) ?><?cs
- if:subcount(obj.deprecated) ?><p>
- <p class="caution">
- <strong><?cs call:deprecated_text(obj.kind) ?></strong><br/> <?cs
- call:tag_list(obj.deprecated) ?>
- </p><?cs
- /if ?><?cs
-/def ?>
-
-<?cs # print the See Also: section ?><?cs
-def:see_also_tags(also) ?><?cs
- if:subcount(also) ?>
- <div class="jd-tagdata">
- <h5 class="jd-tagtitle">See Also</h5>
- <ul class="nolist"><?cs
- each:tag=also ?><li><?cs
- if:tag.kind == "@see" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs
- var:tag.label ?></a></code><?cs
- elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs
- elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs
- else ?>[ERROR: Unknown @see kind]<?cs
- /if ?></li><?cs
- /each ?>
- </ul>
- </div><?cs
- /if ?>
-<?cs /def ?>
-
-<?cs # print the API Level ?><?cs
-def:since_tags(obj) ?>
- Since: <a href="<?cs var:toroot ?>guide/appendix/api-levels.html#level<?cs var:obj.since ?>">API Level <?cs var:obj.since ?></a>
-<?cs /def ?>
-
-<?cs # Print the long-form description for something.
- Uses the following fields: deprecated descr seeAlso since ?><?cs
-def:description(obj) ?><?cs
- call:deprecated_warning(obj) ?>
- <div class="jd-tagdata jd-tagdescr"><p><?cs call:tag_list(obj.descr) ?></p></div><?cs
- if:subcount(obj.attrRefs) ?>
- <div class="jd-tagdata">
- <h5 class="jd-tagtitle">Related XML Attributes</h5>
- <ul class="nolist"><?cs
- each:attr=obj.attrRefs ?>
- <li><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li><?cs
- /each ?>
- </ul>
- </div><?cs
- /if ?><?cs
- if:subcount(obj.paramTags) ?>
- <div class="jd-tagdata">
- <h5 class="jd-tagtitle">Parameters</h5>
- <table class="jd-tagtable"><?cs
- each:tag=obj.paramTags ?>
- <tr>
- <th><?cs if:tag.isTypeParameter ?><<?cs /if ?><?cs var:tag.name
- ?><?cs if:tag.isTypeParameter ?>><?cs /if ?></td>
- <td><?cs call:tag_list(tag.comment) ?></td>
- </tr><?cs
- /each ?>
- </table>
- </div><?cs
- /if ?><?cs
- if:subcount(obj.returns) ?>
- <div class="jd-tagdata">
- <h5 class="jd-tagtitle">Returns</h5>
- <ul class="nolist"><li><?cs call:tag_list(obj.returns) ?></li></ul>
- </div><?cs
- /if ?><?cs
- if:subcount(obj.throws) ?>
- <div class="jd-tagdata">
- <h5 class="jd-tagtitle">Throws</h5>
- <table class="jd-tagtable"><?cs
- each:tag=obj.throws ?>
- <tr>
- <th><?cs call:type_link(tag.type) ?></td>
- <td><?cs call:tag_list(tag.comment) ?></td>
- </tr><?cs
- /each ?>
- </table>
- </div><?cs
- /if ?><?cs
- call:see_also_tags(obj.seeAlso) ?><?cs
-/def ?>
-
-<?cs # A table of links to classes with descriptions, as in a package file or the nested classes ?><?cs
-def:class_link_table(classes) ?><?cs
- set:count = #1 ?>
- <table class="jd-sumtable-expando"><?cs
- each:cl=classes ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" >
- <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
- <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?> </td>
- </tr><?cs set:count = count + #1 ?><?cs
- /each ?>
- </table><?cs
-/def ?>
-
-<?cs # A list of links to classes, for use in the side navigation of classes when viewing a package (panel nav) ?><?cs
-def:class_link_list(label, classes) ?><?cs
- if:subcount(classes) ?>
- <li><h2><?cs var:label ?></h2>
- <ul><?cs
- each:cl=classes ?>
- <li class="api apilevel-<?cs var:cl.type.since ?>"><?cs call:type_link(cl.type) ?></li><?cs
- /each ?>
- </ul>
- </li><?cs
- /if ?><?cs
-/def ?>
-
-<?cs # A list of links to classes, for use in the side navigation of classes when viewing a class (panel nav) ?><?cs
-def:list(label, classes) ?><?cs
- if:subcount(classes) ?>
- <li><h2><?cs var:label ?></h2>
- <ul><?cs
- each:cl=classes ?>
- <li class="<?cs if:class.name == cl.label?>selected <?cs /if ?>api apilevel-<?cs var:cl.since ?>"><?cs call:type_link(cl) ?></li><?cs
- /each ?>
- </ul>
- </li><?cs
- /if ?><?cs
-/def ?>
-
-<?cs # A list of links to packages, for use in the side navigation of packages (panel nav) ?><?cs
-def:package_link_list(packages) ?><?cs
- each:pkg=packages ?>
- <li class="<?cs if:(class.package.name == pkg.name) || (package.name == pkg.name)?>selected <?cs /if ?>api apilevel-<?cs var:pkg.since ?>"><?cs call:package_link(pkg) ?></li><?cs
- /each ?><?cs
-/def ?>
-
-<?cs # An expando trigger ?><?cs
-def:expando_trigger(id, default) ?>
- <a href="#" onclick="return toggleInherited(this, null)" id="<?cs var:id ?>" class="jd-expando-trigger closed"
- ><img id="<?cs var:id ?>-trigger"
- src="<?cs var:toroot ?>assets/images/triangle-<?cs var:default ?>.png"
- class="jd-expando-trigger-img" /></a><?cs
-/def ?>
-
-<?cs # An expandable list of classes ?><?cs
-def:expandable_class_list(id, classes, default) ?>
- <div id="<?cs var:id ?>">
- <div id="<?cs var:id ?>-list"
- class="jd-inheritedlinks"
- <?cs if:default != "list" ?>style="display: none;"<?cs /if ?>
- ><?cs
- each:cl=classes ?>
- <?cs call:type_link(cl.type) ?><?cs if:!last(cl) ?>,<?cs /if ?><?cs
- /each ?>
- </div>
- <div id="<?cs var:id ?>-summary"
- <?cs if:default != "summary" ?>style="display: none;"<?cs /if ?>
- ><?cs
- call:class_link_table(classes) ?>
- </div>
- </div><?cs
-/def ?>
-
-
-<?cs include:"customization.cs" ?>
diff --git a/tools/droiddoc/templates/navtree_data.cs b/tools/droiddoc/templates/navtree_data.cs
deleted file mode 100644
index c707232..0000000
--- a/tools/droiddoc/templates/navtree_data.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-var NAVTREE_DATA =
-<?cs var:reference_tree ?>
-;
-
diff --git a/tools/droiddoc/templates/nosidenavpage.cs b/tools/droiddoc/templates/nosidenavpage.cs
deleted file mode 100644
index 1dec41e..0000000
--- a/tools/droiddoc/templates/nosidenavpage.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<body class="gc-documentation">
-<a name="top"></a>
-<?cs call:custom_masthead() ?>
-
-<div id="body-content">
-<div id="doc-content" style="position:relative;">
-
-<?cs call:tag_list(root.descr) ?>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
-
-
-
diff --git a/tools/droiddoc/templates/package-descr.cs b/tools/droiddoc/templates/package-descr.cs
deleted file mode 100644
index 08fee18..0000000
--- a/tools/droiddoc/templates/package-descr.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<body class="<?cs var:package.since ?>">
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content">
-
-<div id="api-info-block">
-<div class="api-level">
- <?cs call:since_tags(package) ?>
-</div>
-</div>
-
-<div id="jd-header">
- package
- <h1><?cs var:package.name ?></b></h1>
- <div class="jd-nav">
- <a class="jd-navlink" href="package-summary.html">Classes</a> | Description
- </div>
-</div><!-- end header -->
-
-<div id="naMessage"></div>
-
-<div id="jd-content" class="api apilevel-<?cs var:package.since ?>">
-<div class="jd-descr">
-<p><?cs call:tag_list(package.descr) ?></p>
-</div>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end jd-content -->
-</div> <!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
diff --git a/tools/droiddoc/templates/package-list.cs b/tools/droiddoc/templates/package-list.cs
deleted file mode 100644
index 7f0f889..0000000
--- a/tools/droiddoc/templates/package-list.cs
+++ /dev/null
@@ -1,2 +0,0 @@
-<?cs each:pkg=docs.packages ?><?cs var: pkg.name ?>
-<?cs /each ?>
diff --git a/tools/droiddoc/templates/package.cs b/tools/droiddoc/templates/package.cs
deleted file mode 100644
index b29bc77..0000000
--- a/tools/droiddoc/templates/package.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<body class="<?cs var:package.since ?>">
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content">
-
-<div id="api-info-block">
-<div class="api-level">
- <?cs call:since_tags(package) ?>
-</div>
-</div>
-
-<div id="jd-header">
- package
- <h1><?cs var:package.name ?></h1>
- <div class="jd-nav">
- <?cs if:subcount(package.shortDescr) ?>
- Classes | <a class="jd-navlink" href="package-descr.html">Description</a>
- <?cs /if ?>
- </div>
-</div><!-- end header -->
-
-<div id="naMessage"></div>
-
-<div id="jd-content" class="api apilevel-<?cs var:package.since ?>">
-
-<?cs if:subcount(package.shortDescr) ?>
- <div class="jd-descr">
- <p><?cs call:tag_list(package.shortDescr) ?></p>
- <p><span class="jd-more"><a href="package-descr.html">more...</a></span></p>
- </div>
-<?cs /if ?>
-
-<?cs def:class_table(label, classes) ?>
- <?cs if:subcount(classes) ?>
- <h3><?cs var:label ?></h3>
- <div class="jd-sumtable">
- <?cs call:class_link_table(classes) ?>
- </div>
- <?cs /if ?>
-<?cs /def ?>
-
-<?cs call:class_table("Interfaces", package.interfaces) ?>
-<?cs call:class_table("Classes", package.classes) ?>
-<?cs call:class_table("Enums", package.enums) ?>
-<?cs call:class_table("Exceptions", package.exceptions) ?>
-<?cs call:class_table("Errors", package.errors) ?>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end jd-content -->
-</div><!-- doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
diff --git a/tools/droiddoc/templates/packages.cs b/tools/droiddoc/templates/packages.cs
deleted file mode 100644
index 8650ad1..0000000
--- a/tools/droiddoc/templates/packages.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<body class="gc-documentation">
-<?cs include:"header.cs" ?>
-
-<div class="g-unit" id="doc-content">
-
-<div id="jd-header">
-<h1><?cs var:page.title ?></h1>
-</div>
-
-<div id="jd-content">
-
-<div class="jd-descr">
-<p><?cs call:tag_list(root.descr) ?></p>
-</div>
-
-<?cs set:count = #1 ?>
-<table class="jd-sumtable">
-<?cs each:pkg = docs.packages ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:pkg.since ?>" >
- <td class="jd-linkcol"><?cs call:package_link(pkg) ?></td>
- <td class="jd-descrcol" width="100%"><?cs call:tag_list(pkg.shortDescr) ?></td>
- </tr>
-<?cs set:count = count + #1 ?>
-<?cs /each ?>
-</table>
-
-<?cs include:"footer.cs" ?>
-</div><!-- end jd-content -->
-</div> <!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
diff --git a/tools/droiddoc/templates/sample.cs b/tools/droiddoc/templates/sample.cs
deleted file mode 100644
index 7979b2a..0000000
--- a/tools/droiddoc/templates/sample.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-<?cs include:"doctype.cs" ?>
-<?cs include:"macros.cs" ?>
-<?cs set:resources="true" ?>
-<html>
-<?cs include:"head_tag.cs" ?>
-<?cs include:"header.cs" ?>
-<body class="gc-documentation">
-
-
-<a name="top"></a>
-<div class="g-unit" id="doc-content">
- <div id="jd-header" class="guide-header">
- <span class="crumb"> </span>
- <h1><?cs var:page.title ?></h1>
- </div>
-
-<div id="jd-content">
-
-<p>The file containing the source code shown below is located in the corresponding directory in <code><sdk>/platforms/android-<version>/samples/...</code></p>
-
-<!-- begin file contents -->
-<pre><?cs var:fileContents ?></pre>
-<!-- end file contents -->
-
-<?cs include:"footer.cs" ?>
-</div><!-- end jd-content -->
-</div> <!-- end doc-content -->
-
-<?cs include:"trailer.cs" ?>
-
-</body>
-</html>
diff --git a/tools/droiddoc/templates/todo.cs b/tools/droiddoc/templates/todo.cs
deleted file mode 100644
index e9f7237..0000000
--- a/tools/droiddoc/templates/todo.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title><?cs var:page.title ?></title>
- <style type="text/css">
- table {
- border-width: 1px 1px 1px 1px;
- border-spacing: 0px;
- border-style: solid solid solid solid;
- border-color: black black black black;
- border-collapse: collapse;
- background-color: white;
- }
- table th {
- border-width: 1px 1px 1px 1px;
- padding: 1px 4px 1px 3px;
- border-style: inset inset inset inset;
- border-color: gray gray gray gray;
- background-color: white;
- }
- table td {
- border-width: 1px 1px 1px 1px;
- padding: 1px 4px 1px 3px;
- border-style: inset inset inset inset;
- border-color: gray gray gray gray;
- background-color: white;
- }
- </style>
-</head>
-<body>
-<h1><?cs var:page.title ?></h1>
-
-<h2>Overall</h2>
-<table>
-<tr><th>Errors</th><td><?cs var:all.errorCount ?></td></tr>
-<tr><th>Percent Good</th><td><?cs var:all.percentGood ?></td></tr>
-<tr><th>Total Comments</th><td><?cs var:all.totalCount ?></td></tr>
-</table>
-
-<h2>Package Summary</h2>
-
-<table>
-<tr>
- <th>Package</th>
- <th>Errors</th>
- <th>Percent Good</th>
- <th>Total</th>
-</tr>
-<?cs each:pkg=packages ?>
-<tr>
- <td><?cs var:pkg.name ?></td>
- <td><?cs var:pkg.errorCount ?></td>
- <td><?cs var:pkg.percentGood ?></td>
- <td><?cs var:pkg.totalCount ?></td>
-</tr>
-<?cs /each ?>
-</table>
-
-
-<h2>Class Summary</h3>
-
-<table>
-<tr>
- <th>Class</th>
- <th>Errors</th>
- <th>Percent Good</th>
- <th>Total</th>
-</tr>
-<?cs each:cl=classes ?>
-<tr>
- <td><a href="#class_<?cs var:cl.qualified ?>"><?cs var:cl.qualified ?></a></td>
- <td><?cs var:cl.errorCount ?></td>
- <td><?cs var:cl.percentGood ?></td>
- <td><?cs var:cl.totalCount ?></td>
-</tr>
-<?cs /each ?>
-</table>
-
-<h2>Detail</h2>
-
-<?cs each:cl=classes ?>
-<h3><a name="class_<?cs var:cl.qualified ?>"><?cs var:cl.qualified ?></a></h3>
-<p>Errors: <?cs var:cl.errorCount ?><br/>
-Total: <?cs var:cl.totalCount ?><br/>
-Percent Good: <?cs var:cl.percentGood ?></p>
-<table>
-<?cs each:err=cl.errors ?>
-<tr>
- <td><?cs var:err.pos ?></td>
- <td><?cs var:err.name ?></td>
- <td><?cs var:err.descr ?></td>
-</tr>
-<?cs /each ?>
-</table>
-
-<?cs /each ?>
-
-</body>
-</html>
diff --git a/tools/releasetools/check_target_files_signatures b/tools/releasetools/check_target_files_signatures
index 17aebdc..2c97e2e 100755
--- a/tools/releasetools/check_target_files_signatures
+++ b/tools/releasetools/check_target_files_signatures
@@ -47,7 +47,6 @@
import os
import re
-import sha
import shutil
import subprocess
import tempfile
@@ -112,7 +111,7 @@
self.certs[cert] = self.certs[cert] + "," + name
else:
if name is None:
- name = "unknown cert %s (%s)" % (sha.sha(cert).hexdigest()[:12],
+ name = "unknown cert %s (%s)" % (common.sha1(cert).hexdigest()[:12],
GetCertSubject(cert))
self.certs[cert] = name
@@ -245,7 +244,7 @@
self.max_fn_len = 20
def LoadZipFile(self, filename):
- d = common.UnzipTemp(filename, '*.apk')
+ d, z = common.UnzipTemp(filename, '*.apk')
try:
self.apks = {}
self.apks_by_basename = {}
@@ -263,7 +262,6 @@
finally:
shutil.rmtree(d)
- z = zipfile.ZipFile(open(filename, "rb"))
self.certmap = common.ReadApkCerts(z)
z.close()
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a236a12..3cc86bf 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -19,7 +19,6 @@
import imp
import os
import re
-import sha
import shutil
import subprocess
import sys
@@ -28,6 +27,13 @@
import time
import zipfile
+try:
+ import hashlib
+ sha1 = hashlib.sha1
+except ImportError:
+ import sha
+ sha1 = sha.sha
+
# missing in Python 2.4 and before
if not hasattr(os, "SEEK_SET"):
os.SEEK_SET = 0
@@ -163,23 +169,6 @@
for k, v in sorted(d.items()):
print "%-25s = (%s) %s" % (k, type(v).__name__, v)
-def BuildAndAddBootableImage(sourcedir, targetname, output_zip, info_dict):
- """Take a kernel, cmdline, and ramdisk directory from the input (in
- 'sourcedir'), and turn them into a boot image. Put the boot image
- into the output zip file under the name 'targetname'. Returns
- targetname on success or None on failure (if sourcedir does not
- appear to contain files for the requested image)."""
-
- print "creating %s..." % (targetname,)
-
- img = BuildBootableImage(sourcedir)
- if img is None:
- return None
-
- CheckSize(img, targetname, info_dict)
- ZipWriteStr(output_zip, targetname, img)
- return targetname
-
def BuildBootableImage(sourcedir):
"""Take a kernel, cmdline, and ramdisk directory from the input (in
'sourcedir'), and turn them into a boot image. Return the image
@@ -237,28 +226,53 @@
return data
-def AddRecovery(output_zip, info_dict):
- BuildAndAddBootableImage(os.path.join(OPTIONS.input_tmp, "RECOVERY"),
- "recovery.img", output_zip, info_dict)
+def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir):
+ """Return a File object (with name 'name') with the desired bootable
+ image. Look for it in 'unpack_dir'/BOOTABLE_IMAGES under the name
+ 'prebuilt_name', otherwise construct it from the source files in
+ 'unpack_dir'/'tree_subdir'."""
-def AddBoot(output_zip, info_dict):
- BuildAndAddBootableImage(os.path.join(OPTIONS.input_tmp, "BOOT"),
- "boot.img", output_zip, info_dict)
+ prebuilt_path = os.path.join(unpack_dir, "BOOTABLE_IMAGES", prebuilt_name)
+ if os.path.exists(prebuilt_path):
+ print "using prebuilt %s..." % (prebuilt_name,)
+ return File.FromLocalFile(name, prebuilt_path)
+ else:
+ print "building image from target_files %s..." % (tree_subdir,)
+ return File(name, BuildBootableImage(os.path.join(unpack_dir, tree_subdir)))
+
def UnzipTemp(filename, pattern=None):
- """Unzip the given archive into a temporary directory and return the name."""
+ """Unzip the given archive into a temporary directory and return the name.
+
+ If filename is of the form "foo.zip+bar.zip", unzip foo.zip into a
+ temp dir, then unzip bar.zip into that_dir/BOOTABLE_IMAGES.
+
+ Returns (tempdir, zipobj) where zipobj is a zipfile.ZipFile (of the
+ main file), open for reading.
+ """
tmp = tempfile.mkdtemp(prefix="targetfiles-")
OPTIONS.tempfiles.append(tmp)
- cmd = ["unzip", "-o", "-q", filename, "-d", tmp]
- if pattern is not None:
- cmd.append(pattern)
- p = Run(cmd, stdout=subprocess.PIPE)
- p.communicate()
- if p.returncode != 0:
- raise ExternalError("failed to unzip input target-files \"%s\"" %
- (filename,))
- return tmp
+
+ def unzip_to_dir(filename, dirname):
+ cmd = ["unzip", "-o", "-q", filename, "-d", dirname]
+ if pattern is not None:
+ cmd.append(pattern)
+ p = Run(cmd, stdout=subprocess.PIPE)
+ p.communicate()
+ if p.returncode != 0:
+ raise ExternalError("failed to unzip input target-files \"%s\"" %
+ (filename,))
+
+ m = re.match(r"^(.*[.]zip)\+(.*[.]zip)$", filename, re.IGNORECASE)
+ if m:
+ unzip_to_dir(m.group(1), tmp)
+ unzip_to_dir(m.group(2), os.path.join(tmp, "BOOTABLE_IMAGES"))
+ filename = m.group(1)
+ else:
+ unzip_to_dir(filename, tmp)
+
+ return tmp, zipfile.ZipFile(filename, "r")
def GetKeyPasswords(keylist):
@@ -359,18 +373,17 @@
# image size should be increased by 1/64th to account for the
# spare area (64 bytes per 2k page)
limit = limit / 2048 * (2048+64)
-
- size = len(data)
- pct = float(size) * 100.0 / limit
- msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
- if pct >= 99.0:
- raise ExternalError(msg)
- elif pct >= 95.0:
- print
- print " WARNING: ", msg
- print
- elif OPTIONS.verbose:
- print " ", msg
+ size = len(data)
+ pct = float(size) * 100.0 / limit
+ msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
+ if pct >= 99.0:
+ raise ExternalError(msg)
+ elif pct >= 95.0:
+ print
+ print " WARNING: ", msg
+ print
+ elif OPTIONS.verbose:
+ print " ", msg
def ReadApkCerts(tf_zip):
@@ -651,7 +664,14 @@
self.name = name
self.data = data
self.size = len(data)
- self.sha1 = sha.sha(data).hexdigest()
+ self.sha1 = sha1(data).hexdigest()
+
+ @classmethod
+ def FromLocalFile(cls, name, diskname):
+ f = open(diskname, "rb")
+ data = f.read()
+ f.close()
+ return File(name, data)
def WriteToTemp(self):
t = tempfile.NamedTemporaryFile()
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 756d673..4ed1a07 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -168,17 +168,21 @@
"""Format the given partition, specified by its mount point (eg,
"/system")."""
+ reserve_size = 0
fstab = self.info.get("fstab", None)
if fstab:
p = fstab[partition]
- self.script.append('format("%s", "%s", "%s");' %
- (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device))
+ # Reserve the last 16 Kbytes of an EMMC /data for the crypto footer
+ if partition == "/data" and common.PARTITION_TYPES[p.fs_type] == "EMMC":
+ reserve_size = -16384
+ self.script.append('format("%s", "%s", "%s", "%s");' %
+ (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device, reserve_size))
else:
# older target-files without per-partition types
partition = self.info.get("partition_path", "") + partition
- self.script.append('format("%s", "%s", "%s");' %
+ self.script.append('format("%s", "%s", "%s", "%s");' %
(self.info["fs_type"], self.info["partition_type"],
- partition))
+ partition, reserve_size))
def DeleteFiles(self, file_list):
"""Delete all files in file_list."""
@@ -269,6 +273,20 @@
",\0".join(['"' + i + '"' for i in sorted(links)]) + ");")
self.script.append(self._WordWrap(cmd))
+ def RetouchBinaries(self, file_list):
+ """Execute the retouch instructions in files listed."""
+ cmd = ('retouch_binaries(' +
+ ', '.join(['"' + i[0] + '", "' + i[1] + '"' for i in file_list]) +
+ ');')
+ self.script.append(self._WordWrap(cmd))
+
+ def UndoRetouchBinaries(self, file_list):
+ """Undo the retouching (retouch to zero offset)."""
+ cmd = ('undo_retouch_binaries(' +
+ ', '.join(['"' + i[0] + '", "' + i[1] + '"' for i in file_list]) +
+ ');')
+ self.script.append(self._WordWrap(cmd))
+
def AppendExtra(self, extra):
"""Append text verbatim to the output script."""
self.script.append(extra)
diff --git a/tools/releasetools/img_from_target_files b/tools/releasetools/img_from_target_files
index 0139916..08817ca 100755
--- a/tools/releasetools/img_from_target_files
+++ b/tools/releasetools/img_from_target_files
@@ -23,6 +23,10 @@
-b (--board_config) <file>
Deprecated.
+ -z (--bootable_zip)
+ Include only the bootable images (eg 'boot' and 'recovery') in
+ the output.
+
"""
import sys
@@ -78,7 +82,7 @@
build_command.append(user_dir)
build_command.append(img.name)
- p = common.Run(build_command)
+ p = common.Run(build_command);
p.communicate()
assert p.returncode == 0, "build userdata.img image failed"
@@ -149,35 +153,44 @@
def main(argv):
+ bootable_only = [False]
def option_handler(o, a):
if o in ("-b", "--board_config"):
pass # deprecated
+ if o in ("-z", "--bootable_zip"):
+ bootable_only[0] = True
else:
return False
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:",
- extra_long_opts=["board_config="],
+ extra_opts="b:z",
+ extra_long_opts=["board_config=",
+ "bootable_zip"],
extra_option_handler=option_handler)
+ bootable_only = bootable_only[0]
+
if len(args) != 2:
common.Usage(__doc__)
sys.exit(1)
- OPTIONS.input_tmp = common.UnzipTemp(args[0])
-
- input_zip = zipfile.ZipFile(args[0], "r")
+ OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0])
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
- common.AddBoot(output_zip, OPTIONS.info_dict)
- common.AddRecovery(output_zip, OPTIONS.info_dict)
- AddSystem(output_zip)
- AddUserdata(output_zip)
- CopyInfo(output_zip)
+ common.GetBootableImage(
+ "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT").AddToZip(output_zip)
+ common.GetBootableImage(
+ "recovery.img", "recovery.img", OPTIONS.input_tmp,
+ "RECOVERY").AddToZip(output_zip)
+
+ if not bootable_only:
+ AddSystem(output_zip)
+ AddUserdata(output_zip)
+ CopyInfo(output_zip)
print "cleaning up..."
output_zip.close()
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index aa691b4..79c5465 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -44,6 +44,8 @@
-e (--extra_script) <file>
Insert the contents of file at the end of the update script.
+ -a (--aslr_mode) <on|off>
+ Specify whether to turn on ASLR for the package (on by default).
"""
import sys
@@ -56,7 +58,6 @@
import errno
import os
import re
-import sha
import subprocess
import tempfile
import time
@@ -74,6 +75,7 @@
OPTIONS.wipe_user_data = False
OPTIONS.omit_prereq = False
OPTIONS.extra_script = None
+OPTIONS.aslr_mode = True
OPTIONS.worker_threads = 3
def MostPopularKey(d, default):
@@ -90,6 +92,10 @@
symlink."""
return (info.external_attr >> 16) == 0120777
+def IsRegular(info):
+ """Return true if the zipfile.ZipInfo object passed in represents a
+ symlink."""
+ return (info.external_attr >> 28) == 010
class Item:
"""Items represent the metadata (user, group, mode) of files and
@@ -244,13 +250,15 @@
substitute=None):
"""Copies files underneath system/ in the input zip to the output
zip. Populates the Item class with their metadata, and returns a
- list of symlinks. output_zip may be None, in which case the copy is
- skipped (but the other side effects still happen). substitute is an
- optional dict of {output filename: contents} to be output instead of
- certain input files.
+ list of symlinks as well as a list of files that will be retouched.
+ output_zip may be None, in which case the copy is skipped (but the
+ other side effects still happen). substitute is an optional dict
+ of {output filename: contents} to be output instead of certain input
+ files.
"""
symlinks = []
+ retouch_files = []
for info in input_zip.infolist():
if info.filename.startswith("SYSTEM/"):
@@ -268,6 +276,9 @@
data = substitute[fn]
else:
data = input_zip.read(info.filename)
+ if info.filename.startswith("SYSTEM/lib/") and IsRegular(info):
+ retouch_files.append(("/system/" + basefilename,
+ common.sha1(data).hexdigest()))
output_zip.writestr(info2, data)
if fn.endswith("/"):
Item.Get(fn[:-1], dir=True)
@@ -275,7 +286,7 @@
Item.Get(fn, dir=False)
symlinks.sort()
- return symlinks
+ return (symlinks, retouch_files)
def SignOutput(temp_zip_name, output_zip_name):
@@ -300,7 +311,8 @@
patching and install the new recovery image.
recovery_img and boot_img should be File objects for the
- corresponding images.
+ corresponding images. info should be the dictionary returned by
+ common.LoadInfoDict() on the input target_files.
Returns an Item for the shell script, which must be made
executable.
@@ -318,7 +330,7 @@
# we check to see if this recovery has already been installed by
# testing just the first 2k.
HEADER_SIZE = 2048
- header_sha1 = sha.sha(recovery_img.data[:HEADER_SIZE]).hexdigest()
+ header_sha1 = common.sha1(recovery_img.data[:HEADER_SIZE]).hexdigest()
sh = """#!/system/bin/sh
if ! applypatch -c %(recovery_type)s:%(recovery_device)s:%(header_size)d:%(header_sha1)s; then
log -t recovery "Installing new recovery image"
@@ -378,13 +390,17 @@
script.UnpackPackageDir("recovery", "/system")
script.UnpackPackageDir("system", "/system")
- symlinks = CopySystemFiles(input_zip, output_zip)
+ (symlinks, retouch_files) = CopySystemFiles(input_zip, output_zip)
script.MakeSymlinks(symlinks)
+ if OPTIONS.aslr_mode:
+ script.RetouchBinaries(retouch_files)
+ else:
+ script.UndoRetouchBinaries(retouch_files)
- boot_img = common.File("boot.img", common.BuildBootableImage(
- os.path.join(OPTIONS.input_tmp, "BOOT")))
- recovery_img = common.File("recovery.img", common.BuildBootableImage(
- os.path.join(OPTIONS.input_tmp, "RECOVERY")))
+ boot_img = common.GetBootableImage("boot.img", "boot.img",
+ OPTIONS.input_tmp, "BOOT")
+ recovery_img = common.GetBootableImage("recovery.img", "recovery.img",
+ OPTIONS.input_tmp, "RECOVERY")
MakeRecoveryPatch(output_zip, recovery_img, boot_img)
Item.GetMetadata(input_zip)
@@ -420,12 +436,17 @@
"""Load all the files from SYSTEM/... in a given target-files
ZipFile, and return a dict of {filename: File object}."""
out = {}
+ retouch_files = []
for info in z.infolist():
if info.filename.startswith("SYSTEM/") and not IsSymlink(info):
- fn = "system/" + info.filename[7:]
+ basefilename = info.filename[7:]
+ fn = "system/" + basefilename
data = z.read(info.filename)
out[fn] = common.File(fn, data)
- return out
+ if info.filename.startswith("SYSTEM/lib/") and IsRegular(info):
+ retouch_files.append(("/system/" + basefilename,
+ out[fn].sha1))
+ return (out, retouch_files)
def GetBuildProp(property, z):
@@ -447,7 +468,7 @@
if source_version == 0:
print ("WARNING: generating edify script for a source that "
"can't install it.")
- script = edify_generator.EdifyGenerator(source_version, OPTIONS.info_dict)
+ script = edify_generator.EdifyGenerator(source_version, OPTIONS.target_info_dict)
metadata = {"pre-device": GetBuildProp("ro.product.device", source_zip),
"post-timestamp": GetBuildProp("ro.build.date.utc", target_zip),
@@ -464,9 +485,9 @@
info_dict=OPTIONS.info_dict)
print "Loading target..."
- target_data = LoadSystemFiles(target_zip)
+ (target_data, target_retouch_files) = LoadSystemFiles(target_zip)
print "Loading source..."
- source_data = LoadSystemFiles(source_zip)
+ (source_data, source_retouch_files) = LoadSystemFiles(source_zip)
verbatim_targets = []
patch_list = []
@@ -501,7 +522,7 @@
verbatim_targets.append((tf.name, tf.size))
else:
common.ZipWriteStr(output_zip, "patch/" + tf.name + ".p", d)
- patch_list.append((tf.name, tf, sf, tf.size, sha.sha(d).hexdigest()))
+ patch_list.append((tf.name, tf, sf, tf.size, common.sha1(d).hexdigest()))
largest_source_size = max(largest_source_size, sf.size)
source_fp = GetBuildProp("ro.build.fingerprint", source_zip)
@@ -512,20 +533,16 @@
script.Mount("/system")
script.AssertSomeFingerprint(source_fp, target_fp)
- source_boot = common.File("/tmp/boot.img",
- common.BuildBootableImage(
- os.path.join(OPTIONS.source_tmp, "BOOT")))
- target_boot = common.File("/tmp/boot.img",
- common.BuildBootableImage(
- os.path.join(OPTIONS.target_tmp, "BOOT")))
+ source_boot = common.GetBootableImage(
+ "/tmp/boot.img", "boot.img", OPTIONS.source_tmp, "BOOT")
+ target_boot = common.GetBootableImage(
+ "/tmp/boot.img", "boot.img", OPTIONS.target_tmp, "BOOT")
updating_boot = (source_boot.data != target_boot.data)
- source_recovery = common.File("system/recovery.img",
- common.BuildBootableImage(
- os.path.join(OPTIONS.source_tmp, "RECOVERY")))
- target_recovery = common.File("system/recovery.img",
- common.BuildBootableImage(
- os.path.join(OPTIONS.target_tmp, "RECOVERY")))
+ source_recovery = common.GetBootableImage(
+ "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY")
+ target_recovery = common.GetBootableImage(
+ "/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
updating_recovery = (source_recovery.data != target_recovery.data)
# Here's how we divide up the progress bar:
@@ -635,7 +652,7 @@
script.ShowProgress(0.1, 10)
- target_symlinks = CopySystemFiles(target_zip, None)
+ (target_symlinks, target_retouch_dummies) = CopySystemFiles(target_zip, None)
target_symlinks_d = dict([(i[1], i[0]) for i in target_symlinks])
temp_script = script.MakeTemporary()
@@ -644,7 +661,7 @@
# Note that this call will mess up the tree of Items, so make sure
# we're done with it.
- source_symlinks = CopySystemFiles(source_zip, None)
+ (source_symlinks, source_retouch_dummies) = CopySystemFiles(source_zip, None)
source_symlinks_d = dict([(i[1], i[0]) for i in source_symlinks])
# Delete all the symlinks in source that aren't in target. This
@@ -678,6 +695,10 @@
to_create.append((dest, link))
script.DeleteFiles([i[1] for i in to_create])
script.MakeSymlinks(to_create)
+ if OPTIONS.aslr_mode:
+ script.RetouchBinaries(target_retouch_files)
+ else:
+ script.UndoRetouchBinaries(target_retouch_files)
# Now that the symlinks are created, we can set all the
# permissions.
@@ -687,7 +708,7 @@
device_specific.IncrementalOTA_InstallEnd()
if OPTIONS.extra_script is not None:
- scirpt.AppendExtra(OPTIONS.extra_script)
+ script.AppendExtra(OPTIONS.extra_script)
script.AddToZip(target_zip, output_zip)
WriteMetadata(metadata, output_zip)
@@ -708,6 +729,11 @@
OPTIONS.omit_prereq = True
elif o in ("-e", "--extra_script"):
OPTIONS.extra_script = a
+ elif o in ("-a", "--aslr_mode"):
+ if a in ("on", "On", "true", "True", "yes", "Yes"):
+ OPTIONS.aslr_mode = True
+ else:
+ OPTIONS.aslr_mode = False
elif o in ("--worker_threads"):
OPTIONS.worker_threads = int(a)
else:
@@ -715,14 +741,16 @@
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:k:i:d:wne:",
+ extra_opts="b:k:i:d:wne:a:",
extra_long_opts=["board_config=",
"package_key=",
"incremental_from=",
"wipe_user_data",
"no_prereq",
"extra_script=",
- "worker_threads="],
+ "worker_threads=",
+ "aslr_mode=",
+ ],
extra_option_handler=option_handler)
if len(args) != 2:
@@ -733,10 +761,9 @@
OPTIONS.extra_script = open(OPTIONS.extra_script).read()
print "unzipping target target-files..."
- OPTIONS.input_tmp = common.UnzipTemp(args[0])
+ OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0])
OPTIONS.target_tmp = OPTIONS.input_tmp
- input_zip = zipfile.ZipFile(args[0], "r")
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
if OPTIONS.verbose:
print "--- target info ---"
@@ -760,8 +787,7 @@
WriteFullOTAPackage(input_zip, output_zip)
else:
print "unzipping source target-files..."
- OPTIONS.source_tmp = common.UnzipTemp(OPTIONS.incremental_source)
- source_zip = zipfile.ZipFile(OPTIONS.incremental_source, "r")
+ OPTIONS.source_tmp, source_zip = common.UnzipTemp(OPTIONS.incremental_source)
OPTIONS.target_info_dict = OPTIONS.info_dict
OPTIONS.source_info_dict = common.LoadInfoDict(source_zip)
if OPTIONS.verbose:
diff --git a/tools/soslim/main.c b/tools/soslim/main.c
index dd8a60b..df48484 100644
--- a/tools/soslim/main.c
+++ b/tools/soslim/main.c
@@ -188,9 +188,13 @@
else INFO("Not building symbol filter, filter file is empty.\n");
}
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
- int prelinked = 0;
+ int prelinked = 0, retouched = 0;
int elf_little; /* valid if prelinked != 0 */
long prelink_addr; /* valid if prelinked != 0 */
+#define RETOUCH_MAX_SIZE 600000
+ /* _cnt valid if retouched != 0 */
+ unsigned int retouch_byte_cnt = RETOUCH_MAX_SIZE;
+ char retouch_buf[RETOUCH_MAX_SIZE]; /* valid if retouched != 0 */
#endif
clone_elf(elf, newelf,
infile, outfile,
@@ -200,7 +204,10 @@
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
, &prelinked,
&elf_little,
- &prelink_addr
+ &prelink_addr,
+ &retouched,
+ &retouch_byte_cnt,
+ retouch_buf
#endif
,
true, /* rebuild the section-header-strings table */
@@ -223,6 +230,13 @@
infile, strerror(errno), errno);
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
+ if (retouched) {
+ INFO("File has retouch data, putting it back in place.\n");
+ retouch_dump(outfile != NULL ? outfile : infile,
+ elf_little,
+ retouch_byte_cnt,
+ retouch_buf);
+ }
if (prelinked) {
INFO("File is prelinked, putting prelink TAG back in place.\n");
setup_prelink_info(outfile != NULL ? outfile : infile,
diff --git a/tools/soslim/prelink_info.c b/tools/soslim/prelink_info.c
index 81d5de3..2600ac7 100644
--- a/tools/soslim/prelink_info.c
+++ b/tools/soslim/prelink_info.c
@@ -11,6 +11,7 @@
#include <debug.h>
#include <common.h>
+#define RETOUCH_SUFFIX_SIZE 12
typedef struct {
uint32_t mmap_addr;
char tag[4]; /* 'P', 'R', 'E', ' ' */
@@ -28,7 +29,7 @@
}
else {
/* Different endianness */
- *prelink_addr = switch_endianness(info->mmap_addr);
+ *prelink_addr = switch_endianness(info->mmap_addr);
}
}
}
@@ -67,10 +68,104 @@
set_prelink(prelink_addr, elf_little, &info);
prelinked = 1;
}
- FAILIF(close(fd) < 0, "close(%d): %s (%d)!\n", fd, strerror(errno), errno);
+ FAILIF(close(fd) < 0,
+ "close(%d): %s (%d)!\n", fd, strerror(errno), errno);
return prelinked;
}
+int check_retouched(const char *fname, int elf_little,
+ unsigned int *retouch_byte_cnt, char *retouch_buf) {
+ FAILIF(sizeof(prelink_info_t) != 8,
+ "Unexpected sizeof(prelink_info_t) == %d!\n",
+ sizeof(prelink_info_t));
+ int fd = open(fname, O_RDONLY);
+ FAILIF(fd < 0, "open(%s, O_RDONLY): %s (%d)!\n",
+ fname, strerror(errno), errno);
+ off_t end = lseek(fd, 0, SEEK_END);
+ int nr = sizeof(prelink_info_t);
+ off_t sz = lseek(fd, -nr-RETOUCH_SUFFIX_SIZE, SEEK_CUR);
+ ASSERT((long)(end - sz) == (long)(nr+RETOUCH_SUFFIX_SIZE));
+ FAILIF(sz == (off_t)-1,
+ "lseek(%d, 0, SEEK_END): %s (%d)!\n",
+ fd, strerror(errno), errno);
+
+ char retouch_meta[RETOUCH_SUFFIX_SIZE];
+ int num_read = read(fd, &retouch_meta, RETOUCH_SUFFIX_SIZE);
+ FAILIF(num_read < 0,
+ "read(%d, &info, sizeof(prelink_info_t)): %s (%d)!\n",
+ fd, strerror(errno), errno);
+ FAILIF(num_read != RETOUCH_SUFFIX_SIZE,
+ "read(%d, &info, sizeof(prelink_info_t)): did not read %d bytes as "
+ "expected (read %d)!\n",
+ fd, RETOUCH_SUFFIX_SIZE, num_read);
+
+ int retouched = 0;
+ if (!strncmp(retouch_meta, "RETOUCH ", 8)) {
+ unsigned int retouch_byte_cnt_meta;
+ if (!(elf_little ^ is_host_little()))
+ retouch_byte_cnt_meta = *(unsigned int *)(retouch_meta+8);
+ else
+ retouch_byte_cnt_meta =
+ switch_endianness(*(unsigned int *)(retouch_meta+8));
+ FAILIF(*retouch_byte_cnt < retouch_byte_cnt_meta,
+ "Retouch buffer too small at %d bytes (%d needed).",
+ *retouch_byte_cnt, retouch_byte_cnt_meta);
+ *retouch_byte_cnt = retouch_byte_cnt_meta;
+ off_t sz = lseek(fd,
+ -((long)*retouch_byte_cnt)-RETOUCH_SUFFIX_SIZE-nr,
+ SEEK_END);
+ ASSERT((long)(end - sz) ==
+ (long)(*retouch_byte_cnt+RETOUCH_SUFFIX_SIZE+nr));
+ FAILIF(sz == (off_t)-1,
+ "lseek(%d, 0, SEEK_END): %s (%d)!\n",
+ fd, strerror(errno), errno);
+ num_read = read(fd, retouch_buf, *retouch_byte_cnt);
+ FAILIF(num_read < 0,
+ "read(%d, &info, sizeof(prelink_info_t)): %s (%d)!\n",
+ fd, strerror(errno), errno);
+ FAILIF(num_read != *retouch_byte_cnt,
+ "read(%d, retouch_buf, %u): did not read %d bytes as "
+ "expected (read %d)!\n",
+ fd, *retouch_byte_cnt, *retouch_byte_cnt, num_read);
+
+ retouched = 1;
+ }
+ FAILIF(close(fd) < 0, "close(%d): %s (%d)!\n", fd, strerror(errno), errno);
+ return retouched;
+}
+
+void retouch_dump(const char *fname, int elf_little,
+ unsigned int retouch_byte_cnt, char *retouch_buf) {
+ int fd = open(fname, O_WRONLY);
+ FAILIF(fd < 0,
+ "open(%s, O_WRONLY): %s (%d)\n",
+ fname, strerror(errno), errno);
+ off_t sz = lseek(fd, 0, SEEK_END);
+ FAILIF(sz == (off_t)-1,
+ "lseek(%d, 0, SEEK_END): %s (%d)!\n",
+ fd, strerror(errno), errno);
+
+ // The retouch blob ends with "RETOUCH XXXX", where XXXX is the 4-byte
+ // size of the retouch blob, in target endianness.
+ strncpy(retouch_buf+retouch_byte_cnt, "RETOUCH ", 8);
+ if (elf_little ^ is_host_little()) {
+ *(unsigned int *)(retouch_buf+retouch_byte_cnt+8) =
+ switch_endianness(retouch_byte_cnt);
+ } else {
+ *(unsigned int *)(retouch_buf+retouch_byte_cnt+8) =
+ retouch_byte_cnt;
+ }
+
+ int num_written = write(fd, retouch_buf, retouch_byte_cnt+12);
+ FAILIF(num_written < 0,
+ "write(%d, &info, sizeof(info)): %s (%d)\n",
+ fd, strerror(errno), errno);
+ FAILIF((retouch_byte_cnt+12) != num_written,
+ "Could not write %d bytes as expected (wrote %d bytes instead)!\n",
+ retouch_byte_cnt, num_written);
+ FAILIF(close(fd) < 0, "close(%d): %s (%d)!\n", fd, strerror(errno), errno);
+}
+
void setup_prelink_info(const char *fname, int elf_little, long base)
{
FAILIF(sizeof(prelink_info_t) != 8, "Unexpected sizeof(prelink_info_t) == %zd!\n", sizeof(prelink_info_t));
@@ -92,7 +187,7 @@
else {
/* Different endianness */
INFO("Host and ELF file [%s] have different endianness.\n", fname);
- info.mmap_addr = switch_endianness(base);
+ info.mmap_addr = switch_endianness(base);
}
strncpy(info.tag, "PRE ", 4);
diff --git a/tools/soslim/prelink_info.h b/tools/soslim/prelink_info.h
index e2787cb..efa84fd 100644
--- a/tools/soslim/prelink_info.h
+++ b/tools/soslim/prelink_info.h
@@ -3,6 +3,10 @@
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
int check_prelinked(const char *fname, int elf_little, long *prelink_addr);
+int check_retouched(const char *fname, int elf_little,
+ unsigned int *retouch_byte_cnt, char *retouch_buf);
+void retouch_dump(const char *fname, int elf_little,
+ unsigned int retouch_byte_cnt, char *retouch_buf);
void setup_prelink_info(const char *fname, int elf_little, long base);
#endif
diff --git a/tools/soslim/soslim.c b/tools/soslim/soslim.c
index 125e29e..33b1ee7 100644
--- a/tools/soslim/soslim.c
+++ b/tools/soslim/soslim.c
@@ -27,7 +27,10 @@
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
, int *prelinked,
int *elf_little,
- long *prelink_addr
+ long *prelink_addr,
+ int *retouched,
+ unsigned int *retouch_byte_cnt,
+ char *retouch_buf
#endif
, bool rebuild_shstrtab,
bool strip_debug,
@@ -70,6 +73,11 @@
ASSERT(elf_little);
*elf_little = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB);
*prelinked = check_prelinked(elf_name, *elf_little, prelink_addr);
+ ASSERT(retouched);
+ ASSERT(retouch_byte_cnt);
+ ASSERT(retouch_buf);
+ *retouched = check_retouched(elf_name, *elf_little,
+ retouch_byte_cnt, retouch_buf);
#endif
INFO("\n\nCALCULATING MODIFICATIONS\n\n");
diff --git a/tools/soslim/soslim.h b/tools/soslim/soslim.h
index dfcb085..952c960 100644
--- a/tools/soslim/soslim.h
+++ b/tools/soslim/soslim.h
@@ -23,7 +23,10 @@
#ifdef SUPPORT_ANDROID_PRELINK_TAGS
, int *prelinked,
int *elf_little,
- long *prelink_addr
+ long *prelink_addr,
+ int *retouched,
+ unsigned int *retouch_byte_cnt,
+ char *retouch_buf
#endif
, bool rebuild_shstrtab,
bool strip_debug,