• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

build


Commit MetaInfo

Revisiondc785843c7f1f4dcbcf603c8ae8e9599ea2d15b1 (tree)
Time2009-09-04 06:12:45
AuthorJean-Baptiste Queru <jbq@goog...>
CommiterJean-Baptiste Queru

Log Message

merge from donut

Change Summary

Incremental Difference

--- a/core/Makefile
+++ b/core/Makefile
@@ -299,7 +299,7 @@ else # TARGET_BOOTIMAGE_USE_EXT2 != true
299299 $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
300300 $(call pretty,"Target boot image: $@")
301301 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
302- $(hide) $(call assert-max-file-size,$@,$(BOARD_BOOTIMAGE_MAX_SIZE))
302+ $(hide) $(call assert-max-file-size,$@,$(BOARD_BOOTIMAGE_MAX_SIZE),raw)
303303 endif # TARGET_BOOTIMAGE_USE_EXT2
304304
305305 else # TARGET_NO_KERNEL
@@ -577,7 +577,7 @@ $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
577577 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
578578 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
579579 @echo ----- Made recovery image -------- $@
580- $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE))
580+ $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE),raw)
581581
582582 else
583583 INSTALLED_RECOVERYIMAGE_TARGET :=
@@ -662,7 +662,7 @@ endif
662662 $(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
663663 @echo "Install system fs image: $@"
664664 $(copy-file-to-target)
665- $(hide) $(call assert-max-file-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_MAX_SIZE))
665+ $(hide) $(call assert-max-file-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_MAX_SIZE),yaffs)
666666
667667 systemimage: $(INSTALLED_SYSTEMIMAGE)
668668
@@ -671,7 +671,7 @@ systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
671671 | $(INTERNAL_MKUSERFS)
672672 @echo "make $@: ignoring dependencies"
673673 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
674- $(hide) $(call assert-max-file-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_MAX_SIZE))
674+ $(hide) $(call assert-max-file-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_MAX_SIZE),yaffs)
675675
676676 #######
677677 ## system tarball
@@ -708,7 +708,7 @@ define build-userdataimage-target
708708 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
709709 @mkdir -p $(TARGET_OUT_DATA)
710710 $(call build-userimage-ext2-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,)
711- $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
711+ $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE),yaffs)
712712 endef
713713
714714 else # TARGET_USERIMAGES_USE_EXT2 != true
@@ -718,7 +718,7 @@ define build-userdataimage-target
718718 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
719719 @mkdir -p $(TARGET_OUT_DATA)
720720 $(hide) $(MKYAFFS2) -f $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
721- $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
721+ $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE),yaffs)
722722 endef
723723 endif # TARGET_USERIMAGES_USE_EXT2
724724
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -47,6 +47,7 @@ LOCAL_PREBUILT_LIBS:=
4747 LOCAL_PREBUILT_EXECUTABLES:=
4848 LOCAL_PREBUILT_JAVA_LIBRARIES:=
4949 LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
50+LOCAL_PREBUILT_STRIP_COMMENTS:=
5051 LOCAL_INTERMEDIATE_SOURCES:=
5152 LOCAL_JAVA_LIBRARIES:=
5253 LOCAL_NO_STANDARD_LIBRARIES:=
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1469,6 +1469,19 @@ define copy-file-to-target-with-cp
14691469 $(hide) cp -fp $< $@
14701470 endef
14711471
1472+# The same as copy-file-to-target, but use the zipalign tool to do so.
1473+define copy-file-to-target-with-zipalign
1474+@mkdir -p $(dir $@)
1475+$(hide) $(ZIPALIGN) -f 4 $< $@
1476+endef
1477+
1478+# The same as copy-file-to-target, but strip out "# comment"-style
1479+# comments (for config files and such).
1480+define copy-file-to-target-strip-comments
1481+@mkdir -p $(dir $@)
1482+$(hide) sed -e 's/#.*$$//' -e 's/[ \t]*$$//' -e '/^$$/d' < $< > $@
1483+endef
1484+
14721485 # The same as copy-file-to-target, but don't preserve
14731486 # the old modification time.
14741487 define copy-file-to-new-target
@@ -1489,6 +1502,18 @@ define transform-prebuilt-to-target
14891502 $(copy-file-to-target)
14901503 endef
14911504
1505+# Copy a prebuilt file to a target location, using zipalign on it.
1506+define transform-prebuilt-to-target-with-zipalign
1507+@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt APK: $(PRIVATE_MODULE) ($@)"
1508+$(copy-file-to-target-with-zipalign)
1509+endef
1510+
1511+# Copy a prebuilt file to a target location, stripping "# comment" comments.
1512+define transform-prebuilt-to-target-strip-comments
1513+@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt: $(PRIVATE_MODULE) ($@)"
1514+$(copy-file-to-target-strip-comments)
1515+endef
1516+
14921517
14931518 ###########################################################
14941519 ## On some platforms (MacOS), after copying a static
@@ -1547,6 +1572,7 @@ endef
15471572
15481573 # $(1): The file(s) to check (often $@)
15491574 # $(2): The maximum total image size, in decimal bytes
1575+# $(3): the type of filesystem "yaffs" or "raw"
15501576 #
15511577 # If $(2) is empty, evaluates to "true"
15521578 #
@@ -1560,9 +1586,15 @@ $(if $(2), \
15601586 printname=$$(echo -n "$(1)" | tr " " +); \
15611587 echo "$$printname total size is $$total"; \
15621588 img_blocksize=$(call image-size-from-data-size,$(BOARD_FLASH_BLOCK_SIZE)); \
1589+ if [ "$(3)" == "yaffs" ]; then \
1590+ reservedblocks=5; \
1591+ else \
1592+ reservedblocks=0; \
1593+ fi; \
15631594 twoblocks=$$((img_blocksize * 2)); \
15641595 onepct=$$((((($(2) / 100) - 1) / img_blocksize + 1) * img_blocksize)); \
1565- reserve=$$((twoblocks > onepct ? twoblocks : onepct)); \
1596+ reserve=$$(((twoblocks > onepct ? twoblocks : onepct) + \
1597+ reservedblocks * img_blocksize)); \
15661598 maxsize=$$(($(2) - reserve)); \
15671599 if [ "$$total" -gt "$$maxsize" ]; then \
15681600 echo "error: $$printname too large ($$total > [$(2) - $$reserve])"; \
--- a/core/main.mk
+++ b/core/main.mk
@@ -339,6 +339,7 @@ ifeq ($(SDK_ONLY),true)
339339 subdirs := \
340340 prebuilt \
341341 build/libs/host \
342+ build/tools/zipalign \
342343 dalvik/dexdump \
343344 dalvik/libdex \
344345 dalvik/tools/dmtracedump \
@@ -366,7 +367,6 @@ ifneq (,$(shell which javac 2>/dev/null))
366367 $(warning sdk-only: javac available.)
367368 subdirs += \
368369 build/tools/signapk \
369- build/tools/zipalign \
370370 dalvik/dx \
371371 dalvik/libcore \
372372 development/apps \
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -3,7 +3,7 @@
33 ##
44 ## Additional inputs from base_rules.make:
55 ## None.
6-##
6+##
77 ###########################################################
88
99 ifneq ($(LOCAL_PREBUILT_LIBS),)
@@ -26,8 +26,35 @@ else
2626 prebuilt_module_is_a_library :=
2727 endif
2828
29+# Ensure that prebuilt .apks have been aligned.
30+ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
31+$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
32+ $(transform-prebuilt-to-target-with-zipalign)
33+else
34+ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
35+$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
36+ $(transform-prebuilt-to-target-strip-comments)
37+else
2938 $(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
3039 $(transform-prebuilt-to-target)
40+endif
41+endif
42+
43+ifeq ($(LOCAL_CERTIFICATE),)
44+ # can't re-sign this package, so predexopt is not available.
45+else
46+
47+# If this is not an absolute certificate, assign it to a generic one.
48+ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
49+ LOCAL_CERTIFICATE := $(SRC_TARGET_DIR)/product/security/$(LOCAL_CERTIFICATE)
50+endif
51+
52+PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
53+PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
54+PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
55+
56+endif
57+
3158 ifneq ($(prebuilt_module_is_a_library),)
3259 ifneq ($(LOCAL_IS_HOST_MODULE),)
3360 $(transform-host-ranlib-copy-hack)
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -26,6 +26,7 @@ endif
2626 CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar
2727
2828 junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar
29+HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar
2930
3031 CTS_CORE_CASE_LIST := android.core.tests.annotation \
3132 android.core.tests.archive \
@@ -49,12 +50,25 @@ CTS_CORE_CASE_LIST := android.core.tests.annotation \
4950 android.core.tests.xnet \
5051 android.core.tests.runner
5152
53+CTS_SECURITY_APPS_LIST := \
54+ CtsAppAccessData \
55+ CtsAppWithData \
56+ CtsInstrumentationAppDiffCert \
57+ CtsPermissionDeclareApp \
58+ CtsSharedUidInstall \
59+ CtsSharedUidInstallDiffCert \
60+ CtsSimpleAppInstall \
61+ CtsSimpleAppInstallDiffCert \
62+ CtsTargetInstrumentationApp \
63+ CtsUsePermissionDiffCert
64+
5265 CTS_CASE_LIST := \
5366 DeviceInfoCollector \
5467 CtsTestStubs \
5568 CtsAppTestCases \
5669 CtsContentTestCases \
5770 CtsDatabaseTestCases \
71+ CtsGestureTestCases \
5872 CtsGraphicsTestCases \
5973 CtsHardwareTestCases \
6074 CtsLocationTestCases \
@@ -78,13 +92,14 @@ CTS_CASE_LIST := \
7892 CtsPerformance5TestCases \
7993 ApiDemos \
8094 ApiDemosReferenceTest \
81- $(CTS_CORE_CASE_LIST)
95+ $(CTS_CORE_CASE_LIST) \
96+ $(CTS_SECURITY_APPS_LIST)
8297
8398 DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans
8499
85100 $(cts_dir)/all_cts_files_stamp: PRIVATE_JUNIT_HOST_JAR := $(junit_host_jar)
86101
87-$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(ACP)
102+$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(HOSTTESTLIB_JAR) $(ACP)
88103 # Make necessary directory for CTS
89104 @rm -rf $(PRIVATE_CTS_DIR)
90105 @mkdir -p $(TMP_DIR)
@@ -97,6 +112,8 @@ $(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(ACP)
97112 $(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools
98113 # Copy junit jar
99114 $(hide) $(ACP) -fp $(PRIVATE_JUNIT_HOST_JAR) $(PRIVATE_DIR)/tools
115+# Copy hosttestlib jar
116+ $(hide) $(ACP) -fp $(HOSTTESTLIB_JAR) $(PRIVATE_DIR)/tools
100117 # Change mode of the executables
101118 $(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH))
102119 $(foreach apk,$(CTS_CASE_LIST), \
@@ -106,13 +123,17 @@ $(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(ACP)
106123 $(hide) touch $@
107124
108125 # Generate the test descriptions for the core-tests
109-
126+# Parameters:
127+# $1 : The output file where the description should be written (without the '.xml' extension)
128+# $2 : The AndroidManifest.xml corresponding to the test package
129+# $3 : The name of the TestSuite generator class to use
130+# $4 : The Android.mk corresponding to the test package (required for host-side tests only)
110131 define generate-core-test-description
111132 @echo "Generate core-test description ("$(notdir $(1))")"
112133 $(hide) java $(PRIVATE_JAVAOPTS) \
113134 -classpath $(PRIVATE_CLASSPATH) \
114135 $(PRIVATE_PARAMS) CollectAllTests $(1) \
115- $(2) $(3)
136+ $(2) $(3) $(4)
116137 endef
117138
118139 CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON)
@@ -214,10 +235,17 @@ $(CORE_VM_TEST_DESC): vm-tests $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CORE_INT
214235 dot.junit.AllJunitHostTests, cts/tools/vm-tests/Android.mk)
215236 $(ACP) -fv $(VMTESTS_INTERMEDIATES)/android.core.vm-tests.jar $(PRIVATE_DIR)/repository/testcases/android.core.vm-tests.jar
216237
238+# Move app security host-side tests to the repository
239+APP_SECURITY_LIB := $(cts_dir)/$(cts_name)/repository/testcases/CtsAppSecurityTests.jar
240+
241+$(APP_SECURITY_LIB): $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(cts_dir)/all_cts_files_stamp $(ACP)
242+ $(ACP) -fv $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(APP_SECURITY_LIB)
243+
217244 # Generate the default test plan for User.
218-$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_dir)/all_cts_core_files_stamp $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh $(CORE_VM_TEST_DESC)
219- $(hide) bash $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh cts/tests/tests/ \
220- $(PRIVATE_DIR) $(TMP_DIR) $(TOP) $(TARGET_COMMON_OUT_ROOT) $(OUT_DIR)
245+# Usage: buildCts.py <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath>
246+$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_dir)/all_cts_core_files_stamp $(cts_tools_src_dir)/utils/buildCts.py $(CORE_VM_TEST_DESC) $(APP_SECURITY_LIB) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar
247+ $(hide) $(cts_tools_src_dir)/utils/buildCts.py cts/tests/tests/ $(PRIVATE_DIR) $(TMP_DIR) \
248+ $(TOP) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar
221249
222250 # Package CTS and clean up.
223251 #
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -41,7 +41,7 @@ ifeq "" "$(PLATFORM_VERSION)"
4141 # which is the version that we reveal to the end user.
4242 # Update this value when the platform version changes (rather
4343 # than overriding it somewhere else). Can be an arbitrary string.
44- PLATFORM_VERSION := Donut
44+ PLATFORM_VERSION := 1.6
4545 endif
4646
4747 ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -53,13 +53,13 @@ ifeq "" "$(PLATFORM_SDK_VERSION)"
5353 # intermediate builds). During development, this number remains at the
5454 # SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
5555 # the code-name of the new development work.
56- PLATFORM_SDK_VERSION := 3
56+ PLATFORM_SDK_VERSION := 4
5757 endif
5858
5959 ifeq "" "$(PLATFORM_VERSION_CODENAME)"
6060 # If the build is not a final release build, then this is the current
6161 # development code-name. If this is a final release build, it is simply "REL".
62- PLATFORM_VERSION_CODENAME := Donut
62+ PLATFORM_VERSION_CODENAME := REL
6363 endif
6464
6565 ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -24,6 +24,5 @@ PRODUCT_PACKAGES := \
2424 VpnServices \
2525 UserDictionaryProvider \
2626 PackageInstaller \
27- WebSearchProvider \
2827 Bugreport
2928
--- a/target/product/min_dev.mk
+++ b/target/product/min_dev.mk
@@ -12,7 +12,6 @@ PRODUCT_PACKAGES := \
1212 MediaProvider \
1313 SettingsProvider \
1414 PackageInstaller \
15- WebSearchProvider \
1615 Bugreport \
1716 Launcher \
1817 Settings \
--- a/tools/droiddoc/src/ClassInfo.java
+++ b/tools/droiddoc/src/ClassInfo.java
@@ -863,6 +863,7 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
863863 data.setValue(base + ".kind", this.kind());
864864 TagInfo.makeHDF(data, base + ".shortDescr", this.firstSentenceTags());
865865 TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags());
866+ data.setValue(base + ".since", getSince());
866867 }
867868
868869 /**
--- a/tools/droiddoc/src/DroidDoc.java
+++ b/tools/droiddoc/src/DroidDoc.java
@@ -56,6 +56,7 @@ public class DroidDoc
5656 public static ArrayList<String[]> mHDFData = new ArrayList<String[]>();
5757 public static Map<Character,String> escapeChars = new HashMap<Character,String>();
5858 public static String title = "";
59+ public static SinceTagger sinceTagger = new SinceTagger();
5960
6061 public static boolean checkLevel(int level)
6162 {
@@ -97,7 +98,6 @@ public class DroidDoc
9798 String apiFile = null;
9899 String debugStubsFile = "";
99100 HashSet<String> stubPackages = null;
100- SinceTagger sinceTagger = new SinceTagger();
101101
102102 root = r;
103103
@@ -518,6 +518,7 @@ public class DroidDoc
518518 i++;
519519 }
520520
521+ sinceTagger.writeVersionNames(data);
521522 return data;
522523 }
523524
--- a/tools/droiddoc/src/NavTree.java
+++ b/tools/droiddoc/src/NavTree.java
@@ -25,7 +25,7 @@ public class NavTree {
2525 for (PackageInfo pkg: DroidDoc.choosePackages()) {
2626 children.add(makePackageNode(pkg));
2727 }
28- Node node = new Node("Reference", dir + "packages.html", children);
28+ Node node = new Node("Reference", dir + "packages.html", children, null);
2929
3030 StringBuilder buf = new StringBuilder();
3131 if (false) {
@@ -46,7 +46,7 @@ public class NavTree {
4646 private static Node makePackageNode(PackageInfo pkg) {
4747 ArrayList<Node> children = new ArrayList();
4848
49- children.add(new Node("Description", pkg.fullDescriptionHtmlPage(), null));
49+ children.add(new Node("Description", pkg.fullDescriptionHtmlPage(), null, null));
5050
5151 addClassNodes(children, "Interfaces", pkg.interfaces());
5252 addClassNodes(children, "Classes", pkg.ordinaryClasses());
@@ -54,7 +54,7 @@ public class NavTree {
5454 addClassNodes(children, "Exceptions", pkg.exceptions());
5555 addClassNodes(children, "Errors", pkg.errors());
5656
57- return new Node(pkg.name(), pkg.htmlPage(), children);
57+ return new Node(pkg.name(), pkg.htmlPage(), children, pkg.getSince());
5858 }
5959
6060 private static void addClassNodes(ArrayList<Node> parent, String label, ClassInfo[] classes) {
@@ -62,12 +62,12 @@ public class NavTree {
6262
6363 for (ClassInfo cl: classes) {
6464 if (cl.checkLevel()) {
65- children.add(new Node(cl.name(), cl.htmlPage(), null));
65+ children.add(new Node(cl.name(), cl.htmlPage(), null, cl.getSince()));
6666 }
6767 }
6868
6969 if (children.size() > 0) {
70- parent.add(new Node(label, null, children));
70+ parent.add(new Node(label, null, children, null));
7171 }
7272 }
7373
@@ -75,11 +75,13 @@ public class NavTree {
7575 private String mLabel;
7676 private String mLink;
7777 ArrayList<Node> mChildren;
78+ private String mSince;
7879
79- Node(String label, String link, ArrayList<Node> children) {
80+ Node(String label, String link, ArrayList<Node> children, String since) {
8081 mLabel = label;
8182 mLink = link;
8283 mChildren = children;
84+ mSince = since;
8385 }
8486
8587 static void renderString(StringBuilder buf, String s) {
@@ -136,6 +138,8 @@ public class NavTree {
136138 renderString(buf, mLink);
137139 buf.append(", ");
138140 renderChildren(buf);
141+ buf.append(", ");
142+ renderString(buf, mSince);
139143 buf.append(" ]");
140144 }
141145 }
--- a/tools/droiddoc/src/PackageInfo.java
+++ b/tools/droiddoc/src/PackageInfo.java
@@ -123,6 +123,7 @@ public class PackageInfo extends DocInfo implements ContainerInfo
123123 ClassInfo.makeLinkListHDF(data, base + ".enums", enums());
124124 ClassInfo.makeLinkListHDF(data, base + ".exceptions", exceptions());
125125 ClassInfo.makeLinkListHDF(data, base + ".errors", errors());
126+ data.setValue(base + ".since", getSince());
126127 }
127128
128129 public ClassInfo[] interfaces()
--- a/tools/droiddoc/src/SinceTagger.java
+++ b/tools/droiddoc/src/SinceTagger.java
@@ -4,6 +4,8 @@ import com.android.apicheck.*;
44
55 import java.util.*;
66
7+import org.clearsilver.HDF;
8+
79 /**
810 * Applies version information to the DroidDoc class model from apicheck XML
911 * files. Sample usage:
@@ -46,6 +48,17 @@ public class SinceTagger {
4648 }
4749
4850 /**
51+ * Writes an index of the version names to {@code data}.
52+ */
53+ public void writeVersionNames(HDF data) {
54+ int index = 1;
55+ for (String version : xmlToName.values()) {
56+ data.setValue("since." + index + ".name", version);
57+ index++;
58+ }
59+ }
60+
61+ /**
4962 * Applies the version information to {@code classDocs} where not already
5063 * present.
5164 *
--- a/tools/droiddoc/templates-pdk/customization.cs
+++ b/tools/droiddoc/templates-pdk/customization.cs
@@ -1,24 +1,27 @@
11 <?cs # This file defines custom definitions for the masthead (logo, searchbox, tabs, etc) and
2-left nav (toc) that gets placed on all pages. ?>
2+left nav (toc) that gets placed on all pages, for the open source site?>
33
44 <?cs
55 def:custom_masthead() ?>
66 <div id="header">
77 <div id="headerLeft">
8- <a href="<?cs var:toroot ?>guide/index.html" tabindex="-1"><img
8+ <a href="http://source.android.com" tabindex="-1"><img
99 src="<?cs var:toroot ?>assets/images/open_source.png" alt="Open Source Project: Platform Development Kit" /></a>
1010 <ul class="<?cs
11- if:reference ?> <?cs
12- elif:guide ?> <?cs
13- elif:sdk ?> <?cs
14- elif:home ?> <?cs
15- elif:community ?> <?cs
16- elif:publish ?> <?cs
17- elif:about ?> <?cs /if ?>">
18- <!--<li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html"
19- onClick="return loadLast('guide)'"><span>Dev Guide</span></a></li>
20- <li id="opensource-link"><a href="http://source.android.com/"
21- onClick="return loadLast('open')"><span>Open Source</span></a></li>-->
11+ if:releases ?> releases<?cs
12+ elif:guide ?> guide<?cs
13+ elif:licenses ?>licenses <?cs
14+ elif:home ?>home <?cs
15+ elif:community ?>community <?cs /if ?>">
16+ <li id="home-link"><a href="<?cs var:toroot ?>index.html"><span>Home</span></a></li>
17+ <li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html"
18+ onClick="return loadLast('guide)'"><span>Guide</span></a></li>
19+ <li id="releases-ink"><a href="<?cs var:toroot ?>releases/index.html"
20+ onClick="return loadLast('releases)'"><span>Releases</span></a></li>
21+ <li id="licenses-link"><a href="<?cs var:toroot ?>licenses/index.html"
22+ onClick="return loadLast('licenses)'"><span>Licenses</span></a></li>
23+ <li id="community-link"><a href="<?cs var:toroot ?>community/index.html"
24+ onClick="return loadLast('community)'"><span>Community</span></a></li>
2225 </ul>
2326 </div>
2427 <div id="headerRight">
@@ -49,9 +52,45 @@ def:guide_nav() ?>
4952 </script>
5053 <?cs /def ?>
5154
55+<?cs
56+def:licenses_nav() ?>
57+ <div class="g-section g-tpl-240" id="body-content">
58+ <div class="g-unit g-first side-nav-resizable" id="side-nav">
59+ <div id="devdoc-nav"><?cs
60+ include:"../../../../development/pdk/docs/licenses/licenses_toc.cs" ?>
61+ </div>
62+ </div> <!-- end side-nav -->
63+ <script>
64+ addLoadEvent(function() {
65+ scrollIntoView("devdoc-nav");
66+ });
67+ </script>
68+<?cs /def ?>
69+
70+<?cs
71+def:releases_nav() ?>
72+ <div class="g-section g-tpl-240" id="body-content">
73+ <div class="g-unit g-first side-nav-resizable" id="side-nav">
74+ <div id="devdoc-nav"><?cs
75+ include:"../../../../development/pdk/docs/releases/releases_toc.cs" ?>
76+ </div>
77+ </div> <!-- end side-nav -->
78+ <script>
79+ addLoadEvent(function() {
80+ scrollIntoView("devdoc-nav");
81+ });
82+ </script>
83+<?cs /def ?>
84+
5285 <?cs
53-def:custom_left_nav() ?><?cs
54- call:guide_nav() ?><?cs
86+def:custom_left_nav() ?><?cs
87+ if:doc.type == "guide" ?><?cs
88+ call:guide_nav() ?><?cs
89+ elif:doc.type == "licenses" ?><?cs
90+ call:licenses_nav() ?><?cs
91+ elif:doc.type == "releases" ?><?cs
92+ call:releases_nav() ?><?cs
93+ /if ?><?cs
5594 /def ?>
5695
5796 <?cs # appears at the bottom of every page ?><?cs
--- a/tools/droiddoc/templates-sdk/customization.cs
+++ b/tools/droiddoc/templates-sdk/customization.cs
@@ -47,34 +47,51 @@ def:custom_masthead() ?>
4747 <div id="headerRight">
4848 <div id="headerLinks">
4949 <?cs if:template.showLanguageMenu ?>
50- <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" />
51- <span id="language">
50+ <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="Language:" />
51+ <span id="language">
5252 <select name="language" onChange="changeLangPref(this.value, true)">
53- <option value="en">English&nbsp;&nbsp;&nbsp;</option>
54- <option value="ja">日本語</option>
55- <?cs #
56- <option value="de">Deutsch</option>
57- <option value="es">Español</option>
58- <option value="fr">Français</option>
59- <option value="it">Italiano</option>
60- <option value="zh-CN">中文 (简体)</option>
61- <option value="zh-TW">中文 (繁體)</option>
62- ?>
53+ <option value="en">English&nbsp;&nbsp;&nbsp;</option>
54+ <option value="ja">日本語</option>
55+ <?cs #
56+ <option value="de">Deutsch</option>
57+ <option value="es">Español</option>
58+ <option value="fr">Français</option>
59+ <option value="it">Italiano</option>
60+ <option value="zh-CN">中文 (简体)</option>
61+ <option value="zh-TW">中文 (繁體)</option>
62+ ?>
6363 </select>
6464 <script type="text/javascript">
6565 <!--
6666 loadLangPref();
6767 //-->
6868 </script>
69- </span>
69+ </span>
7070 <?cs /if ?>
7171 <a href="http://www.android.com">Android.com</a>
7272 </div><?cs
73- call:default_search_box() ?>
73+ call:default_search_box() ?><?cs
74+ if:reference ?>
75+ <div id="api-level-toggle">
76+ <label for="apiLevelControl"><a href="<?cs var:toroot ?>guide/appendix/api-levels.html">Filter by API Level</a>: </label>
77+ <select id="apiLevelControl">
78+ <!-- option elements added by buildApiLevelToggle() -->
79+ </select>
80+ </div>
81+ <script>
82+ var SINCE_DATA = [ <?cs
83+ each:since = since ?>'<?cs
84+ var:since.name ?>'<?cs
85+ if:!last(since) ?>, <?cs /if ?><?cs
86+ /each
87+ ?> ];
88+ buildApiLevelToggle();
89+ </script><?cs
90+ /if ?>
7491 </div><!-- headerRight -->
7592 <script type="text/javascript">
7693 <!--
77- changeTabLang(getLangPref());
94+ changeTabLang(getLangPref());
7895 //-->
7996 </script>
8097 </div><!-- header --><?cs
--- a/tools/droiddoc/templates-sdk/header_tabs.cs
+++ b/tools/droiddoc/templates-sdk/header_tabs.cs
@@ -58,8 +58,16 @@
5858 <?cs /if ?>
5959 </a></li>
6060 <li id="videos-link"><a href="<?cs var:toroot ?>videos/index.html" onClick="return loadLast('videos')">
61+ <?cs if:!sdk.redirect ?>
6162 <span class="en">Videos</span>
62- <span class="ja">ビデオ</span>
63+ <span class="de"></span>
64+ <span class="es"></span>
65+ <span class="fr"></span>
66+ <span class="it"></span>
67+ <span class="ja">ビデオ</span>
68+ <span class="zh-CN"></span>
69+ <span class="zh-TW"></span>
70+ <?cs /if ?>
6371 </a></li>
6472 <li id="community-link"><a href="<?cs var:toroot ?>community/index.html">
6573 <?cs if:!sdk.redirect ?>
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -5,8 +5,8 @@
55 <head>
66 <title>Redirecting...</title>
77 <meta http-equiv="refresh" content="0;url=<?cs var:toroot ?>sdk/<?cs
8- if:sdk.redirect.path ?><?cs var:sdk.redirect.path ?>"<?cs
9- else ?><?cs var:sdk.current ?>/index.html<?cs /if ?>"
8+ if:sdk.redirect.path ?><?cs var:sdk.redirect.path ?><?cs
9+ else ?><?cs var:sdk.current ?>/index.html<?cs /if ?>">
1010 <link href="<?cs var:toroot ?>assets/android-developer-docs.css" rel="stylesheet" type="text/css" />
1111 </head>
1212 <?cs else ?>
@@ -24,8 +24,10 @@
2424 <div id="jd-content">
2525 <p>Redirecting to
2626 <a href="<?cs var:toroot ?>sdk/<?cs
27- if:sdk.redirect.path ?><?cs var:sdk.redirect.path ?>">/sdk/<?cs var:sdk.redirect.path ?><?cs
28- else ?><?cs var:sdk.current ?>/index.html">/sdk/<?cs var:sdk.current ?>/index.html<?cs /if ?>
27+ if:sdk.redirect.path ?><?cs var:sdk.redirect.path ?><?cs
28+ else ?><?cs var:sdk.current ?>/index.html<?cs /if ?>">sdk/<?cs
29+ if:sdk.redirect.path ?><?cs var:sdk.redirect.path ?><?cs
30+ else ?><?cs var:sdk.current ?>/index.html<?cs /if ?>
2931 </a> ...</p>
3032 <?cs else ?>
3133 <div class="g-unit" id="doc-content" >
@@ -50,7 +52,7 @@
5052 </div>
5153 <?cs /if ?>
5254
53-<?cs if:android.whichdoc != "online" ?>
55+<?cs if:android.whichdoc != "online" && !android.preview ?>
5456
5557 <p>The sections below provide an overview of the SDK package. </p>
5658
@@ -101,7 +103,20 @@ computer. </p>
101103 </tr>
102104 </table>
103105
104- <?cs else ?>
106+ <?cs else ?><?cs if:android.whichdoc == "online" ?>
107+
108+ <?cs if:sdk.preview ?>
109+ <p>Welcome developers! The next release of the Android platform will be
110+ Android 1.6 and we are pleased to announce the availability of an early look
111+ SDK to give you a head-start on developing applications for it. </p>
112+
113+ <p>The Android 1.6 platform includes a variety of improvements and new
114+ features for users and developers. Additionally, the SDK itself introduces
115+ several new capabilities that enable you to develop applications more
116+ efficiently. See the <a href="features.html">Android 1.6 Highlights</a>
117+ document for a list of highlights.</p>
118+ <?cs /if ?>
119+
105120 <p>Before downloading, please read the <a href="requirements.html">
106121 System Requirements</a> document. As you start the download, you will also need to review and agree to
107122 the Terms and Conditions that govern the use of the Android SDK. </p>
@@ -137,9 +152,32 @@ the Terms and Conditions that govern the use of the Android SDK. </p>
137152 <td><?cs var:sdk.linux_bytes ?> bytes</td>
138153 <td><?cs var:sdk.linux_checksum ?></td>
139154 </tr>
155+ <?cs if:adt.zip_download ?>
156+ <tr class="alt-color">
157+ <td>ADT Plugin for Eclipse <?cs var:adt.zip_version ?></td>
158+ <td>
159+ <a href="<?cs var:toroot ?>sdk/download.html?v=<?cs var:adt.zip_download ?>"><?cs var:adt.zip_download ?></a>
160+ </td>
161+ <td><?cs var:adt.zip_bytes ?> bytes</td>
162+ <td><?cs var:adt.zip_checksum ?></td>
163+ </tr>
164+ <?cs /if ?>
140165 </table>
141166
142-<?cs /if ?>
167+ <?cs /if ?>
168+ <?cs /if ?>
169+<?cs /if ?>
170+
171+<?cs if:android.whichdoc != "online" && sdk.preview ?>
172+ <p>Welcome developers! The next release of the Android platform will be
173+ Android 1.6 and we are pleased to announce the availability of an early look SDK
174+ to give you a head-start on developing applications for it. </p>
175+
176+ <p>The Android 1.6 platform includes a variety of improvements and new features
177+ for users and developers. Additionally, the SDK itself introduces several new
178+ capabilities that enable you to develop applications more efficiently.
179+ See the <a href="http://developer.android.com/sdk/preview/features.html">
180+ Android 1.6 Highlights</a> document for a list of highlights.</p>
143181 <?cs /if ?>
144182
145183 <?cs call:tag_list(root.descr) ?>
--- a/tools/droiddoc/templates/assets/android-developer-core.css
+++ b/tools/droiddoc/templates/assets/android-developer-core.css
@@ -49,6 +49,8 @@ a:visited code {
4949
5050 input, select,
5151 textarea, option {
52+ font-family:inherit;
53+ font-size:inherit;
5254 padding:0;
5355 margin:0;
5456 }
@@ -131,13 +133,17 @@ dd pre, dd table, dd img {
131133 }
132134
133135 li ul,
134-li ol {
135- margin:.5em 0 0 0;
136+li ol,
137+dd ul,
138+dd ol {
139+ margin:0;
136140 padding: 0 0 0 2em;
137141 }
138142
139-dl li {
140- padding:.5em 0 0 0;
143+li li,
144+dd li {
145+ margin:0;
146+ padding:.5em 0 0;
141147 }
142148
143149 dl dl,
@@ -177,6 +183,8 @@ hr.blue {
177183
178184 /* LAYOUT */
179185 #body-content {
186+ /* "Preliminary" watermark for preview releases and interim builds.
187+ background:transparent url(images/preliminary.png) repeat scroll 0 0; */
180188 margin:0;
181189 position:relative;
182190 width:100%;
@@ -777,7 +785,7 @@ td.gsc-search-button {
777785 }
778786
779787 #carouselMain {
780- background: url('/assets/images/home/bg_home_carousel_board.png') 0 0 no-repeat;
788+ background: url(images/home/bg_home_carousel_board.png) 0 0 no-repeat;
781789 height:auto;
782790 padding: 25px 21px 0;
783791 overflow:hidden;
@@ -800,7 +808,7 @@ td.gsc-search-button {
800808 }
801809
802810 #carouselWheel {
803- background: url('/assets/images/home/bg_home_carousel_wheel.png') 0 0 no-repeat;
811+ background: url(images/home/bg_home_carousel_wheel.png) 0 0 no-repeat;
804812 padding-top:40px;
805813 height:150px;
806814 }
@@ -1154,12 +1162,12 @@ ul.videoPreviews p.full {
11541162
11551163 ul.videoPreviews span.more {
11561164 padding:0 0 0 12px;
1157- background:url('/assets/images/arrow_bluelink_down.png') 0 2px no-repeat;
1165+ background:url(images/arrow_bluelink_down.png) 0 2px no-repeat;
11581166 }
11591167
11601168 ul.videoPreviews span.less {
11611169 padding:0 0 0 12px;
1162- background:url('/assets/images/arrow_bluelink_up.png') 0 2px no-repeat;
1170+ background:url(images/arrow_bluelink_up.png) 0 2px no-repeat;
11631171 display:none;
11641172 }
11651173
--- a/tools/droiddoc/templates/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates/assets/android-developer-docs.css
@@ -276,9 +276,9 @@
276276
277277 /* summary tables for reference pages */
278278 .jd-sumtable {
279-margin: .5em 1em 1em 1em;
280-width:99%;
281-font-size:.9em;
279+ margin: .5em 1em 1em 1em;
280+ width:95%; /* consistent table widths; within IE's quirks */
281+ font-size:.9em;
282282 }
283283
284284 .jd-sumtable a {
@@ -330,8 +330,7 @@ font-size:.9em;
330330 links to summary tables) */
331331 #api-info-block {
332332 font-size:.8em;
333- margin:0;
334- padding:6px;
333+ padding:6px 10px;
335334 font-weight:normal;
336335 float:right;
337336 text-align:right;
@@ -346,20 +345,56 @@ links to summary tables) */
346345 color:#999;
347346 }
348347
349-h4.jd-details-title .api-level,
350-div#jd-header .api-level {
351- font-size:12px;
348+div.api-level {
349+ font-size:.8em;
352350 font-weight:normal;
353351 color:#999;
354- position:absolute;
355- top:5px;
356- right:5px;
352+ float:right;
353+ padding:0 7px 0;
354+ margin-top:-25px;
357355 }
358356
359-div#jd-header .api-level {
360- position:relative;
361- float:right;
362- margin-top:-1.7em;
357+#api-info-block div.api-level {
358+ font-size:1.3em;
359+ font-weight:bold;
360+ float:none;
361+ color:#444;
362+ padding:0;
363+ margin:0;
364+}
365+
366+/* Force link colors for IE6 */
367+div.api-level a {
368+ color:#999;
369+}
370+#api-info-block div.api-level a:link {
371+ color:#444;
372+}
373+#api-level-toggle a {
374+ color:#999;
375+}
376+
377+div#naMessage {
378+ display:none;
379+ width:555px;
380+ height:0;
381+ margin:0 auto;
382+}
383+
384+div#naMessage div {
385+ width:450px;
386+ position:fixed;
387+ margin:50px 0;
388+ padding:4em 4em 3em;
389+ background:#FFF;
390+ background:rgba(255,255,255,0.7);
391+ border:1px solid #dddd00;
392+}
393+/* IE6 can't position fixed */
394+* html div#naMessage div { position:absolute; }
395+
396+div#naMessage strong {
397+ font-size:1.1em;
363398 }
364399
365400 .absent,
@@ -367,25 +402,53 @@ div#jd-header .api-level {
367402 .absent a:visited,
368403 .absent a:hover,
369404 .absent * {
370- color:#aaa !important;
371- background-color:#f6f6f6 !important;
405+ color:#bbb !important;
372406 cursor:default !important;
373407 text-decoration:none !important;
374408 }
375409
376-#side-nav li.absent,
377-#side-nav li.absent * {
378- background-color:#fff !important;
410+#api-level-toggle a,
411+.api-level a {
412+ color:inherit;
413+ text-decoration:none;
414+}
415+
416+#api-level-toggle a:hover,
417+.api-level a:hover {
418+ color:inherit;
419+ text-decoration:underline !important;
420+ cursor:pointer !important;
379421 }
380422
381423 #side-nav li.absent.selected,
382-#side-nav li.absent.selected * {
383- background-color:#eee !important;
424+#side-nav li.absent.selected *,
425+#side-nav div.label.absent.selected,
426+#side-nav div.label.absent.selected * {
427+ background-color:#eaeaea !important;
428+}
429+/* IE6 quirk (won't chain classes, so just keep background blue) */
430+* html #side-nav li.selected,
431+* html #side-nav li.selected *,
432+* html #side-nav div.label.selected,
433+* html #side-nav div.label.selected * {
434+ background-color: #435a6e !important;
384435 }
385436
437+
438+.absent h4.jd-details-title,
439+.absent h4.jd-details-title * {
440+ background-color:#f6f6f6 !important;
441+}
442+
443+.absent img {
444+ opacity: .3;
445+ filter: alpha(opacity=30);
446+ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
447+}
448+
449+
386450 /* applies to a div containing links to summary tables */
387451 .sum-details-links {
388- margin:0 .5em;
389452 padding:0;
390453 font-weight:normal;
391454 }
@@ -554,8 +617,7 @@ h4.jd-details-title {
554617 font-size:1.15em;
555618 background-color: #E2E2E2;
556619 margin:1.5em 0 .6em;
557- padding:3px;
558- position:relative; /* so the api level can be absolute */
620+ padding:3px 95px 3px 3px; /* room for api-level */
559621 }
560622
561623 h4.jd-tagtitle {
@@ -1122,21 +1184,16 @@ body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body
11221184 padding:0;
11231185 }
11241186
1125- #headerLeft .guide {
1126- display:none;
1127- }
1128-
1129- #headerRight {
1187+ #header-tabs,
1188+ #headerRight,
1189+ #side-nav,
1190+ #api-info-block {
11301191 display:none;
11311192 }
11321193
11331194 #body-content {
11341195 position:inherit;
11351196 }
1136-
1137- #side-nav {
1138- display:none;
1139- }
11401197
11411198 #doc-content {
11421199 margin-left:0 !important;
--- a/tools/droiddoc/templates/assets/android-developer-docs.js
+++ b/tools/droiddoc/templates/assets/android-developer-docs.js
@@ -31,16 +31,9 @@ if ((agent.indexOf("Mobile") != -1) ||
3131 addLoadEvent(mobileSetup);
3232 }
3333
34-/* loads the lists.js file to the page.
35-Loading this in the head was slowing page load time */
36-addLoadEvent( function() {
37- var lists = document.createElement("script");
38- lists.setAttribute("type","text/javascript");
39- lists.setAttribute("src", toRoot+"reference/lists.js");
40- $("head").append($(lists));
41-} );
42-
34+addLoadEvent(function() {
4335 window.onresize = resizeAll;
36+});
4437
4538 function mobileSetup() {
4639 $("body").css({'overflow':'auto'});
@@ -51,6 +44,15 @@ function mobileSetup() {
5144 $("#nav-tree").css({'overflow-y': 'auto'});
5245 }
5346
47+/* loads the lists.js file to the page.
48+Loading this in the head was slowing page load time */
49+addLoadEvent( function() {
50+ var lists = document.createElement("script");
51+ lists.setAttribute("type","text/javascript");
52+ lists.setAttribute("src", toRoot+"reference/lists.js");
53+ $("head").append($(lists));
54+} );
55+
5456 function setToRoot(root) {
5557 toRoot = root;
5658 // note: toRoot also used by carousel.js
--- a/tools/droiddoc/templates/assets/navtree.js
+++ b/tools/droiddoc/templates/assets/android-developer-reference.js
@@ -1,5 +1,69 @@
11
2-function new_node(me, mom, text, link, children_data)
2+/* API LEVEL TOGGLE */
3+addLoadEvent(changeApiLevel);
4+var API_LEVEL_COOKIE = "api_level";
5+var minLevel = 1;
6+
7+function buildApiLevelToggle() {
8+ var maxLevel = SINCE_DATA.length;
9+ var userApiLevel = readCookie(API_LEVEL_COOKIE);
10+
11+ if (userApiLevel != 0) {
12+ selectedLevel = userApiLevel;
13+ } else {
14+ selectedLevel = maxLevel;
15+ }
16+
17+ minLevel = $("body").attr("class");
18+ var select = $("#apiLevelControl").html("").change(changeApiLevel);
19+ for (var i = maxLevel-1; i >= 0; i--) {
20+ var option = $("<option />").attr("value",""+SINCE_DATA[i]).append(""+SINCE_DATA[i]);
21+// if (SINCE_DATA[i] < minLevel) option.addClass("absent"); // always false for strings (codenames)
22+ select.append(option);
23+ }
24+
25+ // get the DOM element and use setAttribute cuz IE6 fails when using jquery .attr('selected',true)
26+ var selectedLevelItem = $("#apiLevelControl option[value='"+selectedLevel+"']").get(0);
27+ selectedLevelItem.setAttribute('selected',true);
28+}
29+
30+function changeApiLevel() {
31+ var selectedLevel = $("#apiLevelControl option:selected").val();
32+ toggleVisisbleApis(selectedLevel, "body");
33+
34+ var date = new Date();
35+ date.setTime(date.getTime()+(50*365*24*60*60*1000)); // keep this for 50 years
36+ writeCookie(API_LEVEL_COOKIE, selectedLevel, null, date);
37+
38+ if (selectedLevel < minLevel) {
39+ var thing = ($("#jd-header").html().indexOf("package") != -1) ? "package" : "class";
40+ $("#naMessage").show().html("<div><p><strong>This " + thing + " is not available with API Level " + selectedLevel + ".</strong></p>"
41+ + "<p>To use this " + thing + ", your application must specify API Level " + minLevel + " or higher in its manifest "
42+ + "and be compiled against a version of the Android library that supports an equal or higher API Level. To reveal this "
43+ + "document, change the value of the API Level filter above.</p>"
44+ + "<p><a href='" +toRoot+ "guide/appendix/api-levels.html'>What is the API Level?</a></p></div>");
45+ } else {
46+ $("#naMessage").hide();
47+ }
48+}
49+
50+function toggleVisisbleApis(selectedLevel, context) {
51+ var apis = $(".api",context);
52+ apis.each(function(i) {
53+ var obj = $(this);
54+ var className = obj.attr("class");
55+ var apiLevelIndex = className.lastIndexOf("-")+1;
56+ var apiLevelEndIndex = className.indexOf(" ", apiLevelIndex);
57+ apiLevelEndIndex = apiLevelEndIndex != -1 ? apiLevelEndIndex : className.length;
58+ var apiLevel = className.substring(apiLevelIndex, apiLevelEndIndex);
59+ if (apiLevel > selectedLevel) obj.addClass("absent").attr("title","Requires API Level "+apiLevel+" or higher");
60+ else obj.removeClass("absent").removeAttr("title");
61+ });
62+}
63+
64+/* NAVTREE */
65+
66+function new_node(me, mom, text, link, children_data, api_level)
367 {
468 var node = new Object();
569 node.children = Array();
@@ -10,9 +74,13 @@ function new_node(me, mom, text, link, children_data)
1074 mom.get_children_ul().appendChild(node.li);
1175
1276 node.label_div = document.createElement("div");
77+ node.label_div.className = "label";
78+ if (api_level != null) {
79+ $(node.label_div).addClass("api");
80+ $(node.label_div).addClass("api-level-"+api_level);
81+ }
1382 node.li.appendChild(node.label_div);
1483 node.label_div.style.paddingLeft = 10*node.depth + "px";
15- node.label_div.className = "label";
1684
1785 if (children_data == null) {
1886 // 12 is the width of the triangle and padding extra space
@@ -81,10 +149,15 @@ function expand_node(me, node)
81149 $(node.get_children_ul()).slideDown("fast");
82150 } else {
83151 get_node(me, node);
152+ if ($(node.label_div).hasClass("absent")) $(node.get_children_ul()).addClass("absent");
84153 $(node.get_children_ul()).slideDown("fast");
85154 }
86155 node.plus_img.src = me.toroot + "assets/images/triangle-opened-small.png";
87156 node.expanded = true;
157+
158+ // perform api level toggling because new nodes are new to the DOM
159+ var selectedLevel = $("#apiLevelControl option:selected").val();
160+ toggleVisisbleApis(selectedLevel, "#side-nav");
88161 }
89162 }
90163
@@ -94,7 +167,7 @@ function get_node(me, mom)
94167 for (var i in mom.children_data) {
95168 var node_data = mom.children_data[i];
96169 mom.children[i] = new_node(me, mom, node_data[0], node_data[1],
97- node_data[2]);
170+ node_data[2], node_data[3]);
98171 }
99172 }
100173
@@ -104,8 +177,7 @@ function this_page_relative(toroot)
104177 var file = "";
105178 if (toroot.substr(0, 1) == "/") {
106179 if (full.substr(0, toroot.length) == toroot) {
107- var basePath = getBaseUri(full);
108- return basePath.substring(toroot.length);
180+ return full.substr(toroot.length);
109181 } else {
110182 // the file isn't under toroot. Fail.
111183 return null;
@@ -150,15 +222,18 @@ function load_navtree_data(toroot) {
150222 navtreeData.setAttribute("type","text/javascript");
151223 navtreeData.setAttribute("src", toroot+"navtree_data.js");
152224 $("head").append($(navtreeData));
153-}
225+}
154226
155227 function init_default_navtree(toroot) {
156- load_navtree_data(toroot);
157228 init_navtree("nav-tree", toroot, NAVTREE_DATA);
229+
230+ // perform api level toggling because because the whole tree is new to the DOM
231+ var selectedLevel = $("#apiLevelControl option:selected").val();
232+ toggleVisisbleApis(selectedLevel, "#side-nav");
158233 }
159234
160235 function init_navtree(navtree_id, toroot, root_nodes)
161-{
236+{
162237 var me = new Object();
163238 me.toroot = toroot;
164239 me.node = new Object();
@@ -189,4 +264,3 @@ function init_navtree(navtree_id, toroot, root_nodes)
189264 });
190265 }
191266 }
192-
Binary files /dev/null and b/tools/droiddoc/templates/assets/images/home/donut-android.png differ
Binary files a/tools/droiddoc/templates/assets/images/preliminary.png and b/tools/droiddoc/templates/assets/images/preliminary.png differ
--- a/tools/droiddoc/templates/class.cs
+++ b/tools/droiddoc/templates/class.cs
@@ -2,7 +2,7 @@
22 <?cs include:"macros.cs" ?>
33 <html>
44 <?cs include:"head_tag.cs" ?>
5-<body>
5+<body class="<?cs var:class.since ?>">
66 <script type="text/javascript">
77 function toggleInherited(linkObj, expand) {
88 var base = linkObj.getAttribute("id");
@@ -26,7 +26,6 @@ function toggleInherited(linkObj, expand) {
2626 return false;
2727 }
2828 </script>
29-
3029 <?cs include:"header.cs" ?>
3130
3231 <div class="g-unit" id="doc-content">
@@ -106,7 +105,9 @@ Summary:
106105 &#124; <a href="#" onclick="return toggleAllSummaryInherited(this)">[Expand All]</a>
107106 <?cs /if ?>
108107 </div><!-- end sum-details-links -->
109-
108+<div class="api-level">
109+ <?cs call:since_tags(class) ?>
110+</div>
110111 </div><!-- end api-info-block -->
111112
112113 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
@@ -134,12 +135,11 @@ Summary:
134135 <?cs set:colspan = colspan-1 ?>
135136 <?cs /each ?>
136137
137-<div class="api-level"><?cs call:since_tags(class) ?></div>
138-
139138 </div><!-- end header -->
140139
140+<div id="naMessage"></div>
141141
142-<div id="jd-content" class="apilevel-<?cs var:class.since ?>">
142+<div id="jd-content" class="api apilevel-<?cs var:class.since ?>">
143143 <table class="jd-inheritance-table">
144144 <?cs set:colspan = subcount(class.inheritance) ?>
145145 <?cs each:supr = class.inheritance ?>
@@ -215,7 +215,7 @@ Summary:
215215 <?cs def:write_field_summary(fields) ?>
216216 <?cs set:count = #1 ?>
217217 <?cs each:field=fields ?>
218- <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
218+ <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:field.since ?>" >
219219 <td class="jd-typecol"><nobr>
220220 <?cs var:field.scope ?>
221221 <?cs var:field.static ?>
@@ -231,7 +231,7 @@ Summary:
231231 <?cs def:write_constant_summary(fields) ?>
232232 <?cs set:count = #1 ?>
233233 <?cs each:field=fields ?>
234- <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
234+ <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:field.since ?>" >
235235 <td class="jd-typecol"><?cs call:type_link(field.type) ?></td>
236236 <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:field.href ?>"><?cs var:field.name ?></a></td>
237237 <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?></td>
@@ -248,7 +248,7 @@ Summary:
248248 <td><nobr><em>Description</em></nobr></td>
249249 </tr>
250250 <?cs each:attr=attrs ?>
251- <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
251+ <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:attr.since ?>" >
252252 <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></td>
253253 <td class="jd-linkcol"><?cs each:m=attr.methods ?>
254254 <a href="<?cs var:toroot ?><?cs var:m.href ?>"><?cs var:m.name ?></a>
@@ -263,13 +263,13 @@ Summary:
263263 <?cs def:write_inners_summary(classes) ?>
264264 <?cs set:count = #1 ?>
265265 <?cs each:cl=class.inners ?>
266- <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
266+ <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.since ?>" >
267267 <td class="jd-typecol"><nobr>
268- <?cs var:class.scope ?>
269- <?cs var:class.static ?>
270- <?cs var:class.final ?>
271- <?cs var:class.abstract ?>
272- <?cs var:class.kind ?></nobr></td>
268+ <?cs var:cl.scope ?>
269+ <?cs var:cl.static ?>
270+ <?cs var:cl.final ?>
271+ <?cs var:cl.abstract ?>
272+ <?cs var:cl.kind ?></nobr></td>
273273 <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
274274 <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?>&nbsp;</td>
275275 </tr>
@@ -305,7 +305,8 @@ Summary:
305305 <div style="clear:left;">Inherited XML Attributes</div></th></tr>
306306 <?cs each:cl=class.inherited ?>
307307 <?cs if:subcount(cl.attrs) ?>
308-<tr><td colspan="12">
308+<tr class="api apilevel-<?cs var:cl.since ?>" >
309+<td colspan="12">
309310 <?cs call:expando_trigger("inherited-attrs-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
310311 <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
311312 <div id="inherited-attrs-<?cs var:cl.qualified ?>">
@@ -329,7 +330,7 @@ Summary:
329330 <table id="enumconstants" class="jd-sumtable"><tr><th colspan="12">Enum Values</th></tr>
330331 <?cs set:count = #1 ?>
331332 <?cs each:field=class.enumConstants ?>
332- <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
333+ <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:field.since ?>" >
333334 <td class="jd-descrcol"><?cs call:type_link(field.type) ?>&nbsp;</td>
334335 <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:field.href ?>"><?cs var:field.name ?></a>&nbsp;</td>
335336 <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?>&nbsp;</td>
@@ -355,7 +356,8 @@ Summary:
355356 <div style="clear:left;">Inherited Constants</div></th></tr>
356357 <?cs each:cl=class.inherited ?>
357358 <?cs if:subcount(cl.constants) ?>
358-<tr><td colspan="12">
359+<tr class="api apilevel-<?cs var:cl.since ?>" >
360+<td colspan="12">
359361 <?cs call:expando_trigger("inherited-constants-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
360362 <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
361363 <div id="inherited-constants-<?cs var:cl.qualified ?>">
@@ -390,7 +392,8 @@ Summary:
390392 <div style="clear:left;">Inherited Fields</div></th></tr>
391393 <?cs each:cl=class.inherited ?>
392394 <?cs if:subcount(cl.fields) ?>
393-<tr><td colspan="12">
395+<tr class="api apilevel-<?cs var:cl.since ?>" >
396+<td colspan="12">
394397 <?cs call:expando_trigger("inherited-fields-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
395398 <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
396399 <div id="inherited-fields-<?cs var:cl.qualified ?>">
@@ -449,7 +452,8 @@ Summary:
449452 <div style="clear:left;">Inherited Methods</div></th></tr>
450453 <?cs each:cl=class.inherited ?>
451454 <?cs if:subcount(cl.methods) ?>
452-<tr><td colspan="12"><?cs call:expando_trigger("inherited-methods-"+cl.qualified, "closed") ?>
455+<tr class="api apilevel-<?cs var:cl.since ?>" >
456+<td colspan="12"><?cs call:expando_trigger("inherited-methods-"+cl.qualified, "closed") ?>
453457 From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
454458 <div id="inherited-methods-<?cs var:cl.qualified ?>">
455459 <div id="inherited-methods-<?cs var:cl.qualified ?>-list"
@@ -485,11 +489,12 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
485489 <?cs call:type_link(field.type) ?>
486490 </span>
487491 <?cs var:field.name ?>
488- <span class="api-level">
489- <?cs call:since_tags(field) ?>
490- </span>
491492 </h4>
492- <div class="jd-details-descr"><?cs call:description(field) ?>
493+ <div class="api-level">
494+ <?cs call:since_tags(field) ?>
495+ </div>
496+ <div class="jd-details-descr">
497+ <?cs call:description(field) ?>
493498 <?cs if:subcount(field.constantValue) ?>
494499 <div class="jd-tagdata">
495500 <span class="jd-tagtitle">Constant Value: </span>
@@ -525,11 +530,13 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
525530 </span>
526531 <span class="sympad"><?cs var:method.name ?></span>
527532 <span class="normal">(<?cs call:parameter_list(method.params) ?>)</span>
528- <span class="api-level">
529- <?cs call:since_tags(method) ?>
530- </span>
531533 </h4>
532- <div class="jd-details-descr"><?cs call:description(method) ?></div>
534+ <div class="api-level">
535+ <?cs call:since_tags(method) ?>
536+ </div>
537+ <div class="jd-details-descr">
538+ <?cs call:description(method) ?>
539+ </div>
533540 </div>
534541 <?cs /each ?>
535542 <?cs /def ?>
@@ -541,10 +548,10 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
541548 <?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
542549 <div class="jd-details api apilevel-<?cs var:attr.since ?>">
543550 <h4 class="jd-details-title"><?cs var:attr.name ?>
544- <span class="api-level">
545- <?cs call:since_tags(attr) ?>
546- </span>
547551 </h4>
552+ <div class="api-level">
553+ <?cs call:since_tags(attr) ?>
554+ </div>
548555 <div class="jd-details-descr">
549556 <?cs call:description(attr) ?>
550557
--- a/tools/droiddoc/templates/classes.cs
+++ b/tools/droiddoc/templates/classes.cs
@@ -22,7 +22,7 @@
2222 <table class="jd-sumtable">
2323 <?cs set:cur_row = #0 ?>
2424 <?cs each:cl = letter ?>
25- <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
25+ <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.since ?>" >
2626 <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
2727 <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?>&nbsp;</td>
2828 </tr>
--- a/tools/droiddoc/templates/head_tag.cs
+++ b/tools/droiddoc/templates/head_tag.cs
@@ -17,7 +17,8 @@ else ?>
1717 setToRoot("<?cs var:toroot ?>");
1818 </script><?cs
1919 if:reference ?>
20-<script src="<?cs var:toroot ?>assets/navtree.js" type="text/javascript"></script><?cs
20+<script src="<?cs var:toroot ?>assets/android-developer-reference.js" type="text/javascript"></script>
21+<script src="<?cs var:toroot ?>navtree_data.js" type="text/javascript"></script><?cs
2122 /if ?>
2223 <noscript>
2324 <style type="text/css">
--- a/tools/droiddoc/templates/macros.cs
+++ b/tools/droiddoc/templates/macros.cs
@@ -117,7 +117,7 @@ def:see_also_tags(also) ?><?cs
117117
118118 <?cs # print the API Level ?><?cs
119119 def:since_tags(obj) ?>
120- Since: API Level <?cs var:obj.since ?>
120+ Since: <a href="<?cs var:toroot ?>guide/appendix/api-levels.html#level<?cs var:obj.since ?>">API Level <?cs var:obj.since ?></a>
121121 <?cs /def ?>
122122
123123 <?cs # Print the long-form description for something.
@@ -203,7 +203,7 @@ def:list(label, classes) ?><?cs
203203 <li><h2><?cs var:label ?></h2>
204204 <ul><?cs
205205 each:cl=classes ?>
206- <li class="<?cs if:class.name == cl.label?>selected<?cs /if ?> api apilevel-<?cs var:cl.since ?>"><?cs call:type_link(cl) ?></li><?cs
206+ <li class="<?cs if:class.name == cl.label?>selected <?cs /if ?>api apilevel-<?cs var:cl.since ?>"><?cs call:type_link(cl) ?></li><?cs
207207 /each ?>
208208 </ul>
209209 </li><?cs
@@ -213,7 +213,7 @@ def:list(label, classes) ?><?cs
213213 <?cs # A list of links to packages, for use in the side navigation of packages (panel nav) ?><?cs
214214 def:package_link_list(packages) ?><?cs
215215 each:pkg=packages ?>
216- <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
216+ <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
217217 /each ?><?cs
218218 /def ?>
219219
--- a/tools/droiddoc/templates/package-descr.cs
+++ b/tools/droiddoc/templates/package-descr.cs
@@ -2,26 +2,31 @@
22 <?cs include:"macros.cs" ?>
33 <html>
44 <?cs include:"head_tag.cs" ?>
5+<body class="<?cs var:package.since ?>">
56 <?cs include:"header.cs" ?>
67
78 <div class="g-unit" id="doc-content">
89
10+<div id="api-info-block">
11+<div class="api-level">
12+ <?cs call:since_tags(package) ?>
13+</div>
14+</div>
15+
916 <div id="jd-header">
10- <strong>
11- <div class="jd-page_title-prefix">package</div>
12- </strong>
17+ package
1318 <h1><?cs var:package.name ?></b></h1>
1419 <div class="jd-nav">
15- <a class="jd-navlink" href="package-summary.html">Classes</a> |
16- Description
20+ <a class="jd-navlink" href="package-summary.html">Classes</a> | Description
1721 </div>
1822 </div><!-- end header -->
1923
20-<div id="jd-content">
24+<div id="naMessage"></div>
25+
26+<div id="jd-content" class="api apilevel-<?cs var:package.since ?>">
2127 <div class="jd-descr">
2228 <p><?cs call:tag_list(package.descr) ?></p>
2329 </div>
24-<?cs call:since_tags(package) ?>
2530
2631 <?cs include:"footer.cs" ?>
2732 </div><!-- end jd-content -->
--- a/tools/droiddoc/templates/package.cs
+++ b/tools/droiddoc/templates/package.cs
@@ -2,25 +2,30 @@
22 <?cs include:"macros.cs" ?>
33 <html>
44 <?cs include:"head_tag.cs" ?>
5+<body class="<?cs var:package.since ?>">
56 <?cs include:"header.cs" ?>
67
78 <div class="g-unit" id="doc-content">
89
10+<div id="api-info-block">
11+<div class="api-level">
12+ <?cs call:since_tags(package) ?>
13+</div>
14+</div>
15+
916 <div id="jd-header">
1017 package
1118 <h1><?cs var:package.name ?></h1>
1219 <div class="jd-nav">
1320 <?cs if:subcount(package.shortDescr) ?>
14- Classes |
15- <a class="jd-navlink" href="package-descr.html">Description</a>
21+ Classes | <a class="jd-navlink" href="package-descr.html">Description</a>
1622 <?cs /if ?>
1723 </div>
18- <span class="api-level">
19- <?cs call:since_tags(package) ?>
20- </span>
21-</div>
24+</div><!-- end header -->
25+
26+<div id="naMessage"></div>
2227
23-<div id="jd-content">
28+<div id="jd-content" class="api apilevel-<?cs var:package.since ?>">
2429
2530 <?cs if:subcount(package.shortDescr) ?>
2631 <div class="jd-descr">
--- a/tools/droiddoc/templates/packages.cs
+++ b/tools/droiddoc/templates/packages.cs
@@ -20,7 +20,7 @@
2020 <?cs set:count = #1 ?>
2121 <table class="jd-sumtable">
2222 <?cs each:pkg = docs.packages ?>
23- <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
23+ <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:pkg.since ?>" >
2424 <td class="jd-linkcol"><?cs call:package_link(pkg) ?></td>
2525 <td class="jd-descrcol" width="100%"><?cs call:tag_list(pkg.shortDescr) ?>&nbsp;</td>
2626 </tr>
--- a/tools/releasetools/amend_generator.py
+++ b/tools/releasetools/amend_generator.py
@@ -180,6 +180,7 @@ class AmendGenerator(object):
180180
181181 def MakeSymlinks(self, symlink_list):
182182 """Create symlinks, given a list of (dest, link) pairs."""
183+ self.DeleteFiles([i[1] for i in symlink_list])
183184 self.script.extend(["symlink %s %s" % (i[0], self._FileRoot(i[1]))
184185 for i in sorted(symlink_list)])
185186
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -46,18 +46,20 @@ def Run(args, **kwargs):
4646 return subprocess.Popen(args, **kwargs)
4747
4848
49-def LoadBoardConfig(fn):
50- """Parse a board_config.mk file looking for lines that specify the
51- maximum size of various images, and parse them into the
52- OPTIONS.max_image_size dict."""
49+def LoadMaxSizes():
50+ """Load the maximum allowable images sizes from the input
51+ target_files size."""
5352 OPTIONS.max_image_size = {}
54- for line in open(fn):
55- line = line.strip()
56- m = re.match(r"BOARD_(BOOT|RECOVERY|SYSTEM|USERDATA)IMAGE_MAX_SIZE"
57- r"\s*:=\s*(\d+)", line)
58- if not m: continue
59-
60- OPTIONS.max_image_size[m.group(1).lower() + ".img"] = int(m.group(2))
53+ try:
54+ for line in open(os.path.join(OPTIONS.input_tmp, "META", "imagesizes.txt")):
55+ pieces = line.split()
56+ if len(pieces) != 2: continue
57+ image = pieces[0]
58+ size = int(pieces[1])
59+ OPTIONS.max_image_size[image + ".img"] = size
60+ except IOError, e:
61+ if e.errno == errno.ENOENT:
62+ pass
6163
6264
6365 def BuildAndAddBootableImage(sourcedir, targetname, output_zip):
@@ -142,7 +144,7 @@ def UnzipTemp(filename):
142144
143145 tmp = tempfile.mkdtemp(prefix="targetfiles-")
144146 OPTIONS.tempfiles.append(tmp)
145- p = Run(["unzip", "-q", filename, "-d", tmp], stdout=subprocess.PIPE)
147+ p = Run(["unzip", "-o", "-q", filename, "-d", tmp], stdout=subprocess.PIPE)
146148 p.communicate()
147149 if p.returncode != 0:
148150 raise ExternalError("failed to unzip input target-files \"%s\"" %
--- a/tools/releasetools/img_from_target_files
+++ b/tools/releasetools/img_from_target_files
@@ -21,8 +21,7 @@ use with 'fastboot update'.
2121 Usage: img_from_target_files [flags] input_target_files output_image_zip
2222
2323 -b (--board_config) <file>
24- Specifies a BoardConfig.mk file containing image max sizes
25- against which the generated image files are checked.
24+ Deprecated.
2625
2726 """
2827
@@ -109,10 +108,10 @@ def main(argv):
109108
110109 def option_handler(o, a):
111110 if o in ("-b", "--board_config"):
112- common.LoadBoardConfig(a)
113- return True
111+ pass # deprecated
114112 else:
115113 return False
114+ return True
116115
117116 args = common.ParseOptions(argv, __doc__,
118117 extra_opts="b:",
@@ -123,15 +122,15 @@ def main(argv):
123122 common.Usage(__doc__)
124123 sys.exit(1)
125124
125+ OPTIONS.input_tmp = common.UnzipTemp(args[0])
126+
127+ common.LoadMaxSizes()
126128 if not OPTIONS.max_image_size:
127129 print
128- print " WARNING: No board config specified; will not check image"
129- print " sizes against limits. Use -b to make sure the generated"
130- print " images don't exceed partition sizes."
130+ print " WARNING: Failed to load max image sizes; will not enforce"
131+ print " image size limits."
131132 print
132133
133- OPTIONS.input_tmp = common.UnzipTemp(args[0])
134-
135134 output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
136135
137136 common.AddBoot(output_zip)
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -22,8 +22,7 @@ a full OTA is produced.
2222 Usage: ota_from_target_files [flags] input_target_files output_ota_package
2323
2424 -b (--board_config) <file>
25- Specifies a BoardConfig.mk file containing image max sizes
26- against which the generated image files are checked.
25+ Deprecated.
2726
2827 -k (--package_key) <key>
2928 Key to use to sign the package (default is
@@ -619,7 +618,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
619618 script.Print("Removing unneeded files...")
620619 script.DeleteFiles(["/"+i[0] for i in verbatim_targets] +
621620 ["/"+i for i in sorted(source_data)
622- if i not in target_data])
621+ if i not in target_data] +
622+ ["/system/recovery.img"])
623623
624624 if updating_boot:
625625 # Produce the boot image by applying a patch to the current
@@ -736,7 +736,7 @@ def main(argv):
736736
737737 def option_handler(o, a):
738738 if o in ("-b", "--board_config"):
739- common.LoadBoardConfig(a)
739+ pass # deprecated
740740 elif o in ("-k", "--package_key"):
741741 OPTIONS.package_key = a
742742 elif o in ("-i", "--incremental_from"):
@@ -768,13 +768,6 @@ def main(argv):
768768 common.Usage(__doc__)
769769 sys.exit(1)
770770
771- if not OPTIONS.max_image_size:
772- print
773- print " WARNING: No board config specified; will not check image"
774- print " sizes against limits. Use -b to make sure the generated"
775- print " images don't exceed partition sizes."
776- print
777-
778771 if OPTIONS.script_mode not in ("amend", "edify", "auto"):
779772 raise ValueError('unknown script mode "%s"' % (OPTIONS.script_mode,))
780773
@@ -783,6 +776,14 @@ def main(argv):
783776
784777 print "unzipping target target-files..."
785778 OPTIONS.input_tmp = common.UnzipTemp(args[0])
779+
780+ common.LoadMaxSizes()
781+ if not OPTIONS.max_image_size:
782+ print
783+ print " WARNING: Failed to load max image sizes; will not enforce"
784+ print " image size limits."
785+ print
786+
786787 OPTIONS.target_tmp = OPTIONS.input_tmp
787788 input_zip = zipfile.ZipFile(args[0], "r")
788789 if OPTIONS.package_key:
--- a/tools/releasetools/sign_target_files_apks
+++ b/tools/releasetools/sign_target_files_apks
@@ -272,8 +272,13 @@ def ReplaceOtaKeys(input_tf_zip, output_tf_zip):
272272 k = m.group(1)
273273 mapped_keys.append(OPTIONS.key_map.get(k, k) + ".x509.pem")
274274
275- print "using:\n ", "\n ".join(mapped_keys)
276- print "for OTA package verification"
275+ if mapped_keys:
276+ print "using:\n ", "\n ".join(mapped_keys)
277+ print "for OTA package verification"
278+ else:
279+ mapped_keys.append(
280+ OPTIONS.key_map["build/target/product/security/testkey"] + ".x509.pem")
281+ print "META/otakeys.txt has no keys; using", mapped_keys[0]
277282
278283 # recovery uses a version of the key that has been slightly
279284 # predigested (by DumpPublicKey.java) and put in res/keys.