Merge "README: Update docs"
diff --git a/.gitignore b/.gitignore
index c9b568f..f1f4a52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
*.pyc
*.swp
+blueprint/
+kati/
+soong/
diff --git a/CleanSpec.mk b/CleanSpec.mk
index edf0179..19cb651 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -329,6 +329,11 @@
# instead.
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+# On to MNC
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+
# Adding dalvik.vm.usejit
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
@@ -349,6 +354,26 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
+# Change PLATFORM_VERSION from MNC to M
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+
+# 23 is becoming alive!!!
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+
+# 23 is becoming more alive!!!
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
+# $(PRODUCT_OUT)/recovery/root/sdcard goes from symlink to folder.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/sdcard)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/LINUX_KERNEL_COPYING b/core/LINUX_KERNEL_COPYING
new file mode 100644
index 0000000..ca442d3
--- /dev/null
+++ b/core/LINUX_KERNEL_COPYING
@@ -0,0 +1,356 @@
+
+ NOTE! This copyright does *not* cover user programs that use kernel
+ services by normal system calls - this is merely considered normal use
+ of the kernel, and does *not* fall under the heading of "derived work".
+ Also note that the GPL below is copyrighted by the Free Software
+ Foundation, but the instance of code that it refers to (the Linux
+ kernel) is copyrighted by me and others who actually wrote it.
+
+ Also note that the only valid version of the GPL as far as the kernel
+ is concerned is _this_ particular version of the license (ie v2, not
+ v2.2 or v3.x or whatever), unless explicitly otherwise stated.
+
+ Linus Torvalds
+
+----------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/core/Makefile b/core/Makefile
index f0b1d56..f64dc28 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -67,7 +67,9 @@
ADDITIONAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(ADDITIONAL_DEFAULT_PROPERTIES),=)
-$(INSTALLED_DEFAULT_PROP_TARGET):
+intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
+
+$(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo "#" > $@; \
@@ -75,7 +77,13 @@
echo "#" >> $@;
$(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \
echo "$(line)" >> $@;)
- build/tools/post_process_props.py $@
+ $(hide) echo "#" >> $@; \
+ echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
+ echo "#" >> $@;
+ $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
+ $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
+ $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
+ $(hide) build/tools/post_process_props.py $@
# -----------------------------------------------------------------
# build.prop
@@ -106,15 +114,15 @@
BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
# A human-readable string that descibes this build in detail.
-build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS)
-$(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc)
+build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
+$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
# The string used to uniquely identify the combined build and product; used by the OTA server.
ifeq (,$(strip $(BUILD_FINGERPRINT)))
ifneq ($(filter eng.%,$(BUILD_NUMBER)),)
# Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed
# the Android system property length limit (PROPERTY_VALUE_MAX=92).
- BF_BUILD_NUMBER := $(USER)$(shell date +%m%d%H%M)
+ BF_BUILD_NUMBER := $(shell echo $${USER:0:6})$(shell $(DATE) +%m%d%H%M)
else
BF_BUILD_NUMBER := $(BUILD_NUMBER)
endif
@@ -124,6 +132,9 @@
$(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
endif
+$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) > $(PRODUCT_OUT)/build_fingerprint.txt)
+BUILD_FINGERPRINT_FROM_FILE := $$(cat $(PRODUCT_OUT)/build_fingerprint.txt)
+
# The string used to uniquely identify the system build; used by the OTA server.
# This purposefully excludes any product-specific variables.
ifeq (,$(strip $(BUILD_THUMBPRINT)))
@@ -147,7 +158,7 @@
# Dev. branches should have DISPLAY_BUILD_NUMBER set
ifeq "true" "$(DISPLAY_BUILD_NUMBER)"
- BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER) $(BUILD_KEYS)
+ BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
else
BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
endif
@@ -166,12 +177,18 @@
BUILDINFO_SH := build/tools/buildinfo.sh
+# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test harness to distinguish builds.
+TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
+ifdef SANITIZE_TARGET
+TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
+endif
+
ifdef TARGET_SYSTEM_PROP
system_prop_file := $(TARGET_SYSTEM_PROP)
else
system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
endif
-$(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
+$(intermediate_system_build_prop): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -183,7 +200,7 @@
echo "import /oem/oem.prop $(prop)" >> $@;)
endif
$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
- TARGET_BUILD_FLAVOR="$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)" \
+ TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
TARGET_DEVICE="$(TARGET_DEVICE)" \
PRODUCT_NAME="$(TARGET_PRODUCT)" \
PRODUCT_BRAND="$(PRODUCT_BRAND)" \
@@ -194,14 +211,19 @@
PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
BUILD_ID="$(BUILD_ID)" \
BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
- BUILD_NUMBER="$(BUILD_NUMBER)" \
+ DATE="$(DATE_FROM_FILE)" \
+ BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
+ BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
PLATFORM_VERSION="$(PLATFORM_VERSION)" \
+ PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
+ PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
+ PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
- BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
+ BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
$(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT)") \
TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
@@ -231,6 +253,19 @@
build_desc :=
+ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
+INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
+else
+INSTALLED_RECOVERYIMAGE_TARGET :=
+endif
+
+$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
+ @echo "Target build info: $@"
+ $(hide) cat $(intermediate_system_build_prop) > $@
+ifdef INSTALLED_RECOVERYIMAGE_TARGET
+ $(hide) echo ro.expect.recovery_id=`cat $(RECOVERYIMAGE_ID_FILE)` >> $@
+endif
+
# -----------------------------------------------------------------
# vendor build.prop
#
@@ -242,25 +277,12 @@
@echo Target vendor buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
- $(hide) echo ro.vendor.build.date=`date`>>$@
- $(hide) echo ro.vendor.build.date.utc=`date +%s`>>$@
- $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT)">>$@
+ $(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@
+ $(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
+ $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
endif
# ----------------------------------------------------------------
-# boot.img build.prop
-# as with vendor build.prop above, for verifying that the bootimage
-# build is what we think it is
-
-INSTALLED_BOOTIMAGE_BUILD_PROP_TARGET := $(TARGET_ROOT_OUT)/build.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BOOTIMAGE_BUILD_PROP_TARGET)
-$(INSTALLED_BOOTIMAGE_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
- @echo Target bootimage buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) echo > $@
- $(hide) echo ro.bootimage.build.date=`date`>>$@
- $(hide) echo ro.bootimage.build.date.utc=`date +%s`>>$@
- $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT)">>$@
# -----------------------------------------------------------------
# sdk-build.prop
@@ -298,7 +320,12 @@
@echo Package stats: $@
@mkdir -p $(dir $@)
$(hide) rm -f $@
+ifeq ($(PACKAGES_TO_STAT),)
+# Create empty package stats file if target builds no jar(s) or apk(s).
+ $(hide) touch $@
+else
$(hide) build/tools/dump-package-stats $^ > $@
+endif
.PHONY: package-stats
package-stats: $(PACKAGE_STATS_FILE)
@@ -451,12 +478,12 @@
INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
$(call pretty,"Target ram disk: $@")
- $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
.PHONY: ramdisk-nodeps
ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
@echo "make $@: ignoring dependencies"
- $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
@@ -464,8 +491,12 @@
# the boot image, which is a collection of other images.
INTERNAL_BOOTIMAGE_ARGS := \
$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
- --kernel $(INSTALLED_KERNEL_TARGET) \
- --ramdisk $(INSTALLED_RAMDISK_TARGET)
+ --kernel $(INSTALLED_KERNEL_TARGET)
+
+ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
+endif
+
INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
@@ -486,9 +517,18 @@
INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
+# BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true.
+ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
+ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ $(error BOARD_BUILD_SYSTEM_ROOT_IMAGE must be enabled for BOARD_USES_RECOVERY_AS_BOOT.)
+endif
+endif
+
+# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
+ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
-else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)) # TARGET_BOOTIMAGE_USE_EXT2 != true
+else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)) # TARGET_BOOTIMAGE_USE_EXT2 != true
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
$(call pretty,"Target boot image: $@")
@@ -503,7 +543,22 @@
$(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET)
$(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
-else # PRODUCT_SUPPORTS_VERITY != true
+else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
+
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER)
+ $(call pretty,"Target boot image: $@")
+ $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
+ $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
+ $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
+
+.PHONY: bootimage-nodeps
+bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER)
+ @echo "make $@: ignoring dependencies"
+ $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
+ $(VBOOT_SIGNER) $(FUTILITY) $(INSTALLED_BOOTIMAGE_TARGET).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(INSTALLED_BOOTIMAGE_TARGET).keyblock $(INSTALLED_BOOTIMAGE_TARGET)
+ $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
+
+else # PRODUCT_SUPPORTS_VBOOT != true
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
$(call pretty,"Target boot image: $@")
@@ -517,6 +572,7 @@
$(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
endif # TARGET_BOOTIMAGE_USE_EXT2
+endif # BOARD_USES_RECOVERY_AS_BOOT
else # TARGET_NO_KERNEL
# HACK: The top-level targets depend on the bootimage. Not all targets
@@ -618,7 +674,7 @@
# make the target NOTICE files depend on this particular file too, which will
# then be in the right directory for the find in combine-notice-files to work.
$(kernel_notice_file): \
- prebuilts/qemu-kernel/arm/LINUX_KERNEL_COPYING \
+ $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
| $(ACP)
@echo Copying: $@
$(hide) mkdir -p $(dir $@)
@@ -633,10 +689,24 @@
# before the rules that use that variable to build the image.
ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
-$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
+$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR)) | $(ZIPTIME)
$(hide) rm -f $@
$(hide) mkdir -p $(dir $@)
- $(hide) zip -qj $@ $<
+ $(hide) zip -qjX $@ $<
+ $(remove-timestamps-from-package)
+
+# Carry the public key for update_engine if it's a non-Brillo target that
+# uses the AB updater. We use the same key as otacerts but in RSA public key
+# format.
+ifeq ($(AB_OTA_UPDATER),true)
+ifeq ($(BRILLO),)
+ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
+$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
+ $(hide) rm -f $@
+ $(hide) mkdir -p $(dir $@)
+ $(hide) openssl x509 -pubkey -noout -in $< > $@
+endif
+endif
.PHONY: otacerts
otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
@@ -681,17 +751,23 @@
endif
endif
+ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
+ INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
+endif
ifeq ($(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs)
-INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG)
+INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
endif
INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY))
INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
+ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC))
+INTERNAL_USERIMAGES_DEPS += $(FEC)
+endif
endif
-SELINUX_FC := $(TARGET_ROOT_OUT)/file_contexts
+SELINUX_FC := $(TARGET_ROOT_OUT)/file_contexts.bin
INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
# $(1): the path of the output dictionary file
@@ -701,6 +777,9 @@
$(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
+$(if $(BOARD_HAS_EXT4_RESERVED_BLOCKS),$(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(1))
+$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
$(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
@@ -711,16 +790,22 @@
$(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
+$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
+$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(VERITY_SIGNER)" >> $(1))
+$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
+$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
+$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(FUTILITY)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
+$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
+ $(hide) echo "recovery_as_boot=true" >> $(1))
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
$(hide) echo "system_root_image=true" >> $(1);\
echo "ramdisk_dir=$(TARGET_ROOT_OUT)" >> $(1))
@@ -730,10 +815,8 @@
# -----------------------------------------------------------------
# Recovery image
-# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
-ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
-
-INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
+# Recovery image exists if we are building recovery, or building recovery as boot.
+ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
$(ALL_DEFAULT_INSTALLED_MODULES))
@@ -742,7 +825,7 @@
recovery_sepolicy := $(call intermediates-dir-for,ETC,sepolicy.recovery)/sepolicy.recovery
recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
-recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
+recovery_build_prop := $(intermediate_system_build_prop)
recovery_resources_common := $(call include-path-for, recovery)/res
# Set recovery_density to the density bucket of the device.
@@ -772,18 +855,37 @@
recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
endif
-recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
+ifndef TARGET_PRIVATE_RES_DIRS
+TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
+endif
recovery_resource_deps := $(shell find $(recovery_resources_common) \
- $(recovery_resources_private) -type f)
+ $(TARGET_PRIVATE_RES_DIRS) -type f)
ifdef TARGET_RECOVERY_FSTAB
recovery_fstab := $(TARGET_RECOVERY_FSTAB)
else
recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
endif
+
+# Prior to A/B update, we used to have:
+# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
+# recovery-resource.dat is needed only if we carry a patch of the boot and
+# recovery images and invoke install-recovery.sh on the first boot post an
+# OTA update.
+#
+# We no longer need that if one of the following conditions holds:
+# a) We carry a full copy of the recovery image
+# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
+# b) We build a single image that contains boot and recovery both
+# (BOARD_USES_RECOVERY_AS_BOOT = true).
+
+ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT)))
# Named '.dat' so we don't attempt to use imgdiff for patching it.
RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
+else
+RECOVERY_RESOURCE_ZIP :=
+endif
-ifeq ($(recovery_resources_private),)
+ifeq ($(TARGET_PRIVATE_RES_DIRS),)
$(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
endif
@@ -826,13 +928,14 @@
@mkdir -p $(dir $@)
java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
+RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
# $(1): output file
define build-recoveryimage-target
@echo ----- Making recovery image ------
$(hide) mkdir -p $(TARGET_RECOVERY_OUT)
- $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc $(TARGET_RECOVERY_ROOT_OUT)/tmp
+ $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
@echo Copying baseline ramdisk...
- $(hide) rsync -a $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) # "cp -Rf" fails to overwrite broken symlinks on Mac.
+ $(hide) rsync -a --exclude=etc --exclude=sdcard $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) # "cp -Rf" fails to overwrite broken symlinks on Mac.
@echo Modifying ramdisk contents...
$(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/init*.rc
$(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
@@ -843,25 +946,44 @@
$(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
$(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
$(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
- $(hide) $(foreach item,$(recovery_resources_private), \
- cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
+ $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
+ cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
$(hide) $(foreach item,$(recovery_fstab), \
cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
$(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
$(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
> $(TARGET_RECOVERY_ROOT_OUT)/default.prop
- $(hide) $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
+ $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)), \
+ $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root; \
+ rm -rf $(TARGET_RECOVERY_ROOT_OUT)/system; \
+ ln -sf /system_root/system $(TARGET_RECOVERY_ROOT_OUT)/system) # Mount the system_root_image to /system_root and symlink /system.
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
$(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
- $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1))
- $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)),\
+ $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1) --id > $(RECOVERYIMAGE_ID_FILE))
+ $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
$(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1))
$(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
- $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(1).keyblock $(1))
- $(hide) $(call assert-max-image-size,$(1),$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))
+ $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
+ $(if $(filter true,BOARD_USES_RECOVERY_AS_BOOT), \
+ $(hide) $(call assert-max-image-size,$(1),$(BOARD_BOOTIMAGE_PARTITION_SIZE)), \
+ $(hide) $(call assert-max-image-size,$(1),$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)))
@echo ----- Made recovery image: $(1) --------
endef
+ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INTERNAL_RECOVERYIMAGE_FILES) \
+ $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
+ $(INSTALLED_2NDBOOTLOADER_TARGET) \
+ $(recovery_build_prop) $(recovery_resource_deps) \
+ $(recovery_fstab) \
+ $(RECOVERY_INSTALL_OTA_KEYS)
+ $(call pretty,"Target boot image from recovery: $@")
+ $(call build-recoveryimage-target, $@)
+endif
+
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
@@ -873,17 +995,19 @@
$(RECOVERY_INSTALL_OTA_KEYS)
$(call build-recoveryimage-target, $@)
-$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET)
+ifdef RECOVERY_RESOURCE_ZIP
+$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
$(hide) mkdir -p $(dir $@)
- $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrj $@ -@
+ $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
+ $(remove-timestamps-from-package)
+endif
.PHONY: recoveryimage-nodeps
recoveryimage-nodeps:
@echo "make $@: ignoring dependencies"
$(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
-else
-INSTALLED_RECOVERYIMAGE_TARGET :=
+else # INSTALLED_RECOVERYIMAGE_TARGET not defined
RECOVERY_RESOURCE_ZIP :=
endif
@@ -962,10 +1086,18 @@
skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
- $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) \
+ $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
|| ( echo "Out of space? the tree size of $(TARGET_OUT) is (MB): " 1>&2 ;\
du -sm $(TARGET_OUT) 1>&2;\
- echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
+ if [ "$(INTERNAL_USERIMAGES_EXT_VARIANT)" == "ext4" ]; then \
+ maxsize=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE); \
+ if [ "$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" == "true" ]; then \
+ maxsize=$$((maxsize - 4096 * 4096)); \
+ fi; \
+ echo "The max is $$(( maxsize / 1048576 )) MB." 1>&2 ;\
+ else \
+ echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
+ fi; \
mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
exit 1 )
endef
@@ -982,6 +1114,7 @@
# we can see how big it's going to be, and include that in the system
# image size check calculation.
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
+ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
@@ -991,6 +1124,9 @@
@echo "Construct recovery from boot"
mkdir -p $(dir $@)
PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
+else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
+RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
+endif
endif
@@ -1021,7 +1157,7 @@
$(call create-system-vendor-symlink)
$(MKTARBALL) $(FS_GET_STATS) \
$(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
- $(INSTALLED_SYSTEMTARBALL_TARGET)
+ $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
endef
ifndef SYSTEM_TARBALL_FORMAT
@@ -1054,19 +1190,19 @@
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES)
$(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
$(hide) rm -f $@
- $(hide) cd $(dir $@) && zip -qry $(notdir $@) \
+ $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
$(TARGET_COPY_OUT_SYSTEM) \
$(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES)) \
$(addprefix symbols/,$(PDK_SYMBOL_FILES_LIST))
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
- $(hide) cd $(dir $@) && zip -qry $(notdir $@) \
+ $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
$(TARGET_COPY_OUT_VENDOR)
endif
ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
- $(hide) cd $(OUT_DIR) && zip -qry $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
+ $(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
endif
ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
- $(hide) zip -qry $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
+ $(hide) zip -qryX $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
endif
.PHONY: platform
@@ -1089,7 +1225,7 @@
$(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
$(hide) $(MKTARBALL) $(FS_GET_STATS) \
$(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
- $(INSTALLED_BOOTTARBALL_TARGET)
+ $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
endef
ifndef BOOT_TARBALL_FORMAT
@@ -1133,7 +1269,7 @@
$(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt, skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
- $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET)
+ $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
endef
@@ -1157,7 +1293,7 @@
"$(INSTALLED_USERDATATARBALL_TARGET)")
$(MKTARBALL) $(FS_GET_STATS) \
$(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
- $(INSTALLED_USERDATATARBALL_TARGET)
+ $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
endef
userdata_tar := $(PRODUCT_OUT)/userdata.tar
@@ -1188,7 +1324,7 @@
$(call generate-userimage-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt, skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
- $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET)
+ $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
endef
@@ -1215,6 +1351,13 @@
# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
+INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
+$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES)
+ @echo Installed file list: $@
+ @mkdir -p $(dir $@)
+ @rm -f $@
+ $(hide) build/tools/fileslist.py $(TARGET_OUT_VENDOR) > $@
+
vendorimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,vendor)
BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
@@ -1226,13 +1369,13 @@
$(call generate-userimage-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt, skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
- $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET)
+ $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
endef
# We just build this directly to the install location.
INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
-$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES)
+$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR)
$(build-vendorimage-target)
.PHONY: vendorimage-nodeps
@@ -1250,7 +1393,32 @@
# -----------------------------------------------------------------
# host tools needed to build dist and OTA packages
-DISTTOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
+build_ota_package := true
+ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
+build_ota_package := false
+endif
+ifeq ($(BUILD_OS),darwin)
+build_ota_package := false
+endif
+ifneq ($(strip $(SANITIZE_TARGET)),)
+build_ota_package := false
+endif
+ifeq ($(TARGET_PRODUCT),sdk)
+build_ota_package := false
+endif
+ifneq ($(filter generic%,$(TARGET_DEVICE)),)
+build_ota_package := false
+endif
+ifeq ($(TARGET_NO_KERNEL),true)
+build_ota_package := false
+endif
+ifeq ($(recovery_fstab),)
+build_ota_package := false
+endif
+
+ifeq ($(build_ota_package),true)
+OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
+ $(HOST_OUT_EXECUTABLES)/aapt \
$(HOST_OUT_EXECUTABLES)/mkbootfs \
$(HOST_OUT_EXECUTABLES)/mkbootimg \
$(HOST_OUT_EXECUTABLES)/fs_config \
@@ -1267,17 +1435,39 @@
$(HOST_OUT_EXECUTABLES)/build_verity_tree \
$(HOST_OUT_EXECUTABLES)/verity_signer \
$(HOST_OUT_EXECUTABLES)/append2simg \
- $(HOST_OUT_EXECUTABLES)/boot_signer
+ $(HOST_OUT_EXECUTABLES)/img2simg \
+ $(HOST_OUT_EXECUTABLES)/boot_signer \
+ $(HOST_OUT_EXECUTABLES)/fec \
+ $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
+ $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
+ $(HOST_OUT_EXECUTABLES)/delta_generator
# Shared libraries.
-DISTTOOLS += \
+OTATOOLS += \
$(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX)
-
-OTATOOLS := $(DISTTOOLS) \
- $(HOST_OUT_EXECUTABLES)/aapt
+ $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libdivsufsort$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libdivsufsort64$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libbrillo-http$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite-rtti$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX)
.PHONY: otatools
otatools: $(OTATOOLS)
@@ -1288,17 +1478,20 @@
$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) | $(ACP)
@echo "Package OTA tools: $@"
$(hide) rm -rf $@ $(zip_root)
- $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
+ $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools $(zip_root)/system/extras/verity
$(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
+ $(hide) $(ACP) $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar $(zip_root)/framework/
+ $(hide) $(ACP) -p system/extras/verity/build_verity_metadata.py $(zip_root)/system/extras/verity/
$(hide) $(ACP) -r -d -p build/tools/releasetools/* $(zip_root)/releasetools
$(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
- $(hide) (cd $(zip_root) && zip -qry $(abspath $@) *)
- $(hide) zip -qry $(abspath $@) build/target/product/security/
- $(hide) find device vendor -name \*.pk8 -o -name \*.x509.pem -o -name oem.prop | xargs zip -qry $(abspath $@)>/dev/null || true
+ $(hide) (cd $(zip_root) && zip -qryX $(abspath $@) *)
+ $(hide) zip -qryX $(abspath $@) build/target/product/security/
+ $(hide) find device vendor -name \*.pk8 -o -name \*.x509.pem -o -name oem.prop | xargs zip -qryX $(abspath $@)>/dev/null || true
.PHONY: otatools-package
otatools-package: $(BUILT_OTATOOLS_PACKAGE)
+endif # build_ota_package
# -----------------------------------------------------------------
# A zip of the directories that map to the target filesystem.
@@ -1327,12 +1520,14 @@
fi
endef
-built_ota_tools := \
- $(call intermediates-dir-for,EXECUTABLES,applypatch,,,$(TARGET_PREFER_32_BIT))/applypatch \
- $(call intermediates-dir-for,EXECUTABLES,applypatch_static,,,$(TARGET_PREFER_32_BIT))/applypatch_static \
- $(call intermediates-dir-for,EXECUTABLES,check_prereq,,,$(TARGET_PREFER_32_BIT))/check_prereq \
- $(call intermediates-dir-for,EXECUTABLES,sqlite3,,,$(TARGET_PREFER_32_BIT))/sqlite3 \
- $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
+built_ota_tools :=
+
+# We can't build static executables when SANITIZE_TARGET=address
+ifeq ($(strip $(SANITIZE_TARGET)),)
+built_ota_tools += \
+ $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
+endif
+
$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
@@ -1345,6 +1540,18 @@
$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
endif
+# Build OTA tools if not using the AB Updater.
+ifneq ($(AB_OTA_UPDATER),true)
+$(BUILT_TARGET_FILES_PACKAGE): $(built_ota_tools)
+endif
+
+# If we are using recovery as boot, output recovery files to BOOT/.
+ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
+$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
+else
+$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
+endif
+
# Depending on the various images guarantees that the underlying
# directories are up-to-date.
$(BUILT_TARGET_FILES_PACKAGE): \
@@ -1357,37 +1564,46 @@
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
$(SELINUX_FC) \
- $(built_ota_tools) \
$(APKCERTS_FILE) \
$(HOST_OUT_EXECUTABLES)/fs_config \
| $(ACP)
@echo "Package target files: $@"
$(hide) rm -rf $@ $(zip_root)
$(hide) mkdir -p $(dir $@) $(zip_root)
+ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
@# Components of the recovery image
- $(hide) mkdir -p $(zip_root)/RECOVERY
+ $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
$(hide) $(call package_files-copy-root, \
- $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
+ $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
ifdef INSTALLED_KERNEL_TARGET
- $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
+ $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
endif
ifdef INSTALLED_2NDBOOTLOADER_TARGET
$(hide) $(ACP) \
- $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
+ $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
endif
ifdef BOARD_KERNEL_CMDLINE
- $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
+ $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
endif
ifdef BOARD_KERNEL_BASE
- $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
+ $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
endif
ifdef BOARD_KERNEL_PAGESIZE
- $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize
+ $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
endif
+endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
@# Components of the boot image
$(hide) mkdir -p $(zip_root)/BOOT
+ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ $(hide) mkdir -p $(zip_root)/ROOT
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
+else
$(hide) $(call package_files-copy-root, \
$(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
+endif
+ @# If we are using recovery as boot, this is already done when processing recovery.
+ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
ifdef INSTALLED_KERNEL_TARGET
$(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
endif
@@ -1404,6 +1620,7 @@
ifdef BOARD_KERNEL_PAGESIZE
$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
endif
+endif # BOARD_USES_RECOVERY_AS_BOOT
$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
mkdir -p $(zip_root)/RADIO; \
$(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
@@ -1419,15 +1636,21 @@
$(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
endif
@# Extra contents of the OTA package
- $(hide) mkdir -p $(zip_root)/OTA/bin
+ $(hide) mkdir -p $(zip_root)/OTA
$(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
+ifneq ($(AB_OTA_UPDATER),true)
+ifneq ($(built_ota_tools),)
+ $(hide) mkdir -p $(zip_root)/OTA/bin
$(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
+endif
+endif
@# Files that do not end up in any images, but are necessary to
@# build them.
$(hide) mkdir -p $(zip_root)/META
$(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
$(hide) if test -e $(tool_extensions)/releasetools.py; then $(ACP) $(tool_extensions)/releasetools.py $(zip_root)/META/; fi
$(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
+ $(hide) $(ACP) $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
$(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
$(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
ifdef BOARD_FLASH_BLOCK_SIZE
@@ -1436,9 +1659,18 @@
ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
$(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
+ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),)
+ $(hide) echo "recovery_as_boot=$(BOARD_USES_RECOVERY_AS_BOOT)" >> $(zip_root)/META/misc_info.txt
+endif
+ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
+ $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
+endif
ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
$(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
+ifdef BOARD_HAS_EXT4_RESERVED_BLOCKS
+ $(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(zip_root)/META/misc_info.txt
+endif
ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
@# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
$(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
@@ -1454,25 +1686,60 @@
$(hide) echo "use_set_metadata=1" >> $(zip_root)/META/misc_info.txt
$(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
$(hide) echo "update_rename_support=1" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "blockimgdiff_versions=1,2,3" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "blockimgdiff_versions=1,2,3,4" >> $(zip_root)/META/misc_info.txt
ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
# OTA scripts are only interested in fingerprint related properties
$(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
endif
+ifneq ($(strip $(SANITIZE_TARGET)),)
+ # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
+ $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
+endif
+ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
+ $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
+endif
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
+ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
./build/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
+endif
+ifeq ($(AB_OTA_UPDATER),true)
+ @# When using the A/B updater, include the updater config files in the zip.
+ $(hide) $(ACP) $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
+ $(hide) for part in $(AB_OTA_PARTITIONS); do \
+ echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
+ done
+ $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
+ echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
+ done
+ @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
+ $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
+ifdef OSRELEASED_DIRECTORY
+ $(hide) $(ACP) $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
+ $(hide) $(ACP) $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
+endif
+endif
+ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
+ @# If breakpad symbols have been generated, add them to the zip.
+ $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
+endif
@# Zip everything up, preserving symlinks
- $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
+ $(hide) (cd $(zip_root) && zip -qryX ../$(notdir $@) .)
@# Run fs_config on all the system, vendor, boot ramdisk,
@# and recovery ramdisk files in the zip, and save the output
- $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -S $(SELINUX_FC) > $(zip_root)/META/filesystem_config.txt
- $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="VENDOR/" } /^VENDOR\// {print "vendor/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -S $(SELINUX_FC) > $(zip_root)/META/vendor_filesystem_config.txt
- $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="BOOT/RAMDISK/" } /^BOOT\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -S $(SELINUX_FC) > $(zip_root)/META/boot_filesystem_config.txt
- $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -S $(SELINUX_FC) > $(zip_root)/META/recovery_filesystem_config.txt
- $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/*filesystem_config.txt)
+ $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/filesystem_config.txt
+ $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="VENDOR/" } /^VENDOR\// {print "vendor/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/vendor_filesystem_config.txt
+ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="ROOT/" } /^ROOT\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/root_filesystem_config.txt
+endif
+ $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="BOOT/RAMDISK/" } /^BOOT\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/boot_filesystem_config.txt
+ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
+ $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/recovery_filesystem_config.txt
+endif
+ $(hide) (cd $(zip_root) && zip -qX ../$(notdir $@) META/*filesystem_config.txt)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- ./build/tools/releasetools/add_img_to_target_files -p $(HOST_OUT) $@
+ ./build/tools/releasetools/add_img_to_target_files -v -p $(HOST_OUT) $@
.PHONY: target-files-package
target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
@@ -1481,11 +1748,7 @@
$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
endif
-ifneq ($(TARGET_PRODUCT),sdk)
-ifeq ($(filter generic%,$(TARGET_DEVICE)),)
-ifneq ($(TARGET_NO_KERNEL),true)
-ifneq ($(recovery_fstab),)
-
+ifeq ($(build_ota_package),true)
# -----------------------------------------------------------------
# OTA update package
@@ -1499,7 +1762,7 @@
$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
-$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
+$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE)
@echo "Package OTA: $@"
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
./build/tools/releasetools/ota_from_target_files -v \
@@ -1512,10 +1775,7 @@
.PHONY: otapackage
otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
-endif # recovery_fstab is defined
-endif # TARGET_NO_KERNEL != true
-endif # TARGET_DEVICE != generic*
-endif # TARGET_PRODUCT != sdk
+endif # build_ota_package
# -----------------------------------------------------------------
# The update package
@@ -1528,7 +1788,7 @@
INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
-$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
+$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE)
@echo "Package: $@"
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
./build/tools/releasetools/img_from_target_files -v \
@@ -1557,7 +1817,7 @@
@echo "Package symbols: $@"
$(hide) rm -rf $@
$(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED)
- $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
+ $(hide) zip -qrX $@ $(TARGET_OUT_UNSTRIPPED)
# -----------------------------------------------------------------
# A zip of the Android Apps. Not keeping full path so that we don't
@@ -1574,8 +1834,13 @@
@echo "Package apps: $@"
$(hide) rm -rf $@
$(hide) mkdir -p $(dir $@)
- $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*/*.apk $(TARGET_OUT_APPS_PRIVILEGED)/*/*.apk
-
+ $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
+ if [ -z "$$apps_to_zip" ]; then \
+ echo "No apps to zip up. Generating empty apps archive." ; \
+ a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
+ else \
+ zip -qjX $@ $$apps_to_zip; \
+ fi
#------------------------------------------------------------------
# A zip of emma code coverage meta files. Generated for fully emma
@@ -1587,7 +1852,7 @@
$(EMMA_META_ZIP) :
@echo "Collecting Emma coverage meta files."
$(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "coverage.em" | \
- zip -@ -q $@
+ zip -@ -qX $@
endif # EMMA_INSTRUMENT=true
@@ -1603,7 +1868,7 @@
$(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
if [ -n "$$dict_files" ]; then \
unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
- zip -q $@ $$dict_files $$unobfuscated_jars; \
+ zip -qX $@ $$dict_files $$unobfuscated_jars; \
else \
touch $(dir $@)/zipdummy; \
(cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
@@ -1634,7 +1899,7 @@
$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
@echo "Package: $@"
- $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
+ $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
endif
# -----------------------------------------------------------------
@@ -1769,7 +2034,7 @@
HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
chmod -R ug+rwX $(PRIVATE_DIR) && \
- cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
+ cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
@@ -1804,11 +2069,15 @@
include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
-include $(sort $(wildcard device/*/build/tasks/*.mk))
+-include $(sort $(wildcard product/*/build/tasks/*.mk))
# Also the project-specific tasks
-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
+-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
endif
+include $(BUILD_SYSTEM)/product-graph.mk
+
# -----------------------------------------------------------------
# Create SDK repository packages. Must be done after tasks/* since
# we need the addon rules defined.
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index c641b75..582bad4 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -15,6 +15,7 @@
my_full_libs_manifest_deps := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
# Set up dependency on aar libraries
+LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar)
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 0294cf2..7e33660 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -34,14 +34,37 @@
ifneq ($(LOCAL_IS_HOST_MODULE),true)
$(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
endif
- my_prefix := HOST_
+ ifeq ($(LOCAL_HOST_PREFIX),)
+ my_prefix := HOST_
+ else
+ my_prefix := $(LOCAL_HOST_PREFIX)
+ endif
my_host := host-
else
my_prefix := TARGET_
my_host :=
endif
+ifeq ($(my_prefix),HOST_CROSS_)
+ my_host_cross := true
+else
+ my_host_cross :=
+endif
+
my_module_tags := $(LOCAL_MODULE_TAGS)
+ifeq ($(my_host_cross),true)
+ my_module_tags :=
+endif
+
+ifdef BUILDING_WITH_NINJA
+# Ninja has an implicit dependency on the command being run, and kati will
+# regenerate the ninja manifest if any read makefile changes, so there is no
+# need to have dependencies on makefiles.
+# This won't catch all the cases where LOCAL_ADDITIONAL_DEPENDENCIES contains
+# a .mk file, because a few users of LOCAL_ADDITIONAL_DEPENDENCIES don't include
+# base_rules.mk, but it will fix the most common ones.
+LOCAL_ADDITIONAL_DEPENDENCIES := $(filter-out %.mk,$(LOCAL_ADDITIONAL_DEPENDENCIES))
+endif
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
@@ -117,6 +140,8 @@
partition_tag := _VENDOR
else ifeq (true,$(LOCAL_OEM_MODULE))
partition_tag := _OEM
+ else ifeq (true,$(LOCAL_ODM_MODULE))
+ partition_tag := _ODM
else
# The definition of should-install-to-system will be different depending
# on which goal (e.g., sdk or just droid) is being built.
@@ -148,15 +173,18 @@
my_register_name := $(LOCAL_MODULE)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX)
endif
endif
+ifeq ($(my_host_cross),true)
+ my_register_name := host_cross_$(LOCAL_MODULE)
+endif
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
module_id := MODULE.$(if \
- $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
+ $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
ifdef $(module_id)
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
endif
$(module_id) := $(LOCAL_PATH)
-intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
+intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
generated_sources_dir := $(call local-generated-sources-dir)
@@ -192,296 +220,40 @@
# Assemble the list of targets to create PRIVATE_ variables for.
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
-
###########################################################
-## AIDL: Compile .aidl files to .java
+## Create .toc files from shared objects to reduce unnecessary rebuild
+# .toc files have the list of external dynamic symbols without their addresses.
+# As .KATI_RESTAT is specified to .toc files and commit-change-for-toc is used,
+# dependent binaries of a .toc file will be rebuilt only when the content of
+# the .toc file is changed.
###########################################################
+ifndef LOCAL_IS_HOST_MODULE
+# Disable .toc optimization for host modules: we may run the host binaries during the build process
+# and the libraries' implementation matters.
+ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
+LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE).toc
+$(LOCAL_BUILT_MODULE).toc: $(LOCAL_BUILT_MODULE)
+ $(call $(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)transform-shared-lib-to-toc,$<,$@.tmp)
+ $(call commit-change-for-toc,$@)
-aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
-
-ifneq ($(strip $(aidl_sources)),)
-
-aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
-aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources))
-
-aidl_preprocess_import :=
-LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
-ifdef LOCAL_SDK_VERSION
-ifneq ($(filter current system_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
- # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
- aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
-else
- aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
-endif # not current or system_current
-else
-# build against the platform.
-LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
-endif # LOCAL_SDK_VERSION
-$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
-
-$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: \
- $(TOPDIR)$(LOCAL_PATH)/%.aidl \
- $(LOCAL_MODULE_MAKEFILE) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- $(AIDL) \
- $(aidl_preprocess_import)
- $(transform-aidl-to-java)
--include $(aidl_java_sources:%.java=%.P)
-
-else
-aidl_java_sources :=
+# Kati adds restat=1 to ninja. GNU make does nothing for this.
+.KATI_RESTAT: $(LOCAL_BUILT_MODULE).toc
+endif
endif
###########################################################
-## logtags: Add .logtags files to global list, emit java source
+## logtags: Add .logtags files to global list
###########################################################
logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES))
ifneq ($(strip $(logtags_sources)),)
-
event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
-
-# Emit a java source file with constants for the tags, if
-# LOCAL_MODULE_CLASS is "APPS" or "JAVA_LIBRARIES".
-ifneq ($(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES),)
-
-logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
-logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources))
-
-$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
- $(transform-logtags-to-java)
-
-endif
-
else
-logtags_java_sources :=
event_log_tags :=
endif
###########################################################
-## .proto files: Compile proto files to .java
-###########################################################
-proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
-# Because names of the .java files compiled from .proto files are unknown until the
-# .proto files are compiled, we use a timestamp file as depedency.
-proto_java_sources_file_stamp :=
-ifneq ($(proto_sources),)
-proto_sources_fullpath := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(proto_sources))
-# 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.
-ifneq ($(LOCAL_INTERMEDIATE_SOURCE_DIR),)
-proto_java_intemediate_dir := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/proto
-else
-# LOCAL_INTERMEDIATE_SOURCE_DIR may be not defined in non-java modules.
-proto_java_intemediate_dir := $(intermediates)/proto
-endif
-proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp
-proto_java_sources_dir := $(proto_java_intemediate_dir)/src
-
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir)
-ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out
-else
- ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
- else
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
- endif
-endif
-$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
-$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
- $(call transform-proto-to-java)
-
-#TODO: protoc should output the dependencies introduced by imports.
-
-LOCAL_INTERMEDIATE_TARGETS += $(proto_java_sources_file_stamp)
-endif # proto_sources
-
-
-###########################################################
-## Java: Compile .java files to .class
-###########################################################
-#TODO: pull this into java.make once host and target are combined
-
-java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
- $(filter %.java,$(LOCAL_GENERATED_SOURCES))
-all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
-
-## Java resources #########################################
-
-# Look for resource files in any specified directories.
-# Non-java and non-doc files will be picked up as resources
-# and included in the output jar file.
-java_resource_file_groups :=
-
-LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
-ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
- # This makes a list of words like
- # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
- # where each of the files is relative to the directory it's grouped with.
- # Directories that don't contain any resource files will result in groups
- # that end with a colon, and they are stripped out in the next step.
- java_resource_file_groups += \
- $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
- $(subst $(space),:,$(strip \
- $(TOP_DIR)$(LOCAL_PATH)/$(dir): \
- $(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \
- find . \
- -type d -a -name ".svn" -prune -o \
- -type f \
- -a \! -name "*.java" \
- -a \! -name "package.html" \
- -a \! -name "overview.html" \
- -a \! -name ".*.swp" \
- -a \! -name ".DS_Store" \
- -a \! -name "*~" \
- -print \
- )) \
- )) \
- )
- java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
-endif # LOCAL_JAVA_RESOURCE_DIRS
-
-LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
-ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
- java_resource_file_groups += \
- $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
- $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
- )
-endif # LOCAL_JAVA_RESOURCE_FILES
-
-ifdef java_resource_file_groups
- # The full paths to all resources, used for dependencies.
- java_resource_sources := \
- $(foreach group,$(java_resource_file_groups), \
- $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
- $(wordlist 2,9999,$(subst :,$(space),$(group))) \
- ) \
- )
- # The arguments to jar that will include these files in a jar file.
- # Quote the file name to handle special characters (such as #) correctly.
- extra_jar_args := \
- $(foreach group,$(java_resource_file_groups), \
- $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \
- $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \
- ) \
- )
- java_resource_file_groups :=
-else
- java_resource_sources :=
- extra_jar_args :=
-endif # java_resource_file_groups
-
-## PRIVATE java vars ######################################
-# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
-# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
-# You have to set up the dependency in some other way.
-need_compile_java := $(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))
-ifdef need_compile_java
-
-full_static_java_libs := \
- $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
- $(call intermediates-dir-for, \
- JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar)
-
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES))
-ifeq ($(my_prefix),TARGET_)
-ifeq ($(LOCAL_SDK_VERSION),)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart)
-else
-ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
-# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current)
-else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_system_stubs_current)
-else
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
-endif # current or system_current
-endif # LOCAL_SDK_VERSION
-endif # TARGET_
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
-
-# full_java_libs: The list of files that should be used as the classpath.
-# Using this list as a dependency list WILL NOT WORK.
-# full_java_lib_deps: Should be specified as a prerequisite of this module
-# to guarantee that the files in full_java_libs will
-# be up-to-date.
-ifdef LOCAL_IS_HOST_MODULE
-ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-deps,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
-
-full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
-full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
-else
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
-
-full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
- $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
-full_java_lib_deps := $(full_shared_java_libs)
-endif # USE_CORE_LIB_BOOTCLASSPATH
-else # !LOCAL_IS_HOST_MODULE
-full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
-full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
-endif # !LOCAL_IS_HOST_MODULE
-full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
-full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH)
-
-# This is set by packages that are linking to other packages that export
-# shared libraries, allowing them to make use of the code in the linked apk.
-apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
-ifneq ($(apk_libraries),)
- link_apk_libraries := \
- $(foreach lib,$(apk_libraries), \
- $(call intermediates-dir-for, \
- APPS,$(lib),,COMMON)/classes.jar)
-
- # link against the jar with full original names (before proguard processing).
- full_shared_java_libs += $(link_apk_libraries)
- full_java_libs += $(link_apk_libraries)
- full_java_lib_deps += $(link_apk_libraries)
-endif
-
-# This is set by packages that contain instrumentation, allowing them to
-# link against the package they are instrumenting. Currently only one such
-# package is allowed.
-LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
-ifdef LOCAL_INSTRUMENTATION_FOR
- ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
- $(error \
- $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
- endif
-
- link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
- APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
- # link against the jar with full original names (before proguard processing).
- link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
- full_java_libs += $(link_instr_classes_jar)
- full_java_lib_deps += $(link_instr_classes_jar)
-endif
-
-endif # need_compile_java
-
-# We may want to add jar manifest or jar resource files even if there is no java code at all.
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
-jar_manifest_file :=
-ifneq ($(strip $(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
-
-###########################################################
## make clean- targets
###########################################################
cleantarget := clean-$(my_register_name)
@@ -497,35 +269,12 @@
###########################################################
## Common definitions for module.
###########################################################
-
-# aapt doesn't accept multiple --extra-packages flags.
-# We have to collapse them into a single --extra-packages flag here.
-LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
-ifdef LOCAL_AAPT_FLAGS
-ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
-aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
-aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
-aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
-LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
- --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
-aapt_flags_extra_packages :=
-aapt_flags :=
-endif
-endif
-
-# Propagate local configuration options to this target.
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS)
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES)
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME)
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR:= $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
-
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
-
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
# Tell the module and all of its sub-modules who it is.
@@ -537,6 +286,15 @@
.PHONY: $(my_register_name)
$(my_register_name): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
+# Set up phony targets that covers all modules under the given paths.
+# This allows us to build everything in given paths by running mmma/mma.
+my_path_components := $(subst /,$(space),$(LOCAL_PATH))
+my_path_prefix := MODULES-IN
+$(foreach c, $(my_path_components),\
+ $(eval my_path_prefix := $(my_path_prefix)-$(c))\
+ $(eval .PHONY : $(my_path_prefix))\
+ $(eval $(my_path_prefix) : $(my_register_name)))
+
###########################################################
## Module installation rule
###########################################################
@@ -562,8 +320,25 @@
$(copy-file-to-target-with-cp)
endif
-endif # !LOCAL_UNINSTALLABLE_MODULE
+# Rule to install the module's companion init.rc.
+my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix))
+my_init_rc_src :=
+my_init_rc_installed :=
+ifndef my_init_rc
+my_init_rc := $(LOCAL_INIT_RC)
+# Make sure we don't define the rule twice in multilib module.
+LOCAL_INIT_RC :=
+endif
+ifdef my_init_rc
+my_init_rc_src := $(LOCAL_PATH)/$(my_init_rc)
+my_init_rc_installed := $(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(my_init_rc_src))
+$(my_init_rc_installed) : $(my_init_rc_src) | $(ACP)
+ @echo "Install: $@"
+ $(copy-file-to-new-target)
+$(my_register_name) : $(my_init_rc_installed)
+endif # my_init_rc
+endif # !LOCAL_UNINSTALLABLE_MODULE
###########################################################
## CHECK_BUILD goals
@@ -573,8 +348,6 @@
# checked modules, use LOCAL_BUILT_MODULE.
ifdef LOCAL_CHECKED_MODULE
my_checked_module := $(LOCAL_CHECKED_MODULE)
-else ifdef java_alternative_checked_module
- my_checked_module := $(java_alternative_checked_module)
else
my_checked_module := $(LOCAL_BUILT_MODULE)
endif
@@ -612,9 +385,12 @@
$(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
ALL_MODULES.$(my_register_name).INSTALLED := \
- $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) $(LOCAL_INSTALLED_MODULE))
+ $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
+ $(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed))
ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
- $(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) $(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE))
+ $(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
+ $(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE) \
+ $(addprefix $(my_init_rc_src):,$(my_init_rc_installed)))
endif
ifdef LOCAL_PICKUP_FILES
# Files or directories ready to pick up by the build system
@@ -622,13 +398,15 @@
ALL_MODULES.$(my_register_name).PICKUP_FILES := \
$(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
endif
+my_required_modules := $(LOCAL_REQUIRED_MODULES) \
+ $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+ifdef LOCAL_IS_HOST_MODULE
+my_required_modules += $(LOCAL_REQUIRED_MODULES_$($(my_prefix)OS))
+endif
ALL_MODULES.$(my_register_name).REQUIRED := \
- $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(LOCAL_REQUIRED_MODULES) \
- $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
+ $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(my_required_modules))
ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
-ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
- $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
ALL_MODULES.$(my_register_name).MAKEFILE := \
$(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
ifdef LOCAL_MODULE_OWNER
@@ -638,9 +416,7 @@
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
endif
-ifdef aidl_sources
-ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources)
-endif
+ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
@@ -699,5 +475,3 @@
###########################################################
include $(BUILD_NOTICE_FILE)
-
-#:vi noexpandtab
diff --git a/core/binary.mk b/core/binary.mk
index d3d050e..5f7ba66 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -24,7 +24,7 @@
endif
else
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
- my_system_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
+ my_system_shared_libraries := libc libm
else
my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
endif
@@ -34,21 +34,27 @@
# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
# we can't modify them in place.
my_src_files := $(LOCAL_SRC_FILES)
+my_src_files_exclude := $(LOCAL_SRC_FILES_EXCLUDE)
my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
my_cflags := $(LOCAL_CFLAGS)
my_conlyflags := $(LOCAL_CONLYFLAGS)
my_cppflags := $(LOCAL_CPPFLAGS)
+my_cflags_no_override := $(GLOBAL_CFLAGS_NO_OVERRIDE)
+my_cppflags_no_override := $(GLOBAL_CPPFLAGS_NO_OVERRIDE)
my_ldflags := $(LOCAL_LDFLAGS)
my_ldlibs := $(LOCAL_LDLIBS)
my_asflags := $(LOCAL_ASFLAGS)
my_cc := $(LOCAL_CC)
+my_cc_wrapper := $(CC_WRAPPER)
my_cxx := $(LOCAL_CXX)
+my_cxx_wrapper := $(CXX_WRAPPER)
my_c_includes := $(LOCAL_C_INCLUDES)
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
my_native_coverage := $(LOCAL_NATIVE_COVERAGE)
-my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
ifdef LOCAL_IS_HOST_MODULE
my_allow_undefined_symbols := true
@@ -69,7 +75,15 @@
my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include
- ifeq (x86_64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+
+ # x86_64 and and mips64 are both multilib toolchains, so their libraries are
+ # installed in /usr/lib64. Aarch64, on the other hand, is not a multilib
+ # compiler, so its libraries are in /usr/lib.
+ #
+ # Mips32r6 is yet another variation, with libraries installed in libr6.
+ #
+ # For the rest, the libraries are installed simply to /usr/lib.
+ ifneq (,$(filter x86_64 mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib64
else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/libr6
@@ -79,11 +93,16 @@
# The bionic linker now has support for packed relocations and gnu style
# hashes (which are much faster!), but shipping to older devices requires
- # the old style hash and disabling packed relocations.
- #ifeq ($(shell expr $(LOCAL_SDK_VERSION) >= FIRST_SUPPORTED_VERSION),0)
- my_ldflags += -Wl,--hash-style=sysv
- LOCAL_PACK_MODULE_RELOCATIONS := false
- #endif
+ # the old style hash. Fortunately, we can build with both and it'll work
+ # anywhere.
+ #
+ # This is not currently supported on MIPS architectures.
+ ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
+ my_ldflags += -Wl,--hash-style=both
+ endif
+
+ # We don't want to expose the relocation packer to the NDK just yet.
+ LOCAL_PACK_MODULE_RELOCATIONS := false
# Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
# See ndk/docs/CPLUSPLUS-SUPPORT.html
@@ -100,15 +119,16 @@
ifeq (,$(LOCAL_NDK_STL_VARIANT))
LOCAL_NDK_STL_VARIANT := system
endif
- ifneq (1,$(words $(filter system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
+ ifneq (1,$(words $(filter none system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
$(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
endif
ifeq (system,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
- # for "system" variant, the shared library exists in the system library and -lstdc++ is added by default.
+ my_system_shared_libraries += libstdc++
else # LOCAL_NDK_STL_VARIANT is not system
ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
+ my_system_shared_libraries += libstdc++
ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_static.a
else
@@ -127,11 +147,14 @@
my_ndk_stl_shared_lib := -lc++_shared
endif
my_ndk_stl_cppflags := -std=c++11
- else
- # LOCAL_NDK_STL_VARIANT is gnustl_static
+ else # LOCAL_NDK_STL_VARIANT is not c++_* either
+ ifneq (,$(filter gnustl_%, $(LOCAL_NDK_STL_VARIANT)))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/include \
$(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/include
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/libgnustl_static.a
+ else # LOCAL_NDK_STL_VARIANT must be none
+ # Do nothing.
+ endif
endif
endif
endif
@@ -140,7 +163,7 @@
# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
# all code is position independent, and then those warnings get promoted to
# errors.
-ifndef USE_MINGW
+ifneq ($($(my_prefix)OS),windows)
ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
my_cflags += -fpie
else
@@ -148,7 +171,21 @@
endif
endif
+ifdef LOCAL_IS_HOST_MODULE
+my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS)) $(LOCAL_SRC_FILES_$($(my_prefix)OS)_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_static_libraries += $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)OS))
+my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)OS))
+my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)OS))
+my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)OS))
+my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)OS))
+my_ldlibs += $(LOCAL_LDLIBS_$($(my_prefix)OS))
+my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)OS))
+my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)OS))
+my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)OS))
+endif
+
my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
+my_src_files_exclude += $(LOCAL_SRC_FILES_EXCLUDE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_EXCLUDE_$(my_32_64_bit_suffix))
my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix))
my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix))
my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix))
@@ -157,6 +194,13 @@
my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix))
my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix))
+my_missing_exclude_files := $(filter-out $(my_src_files),$(my_src_files_exclude))
+ifneq ($(my_missing_exclude_files),)
+$(warning Files are listed in LOCAL_SRC_FILES_EXCLUDE but not LOCAL_SRC_FILES)
+$(error $(my_missing_exclude_files))
+endif
+my_src_files := $(filter-out $(my_src_files_exclude),$(my_src_files))
+
my_clang := $(strip $(LOCAL_CLANG))
ifdef LOCAL_CLANG_$(my_32_64_bit_suffix)
my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix)))
@@ -168,26 +212,47 @@
# clang is enabled by default for host builds
# enable it unless we've specifically disabled clang above
ifdef LOCAL_IS_HOST_MODULE
- ifneq ($(HOST_OS),windows)
+ ifneq ($($(my_prefix)OS),windows)
ifeq ($(my_clang),)
my_clang := true
endif
endif
+# Add option to make clang the default for device build
+else ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
+ ifeq ($(my_clang),)
+ my_clang := true
+ endif
endif
-# Add option to make clang the default for device build
-ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
- ifeq ($(my_clang),)
- my_clang := true
+my_cpp_std_version := -std=gnu++14
+
+ifneq ($(my_clang),true)
+ # GCC uses an invalid C++14 ABI (emits calls to
+ # __cxa_throw_bad_array_length, which is not a valid C++ RT ABI).
+ # http://b/25022512
+ my_cpp_std_version := -std=gnu++11
+endif
+
+ifdef LOCAL_SDK_VERSION
+ # The NDK handles this itself.
+ my_cpp_std_version :=
+endif
+
+ifdef LOCAL_IS_HOST_MODULE
+ ifneq ($(my_clang),true)
+ # The host GCC doesn't support C++14 (and is deprecated, so likely
+ # never will). Build these modules with C++11.
+ my_cpp_std_version := -std=gnu++11
endif
endif
+my_cppflags := $(my_cpp_std_version) $(my_cppflags)
+
+
# arch-specific static libraries go first so that generic ones can depend on them
my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
-my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
-
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
# Add static HAL libraries
@@ -199,12 +264,14 @@
b_lib :=
endif
-include $(BUILD_SYSTEM)/config_sanitizers.mk
-
-ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_$(my_prefix)CLANG)),true)
- my_clang :=
+ifneq ($(strip $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)),)
+ my_linker := $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)
+else
+ my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LINKER)
endif
+include $(BUILD_SYSTEM)/config_sanitizers.mk
+
# Add in libcompiler_rt for all regular device builds
ifeq (,$(LOCAL_SDK_VERSION)$(WITHOUT_LIBCOMPILER_RT))
my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
@@ -225,6 +292,10 @@
my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_OPTIMIZE_CFLAGS)
my_fdo_build := true
endif
+ # Disable ccache (or other compiler wrapper) except gomacc, which
+ # can handle -fprofile-use properly.
+ my_cc_wrapper := $(filter $(GOMA_CC),$(my_cc_wrapper))
+ my_cxx_wrapper := $(filter $(GOMA_CC),$(my_cxx_wrapper))
endif
###########################################################
@@ -270,17 +341,17 @@
else # LOCAL_IS_HOST_MODULE
ifeq ($(my_clang),true)
-my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CFLAGS)
-my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CONLYFLAGS)
-my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CPPFLAGS)
-my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_LDFLAGS)
-my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_C_INCLUDES)
+my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
+my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS)
+my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS)
+my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
+my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
else
-my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CFLAGS)
-my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CONLYFLAGS)
-my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CPPFLAGS)
-my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LDFLAGS)
-my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_C_INCLUDES)
+my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
+my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS)
+my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS)
+my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS)
+my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
endif # my_clang
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
@@ -309,6 +380,14 @@
my_native_coverage := false
endif
+ifeq ($(my_clang),true)
+ my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT)
+else
+ my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV)
+endif
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib)
+
###########################################################
## Define PRIVATE_ variables used by multiple module types
###########################################################
@@ -335,6 +414,7 @@
else
my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC)
endif
+ my_cc := $(my_cc_wrapper) $(my_cc)
endif
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)"
@@ -351,6 +431,7 @@
else
my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX)
endif
+ my_cxx := $(my_cxx_wrapper) $(my_cxx)
endif
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)"
@@ -359,6 +440,7 @@
my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)"
endif
endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang)
@@ -367,7 +449,6 @@
ifeq ($(LOCAL_CPP_EXTENSION),)
LOCAL_CPP_EXTENSION := .cpp
endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
# Certain modules like libdl have to have symbols resolved at runtime and blow
# up if --no-undefined is passed to the linker.
@@ -387,7 +468,7 @@
## Define arm-vs-thumb-mode flags.
###########################################################
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
-ifeq ($(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm)
+ifeq ($($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm)
arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
@@ -433,6 +514,20 @@
RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
renderscript_intermediate := $(intermediates)/renderscript
+renderscript_target_api :=
+
+ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
+renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
+else
+ifneq (,$(LOCAL_SDK_VERSION))
+# Set target-api for LOCAL_SDK_VERSIONs other than current.
+ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
+renderscript_target_api := $(LOCAL_SDK_VERSION)
+endif
+endif # LOCAL_SDK_VERSION is set
+endif # LOCAL_RENDERSCRIPT_TARGET_API is set
+
+
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
endif
@@ -461,12 +556,13 @@
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
+$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
$(transform-renderscripts-to-cpp-and-bc)
# include the dependency files (.d/.P) generated by llvm-rs-cc.
--include $(bc_dep_files:%.d=%.P)
+$(call include-depfile,$(RenderScript_file_stamp).P,$(RenderScript_file_stamp))
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
@@ -477,6 +573,7 @@
# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
$(rs_generated_cpps) : $(RenderScript_file_stamp)
@echo "Updated RS generated cpp file $@."
+ $(hide) touch $@
my_c_includes += $(renderscript_intermediate)
my_generated_sources += $(rs_generated_cpps)
@@ -500,137 +597,218 @@
ALL_GENERATED_SOURCES += $(my_generated_sources)
###########################################################
-## Compile the .proto files to .cc and then to .o
+## Compile the .proto files to .cc (or .c) and then to .o
###########################################################
proto_sources := $(filter %.proto,$(my_src_files))
proto_generated_objects :=
proto_generated_headers :=
ifneq ($(proto_sources),)
-proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
-proto_generated_cc_sources_dir := $(generated_sources_dir)/proto
-proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
- $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
-proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
+proto_generated_sources_dir := $(generated_sources_dir)/proto
proto_generated_obj_dir := $(intermediates)/proto
+
+ifneq (,$(filter nanopb-c nanopb-c-enable_malloc, $(LOCAL_PROTOC_OPTIMIZE_TYPE)))
+my_proto_source_suffix := .c
+my_proto_c_includes := external/nanopb-c
+my_protoc_flags := --nanopb_out=$(proto_generated_sources_dir) \
+ --plugin=external/nanopb-c/generator/protoc-gen-nanopb
+else
+my_proto_source_suffix := .cc
+my_proto_c_includes := external/protobuf/src
+my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
+my_protoc_flags := --cpp_out=$(proto_generated_sources_dir)
+endif
+my_proto_c_includes += $(proto_generated_sources_dir)
+
+proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
+proto_generated_sources := $(addprefix $(proto_generated_sources_dir)/, \
+ $(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath)))
+proto_generated_headers := $(patsubst %.pb$(my_proto_source_suffix),%.pb.h, $(proto_generated_sources))
proto_generated_objects := $(addprefix $(proto_generated_obj_dir)/, \
$(patsubst %.proto,%.pb.o,$(proto_sources_fullpath)))
-# Auto-export the generated proto source dir.
-LOCAL_EXPORT_C_INCLUDE_DIRS += $(proto_generated_cc_sources_dir)
-
# Ensure the transform-proto-to-cc rule is only defined once in multilib build.
ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
-$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
-$(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir)
-$(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
-$(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC)
+$(proto_generated_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
+$(proto_generated_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags)
+$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(PROTOC)
$(transform-proto-to-cc)
# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
-$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
+$(proto_generated_headers): $(proto_generated_sources_dir)/%.pb.h: $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix)
@echo "Updated header file $@."
+ $(hide) touch $@
$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true
endif # transform-proto-to-cc rule included only once
$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(proto_generated_objects): $(proto_generated_obj_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
+$(proto_generated_objects): $(proto_generated_obj_dir)/%.o: $(proto_generated_sources_dir)/%$(my_proto_source_suffix) $(proto_generated_headers)
+ifeq ($(my_proto_source_suffix),.c)
+ $(transform-$(PRIVATE_HOST)c-to-o)
+else
$(transform-$(PRIVATE_HOST)cpp-to-o)
+endif
-include $(proto_generated_objects:%.o=%.P)
-my_c_includes += external/protobuf/src $(proto_generated_cc_sources_dir)
-my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
-ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
+my_c_includes += $(my_proto_c_includes)
+# Auto-export the generated proto source dir.
+my_export_c_include_dirs += $(my_proto_c_includes)
+
+ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc)
+ my_static_libraries += libprotobuf-c-nano-enable_malloc
+else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c)
+ my_static_libraries += libprotobuf-c-nano
+else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
ifdef LOCAL_SDK_VERSION
- my_static_libraries += libprotobuf-cpp-full
+ my_static_libraries += libprotobuf-cpp-full-ndk
else
my_shared_libraries += libprotobuf-cpp-full
endif
else
ifdef LOCAL_SDK_VERSION
- my_static_libraries += libprotobuf-cpp-lite
+ my_static_libraries += libprotobuf-cpp-lite-ndk
else
my_shared_libraries += libprotobuf-cpp-lite
endif
endif
endif # $(proto_sources) non-empty
+###########################################################
+## Compile the .dbus-xml files to c++ headers
+###########################################################
+dbus_definitions := $(filter %.dbus-xml,$(my_src_files))
+dbus_generated_headers :=
+ifneq ($(dbus_definitions),)
+
+dbus_definition_paths := $(addprefix $(LOCAL_PATH)/,$(dbus_definitions))
+dbus_service_config := $(filter %dbus-service-config.json,$(my_src_files))
+dbus_service_config_path := $(addprefix $(LOCAL_PATH)/,$(dbus_service_config))
+
+dbus_gen_dir := $(generated_sources_dir)/dbus_bindings
+
+ifdef LOCAL_DBUS_PROXY_PREFIX
+dbus_header_dir := $(dbus_gen_dir)/include/$(LOCAL_DBUS_PROXY_PREFIX)
+dbus_headers := dbus-proxies.h
+else
+dbus_header_dir := $(dbus_gen_dir)
+dbus_headers := $(patsubst %.dbus-xml,%.h,$(dbus_definitions))
+endif
+dbus_generated_headers := $(addprefix $(dbus_header_dir)/,$(dbus_headers))
+
+# Ensure that we only define build rules once in multilib builds.
+ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
+$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined := true
+
+$(dbus_generated_headers): PRIVATE_MODULE := $(LOCAL_MODULE)
+$(dbus_generated_headers): PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_path)
+$(dbus_generated_headers) : $(dbus_service_config_path) $(DBUS_GENERATOR)
+ifdef LOCAL_DBUS_PROXY_PREFIX
+$(dbus_generated_headers) : $(dbus_definition_paths)
+ $(generate-dbus-proxies)
+else
+$(dbus_generated_headers) : $(dbus_header_dir)/%.h : $(LOCAL_PATH)/%.dbus-xml
+ $(generate-dbus-adaptors)
+endif # $(LOCAL_DBUS_PROXY_PREFIX)
+endif # $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
+
+ifdef LOCAL_DBUS_PROXY_PREFIX
+# Auto-export the generated dbus proxy directory.
+my_export_c_include_dirs += $(dbus_gen_dir)/include
+my_c_includes += $(dbus_gen_dir)/include
+else
+my_export_c_include_dirs += $(dbus_header_dir)
+my_c_includes += $(dbus_header_dir)
+endif # $(LOCAL_DBUS_PROXY_PREFIX)
+
+my_generated_sources += $(dbus_generated_headers)
+
+endif # $(dbus_definitions) non-empty
+
###########################################################
-## YACC: Compile .y and .yy files to .cpp and the to .o.
+## AIDL: Compile .aidl files to .cpp and .h files
+###########################################################
+aidl_src := $(strip $(filter %.aidl,$(my_src_files)))
+aidl_gen_cpp :=
+ifneq ($(aidl_src),)
+
+# Use the intermediates directory to avoid writing our own .cpp -> .o rules.
+aidl_gen_cpp_root := $(intermediates)/aidl-generated/src
+aidl_gen_include_root := $(intermediates)/aidl-generated/include
+
+# Multi-architecture builds have distinct intermediates directories.
+# Thus we'll actually generate source for each architecture.
+$(foreach s,$(aidl_src),\
+ $(eval $(call define-aidl-cpp-rule,$(s),$(aidl_gen_cpp_root),aidl_gen_cpp)))
+$(foreach cpp,$(aidl_gen_cpp), \
+ $(call include-depfile,$(addsuffix .aidl.P,$(basename $(cpp))),$(cpp)))
+
+
+$(aidl_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE)
+$(aidl_gen_cpp) : PRIVATE_HEADER_OUTPUT_DIR := $(aidl_gen_include_root)
+$(aidl_gen_cpp) : PRIVATE_AIDL_FLAGS := $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
+
+# Add generated headers to include paths.
+my_c_includes += $(aidl_gen_include_root)
+my_export_c_include_dirs += $(aidl_gen_include_root)
+# Pick up the generated C++ files later for transformation to .o files.
+my_generated_sources += $(aidl_gen_cpp)
+
+endif # $(aidl_src) non-empty
+
+###########################################################
+## YACC: Compile .y/.yy files to .c/.cpp and then to .o.
###########################################################
y_yacc_sources := $(filter %.y,$(my_src_files))
-y_yacc_cpps := $(addprefix \
- $(intermediates)/,$(y_yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
+y_yacc_cs := $(addprefix \
+ $(intermediates)/,$(y_yacc_sources:.y=.c))
+ifneq ($(y_yacc_cs),)
+$(y_yacc_cs): $(intermediates)/%.c: \
+ $(TOPDIR)$(LOCAL_PATH)/%.y \
+ $(my_additional_dependencies)
+ $(call transform-y-to-c-or-cpp)
+
+my_generated_sources += $(y_yacc_cs)
+endif
yy_yacc_sources := $(filter %.yy,$(my_src_files))
yy_yacc_cpps := $(addprefix \
$(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
-
-yacc_cpps := $(y_yacc_cpps) $(yy_yacc_cpps)
-yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
-yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
-
-ifneq ($(strip $(y_yacc_cpps)),)
-$(y_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
- $(TOPDIR)$(LOCAL_PATH)/%.y \
- $(lex_cpps) $(my_additional_dependencies)
- $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
-$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
-endif
-
-ifneq ($(strip $(yy_yacc_cpps)),)
+ifneq ($(yy_yacc_cpps),)
$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.yy \
- $(lex_cpps) $(my_additional_dependencies)
- $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
-$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
-endif
+ $(my_additional_dependencies)
+ $(call transform-y-to-c-or-cpp)
-ifneq ($(strip $(yacc_cpps)),)
-$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
-$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
- $(transform-$(PRIVATE_HOST)cpp-to-o)
+my_generated_sources += $(yy_yacc_cpps)
endif
###########################################################
-## LEX: Compile .l and .ll files to .cpp and then to .o.
+## LEX: Compile .l/.ll files to .c/.cpp and then to .o.
###########################################################
l_lex_sources := $(filter %.l,$(my_src_files))
-l_lex_cpps := $(addprefix \
- $(intermediates)/,$(l_lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
+l_lex_cs := $(addprefix \
+ $(intermediates)/,$(l_lex_sources:.l=.c))
+ifneq ($(l_lex_cs),)
+$(l_lex_cs): $(intermediates)/%.c: \
+ $(TOPDIR)$(LOCAL_PATH)/%.l
+ $(transform-l-to-c-or-cpp)
+
+my_generated_sources += $(l_lex_cs)
+endif
ll_lex_sources := $(filter %.ll,$(my_src_files))
ll_lex_cpps := $(addprefix \
$(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
-
-lex_cpps := $(l_lex_cpps) $(ll_lex_cpps)
-lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
-
-ifneq ($(strip $(l_lex_cpps)),)
-$(l_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
- $(TOPDIR)$(LOCAL_PATH)/%.l
- $(transform-l-to-cpp)
-endif
-
-ifneq ($(strip $(ll_lex_cpps)),)
+ifneq ($(ll_lex_cpps),)
$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.ll
- $(transform-l-to-cpp)
-endif
+ $(transform-l-to-c-or-cpp)
-ifneq ($(strip $(lex_cpps)),)
-$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
-$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(lex_objects): $(intermediates)/%.o: \
- $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
- $(my_additional_dependencies) \
- $(yacc_headers)
- $(transform-$(PRIVATE_HOST)cpp-to-o)
+my_generated_sources += $(ll_lex_cpps)
endif
###########################################################
@@ -725,6 +903,7 @@
endif
gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
+$(gen_asm_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
###########################################################
## o: Include generated .o files in output.
@@ -808,6 +987,20 @@
endif
###########################################################
+## ObjC++: Compile .mm files to .o
+###########################################################
+
+objcpp_sources := $(filter %.mm,$(my_src_files))
+objcpp_objects := $(addprefix $(intermediates)/,$(objcpp_sources:.mm=.o))
+
+ifneq ($(strip $(objcpp_objects)),)
+$(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm $(yacc_cpps) $(proto_generated_headers) \
+ $(my_additional_dependencies)
+ $(transform-$(PRIVATE_HOST)mm-to-o)
+-include $(objcpp_objects:%.o=%.P)
+endif
+
+###########################################################
## AS: Compile .S files to .o.
###########################################################
@@ -847,6 +1040,7 @@
endif
asm_objects := $(dotdot_objects_S) $(dotdot_objects_s) $(asm_objects_S) $(asm_objects_s)
+$(asm_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
# .asm for x86/x86_64 needs to be compiled with yasm.
@@ -891,11 +1085,11 @@
import_includes := $(intermediates)/import_includes
import_includes_deps := $(strip \
$(foreach l, $(installed_shared_library_module_names), \
- $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes) \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes))
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps)
-$(import_includes) : $(LOCAL_MODULE_MAKEFILE) $(import_includes_deps)
+$(import_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(import_includes_deps)
@echo Import includes file: $@
$(hide) mkdir -p $(dir $@) && rm -f $@
ifdef import_includes_deps
@@ -920,8 +1114,7 @@
$(c_objects) \
$(gen_c_objects) \
$(objc_objects) \
- $(yacc_objects) \
- $(lex_objects) \
+ $(objcpp_objects) \
$(proto_generated_objects) \
$(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
@@ -938,7 +1131,11 @@
# that custom build rules which generate .o files don't consume other generated
# sources as input (or if they do they take care of that dependency themselves).
$(normal_objects) : | $(my_generated_sources)
+ifeq ($(BUILDING_WITH_NINJA),true)
+$(all_objects) : $(import_includes)
+else
$(all_objects) : | $(import_includes)
+endif
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
@@ -980,6 +1177,7 @@
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
$(my_shared_libraries)))
+built_shared_library_deps := $(addsuffix .toc, $(built_shared_libraries))
# Add the NDK libraries to the built module dependency
my_system_shared_libraries_fullpath := \
@@ -993,12 +1191,20 @@
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
$(installed_shared_library_module_names)))
+ifdef LOCAL_IS_HOST_MODULE
+# Disable .toc optimization for host modules: we may run the host binaries during the build process
+# and the libraries' implementation matters.
+built_shared_library_deps := $(built_shared_libraries)
+else
+built_shared_library_deps := $(addsuffix .toc, $(built_shared_libraries))
+endif
+my_system_shared_libraries_fullpath :=
endif
built_static_libraries := \
$(foreach lib,$(my_static_libraries), \
$(call intermediates-dir-for, \
- STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
+ STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
ifdef LOCAL_SDK_VERSION
built_static_libraries += $(my_ndk_stl_static_lib)
@@ -1007,7 +1213,7 @@
built_whole_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
$(call intermediates-dir-for, \
- STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
+ STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
# We don't care about installed static libraries, since the
# libraries have already been linked into the module at that point.
@@ -1031,6 +1237,8 @@
my_cflags += $(LOCAL_CLANG_CFLAGS)
my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS)
my_cppflags += $(LOCAL_CLANG_CPPFLAGS)
+my_cflags_no_override += $(GLOBAL_CLANG_CFLAGS_NO_OVERRIDE)
+my_cppflags_no_override += $(GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE)
my_asflags += $(LOCAL_CLANG_ASFLAGS)
my_ldflags += $(LOCAL_CLANG_LDFLAGS)
my_cflags += $(LOCAL_CLANG_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CFLAGS_$(my_32_64_bit_suffix))
@@ -1050,18 +1258,28 @@
my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags))
endif
+# No one should ever use this flag. On GCC it's mere presence will disable all
+# warnings, even those that are specified after it (contrary to typical warning
+# flag behavior). This circumvents CFLAGS_NO_OVERRIDE from forcibly enabling the
+# warnings that are *always* bugs.
+my_illegal_flags := -w
+my_cflags := $(filter-out $(my_illegal_flags),$(my_cflags))
+my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags))
+my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags))
+
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS_NO_OVERRIDE := $(my_cflags_no_override)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS_NO_OVERRIDE := $(my_cppflags_no_override)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
# this is really the way to get the files onto the command line instead
# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
@@ -1075,7 +1293,8 @@
###########################################################
# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
all_libraries := \
- $(built_shared_libraries) \
+ $(built_shared_library_deps) \
+ $(my_system_shared_libraries_fullpath) \
$(built_static_libraries) \
$(built_whole_libraries)
@@ -1088,18 +1307,33 @@
# Export includes
###########################################################
export_includes := $(intermediates)/export_includes
-$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
+$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs)
# Make sure .pb.h are already generated before any dependent source files get compiled.
-$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers)
+# Similarly, the generated DBus headers need to exist before we export their location.
+# People are not going to consume the aidl generated cpp file, but the cpp file is
+# generated after the headers, so this is a convenient way to ensure the headers exist.
+$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(proto_generated_headers) $(dbus_generated_headers) $(aidl_gen_cpp)
@echo Export includes file: $< -- $@
- $(hide) mkdir -p $(dir $@) && rm -f $@
-ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
+ $(hide) mkdir -p $(dir $@) && rm -f $@.tmp
+ifdef my_export_c_include_dirs
$(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
- echo "-I $$d" >> $@; \
+ echo "-I $$d" >> $@.tmp; \
done
else
- $(hide) touch $@
+ $(hide) touch $@.tmp
endif
+ifeq ($(BUILDING_WITH_NINJA),true)
+ $(hide) if cmp -s $@.tmp $@ ; then \
+ rm $@.tmp ; \
+ else \
+ mv $@.tmp $@ ; \
+ fi
+else
+ mv $@.tmp $@ ;
+endif
+
+# Kati adds restat=1 to ninja. GNU make does nothing for this.
+.KATI_RESTAT: $(export_includes)
# Make sure export_includes gets generated when you are running mm/mmm
$(LOCAL_BUILT_MODULE) : | $(export_includes)
diff --git a/core/build-system.html b/core/build-system.html
index caade58..bddde6a 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -270,6 +270,7 @@
<li>Installs non-APK modules that have no tags specified.
<li>Installs APKs according to the product definition files; tags
are ignored for APK modules.
+ <li><code>ro.adb.secure=1</code>
<li><code>ro.secure=1</code>
<li><code>ro.debuggable=0</code>
<li><code>adb</code> is disabled by default.
@@ -462,26 +463,17 @@
<p>Sometimes you need to set flags specifically for different platforms. Here
is a list of which values the different build-system defined variables will be
set to and some examples.</p>
-<p>For a device build, <code>TARGET_OS</code> is <code>linux</code> (we're using
-linux!), and <code>TARGET_ARCH</code> is <code>arm</code>.</p>
-<p>For a simulator build, <code>TARGET_OS</code> and <code>TARGET_ARCH</code>
-are set to the same as <code>HOST_OS</code> and <code>HOST_ARCH</code> are
-on your platform. <code>TARGET_PRODUCT</code> is the name of the target
-hardware/product you are building for. The value <code>sim</code> is used
-for the simulator. We haven't thought through the full extent of customization
-that will happen here, but likely there will be additional UI configurations
-specified here as well.</p>
<table cellspacing=25>
<tr>
<td valign=top align=center>
<b>HOST_OS</b><br/>
linux<br/>
- darwin<br/>
- (cygwin)
+ darwin
</td>
<td valign=top align=center>
<b>HOST_ARCH</b><br/>
- x86
+ x86<br/>
+ x86_64
</td>
<td valign=top align=center>
<b>HOST_BUILD_TYPE</b><br/>
@@ -491,42 +483,40 @@
</tr>
<tr>
<td valign=top align=center>
- <b>TARGET_OS</b><br/>
- linux<br/>
- darwin<br/>
- (cygwin)
- </td>
- <td valign=top align=center>
<b>TARGET_ARCH</b><br/>
arm<br/>
- x86
+ arm64<br/>
+ mips<br/>
+ mips64<br/>
+ x86<br/>
+ x86_64
</td>
<td valign=top align=center>
<b>TARGET_BUILD_TYPE</b><br/>
release<br/>
debug
</td>
- <td valign=top align=center>
- <b>TARGET_PRODUCT</b><br/>
- sim<br/>
- dream<br/>
- sooner
- </td>
</tr>
</table>
+<p>There are also special variables to use instead of conditionals. Many of the
+normal variables (LOCAL_SRC_FILES, LOCAL_CFLAGS, etc) can be conditionally added
+to with _{arch} _{32|64}, and for the host, _{os}.</p>
+
<h4>Some Examples</h4>
<pre>ifeq ($(TARGET_BUILD_TYPE),release)
LOCAL_CFLAGS += -DNDEBUG=1
endif
+LOCAL_CFLAGS_arm += -DTARGET_IS_ARM
+
+LOCAL_CFLAGS_64 += -DBIG_POINTER
+
# from libutils
-ifeq ($(TARGET_OS),linux)
# Use the futex based mutex and condition variable
# implementation from android-arm because it's shared mem safe
-LOCAL_SRC_FILES += futex_synchro.c
-LOCAL_LDLIBS += -lrt -ldl
-endif
+LOCAL_SRC_FILES_linux += futex_synchro.c
+LOCAL_LDLIBS_linux += -lrt -ldl
</pre>
@@ -554,7 +544,7 @@
the unstripped executables so GDB can find the symbols.
<code>LOCAL_UNSTRIPPED_PATH</code> is not necessary if you only specified
<code>LOCAL_MODULE_RELATIVE_PATH</code>.</p>
-<p>Look in <code>config/envsetup.make</code> for all of the variables defining
+<p>Look in <code>core/envsetup.mk</code> for all of the variables defining
places to build things.</p>
<p>FYI: If you're installing an executable to /sbin, you probably also want to
set <code>LOCAL_FORCE_STATIC_EXCUTABLE := true</code> in your Android.mk, which
@@ -587,6 +577,11 @@
and definitions that are specific to either the host or the target builds.
Do not set variables that start with HOST_ or TARGET_ in your makefiles.
</li>
+ <li><b>HOST_CROSS_</b> - These contain the directories and definitions that
+ are specific to cross-building host binaries. The common case is building
+ windows host tools on linux. Do not set variables that start with
+ HOST_CROSS_ in your makefiles.
+ </li>
<li><b>BUILD_</b> and <b>CLEAR_VARS</b> - These contain the names of
well-defined template makefiles to include. Some examples are CLEAR_VARS
and BUILD_HOST_PACKAGE.</li>
@@ -773,13 +768,13 @@
</code></p>
<h4>LOCAL_PREBUILT_EXECUTABLES</h4>
-<p>When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to
-executables that you want copied. They're located automatically into the
+<p>When including $(BUILD_MULTI_PREBUILT) or $(BUILD_HOST_PREBUILT), set these
+to executables that you want copied. They're located automatically into the
right bin directory.</p>
<h4>LOCAL_PREBUILT_LIBS</h4>
-<p>When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to
-libraries that you want copied. They're located automatically into the
+<p>When including $(BUILD_MULTI_PREBUILT) or $(BUILD_HOST_PREBUILT), set these
+to libraries that you want copied. They're located automatically into the
right lib directory.</p>
<h4>LOCAL_SHARED_LIBRARIES</h4>
@@ -836,6 +831,16 @@
the relative path.</p>
<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p>
+<h4>LOCAL_MODULE_HOST_OS</h4>
+<p>This specifies which OSes are supported by this host module. It is not used
+for target builds. The accepted values here are combinations of
+<code>linux</code>, <code>darwin</code>, and <code>windows</code>. By default,
+linux and darwin(MacOS) are considered to be supported. If a module should
+build under windows, you must specify windows, and any others to be supported.
+Some examples:</p>
+<p><code>LOCAL_MODULE_HOST_OS := linux<br/>
+LOCAL_MODULE_HOST_OS := darwin linux windows</code></p>
+
<h4>LOCAL_UNSTRIPPED_PATH</h4>
<p>Instructs the build system to put the unstripped version of the module
somewhere other than what's normal for its type. Usually, you override this
@@ -878,10 +883,10 @@
If you make a change that requires an update, you need to update two places
so this message will be printed.
<ul>
- <li>In config/envsetup.make, increment the
+ <li>In core/envsetup.mk, increment the
CORRECT_BUILD_ENV_SEQUENCE_NUMBER definition.</li>
<li>In buildspec.mk.default, update the BUILD_ENV_SEQUENCE_DUMBER
- definition to match the one in config/envsetup.make</li>
+ definition to match the one in core/envsetup.mk</li>
</ul>
The scripts automatically get the value from the build system, so they will
trigger the warning as well.
@@ -900,53 +905,39 @@
for some other dependency that isn't created automatically.</p>
<h4>LOCAL_BUILT_MODULE</h4>
+<p class=warning>This should not be used, since multiple binaries are now
+created from a single module defintiion.</p>
<p>When a module is built, the module is created in an intermediate
directory then copied to its final location. LOCAL_BUILT_MODULE is
the full path to the intermediate file. See LOCAL_INSTALLED_MODULE
for the path to the final installed location of the module.</p>
-<h4>LOCAL_HOST</h4>
-<p>Set by the host_xxx.make includes to tell base_rules.make and the other
-includes that we're building for the host. Kenneth did this as part of
-openbinder, and I would like to clean it up so the rules, includes and
-definitions aren't duplicated for host and target.</p>
+<h4>LOCAL_IS_HOST_MODULE</h4>
+<p>Set by the host_xxx.mk includes to tell base_rules.mk and the other
+includes that we're building for the host.</p>
<h4>LOCAL_INSTALLED_MODULE</h4>
+<p class=warning>This should not be used, since multiple binaries are now
+created from a single module defintiion.</p>
<p>The fully qualified path name of the final location of the module.
See LOCAL_BUILT_MODULE for the location of the intermediate file that
the make rules should actually be constructing.</p>
-<h4>LOCAL_REPLACE_VARS</h4>
-<p>Used in some stuff remaining from the openbinder for building scripts
-with particular values set,</p>
-
-<h4>LOCAL_SCRIPTS</h4>
-<p>Used in some stuff remaining from the openbinder build system that we
-might find handy some day.</p>
-
<h4>LOCAL_MODULE_CLASS</h4>
<p>Which kind of module this is. This variable is used to construct other
-variable names used to locate the modules. See base_rules.make and
-envsetup.make.</p>
-
-<h4>LOCAL_MODULE_NAME</h4>
-<p>Set to the leaf name of the LOCAL_BUILT_MODULE. I'm not sure,
-but it looks like it's just used in the WHO_AM_I variable to identify
-in the pretty printing what's being built.</p>
+variable names used to locate the modules. See base_rules.mk and
+envsetup.mk.</p>
<h4>LOCAL_MODULE_SUFFIX</h4>
<p>The suffix that will be appended to <code>LOCAL_MODULE</code> to form
<code>LOCAL_MODULE_NAME</code>. For example, .so, .a, .dylib.</p>
<h4>LOCAL_STRIP_MODULE</h4>
-<p>Calculated in base_rules.make to determine if this module should actually
-be stripped or not, based on whether <code>LOCAL_STRIPPABLE_MODULE</code>
-is set, and whether the combo is configured to ever strip modules. With
-Iliyan's stripping tool, this might change.</p>
-
-<h4>LOCAL_STRIPPABLE_MODULE</h4>
-<p>Set by the include makefiles if that type of module is strippable.
-Executables and shared libraries are.</p>
+<p>If set to true (the default), the binary will be stripped and a debug
+link will be set up so that GDB will still work. If set to no_debuglink,
+the binary will be stripped, but no debug link will be added. If set to
+keep_symbols, it will strip the debug information, but keep the symbol table.
+Any other value will prevent stripping.</p>
<h4>LOCAL_SYSTEM_SHARED_LIBRARIES</h4>
<p>Used while building the base libraries: libc, libm, libdl. Usually
diff --git a/core/build_id.mk b/core/build_id.mk
index f94b224..0e8e2cf 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -18,6 +18,4 @@
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.
-BUILD_ID := AOSP
-
-DISPLAY_BUILD_NUMBER := true
+export BUILD_ID=MASTER
diff --git a/core/ccache.mk b/core/ccache.mk
new file mode 100644
index 0000000..5c2ae23
--- /dev/null
+++ b/core/ccache.mk
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2015 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.
+#
+
+ifneq ($(filter-out false,$(USE_CCACHE)),)
+ # The default check uses size and modification time, causing false misses
+ # since the mtime depends when the repo was checked out
+ export CCACHE_COMPILERCHECK := content
+
+ # See man page, optimizations to get more cache hits
+ # implies that __DATE__ and __TIME__ are not critical for functionality.
+ # Ignore include file modification time since it will depend on when
+ # the repo was checked out
+ export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
+
+ # Turn all preprocessor absolute paths into relative paths.
+ # Fixes absolute paths in preprocessed source due to use of -g.
+ # We don't really use system headers much so the rootdir is
+ # fine; ensures these paths are relative for all Android trees
+ # on a workstation.
+ export CCACHE_BASEDIR := /
+
+ # Workaround for ccache with clang.
+ # See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
+ export CCACHE_CPP2 := true
+
+ CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
+ ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
+ # Check that the executable is here.
+ ccache := $(strip $(wildcard $(ccache)))
+ ifdef ccache
+ ifndef CC_WRAPPER
+ CC_WRAPPER := $(ccache)
+ endif
+ ifndef CXX_WRAPPER
+ CXX_WRAPPER := $(ccache)
+ endif
+ ccache =
+ endif
+endif
diff --git a/core/clang/HOST_CROSS_windows.mk b/core/clang/HOST_CROSS_windows.mk
new file mode 100644
index 0000000..74adb58
--- /dev/null
+++ b/core/clang/HOST_CROSS_windows.mk
@@ -0,0 +1,56 @@
+
+include $(BUILD_SYSTEM)/clang/x86.mk
+
+CLANG_CONFIG_x86_HOST_CROSS_TRIPLE := i686-pc-mingw32
+
+CLANG_CONFIG_x86_HOST_CROSS_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_HOST_CROSS_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_CROSS_TRIPLE)
+
+CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_HOST_CROSS_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CONLYFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CONLYFLAGS) \
+ $(CLANG_CONFIG_HOST_CROSS_EXTRA_CONLYFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_CONLYFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_CONLYFLAGS)
+
+CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_HOST_CROSS_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_CPPFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_CROSS_TRIPLE)
+
+CLANG_CONFIG_x86_HOST_CROSS_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_HOST_CROSS_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_CROSS_TRIPLE)
+
+CLANG_HOST_CROSS_GLOBAL_CFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CFLAGS)
+
+CLANG_HOST_CROSS_GLOBAL_CONLYFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_CONLYFLAGS)) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CONLYFLAGS)
+
+CLANG_HOST_CROSS_GLOBAL_CPPFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CPPFLAGS)
+
+CLANG_HOST_CROSS_GLOBAL_LDFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_LDFLAGS)
+
+HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686.a
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
index f14a9c3..0ec64ad 100644
--- a/core/clang/HOST_x86.mk
+++ b/core/clang/HOST_x86.mk
@@ -16,9 +16,6 @@
CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS)
CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS)
endif
-ifeq ($(HOST_OS),windows)
-CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
-endif
CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS := \
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
diff --git a/core/clang/HOST_x86_64.mk b/core/clang/HOST_x86_64.mk
index 1211e73..d46cb67 100644
--- a/core/clang/HOST_x86_64.mk
+++ b/core/clang/HOST_x86_64.mk
@@ -16,9 +16,6 @@
CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS)
CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS)
endif
-ifeq ($(HOST_OS),windows)
-CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64
-endif
CLANG_CONFIG_x86_64_HOST_EXTRA_ASFLAGS := \
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk
index 74b5a69..8b94209 100644
--- a/core/clang/HOST_x86_common.mk
+++ b/core/clang/HOST_x86_common.mk
@@ -6,6 +6,8 @@
CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS := \
-integrated-as
+
+CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS += -fstack-protector-strong
endif
ifeq ($(HOST_OS),linux)
@@ -16,6 +18,8 @@
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS += -fstack-protector-strong
+
ifneq ($(strip $($(clang_2nd_arch_prefix)HOST_IS_64_BIT)),)
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
@@ -48,7 +52,3 @@
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/
endif
endif # Linux
-
-ifeq ($(HOST_OS),windows)
-# nothing required here yet
-endif
diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk
index 62ce242..eeffa51 100644
--- a/core/clang/TARGET_arm.mk
+++ b/core/clang/TARGET_arm.mk
@@ -69,4 +69,4 @@
# Address sanitizer clang config
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-arm-android
-$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RPATH := /system/lib/asan
+$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk
index ea4d937..15b0172 100644
--- a/core/clang/TARGET_arm64.mk
+++ b/core/clang/TARGET_arm64.mk
@@ -66,5 +66,5 @@
TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-aarch64-android.a
# Address sanitizer clang config
-ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-arm64-android
-ADDRESS_SANITIZER_RPATH := /system/lib64/asan
+ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-aarch64-android
+ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
diff --git a/core/clang/TARGET_x86.mk b/core/clang/TARGET_x86.mk
index 4e9e8be..9ca86a1 100644
--- a/core/clang/TARGET_x86.mk
+++ b/core/clang/TARGET_x86.mk
@@ -19,11 +19,8 @@
$(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_TARGET_EXTRA_ASFLAGS) \
- -fno-optimize-sibling-calls \
-mstackrealign
-# http://llvm.org/bugs/show_bug.cgi?id=15086,
-# llvm tail call optimization is wrong for x86.
# -mstackrealign is needed to realign stack in native code
# that could be called from JNI, so that movaps instruction
# will work on assumed stack aligned local variables.
@@ -74,3 +71,7 @@
$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := i686-linux-android
$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686-android.a
+
+# Address sanitizer clang config
+$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan-i686-android
+$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
diff --git a/core/clang/arm.mk b/core/clang/arm.mk
index bf31f51..4053bb2 100644
--- a/core/clang/arm.mk
+++ b/core/clang/arm.mk
@@ -7,12 +7,7 @@
ifneq (,$(filter krait,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
# Android's clang support's krait as a CPU whereas GCC doesn't. Specify
# -mcpu here rather than the more normal core/combo/arch/arm/armv7-a-neon.mk.
- CLANG_CONFIG_arm_EXTRA_CFLAGS += -mcpu=krait
-endif
-
-ifeq ($(HOST_OS),darwin)
- # Darwin is really bad at dealing with idiv/sdiv. Don't use krait on Darwin.
- CLANG_CONFIG_arm_EXTRA_CFLAGS += -mcpu=cortex-a9
+ CLANG_CONFIG_arm_EXTRA_CFLAGS += -mcpu=krait -mfpu=neon-vfpv4
endif
CLANG_CONFIG_arm_EXTRA_CPPFLAGS :=
@@ -34,8 +29,7 @@
-fno-partial-inlining \
-fno-strict-volatile-bitfields \
-fno-tree-copy-prop \
- -fno-tree-loop-optimize \
- -Wa,--noexecstack
+ -fno-tree-loop-optimize
define subst-clang-incompatible-arm-flags
$(subst -march=armv5te,-march=armv5t,\
diff --git a/core/clang/arm64.mk b/core/clang/arm64.mk
index ab395b3..cad7321 100644
--- a/core/clang/arm64.mk
+++ b/core/clang/arm64.mk
@@ -13,8 +13,7 @@
-frerun-cse-after-loop \
-frename-registers \
-fno-strict-volatile-bitfields \
- -fno-align-jumps \
- -Wa,--noexecstack
+ -fno-align-jumps
# We don't have any arm64 flags to substitute yet.
define subst-clang-incompatible-arm64-flags
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 512b116..6df3e17 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -1,13 +1,8 @@
## Clang configurations.
-# WITHOUT_CLANG covers both HOST and TARGET
-ifeq ($(WITHOUT_CLANG),true)
-WITHOUT_TARGET_CLANG := true
-WITHOUT_HOST_CLANG := true
-endif
-
-LLVM_PREBUILTS_VERSION := 3.6
-LLVM_PREBUILTS_PATH := prebuilts/clang/$(BUILD_OS)-x86/host/$(LLVM_PREBUILTS_VERSION)/bin
+LLVM_PREBUILTS_VERSION ?= 3.8
+LLVM_PREBUILTS_BASE ?= prebuilts/clang/host
+LLVM_PREBUILTS_PATH := $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin
LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_PATH)/../lib/clang/$(LLVM_PREBUILTS_VERSION)/lib/linux/
CLANG := $(LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
@@ -18,17 +13,15 @@
CLANG_TBLGEN := $(BUILD_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
LLVM_TBLGEN := $(BUILD_OUT_EXECUTABLES)/llvm-tblgen$(BUILD_EXECUTABLE_SUFFIX)
-# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars.
-ifdef CC_WRAPPER
- ifneq ($(CC_WRAPPER),$(firstword $(CLANG)))
- CLANG := $(CC_WRAPPER) $(CLANG)
- endif
-endif
-ifdef CXX_WRAPPER
- ifneq ($(CXX_WRAPPER),$(firstword $(CLANG_CXX)))
- CLANG_CXX := $(CXX_WRAPPER) $(CLANG_CXX)
- endif
-endif
+# RenderScript-specific tools
+# These are tied to the version of LLVM directly in external/, so they might
+# trail the host prebuilts being used for the rest of the build process.
+RS_LLVM_PREBUILTS_VERSION := 3.8
+RS_LLVM_PREBUILTS_BASE := prebuilts/clang/host
+RS_LLVM_PREBUILTS_PATH := $(RS_LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(RS_LLVM_PREBUILTS_VERSION)/bin
+RS_CLANG := $(RS_LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
+RS_LLVM_AS := $(RS_LLVM_PREBUILTS_PATH)/llvm-as$(BUILD_EXECUTABLE_SUFFIX)
+RS_LLVM_LINK := $(RS_LLVM_PREBUILTS_PATH)/llvm-link$(BUILD_EXECUTABLE_SUFFIX)
# Clang flags for all host or target rules
CLANG_CONFIG_EXTRA_ASFLAGS :=
@@ -45,7 +38,8 @@
-Werror=int-conversion
# Disable overly aggressive warning for macros defined with a leading underscore
-# This happens in AndroidConfig.h, which is included nearly everywhere.
+# This used to happen in AndroidConfig.h, which was included everywhere.
+# TODO: can we remove this now?
CLANG_CONFIG_EXTRA_CFLAGS += \
-Wno-reserved-id-macro
@@ -64,6 +58,11 @@
CLANG_CONFIG_EXTRA_CPPFLAGS += \
-Wno-inconsistent-missing-override
+# Force clang to always output color diagnostics. Ninja will strip the ANSI
+# color codes if it is not running in a terminal.
+CLANG_CONFIG_EXTRA_CFLAGS += \
+ -fcolor-diagnostics
+
CLANG_CONFIG_UNKNOWN_CFLAGS := \
-finline-functions \
-finline-limit=64 \
@@ -73,6 +72,8 @@
-fno-tree-sra \
-fprefetch-loop-arrays \
-funswitch-loops \
+ -Werror=unused-but-set-parameter \
+ -Werror=unused-but-set-variable \
-Wmaybe-uninitialized \
-Wno-error=clobbered \
-Wno-error=maybe-uninitialized \
@@ -87,7 +88,9 @@
-Wno-unused-but-set-variable \
-Wno-unused-local-typedefs \
-Wunused-but-set-parameter \
- -Wunused-but-set-variable
+ -Wunused-but-set-variable \
+ -fdiagnostics-color \
+ -fdebug-prefix-map=/proc/self/cwd=
# Clang flags for all host rules
CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=
@@ -95,6 +98,12 @@
CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
+# Clang flags for all host cross rules
+CLANG_CONFIG_HOST_CROSS_EXTRA_ASFLAGS :=
+CLANG_CONFIG_HOST_CROSS_EXTRA_CFLAGS :=
+CLANG_CONFIG_HOST_CROSS_EXTRA_CPPFLAGS :=
+CLANG_CONFIG_HOST_CROSS_EXTRA_LDFLAGS :=
+
# Clang flags for all target rules
CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
@@ -137,6 +146,10 @@
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_2ND_ARCH).mk
endif
+ifdef HOST_CROSS_OS
+include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_OS).mk
+endif
+
# TARGET config
clang_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk
@@ -150,7 +163,7 @@
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fno-omit-frame-pointer
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
-ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl
+ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES :=
ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
# This allows us to use the superset of functionality that compiler-rt
diff --git a/core/clang/mips.mk b/core/clang/mips.mk
index 08daf40..4a8f812 100644
--- a/core/clang/mips.mk
+++ b/core/clang/mips.mk
@@ -12,8 +12,14 @@
-frerun-cse-after-loop \
-frename-registers \
-msynci \
+ -mno-synci \
-mno-fused-madd
+# Temporary workaround for Mips clang++ problem, creates
+# relocated ptrs in read-only pic .gcc_exception_table;
+# permanent fix pending at http://reviews.llvm.org/D9669
+CLANG_CONFIG_mips_UNKNOWN_CFLAGS += -Wl,--warn-shared-textrel
+
# We don't have any mips flags to substitute yet.
define subst-clang-incompatible-mips-flags
$(1)
diff --git a/core/clang/mips64.mk b/core/clang/mips64.mk
index 612175c..1b72e05 100644
--- a/core/clang/mips64.mk
+++ b/core/clang/mips64.mk
@@ -12,8 +12,14 @@
-frerun-cse-after-loop \
-frename-registers \
-msynci \
+ -mno-synci \
-mno-fused-madd
+# Temporary workaround for Mips clang++ problem creating
+# relocated ptrs in read-only pic .gcc_exception_table;
+# permanent fix pending at http://reviews.llvm.org/D9669
+CLANG_CONFIG_mips64_UNKNOWN_CFLAGS += -Wl,--warn-shared-textrel
+
# We don't have any mips64 flags to substitute yet.
define subst-clang-incompatible-mips64-flags
$(1)
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index cf980d8..06ceecb 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -54,6 +54,7 @@
# can have permission to touch it.
include $(BUILD_SYSTEM)/cleanspec.mk
INTERNAL_CLEAN_BUILD_VERSION := $(strip $(INTERNAL_CLEAN_BUILD_VERSION))
+INTERNAL_CLEAN_STEPS := $(strip $(INTERNAL_CLEAN_STEPS))
# If the clean_steps.mk file is missing (usually after a clean build)
# then we won't do anything.
@@ -105,11 +106,18 @@
_crs_new_cmd :=
steps :=
endif
-CURRENT_CLEAN_BUILD_VERSION :=
-CURRENT_CLEAN_STEPS :=
# Write the new state to the file.
#
+rewrite_clean_steps_file :=
+ifneq ($(CURRENT_CLEAN_BUILD_VERSION)-$(CURRENT_CLEAN_STEPS),$(INTERNAL_CLEAN_BUILD_VERSION)-$(INTERNAL_CLEAN_STEPS))
+rewrite_clean_steps_file := true
+endif
+ifeq ($(wildcard $(clean_steps_file)),)
+# This is the first build.
+rewrite_clean_steps_file := true
+endif
+ifeq ($(rewrite_clean_steps_file),true)
$(shell \
mkdir -p $(dir $(clean_steps_file)) && \
echo "CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)" > \
@@ -117,8 +125,12 @@
echo "CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)" >> \
$(clean_steps_file) \
)
+endif
+CURRENT_CLEAN_BUILD_VERSION :=
+CURRENT_CLEAN_STEPS :=
clean_steps_file :=
+rewrite_clean_steps_file :=
INTERNAL_CLEAN_STEPS :=
INTERNAL_CLEAN_BUILD_VERSION :=
@@ -137,15 +149,23 @@
current_build_config := \
$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)-{$(aapt_config_list)}
+current_sanitize_target := $(strip $(SANITIZE_TARGET))
+ifeq (,$(current_sanitize_target))
+ current_sanitize_target := false
+endif
aapt_config_list :=
force_installclean := false
+force_objclean := false
# Read the current state from the file, if present.
# Will set PREVIOUS_BUILD_CONFIG.
#
PREVIOUS_BUILD_CONFIG :=
+PREVIOUS_SANITIZE_TARGET :=
-include $(previous_build_config_file)
PREVIOUS_BUILD_CONFIG := $(strip $(PREVIOUS_BUILD_CONFIG))
+PREVIOUS_SANITIZE_TARGET := $(strip $(PREVIOUS_SANITIZE_TARGET))
+
ifdef PREVIOUS_BUILD_CONFIG
ifneq "$(current_build_config)" "$(PREVIOUS_BUILD_CONFIG)"
$(info *** Build configuration changed: "$(PREVIOUS_BUILD_CONFIG)" -> "$(current_build_config)")
@@ -156,15 +176,27 @@
endif
endif
endif # else, this is the first build, so no need to clean.
-PREVIOUS_BUILD_CONFIG :=
+
+ifdef PREVIOUS_SANITIZE_TARGET
+ ifneq "$(current_sanitize_target)" "$(PREVIOUS_SANITIZE_TARGET)"
+ $(info *** SANITIZE_TARGET changed: "$(PREVIOUS_SANITIZE_TARGET)" -> "$(current_sanitize_target)")
+ force_objclean := true
+ endif
+endif # else, this is the first build, so no need to clean.
# Write the new state to the file.
#
+ifneq ($(PREVIOUS_BUILD_CONFIG)-$(PREVIOUS_SANITIZE_TARGET),$(current_build_config)-$(current_sanitize_target))
$(shell \
mkdir -p $(dir $(previous_build_config_file)) && \
echo "PREVIOUS_BUILD_CONFIG := $(current_build_config)" > \
+ $(previous_build_config_file) && \
+ echo "PREVIOUS_SANITIZE_TARGET := $(current_sanitize_target)" >> \
$(previous_build_config_file) \
)
+endif
+PREVIOUS_BUILD_CONFIG :=
+PREVIOUS_SANITIZE_TARGET :=
previous_build_config_file :=
current_build_config :=
@@ -221,6 +253,12 @@
$(PRODUCT_OUT)/data-qemu/* \
$(PRODUCT_OUT)/userdata-qemu.img
+# The files/dirs to delete during an objclean, which removes any files
+# in the staging and emulator data partitions.
+objclean_files := \
+ $(TARGET_OUT_INTERMEDIATES) \
+ $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)
+
# make sure *_OUT is set so that we won't result in deleting random parts
# of the filesystem.
ifneq (2,$(words $(HOST_OUT) $(PRODUCT_OUT)))
@@ -240,6 +278,12 @@
$(hide) rm -rf $(FILES)
@echo "Deleted images and staging directories."
+.PHONY: objclean
+objclean: FILES := $(objclean_files)
+objclean:
+ $(hide) rm -rf $(FILES)
+ @echo "Deleted images and staging directories."
+
ifeq "$(force_installclean)" "true"
$(info *** Forcing "make installclean"...)
$(info *** rm -rf $(dataclean_files) $(installclean_files))
@@ -247,3 +291,31 @@
$(info *** Done with the cleaning, now starting the real build.)
endif
force_installclean :=
+
+ifeq "$(force_objclean)" "true"
+ $(info *** Forcing cleanup of intermediate files...)
+ $(info *** rm -rf $(objclean_files))
+ $(shell rm -rf $(objclean_files))
+ $(info *** Done with the cleaning, now starting the real build.)
+endif
+force_objclean :=
+
+###########################################################
+
+.PHONY: clean-jack-files
+clean-jack-files: clean-dex-files
+ $(hide) find $(OUT_DIR) -name "*.jack" | xargs rm -f
+ $(hide) find $(OUT_DIR) -type d -name "jack" | xargs rm -rf
+ @echo "All jack files have been removed."
+
+.PHONY: clean-dex-files
+clean-dex-files:
+ $(hide) find $(OUT_DIR) -name "*.dex" ! -path "*/jack-incremental/*" | xargs rm -f
+ $(hide) for i in `find $(OUT_DIR) -name "*.jar" -o -name "*.apk"` ; do ((unzip -l $$i 2> /dev/null | \
+ grep -q "\.dex$$" && rm -f $$i) || continue ) ; done
+ @echo "All dex files and archives containing dex files have been removed."
+
+.PHONY: clean-jack-incremental
+clean-jack-incremental:
+ $(hide) find $(OUT_DIR) -name "jack-incremental" -type d | xargs rm -rf
+ @echo "All jack incremental dirs have been removed."
diff --git a/core/cleanspec.mk b/core/cleanspec.mk
index 500ce54..4441e2a 100644
--- a/core/cleanspec.mk
+++ b/core/cleanspec.mk
@@ -64,6 +64,6 @@
# ************************************************
subdir_cleanspecs := \
- $(shell build/tools/findleaves.py --prune=$(OUT_DIR) --prune=.repo --prune=.git . CleanSpec.mk)
+ $(shell build/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) . CleanSpec.mk)
include $(subdir_cleanspecs)
subdir_cleanspecs :=
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 1357b39..49e56c4 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -20,7 +20,6 @@
LOCAL_MODULE_CLASS:=
LOCAL_MODULE_SUFFIX:=
LOCAL_PACKAGE_NAME:=
-LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES:=
LOCAL_OVERRIDES_PACKAGES:=
LOCAL_EXPORT_PACKAGE_RESOURCES:=
LOCAL_MANIFEST_PACKAGE_NAME:=
@@ -29,6 +28,7 @@
LOCAL_ACP_UNAVAILABLE:=
LOCAL_MODULE_TAGS:=
LOCAL_SRC_FILES:=
+LOCAL_SRC_FILES_EXCLUDE:=
LOCAL_PREBUILT_OBJ_FILES:=
LOCAL_STATIC_JAVA_LIBRARIES:=
LOCAL_STATIC_JAVA_AAR_LIBRARIES:=
@@ -74,6 +74,7 @@
LOCAL_JAVA_LAYERS_FILE:=
LOCAL_NO_STANDARD_LIBRARIES:=
LOCAL_CLASSPATH:=
+LOCAL_JACK_CLASSPATH:=
LOCAL_DROIDDOC_USE_STANDARD_DOCLET:=
LOCAL_DROIDDOC_SOURCE_PATH:=
LOCAL_DROIDDOC_TEMPLATE_DIR:=
@@ -107,6 +108,9 @@
LOCAL_ADDITIONAL_JAVA_DIR:=
LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
LOCAL_DX_FLAGS:=
+LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED) # '' (ie disabled), disabled, full, incremental
+LOCAL_JACK_FLAGS:=
+LOCAL_JILL_FLAGS:=
LOCAL_CERTIFICATE:=
LOCAL_SDK_VERSION:=
LOCAL_SDK_RES_VERSION:=
@@ -114,6 +118,7 @@
LOCAL_EMMA_INSTRUMENT:=
LOCAL_PROGUARD_ENABLED:= # '',full,custom,nosystem,disabled,obfuscation,optimization
LOCAL_PROGUARD_FLAGS:=
+LOCAL_JACK_PROGUARD_FLAGS:=
LOCAL_PROGUARD_FLAG_FILES:=
LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_EMMA_COVERAGE_FILTER:=
@@ -126,27 +131,26 @@
LOCAL_RENDERSCRIPT_CC:=
LOCAL_RENDERSCRIPT_COMPATIBILITY:=
LOCAL_RENDERSCRIPT_FLAGS:=
-LOCAL_RENDERSCRIPT_SKIP_INSTALL:=
LOCAL_RENDERSCRIPT_TARGET_API:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
LOCAL_DEX_PREOPT_FLAGS:=
-LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full
+LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full,nanopb-c,nanopb-c-enable_malloc
LOCAL_PROTOC_FLAGS:=
LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
LOCAL_NO_CRT:=
+LOCAL_NO_LIBGCC:=
LOCAL_PROPRIETARY_MODULE:=
LOCAL_OEM_MODULE:=
+LOCAL_ODM_MODULE:=
LOCAL_PRIVILEGED_MODULE:=
LOCAL_MODULE_OWNER:=
LOCAL_CTS_TEST_PACKAGE:=
LOCAL_CTS_TEST_RUNNER:=
LOCAL_CLANG:=
-LOCAL_ADDRESS_SANITIZER:=
LOCAL_JAR_EXCLUDE_FILES:=
LOCAL_JAR_PACKAGES:=
LOCAL_JAR_EXCLUDE_PACKAGES:=
-LOCAL_LINT_FLAGS:=
LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true
# Don't delete the META_INF dir when merging static Java libraries.
LOCAL_DONT_DELETE_JAR_META_INF:=
@@ -155,7 +159,6 @@
LOCAL_PREBUILT_MODULE_FILE:=
LOCAL_POST_LINK_CMD:=
LOCAL_POST_INSTALL_CMD:=
-LOCAL_DIST_BUNDLED_BINARIES:=
LOCAL_HAL_STATIC_LIBRARIES:=
LOCAL_RMTYPEDEFS:=
LOCAL_NO_SYNTAX_CHECK:=
@@ -167,6 +170,13 @@
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH:=
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN:=
LOCAL_MODULE_HOST_ARCH:=
+LOCAL_MODULE_HOST_ARCH_WARN:=
+LOCAL_MODULE_UNSUPPORTED_HOST_ARCH:=
+LOCAL_MODULE_UNSUPPORTED_HOST_ARCH_WARN:=
+LOCAL_MODULE_HOST_CROSS_ARCH:=
+LOCAL_MODULE_HOST_CROSS_ARCH_WARN:=
+LOCAL_MODULE_UNSUPPORTED_HOST_CROSS_ARCH:=
+LOCAL_MODULE_UNSUPPORTED_HOST_CROSS_ARCH_WARN:=
LOCAL_NO_FPIE :=
LOCAL_CXX_STL := default
LOCAL_NATIVE_COVERAGE :=
@@ -174,9 +184,14 @@
LOCAL_DPI_FILE_STEM:=
LOCAL_SANITIZE:=
LOCAL_SANITIZE_RECOVER:=
+LOCAL_DBUS_PROXY_PREFIX:=
+LOCAL_INIT_RC:=
+LOCAL_MODULE_HOST_OS:=
+LOCAL_NOTICE_FILE:=
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=
+LOCAL_SRC_FILES_EXCLUDE_$(TARGET_ARCH):=
LOCAL_CFLAGS_$(TARGET_ARCH):=
LOCAL_CLANG_CFLAGS_$(TARGET_ARCH):=
LOCAL_CPPFLAGS_$(TARGET_ARCH):=
@@ -184,7 +199,6 @@
LOCAL_C_INCLUDES_$(TARGET_ARCH):=
LOCAL_ASFLAGS_$(TARGET_ARCH):=
LOCAL_CLANG_ASFLAGS_$(TARGET_ARCH):=
-LOCAL_NO_CRT_$(TARGET_ARCH):=
LOCAL_LDFLAGS_$(TARGET_ARCH):=
LOCAL_CLANG_LDFLAGS_$(TARGET_ARCH):=
LOCAL_SHARED_LIBRARIES_$(TARGET_ARCH):=
@@ -196,6 +210,7 @@
LOCAL_PREBUILT_JNI_LIBS_$(TARGET_ARCH):=
ifdef TARGET_2ND_ARCH
LOCAL_SRC_FILES_$(TARGET_2ND_ARCH):=
+LOCAL_SRC_FILES_EXCLUDE_$(TARGET_2ND_ARCH):=
LOCAL_CFLAGS_$(TARGET_2ND_ARCH):=
LOCAL_CLANG_CFLAGS_$(TARGET_2ND_ARCH):=
LOCAL_CPPFLAGS_$(TARGET_2ND_ARCH):=
@@ -203,7 +218,6 @@
LOCAL_C_INCLUDES_$(TARGET_2ND_ARCH):=
LOCAL_ASFLAGS_$(TARGET_2ND_ARCH):=
LOCAL_CLANG_ASFLAGS_$(TARGET_2ND_ARCH):=
-LOCAL_NO_CRT_$(TARGET_2ND_ARCH):=
LOCAL_LDFLAGS_$(TARGET_2ND_ARCH):=
LOCAL_CLANG_LDFLAGS_$(TARGET_2ND_ARCH):=
LOCAL_SHARED_LIBRARIES_$(TARGET_2ND_ARCH):=
@@ -215,6 +229,7 @@
LOCAL_PREBUILT_JNI_LIBS_$(TARGET_2ND_ARCH):=
endif
LOCAL_SRC_FILES_$(HOST_ARCH):=
+LOCAL_SRC_FILES_EXCLUDE_$(HOST_ARCH):=
LOCAL_CFLAGS_$(HOST_ARCH):=
LOCAL_CLANG_CFLAGS_$(HOST_ARCH):=
LOCAL_CPPFLAGS_$(HOST_ARCH):=
@@ -222,7 +237,6 @@
LOCAL_C_INCLUDES_$(HOST_ARCH):=
LOCAL_ASFLAGS_$(HOST_ARCH):=
LOCAL_CLANG_ASFLAGS_$(HOST_ARCH):=
-LOCAL_NO_CRT_$(HOST_ARCH):=
LOCAL_LDFLAGS_$(HOST_ARCH):=
LOCAL_CLANG_LDFLAGS_$(HOST_ARCH):=
LOCAL_SHARED_LIBRARIES_$(HOST_ARCH):=
@@ -233,6 +247,7 @@
LOCAL_CLANG_$(HOST_ARCH):=
ifdef HOST_2ND_ARCH
LOCAL_SRC_FILES_$(HOST_2ND_ARCH):=
+LOCAL_SRC_FILES_EXCLUDE_$(HOST_2ND_ARCH):=
LOCAL_CFLAGS_$(HOST_2ND_ARCH):=
LOCAL_CLANG_CFLAGS_$(HOST_2ND_ARCH):=
LOCAL_CPPFLAGS_$(HOST_2ND_ARCH):=
@@ -240,7 +255,6 @@
LOCAL_C_INCLUDES_$(HOST_2ND_ARCH):=
LOCAL_ASFLAGS_$(HOST_2ND_ARCH):=
LOCAL_CLANG_ASFLAGS_$(HOST_2ND_ARCH):=
-LOCAL_NO_CRT_$(HOST_2ND_ARCH):=
LOCAL_LDFLAGS_$(HOST_2ND_ARCH):=
LOCAL_CLANG_LDFLAGS_$(HOST_2ND_ARCH):=
LOCAL_SHARED_LIBRARIES_$(HOST_2ND_ARCH):=
@@ -251,8 +265,44 @@
LOCAL_CLANG_$(HOST_2ND_ARCH):=
endif
+LOCAL_SRC_FILES_$(HOST_OS):=
+LOCAL_STATIC_LIBRARIES_$(HOST_OS):=
+LOCAL_SHARED_LIBRARIES_$(HOST_OS):=
+LOCAL_CFLAGS_$(HOST_OS):=
+LOCAL_CPPFLAGS_$(HOST_OS):=
+LOCAL_LDFLAGS_$(HOST_OS):=
+LOCAL_LDLIBS_$(HOST_OS):=
+LOCAL_ASFLAGS_$(HOST_OS):=
+LOCAL_C_INCLUDES_$(HOST_OS):=
+LOCAL_GENERATED_SOURCES_$(HOST_OS):=
+LOCAL_REQUIRED_MODULES_$(HOST_OS):=
+
+ifdef HOST_CROSS_OS
+LOCAL_SRC_FILES_$(HOST_CROSS_OS):=
+LOCAL_STATIC_LIBRARIES_$(HOST_CROSS_OS):=
+LOCAL_SHARED_LIBRARIES_$(HOST_CROSS_OS):=
+LOCAL_CFLAGS_$(HOST_CROSS_OS):=
+LOCAL_CPPFLAGS_$(HOST_CROSS_OS):=
+LOCAL_LDFLAGS_$(HOST_CROSS_OS):=
+LOCAL_LDLIBS_$(HOST_CROSS_OS):=
+LOCAL_ASFLAGS_$(HOST_CROSS_OS):=
+LOCAL_C_INCLUDES_$(HOST_CROSS_OS):=
+LOCAL_GENERATED_SOURCES_$(HOST_CROSS_OS):=
+LOCAL_REQUIRED_MODULES_$(HOST_CROSS_OS):=
+endif
+
+LOCAL_SRC_FILES_$(HOST_OS)_$(HOST_ARCH):=
+ifdef HOST_2ND_ARCH
+LOCAL_SRC_FILES_$(HOST_OS)_$(HOST_2ND_ARCH):=
+endif
+ifdef HOST_CROSS_OS
+LOCAL_SRC_FILES_$(HOST_CROSS_OS)_$(HOST_CROSS_ARCH):=
+endif
+
LOCAL_SRC_FILES_32:=
LOCAL_SRC_FILES_64:=
+LOCAL_SRC_FILES_EXCLUDE_32:=
+LOCAL_SRC_FILES_EXCLUDE_64:=
LOCAL_SHARED_LIBRARIES_32:=
LOCAL_SHARED_LIBRARIES_64:=
LOCAL_STATIC_LIBRARIES_32:=
@@ -285,6 +335,8 @@
LOCAL_MODULE_STEM_64:=
LOCAL_CLANG_32:=
LOCAL_CLANG_64:=
+LOCAL_INIT_RC_32:=
+LOCAL_INIT_RC_64:=
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
diff --git a/core/combo/HOST_CROSS_windows-x86.mk b/core/combo/HOST_CROSS_windows-x86.mk
new file mode 100644
index 0000000..b6cbebc
--- /dev/null
+++ b/core/combo/HOST_CROSS_windows-x86.mk
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2006 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.
+#
+
+# Settings to use MinGW as a cross-compiler under Linux
+# Included by combo/select.make
+
+$(combo_var_prefix)GLOBAL_CFLAGS += -DUSE_MINGW -DWIN32_LEAN_AND_MEAN
+$(combo_var_prefix)GLOBAL_CFLAGS += -Wno-unused-parameter
+$(combo_var_prefix)GLOBAL_CFLAGS += --sysroot=prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32
+$(combo_var_prefix)GLOBAL_CFLAGS += -m32
+$(combo_var_prefix)GLOBAL_LDFLAGS += -m32
+TOOLS_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-
+$(combo_var_prefix)C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/include
+$(combo_var_prefix)C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include
+$(combo_var_prefix)GLOBAL_LD_DIRS += -Lprebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32
+
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+$(combo_var_prefix)GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+# Use C99-compliant printf functions (%zd).
+$(combo_var_prefix)GLOBAL_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
+# Admit to using >= Vista. Both are needed because of <_mingw.h>.
+$(combo_var_prefix)GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0600 -DWINVER=0x0600
+# Get 64-bit off_t and related functions.
+$(combo_var_prefix)GLOBAL_CFLAGS += -D_FILE_OFFSET_BITS=64
+
+$(combo_var_prefix)CC := $(TOOLS_PREFIX)gcc
+$(combo_var_prefix)CXX := $(TOOLS_PREFIX)g++
+$(combo_var_prefix)AR := $(TOOLS_PREFIX)ar
+$(combo_var_prefix)NM := $(TOOLS_PREFIX)nm
+$(combo_var_prefix)OBJDUMP := $(TOOLS_PREFIX)objdump
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OBJDUMP) -x $(1) | grep "^Name" | cut -f3 -d" " > $(2)
+$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)NM) -g -f p $(1) | cut -f1-2 -d" " >> $(2)
+endef
+
+$(combo_var_prefix)GLOBAL_LDFLAGS += \
+ --enable-stdcall-fixup
+
+ifneq ($(strip $(BUILD_HOST_static)),)
+# Statically-linked binaries are desirable for sandboxed environment
+$(combo_var_prefix)GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+$(combo_var_prefix)SHLIB_SUFFIX := .dll
+$(combo_var_prefix)EXECUTABLE_SUFFIX := .exe
+
+$(combo_var_prefix)IS_64_BIT :=
+
+# The mingw gcc is 4.8, 4.9 is required for color diagnostics
+$(combo_var_prefix)UNKNOWN_CFLAGS := -fdiagnostics-color
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index 8389bb8..fc56e52 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -36,6 +36,10 @@
$(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-gcc
$(combo_2nd_arch_prefix)HOST_CXX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-g++
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_macho,$(1),$(2))
+endef
+
# gcc location for clang; to be updated when clang is updated
# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)
@@ -52,10 +56,6 @@
$(combo_2nd_arch_prefix)HOST_SHLIB_SUFFIX := .dylib
$(combo_2nd_arch_prefix)HOST_JNILIB_SUFFIX := .jnilib
-# TODO: add AndroidConfig.h for darwin-x86_64
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += \
- -include $(call select-android-config-h,darwin-x86)
-
$(combo_2nd_arch_prefix)HOST_GLOBAL_ARFLAGS := cqs
############################################################
@@ -78,12 +78,14 @@
-o $@ \
-install_name @rpath/$(notdir $@) \
-Wl,-rpath,@loader_path/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
+ -Wl,-rpath,@loader_path/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
$(PRIVATE_LDFLAGS)
endef
define transform-host-o-to-executable-inner
$(hide) $(PRIVATE_CXX) \
-Wl,-rpath,@loader_path/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
+ -Wl,-rpath,@loader_path/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
-o $@ \
-Wl,-headerpad_max_install_names \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
diff --git a/core/combo/HOST_darwin-x86_64.mk b/core/combo/HOST_darwin-x86_64.mk
index 0efa78f..251455f 100644
--- a/core/combo/HOST_darwin-x86_64.mk
+++ b/core/combo/HOST_darwin-x86_64.mk
@@ -36,6 +36,10 @@
HOST_CC := $(HOST_TOOLCHAIN_PREFIX)-gcc
HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_macho,$(1),$(2))
+endef
+
# gcc location for clang; to be updated when clang is updated
# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT)
@@ -52,9 +56,6 @@
HOST_SHLIB_SUFFIX := .dylib
HOST_JNILIB_SUFFIX := .jnilib
-HOST_GLOBAL_CFLAGS += \
- -include $(call select-android-config-h,darwin-x86)
-
HOST_GLOBAL_ARFLAGS := cqs
# We Reuse the following functions with the same name from HOST_darwin-x86.mk:
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 8eda6c0..169e2d2 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -23,13 +23,19 @@
$(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc
$(combo_2nd_arch_prefix)HOST_CXX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)g++
$(combo_2nd_arch_prefix)HOST_AR := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)ar
+$(combo_2nd_arch_prefix)HOST_READELF := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)readelf
+$(combo_2nd_arch_prefix)HOST_NM := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
# gcc location for clang; to be updated when clang is updated
-$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/
+$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8
# We expect SSE3 floating point math.
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -msse3 -mfpmath=sse -m32 -Wa,--noexecstack -march=prescott
-$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--no-undefined-version
ifneq ($(strip $(BUILD_HOST_static)),)
# Statically-linked binaries are desirable for sandboxed environment
@@ -38,15 +44,17 @@
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -fPIC \
-no-canonical-prefixes \
- -include $(call select-android-config-h,linux-x86)
-# TODO: Set _FORTIFY_SOURCE=2. Bug 20558757.
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fstack-protector
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector
# Workaround differences in inttypes.h between host and target.
# See bug 12708004.
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+# We build a 32-bit host art, and right now that also means building *all* host libraries
+# both 32- and 64-bit (whether art uses them or not --- 9d59f417767991246848c3e101cb27d2dfea5988).
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1
+
$(combo_2nd_arch_prefix)HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
############################################################
diff --git a/core/combo/HOST_linux-x86_64.mk b/core/combo/HOST_linux-x86_64.mk
index e268e41..9766f2b 100644
--- a/core/combo/HOST_linux-x86_64.mk
+++ b/core/combo/HOST_linux-x86_64.mk
@@ -23,25 +23,28 @@
HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc
HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++
HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar
+HOST_READELF := $(HOST_TOOLCHAIN_PREFIX)readelf
+HOST_NM := $(HOST_TOOLCHAIN_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
# gcc location for clang; to be updated when clang is updated
-HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/
+HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8
HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
-HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
+HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--no-undefined-version
ifneq ($(strip $(BUILD_HOST_static)),)
# Statically-linked binaries are desirable for sandboxed environment
HOST_GLOBAL_LDFLAGS += -static
endif # BUILD_HOST_static
-# TODO: Add AndroidConfig.h for linux-x86_64
HOST_GLOBAL_CFLAGS += -fPIC \
-no-canonical-prefixes \
- -include $(call select-android-config-h,linux-x86)
-# TODO: Set _FORTIFY_SOURCE=2. Bug 20558757.
-HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fstack-protector
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector
# Workaround differences in inttypes.h between host and target.
# See bug 12708004.
diff --git a/core/combo/HOST_windows-x86.mk b/core/combo/HOST_windows-x86.mk
deleted file mode 100644
index b71ac16..0000000
--- a/core/combo/HOST_windows-x86.mk
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# Copyright (C) 2006 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.
-#
-
-# Configuration for Linux on x86.
-# Included by combo/select.make
-
-# right now we get these from the environment, but we should
-# pick them from the tree somewhere
-TOOLS_PREFIX := #prebuilt/windows/host/bin/
-TOOLS_EXE_SUFFIX := .exe
-
-# Settings to use MinGW has a cross-compiler under Linux
-ifneq ($(findstring Linux,$(UNAME)),)
-ifdef USE_MINGW
-HOST_ACP_UNAVAILABLE := true
-TOOLS_EXE_SUFFIX :=
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -DUSE_MINGW -DWIN32_LEAN_AND_MEAN
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -Wno-unused-parameter
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += --sysroot=prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -m32
-$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32
-TOOLS_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-
-$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/include
-$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include
-$(combo_2nd_arch_prefix)HOST_GLOBAL_LD_DIRS += -Lprebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32
-endif # USE_MINGW
-endif # Linux
-
-# Workaround differences in inttypes.h between host and target.
-# See bug 12708004.
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
-
-$(combo_2nd_arch_prefix)HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
-$(combo_2nd_arch_prefix)HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
-$(combo_2nd_arch_prefix)HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
-
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += \
- -include $(call select-android-config-h,windows)
-$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += \
- --enable-stdcall-fixup
-
-ifneq ($(strip $(BUILD_HOST_static)),)
-# Statically-linked binaries are desirable for sandboxed environment
-$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
-endif # BUILD_HOST_static
-
-# when building under Cygwin, ensure that we use Mingw compilation by default.
-# you can disable this (i.e. to generate Cygwin executables) by defining the
-# USE_CYGWIN variable in your environment, e.g.:
-#
-# export USE_CYGWIN=1
-#
-# note that the -mno-cygwin flags are not needed when cross-compiling the
-# Windows host tools on Linux
-#
-ifneq ($(findstring CYGWIN,$(UNAME)),)
-ifeq ($(strip $(USE_CYGWIN)),)
-$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mno-cygwin
-$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
-endif
-endif
-
-############################################################
-## Macros after this line are shared by the 64-bit config.
-
-HOST_SHLIB_SUFFIX := .dll
-HOST_EXECUTABLE_SUFFIX := .exe
-
-# $(1): The file to check
-# TODO: find out what format cygwin's stat(1) uses
-define get-file-size
-999999999
-endef
diff --git a/core/combo/HOST_windows-x86_64.mk b/core/combo/HOST_windows-x86_64.mk
deleted file mode 100644
index bd392ea..0000000
--- a/core/combo/HOST_windows-x86_64.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Copyright (C) 2006 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.
-#
-
-# Configuration for Windows on x86_64.
-# Included by combo/select.make
-
-# right now we get these from the environment, but we should
-# pick them from the tree somewhere
-TOOLS_PREFIX := #prebuilt/windows/host/bin/
-TOOLS_EXE_SUFFIX := .exe
-
-# Settings to use MinGW has a cross-compiler under Linux
-ifneq ($(findstring Linux,$(UNAME)),)
-ifdef USE_MINGW
-HOST_ACP_UNAVAILABLE := true
-TOOLS_EXE_SUFFIX :=
-HOST_GLOBAL_CFLAGS += -DUSE_MINGW
-TOOLS_PREFIX := /usr/bin/amd64-mingw32msvc-
-HOST_C_INCLUDES += /usr/lib/gcc/amd64-mingw32msvc/4.4.2/include
-HOST_GLOBAL_LD_DIRS += -L/usr/amd64-mingw32msvc/lib
-endif # USE_MINGW
-endif # Linux
-
-# Workaround differences in inttypes.h between host and target.
-# See bug 12708004.
-HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
-
-HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
-HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
-HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
-
-HOST_GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
-HOST_GLOBAL_LDFLAGS += --enable-stdcall-fixup
-ifneq ($(strip $(BUILD_HOST_static)),)
-# Statically-linked binaries are desirable for sandboxed environment
-HOST_GLOBAL_LDFLAGS += -static
-endif # BUILD_HOST_static
-
-# when building under Cygwin, ensure that we use Mingw compilation by default.
-# you can disable this (i.e. to generate Cygwin executables) by defining the
-# USE_CYGWIN variable in your environment, e.g.:
-#
-# export USE_CYGWIN=1
-#
-# note that the -mno-cygwin flags are not needed when cross-compiling the
-# Windows host tools on Linux
-#
-ifneq ($(findstring CYGWIN,$(UNAME)),)
-ifeq ($(strip $(USE_CYGWIN)),)
-HOST_GLOBAL_CFLAGS += -mno-cygwin
-HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
-endif
-endif
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index a2d3dee..510aae5 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -20,8 +20,7 @@
# You can set TARGET_ARCH_VARIANT to use an arch version other
# than ARMv5TE. Each value should correspond to a file named
# $(BUILD_COMBOS)/arch/<name>.mk which must contain
-# makefile variable definitions similar to the preprocessor
-# defines in build/core/combo/include/arch/<combo>/AndroidConfig.h. Their
+# makefile variable definitions. Their
# purpose is to allow module Android.mk files to selectively compile
# different versions of code based upon the funtionality and
# instructions available in a given architecture version.
@@ -64,6 +63,11 @@
$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld
$(combo_2nd_arch_prefix)TARGET_READELF := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)readelf
$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip
+$(combo_2nd_arch_prefix)TARGET_NM := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -92,14 +96,12 @@
$(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
endif
-android_config_h := $(call select-android-config-h,linux-arm)
-
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
-msoft-float \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
- -fstack-protector \
+ -fstack-protector-strong \
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
@@ -107,8 +109,6 @@
-no-canonical-prefixes \
-fno-canonical-system-headers \
$(arch_variant_cflags) \
- -include $(android_config_h) \
- -I $(dir $(android_config_h))
# The "-Wunused-but-set-variable" option often breaks projects that enable
# "-Wall -Werror" due to a commom idiom "ALOGV(mesg)" where ALOGV is turned
@@ -138,6 +138,7 @@
-Wl,--fatal-warnings \
-Wl,--icf=safe \
-Wl,--hash-style=gnu \
+ -Wl,--no-undefined-version \
$(arch_variant_ldflags)
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -mthumb-interwork
@@ -171,6 +172,7 @@
endif
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_$(combo_2nd_arch_prefix)ARCH)
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
@@ -190,6 +192,4 @@
$(combo_2nd_arch_prefix)TARGET_PACK_MODULE_RELOCATIONS := true
-$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
-
$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
index 2fceee0..6a1d861 100644
--- a/core/combo/TARGET_linux-arm64.mk
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -20,8 +20,7 @@
# You can set TARGET_ARCH_VARIANT to use an arch version other
# than ARMv5TE. Each value should correspond to a file named
# $(BUILD_COMBOS)/arch/<name>.mk which must contain
-# makefile variable definitions similar to the preprocessor
-# defines in build/core/combo/include/arch/<combo>/AndroidConfig.h. Their
+# makefile variable definitions. Their
# purpose is to allow module Android.mk files to selectively compile
# different versions of code based upon the funtionality and
# instructions available in a given architecture version.
@@ -64,16 +63,19 @@
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld
TARGET_READELF := $(TARGET_TOOLS_PREFIX)readelf
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip
+TARGET_NM := $(TARGET_TOOLS_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
TARGET_GLOBAL_CFLAGS += \
-fno-strict-aliasing \
-android_config_h := $(call select-android-config-h,linux-arm64)
-
TARGET_GLOBAL_CFLAGS += \
- -fstack-protector \
+ -fstack-protector-strong \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
@@ -84,8 +86,6 @@
-no-canonical-prefixes \
-fno-canonical-system-headers \
$(arch_variant_cflags) \
- -include $(android_config_h) \
- -I $(dir $(android_config_h))
# Help catch common 32/64-bit errors.
TARGET_GLOBAL_CFLAGS += \
@@ -114,6 +114,10 @@
-Wl,--fatal-warnings \
-Wl,-maarch64linux \
-Wl,--hash-style=gnu \
+ -Wl,--fix-cortex-a53-843419 \
+ -fuse-ld=gold \
+ -Wl,--icf=safe \
+ -Wl,--no-undefined-version \
$(arch_variant_ldflags)
# Disable transitive dependency library symbol resolving.
@@ -141,6 +145,7 @@
-print-file-name=libgcov.a)
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH)
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
@@ -160,6 +165,4 @@
TARGET_PACK_MODULE_RELOCATIONS := true
-TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
-
TARGET_LINKER := /system/bin/linker64
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index 962aa45..186d88f 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -20,8 +20,7 @@
# You can set TARGET_ARCH_VARIANT to use an arch version other
# than mips32r2-fp. Each value should correspond to a file named
# $(BUILD_COMBOS)/arch/<name>.mk which must contain
-# makefile variable definitions similar to the preprocessor
-# defines in build/core/combo/include/arch/<combo>/AndroidConfig.h. Their
+# makefile variable definitions. Their
# purpose is to allow module Android.mk files to selectively compile
# different versions of code based upon the funtionality and
# instructions available in a given architecture version.
@@ -64,6 +63,11 @@
$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld
$(combo_2nd_arch_prefix)TARGET_READELF := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)readelf
$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip
+$(combo_2nd_arch_prefix)TARGET_NM := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -79,22 +83,19 @@
TARGET_mips_CFLAGS += -fno-omit-frame-pointer
endif
-android_config_h := $(call select-android-config-h,linux-mips)
-
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
$(TARGET_mips_CFLAGS) \
-U__unix -U__unix__ -Umips \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
+ -fstack-protector-strong \
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
-no-canonical-prefixes \
-fno-canonical-system-headers \
$(arch_variant_cflags) \
- -include $(android_config_h) \
- -I $(dir $(android_config_h))
ifneq ($(ARCH_MIPS_PAGE_SHIFT),)
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -DPAGE_SHIFT=$(ARCH_MIPS_PAGE_SHIFT)
@@ -107,6 +108,7 @@
-Wl,--build-id=md5 \
-Wl,--warn-shared-textrel \
-Wl,--fatal-warnings \
+ -Wl,--no-undefined-version \
$(arch_variant_ldflags)
# Disable transitive dependency library symbol resolving.
@@ -145,6 +147,7 @@
endif
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-mips # mips covers both mips and mips64.
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
@@ -164,6 +167,4 @@
$(combo_2nd_arch_prefix)TARGET_PACK_MODULE_RELOCATIONS := true
-$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
-
$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker
diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk
index 1116f46..3e1f61a 100644
--- a/core/combo/TARGET_linux-mips64.mk
+++ b/core/combo/TARGET_linux-mips64.mk
@@ -20,8 +20,7 @@
# You can set TARGET_ARCH_VARIANT to use an arch version other
# than mips64r6. Each value should correspond to a file named
# $(BUILD_COMBOS)/arch/<name>.mk which must contain
-# makefile variable definitions similar to the preprocessor
-# defines in build/core/combo/include/arch/<combo>/AndroidConfig.h. Their
+# makefile variable definitions. Their
# purpose is to allow module Android.mk files to selectively compile
# different versions of code based upon the funtionality and
# instructions available in a given architecture version.
@@ -64,6 +63,11 @@
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld
TARGET_READELF := $(TARGET_TOOLS_PREFIX)readelf
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip
+TARGET_NM := $(TARGET_TOOLS_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -79,22 +83,19 @@
TARGET_mips_CFLAGS += -fno-omit-frame-pointer
endif
-android_config_h := $(call select-android-config-h,linux-mips64)
-
TARGET_GLOBAL_CFLAGS += \
$(TARGET_mips_CFLAGS) \
-U__unix -U__unix__ -Umips \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
+ -fstack-protector-strong \
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
-no-canonical-prefixes \
-fno-canonical-system-headers \
$(arch_variant_cflags) \
- -include $(android_config_h) \
- -I $(dir $(android_config_h))
# Help catch common 32/64-bit errors.
TARGET_GLOBAL_CFLAGS += \
@@ -113,8 +114,12 @@
-Wl,--build-id=md5 \
-Wl,--warn-shared-textrel \
-Wl,--fatal-warnings \
+ -Wl,--no-undefined-version \
$(arch_variant_ldflags)
+# Disable transitive dependency library symbol resolving.
+TARGET_GLOBAL_LDFLAGS += -Wl,--allow-shlib-undefined
+
TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
# More flags/options can be added here
@@ -128,7 +133,6 @@
libc_root := bionic/libc
libm_root := bionic/libm
-libthread_db_root := bionic/libthread_db
## on some hosts, the target cross-compiler is not available so do not run this command
@@ -149,6 +153,7 @@
endif
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-mips
# TODO: perhaps use $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH) instead of asm-mips ?
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
@@ -159,7 +164,7 @@
$(KERNEL_HEADERS) \
$(libm_root)/include \
$(libm_root)/include/mips \
- $(libthread_db_root)/include
+
# TODO: perhaps use $(libm_root)/include/mips64 instead of mips ?
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
@@ -171,6 +176,4 @@
TARGET_PACK_MODULE_RELOCATIONS := true
-TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
-
TARGET_LINKER := /system/bin/linker64
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index 482889d..558ec3b 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -56,6 +56,11 @@
$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld
$(combo_2nd_arch_prefix)TARGET_READELF := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)readelf
$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip
+$(combo_2nd_arch_prefix)TARGET_NM := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
ifneq ($(wildcard $($(combo_2nd_arch_prefix)TARGET_CC)),)
$(combo_2nd_arch_prefix)TARGET_LIBGCC := \
@@ -72,11 +77,10 @@
libm_root := bionic/libm
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64.
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
-android_config_h := $(call select-android-config-h,target_linux-x86)
-
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
-O2 \
-Wa,--noexecstack \
@@ -90,16 +94,10 @@
-fstrict-aliasing \
-funswitch-loops \
-funwind-tables \
- -fstack-protector \
+ -fstack-protector-strong \
-m32 \
-no-canonical-prefixes \
-fno-canonical-system-headers \
- -include $(android_config_h) \
- -I $(dir $(android_config_h))
-
-# Work around gcc 4.9 devirtualization bug, https://b.corp.google.com/19872411.
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
- -fno-devirtualize \
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(arch_variant_cflags)
@@ -131,6 +129,7 @@
$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--fatal-warnings
$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--hash-style=gnu
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--no-undefined-version
$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
$(libc_root)/arch-x86/include \
@@ -148,8 +147,6 @@
$(combo_2nd_arch_prefix)TARGET_PACK_MODULE_RELOCATIONS := true
-$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
-
$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker
$(combo_2nd_arch_prefix)TARGET_GLOBAL_YASM_FLAGS := -f elf32 -m x86
diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk
index c705b95..12166ec 100644
--- a/core/combo/TARGET_linux-x86_64.mk
+++ b/core/combo/TARGET_linux-x86_64.mk
@@ -56,6 +56,11 @@
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld
TARGET_READELF := $(TARGET_TOOLS_PREFIX)readelf
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip
+TARGET_NM := $(TARGET_TOOLS_PREFIX)nm
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
ifneq ($(wildcard $(TARGET_CC)),)
TARGET_LIBGCC := \
@@ -72,6 +77,7 @@
libm_root := bionic/libm
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_COMMON += $(libc_root)/kernel/common
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64.
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
@@ -88,25 +94,17 @@
-fstrict-aliasing \
-funswitch-loops \
-funwind-tables \
- -fstack-protector \
+ -fstack-protector-strong \
-m64 \
-no-canonical-prefixes \
-fno-canonical-system-headers
-# Work around gcc 4.9 devirtualization bug, https://b.corp.google.com/19872411.
-TARGET_GLOBAL_CFLAGS += \
- -fno-devirtualize \
-
# Help catch common 32/64-bit errors.
TARGET_GLOBAL_CFLAGS += \
-Werror=pointer-to-int-cast \
-Werror=int-to-pointer-cast \
-Werror=implicit-function-declaration \
-android_config_h := $(call select-android-config-h,target_linux-x86)
-TARGET_ANDROID_CONFIG_CFLAGS := -include $(android_config_h) -I $(dir $(android_config_h))
-TARGET_GLOBAL_CFLAGS += $(TARGET_ANDROID_CONFIG_CFLAGS)
-
TARGET_GLOBAL_CFLAGS += $(arch_variant_cflags)
ifeq ($(ARCH_X86_HAVE_SSSE3),true) # yes, really SSSE3, not SSE3!
@@ -140,6 +138,7 @@
TARGET_GLOBAL_LDFLAGS += -Wl,--fatal-warnings
TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
TARGET_GLOBAL_LDFLAGS += -Wl,--hash-style=gnu
+TARGET_GLOBAL_LDFLAGS += -Wl,--no-undefined-version
TARGET_C_INCLUDES := \
$(libc_root)/arch-x86_64/include \
@@ -155,8 +154,6 @@
TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
-TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
-
TARGET_LINKER := /system/bin/linker64
TARGET_GLOBAL_YASM_FLAGS := -f elf64 -m amd64
diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk
index 99f17aa..5dc1fec 100644
--- a/core/combo/arch/arm/armv7-a-neon.mk
+++ b/core/combo/arch/arm/armv7-a-neon.mk
@@ -24,7 +24,7 @@
arch_variant_ldflags := \
-Wl,--fix-cortex-a8
else
-ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a7)
+ifneq (,$(filter cortex-a7 cortex-a53 cortex-a53.a57,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a7
arch_variant_ldflags := \
-Wl,--no-fix-cortex-a8
diff --git a/core/combo/arch/arm64/armv8-a.mk b/core/combo/arch/arm64/armv8-a.mk
index edc0497..5e27e5a 100644
--- a/core/combo/arch/arm64/armv8-a.mk
+++ b/core/combo/arch/arm64/armv8-a.mk
@@ -1 +1,5 @@
-arch_variant_cflags :=
+ifneq (,$(filter cortex-a53,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
+ arch_variant_cflags := -mcpu=cortex-a53
+else
+ arch_variant_cflags :=
+endif
diff --git a/core/combo/arch/mips/mips32-fp.mk b/core/combo/arch/mips/mips32-fp.mk
index 8320e93..912ff63 100644
--- a/core/combo/arch/mips/mips32-fp.mk
+++ b/core/combo/arch/mips/mips32-fp.mk
@@ -7,6 +7,7 @@
-mips32 \
-mfp32 \
-modd-spreg \
+ -mno-synci
arch_variant_ldflags := \
-Wl,-melf32ltsmip
diff --git a/core/combo/arch/mips/mips32r2-fp-xburst.mk b/core/combo/arch/mips/mips32r2-fp-xburst.mk
index 2b4f714..09b3bc2 100644
--- a/core/combo/arch/mips/mips32r2-fp-xburst.mk
+++ b/core/combo/arch/mips/mips32r2-fp-xburst.mk
@@ -9,7 +9,8 @@
-mfp32 \
-modd-spreg \
-mno-fused-madd \
- -Wa,-mmxu
+ -Wa,-mmxu \
+ -mno-synci
arch_variant_ldflags := \
-Wl,-melf32ltsmip
diff --git a/core/combo/include/arch/darwin-x86/AndroidConfig.h b/core/combo/include/arch/darwin-x86/AndroidConfig.h
deleted file mode 100644
index c28a7f8..0000000
--- a/core/combo/include/arch/darwin-x86/AndroidConfig.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-/*
- * Android config -- "Darwin". Used for X86 Mac OS X.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/*
- * Define if we have <malloc.h> header
- */
-/* #define HAVE_MALLOC_H 1 */
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '/'
-
-/*
- * Define if <stdint.h> exists.
- */
-#define HAVE_STDINT_H 1
-
-#endif /*_ANDROID_CONFIG_H*/
diff --git a/core/combo/include/arch/linux-arm/AndroidConfig.h b/core/combo/include/arch/linux-arm/AndroidConfig.h
deleted file mode 100644
index e819535..0000000
--- a/core/combo/include/arch/linux-arm/AndroidConfig.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-/*
- * Android config -- "android-arm". Used for ARM device builds.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/*
- * Define if we have <malloc.h> header
- */
-#define HAVE_MALLOC_H 1
-
-/*
- * Define if we're running on *our* linux on device or emulator.
- */
-#define HAVE_ANDROID_OS 1
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '/'
-
-/*
- * Define if <stdint.h> exists.
- */
-#define HAVE_STDINT_H 1
-
-#endif /* _ANDROID_CONFIG_H */
diff --git a/core/combo/include/arch/linux-arm64/AndroidConfig.h b/core/combo/include/arch/linux-arm64/AndroidConfig.h
deleted file mode 100644
index cee484d..0000000
--- a/core/combo/include/arch/linux-arm64/AndroidConfig.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-/*
- * Android config -- "android-aarch64". Used for ARM aarch64 device builds.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/*
- * Define if we have <malloc.h> header
- */
-#define HAVE_MALLOC_H 1
-
-/*
- * Define if we're running on *our* linux on device or emulator.
- */
-#define HAVE_ANDROID_OS 1
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '/'
-
-/*
- * Define if <stdint.h> exists.
- */
-#define HAVE_STDINT_H 1
-
-#endif /* _ANDROID_CONFIG_H */
diff --git a/core/combo/include/arch/linux-mips/AndroidConfig.h b/core/combo/include/arch/linux-mips/AndroidConfig.h
deleted file mode 100644
index a5dcef1..0000000
--- a/core/combo/include/arch/linux-mips/AndroidConfig.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Android config -- "android-mips". Used for MIPS device builds.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/*
- * Define if we have <malloc.h> header
- */
-#define HAVE_MALLOC_H 1
-
-/*
- * Define if we're running on *our* linux on device or emulator.
- */
-#define HAVE_ANDROID_OS 1
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '/'
-
-/*
- * Define if <stdint.h> exists.
- */
-#define HAVE_STDINT_H 1
-
-#endif /* _ANDROID_CONFIG_H */
diff --git a/core/combo/include/arch/linux-mips64/AndroidConfig.h b/core/combo/include/arch/linux-mips64/AndroidConfig.h
deleted file mode 100644
index 62d569e..0000000
--- a/core/combo/include/arch/linux-mips64/AndroidConfig.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-/*
- * Android config -- "android-mips64". Used for MIPS device builds.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/*
- * Define if we have <malloc.h> header
- */
-#define HAVE_MALLOC_H 1
-
-/*
- * Define if we're running on *our* linux on device or emulator.
- */
-#define HAVE_ANDROID_OS 1
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '/'
-
-/*
- * Define if <stdint.h> exists.
- */
-#define HAVE_STDINT_H 1
-
-#endif /* _ANDROID_CONFIG_H */
diff --git a/core/combo/include/arch/linux-x86/AndroidConfig.h b/core/combo/include/arch/linux-x86/AndroidConfig.h
deleted file mode 100644
index 89b29fe..0000000
--- a/core/combo/include/arch/linux-x86/AndroidConfig.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-/*
- * Android config -- "Linux". Used for desktop x86 Linux.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/*
- * We need to choose between 32-bit and 64-bit off_t. All of our code should
- * agree on the same size. For desktop systems, use 64-bit values,
- * because some of our libraries (e.g. wxWidgets) expect to be built that way.
- */
-#define _FILE_OFFSET_BITS 64
-#define _LARGEFILE_SOURCE 1
-
-/*
- * Define if we have <malloc.h> header
- */
-#define HAVE_MALLOC_H 1
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '/'
-
-/*
- * Define if <stdint.h> exists.
- */
-#define HAVE_STDINT_H 1
-
-#endif /*_ANDROID_CONFIG_H*/
diff --git a/core/combo/include/arch/target_linux-x86/AndroidConfig.h b/core/combo/include/arch/target_linux-x86/AndroidConfig.h
deleted file mode 100644
index 41e4df9..0000000
--- a/core/combo/include/arch/target_linux-x86/AndroidConfig.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2005 The Android Open Source Project
- *
- * Android config -- "target_linux-x86". Used for x86 linux target devices.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/*
- * Define if we have <malloc.h> header
- */
-#define HAVE_MALLOC_H 1
-
-/*
- * Define if we're running on *our* linux on device or emulator.
- */
-#define HAVE_ANDROID_OS 1
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '/'
-
-/*
- * Define if <stdint.h> exists.
- */
-#define HAVE_STDINT_H 1
-
-#endif /* _ANDROID_CONFIG_H */
diff --git a/core/combo/include/arch/windows/AndroidConfig.h b/core/combo/include/arch/windows/AndroidConfig.h
deleted file mode 100644
index e7eb837..0000000
--- a/core/combo/include/arch/windows/AndroidConfig.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-/*
- * Android config -- "CYGWIN_NT-5.1".
- *
- * Cygwin has pthreads, but GDB seems to get confused if you use it to
- * create threads. By "confused", I mean it freezes up the first time the
- * debugged process creates a thread, even if you use CreateThread. The
- * mere presence of pthreads linkage seems to cause problems.
- */
-#ifndef _ANDROID_CONFIG_H
-#define _ANDROID_CONFIG_H
-
-/*
- * ===========================================================================
- * !!! IMPORTANT !!!
- * ===========================================================================
- *
- * This file is included by ALL C/C++ source files. Don't put anything in
- * here unless you are absolutely certain it can't go anywhere else.
- *
- * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
- * comments.
- */
-
-/* MingW doesn't define __BEGIN_DECLS / __END_DECLS. */
-
-#ifndef __BEGIN_DECLS
-# ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# else
-# define __BEGIN_DECLS
-# endif
-#endif
-
-#ifndef __END_DECLS
-# ifdef __cplusplus
-# define __END_DECLS }
-# else
-# define __END_DECLS
-# endif
-#endif
-
-/* TODO: replace references to this. */
-#define HAVE_WIN32_IPC
-
-#ifdef __CYGWIN__
-#error "CYGWIN is unsupported for platform builds"
-#endif
-
-/*
- * Define this if you build against MSVCRT.DLL
- */
-#define HAVE_MS_C_RUNTIME
-
-/*
- * Define this if we want to use WinSock.
- */
-#define HAVE_WINSOCK
-
-/*
- * We need to choose between 32-bit and 64-bit off_t. All of our code should
- * agree on the same size. For desktop systems, use 64-bit values,
- * because some of our libraries (e.g. wxWidgets) expect to be built that way.
- */
-#define _FILE_OFFSET_BITS 64
-#define _LARGEFILE_SOURCE 1
-
-/*
- * Add any extra platform-specific defines here.
- */
-#define WIN32 1 /* stock Cygwin doesn't define these */
-#define _WIN32 1
-#define _WIN32_WINNT 0x0500 /* admit to using >= Win2K */
-
-#define HAVE_WINDOWS_PATHS /* needed by simulator */
-
-/*
- * The default path separator for the platform
- */
-#define OS_PATH_SEPARATOR '\\'
-
-/*
- * Various definitions missing in MinGW
- */
-#ifdef USE_MINGW
-#define S_IRGRP 0
-#endif
-
-#endif /*_ANDROID_CONFIG_H*/
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index fb43ea4..70dae13 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -9,6 +9,11 @@
# COMMON_JAVAC -- Java compiler command with common arguments
#
+ifndef ANDROID_COMPILE_WITH_JACK
+# Defines if compilation with jack is enabled by default.
+ANDROID_COMPILE_WITH_JACK := true
+endif
+
common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
# Use the indexer wrapper to index the codebase instead of the javac compiler
@@ -26,12 +31,7 @@
endif
# Whatever compiler is on this system.
-ifeq ($(BUILD_OS), windows)
- COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
- $(common_jdk_flags)
-else
- COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
-endif
+COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
# Eclipse.
ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
@@ -40,6 +40,8 @@
$(info CUSTOM_JAVA_COMPILER=eclipse)
endif
+GLOBAL_JAVAC_DEBUG_FLAGS := -g
+
HOST_JAVAC ?= $(COMMON_JAVAC)
TARGET_JAVAC ?= $(COMMON_JAVAC)
diff --git a/core/combo/mac_version.mk b/core/combo/mac_version.mk
index 6defba7..f6bd852 100644
--- a/core/combo/mac_version.mk
+++ b/core/combo/mac_version.mk
@@ -9,7 +9,7 @@
build_mac_version := $(shell sw_vers -productVersion)
-mac_sdk_versions_supported := 10.6 10.7 10.8 10.9
+mac_sdk_versions_supported := 10.8 10.9 10.10 10.11
ifneq ($(strip $(MAC_SDK_VERSION)),)
mac_sdk_version := $(MAC_SDK_VERSION)
ifeq ($(filter $(mac_sdk_version),$(mac_sdk_versions_supported)),)
@@ -19,7 +19,7 @@
$(error Stop.)
endif
else
-mac_sdk_versions_installed := $(shell xcodebuild -showsdks | grep macosx | sort | sed -e "s/.*macosx//g")
+mac_sdk_versions_installed := $(shell xcodebuild -showsdks | grep macosx | sed -e "s/.*macosx//g")
mac_sdk_version := $(firstword $(filter $(mac_sdk_versions_installed), $(mac_sdk_versions_supported)))
ifeq ($(mac_sdk_version),)
mac_sdk_version := $(firstword $(mac_sdk_versions_supported))
diff --git a/core/combo/select.mk b/core/combo/select.mk
index 01f9322..df12e7e 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -47,62 +47,3 @@
# Now include the combo for this specific target.
include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
-
-ifneq ($(USE_CCACHE),)
- # The default check uses size and modification time, causing false misses
- # since the mtime depends when the repo was checked out
- export CCACHE_COMPILERCHECK := content
-
- # See man page, optimizations to get more cache hits
- # implies that __DATE__ and __TIME__ are not critical for functionality.
- # Ignore include file modification time since it will depend on when
- # the repo was checked out
- export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
-
- # Turn all preprocessor absolute paths into relative paths.
- # Fixes absolute paths in preprocessed source due to use of -g.
- # We don't really use system headers much so the rootdir is
- # fine; ensures these paths are relative for all Android trees
- # on a workstation.
- export CCACHE_BASEDIR := /
-
- # Workaround for ccache with clang.
- # See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
- export CCACHE_CPP2 := true
-
- CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
- # If we are cross-compiling Windows binaries on Linux
- # then use the linux ccache binary instead.
- ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
- CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
- endif
- ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
- # Check that the executable is here.
- ccache := $(strip $(wildcard $(ccache)))
- ifdef ccache
- ifndef CC_WRAPPER
- CC_WRAPPER := $(ccache)
- endif
- ifndef CXX_WRAPPER
- CXX_WRAPPER := $(ccache)
- endif
- ccache =
- endif
-endif
-
-# Stash the original values of CC and CXX so we can still use the non-wrapped
-# values later.
-$(combo_2nd_arch_prefix)CC_BARE := $($(combo_var_prefix)CC)
-$(combo_2nd_arch_prefix)CXX_BARE := $($(combo_var_prefix)CXX)
-
-# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars.
-ifdef CC_WRAPPER
- ifneq ($(CC_WRAPPER),$(firstword $($(combo_var_prefix)CC)))
- $(combo_var_prefix)CC := $(CC_WRAPPER) $($(combo_var_prefix)CC)
- endif
-endif
-ifdef CXX_WRAPPER
- ifneq ($(CXX_WRAPPER),$(firstword $($(combo_var_prefix)CXX)))
- $(combo_var_prefix)CXX := $(CXX_WRAPPER) $($(combo_var_prefix)CXX)
- endif
-endif
diff --git a/core/config.mk b/core/config.mk
index 83295d9..34be76b 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -23,6 +23,10 @@
endef
+# The pound character "#"
+define pound
+#
+endef
# Unfortunately you can't simply define backslash as \ or \\.
backslash := \a
backslash := $(patsubst %a,%,$(backslash))
@@ -38,6 +42,7 @@
# TODO: See if we can remove most of these from the global list.
SRC_HEADERS := \
$(TOPDIR)system/core/include \
+ $(TOPDIR)system/media/audio/include \
$(TOPDIR)hardware/libhardware/include \
$(TOPDIR)hardware/libhardware_legacy/include \
$(TOPDIR)hardware/ril/include \
@@ -85,6 +90,8 @@
BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
BUILD_NATIVE_BENCHMARK := $(BUILD_SYSTEM)/native_benchmark.mk
BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
+BUILD_FUZZ_TEST := $(BUILD_SYSTEM)/fuzz_test.mk
+BUILD_HOST_FUZZ_TEST := $(BUILD_SYSTEM)/host_fuzz_test.mk
BUILD_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/shared_test_lib.mk
BUILD_HOST_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/host_shared_test_lib.mk
@@ -104,32 +111,32 @@
# lines being executed, instead of a short message about
# the kind of operation being done.
SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))
+hide := $(if $(SHOW_COMMANDS),,@)
+################################################################
+# Tools needed in product configuration makefiles.
+################################################################
+NORMALIZE_PATH := build/tools/normalize_path.py
+
+# $(1): the paths to be normalized
+define normalize-paths
+$(if $(1),$(shell $(NORMALIZE_PATH) $(1)))
+endef
# ###############################################################
# Set common values
# ###############################################################
-# These can be changed to modify both host and device modules.
-COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith
-COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG
-
-COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo -std=gnu++11
-COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS)
-
-GLOBAL_CFLAGS_NO_OVERRIDE := \
- -Werror=int-to-pointer-cast \
- -Werror=pointer-to-int-cast \
-
-GLOBAL_CPPFLAGS_NO_OVERRIDE :=
-
# Set the extensions used for various packages
COMMON_PACKAGE_SUFFIX := .zip
COMMON_JAVA_PACKAGE_SUFFIX := .jar
COMMON_ANDROID_PACKAGE_SUFFIX := .apk
-# list of flags to turn specific warnings in to errors
-TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point
+ifdef TMPDIR
+JAVA_TMPDIR_ARG := -Djava.io.tmpdir=$(TMPDIR)
+else
+JAVA_TMPDIR_ARG :=
+endif
# ###############################################################
# Include sub-configuration files
@@ -150,6 +157,10 @@
# are specific to the user's build configuration.
include $(BUILD_SYSTEM)/envsetup.mk
+# Pruned directory options used when using findleaves.py
+# See envsetup.mk for a description of SCAN_EXCLUDE_DIRS
+FIND_LEAVES_EXCLUDES := $(addprefix --prune=, $(OUT_DIR) $(SCAN_EXCLUDE_DIRS) .repo .git)
+
# The build system exposes several variables for where to find the kernel
# headers:
# TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
@@ -216,9 +227,16 @@
endif
TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
-# $(1): os/arch
-define select-android-config-h
-build/core/combo/include/arch/$(1)/AndroidConfig.h
+# Commands to generate .toc file common to ELF .so files.
+define _gen_toc_command_for_elf
+$(hide) ($($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) -d $(1) | grep SONAME || echo "No SONAME for $1") > $(2)
+$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) --dyn-syms $(1) | awk '{$$2=""; $$3=""; print}' >> $(2)
+endef
+
+# Commands to generate .toc file from Darwin dynamic library.
+define _gen_toc_command_for_macho
+$(hide) otool -l $(1) | grep LC_ID_DYLIB -A 5 > $(2)
+$(hide) nm -gP $(1) | cut -f1-2 -d" " | grep -v U$$ >> $(2)
endef
combo_target := HOST_
@@ -232,6 +250,13 @@
include $(BUILD_SYSTEM)/combo/select.mk
endif
+# Load the windows cross compiler under Linux
+ifdef HOST_CROSS_OS
+combo_target := HOST_CROSS_
+combo_2nd_arch_prefix :=
+include $(BUILD_SYSTEM)/combo/select.mk
+endif
+
# on windows, the tools have .exe at the end, and we depend on the
# host config stuff being done first
@@ -246,6 +271,9 @@
include $(BUILD_SYSTEM)/combo/select.mk
endif
+include $(BUILD_SYSTEM)/ccache.mk
+include $(BUILD_SYSTEM)/goma.mk
+
ifdef TARGET_PREFER_32_BIT
TARGET_PREFER_32_BIT_APPS := true
TARGET_PREFER_32_BIT_EXECUTABLES := true
@@ -362,9 +390,53 @@
endif
endif
+#
+# Tools that are prebuilts for TARGET_BUILD_APPS
+#
+
+ACP := $(HOST_OUT_EXECUTABLES)/acp
+AIDL := $(HOST_OUT_EXECUTABLES)/aidl
+AAPT := $(HOST_OUT_EXECUTABLES)/aapt
+ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign
+SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
+SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
+LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc
+BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat
+
+DX := $(HOST_OUT_EXECUTABLES)/dx
+MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
+
+USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
+
+# Override the definitions above for unbundled and PDK builds
+ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
+prebuilt_sdk_tools := prebuilts/sdk/tools
+prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
+
+ACP := $(prebuilt_sdk_tools_bin)/acp
+AIDL := $(prebuilt_sdk_tools_bin)/aidl
+AAPT := $(prebuilt_sdk_tools_bin)/aapt
+ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign
+SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
+# Use 64-bit libraries unconditionally because 32-bit JVMs are no longer supported
+SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
+
+DX := $(prebuilt_sdk_tools)/dx
+MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
+
+# Don't use prebuilts in PDK
+ifneq ($(TARGET_BUILD_PDK),true)
+LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc
+BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat
+endif # TARGET_BUILD_PDK
+endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK
+
# ---------------------------------------------------------------
# Generic tools.
+JACK := $(HOST_OUT_EXECUTABLES)/jack
+JACK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jack.jar
+JILL_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jill.jar
LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39
# The default PKGDATADIR built in the prebuilt bison is a relative path
@@ -378,10 +450,15 @@
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
DOXYGEN:= doxygen
-AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX)
-AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX)
+AIDL_CPP := $(HOST_OUT_EXECUTABLES)/aidl-cpp$(HOST_EXECUTABLE_SUFFIX)
+ifeq ($(HOST_OS),linux)
+BREAKPAD_DUMP_SYMS := $(HOST_OUT_EXECUTABLES)/dump_syms
+else
+# For non-supported hosts, do not generate breakpad symbols.
+BREAKPAD_GENERATE_SYMBOLS := false
+endif
PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
-SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
+DBUS_GENERATOR := $(HOST_OUT_EXECUTABLES)/dbus-binding-generator
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
@@ -403,28 +480,46 @@
MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh
SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
+IMG2SIMG := $(HOST_OUT_EXECUTABLES)/img2simg$(HOST_EXECUTABLE_SUFFIX)
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
MKTARBALL := build/tools/mktarball.sh
TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
+
+ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
+DEFAULT_JACK_ENABLED:=full
+else
+DEFAULT_JACK_ENABLED:=
+endif
+ifneq ($(ANDROID_JACK_EXTRA_ARGS),)
+DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS)
+else
+DEFAULT_JACK_EXTRA_ARGS := @$(BUILD_SYSTEM)/jack-default.args
+endif
+# Turn off jack warnings by default.
+DEFAULT_JACK_EXTRA_ARGS += --verbose error
+
+JILL := java -Xmx3500m -jar $(JILL_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)
-BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat$(HOST_EXECUTABLE_SUFFIX)
-LINT := prebuilts/sdk/tools/lint
RMTYPEDEFS := $(HOST_OUT_EXECUTABLES)/rmtypedefs
APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg
VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer
BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree
BOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/boot_signer
+FUTILITY := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/futility/futility
+VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh
+FEC := $(HOST_OUT_EXECUTABLES)/fec
-# ACP is always for the build OS, not for the host OS
-ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)
+ifndef TARGET_BUILD_APPS
+ZIPTIME := $(HOST_OUT_EXECUTABLES)/ziptime$(HOST_EXECUTABLE_SUFFIX)
+endif
-# dx is java behind a shell script; no .exe necessary.
-DX := $(HOST_OUT_EXECUTABLES)/dx
-ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
+# ijar converts a .jar file to a smaller .jar file which only has its
+# interfaces.
+IJAR := $(HOST_OUT_EXECUTABLES)/ijar$(BUILD_EXECUTABLE_SUFFIX)
+DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX)
# relocation packer
RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer
@@ -436,20 +531,15 @@
# Tool to merge AndroidManifest.xmls
ANDROID_MANIFEST_MERGER := java -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge
-YACC_HEADER_SUFFIX:= .hpp
-
-# Don't use column under Windows, cygwin or not
-ifeq ($(HOST_OS),windows)
-COLUMN:= cat
-else
COLUMN:= column
-endif
+# We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh.
+ifneq ($(CALLED_FROM_SETUP),true)
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
ifneq ($(HOST_JDK_TOOLS_JAR),)
ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
-$(error Error: could not find jdk tools.jar, please check if your JDK was installed correctly)
+$(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), please check if your JDK was installed correctly)
endif
endif
@@ -458,6 +548,7 @@
ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),)
HOST_JDK_IS_64BIT_VERSION := true
endif
+endif # CALLED_FROM_SETUP not true
# It's called md5 on Mac OS and md5sum on Linux
ifeq ($(HOST_OS),darwin)
@@ -482,6 +573,65 @@
# Set up final options.
# ###############################################################
+ifneq ($(COMMON_GLOBAL_CFLAGS)$(COMMON_GLOBAL_CPPFLAGS),)
+$(warning COMMON_GLOBAL_C(PP)FLAGS changed)
+$(info *** Device configurations are no longer allowed to change the global flags.)
+$(info *** COMMON_GLOBAL_CFLAGS: $(COMMON_GLOBAL_CFLAGS))
+$(info *** COMMON_GLOBAL_CPPFLAGS: $(COMMON_GLOBAL_CPPFLAGS))
+$(error bailing...)
+endif
+
+# These can be changed to modify both host and device modules.
+COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith
+COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG
+
+# Force gcc to always output color diagnostics. Ninja will strip the ANSI
+# color codes if it is not running in a terminal.
+COMMON_GLOBAL_CFLAGS += -fdiagnostics-color
+
+COMMON_GLOBAL_CPPFLAGS:= -Wsign-promo
+COMMON_RELEASE_CPPFLAGS:=
+
+GLOBAL_CFLAGS_NO_OVERRIDE := \
+ -Werror=int-to-pointer-cast \
+ -Werror=pointer-to-int-cast \
+
+GLOBAL_CLANG_CFLAGS_NO_OVERRIDE := \
+ -Werror=address-of-temporary \
+ -Werror=null-dereference \
+ -Werror=return-type \
+
+GLOBAL_CPPFLAGS_NO_OVERRIDE :=
+
+# list of flags to turn specific warnings in to errors
+TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=date-time
+
+# We run gcc/clang with PWD=/proc/self/cwd to remove the $TOP
+# from the debug output. That way two builds in two different
+# directories will create the same output.
+# /proc doesn't exist on Darwin.
+ifeq ($(HOST_OS),linux)
+RELATIVE_PWD := PWD=/proc/self/cwd
+# Remove this useless prefix from the debug output.
+COMMON_GLOBAL_CFLAGS += -fdebug-prefix-map=/proc/self/cwd=
+else
+RELATIVE_PWD :=
+endif
+
+# Allow the C/C++ macros __DATE__ and __TIME__ to be set to the
+# build date and time, so that a build may be repeated.
+# Write the date and time to a file so that the command line
+# doesn't change every time, which would cause ninja to rebuild
+# the files.
+$(shell mkdir -p $(OUT_DIR) && \
+ $(DATE) "+%b %_d %Y" > $(OUT_DIR)/build_c_date.txt && \
+ $(DATE) +%T > $(OUT_DIR)/build_c_time.txt)
+BUILD_DATETIME_C_DATE := $$(cat $(OUT_DIR)/build_c_date.txt)
+BUILD_DATETIME_C_TIME := $$(cat $(OUT_DIR)/build_c_time.txt)
+ifeq ($(OVERRIDE_C_DATE_TIME),true)
+COMMON_GLOBAL_CFLAGS += -Wno-builtin-macro-redefined -D__DATE__="\"$(BUILD_DATETIME_C_DATE)\"" -D__TIME__=\"$(BUILD_DATETIME_C_TIME)\"
+endif
+
HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
@@ -506,7 +656,6 @@
# sure to only specify them for the target compilers checked in to
# the source tree.
TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
-TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
HOST_GLOBAL_CFLAGS += $(HOST_RELEASE_CFLAGS)
HOST_GLOBAL_CPPFLAGS += $(HOST_RELEASE_CPPFLAGS)
@@ -522,7 +671,6 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS += -L$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS += $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_RELEASE_CFLAGS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS += $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_RELEASE_CPPFLAGS)
endif
@@ -538,27 +686,43 @@
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CPPFLAGS += $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_RELEASE_CPPFLAGS)
endif
+ifdef HOST_CROSS_OS
+HOST_CROSS_GLOBAL_CFLAGS += $(filter-out $(HOST_CROSS_UNKNOWN_CFLAGS),$(COMMON_GLOBAL_CFLAGS))
+HOST_CROSS_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
+HOST_CROSS_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
+HOST_CROSS_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
+HOST_CROSS_GLOBAL_LD_DIRS += -L$(HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES)
+HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_CROSS_OUT_HEADERS)
+HOST_CROSS_GLOBAL_CFLAGS += $(HOST_CROSS_RELEASE_CFLAGS)
+HOST_CROSS_GLOBAL_CPPFLAGS += $(HOST_CROSS_RELEASE_CPPFLAGS)
+endif
+
+ifdef BRILLO
+# Add a C define that identifies Brillo targets. __BRILLO__ should only be used
+# to differentiate between Brillo and non-Brillo-but-Android environments. Use
+# __ANDROID__ instead to test if something is being built in an Android-derived
+# environment (including Brillo) as opposed to an entirely different
+# environment (e.g. Chrome OS).
+TARGET_GLOBAL_CFLAGS += -D__BRILLO__
+ifdef TARGET_2ND_ARCH
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS += -D__BRILLO__
+endif
+endif
+
# allow overriding default Java libraries on a per-target basis
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
- TARGET_DEFAULT_JAVA_LIBRARIES := core-libart core-junit ext framework
+ TARGET_DEFAULT_JAVA_LIBRARIES := core-oj core-libart core-junit ext framework okhttp
endif
# Flags for DEX2OAT
+first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3)))
DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
-ifeq ($(TARGET_CPU_VARIANT),)
-ifeq ($(TARGET_ARCH_VARIANT),)
-DEX2OAT_TARGET_CPU_VARIANT := default
-else
-DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_ARCH_VARIANT)
-endif
-else
-DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_CPU_VARIANT)
-endif
+DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT),$(TARGET_ARCH_VARIANT),default)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
ifdef TARGET_2ND_ARCH
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH)
-$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_2ND_CPU_VARIANT)
+$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_2ND_CPU_VARIANT),$(TARGET_2ND_ARCH_VARIANT),default)
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
endif
@@ -573,6 +737,13 @@
HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk
HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk
+# The path where app can reference the support library resources.
+ifdef TARGET_BUILD_APPS
+SUPPORT_LIBRARY_ROOT := $(HISTORICAL_SDK_VERSIONS_ROOT)/current/support
+else
+SUPPORT_LIBRARY_ROOT := frameworks/support
+endif
+
# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N.
# The 'current' version is whatever this source tree is.
#
@@ -611,8 +782,12 @@
# Set up RS prebuilt variables for compatibility library
RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc
-RS_PREBUILT_LIBPATH := -L prebuilts/ndk/8/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
+ifeq (true,$(TARGET_IS_64_BIT))
+RS_PREBUILT_LIBPATH := -L prebuilts/ndk/current/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib
+else
+RS_PREBUILT_LIBPATH := -L prebuilts/ndk/current/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
+endif
# API Level lists for Renderscript Compat lib.
RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index b116283..6e96880 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -4,43 +4,64 @@
my_sanitize := $(strip $(LOCAL_SANITIZE))
-# Keep compatibility for LOCAL_ADDRESS_SANITIZER until all targets have moved to
-# `LOCAL_SANITIZE := address`.
-ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
- my_sanitize += address
+# SANITIZE_HOST is only in effect if the module is already using clang (host
+# modules that haven't set `LOCAL_CLANG := false` and device modules that
+# have set `LOCAL_CLANG := true`.
+my_global_sanitize :=
+ifeq ($(my_clang),true)
+ ifdef LOCAL_IS_HOST_MODULE
+ my_global_sanitize := $(strip $(SANITIZE_HOST))
+
+ # SANITIZE_HOST=true is a deprecated way to say SANITIZE_HOST=address.
+ my_global_sanitize := $(subst true,address,$(my_global_sanitize))
+ else
+ my_global_sanitize := $(strip $(SANITIZE_TARGET))
+ endif
endif
-# And `LOCAL_SANITIZE := never`.
-ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),false)
- my_sanitize := never
+# The sanitizer specified by the environment wins over the module.
+ifneq ($(my_global_sanitize),)
+ my_sanitize := $(my_global_sanitize)
endif
# Don't apply sanitizers to NDK code.
ifdef LOCAL_SDK_VERSION
- my_sanitize := never
+ my_sanitize :=
endif
-# Configure SANITIZE_HOST.
-ifdef LOCAL_IS_HOST_MODULE
- ifeq ($(my_sanitize),)
- my_sanitize := $(strip $(SANITIZE_HOST))
+# Never always wins.
+ifeq ($(LOCAL_SANITIZE),never)
+ my_sanitize :=
+endif
- # SANTIZIZE_HOST=true is a deprecated way to say SANITIZE_HOST=address.
- ifeq ($(my_sanitize),true)
- my_sanitize := address
- endif
-
- # SANITIZE_HOST is only in effect if the module is already using clang (host
- # modules that haven't set `LOCAL_CLANG := false` and device modules that
- # have set `LOCAL_CLANG := true`.
- ifneq ($(my_clang),true)
- my_sanitize :=
+# TSAN is not supported on 32-bit architectures. For non-multilib cases, make
+# its use an error. For multilib cases, don't use it for the 32-bit case.
+ifneq ($(filter thread,$(my_sanitize)),)
+ ifeq ($(my_32_64_bit_suffix),32)
+ ifeq ($(my_module_multilib),both)
+ my_sanitize := $(filter-out thread,$(my_sanitize))
+ else
+ $(error $(LOCAL_PATH): $(LOCAL_MODULE): TSAN cannot be used for 32-bit modules.)
endif
endif
endif
-ifeq ($(my_sanitize),never)
- my_sanitize :=
+# Undefined symbols can occur if a non-sanitized library links
+# sanitized static libraries. That's OK, because the executable
+# always depends on the ASan runtime library, which defines these
+# symbols.
+ifneq ($(strip $(SANITIZE_TARGET)),)
+ ifndef LOCAL_IS_HOST_MODULE
+ ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
+ ifeq ($(my_sanitize),)
+ my_allow_undefined_symbols := true
+ endif
+ endif
+ # Workaround for a bug in AddressSanitizer that breaks stack unwinding.
+ # https://code.google.com/p/address-sanitizer/issues/detail?id=387
+ # Revert when external/compiler-rt is updated past r236014.
+ LOCAL_PACK_MODULE_RELOCATIONS := false
+ endif
endif
# Sanitizers can only be used with clang.
@@ -52,21 +73,30 @@
ifneq ($(filter default-ub,$(my_sanitize)),)
my_sanitize := $(CLANG_DEFAULT_UB_CHECKS)
- my_ldlibs += -ldl
+endif
- ifdef LOCAL_IS_HOST_MODULE
- my_cflags += -fno-sanitize-recover=all
- else
- my_cflags += -fsanitize-undefined-trap-on-error
+ifneq ($(filter coverage,$(my_sanitize)),)
+ ifeq ($(filter address,$(my_sanitize)),)
+ $(error $(LOCAL_PATH): $(LOCAL_MODULE): Use of 'coverage' also requires 'address')
endif
+ my_cflags += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
+ my_sanitize := $(filter-out coverage,$(my_sanitize))
endif
ifneq ($(my_sanitize),)
- fsanitize_arg := $(subst $(space),$(comma),$(my_sanitize)),
+ fsanitize_arg := $(subst $(space),$(comma),$(my_sanitize))
my_cflags += -fsanitize=$(fsanitize_arg)
ifdef LOCAL_IS_HOST_MODULE
+ my_cflags += -fno-sanitize-recover=all
my_ldflags += -fsanitize=$(fsanitize_arg)
+ my_ldlibs += -lrt -ldl
+ else
+ ifeq ($(filter address,$(my_sanitize)),)
+ my_cflags += -fsanitize-trap=all
+ my_cflags += -ftrap-function=abort
+ endif
+ my_shared_libraries += libdl
endif
endif
@@ -78,29 +108,28 @@
ifdef LOCAL_IS_HOST_MODULE
# -nodefaultlibs (provided with libc++) prevents the driver from linking
# libraries needed with -fsanitize=address. http://b/18650275 (WAI)
- my_ldlibs += -lm -ldl -lpthread
+ my_ldlibs += -lm -lpthread
my_ldflags += -Wl,--no-as-needed
else
+ my_cflags += -mllvm -asan-globals=0
# ASan runtime library must be the first in the link order.
my_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RUNTIME_LIBRARY) \
$(my_shared_libraries) \
$(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
- my_ldflags += -Wl,-rpath,$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RPATH)
+
+ my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
+ # Make sure linker_asan get installed.
+ $(LOCAL_INSTALLED_MODULE) : | $(PRODUCT_OUT)$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
endif
endif
ifneq ($(filter undefined,$(my_sanitize)),)
- my_cflags += -fno-sanitize-recover=all
-
- ifdef LOCAL_IS_HOST_MODULE
- my_ldlibs += -ldl
- else
+ ifndef LOCAL_IS_HOST_MODULE
$(error ubsan is not yet supported on the target)
endif
endif
-
ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),)
recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_RECOVER)),
my_cflags += -fsanitize-recover=$(recover_arg)
diff --git a/core/configure_local_jack.mk b/core/configure_local_jack.mk
new file mode 100644
index 0000000..2270c88
--- /dev/null
+++ b/core/configure_local_jack.mk
@@ -0,0 +1,39 @@
+#
+# 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.
+#
+
+ifdef ANDROID_FORCE_JACK_ENABLED
+LOCAL_JACK_ENABLED := $(ANDROID_FORCE_JACK_ENABLED)
+endif
+
+LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
+LOCAL_MODULE := $(strip $(LOCAL_MODULE))
+
+ifneq ($(LOCAL_JACK_ENABLED),full)
+ifneq ($(LOCAL_JACK_ENABLED),incremental)
+ifdef LOCAL_JACK_ENABLED
+ifneq ($(LOCAL_JACK_ENABLED),disabled)
+$(error $(LOCAL_PATH): invalid LOCAL_JACK_ENABLED "$(LOCAL_JACK_ENABLED)" for $(LOCAL_MODULE))
+endif
+endif
+LOCAL_JACK_ENABLED :=
+endif
+endif
+
+ifdef $(LOCAL_MODULE).JACK_VERSION
+LOCAL_JACK_VERSION := $($(LOCAL_MODULE).JACK_VERSION)
+else
+LOCAL_JACK_VERSION := $(JACK_DEFAULT_VERSION)
+endif
diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk
index 630fe4e..37be1f7 100644
--- a/core/cxx_stl_setup.mk
+++ b/core/cxx_stl_setup.mk
@@ -1,6 +1,6 @@
#############################################################
## Set up flags based on LOCAL_CXX_STL.
-## Input variables: LOCAL_CXX_STL
+## Input variables: LOCAL_CXX_STL, my_prefix
## Output variables: My_cflags, my_c_includes, my_shared_libraries, etc.
#############################################################
@@ -14,7 +14,7 @@
my_cxx_stl := libc++_static
endif
- ifdef USE_MINGW
+ ifeq ($($(my_prefix)OS),windows)
# libc++ is not supported on mingw.
my_cxx_stl := libstdc++
endif
@@ -24,13 +24,37 @@
endif
else
my_cxx_stl := $(strip $(LOCAL_CXX_STL))
+ ifdef LOCAL_SDK_VERSION
+ # The NDK has historically used LOCAL_NDK_STL_VARIANT to specify the
+ # STL. An Android.mk that specifies both LOCAL_CXX_STL and
+ # LOCAL_SDK_VERSION will incorrectly try (and most likely fail) to use
+ # the platform STL in an NDK binary. Emit an error to direct the user
+ # toward the correct option.
+ #
+ # Note that we could also accept LOCAL_CXX_STL as an alias for
+ # LOCAL_NDK_STL_VARIANT (and in fact soong does use the same name), but
+ # the two options use different names for the STLs.
+ $(error $(LOCAL_PATH): $(LOCAL_MODULE): Must use LOCAL_NDK_STL_VARIANT rather than LOCAL_CXX_STL for NDK binaries)
+ endif
+ ifdef LOCAL_IS_HOST_MODULE
+ ifeq ($($(my_prefix)OS),windows)
+ ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
+ # libc++ is not supported on mingw.
+ my_cxx_stl := libstdc++
+ endif
+ endif
+ endif
endif
# Yes, this is actually what the clang driver does.
-HOST_linux_dynamic_gcclibs := -lgcc_s -lgcc -lc -lgcc_s -lgcc
-HOST_linux_static_gcclibs := -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
-HOST_darwin_dynamic_gcclibs := -lc -lSystem
-HOST_darwin_static_gcclibs := NO_STATIC_HOST_BINARIES_ON_DARWIN
+linux_dynamic_gcclibs := -lgcc_s -lgcc -lc -lgcc_s -lgcc
+linux_static_gcclibs := -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
+darwin_dynamic_gcclibs := -lc -lSystem
+darwin_static_gcclibs := NO_STATIC_HOST_BINARIES_ON_DARWIN
+windows_dynamic_gcclibs := \
+ -lmsvcr110 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 \
+ -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
+windows_static_gcclibs := NO_STATIC_HOST_BINARIES_ON_WINDOWS
my_link_type := dynamic
ifdef LOCAL_IS_HOST_MODULE
@@ -48,10 +72,15 @@
ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
my_cflags += -D_USING_LIBCXX
- my_c_includes += external/libcxx/include
+ # Note that the structure of this means that LOCAL_CXX_STL := libc++ will
+ # use the static libc++ for static executables.
ifeq ($(my_link_type),dynamic)
- my_shared_libraries += libc++
+ ifeq ($(my_cxx_stl),libc++)
+ my_shared_libraries += libc++
+ else
+ my_static_libraries += libc++_static
+ endif
else
my_static_libraries += libc++_static
endif
@@ -60,10 +89,11 @@
my_cppflags += -nostdinc++
my_ldflags += -nodefaultlibs
my_ldlibs += -lpthread -lm
- my_ldlibs += $($(my_prefix)$(HOST_OS)_$(my_link_type)_gcclibs)
+ my_ldlibs += $($($(my_prefix)OS)_$(my_link_type)_gcclibs)
else
ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_static_libraries += libunwind_llvm
+ my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
endif
ifeq ($(my_link_type),static)
@@ -74,9 +104,6 @@
endif
else ifeq ($(my_cxx_stl),ndk)
# Using an NDK STL. Handled in binary.mk.
- ifndef LOCAL_IS_HOST_MODULE
- my_system_shared_libraries += libstdc++
- endif
else ifeq ($(my_cxx_stl),libstdc++)
# Using bionic's basic libstdc++. Not actually an STL. Only around until the
# tree is in good enough shape to not need it.
@@ -89,7 +116,7 @@
ifdef LOCAL_IS_HOST_MODULE
my_cppflags += -nostdinc++
my_ldflags += -nodefaultlibs
- my_ldlibs += $($(my_prefix)$(HOST_OS)_$(my_link_type)_gcclibs)
+ my_ldlibs += $($($(my_prefix)OS)_$(my_link_type)_gcclibs)
endif
else
$(error $(LOCAL_PATH): $(LOCAL_MODULE): $(my_cxx_stl) is not a supported STL.)
diff --git a/core/definitions.mk b/core/definitions.mk
index b6e5277..78b607b 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -87,11 +87,17 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES :=
HOST_DEPENDENCIES_ON_SHARED_LIBRARIES :=
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES :=
+HOST_CROSS_DEPENDENCIES_ON_SHARED_LIBRARIES :=
# Generated class file names for Android resource.
# They are escaped and quoted so can be passed safely to a bash command.
ANDROID_RESOURCE_GENERATED_CLASSES := 'R.class' 'R$$*.class' 'Manifest.class' 'Manifest$$*.class'
+# Display names for various build targets
+TARGET_DISPLAY := target
+HOST_DISPLAY := host
+HOST_CROSS_DISPLAY := host cross
+
###########################################################
## Debugging; prints a variable list to stdout
###########################################################
@@ -126,6 +132,7 @@
define my-dir
$(strip \
$(eval LOCAL_MODULE_MAKEFILE := $$(lastword $$(MAKEFILE_LIST))) \
+ $(eval LOCAL_MODULE_MAKEFILE_DEP := $(if $(BUILDING_WITH_NINJA),,$$(LOCAL_MODULE_MAKEFILE))) \
$(if $(filter $(BUILD_SYSTEM)/% $(OUT_DIR)/%,$(LOCAL_MODULE_MAKEFILE)), \
$(error my-dir must be called before including any other makefile.) \
, \
@@ -135,11 +142,27 @@
endef
###########################################################
+## Remove any makefiles that are being handled by soong
+###########################################################
+ifeq ($(USE_SOONG),true)
+define filter-soong-makefiles
+$(foreach mk,$(1),\
+ $(if $(wildcard $(patsubst %/Android.mk,%/Android.bp,$(mk))),\
+ $(info skipping $(mk) ...),\
+ $(mk)))
+endef
+else
+define filter-soong-makefiles
+$(1)
+endef
+endif
+
+###########################################################
## Retrieve a list of all makefiles immediately below some directory
###########################################################
define all-makefiles-under
-$(wildcard $(1)/*/Android.mk)
+$(sort $(call filter-soong-makefiles,$(wildcard $(1)/*/Android.mk)))
endef
###########################################################
@@ -150,8 +173,9 @@
# $(1): directory to search under
# Ignores $(1)/Android.mk
define first-makefiles-under
-$(shell build/tools/findleaves.py --prune=$(OUT_DIR) --prune=.repo --prune=.git \
- --mindepth=2 $(1) Android.mk)
+$(call filter-soong-makefiles,\
+ $(shell build/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) \
+ --mindepth=2 $(1) Android.mk))
endef
###########################################################
@@ -171,7 +195,48 @@
# $(1): List of directories to look for under this directory
define all-named-subdir-makefiles
-$(wildcard $(addsuffix /Android.mk, $(addprefix $(call my-dir)/,$(1))))
+$(sort $(call filter-soong-makefiles,\
+ $(wildcard $(addsuffix /Android.mk, $(addprefix $(call my-dir)/,$(1))))))
+endef
+
+###########################################################
+## Find all of the directories under the named directories with
+## the specified name.
+## Meant to be used like:
+## INC_DIRS := $(call all-named-dirs-under,inc,.)
+###########################################################
+
+define all-named-dirs-under
+$(call find-subdir-files,$(2) -type d -name "$(1)")
+endef
+
+###########################################################
+## Find all the directories under the current directory that
+## haves name that match $(1)
+###########################################################
+
+define all-subdir-named-dirs
+$(call all-named-dirs-under,$(1),.)
+endef
+
+###########################################################
+## Find all of the files under the named directories with
+## the specified name.
+## Meant to be used like:
+## SRC_FILES := $(call all-named-files-under,*.h,src tests)
+###########################################################
+
+define all-named-files-under
+$(call find-files-in-subdirs,$(LOCAL_PATH),"$(1)",$(2))
+endef
+
+###########################################################
+## Find all of the files under the current directory with
+## the specified name.
+###########################################################
+
+define all-subdir-named-files
+$(call all-named-files-under,$(1),.)
endef
###########################################################
@@ -181,10 +246,7 @@
###########################################################
define all-java-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.java" -and -not -name ".*") \
- )
+$(call all-named-files-under,*.java,$(1))
endef
###########################################################
@@ -203,10 +265,7 @@
###########################################################
define all-c-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.c" -and -not -name ".*") \
- )
+$(call all-named-files-under,*.c,$(1))
endef
###########################################################
@@ -219,16 +278,36 @@
endef
###########################################################
+## Find all of the cpp files under the named directories.
+## LOCAL_CPP_EXTENSION is respected if set.
+## Meant to be used like:
+## SRC_FILES := $(call all-cpp-files-under,src tests)
+###########################################################
+
+define all-cpp-files-under
+$(sort $(patsubst ./%,%, \
+ $(shell cd $(LOCAL_PATH) ; \
+ find -L $(1) -name "*$(or $(LOCAL_CPP_EXTENSION),.cpp)" -and -not -name ".*") \
+ ))
+endef
+
+###########################################################
+## Find all of the cpp files from here. Meant to be used like:
+## SRC_FILES := $(call all-subdir-cpp-files)
+###########################################################
+
+define all-subdir-cpp-files
+$(call all-cpp-files-under,.)
+endef
+
+###########################################################
## Find all files named "I*.aidl" under the named directories,
## which must be relative to $(LOCAL_PATH). The returned list
## is relative to $(LOCAL_PATH).
###########################################################
define all-Iaidl-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "I*.aidl" -and -not -name ".*") \
- )
+$(call all-named-files-under,I*.aidl,$(1))
endef
###########################################################
@@ -246,10 +325,7 @@
###########################################################
define all-logtags-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.logtags" -and -not -name ".*") \
- )
+$(call all-named-files-under,*.logtags,$(1))
endef
###########################################################
@@ -259,10 +335,7 @@
###########################################################
define all-proto-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.proto" -and -not -name ".*") \
- )
+$(call all-named-files-under,*.proto,$(1))
endef
###########################################################
@@ -272,10 +345,7 @@
###########################################################
define all-renderscript-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*") \
- )
+$(call find-subdir-files,$(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*")
endef
###########################################################
@@ -285,10 +355,7 @@
###########################################################
define all-S-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.S" -and -not -name ".*") \
- )
+$(call all-named-files-under,*.S,$(1))
endef
###########################################################
@@ -298,10 +365,7 @@
###########################################################
define all-html-files-under
-$(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.html" -and -not -name ".*") \
- )
+$(call all-named-files-under,*.html,$(1))
endef
###########################################################
@@ -319,7 +383,7 @@
###########################################################
define find-subdir-files
-$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) ; find -L $(1)))
+$(sort $(patsubst ./%,%,$(shell cd $(LOCAL_PATH) ; find -L $(1))))
endef
###########################################################
@@ -331,8 +395,8 @@
###########################################################
define find-subdir-subdir-files
-$(filter-out $(patsubst %,$(1)/%,$(3)),$(patsubst ./%,%,$(shell cd \
- $(LOCAL_PATH) ; find -L $(1) -maxdepth 1 -name $(2))))
+$(sort $(filter-out $(patsubst %,$(1)/%,$(3)),$(patsubst ./%,%,$(shell cd \
+ $(LOCAL_PATH) ; find -L $(1) -maxdepth 1 -name $(2)))))
endef
###########################################################
@@ -341,10 +405,10 @@
###########################################################
define find-subdir-assets
-$(if $(1),$(patsubst ./%,%, \
+$(sort $(if $(1),$(patsubst ./%,%, \
$(shell if [ -d $(1) ] ; then cd $(1) ; find ./ -not -name '.*' -and -type f -and -not -type l ; fi)), \
$(warning Empty argument supplied to find-subdir-assets) \
-)
+))
endef
###########################################################
@@ -352,11 +416,11 @@
###########################################################
define find-other-java-files
- $(call find-subdir-files,$(1) -name "*.java" -and -not -name ".*")
+$(call all-java-files-under,$(1))
endef
define find-other-html-files
- $(call find-subdir-files,$(1) -name "*.html" -and -not -name ".*")
+$(call all-html-files-under,$(1))
endef
###########################################################
@@ -369,10 +433,10 @@
###########################################################
define find-files-in-subdirs
-$(patsubst ./%,%, \
+$(sort $(patsubst ./%,%, \
$(shell cd $(1) ; \
find -L $(3) -name $(2) -and -not -name ".*") \
- )
+ ))
endef
###########################################################
@@ -385,7 +449,7 @@
define find-parent-file
$(strip \
- $(eval _fpf := $(wildcard $(foreach f, $(2), $(strip $(1))/$(f)))) \
+ $(eval _fpf := $(sort $(wildcard $(foreach f, $(2), $(strip $(1))/$(f))))) \
$(if $(_fpf),$(_fpf), \
$(if $(filter-out ./ .,$(1)), \
$(call find-parent-file,$(patsubst %/,%,$(dir $(1))),$(2)) \
@@ -403,6 +467,14 @@
endef
###########################################################
+## Reverse order of a list
+###########################################################
+
+define reverse-list
+$(if $(1),$(call reverse-list,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))
+endef
+
+###########################################################
## The intermediates directory. Where object files go for
## a given target. We could technically get away without
## the "_intermediates" suffix on the directory, but it's
@@ -414,7 +486,8 @@
# $(2): target name, like "NotePad"
# $(3): if non-empty, this is a HOST target.
# $(4): if non-empty, force the intermediates to be COMMON
-# $(5): if non-empty, force the intermedistes to be for the 2nd arch
+# $(5): if non-empty, force the intermediates to be for the 2nd arch
+# $(6): if non-empty, force the intermediates to be for the host cross os
define intermediates-dir-for
$(strip \
$(eval _idfClass := $(strip $(1))) \
@@ -423,7 +496,7 @@
$(eval _idfName := $(strip $(2))) \
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
- $(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
+ $(eval _idfPrefix := $(if $(strip $(3)),$(if $(strip $(6)),HOST_CROSS,HOST),TARGET)) \
$(eval _idf2ndArchPrefix := $(if $(strip $(5)),$(TARGET_2ND_ARCH_VAR_PREFIX))) \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
@@ -441,13 +514,14 @@
#
# $(1): if non-empty, force the intermediates to be COMMON
# $(2): if non-empty, force the intermediates to be for the 2nd arch
+# $(3): if non-empty, force the intermediates to be for the host cross os
define local-intermediates-dir
$(strip \
$(if $(strip $(LOCAL_MODULE_CLASS)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-intermediates-dir)) \
$(if $(strip $(LOCAL_MODULE)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-intermediates-dir)) \
- $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1),$(2)) \
+ $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1),$(2),$(3)) \
)
endef
@@ -474,7 +548,7 @@
$(error $(LOCAL_PATH): Name not defined in call to generated-sources-dir-for)) \
$(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
- $(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN_COMMON)) \
+ $(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_GEN)) \
, \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN)) \
) \
@@ -602,6 +676,36 @@
endef
###########################################################
+## Convert "core ext framework" to "out/.../classes.jack ..."
+## $(1): library list
+## $(2): Non-empty if IS_HOST_MODULE
+###########################################################
+
+# $(1): library name
+# $(2): Non-empty if IS_HOST_MODULE
+define _jack-lib-full-classes
+$(call _java-lib-dir,$(1),$(2))/classes.jack
+endef
+
+# $(1): library name list
+# $(2): Non-empty if IS_HOST_MODULE
+define jack-lib-files
+$(foreach lib,$(1),$(call _jack-lib-full-classes,$(lib),$(2)))
+endef
+
+# $(1): library name
+# $(2): Non-empty if IS_HOST_MODULE
+define _jack-lib-full-dep
+$(call _jack-lib-full-classes,$(1),$(2))
+endef
+
+# $(1): library name list
+# $(2): Non-empty if IS_HOST_MODULE
+define jack-lib-deps
+$(foreach lib,$(1),$(call _jack-lib-full-dep,$(lib),$(2)))
+endef
+
+###########################################################
## Run rot13 on a string
## $(1): the string. Must be one line.
###########################################################
@@ -764,52 +868,13 @@
define pretty
@echo $1
endef
-hide := @
else
define pretty
endef
-hide :=
endif
###########################################################
-## Dump the variables that are associated with targets
-###########################################################
-
-define dump-module-variables
-@echo all_dependencies=$^
-@echo PRIVATE_YACCFLAGS=$(PRIVATE_YACCFLAGS);
-@echo PRIVATE_CFLAGS=$(PRIVATE_CFLAGS);
-@echo PRIVATE_CPPFLAGS=$(PRIVATE_CPPFLAGS);
-@echo PRIVATE_DEBUG_CFLAGS=$(PRIVATE_DEBUG_CFLAGS);
-@echo PRIVATE_C_INCLUDES=$(PRIVATE_C_INCLUDES);
-@echo PRIVATE_LDFLAGS=$(PRIVATE_LDFLAGS);
-@echo PRIVATE_LDLIBS=$(PRIVATE_LDLIBS);
-@echo PRIVATE_ARFLAGS=$(PRIVATE_ARFLAGS);
-@echo PRIVATE_AAPT_FLAGS=$(PRIVATE_AAPT_FLAGS);
-@echo PRIVATE_DX_FLAGS=$(PRIVATE_DX_FLAGS);
-@echo PRIVATE_JAVACFLAGS=$(PRIVATE_JAVACFLAGS);
-@echo PRIVATE_JAVA_LIBRARIES=$(PRIVATE_JAVA_LIBRARIES);
-@echo PRIVATE_ALL_SHARED_LIBRARIES=$(PRIVATE_ALL_SHARED_LIBRARIES);
-@echo PRIVATE_ALL_STATIC_LIBRARIES=$(PRIVATE_ALL_STATIC_LIBRARIES);
-@echo PRIVATE_ALL_WHOLE_STATIC_LIBRARIES=$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES);
-@echo PRIVATE_ALL_OBJECTS=$(PRIVATE_ALL_OBJECTS);
-@echo PRIVATE_NO_CRT=$(PRIVATE_NO_CRT);
-endef
-
-###########################################################
-## Commands for using sed to replace given variable values
-###########################################################
-
-define transform-variables
-@mkdir -p $(dir $@)
-@echo "Sed: $(if $(PRIVATE_MODULE),$(PRIVATE_MODULE),$@) <= $<"
-$(hide) sed $(foreach var,$(REPLACE_VARS),-e "s/{{$(var)}}/$(subst /,\/,$(PWD)/$($(var)))/g") $< >$@
-$(hide) if [ "$(suffix $@)" = ".sh" ]; then chmod a+rx $@; fi
-endef
-
-
-###########################################################
-## Commands for munging the dependency files GCC generates
+## Commands for munging the dependency files the compiler generates
###########################################################
# $(1): the input .d file
# $(2): the output .P file
@@ -825,32 +890,41 @@
endef
###########################################################
+## Commands for including the dependency files the compiler generates
+###########################################################
+# $(1): the .P file
+# $(2): the main build target
+ifeq ($(BUILDING_WITH_NINJA),true)
+define include-depfile
+$(eval $(2) : .KATI_DEPFILE := $1)
+endef
+else
+define include-depfile
+$(eval -include $1)
+endef
+endif
+
+###########################################################
## Commands for running lex
###########################################################
-define transform-l-to-cpp
-@mkdir -p $(dir $@)
+define transform-l-to-c-or-cpp
@echo "Lex: $(PRIVATE_MODULE) <= $<"
+@mkdir -p $(dir $@)
$(hide) $(LEX) -o$@ $<
endef
###########################################################
## Commands for running yacc
##
-## Because the extension of c++ files can change, the
-## extension must be specified in $1.
-## E.g, "$(call transform-y-to-cpp,.cpp)"
###########################################################
-define transform-y-to-cpp
-@mkdir -p $(dir $@)
+define transform-y-to-c-or-cpp
@echo "Yacc: $(PRIVATE_MODULE) <= $<"
-$(YACC) $(PRIVATE_YACCFLAGS) -o $@ $<
-touch $(@:$1=$(YACC_HEADER_SUFFIX))
-echo '#ifndef '$(@F:$1=_h) > $(@:$1=.h)
-echo '#define '$(@F:$1=_h) >> $(@:$1=.h)
-cat $(@:$1=$(YACC_HEADER_SUFFIX)) >> $(@:$1=.h)
-echo '#endif' >> $(@:$1=.h)
+@mkdir -p $(dir $@)
+$(YACC) $(PRIVATE_YACCFLAGS) \
+ --defines=$(basename $@).h \
+ -o $@ $<
endef
###########################################################
@@ -895,6 +969,24 @@
## Commands to compile RenderScript to C++
###########################################################
+## Merge multiple .d files generated by llvm-rs-cc. This is necessary
+## because ninja can handle only a single depfile per build target.
+## We assume .d files start with two targets and their prerequisites
+## follow. The first line is for the stamp file and the second line is
+## for .bc file. There's no way to let ninja know dependencies to .bc
+## files, so we give up build targets for .bc files. As we write the
+## .stamp file as the target by ourselves, the sed script removes the
+## first two lines and append a backslash to the last line to
+## concatenate contents of multiple files.
+# $(1): .d files to be merged
+# $(2): merged .d file
+define _merge-renderscript-d
+$(hide) echo '$@: $(backslash)' > $2
+$(foreach d,$1, \
+ $(hide) sed '1d; 2d; s/\( \\\)\?$$/ \\/' $d >> $2$(newline))
+$(hide) echo >> $2
+endef
+
define transform-renderscripts-to-cpp-and-bc
@echo "RenderScript: $(PRIVATE_MODULE) <= $(PRIVATE_RS_SOURCE_FILES)"
$(hide) rm -rf $(PRIVATE_RS_OUTPUT_DIR)
@@ -904,11 +996,12 @@
-d $(PRIVATE_RS_OUTPUT_DIR) \
-a $@ -MD \
-reflect-c++ \
+ $(addprefix -target-api , $(PRIVATE_RS_TARGET_API)) \
$(PRIVATE_RS_FLAGS) \
$(addprefix -I , $(PRIVATE_RS_INCLUDES)) \
$(PRIVATE_RS_SOURCE_FILES)
- $(foreach d,$(PRIVATE_DEP_FILES),\
- $(call transform-d-to-p-args,$(d),$(d:%.d=%.P))$(newline))
+$(call _merge-renderscript-d,$(PRIVATE_DEP_FILES),$@.d)
+$(call transform-d-to-p-args,$@.d,$@.P)
$(hide) mkdir -p $(dir $@)
$(hide) touch $@
endef
@@ -925,6 +1018,26 @@
endef
#$(AIDL) $(PRIVATE_AIDL_FLAGS) $< - | indent -nut -br -npcs -l1000 > $@
+define transform-aidl-to-cpp
+@mkdir -p $(dir $@)
+@mkdir -p $(PRIVATE_HEADER_OUTPUT_DIR)
+@echo "Generating C++ from AIDL: $(PRIVATE_MODULE) <= $<"
+$(hide) $(AIDL_CPP) -d$(basename $@).aidl.P $(PRIVATE_AIDL_FLAGS) \
+ $< $(PRIVATE_HEADER_OUTPUT_DIR) $@
+endef
+
+## Given a .aidl file path generate the rule to compile it a .cpp file.
+# $(1): a .aidl source file
+# $(2): a directory to place the generated .cpp files in
+# $(3): name of a variable to add the path to the generated source file to
+#
+# You must call this with $(eval).
+define define-aidl-cpp-rule
+define-aidl-cpp-rule-src := $(patsubst %.aidl,%$(LOCAL_CPP_EXTENSION),$(subst ../,dotdot/,$(addprefix $(2)/,$(1))))
+$$(define-aidl-cpp-rule-src) : $(LOCAL_PATH)/$(1) $(AIDL_CPP)
+ $$(transform-aidl-to-cpp)
+$(3) += $$(define-aidl-cpp-rule-src)
+endef
###########################################################
## Commands for running java-event-log-tags.py
@@ -957,15 +1070,40 @@
endef
######################################################################
-## Commands for running protoc to compile .proto into .pb.cc and .pb.h
+## Commands for running protoc to compile .proto into .pb.cc (or.pb.c) and .pb.h
######################################################################
define transform-proto-to-cc
-@mkdir -p $(dir $@)
@echo "Protoc: $@ <= $<"
+@mkdir -p $(dir $@)
$(hide) $(PROTOC) \
$(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
$(PRIVATE_PROTOC_FLAGS) \
- --cpp_out=$(PRIVATE_PROTO_CC_OUTPUT_DIR) $<
+ $<
+endef
+
+
+######################################################################
+## Commands for generating DBus adaptors from .dbus-xml files.
+######################################################################
+define generate-dbus-adaptors
+@echo "Generating DBus adaptors for $(PRIVATE_MODULE)"
+@mkdir -p $(dir $@)
+$(hide) $(DBUS_GENERATOR) \
+ --service-config=$(PRIVATE_DBUS_SERVICE_CONFIG) \
+ --adaptor=$@ \
+ $<
+endef
+
+######################################################################
+## Commands for generating DBus proxies from .dbus-xml files.
+######################################################################
+define generate-dbus-proxies
+@echo "Generating DBus proxies for $(PRIVATE_MODULE)"
+@mkdir -p $(dir $@)
+$(hide) $(DBUS_GENERATOR) \
+ --service-config=$(PRIVATE_DBUS_SERVICE_CONFIG) \
+ --proxy=$@ \
+ $(filter %.dbus-xml,$^)
endef
@@ -974,9 +1112,9 @@
###########################################################
define transform-cpp-to-o
-@mkdir -p $(dir $@)
@echo "target $(PRIVATE_ARM_MODE) C++: $(PRIVATE_MODULE) <= $<"
-$(hide) $(PRIVATE_CXX) \
+@mkdir -p $(dir $@)
+$(hide) $(RELATIVE_PWD) $(PRIVATE_CXX) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
$(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
@@ -994,8 +1132,8 @@
$(PRIVATE_CFLAGS) \
$(PRIVATE_CPPFLAGS) \
$(PRIVATE_DEBUG_CFLAGS) \
- $(GLOBAL_CFLAGS_NO_OVERRIDE) \
- $(GLOBAL_CPPFLAGS_NO_OVERRIDE) \
+ $(PRIVATE_CFLAGS_NO_OVERRIDE) \
+ $(PRIVATE_CPPFLAGS_NO_OVERRIDE) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
$(transform-d-to-p)
endef
@@ -1008,7 +1146,7 @@
# $(1): extra flags
define transform-c-or-s-to-o-no-deps
@mkdir -p $(dir $@)
-$(hide) $(PRIVATE_CC) \
+$(hide) $(RELATIVE_PWD) $(PRIVATE_CC) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
$(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
@@ -1032,7 +1170,7 @@
$(PRIVATE_CFLAGS) \
$(PRIVATE_CONLYFLAGS) \
$(PRIVATE_DEBUG_CFLAGS) \
- $(GLOBAL_CFLAGS_NO_OVERRIDE))
+ $(PRIVATE_CFLAGS_NO_OVERRIDE))
endef
define transform-s-to-o-no-deps
@@ -1081,15 +1219,15 @@
###########################################################
define transform-host-cpp-to-o
+@echo "$($(PRIVATE_PREFIX)DISPLAY) C++: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
-@echo "host C++: $(PRIVATE_MODULE) <= $<"
-$(hide) $(PRIVATE_CXX) \
+$(hide) $(RELATIVE_PWD) $(PRIVATE_CXX) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
$(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
- $(HOST_PROJECT_INCLUDES) \
+ $($(PRIVATE_PREFIX)PROJECT_INCLUDES) \
$(PRIVATE_HOST_C_INCLUDES)))) \
-c \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
@@ -1099,6 +1237,8 @@
$(PRIVATE_CFLAGS) \
$(PRIVATE_CPPFLAGS) \
$(PRIVATE_DEBUG_CFLAGS) \
+ $(PRIVATE_CFLAGS_NO_OVERRIDE) \
+ $(PRIVATE_CPPFLAGS_NO_OVERRIDE) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
$(transform-d-to-p)
endef
@@ -1111,13 +1251,13 @@
# $(1): extra flags
define transform-host-c-or-s-to-o-no-deps
@mkdir -p $(dir $@)
-$(hide) $(PRIVATE_CC) \
+$(hide) $(RELATIVE_PWD) $(PRIVATE_CC) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
$(shell cat $(PRIVATE_IMPORT_INCLUDES)) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
- $(HOST_PROJECT_INCLUDES) \
+ $($(PRIVATE_PREFIX)PROJECT_INCLUDES) \
$(PRIVATE_HOST_C_INCLUDES)))) \
-c \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
@@ -1125,16 +1265,17 @@
$(PRIVATE_HOST_GLOBAL_CONLYFLAGS) \
) \
$(1) \
+ $(PRIVATE_CFLAGS_NO_OVERRIDE) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
endef
define transform-host-c-to-o-no-deps
-@echo "host C: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) C: $(PRIVATE_MODULE) <= $<"
$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_CONLYFLAGS) $(PRIVATE_DEBUG_CFLAGS))
endef
define transform-host-s-to-o-no-deps
-@echo "host asm: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) asm: $(PRIVATE_MODULE) <= $<"
$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_ASFLAGS))
endef
@@ -1153,7 +1294,7 @@
###########################################################
define transform-host-m-to-o-no-deps
-@echo "host ObjC: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) ObjC: $(PRIVATE_MODULE) <= $<"
$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
endef
@@ -1162,6 +1303,14 @@
$(transform-d-to-p)
endef
+###########################################################
+## Commands for running gcc to compile a host Objective-C++ file
+###########################################################
+
+define transform-host-mm-to-o
+$(transform-host-cpp-to-o)
+endef
+
###########################################################
## Rules to compile a single C/C++ source with ../ in the path
@@ -1246,7 +1395,6 @@
# $(1): the full path of the source static library.
define _extract-and-include-single-target-whole-static-lib
-@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]"
$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\
rm -rf $$ldir; \
mkdir -p $$ldir; \
@@ -1274,7 +1422,6 @@
# $(1): the full path of the source static library.
define extract-and-include-whole-static-libs-first
$(if $(strip $(1)),
-@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]"
$(hide) cp $(1) $@)
endef
@@ -1287,10 +1434,10 @@
# Explicitly delete the archive first so that ar doesn't
# try to add to an existing archive.
define transform-o-to-static-lib
+@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
@rm -f $@
$(extract-and-include-target-whole-static-libs)
-@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
$(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
@@ -1302,7 +1449,6 @@
# $(1): the full path of the source static library.
define _extract-and-include-single-host-whole-static-lib
-@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]"
$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\
rm -rf $$ldir; \
mkdir -p $$ldir; \
@@ -1310,19 +1456,19 @@
lib_to_include=$$ldir/$(notdir $(1)); \
filelist=; \
subdir=0; \
- for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) t $(1) | \grep '\.o$$'`; do \
+ for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) t $(1) | \grep '\.o$$'`; do \
if [ -e $$ldir/$$f ]; then \
mkdir $$ldir/$$subdir; \
ext=$$subdir/; \
subdir=$$((subdir+1)); \
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) m $$lib_to_include $$f; \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) m $$lib_to_include $$f; \
else \
ext=; \
fi; \
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
filelist="$$filelist $$ldir/$$ext$$f"; \
done ; \
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_ARFLAGS) \
$(PRIVATE_ARFLAGS) $@ $$filelist
endef
@@ -1336,12 +1482,12 @@
# Explicitly delete the archive first so that ar doesn't
# try to add to an existing archive.
define transform-host-o-to-static-lib
+@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticLib: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
@rm -f $@
$(extract-and-include-host-whole-static-libs)
-@echo "host StaticLib: $(PRIVATE_MODULE) ($@)"
-$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) \
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
+$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_ARFLAGS) \
$(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
endef
@@ -1355,10 +1501,11 @@
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
- -Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
- -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
+ -Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
+ -Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
-shared -Wl,-soname,$(notdir $@) \
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
) \
@@ -1379,14 +1526,14 @@
endif
define transform-host-o-to-shared-lib
+@echo "$($(PRIVATE_PREFIX)DISPLAY) SharedLib: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
-@echo "host SharedLib: $(PRIVATE_MODULE) ($@)"
$(transform-host-o-to-shared-lib-inner)
endef
define transform-host-o-to-package
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Package: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
-@echo "host Package: $(PRIVATE_MODULE) ($@)"
$(transform-host-o-to-shared-lib-inner)
endef
@@ -1401,7 +1548,7 @@
-Wl,--gc-sections \
$(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl$(comma)-shared) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
+ $(PRIVATE_TARGET_CRTBEGIN_SO_O) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
@@ -1409,25 +1556,23 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBPROFILE_RT)) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(PRIVATE_TARGET_LIBGCC) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \
+ $(PRIVATE_TARGET_CRTEND_SO_O) \
$(PRIVATE_LDLIBS)
endef
define transform-o-to-shared-lib
-@mkdir -p $(dir $@)
@echo "target SharedLib: $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
$(transform-o-to-shared-lib-inner)
endef
-
###########################################################
## Commands for filtering a target executable or library
###########################################################
@@ -1438,15 +1583,15 @@
endif
define transform-to-stripped
-@mkdir -p $(dir $@)
@echo "target Strip: $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
$(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ \
$(if $(PRIVATE_NO_DEBUGLINK),,$(TARGET_STRIP_EXTRA))
endef
define transform-to-stripped-keep-symbols
-@mkdir -p $(dir $@)
@echo "target Strip (keep symbols): $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
$(hide) $(PRIVATE_OBJCOPY) \
`$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "-R " $$2}' | xargs` \
$(TARGET_STRIP_KEEP_SYMBOLS_EXTRA) $< $@
@@ -1457,8 +1602,8 @@
###########################################################
define pack-elf-relocations
-$(copy-file-to-target)
@echo "target Pack Relocations: $(PRIVATE_MODULE) ($@)"
+$(copy-file-to-target)
$(hide) $(RELOCATION_PACKER) $@
endef
@@ -1469,12 +1614,12 @@
define transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -pie \
-nostdlib -Bdynamic \
- -Wl,-dynamic-linker,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_LINKER) \
+ -Wl,-dynamic-linker,$(PRIVATE_LINKER) \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
+ $(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
@@ -1482,21 +1627,20 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBPROFILE_RT)) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(PRIVATE_TARGET_LIBGCC) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_TARGET_CRTEND_O) \
$(PRIVATE_LDLIBS)
endef
define transform-o-to-executable
-@mkdir -p $(dir $@)
@echo "target Executable: $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
$(transform-o-to-executable-inner)
endef
@@ -1518,7 +1662,7 @@
-Wl,--gc-sections \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_STATIC_O)) \
+ $(PRIVATE_TARGET_CRTBEGIN_STATIC_O) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_OBJECTS) \
@@ -1529,18 +1673,17 @@
-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))) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBGCOV)) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_LIBPROFILE_RT)) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(call normalize-target-libraries,$(filter %libcompiler_rt.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(PRIVATE_TARGET_LIBGCC) \
-Wl,--end-group \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+ $(PRIVATE_TARGET_CRTEND_O)
endef
define transform-o-to-static-executable
-@mkdir -p $(dir $@)
@echo "target StaticExecutable: $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
$(transform-o-to-static-executable-inner)
endef
@@ -1553,8 +1696,8 @@
else
HOST_FPIE_FLAGS := -pie
# Force the correct entry point to workaround a bug in binutils that manifests with -pie
-ifeq ($(HOST_OS),windows)
-HOST_FPIE_FLAGS += -Wl,-e_mainCRTStartup
+ifeq ($(HOST_CROSS_OS),windows)
+HOST_CROSS_FPIE_FLAGS += -Wl,-e_mainCRTStartup
endif
endif
@@ -1571,9 +1714,10 @@
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
- -Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
- -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
+ -Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
+ -Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
) \
@@ -1584,8 +1728,8 @@
endif
define transform-host-o-to-executable
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Executable: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
-@echo "host Executable: $(PRIVATE_MODULE) ($@)"
$(transform-host-o-to-executable-inner)
endef
@@ -1594,8 +1738,12 @@
## Commands for running javac to make .class files
###########################################################
-#@echo "Source intermediates dir: $(PRIVATE_SOURCE_INTERMEDIATES_DIR)"
-#@echo "Source intermediates: $$(find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java')"
+# Add BUILD_NUMBER to apps default version name if it's unbundled build.
+ifdef TARGET_BUILD_APPS
+APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER_FROM_FILE)
+else
+APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
+endif
# TODO: Right now we generate the asset resources twice, first as part
# of generating the Java classes, then at the end when packaging the final
@@ -1622,23 +1770,14 @@
$(addprefix -G , $(PRIVATE_PROGUARD_OPTIONS_FILE)) \
$(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version , $(PRIVATE_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)-$(BUILD_NUMBER))) \
+ $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \
+ $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
- $(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR))
+ $(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
+ --skip-symbols-without-default-localization
endef
-ifeq ($(HOST_OS),windows)
-xlint_unchecked :=
-else
xlint_unchecked := -Xlint:unchecked
-endif
-
-ifeq (true, $(ENABLE_INCREMENTALJAVAC))
-incremental_dex := --incremental
-else
-incremental_dex :=
-endif
# emit-line, <word list>, <output file>
define emit-line
@@ -1648,6 +1787,7 @@
# dump-words-to-file, <word list>, <output file>
define dump-words-to-file
@rm -f $(2)
+ @touch $(2)
@$(call emit-line,$(wordlist 1,200,$(1)),$(2))
@$(call emit-line,$(wordlist 201,400,$(1)),$(2))
@$(call emit-line,$(wordlist 401,600,$(1)),$(2))
@@ -1673,11 +1813,13 @@
@$(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)))))
+ @$(call emit-line,$(wordlist 5001,5200,$(1)),$(2))
+ @$(if $(wordlist 5201,5202,$(1)),$(error Too many words ($(words $(1)))))
endef
# For a list of jar files, unzip them to a specified directory,
-# but make sure that no META-INF files come along for the ride.
+# but make sure that no META-INF files come along for the ride,
+# unless PRIVATE_DONT_DELETE_JAR_META_INF is set.
#
# $(1): files to unzip
# $(2): destination directory
@@ -1689,8 +1831,14 @@
exit 1; \
fi; \
unzip -qo $$f -d $(2); \
- done \
- $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,;rm -rf $(2)/META-INF)
+ done
+ $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,$(hide) rm -rf $(2)/META-INF)
+endef
+
+# Call jack
+#
+define call-jack
+ JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JACK) $(DEFAULT_JACK_EXTRA_ARGS)
endef
# Common definition to invoke javac on the host and target.
@@ -1711,13 +1859,12 @@
$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list)
$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
+ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
fi
$(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \
- | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
+ | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
$(1) -encoding UTF-8 \
- $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
$(2) \
$(addprefix -classpath ,$(strip \
@@ -1746,7 +1893,7 @@
$(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))))
$(if $(PRIVATE_RMTYPEDEFS), $(hide) $(RMTYPEDEFS) -v $(PRIVATE_CLASS_INTERMEDIATES_DIR))
$(if $(PRIVATE_JAR_MANIFEST), \
- $(hide) sed -e 's/%BUILD_NUMBER%/$(BUILD_NUMBER)/' \
+ $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf && \
jar -cfm $@ $(dir $@)/manifest.mf \
-C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ., \
@@ -1759,68 +1906,207 @@
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
endef
-# Override the above definitions if we want to do incremetal javac
-ifeq (true, $(ENABLE_INCREMENTALJAVAC))
-define compile-java
-$(hide) mkdir -p $(dir $@)
-$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
-$(hide) touch $(PRIVATE_CLASS_INTERMEDIATES_DIR)/newstamp
-$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
-$(hide) if [ -e $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp ] ; then \
- newerFlag=$$(echo -n "-newer $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp") ; \
- fi ; \
- find $(PRIVATE_JAVA_SOURCES) $$newerFlag > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list ; \
- if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' $$newerFlag >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
- fi
-$(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \
- | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
-@echo "(Incremental) build source files:"
-@cat $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
-$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
- $(1) -encoding UTF-8 \
- $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \
- $(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
- $(2) \
- $(addprefix -classpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES) $(PRIVATE_CLASS_INTERMEDIATES_DIR)))) \
- $(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
- -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
- $(PRIVATE_JAVACFLAGS) \
- \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \
- || ( exit 41 ) \
-fi
-$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list
-$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
+# Invoke Jack to compile java from source to dex and jack files.
+#
+# 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 Jack doesn't like them.
+define jack-java-to-dex
$(hide) rm -f $@
-$(if $(PRIVATE_JAR_EXCLUDE_FILES), $(hide) find $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
- -name $(word 1, $(PRIVATE_JAR_EXCLUDE_FILES)) \
- $(addprefix -o -name , $(wordlist 2, 999, $(PRIVATE_JAR_EXCLUDE_FILES))) \
- | xargs rm -rf)
-$(if $(PRIVATE_JAR_PACKAGES), \
- $(hide) find $(PRIVATE_CLASS_INTERMEDIATES_DIR) -mindepth 1 -type f \
- $(foreach pkg, $(PRIVATE_JAR_PACKAGES), \
- -not -path $(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))/\*) -delete ; \
- find $(PRIVATE_CLASS_INTERMEDIATES_DIR) -empty -delete)
-$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) rm -rf \
- $(foreach pkg, $(PRIVATE_JAR_EXCLUDE_PACKAGES), \
- $(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))))
-$(if $(PRIVATE_RMTYPEDEFS), $(hide) $(RMTYPEDEFS) -v $(PRIVATE_CLASS_INTERMEDIATES_DIR))
-$(if $(PRIVATE_JAR_MANIFEST), \
- $(hide) sed -e 's/%BUILD_NUMBER%/$(BUILD_NUMBER)/' \
- $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf && \
- jar -cfm $@ $(dir $@)/manifest.mf \
- -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ., \
- $(hide) jar -cf $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .)
-$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
-$(hide) mv $(PRIVATE_CLASS_INTERMEDIATES_DIR)/newstamp $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp
+$(hide) rm -f $(PRIVATE_CLASSES_JACK)
+$(hide) rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR)
+$(hide) mkdir -p $(dir $@)
+$(hide) mkdir -p $(dir $(PRIVATE_CLASSES_JACK))
+$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR)
+$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
+$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list)
+$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
+ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
+fi
+$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
+ | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
+$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
+ $(hide) echo -basedirectory $(CURDIR) > $@.flags; \
+ echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
+)
+$(if $(PRIVATE_EXTRA_JAR_ARGS),
+ $(hide) mkdir -p $@.res.tmp
+ $(hide) $(call create-empty-package-at,$@.res.tmp.zip)
+ $(hide) $(call add-java-resources-to,$@.res.tmp.zip)
+ $(hide) unzip -qo $@.res.tmp.zip -d $@.res.tmp
+ $(hide) rm $@.res.tmp.zip)
+$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
+ export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
+else \
+ export tmpEcjArg=""; \
+fi; \
+$(call call-jack) \
+ $(strip $(PRIVATE_JACK_FLAGS)) \
+ $(if $(NO_OPTIMIZE_DX), \
+ -D jack.dex.optimize="false") \
+ $(if $(PRIVATE_RMTYPEDEFS), \
+ -D jack.android.remove-typedef="true") \
+ $(addprefix --classpath ,$(strip \
+ $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \
+ $(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
+ $(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
+ -D jack.import.resource.policy=keep-first \
+ -D jack.import.type.policy=keep-first \
+ --output-jack $(PRIVATE_CLASSES_JACK) \
+ $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
+ --output-dex $(PRIVATE_JACK_INTERMEDIATES_DIR) \
+ $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \
+ $(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \
+ $$tmpEcjArg \
+ || ( rm -rf $(PRIVATE_CLASSES_JACK); exit 41 )
+$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/classes*.dex $(dir $@)
+$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list
+$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp)
+$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list
+$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53)
+$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53)
+$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
endef
-define transform-java-to-classes.jar
-@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
-$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
+define transform-jar-to-jack
+ $(hide) mkdir -p $(dir $@)
+ $(JILL) $(PRIVATE_JILL_FLAGS) --output $@.tmpjill.jack $<
+ $(hide) mkdir -p $@.tmpjill.res
+ $(hide) unzip -qo $< -d $@.tmpjill.res
+ $(hide) find $@.tmpjill.res -iname "*.class" -delete
+ $(hide) $(call call-jack) \
+ -D jack.import.resource.policy=keep-first \
+ -D jack.import.type.policy=keep-first \
+ --import $@.tmpjill.jack \
+ --import-resource $@.tmpjill.res \
+ --output-jack $@
+ $(hide) rm -rf $@.tmpjill.res
+ $(hide) rm $@.tmpjill.jack
endef
-endif # ENABLE_INCREMENTALJAVAC
+
+# Moves $1.tmp to $1 if necessary. This is designed to be used with
+# .KATI_RESTAT. For kati, this function doesn't update the timestamp
+# of $1 when $1.tmp is identical to $1 so that ninja won't rebuild
+# targets which depend on $1. For GNU make, this function simply
+# copies $1.tmp to $1.
+ifeq ($(BUILDING_WITH_NINJA),true)
+define commit-change-for-toc
+$(hide) if cmp -s $1.tmp $1 ; then \
+ rm $1.tmp ; \
+else \
+ mv $1.tmp $1 ; \
+fi
+endef
+else
+define commit-change-for-toc
+@# make doesn't support restat. We always update .toc files so the dependents will always be updated too.
+$(hide) mv $1.tmp $1
+endef
+endif
+
+## Rule to create a table of contents from a .jar file.
+## Must be called with $(eval).
+# $(1): A .jar file
+define _transform-jar-to-toc
+$1.toc: $1 | $(IJAR)
+ @echo Generating TOC: $$@
+ $(hide) $(IJAR) $$< $$@.tmp
+ $$(call commit-change-for-toc,$$@)
+endef
+
+## Define a rule which generates .jar.toc and mark it as .KATI_RESTAT.
+# $(1): A .jar file
+define define-jar-to-toc-rule
+$(eval $(call _transform-jar-to-toc,$1))\
+$(eval .KATI_RESTAT: $1.toc)
+endef
+
+ifeq (,$(TARGET_BUILD_APPS))
+
+## Rule to create a table of contents from a .dex file.
+## Must be called with $(eval).
+# $(1): The directory which contains classes*.dex files
+define _transform-dex-to-toc
+$1/classes.dex.toc: PRIVATE_INPUT_DEX_FILES := $1/classes*.dex
+$1/classes.dex.toc: $1/classes.dex $(DEXDUMP)
+ @echo Generating TOC: $$@
+ $(hide) $(DEXDUMP) -l xml $$(PRIVATE_INPUT_DEX_FILES) > $$@.tmp
+ $$(call commit-change-for-toc,$$@)
+endef
+
+## Define a rule which generates .dex.toc and mark it as .KATI_RESTAT.
+# $(1): The directory which contains classes*.dex files
+define define-dex-to-toc-rule
+$(eval $(call _transform-dex-to-toc,$1))\
+$(eval .KATI_RESTAT: $1/classes.dex.toc)
+endef
+
+else
+
+# Turn off .toc optimization for apps build as we cannot build dexdump.
+define define-dex-to-toc-rule
+endef
+
+endif # TARGET_BUILD_APPS
+
+
+# Invoke Jack to compile java from source to jack files without shrink or obfuscation.
+#
+# 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 Jack doesn't like them.
+define java-to-jack
+$(hide) rm -f $@
+$(hide) rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR)
+$(hide) mkdir -p $(dir $@)
+$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR)
+$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
+$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list)
+$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
+ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
+fi
+$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
+ | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
+$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
+ $(hide) echo -basedirectory $(CURDIR) > $@.flags; \
+ echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
+)
+$(if $(PRIVATE_EXTRA_JAR_ARGS),
+ $(hide) mkdir -p $@.res.tmp
+ $(hide) $(call create-empty-package-at,$@.res.tmp.zip)
+ $(hide) $(call add-java-resources-to,$@.res.tmp.zip)
+ $(hide) unzip -qo $@.res.tmp.zip -d $@.res.tmp
+ $(hide) rm $@.res.tmp.zip)
+$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
+ export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
+else \
+ export tmpEcjArg=""; \
+fi; \
+$(call call-jack) \
+ $(strip $(PRIVATE_JACK_FLAGS)) \
+ $(if $(NO_OPTIMIZE_DX), \
+ -D jack.dex.optimize="false") \
+ $(addprefix --classpath ,$(strip \
+ $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \
+ $(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
+ $(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
+ -D jack.import.resource.policy=keep-first \
+ -D jack.import.type.policy=keep-first \
+ $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
+ --output-jack $@ \
+ $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \
+ $(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \
+ $$tmpEcjArg \
+ || ( rm -f $@ ; exit 41 )
+$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list
+$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp)
+$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list
+$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53)
+$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53)
+$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
+endef
define transform-classes.jar-to-emma
$(hide) java -classpath $(EMMA_JAR) emma instr -outmode fullcopy -outfile \
@@ -1830,15 +2116,13 @@
#TODO: use a smaller -Xmx value for most libraries;
# only core.jar and framework.jar need a heap this big.
-# Avoid the memory arguments on Windows, dx fails to load for some reason with them.
define transform-classes.jar-to-dex
@echo "target Dex: $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex
$(hide) $(DX) \
- $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx2048M) \
+ -JXms16M -JXmx2048M \
--dex --output=$(dir $@) \
- $(incremental_dex) \
$(if $(NO_OPTIMIZE_DX), \
--no-optimize) \
$(if $(GENERATE_DEX_DEBUG), \
@@ -1852,12 +2136,20 @@
# Create a mostly-empty .jar file that we'll add to later.
# The MacOS jar tool doesn't like creating empty jar files,
# so we need to give it something.
+# $(1) package to create
+define create-empty-package-at
+@mkdir -p $(dir $(1))
+$(hide) touch $(dir $(1))zipdummy
+$(hide) (cd $(dir $(1)) && jar cf $(notdir $(1)) zipdummy)
+$(hide) zip -qd $(1) zipdummy
+$(hide) rm $(dir $(1))zipdummy
+endef
+
+# Create a mostly-empty .jar file that we'll add to later.
+# The MacOS jar tool doesn't like creating empty jar files,
+# so we need to give it something.
define create-empty-package
-@mkdir -p $(dir $@)
-$(hide) touch $(dir $@)zipdummy
-$(hide) (cd $(dir $@) && jar cf $(notdir $@) zipdummy)
-$(hide) zip -qd $@ zipdummy
-$(hide) rm $(dir $@)zipdummy
+$(call create-empty-package-at,$@)
endef
# Copy an arhchive file and delete any class files and empty folders inside.
@@ -1891,10 +2183,11 @@
$(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(if $(filter --product,$(PRIVATE_AAPT_FLAGS)),,$(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)-$(BUILD_NUMBER))) \
+ $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \
+ $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
+ --skip-symbols-without-default-localization \
-F $@
endef
@@ -1906,20 +2199,29 @@
endef
+# For apps_only build, don't uncompress/page-align the jni libraries,
+# because the apk may be run on older platforms that don't support loading jni directly from apk.
+ifdef TARGET_BUILD_APPS
+JNI_COMPRESS_FLAGS :=
+ZIPALIGN_PAGE_ALIGN_FLAGS :=
+else
+JNI_COMPRESS_FLAGS := -0
+ZIPALIGN_PAGE_ALIGN_FLAGS := -p
+endif
+
define add-jni-shared-libs-to-package
$(hide) rm -rf $(dir $@)lib
$(hide) mkdir -p $(addprefix $(dir $@)lib/,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI))
$(foreach abi,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI),\
$(call _add-jni-shared-libs-to-package-per-abi,$(abi),\
$(patsubst $(abi):%,%,$(filter $(abi):%,$(PRIVATE_JNI_SHARED_LIBRARIES)))))
-$(hide) (cd $(dir $@) && zip -r \
- $(if $(filter true, $(PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES)),-0,) $(notdir $@) lib)
+$(hide) (cd $(dir $@) && zip -qrX $(JNI_COMPRESS_FLAGS) $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib
endef
#TODO: update the manifest to point to the dex file
define add-dex-to-package
-$(hide) zip -qj $@ $(dir $(PRIVATE_DEX_FILE))classes*.dex
+$(hide) find $(dir $(PRIVATE_DEX_FILE)) -maxdepth 1 -name "classes*.dex" | sort | xargs zip -qjX $@
endef
# Add java resources added by the current module.
@@ -1931,11 +2233,24 @@
@rm -f $(1).jar-arg-list
endef
+# Add resources carried by static Jack libraries.
+#
+define add-carried-jack-resources
+ $(hide) if [ -d $(PRIVATE_JACK_INTERMEDIATES_DIR) ] ; then \
+ find $(PRIVATE_JACK_INTERMEDIATES_DIR) -type f | sort \
+ | sed -e "s?^$(PRIVATE_JACK_INTERMEDIATES_DIR)/? -C \"$(PRIVATE_JACK_INTERMEDIATES_DIR)\" \"?" -e "s/$$/\"/" \
+ > $(dir $@)jack_res_jar_flags; \
+ if [ -s $(dir $@)jack_res_jar_flags ] ; then \
+ jar uf $@ @$(dir $@)jack_res_jar_flags; \
+ fi; \
+fi
+endef
+
# Sign a package using the specified key/cert.
#
define sign-package
$(hide) mv $@ $@.unsigned
-$(hide) java -jar $(SIGNAPK_JAR) \
+$(hide) java -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) -jar $(SIGNAPK_JAR) \
$(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) \
$(PRIVATE_ADDITIONAL_CERTIFICATES) $@.unsigned $@.signed
$(hide) mv $@.signed $@
@@ -1947,20 +2262,30 @@
$(hide) mv $@ $@.unaligned
$(hide) $(ZIPALIGN) \
-f \
- $(if $(filter true, $(PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES)),-p,) \
+ $(ZIPALIGN_PAGE_ALIGN_FLAGS) \
4 \
$@.unaligned $@.aligned
$(hide) mv $@.aligned $@
endef
+# Remove dynamic timestamps from packages
+#
+ifndef TARGET_BUILD_APPS
+define remove-timestamps-from-package
+$(hide) $(ZIPTIME) $@
+endef
+endif
+
+# Uncompress shared libraries embedded in an apk.
+#
define uncompress-shared-libs
-$(hide) rm -rf $(dir $@)/tmpworkdir
-$(hide) mv $@ $@.compressed
-$(hide) mkdir $(dir $@)/tmpworkdir
-$(hide) unzip $@.compressed 'lib/*.so' -d $(dir $@)/tmpworkdir
-$(hide) ( cd $(dir $@)/tmpworkdir && zip -D -r -0 ../$(notdir $@).compressed lib )
-$(hide) mv $@.compressed $@
-$(hide) rm -rf $(dir $@)/tmpworkdir
+$(hide) if unzip -l $@ $(PRIVATE_EMBEDDED_JNI_LIBS) >/dev/null ; then \
+ rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
+ unzip $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
+ zip -d $@ 'lib/*.so' && \
+ ( cd $(dir $@)uncompressedlibs && find lib -type f | sort | zip -D -X -0 ../$(notdir $@) -@ ) && \
+ rm -rf $(dir $@)uncompressedlibs; \
+ fi
endef
define install-dex-debug
@@ -1983,7 +2308,7 @@
# 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))"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
endef
@@ -2330,12 +2655,13 @@
endef
# Return the arch for the source file of a prebuilt
-# Return "none" if no matching arch found, so the result can be passed to
+# Return "none" if no matching arch found and return empty
+# if the input is empty, so the result can be passed to
# LOCAL_MODULE_TARGET_ARCH.
# $(1) the list of archs supported by the prebuilt
define get-prebuilt-src-arch
$(strip $(if $(filter $(TARGET_ARCH),$(1)),$(TARGET_ARCH),\
- $(if $(filter $(TARGET_2ND_ARCH),$(1)),$(TARGET_2ND_ARCH),none)))
+ $(if $(filter $(TARGET_2ND_ARCH),$(1)),$(TARGET_2ND_ARCH),$(if $(1),none))))
endef
###########################################################
@@ -2350,6 +2676,7 @@
# Include any vendor specific definitions.mk file
-include $(TOPDIR)vendor/*/build/core/definitions.mk
-include $(TOPDIR)device/*/build/core/definitions.mk
+-include $(TOPDIR)product/*/build/core/definitions.mk
# broken:
# $(foreach file,$^,$(if $(findstring,.a,$(suffix $file)),-l$(file),$(file)))
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 8b555e0..e0dde01 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -35,7 +35,7 @@
_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
-$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP) $(AAPT)
+$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP)
$$(call copy-file-to-target)
ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
$$(call dexpreopt-remove-classes.dex,$$@)
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 6f598be..97e77ba 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -3,19 +3,16 @@
#
####################################
+# Default to debug version to help find bugs.
+# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
+ifeq ($(USE_DEX2OAT_DEBUG),false)
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
-DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
+else
+DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
+endif
-# By default, do not run rerun dex2oat if the tool changes.
-# Comment out the | to force dex2oat to rerun on after all changes.
-DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
-DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
-DEX2OAT_DEPENDENCY += |
DEX2OAT_DEPENDENCY += $(DEX2OAT)
-DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY)
-DEX2OATD_DEPENDENCY += $(DEX2OATD)
-
# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
@@ -24,13 +21,6 @@
COMPILED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES))))
-# Default to debug version to help find bugs.
-# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
-ifneq ($(USE_DEX2OAT_DEBUG), false)
-DEX2OAT = $(DEX2OATD)
-DEX2OAT_DEPENDENCY = $(DEX2OATD_DEPENDENCY)
-endif
-
# start of image reserved address space
LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
@@ -105,7 +95,8 @@
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
- --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols --no-include-cfi \
+ --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
--abort-on-hard-verifier-error \
+ --no-inline-from=core-oj.jar \
$(PRIVATE_DEX_PREOPT_FLAGS)
endef
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index cfc7653..f8fc655 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -42,15 +42,18 @@
# The rule to install boot.art and boot.oat
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP)
- $(call copy-file-to-target)
- $(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@)
+ $(hide) $(ACP) -fp $(dir $<)/*.art $(dir $@)
+ $(hide) $(ACP) -fp $(dir $<)/*.oat $(dir $@)
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
# Use dex2oat debug version for better error reporting
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY)
- @echo "target dex2oat: $@ ($?)"
+ @echo "target dex2oat: $@"
@mkdir -p $(dir $@)
@mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
+ @rm -f $(dir $@)/*.art $(dir $@)/*.oat
+ @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art
+ @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat
$(hide) $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
--image-classes=$(PRELOADED_CLASSES) \
$(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
@@ -62,5 +65,6 @@
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
- --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols --no-include-cfi \
+ --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
+ --multi-image --no-inline-from=core-oj.jar \
$(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(COMPILED_CLASSES_FLAGS)
diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk
index 06e498d..b2a3d64 100644
--- a/core/dpi_specific_apk.mk
+++ b/core/dpi_specific_apk.mk
@@ -25,24 +25,35 @@
$(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR)
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
-$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
-# Note that PRIVATE_CLASS_INTERMEDIATES_DIR points to the base apk's intermediate dir.
-$(built_dpi_apk): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
-$(built_dpi_apk): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
$(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key)
$(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate)
$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
+$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE :=
+ifneq ($(full_classes_jar),)
+$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
+ifndef LOCAL_JACK_ENABLED
+# Use the jarjar processed arhive as the initial package file.
+$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
+else
+$(built_dpi_apk): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
+endif # LOCAL_JACK_ENABLED
+$(built_dpi_apk): $(built_dex)
+else
+$(built_dpi_apk): PRIVATE_DEX_FILE :=
+endif # full_classes_jar
+
# Set up dependenncies and the build recipe.
$(built_dpi_apk) : $(R_file_stamp)
$(built_dpi_apk) : $(all_library_res_package_export_deps)
-$(built_dpi_apk) : $(built_dex)
$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR)
-$(built_dpi_apk) : $(AAPT) | $(ZIPALIGN)
+$(built_dpi_apk) : $(AAPT)
$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
- $(create-empty-package)
+ $(if $(PRIVATE_SOURCE_ARCHIVE),\
+ $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
+ $(create-empty-package))
$(add-assets-to-package)
ifneq ($(jni_shared_libraries),)
$(add-jni-shared-libs-to-package)
@@ -52,13 +63,11 @@
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else
$(add-dex-to-package)
+ifdef LOCAL_JACK_ENABLED
+ $(add-carried-jack-resources)
endif
- $(add-carried-java-resources)
-ifneq ($(extra_jar_args),)
- $(add-java-resources-to-package)
endif
$(sign-package)
- $(align-package)
# Set up global variables to register this apk to the higher-level dependency graph.
ALL_MODULES += $(dpi_apk_name)
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 41f135c..1b65611 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -23,6 +23,7 @@
LOCAL_IS_HOST_MODULE := $(call true-or-empty,$(LOCAL_IS_HOST_MODULE))
ifeq ($(LOCAL_IS_HOST_MODULE),true)
my_prefix := HOST_
+LOCAL_HOST_PREFIX :=
else
my_prefix := TARGET_
endif
@@ -72,8 +73,8 @@
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
endif
else
- LOCAL_JAVA_LIBRARIES := core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
- $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-libart)
+ LOCAL_JAVA_LIBRARIES := core-oj core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-oj):$(call java-lib-files, core-libart)
endif # LOCAL_SDK_VERSION
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
@@ -107,7 +108,7 @@
define prepare-doc-source-list
$(hide) mkdir -p $(dir $(1))
$(call dump-words-to-file, $(2), $(1))
-$(hide) for d in $(3) ; do find $$d -name '*.java' >> $(1) 2> /dev/null ; done ; true
+$(hide) for d in $(3) ; do find $$d -name '*.java' -and -not -name '.*' >> $(1) 2> /dev/null ; done ; true
endef
ifeq (a,b)
@@ -124,15 +125,15 @@
##
droiddoc_templates := \
- $(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f)
+ $(sort $(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f))
droiddoc := \
$(HOST_JDK_TOOLS_JAR) \
$(HOST_OUT_JAVA_LIBRARIES)/doclava$(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_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER_FROM_FILE)
+$(full_target): PRIVATE_CURRENT_TIME := -hdf page.now "$$($(DATE_FROM_FILE) "+%d %b %Y %k:%M")"
$(full_target): PRIVATE_CUSTOM_TEMPLATE_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_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)
@@ -141,7 +142,7 @@
html_dir_files :=
ifneq ($(strip $(LOCAL_DROIDDOC_HTML_DIR)),)
$(full_target): PRIVATE_DROIDDOC_HTML_DIR := -htmldir $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR)
-html_dir_files := $(shell find $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR) -type f)
+html_dir_files := $(sort $(shell find $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR) -type f))
else
$(full_target): PRIVATE_DROIDDOC_HTML_DIR :=
endif
@@ -160,7 +161,7 @@
$(droiddoc) \
$(html_dir_files) \
$(full_java_lib_deps) \
- $(LOCAL_MODULE_MAKEFILE) \
+ $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
@echo Docs droiddoc: $(PRIVATE_OUT_DIR)
$(hide) mkdir -p $(dir $@)
@@ -170,7 +171,7 @@
javadoc \
-encoding UTF-8 \
\@$(PRIVATE_SRC_LIST_FILE) \
- -J-Xmx1280m \
+ -J-Xmx1600m \
-XDignore.symbol.file \
$(PRIVATE_PROFILING_OPTIONS) \
-quiet \
@@ -208,6 +209,7 @@
\@$(PRIVATE_SRC_LIST_FILE) \
-J-Xmx1024m \
-XDignore.symbol.file \
+ $(if $(LEGACY_USE_JAVA7),,-Xdoclint:none) \
$(PRIVATE_PROFILING_OPTIONS) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
$(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
@@ -240,7 +242,7 @@
@echo Package docs: $@
@rm -f $@
@mkdir -p $(dir $@)
- $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rq $$F * )
+ $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rqX $$F * )
$(LOCAL_MODULE)-docs.zip : $(out_zip)
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index 510bc7d..c7fb8db 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -80,6 +80,7 @@
$(info HOST_ARCH=$(HOST_ARCH))
$(info HOST_OS=$(HOST_OS))
$(info HOST_OS_EXTRA=$(HOST_OS_EXTRA))
+$(info HOST_CROSS_OS=$(HOST_CROSS_OS))
$(info HOST_BUILD_TYPE=$(HOST_BUILD_TYPE))
$(info BUILD_ID=$(BUILD_ID))
$(info OUT_DIR=$(OUT_DIR))
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 38c0cbe..d6f6cc9 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -44,7 +44,10 @@
relocation_packer_input := $(linked_module)
relocation_packer_output := $(intermediates)/PACKED/$(my_built_module_stem)
-my_pack_module_relocations := $(LOCAL_PACK_MODULE_RELOCATIONS)
+my_pack_module_relocations := false
+ifneq ($(DISABLE_RELOCATION_PACKER),true)
+ my_pack_module_relocations := $(LOCAL_PACK_MODULE_RELOCATIONS)
+endif
ifeq ($(my_pack_module_relocations),)
my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
@@ -86,6 +89,20 @@
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
+###########################################################
+## Store breakpad symbols
+###########################################################
+
+ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
+my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+breakpad_input := $(relocation_packer_output)
+breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym
+$(breakpad_output) : $(breakpad_input) | $(BREAKPAD_DUMP_SYMS)
+ @echo "target breakpad: $(PRIVATE_MODULE) ($@)"
+ @mkdir -p $(dir $@)
+ $(hide) $(BREAKPAD_DUMP_SYMS) -c $< > $@
+$(LOCAL_BUILT_MODULE) : $(breakpad_output)
+endif
###########################################################
## Strip
@@ -143,5 +160,6 @@
$(cleantarget): PRIVATE_CLEAN_FILES += \
$(linked_module) \
+ $(breakpad_output) \
$(symbolic_output) \
$(strip_output)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 015cfee..46c1463 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -5,6 +5,11 @@
# the bottom for the full list
# OUT_DIR is also set to "out" if it's not already set.
# this allows you to set it to somewhere else if you like
+# SCAN_EXCLUDE_DIRS is an optional, whitespace separated list of
+# directories that will also be excluded from full checkout tree
+# searches for source or make files, in addition to OUT_DIR.
+# This can be useful if you set OUT_DIR to be a different directory
+# than other outputs of your build system.
# Set up version information.
include $(BUILD_SYSTEM)/version_defaults.mk
@@ -22,7 +27,7 @@
# NOTE: This will be overridden in product_config.mk if make
# was invoked with a PRODUCT-xxx-yyy goal.
ifeq ($(TARGET_PRODUCT),)
-TARGET_PRODUCT := full
+TARGET_PRODUCT := aosp_arm
endif
@@ -48,19 +53,15 @@
ifneq (,$(findstring Macintosh,$(UNAME)))
HOST_OS := darwin
endif
-ifneq (,$(findstring CYGWIN,$(UNAME)))
- HOST_OS := windows
-endif
# BUILD_OS is the real host doing the build.
BUILD_OS := $(HOST_OS)
-# Under Linux, if USE_MINGW is set, we change HOST_OS to Windows to build the
-# Windows SDK. Only a subset of tools and SDK will manage to build properly.
+HOST_CROSS_OS :=
+# We can cross-build Windows binaries on Linux
ifeq ($(HOST_OS),linux)
-ifdef USE_MINGW
- HOST_OS := windows
-endif
+HOST_CROSS_OS := windows
+HOST_CROSS_ARCH := x86
endif
ifeq ($(HOST_OS),)
@@ -107,6 +108,7 @@
TARGET_COPY_OUT_SYSTEM := system
TARGET_COPY_OUT_DATA := data
TARGET_COPY_OUT_OEM := oem
+TARGET_COPY_OUT_ODM := odm
TARGET_COPY_OUT_ROOT := root
TARGET_COPY_OUT_RECOVERY := recovery
###########################################
@@ -130,15 +132,6 @@
$(error must be empty or one of: eng user userdebug)
endif
-# Build host as 32-bit for SDK build.
-ifneq ($(filter $(MAKECMDGOALS),win_sdk sdk),)
-HOST_PREFER_32_BIT := true
-endif
-ifdef USE_MINGW
-# We only build sdk host tools in the MinGW windows build.
-# Build it as 32-bit as well.
-HOST_PREFER_32_BIT := true
-endif
SDK_HOST_ARCH := x86
# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
@@ -146,11 +139,11 @@
# make sure only one exists.
# Real boards should always be associated with an OEM vendor.
board_config_mk := \
- $(strip $(wildcard \
+ $(strip $(sort $(wildcard \
$(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
- $(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
- $(shell test -d vendor && find vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
- ))
+ $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
+ $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
+ )))
ifeq ($(board_config_mk),)
$(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
endif
@@ -161,6 +154,10 @@
ifeq ($(TARGET_ARCH),)
$(error TARGET_ARCH not defined by board config: $(board_config_mk))
endif
+ifneq ($(MALLOC_IMPL),)
+ $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).)
+ $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory)
+endif
TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
board_config_mk :=
@@ -219,8 +216,12 @@
HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))
+# TODO: remove
+BUILD_OUT := $(HOST_OUT)
-BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)
+HOST_CROSS_OUT_release := $(HOST_OUT_ROOT_release)/windows-$(HOST_PREBUILT_ARCH)
+HOST_CROSS_OUT_debug := $(HOST_OUT_ROOT_debug)/windows-$(HOST_PREBUILT_ARCH)
+HOST_CROSS_OUT := $(HOST_CROSS_OUT_$(HOST_BUILD_TYPE))
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
@@ -238,6 +239,9 @@
HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework
HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon
+HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT)/bin
+HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib
+
HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
HOST_OUT_HEADERS := $(HOST_OUT_INTERMEDIATES)/include
HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
@@ -245,9 +249,16 @@
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
HOST_OUT_FAKE := $(HOST_OUT)/fake_packages
+HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
+HOST_CROSS_OUT_HEADERS := $(HOST_CROSS_OUT_INTERMEDIATES)/include
+HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $(HOST_CROSS_OUT_INTERMEDIATES)/lib
+HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
+
HOST_OUT_GEN := $(HOST_OUT)/gen
HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
+HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
+
# Out for HOST_2ND_ARCH
HOST_2ND_ARCH_VAR_PREFIX := 2ND_
HOST_2ND_ARCH_MODULE_SUFFIX := _32
@@ -274,14 +285,20 @@
TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
+ifneq ($(filter address,$(SANITIZE_TARGET)),)
+target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
+else
+target_out_shared_libraries_base := $(TARGET_OUT)
+endif
+
TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin
ifeq ($(TARGET_IS_64_BIT),true)
# /system/lib always contains 32-bit libraries,
# and /system/lib64 (if present) always contains 64-bit libraries.
-TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib64
+TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib64
else
-TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
+TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib
endif
TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework
TARGET_OUT_APPS := $(TARGET_OUT)/app
@@ -297,7 +314,7 @@
TARGET_2ND_ARCH_MODULE_SUFFIX := $(HOST_2ND_ARCH_MODULE_SUFFIX)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)/lib
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED)
@@ -325,12 +342,18 @@
TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
+ifneq ($(filter address,$(SANITIZE_TARGET)),)
+target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)/vendor
+else
+target_out_vendor_shared_libraries_base := $(TARGET_OUT_VENDOR)
+endif
+
TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin
TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES := $(TARGET_OUT_VENDOR)/xbin
ifeq ($(TARGET_IS_64_BIT),true)
-TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib64
+TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib64
else
-TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib
+TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib
endif
TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework
TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR)/app
@@ -342,7 +365,7 @@
TARGET_OUT_OEM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_OEM)
TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM)/bin
-ifneq ($(filter %64,$(TARGET_ARCH)),)
+ifeq ($(TARGET_IS_64_BIT),true)
TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib64
else
TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
@@ -356,6 +379,22 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM_APPS)
+TARGET_OUT_ODM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM)
+TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM)/bin
+ifeq ($(TARGET_IS_64_BIT),true)
+TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib64
+else
+TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib
+endif
+TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM)/app
+TARGET_OUT_ODM_ETC := $(TARGET_OUT_ODM)/etc
+
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM_EXECUTABLES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM_APPS)
+
+TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad
+
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib
@@ -391,3 +430,7 @@
ifeq ($(PRINT_BUILD_CONFIG),)
PRINT_BUILD_CONFIG := true
endif
+
+ifeq ($(USE_CLANG_PLATFORM_BUILD),)
+USE_CLANG_PLATFORM_BUILD := true
+endif
diff --git a/core/executable.mk b/core/executable.mk
index 4dd9a23..70ef0d9 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -6,6 +6,17 @@
# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
# LOCAL_MODULE_STEM_64
+my_skip_this_target :=
+ifneq ($(filter address,$(SANITIZE_TARGET)),)
+ ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
+ my_skip_this_target := true
+ else ifeq (false, $(LOCAL_CLANG))
+ my_skip_this_target := true
+ endif
+endif
+
+ifneq (true,$(my_skip_this_target))
+
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
@@ -71,3 +82,5 @@
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
my_module_arch_supported :=
+
+endif
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 2684d51..2105f58 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -35,13 +35,21 @@
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
-my_target_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT)
-my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV)
+ifeq ($(LOCAL_NO_LIBGCC),true)
+my_target_libgcc :=
+else
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
+endif
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
+ifeq ($(LOCAL_NO_CRT),true)
+my_target_crtbegin_dynamic_o :=
+my_target_crtbegin_static_o :=
+my_target_crtend_o :=
+else
my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_DYNAMIC_O)
my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_STATIC_O)
my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_O)
+endif
ifdef LOCAL_SDK_VERSION
# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
@@ -56,8 +64,6 @@
endif
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
-$(linked_module): PRIVATE_TARGET_LIBPROFILE_RT := $(my_target_libprofile_rt)
-$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk
index 2326e83..931550f 100644
--- a/core/executable_prefer_symlink.mk
+++ b/core/executable_prefer_symlink.mk
@@ -39,7 +39,10 @@
endif
endif
-$(my_symlink): $(LOCAL_INSTALLED_MODULE) $(LOCAL_MODULE_MAKEFILE)
+# $(my_symlink) doesn't need to depend on $(PRIVATE_SRC_BINARY_NAME): we can generate symlink to nonexistent file.
+# If you add the dependency, make would compare the timestamp of a file against that of its symlink:
+# they are always equal, because make follows symlink.
+$(my_symlink): $(LOCAL_MODULE_MAKEFILE_DEP)
@echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)"
@mkdir -p $(dir $@)
@rm -rf $@
diff --git a/core/find-jdk-tools-jar.sh b/core/find-jdk-tools-jar.sh
index 0224829..ac0b3b6 100755
--- a/core/find-jdk-tools-jar.sh
+++ b/core/find-jdk-tools-jar.sh
@@ -16,5 +16,5 @@
LSLINE=$(ls -l "$JAVAC")
JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //")
done
- echo $JAVAC | sed -e "s:\(.*\)/bin/javac.*:\\1/lib/tools.jar:"
+ echo $JAVAC | sed -e 's:\(.*\)/javac$:\1/../lib/tools.jar:'
fi
diff --git a/core/fuzz_test.mk b/core/fuzz_test.mk
new file mode 100644
index 0000000..fc582b3
--- /dev/null
+++ b/core/fuzz_test.mk
@@ -0,0 +1,34 @@
+###########################################
+## A thin wrapper around BUILD_EXECUTABLE
+## Common flags for fuzz tests are added.
+###########################################
+
+ifdef LOCAL_SDK_VERSION
+ $(error $(LOCAL_PATH): $(LOCAL_MODULE): NDK fuzz tests are not supported.)
+endif
+
+LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
+LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
+
+ifdef LOCAL_MODULE_PATH
+$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE))
+endif
+
+ifdef LOCAL_MODULE_PATH_32
+$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_32 when building test $(LOCAL_MODULE))
+endif
+
+ifdef LOCAL_MODULE_PATH_64
+$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_64 when building test $(LOCAL_MODULE))
+endif
+
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+
+ifndef LOCAL_MULTILIB
+ifndef LOCAL_32_BIT_ONLY
+LOCAL_MULTILIB := both
+endif
+endif
+
+include $(BUILD_EXECUTABLE)
diff --git a/core/goma.mk b/core/goma.mk
new file mode 100644
index 0000000..6535b3e
--- /dev/null
+++ b/core/goma.mk
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2015 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.
+#
+
+# Notice: this works only with Google's Goma build infrastructure.
+ifneq ($(filter-out false,$(USE_GOMA)),)
+ # Check if USE_NINJA is not false because GNU make won't work well
+ # with goma. Note this file is evaluated twice, once by GNU make and
+ # once by kati with USE_NINJA=false. We do this check in the former
+ # pass.
+ ifndef KATI
+ ifeq ($(USE_NINJA),false)
+ $(error USE_GOMA=true is not compatible with USE_NINJA=false)
+ endif
+ endif
+
+ # Goma requires a lot of processes and file descriptors.
+ ifeq ($(shell echo $$(($$(ulimit -u) < 2500 || $$(ulimit -n) < 16000))),1)
+ $(warning Max user processes and/or open files are insufficient)
+ ifeq ($(shell uname),Darwin)
+ $(error See go/ma/how-to-use-goma/how-to-use-goma-for-android to relax the limit)
+ else
+ $(error Adjust the limit by ulimit -u and ulimit -n)
+ endif
+ endif
+
+ ifdef GOMA_DIR
+ goma_dir := $(GOMA_DIR)
+ else
+ goma_dir := $(HOME)/goma
+ endif
+ goma_ctl := $(goma_dir)/goma_ctl.py
+ GOMA_CC := $(goma_dir)/gomacc
+
+ $(if $(wildcard $(goma_ctl)),, \
+ $(warning You should have goma in $$GOMA_DIR or $(HOME)/goma) \
+ $(error See go/ma/how-to-use-goma/how-to-use-goma-for-android for detail))
+
+ # Append gomacc to existing *_WRAPPER variables so it's possible to
+ # use both ccache and gomacc.
+ CC_WRAPPER := $(strip $(CC_WRAPPER) $(GOMA_CC))
+ CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(GOMA_CC))
+
+ # gomacc can start goma client's daemon process automatically, but
+ # it is safer and faster to start up it beforehand. We run this as a
+ # background process so this won't slow down the build.
+ # We use "ensure_start" command when the compiler_proxy is already
+ # running and uses GOMA_HERMETIC=error flag. The compiler_proxy will
+ # restart otherwise.
+ # TODO(hamaji): Remove this condition after http://b/25676777 is fixed.
+ $(shell ( if ( curl http://localhost:$$($(GOMA_CC) port)/flagz | grep GOMA_HERMETIC=error ); then cmd=ensure_start; else cmd=restart; fi; GOMA_HERMETIC=error $(goma_ctl) $${cmd} ) &> /dev/null &)
+
+ goma_ctl :=
+ goma_dir :=
+endif
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index f8264ee..683b8b8 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -28,55 +28,55 @@
#######################################
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ LOCAL_JAVA_LIBRARIES += core-oj-hostdex
LOCAL_JAVA_LIBRARIES += core-libart-hostdex
endif
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
+full_classes_jack := $(intermediates.COMMON)/classes.jack
built_dex := $(intermediates.COMMON)/classes.dex
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_compiled_jar) \
$(full_classes_jarjar_jar) \
+ $(full_classes_jack) \
$(full_classes_jar) \
$(built_dex)
# See comment in java.mk
-java_alternative_checked_module := $(full_classes_compiled_jar)
+ifndef LOCAL_CHECKED_MODULE
+LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
+endif
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
+java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) \
+ $(filter %.java,$(LOCAL_GENERATED_SOURCES))
+all_java_sources := $(java_sources)
-$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
-
-java_alternative_checked_module :=
+include $(BUILD_SYSTEM)/java_common.mk
# The layers file allows you to enforce a layering between java packages.
# Run build/tools/java-layers.py for more details.
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
-
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
-$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS :=
$(full_classes_compiled_jar): \
$(java_sources) \
$(java_resource_sources) \
$(full_java_lib_deps) \
$(jar_manifest_file) \
$(proto_java_sources_file_stamp) \
- $(LOCAL_MODULE_MAKEFILE) \
+ $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-java-to-package)
@@ -96,6 +96,7 @@
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
+ifndef LOCAL_JACK_ENABLED
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
$(built_dex): $(full_classes_jar) $(DX)
@@ -109,6 +110,42 @@
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
$(add-dex-to-package)
+else # LOCAL_JACK_ENABLED
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
+
+ifeq ($(LOCAL_JACK_ENABLED),incremental)
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
+else
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_JACK_INCREMENTAL_DIR :=
+endif
+
+$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
+$(built_dex): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
+$(built_dex): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
+$(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \
+ $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE_DEP) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server
+ @echo Building with Jack: $@
+ $(jack-java-to-dex)
+
+# $(full_classes_jack) is just by-product of $(built_dex).
+# The dummy command was added because, without it, make misses the fact the $(built_dex) also
+# change $(full_classes_jack).
+$(full_classes_jack): $(built_dex)
+ $(hide) touch $@
+
+$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
+$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
+ @echo "Host Jar: $(PRIVATE_MODULE) ($@)"
+ $(create-empty-package)
+ $(add-dex-to-package)
+ $(add-carried-jack-resources)
+
+endif # LOCAL_JACK_ENABLED
+
USE_CORE_LIB_BOOTCLASSPATH :=
endif
diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk
index 9e5aaa3..47ca002 100644
--- a/core/host_dalvik_static_java_library.mk
+++ b/core/host_dalvik_static_java_library.mk
@@ -21,11 +21,39 @@
#
ifeq ($(HOST_OS),linux)
+LOCAL_UNINSTALLABLE_MODULE := true
+LOCAL_IS_STATIC_JAVA_LIBRARY := true
USE_CORE_LIB_BOOTCLASSPATH := true
+LOCAL_JAVA_LIBRARIES += core-oj-hostdex
LOCAL_JAVA_LIBRARIES += core-libart-hostdex
+intermediates.COMMON := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),true,COMMON,)
+full_classes_jack := $(intermediates.COMMON)/classes.jack
+LOCAL_INTERMEDIATE_TARGETS += \
+ $(full_classes_jack)
+
include $(BUILD_SYSTEM)/host_java_library.mk
+# proguard is not supported
+# *.proto files are not supported
+$(full_classes_jack): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
+$(full_classes_jack): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
+$(full_classes_jack): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_jack): \
+ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
+ifeq ($(LOCAL_JACK_ENABLED),incremental)
+$(full_classes_jack): \
+ PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
+else
+$(full_classes_jack): \
+ PRIVATE_JACK_INCREMENTAL_DIR :=
+endif
+$(full_classes_jack): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \
+ $(jar_manifest_file) $(layers_file) $(LOCAL_MODULE_MAKEFILE_DEP) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
+ $(JACK) | setup-jack-server
+ @echo Building with Jack: $@
+ $(java-to-jack)
USE_CORE_LIB_BOOTCLASSPATH :=
-
+LOCAL_IS_STATIC_JAVA_LIBRARY :=
endif
diff --git a/core/host_executable.mk b/core/host_executable.mk
index 0091f3f..bc55ef9 100644
--- a/core/host_executable.mk
+++ b/core/host_executable.mk
@@ -1,5 +1,6 @@
-
+LOCAL_IS_HOST_MODULE := true
my_prefix := HOST_
+LOCAL_HOST_PREFIX :=
include $(BUILD_SYSTEM)/multilib.mk
ifndef LOCAL_MODULE_HOST_ARCH
@@ -50,5 +51,30 @@
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif # HOST_2ND_ARCH
+ifdef HOST_CROSS_OS
+my_prefix := HOST_CROSS_
+LOCAL_HOST_PREFIX := $(my_prefix)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# Build for Windows
+OVERRIDE_BUILT_MODULE_PATH :=
+# we don't want others using the cross compiled version
+saved_LOCAL_BUILT_MODULE := $(LOCAL_BUILT_MODULE)
+saved_LOCAL_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE)
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_INTERMEDIATE_TARGETS :=
+
+ifeq ($(LOCAL_NO_FPIE),)
+LOCAL_LDFLAGS += $(HOST_CROSS_FPIE_FLAGS)
+endif
+
+include $(BUILD_SYSTEM)/host_executable_internal.mk
+LOCAL_BUILT_MODULE := $(saved_LOCAL_BUILT_MODULE)
+LOCAL_INSTALLED_MODULE := $(saved_LOCAL_INSTALLED_MODULE)
+endif
+LOCAL_HOST_PREFIX :=
+endif
+
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
my_module_arch_supported :=
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
index 0c0ac3d..b682ffd 100644
--- a/core/host_executable_internal.mk
+++ b/core/host_executable_internal.mk
@@ -5,12 +5,11 @@
## None.
###########################################################
-LOCAL_IS_HOST_MODULE := true
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := EXECUTABLES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
+LOCAL_MODULE_SUFFIX := $($(my_prefix)EXECUTABLE_SUFFIX)
endif
$(call host-executable-hook)
@@ -27,7 +26,7 @@
include $(BUILD_SYSTEM)/binary.mk
-my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_LIBPROFILE_RT)
+my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
$(LOCAL_BUILT_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
new file mode 100644
index 0000000..cc7baad
--- /dev/null
+++ b/core/host_fuzz_test.mk
@@ -0,0 +1,9 @@
+################################################
+## A thin wrapper around BUILD_HOST_EXECUTABLE
+## Common flags for host fuzz tests are added.
+################################################
+
+LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
+LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
+
+include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index b751c5f..052c571 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -43,6 +43,12 @@
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
+java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) \
+ $(filter %.java,$(LOCAL_GENERATED_SOURCES))
+all_java_sources := $(java_sources)
+
+include $(BUILD_SYSTEM)/java_common.mk
+
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
@@ -58,33 +64,30 @@
$(full_classes_emma_jar) : $(full_classes_compiled_jar) | $(EMMA_JAR)
$(transform-classes.jar-to-emma)
-$(LOCAL_BUILT_MODULE) : $(full_classes_emma_jar)
+$(built_javalib_jar) : $(full_classes_emma_jar)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
else # LOCAL_EMMA_INSTRUMENT
-# Directly build into LOCAL_BUILT_MODULE.
-full_classes_compiled_jar := $(LOCAL_BUILT_MODULE)
+# Directly build into $(built_javalib_jar).
+full_classes_compiled_jar := $(built_javalib_jar)
endif # LOCAL_EMMA_INSTRUMENT
-$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
-
# The layers file allows you to enforce a layering between java packages.
# Run build/tools/java-layers.py for more details.
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
-$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS :=
$(full_classes_compiled_jar): \
$(java_sources) \
$(java_resource_sources) \
$(full_java_lib_deps) \
$(jar_manifest_file) \
$(proto_java_sources_file_stamp) \
- $(LOCAL_MODULE_MAKEFILE) \
+ $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-java-to-package)
diff --git a/core/host_java_library_common.mk b/core/host_java_library_common.mk
index cd9e679..35a6e28 100644
--- a/core/host_java_library_common.mk
+++ b/core/host_java_library_common.mk
@@ -23,6 +23,22 @@
LOCAL_IS_HOST_MODULE := true
LOCAL_BUILT_MODULE_STEM := javalib.jar
+intermediates := $(call local-intermediates-dir)
+intermediates.COMMON := $(call local-intermediates-dir,COMMON)
+
+built_javalib_jar := $(intermediates)/javalib.jar
+
+#################################
+include $(BUILD_SYSTEM)/configure_local_jack.mk
+#################################
+
+ifdef LOCAL_JACK_ENABLED
+ifdef LOCAL_IS_STATIC_JAVA_LIBRARY
+LOCAL_BUILT_MODULE_STEM := classes.jack
+LOCAL_INTERMEDIATE_TARGETS += $(built_javalib_jar)
+endif
+endif
+
# base_rules.mk looks at this
all_res_assets :=
@@ -34,14 +50,15 @@
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-nano
else
- LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-lite
+ ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
+ LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-full
+ else
+ LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-lite
+ endif
endif
endif
endif
-intermediates := $(call local-intermediates-dir)
-intermediates.COMMON := $(call local-intermediates-dir,COMMON)
-
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
index b54bd3a..7cba1ae 100644
--- a/core/host_native_test.mk
+++ b/core/host_native_test.mk
@@ -5,4 +5,22 @@
include $(BUILD_SYSTEM)/host_test_internal.mk
+needs_symlink :=
+ifndef LOCAL_MULTILIB
+ ifndef LOCAL_32_BIT_ONLY
+ LOCAL_MULTILIB := both
+
+ ifeq (,$(LOCAL_MODULE_STEM_32)$(LOCAL_MODULE_STEM_64))
+ LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+ LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+ needs_symlink := true
+ endif
+ endif
+endif
+
include $(BUILD_HOST_EXECUTABLE)
+
+ifdef needs_symlink
+include $(BUILD_SYSTEM)/executable_prefer_symlink.mk
+needs_symlink :=
+endif
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index e840780..49000a4 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -1,4 +1,6 @@
+LOCAL_IS_HOST_MODULE := true
my_prefix := HOST_
+LOCAL_HOST_PREFIX :=
include $(BUILD_SYSTEM)/multilib.mk
ifndef LOCAL_MODULE_HOST_ARCH
@@ -34,6 +36,26 @@
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif # HOST_2ND_ARCH
+ifdef HOST_CROSS_OS
+my_prefix := HOST_CROSS_
+LOCAL_HOST_PREFIX := $(my_prefix)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# Build for Windows
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_MODULE_SUFFIX :=
+# We don't want makefiles using the cross-compiled host tool
+saved_LOCAL_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE)
+LOCAL_INSTALLED_MODULE :=
+LOCAL_INTERMEDIATE_TARGETS :=
+
+include $(BUILD_SYSTEM)/host_shared_library_internal.mk
+LOCAL_INSTALLED_MODULE := $(saved_LOCAL_INSTALLED_MODULE)
+endif
+LOCAL_HOST_PREFIX :=
+endif
+
my_module_arch_supported :=
###########################################################
diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk
index 645098a..272e76f 100644
--- a/core/host_shared_library_internal.mk
+++ b/core/host_shared_library_internal.mk
@@ -7,13 +7,11 @@
## LOCAL_MODULE_SUFFIX will be set for you.
###########################################################
-LOCAL_IS_HOST_MODULE := true
-
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
+LOCAL_MODULE_SUFFIX := $($(my_prefix)SHLIB_SUFFIX)
endif
ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
@@ -36,17 +34,17 @@
# Put the built modules of all shared libraries in a common directory
# to simplify the link line.
-OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)
+OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
include $(BUILD_SYSTEM)/binary.mk
-my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_LIBPROFILE_RT)
+my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
$(LOCAL_BUILD_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
$(LOCAL_BUILT_MODULE): \
$(all_objects) \
$(all_libraries) \
- $(LOCAL_MODULE_MAKEFILE) \
+ $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-o-to-shared-lib)
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index 52c42ef..aa8c0e3 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -1,4 +1,6 @@
+LOCAL_IS_HOST_MODULE := true
my_prefix := HOST_
+LOCAL_HOST_PREFIX :=
include $(BUILD_SYSTEM)/multilib.mk
ifndef LOCAL_MODULE_HOST_ARCH
@@ -34,6 +36,22 @@
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif # HOST_2ND_ARCH
+ifdef HOST_CROSS_OS
+my_prefix := HOST_CROSS_
+LOCAL_HOST_PREFIX := $(my_prefix)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# Build for Windows
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_INTERMEDIATE_TARGETS :=
+
+include $(BUILD_SYSTEM)/host_static_library_internal.mk
+endif
+LOCAL_HOST_PREFIX :=
+endif
+
my_module_arch_supported :=
###########################################################
diff --git a/core/host_static_library_internal.mk b/core/host_static_library_internal.mk
index a533cf5..3946aa7 100644
--- a/core/host_static_library_internal.mk
+++ b/core/host_static_library_internal.mk
@@ -18,8 +18,6 @@
endif
LOCAL_UNINSTALLABLE_MODULE := true
-LOCAL_IS_HOST_MODULE := true
-
include $(BUILD_SYSTEM)/binary.mk
$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk
index e0070c1..7f6aff0 100644
--- a/core/host_test_internal.mk
+++ b/core/host_test_internal.mk
@@ -2,14 +2,13 @@
## Shared definitions for all host test compilations.
#####################################################
-ifeq ($(HOST_OS),windows)
-LOCAL_CFLAGS += -DGTEST_OS_WINDOWS
-else
-LOCAL_CFLAGS += -DGTEST_OS_LINUX
-LOCAL_LDLIBS += -lpthread
-endif
+LOCAL_CFLAGS_windows += -DGTEST_OS_WINDOWS
+LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX
+LOCAL_LDLIBS_linux += -lpthread
+LOCAL_CFLAGS_darwin += -DGTEST_OS_LINUX
+LOCAL_LDLIBS_darwin += -lpthread
LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
LOCAL_C_INCLUDES += external/gtest/include
-LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
+LOCAL_STATIC_LIBRARIES += libgtest_main_host libgtest_host
diff --git a/core/install_jni_libs.mk b/core/install_jni_libs.mk
index da3032d..625a8a2 100644
--- a/core/install_jni_libs.mk
+++ b/core/install_jni_libs.mk
@@ -8,7 +8,7 @@
#
# Output variables:
# jni_shared_libraries, jni_shared_libraries_abi, jni_shared_libraries_with_abis if we are going to embed the libraries into the apk;
-# extracted_jni_libs, if we extract jni libs from prebuilt apk.
+# embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk.
#
my_embed_jni :=
@@ -27,7 +27,7 @@
jni_shared_libraries_abis :=
# jni_shared_libraries_with_abis is a list of <abi>:<path-to-the-built-jni-lib>
jni_shared_libraries_with_abis :=
-extracted_jni_libs :=
+embedded_prebuilt_jni_libs :=
#######################################
# For TARGET_ARCH
@@ -51,7 +51,7 @@
jni_shared_libraries_abis += $(my_jni_shared_libraries_abi)
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
$(my_jni_shared_libraries))
-extracted_jni_libs += $(my_extracted_jni_libs)
+embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs)
# Include RS dynamically-generated libraries as well
# TODO: Add multilib support once RS supports generating multilib libraries.
@@ -83,11 +83,11 @@
jni_shared_libraries_abis += $(my_jni_shared_libraries_abi)
jni_shared_libraries_with_abis += $(addprefix $(my_jni_shared_libraries_abi):,\
$(my_jni_shared_libraries))
-extracted_jni_libs += $(my_extracted_jni_libs)
+embedded_prebuilt_jni_libs += $(my_embedded_prebuilt_jni_libs)
endif # my_add_jni
endif # TARGET_2ND_ARCH
jni_shared_libraries := $(strip $(jni_shared_libraries))
jni_shared_libraries_abis := $(sort $(jni_shared_libraries_abis))
jni_shared_libraries_with_abis := $(strip $(jni_shared_libraries_with_abis))
-extracted_jni_libs := $(strip $(extracted_jni_libs))
+embedded_prebuilt_jni_libs := $(strip $(embedded_prebuilt_jni_libs))
diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk
index c28bb15..27b9697 100644
--- a/core/install_jni_libs_internal.mk
+++ b/core/install_jni_libs_internal.mk
@@ -9,7 +9,7 @@
#
# Output variables:
# my_jni_shared_libraries, my_jni_shared_libraries_abi, if we are going to embed the libraries into the apk;
-# my_extracted_jni_libs, if we extract jni libs from prebuilt apk.
+# my_embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk.
#
my_jni_shared_libraries := \
@@ -19,7 +19,7 @@
# App-specific lib path.
my_app_lib_path := $(dir $(LOCAL_INSTALLED_MODULE))lib/$(TARGET_$(my_2nd_arch_prefix)ARCH)
-my_extracted_jni_libs :=
+my_embedded_prebuilt_jni_libs :=
ifdef my_embed_jni
# App explicitly requires the prebuilt NDK stl shared libraies.
@@ -55,7 +55,8 @@
my_jni_filenames := $(notdir $(my_jni_shared_libraries))
# Make sure the JNI libraries get installed
my_shared_library_path := $($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES)
-$(LOCAL_INSTALLED_MODULE) : | $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
+# Do not use order-only dependency, because we want to rebuild the image if an jni is updated.
+$(LOCAL_INSTALLED_MODULE) : $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
# Create symlink in the app specific lib path
ifdef LOCAL_POST_INSTALL_CMD
@@ -76,25 +77,10 @@
endif # my_embed_jni
ifdef my_prebuilt_jni_libs
-# Install prebuilt JNI libs to the app specific lib path.
-# Files like @path/to/libfoo.so (path inside the apk) are JNI libs extracted from the prebuilt apk;
+# Files like @lib/<abi>/libfoo.so (path inside the apk) are JNI libs embedded prebuilt apk;
# Files like path/to/libfoo.so (path relative to LOCAL_PATH) are prebuilts in the source tree.
-my_extracted_jni_libs := $(patsubst @%,%, \
+my_embedded_prebuilt_jni_libs := $(patsubst @%,%, \
$(filter @%, $(my_prebuilt_jni_libs)))
-ifdef my_extracted_jni_libs
-ifndef my_prebuilt_src_file
-$(error No prebuilt apk to extract prebuilt jni libraries $(my_extracted_jni_libs))
-endif
-# We use the first jni lib file as dependency.
-my_installed_prebuilt_jni := $(my_app_lib_path)/$(notdir $(firstword $(my_extracted_jni_libs)))
-$(my_installed_prebuilt_jni): PRIVATE_JNI_LIBS := $(my_extracted_jni_libs)
-$(my_installed_prebuilt_jni): $(my_prebuilt_src_file)
- @echo "Extract JNI libs ($@ <- $<)"
- @mkdir -p $(dir $@)
- $(hide) unzip -j -o -d $(dir $@) $< $(PRIVATE_JNI_LIBS) && touch $@
-
-$(LOCAL_INSTALLED_MODULE) : | $(my_installed_prebuilt_jni)
-endif
# prebuilt JNI exsiting as separate source files.
my_prebuilt_jni_libs := $(addprefix $(LOCAL_PATH)/, \
@@ -108,7 +94,7 @@
$(foreach lib, $(my_prebuilt_jni_libs), \
$(eval $(call copy-one-file, $(lib), $(my_app_lib_path)/$(notdir $(lib)))))
-$(LOCAL_INSTALLED_MODULE) : | $(addprefix $(my_app_lib_path)/, $(notdir $(my_prebuilt_jni_libs)))
+$(LOCAL_INSTALLED_MODULE) : $(addprefix $(my_app_lib_path)/, $(notdir $(my_prebuilt_jni_libs)))
endif # my_embed_jni
endif # inner my_prebuilt_jni_libs
endif # outer my_prebuilt_jni_libs
diff --git a/core/jack-default.args b/core/jack-default.args
new file mode 100644
index 0000000..8d70a82
--- /dev/null
+++ b/core/jack-default.args
@@ -0,0 +1,5 @@
+-D sched.runner=multi-threaded
+-D sched.runner.thread.kind=fixed
+-D sched.runner.thread.fixed.count=4
+--sanity-checks off
+-D jack.reporter.level.file=error=--,warning=-
\ No newline at end of file
diff --git a/core/java.mk b/core/java.mk
index fc4703c..a0ab4c5 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -1,3 +1,4 @@
+# Target Java.
# Requires:
# LOCAL_MODULE_SUFFIX
# LOCAL_MODULE_CLASS
@@ -7,7 +8,9 @@
ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
# LOCAL_SDK not defined or set to current
ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
+ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
+endif #!LOCAL_NO_STANDARD_LIBRARIES
endif
endif # !PDK_JAVA
endif #PDK
@@ -112,6 +115,10 @@
full_classes_jar := $(intermediates.COMMON)/classes.jar
built_dex := $(intermediates.COMMON)/classes.dex
endif
+# final Jack library, shrinked and obfuscated if it must be
+full_classes_jack := $(intermediates.COMMON)/classes.jack
+# intermediate Jack library without shrink and obfuscation
+noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_compiled_jar) \
@@ -120,6 +127,8 @@
$(full_classes_jar) \
$(full_classes_proguard_jar) \
$(built_dex_intermediate) \
+ $(full_classes_jack) \
+ $(noshrob_classes_jack) \
$(built_dex) \
$(full_classes_stubs_jar)
@@ -140,19 +149,29 @@
RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
renderscript_intermediate.COMMON := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript
+# Defaulting to an empty string uses the latest available platform SDK.
renderscript_target_api :=
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
-renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
+ renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
else
-ifneq (,$(LOCAL_SDK_VERSION))
-# Set target-api for LOCAL_SDK_VERSIONs other than current.
-ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
-renderscript_target_api := $(LOCAL_SDK_VERSION)
-endif
-endif # LOCAL_SDK_VERSION is set
+ ifneq (,$(LOCAL_SDK_VERSION))
+ # Set target-api for LOCAL_SDK_VERSIONs other than current.
+ ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
+ renderscript_target_api := $(LOCAL_SDK_VERSION)
+ endif
+ endif # LOCAL_SDK_VERSION is set
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
+# For 64-bit, we always have to upgrade to at least 21 for compat build.
+ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
+ ifeq ($(TARGET_IS_64_BIT),true)
+ ifneq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
+ renderscript_target_api := 21
+ endif
+ endif
+endif
+
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
endif
@@ -245,7 +264,7 @@
$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
$(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
$(rs_compatibility_jni_libs): $(BCC_COMPAT)
-$(rs_compatibility_jni_libs): PRIVATE_CXX := $(TARGET_CXX)
+$(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(TARGET_CXX)
$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
$(renderscript_intermediate.bc_folder)%.bc
$(transform-bc-to-so)
@@ -259,26 +278,80 @@
LOCAL_RESOURCE_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript/res $(LOCAL_RESOURCE_DIR)
endif
+
+###########################################################
+## AIDL: Compile .aidl files to .java
+###########################################################
+aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
+
+ifneq ($(strip $(aidl_sources)),)
+aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
+aidl_sources := $(addprefix $(LOCAL_PATH)/, $(aidl_sources))
+
+aidl_preprocess_import :=
+ifdef LOCAL_SDK_VERSION
+ifneq ($(filter current system_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
+ # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
+ aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
+else
+ aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
+endif # not current or system_current
+else
+# build against the platform.
+LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
+endif # LOCAL_SDK_VERSION
+$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
+
+$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: \
+ $(LOCAL_PATH)/%.aidl \
+ $(LOCAL_MODULE_MAKEFILE_DEP) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) \
+ $(AIDL) \
+ $(aidl_preprocess_import)
+ $(transform-aidl-to-java)
+-include $(aidl_java_sources:%.java=%.P)
+
+else
+aidl_java_sources :=
+endif
+
+##########################################
+
# All of the rules after full_classes_compiled_jar are very unlikely
# to fail except for bugs in their respective tools. If you would
# like to run these rules, add the "all" modifier goal to the make
# command line.
+ifndef LOCAL_CHECKED_MODULE
ifdef full_classes_jar
-java_alternative_checked_module := $(full_classes_compiled_jar)
-else
-java_alternative_checked_module :=
+LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
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
-# after all the declarations.
+endif
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
-java_alternative_checked_module :=
+###########################################################
+## logtags: emit java source
+###########################################################
+ifneq ($(strip $(logtags_sources)),)
+
+logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
+logtags_sources := $(addprefix $(LOCAL_PATH)/, $(logtags_sources))
+
+$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
+ $(transform-logtags-to-java)
+
+else
+logtags_java_sources :=
+endif
+
+##########################################
+java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
+ $(filter %.java,$(LOCAL_GENERATED_SOURCES))
+all_java_sources := $(java_sources) $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
+
+include $(BUILD_SYSTEM)/java_common.mk
#######################################
# defines built_odex along with rule to install odex
@@ -292,37 +365,6 @@
endif
endif
-# Install the RS compatibility libraries to /system/lib/ if necessary
-ifdef rs_compatibility_jni_libs
-installed_rs_compatibility_jni_libs := $(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/,\
- $(notdir $(rs_compatibility_jni_libs)))
-# Provide a way to skip sources included in multiple projects.
-ifdef LOCAL_RENDERSCRIPT_SKIP_INSTALL
-skip_install_rs_libs := $(patsubst %.rs,%.so, \
- $(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/librs., \
- $(notdir $(LOCAL_RENDERSCRIPT_SKIP_INSTALL))))
-installed_rs_compatibility_jni_libs := \
- $(filter-out $(skip_install_rs_libs),$(installed_rs_compatibility_jni_libs))
-endif
-ifneq (,$(strip $(installed_rs_compatibility_jni_libs)))
-$(installed_rs_compatibility_jni_libs) : $(TARGET_OUT_SHARED_LIBRARIES)/lib%.so : \
- $(renderscript_intermediate)/lib%.so
- $(hide) mkdir -p $(dir $@) && cp -f $< $@
-
-# Install them only if the current module is installed.
-$(LOCAL_INSTALLED_MODULE) : $(installed_rs_compatibility_jni_libs)
-endif
-endif
-
-# We use intermediates.COMMON because the classes.jar/.dex files will be
-# common even if LOCAL_BUILT_MODULE isn't.
-#
-# Override some target variables that base_rules set up for us.
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
-
# Since we're using intermediates.COMMON, make sure that it gets cleaned
# properly.
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
@@ -338,7 +380,7 @@
# - This extra copy, with the dependency on LOCAL_BUILT_MODULE allows the
# PRIVATE_ vars to be preserved.
$(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar)
-$(full_classes_stubs_jar) : $(LOCAL_BUILT_MODULE) | $(ACP)
+$(full_classes_stubs_jar) : $(full_classes_jar) | $(ACP)
@echo Copying $(PRIVATE_SOURCE_FILE)
$(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@
ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
@@ -357,11 +399,10 @@
# This intentionally depends on java_sources, not all_java_sources.
# Deps for generated source files must be handled separately,
# via deps on the target that generates the sources.
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
-$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_compiled_jar): \
$(java_sources) \
@@ -371,12 +412,10 @@
$(layers_file) \
$(RenderScript_file_stamp) \
$(proto_java_sources_file_stamp) \
- $(LOCAL_MODULE_MAKEFILE) \
+ $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-java-to-classes.jar)
-$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
-
# Run jarjar if necessary, otherwise just copy the file.
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
@@ -417,6 +456,8 @@
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
+$(call define-jar-to-toc-rule, $(full_classes_jar))
+
# Run proguard if necessary, otherwise just copy the file.
ifdef LOCAL_PROGUARD_ENABLED
ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
@@ -424,50 +465,78 @@
$(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
endif
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
-proguard_flags := $(addprefix -libraryjars ,$(full_shared_java_libs)) \
+
+# Hack: see b/20667396
+# When an app's LOCAL_SDK_VERSION is lower than the support library's LOCAL_SDK_VERSION,
+# we artifically raises the "SDK version" "linked" by ProGuard, to
+# - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
+# - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
+my_support_library_sdk_raise :=
+ifneq (,$(filter android-support-%,$(LOCAL_STATIC_JAVA_LIBRARIES)))
+ifdef LOCAL_SDK_VERSION
+ifdef TARGET_BUILD_APPS
+ifeq (,$(filter current system_current, $(LOCAL_SDK_VERSION)))
+ my_support_library_sdk_raise := $(call java-lib-files, sdk_vcurrent)
+endif
+else
+ # For platform build, we can't just raise to the "current" SDK,
+ # that would break apps that use APIs removed from the current SDK.
+ my_support_library_sdk_raise := $(call java-lib-files,$(TARGET_DEFAULT_JAVA_LIBRARIES))
+endif
+endif
+endif
+
+# jack already has the libraries in its classpath and doesn't support jars
+legacy_proguard_flags := $(addprefix -libraryjars ,$(my_support_library_sdk_raise) $(full_shared_java_libs))
+common_proguard_flags := \
-forceprocessing \
-printmapping $(proguard_dictionary)
ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
-proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags
+common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
+common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
endif
# If this is a test package, add proguard keep flags for tests.
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
-proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags
+common_proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags
ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
-proguard_flags += -dontshrink # don't shrink tests by default
+common_proguard_flags += -dontshrink # don't shrink tests by default
endif # shrinktests
endif # test package
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
# By default no obfuscation
-proguard_flags += -dontobfuscate
+common_proguard_flags += -dontobfuscate
endif # No obfuscation
ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
# By default no optimization
-proguard_flags += -dontoptimize
+common_proguard_flags += -dontoptimize
endif # No optimization
ifdef LOCAL_INSTRUMENTATION_FOR
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
# If no obfuscation, link in the instrmented package's classes.jar as a library.
# link_instr_classes_jar is defined in base_rule.mk
-proguard_flags += -libraryjars $(link_instr_classes_jar)
+# jack already has this library in its classpath and doesn't support jars
+legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
else # obfuscation
# If obfuscation is enabled, the main app must be obfuscated too.
# We need to run obfuscation using the main app's dictionary,
# and treat the main app's class.jar as injars instead of libraryjars.
-proguard_flags := -injars $(link_instr_classes_jar) \
+legacy_proguard_flags := -injars $(link_instr_classes_jar) \
-outjars $(intermediates.COMMON)/proguard.$(LOCAL_INSTRUMENTATION_FOR).jar \
-include $(link_instr_intermediates_dir.COMMON)/proguard_options \
-applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
-verbose \
- $(proguard_flags)
+ $(legacy_proguard_flags)
+# not supported with jack
+ifdef LOCAL_JACK_ENABLED
+ $(error $(LOCAL_MODULE): Build with jack of instrumentation when obfuscating is not yet supported)
+endif
# Sometimes (test + main app) uses different keep rules from the main app -
# apply the main app's dictionary anyway.
-proguard_flags += -ignorewarnings
+legacy_proguard_flags += -ignorewarnings
# Make sure we run Proguard on the main app first
$(full_classes_proguard_jar) : $(link_instr_intermediates_dir.COMMON)/proguard.classes.jar
@@ -485,8 +554,8 @@
extra_input_jar :=
endif
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
-$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(proguard_flags) $(LOCAL_PROGUARD_FLAGS)
-$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(proguard_flag_files) | $(ACP) $(PROGUARD)
+$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
+$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(proguard_flag_files) | $(ACP) $(PROGUARD)
$(call transform-jar-to-proguard)
else # LOCAL_PROGUARD_ENABLED not defined
@@ -496,7 +565,7 @@
endif # LOCAL_PROGUARD_ENABLED defined
-
+ifndef LOCAL_JACK_ENABLED
# Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
# will work even when intermediates != intermediates.COMMON.
$(built_dex_intermediate): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
@@ -512,6 +581,8 @@
endif
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
$(transform-classes.jar-to-dex)
+endif # LOCAL_JACK_ENABLED is disabled
+
$(built_dex): $(built_dex_intermediate) | $(ACP)
@echo Copying: $@
$(hide) mkdir -p $(dir $@)
@@ -522,17 +593,14 @@
endif
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
-$(findbugs_xml) : PRIVATE_JAR_FILE := $(full_classes_jar)
$(findbugs_xml) : PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
$(call normalize-path-list,$(filter %.jar,\
$(full_java_libs)))))
-# We can't depend directly on full_classes_jar because the PRIVATE_
-# vars won't be set up correctly.
-$(findbugs_xml) : $(LOCAL_BUILT_MODULE)
+$(findbugs_xml) : $(full_classes_jar)
@echo Findbugs: $@
$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
$(PRIVATE_AUXCLASSPATH) \
- $(PRIVATE_JAR_FILE) \
+ $< \
> $@
ALL_FINDBUGS_FILES += $(findbugs_xml)
@@ -549,3 +617,78 @@
$(LOCAL_MODULE)-findbugs : $(findbugs_html)
endif # full_classes_jar is defined
+
+ifdef LOCAL_JACK_ENABLED
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
+ifeq ($(LOCAL_JACK_ENABLED),incremental)
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
+else
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_JACK_INCREMENTAL_DIR :=
+endif
+
+ifdef full_classes_jar
+ifdef LOCAL_PROGUARD_ENABLED
+
+ifndef LOCAL_JACK_PROGUARD_FLAGS
+ LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
+endif
+LOCAL_JACK_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
+ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
+ $(error $(LOCAL_MODULE): Build with jack when LOCAL_TEST_MODULE_TO_PROGUARD_WITH is defined is not yet implemented)
+endif
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := $(common_proguard_flags) $(LOCAL_JACK_PROGUARD_FLAGS)
+else # LOCAL_PROGUARD_ENABLED not defined
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS :=
+endif # LOCAL_PROGUARD_ENABLED defined
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
+
+jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \
+ $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \
+ $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
+ $(LOCAL_MODULE_MAKEFILE_DEP) $(JACK)
+
+ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
+$(full_classes_jack): $(jack_all_deps) | setup-jack-server
+ @echo Building with Jack: $@
+ $(java-to-jack)
+
+# Update timestamps of .toc files for static java libraries so
+# dependents will be always rebuilt.
+$(built_dex).toc: $(full_classes_jack)
+ touch $@
+
+else #LOCAL_IS_STATIC_JAVA_LIBRARY
+$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)
+
+$(built_dex_intermediate): $(jack_all_deps) | setup-jack-server
+ @echo Building with Jack: $@
+ $(jack-java-to-dex)
+
+# $(full_classes_jack) is just by-product of $(built_dex_intermediate).
+# The dummy command was added because, without it, make misses the fact the $(built_dex) also
+# change $(full_classes_jack).
+$(full_classes_jack): $(built_dex_intermediate)
+ $(hide) touch $@
+
+$(call define-dex-to-toc-rule, $(intermediates.COMMON))
+
+endif #LOCAL_IS_STATIC_JAVA_LIBRARY
+
+$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
+ifeq ($(LOCAL_JACK_ENABLED),incremental)
+$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
+else
+$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
+endif
+$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
+$(noshrob_classes_jack): $(jack_all_deps) | setup-jack-server
+ @echo Building with Jack: $@
+ $(java-to-jack)
+endif # full_classes_jar is defined
+endif # LOCAL_JACK_ENABLED
diff --git a/core/java_common.mk b/core/java_common.mk
new file mode 100644
index 0000000..aee3193
--- /dev/null
+++ b/core/java_common.mk
@@ -0,0 +1,352 @@
+# Common to host and target Java modules.
+
+###########################################################
+## .proto files: Compile proto files to .java
+###########################################################
+proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
+# Because names of the .java files compiled from .proto files are unknown until the
+# .proto files are compiled, we use a timestamp file as depedency.
+proto_java_sources_file_stamp :=
+ifneq ($(proto_sources),)
+proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
+
+# 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.
+proto_java_intemediate_dir := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/proto
+proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp
+proto_java_sources_dir := $(proto_java_intemediate_dir)/src
+
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir)
+ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out
+else
+ ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
+ else
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
+ endif
+endif
+$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
+$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
+ $(call transform-proto-to-java)
+
+#TODO: protoc should output the dependencies introduced by imports.
+endif # proto_sources
+
+#########################################
+## Java resources
+
+# Look for resource files in any specified directories.
+# Non-java and non-doc files will be picked up as resources
+# and included in the output jar file.
+java_resource_file_groups :=
+
+LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
+ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
+ # This makes a list of words like
+ # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
+ # where each of the files is relative to the directory it's grouped with.
+ # Directories that don't contain any resource files will result in groups
+ # that end with a colon, and they are stripped out in the next step.
+ java_resource_file_groups += \
+ $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
+ $(subst $(space),:,$(strip \
+ $(LOCAL_PATH)/$(dir): \
+ $(patsubst ./%,%,$(sort $(shell cd $(LOCAL_PATH)/$(dir) && \
+ find . \
+ -type d -a -name ".svn" -prune -o \
+ -type f \
+ -a \! -name "*.java" \
+ -a \! -name "package.html" \
+ -a \! -name "overview.html" \
+ -a \! -name ".*.swp" \
+ -a \! -name ".DS_Store" \
+ -a \! -name "*~" \
+ -print \
+ ))) \
+ )) \
+ )
+ java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
+endif # LOCAL_JAVA_RESOURCE_DIRS
+
+LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
+ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
+ java_resource_file_groups += \
+ $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
+ $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
+ )
+endif # LOCAL_JAVA_RESOURCE_FILES
+
+ifdef java_resource_file_groups
+ # The full paths to all resources, used for dependencies.
+ java_resource_sources := \
+ $(foreach group,$(java_resource_file_groups), \
+ $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
+ $(wordlist 2,9999,$(subst :,$(space),$(group))) \
+ ) \
+ )
+ # The arguments to jar that will include these files in a jar file.
+ # Quote the file name to handle special characters (such as #) correctly.
+ extra_jar_args := \
+ $(foreach group,$(java_resource_file_groups), \
+ $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \
+ $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \
+ ) \
+ )
+ java_resource_file_groups :=
+else
+ java_resource_sources :=
+ extra_jar_args :=
+endif # java_resource_file_groups
+
+######################################
+## PRIVATE java vars
+# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
+# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
+# You have to set up the dependency in some other way.
+need_compile_java := $(strip $(all_java_sources)$(all_res_assets)$(java_resource_sources))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))
+ifdef need_compile_java
+
+full_static_java_libs := \
+ $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
+ $(call intermediates-dir-for, \
+ JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar)
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
+
+# full_java_libs: The list of files that should be used as the classpath.
+# Using this list as a dependency list WILL NOT WORK.
+# full_java_lib_deps: Should be specified as a prerequisite of this module
+# to guarantee that the files in full_java_libs will
+# be up-to-date.
+ifndef LOCAL_IS_HOST_MODULE
+ifeq ($(LOCAL_SDK_VERSION),)
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+# No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath.
+my_bootclasspath := ""
+else # LOCAL_NO_STANDARD_LIBRARIES
+my_bootclasspath := $(call java-lib-files,core-oj):$(call java-lib-files,core-libart)
+endif # LOCAL_NO_STANDARD_LIBRARIES
+else
+ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
+# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
+my_bootclasspath := $(call java-lib-files,android_stubs_current)
+else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
+my_bootclasspath := $(call java-lib-files,android_system_stubs_current)
+else
+my_bootclasspath := $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
+endif # current or system_current
+endif # LOCAL_SDK_VERSION
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
+
+full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_java_lib_deps := $(addsuffix .toc, $(full_java_lib_deps))
+
+else # LOCAL_IS_HOST_MODULE
+
+ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+my_bootclasspath := ""
+else
+my_bootclasspath := $(call java-lib-files,core-oj-hostdex,$(LOCAL_IS_HOST_MODULE)):$(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
+endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
+
+full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) \
+ $(full_shared_java_libs)
+else
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
+
+full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
+ $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
+full_java_lib_deps := $(full_shared_java_libs)
+endif # USE_CORE_LIB_BOOTCLASSPATH
+endif # !LOCAL_IS_HOST_MODULE
+
+full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
+full_java_lib_deps := $(full_java_lib_deps) $(full_static_java_libs) $(LOCAL_CLASSPATH)
+
+ifndef LOCAL_IS_HOST_MODULE
+# This is set by packages that are linking to other packages that export
+# shared libraries, allowing them to make use of the code in the linked apk.
+apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
+ifneq ($(apk_libraries),)
+ link_apk_libraries := \
+ $(foreach lib,$(apk_libraries), \
+ $(call intermediates-dir-for, \
+ APPS,$(lib),,COMMON)/classes.jar)
+
+ # link against the jar with full original names (before proguard processing).
+ full_shared_java_libs += $(link_apk_libraries)
+ full_java_libs += $(link_apk_libraries)
+ full_java_lib_deps += $(link_apk_libraries)
+endif
+
+# This is set by packages that contain instrumentation, allowing them to
+# link against the package they are instrumenting. Currently only one such
+# package is allowed.
+LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
+ifdef LOCAL_INSTRUMENTATION_FOR
+ ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
+ $(error \
+ $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
+ endif
+
+ link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
+ APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
+ # link against the jar with full original names (before proguard processing).
+ link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
+ full_java_libs += $(link_instr_classes_jar)
+ full_java_lib_deps += $(link_instr_classes_jar)
+endif # LOCAL_INSTRUMENTATION_FOR
+endif # LOCAL_IS_HOST_MODULE
+
+endif # need_compile_java
+
+# We may want to add jar manifest or jar resource files even if there is no java code at all.
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
+jar_manifest_file :=
+ifneq ($(strip $(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
+
+##########################################################
+ifndef LOCAL_IS_HOST_MODULE
+## AAPT Flags
+# aapt doesn't accept multiple --extra-packages flags.
+# We have to collapse them into a single --extra-packages flag here.
+LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
+ifdef LOCAL_AAPT_FLAGS
+ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
+aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
+aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
+aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
+LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
+ --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
+aapt_flags_extra_packages :=
+aapt_flags :=
+endif
+endif
+
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
+
+ifdef aidl_sources
+ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources)
+endif
+endif # !LOCAL_IS_HOST_MODULE
+
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs)
+
+ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
+ $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
+
+###########################################################
+# JACK
+###########################################################
+ifdef LOCAL_JACK_ENABLED
+ifdef need_compile_java
+
+full_static_jack_libs := \
+ $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
+ $(call intermediates-dir-for, \
+ JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jack)
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs)
+
+ifndef LOCAL_IS_HOST_MODULE
+ifeq ($(LOCAL_SDK_VERSION),)
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+my_bootclasspath :=
+else
+my_bootclasspath := $(call jack-lib-files,core-oj):$(call jack-lib-files,core-libart)
+endif
+else # LOCAL_SDK_VERSION
+ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
+# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
+my_bootclasspath := $(call jack-lib-files,android_stubs_current)
+else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
+my_bootclasspath := $(call jack-lib-files,android_system_stubs_current)
+else
+my_bootclasspath :=$(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION))
+endif # current or system_current
+endif # LOCAL_SDK_VERSION
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath)
+
+full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+# Turn off .toc optimization for apps build as we cannot build dexdump.
+ifeq (,$(TARGET_BUILD_APPS))
+full_jack_lib_deps := $(patsubst %.jack, %.dex.toc, $(full_jack_lib_deps))
+endif
+
+else # LOCAL_IS_HOST_MODULE
+
+ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+my_bootclasspath :=
+else
+my_bootclasspath := $(call jack-lib-files,core-oj-hostdex,$(LOCAL_IS_HOST_MODULE)):$(call jack-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
+endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath)
+full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+else
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES :=
+full_shared_jack_libs := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_jack_lib_deps := $(full_shared_jack_libs)
+endif # USE_CORE_LIB_BOOTCLASSPATH
+endif # !LOCAL_IS_HOST_MODULE
+full_jack_libs := $(full_shared_jack_libs) $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH)
+full_jack_lib_deps += $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH)
+
+ifndef LOCAL_IS_HOST_MODULE
+# This is set by packages that are linking to other packages that export
+# shared libraries, allowing them to make use of the code in the linked apk.
+ifneq ($(apk_libraries),)
+ link_apk_jack_libraries := \
+ $(foreach lib,$(apk_libraries), \
+ $(call intermediates-dir-for, \
+ APPS,$(lib),,COMMON)/classes.jack)
+
+ # link against the jar with full original names (before proguard processing).
+ full_shared_jack_libs += $(link_apk_jack_libraries)
+ full_jack_libs += $(link_apk_jack_libraries)
+ full_jack_lib_deps += $(link_apk_jack_libraries)
+endif
+
+# This is set by packages that contain instrumentation, allowing them to
+# link against the package they are instrumenting. Currently only one such
+# package is allowed.
+ifdef LOCAL_INSTRUMENTATION_FOR
+ # link against the jar with full original names (before proguard processing).
+ link_instr_classes_jack := $(link_instr_intermediates_dir.COMMON)/classes.noshrob.jack
+ full_jack_libs += $(link_instr_classes_jack)
+ full_jack_lib_deps += $(link_instr_classes_jack)
+endif # LOCAL_INSTRUMENTATION_FOR
+endif # !LOCAL_IS_HOST_MODULE
+
+# Propagate local configuration options to this target.
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JACK_LIBRARIES:= $(full_jack_libs)
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+
+endif # need_compile_java
+endif # LOCAL_JACK_ENABLED
diff --git a/core/java_library.mk b/core/java_library.mk
index b4e3eaa..dc6186f 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -24,10 +24,20 @@
LOCAL_BUILT_MODULE_STEM := javalib.jar
+#################################
+include $(BUILD_SYSTEM)/configure_local_jack.mk
+#################################
+
+ifdef LOCAL_JACK_ENABLED
+ifdef LOCAL_IS_STATIC_JAVA_LIBRARY
+LOCAL_BUILT_MODULE_STEM := classes.jack
+endif
+endif
+
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
# This file will be the one that other modules should depend on.
-common_javalib.jar := $(intermediates.COMMON)/$(LOCAL_BUILT_MODULE_STEM)
+common_javalib.jar := $(intermediates.COMMON)/javalib.jar
LOCAL_INTERMEDIATE_TARGETS += $(common_javalib.jar)
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
@@ -59,7 +69,11 @@
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
-$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
+ifdef LOCAL_JACK_ENABLED
+$(LOCAL_BUILT_MODULE) : $(full_classes_jack)
+else
+$(LOCAL_BUILT_MODULE) : $(common_javalib.jar)
+endif
$(copy-file-to-target)
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
@@ -67,10 +81,18 @@
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
$(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
-$(common_javalib.jar) : $(built_dex) $(java_resource_sources)
+$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
+ifdef LOCAL_JACK_ENABLED
+ $(create-empty-package)
+else
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
+endif
$(add-dex-to-package)
+ifdef LOCAL_JACK_ENABLED
+ $(add-carried-jack-resources)
+endif
+ $(remove-timestamps-from-package)
ifdef LOCAL_DEX_PREOPT
ifneq ($(dexpreopt_boot_jar_module),) # boot jar
diff --git a/core/legacy_prebuilts.mk b/core/legacy_prebuilts.mk
index c477900..f4633d0 100644
--- a/core/legacy_prebuilts.mk
+++ b/core/legacy_prebuilts.mk
@@ -22,68 +22,11 @@
# to add any new such module in the system
GRANDFATHERED_ALL_PREBUILT := \
- akmd2 \
- ap_gain.bin \
- AVRCP.kl \
- batch \
- bitmap_size.txt \
bmgr \
- bp.img \
- brcm_guci_drv \
- bypassfactory \
- cdt.bin \
- chat-ril \
- cpcap-key.kl \
- egl.cfg \
- firmware_error.565 \
- firmware_install.565 \
- ftmipcd \
- gps.conf \
- gpsconfig.xml \
- gps.stingray.so \
- gralloc.omap3.so \
- gralloc.tegra.so \
- hwcomposer.tegra.so \
ime \
- init.goldfish.rc \
- init.goldfish.sh \
- init.olympus.rc \
- init.sholes.rc \
- init.stingray.rc \
input \
- 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 \
- libmoto_ril.so \
- libpppd_plugin-ril.so \
- libril_rds.so \
- location \
- location.cfg \
- main.conf \
- mbm.bin \
- mbm_consumer.bin \
- mdm_panicd \
monkey \
pm \
- pppd-ril \
- pppd-ril.options \
- qwerty.kl \
- radio.img \
- rdl.bin \
RFFspeed_501.bmd \
RFFstd_501.bmd \
- savebpver \
- sholes-keypad.kl \
- suplcerts.bks \
- svc \
- tcmd \
- ueventd.goldfish.rc \
- ueventd.olympus.rc \
- ueventd.stingray.rc \
- vold.fstab \
- wl1271.bin
+ svc
diff --git a/core/main.mk b/core/main.mk
index 3bb8c04..14594e7 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -38,8 +38,6 @@
#endif
# Check for broken versions of make.
-# (Allow any version under Cygwin since we don't actually build the platform there.)
-ifeq (,$(findstring CYGWIN,$(shell uname -sm)))
ifneq (1,$(strip $(shell expr $(MAKE_VERSION) \>= 3.81)))
$(warning ********************************************************************************)
$(warning * You are using version $(MAKE_VERSION) of make.)
@@ -48,7 +46,6 @@
$(warning ********************************************************************************)
$(error stopping)
endif
-endif
# Absolute path of the present working direcotry.
# This overrides the shell variable $PWD, which does not necessarily points to
@@ -63,7 +60,10 @@
# This is the default target. It must be the first declared target.
.PHONY: droid
DEFAULT_GOAL := droid
-$(DEFAULT_GOAL):
+$(DEFAULT_GOAL): droid_targets
+
+.PHONY: droid_targets
+droid_targets:
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
@@ -80,12 +80,15 @@
vendorimage-nodeps \
ramdisk-nodeps \
bootimage-nodeps \
- recoveryimage-nodeps
+ recoveryimage-nodeps \
+ product-graph dump-products
ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),)
dont_bother := true
endif
+ORIGINAL_MAKECMDGOALS := $(MAKECMDGOALS)
+
# Targets that provide quick help on the build system.
include $(BUILD_SYSTEM)/help.mk
@@ -93,6 +96,42 @@
# and host information.
include $(BUILD_SYSTEM)/config.mk
+relaunch_with_ninja :=
+ifneq ($(USE_NINJA),false)
+ifndef BUILDING_WITH_NINJA
+relaunch_with_ninja := true
+endif
+endif
+
+ifeq ($(relaunch_with_ninja),true)
+# Mark this is a ninja build.
+$(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build)
+include build/core/ninja.mk
+else # !relaunch_with_ninja
+ifndef BUILDING_WITH_NINJA
+# Remove ninja build mark if it exists.
+$(shell rm -f $(OUT_DIR)/ninja_build)
+endif
+
+# With these files findleaves.py won't be unnecessarily slower even if
+# there is a user creates a copy of $(OUT_DIR).
+$(shell echo '# This file prevents findleaves.py from traversing this directory further' > $(OUT_DIR)/Android.mk)
+$(shell echo '# This file prevents findleaves.py from traversing this directory further' > $(OUT_DIR)/CleanSpec.mk)
+
+# Write the build number to a file so it can be read back in
+# without changing the command line every time. Avoids rebuilds
+# when using ninja.
+$(shell mkdir -p $(OUT_DIR) && \
+ echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt && \
+ echo -n $(BUILD_DATETIME) > $(OUT_DIR)/build_date.txt)
+BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
+BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt)
+ifeq ($(HOST_OS),darwin)
+DATE_FROM_FILE := date -r $(BUILD_DATETIME_FROM_FILE)
+else
+DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE)
+endif
+
# CTS-specific config.
-include cts/build/config.mk
@@ -105,13 +144,12 @@
# Include the google-specific config
-include vendor/google/build/config.mk
-VERSION_CHECK_SEQUENCE_NUMBER := 5
+VERSION_CHECK_SEQUENCE_NUMBER := 6
-include $(OUT_DIR)/versions_checked.mk
ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER),$(VERSIONS_CHECKED))
$(info Checking build tools versions...)
-ifneq ($(HOST_OS),windows)
# check for a case sensitive file system
ifneq (a,$(shell mkdir -p $(OUT_DIR) ; \
echo a > $(OUT_DIR)/casecheck.txt; \
@@ -123,7 +161,6 @@
$(warning ************************************************************)
$(error Case-insensitive filesystems not supported)
endif
-endif
# Make sure that there are no spaces in the absolute path; the
# build system can't deal with them.
@@ -143,19 +180,19 @@
java_version_str := $(shell unset _JAVA_OPTIONS && java -version 2>&1)
javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1)
-# Check for the correct version of java, should be 1.7 by
-# default, and 1.8 if EXPERIMENTAL_USE_JAVA8 is set
-ifneq ($(EXPERIMENTAL_USE_JAVA8),)
+# Check for the correct version of java, should be 1.8 by
+# default and only 1.7 if LEGACY_USE_JAVA7 is set.
+ifeq ($(LEGACY_USE_JAVA7),) # if LEGACY_USE_JAVA7 == ''
required_version := "1.8.x"
required_javac_version := "1.8"
-java_version := $(shell echo '$(java_version_str)' | grep 'openjdk .*[ "]1\.8[\. "$$]')
+java_version := $(shell echo '$(java_version_str)' | grep '[ "]1\.8[\. "$$]')
javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.8[\. "$$]')
-else # default
+else
required_version := "1.7.x"
required_javac_version := "1.7"
java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]')
javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]')
-endif # if EXPERIMENTAL_USE_JAVA8
+endif # if LEGACY_USE_JAVA7 == ''
ifeq ($(strip $(java_version)),)
$(info ************************************************************)
@@ -173,7 +210,7 @@
# Check for the current JDK.
#
-# For Java 1.7, we require OpenJDK on linux and Oracle JDK on Mac OS.
+# For Java 1.7/1.8, we require OpenJDK on linux and Oracle JDK on Mac OS.
requires_openjdk := false
ifeq ($(BUILD_OS),linux)
requires_openjdk := true
@@ -234,23 +271,7 @@
# These are the modifier targets that don't do anything themselves, but
# change the behavior of the build.
# (must be defined before including definitions.make)
-INTERNAL_MODIFIER_TARGETS := showcommands all incrementaljavac
-
-.PHONY: incrementaljavac
-incrementaljavac: ;
-
-# WARNING:
-# ENABLE_INCREMENTALJAVAC should NOT be enabled by default, because change of
-# a Java source file won't trigger rebuild of its dependent Java files.
-# You can only enable it by adding "incrementaljavac" to your make command line.
-# You are responsible for the correctness of the incremental build.
-# This may decrease incremental build time dramatically for large Java libraries,
-# such as core.jar, framework.jar, etc.
-ENABLE_INCREMENTALJAVAC :=
-ifneq (,$(filter incrementaljavac, $(MAKECMDGOALS)))
-ENABLE_INCREMENTALJAVAC := true
-MAKECMDGOALS := $(filter-out incrementaljavac, $(MAKECMDGOALS))
-endif
+INTERNAL_MODIFIER_TARGETS := showcommands all
# EMMA_INSTRUMENT_STATIC merges the static emma library to each emma-enabled module.
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
@@ -297,6 +318,17 @@
# The pdk (Platform Development Kit) build
include build/core/pdk_config.mk
+#
+# -----------------------------------------------------------------
+# Jack version configuration
+-include $(TOPDIR)prebuilts/sdk/tools/jack_versions.mk
+-include $(TOPDIR)prebuilts/sdk/tools/jack_for_module.mk
+
+#
+# -----------------------------------------------------------------
+# Install and start Jack server
+-include $(TOPDIR)prebuilts/sdk/tools/jack_server_setup.mk
+
# -----------------------------------------------------------------
###
### In this section we set up the things that are different
@@ -311,7 +343,7 @@
# Add build properties for ART. These define system properties used by installd
# to pass flags to dex2oat.
-ADDITIONAL_BUILD_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart
+ADDITIONAL_BUILD_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT)
ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
@@ -333,6 +365,10 @@
# Target is secure in user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
+ ifeq ($(user_variant),user)
+ ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+ endif
+
ifeq ($(user_variant),userdebug)
# Pick up some extra useful tools
tags_to_install += debug
@@ -404,7 +440,7 @@
sdk_repo_goal := $(strip $(filter sdk_repo,$(MAKECMDGOALS)))
MAKECMDGOALS := $(strip $(filter-out sdk_repo,$(MAKECMDGOALS)))
-ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS) checkbuild emulator_tests target-files-package,$(MAKECMDGOALS))),1)
+ifneq ($(words $(sort $(filter-out $(INTERNAL_MODIFIER_TARGETS) checkbuild emulator_tests target-files-package,$(MAKECMDGOALS)))),1)
$(error The 'sdk' target may not be specified with any other targets)
endif
@@ -450,21 +486,6 @@
$(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL)
endif
-# Bring in all modules that need to be built.
-ifeq ($(HOST_OS),windows)
-SDK_ONLY := true
-endif
-
-ifeq ($(SDK_ONLY),true)
-include $(TOPDIR)sdk/build/windows_sdk_whitelist.mk
-include $(TOPDIR)development/build/windows_sdk_whitelist.mk
-
-# Exclude tools/acp when cross-compiling windows under linux
-ifeq ($(findstring Linux,$(UNAME)),)
-subdirs += build/tools/acp
-endif
-
-else # !SDK_ONLY
#
# Typical build; include any Android.mk files we can find.
#
@@ -472,8 +493,6 @@
FULL_BUILD := true
-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
@@ -500,6 +519,7 @@
# A helper goal printing out install paths
.PHONY: GET-INSTALL-PATH
GET-INSTALL-PATH:
+ @echo "Install paths for modules in $(ONE_SHOT_MAKEFILE):"
@$(foreach m, $(ALL_MODULES), $(if $(ALL_MODULES.$(m).INSTALLED), \
echo 'INSTALL-PATH: $(m) $(ALL_MODULES.$(m).INSTALLED)';))
@@ -513,9 +533,13 @@
# Can't use first-makefiles-under here because
# --mindepth=2 makes the prunes not work.
subdir_makefiles := \
- $(shell build/tools/findleaves.py --prune=$(OUT_DIR) --prune=.repo --prune=.git $(subdirs) Android.mk)
+ $(shell build/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) $(subdirs) Android.mk)
-$(foreach mk, $(subdir_makefiles), $(info including $(mk) ...)$(eval include $(mk)))
+ifeq ($(USE_SOONG),true)
+subdir_makefiles := $(SOONG_ANDROID_MK) $(call filter-soong-makefiles,$(subdir_makefiles))
+endif
+
+$(foreach mk, $(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk)))
endif # dont_bother
@@ -585,6 +609,8 @@
$(m))))
endef
+# If a module is for a cross host os, the required modules must be for
+# that OS too.
# If a module is built for 32-bit, the required modules must be 32-bit too;
# Otherwise if the module is an exectuable or shared library,
# the required modules must be 64-bit;
@@ -592,6 +618,8 @@
$(foreach m,$(ALL_MODULES),\
$(eval r := $(ALL_MODULES.$(m).REQUIRED))\
$(if $(r),\
+ $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),\
+ $(eval r := $(addprefix host_cross_,$(r))))\
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
$(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\
$(if $(filter EXECUTABLES SHARED_LIBRARIES,$(ALL_MODULES.$(m).CLASS)),\
@@ -614,32 +642,40 @@
$(eval r := $(call module-installed-files,$(r))) \
$(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval h_m := $(filter $(HOST_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
+ $(eval hc_m := $(filter $(HOST_CROSS_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
$(eval h_r := $(filter $(HOST_OUT_ROOT)/%, $(r))) \
+ $(eval hc_r := $(filter $(HOST_CROSS_OUT_ROOT)/%, $(r))) \
$(eval t_m := $(filter-out $(t_r), $(t_m))) \
$(eval h_m := $(filter-out $(h_r), $(h_m))) \
+ $(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \
$(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
$(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
+ $(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \
) \
)
t_m :=
h_m :=
+hc_m :=
t_r :=
h_r :=
+hc_r :=
# Establish the dependecies on the shared libraries.
# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
# so they can be expanded to product_MODULES later.
-# $(1): TARGET_ or HOST_.
+# $(1): TARGET_ or HOST_ or HOST_CROSS_.
# $(2): non-empty for 2nd arch.
+# $(3): non-empty for host cross compile.
define resolve-shared-libs-depes
$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\
$(eval p := $(subst :,$(space),$(m)))\
$(eval mod := $(firstword $(p)))\
$(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\
$(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\
- $(eval r := $(filter $($(1)OUT_ROOT)/%,$(call module-installed-files,\
+ $(if $(3),$(eval deps := $(addprefix host_cross_,$(deps))))\
+ $(eval r := $(filter $($(1)OUT)/%,$(call module-installed-files,\
$(deps))))\
$(eval $(call add-required-deps,$(word 2,$(p)),$(r)))\
$(eval ALL_MODULES.$(mod).REQUIRED += $(deps)))
@@ -653,6 +689,9 @@
ifdef HOST_2ND_ARCH
$(call resolve-shared-libs-depes,HOST_,true)
endif
+ifdef HOST_CROSS_OS
+$(call resolve-shared-libs-depes,HOST_CROSS_,,true)
+endif
m :=
r :=
@@ -751,9 +790,14 @@
#$(error filtered out
# $(filter-out $(modules_to_install),$(old_modules_to_install)))
-# Don't include any GNU targets in the SDK. It's ok (and necessary)
-# to build the host tools, but nothing that's going to be installed
-# on the target (including static libraries).
+# Don't include any GNU General Public License shared objects or static
+# libraries in SDK images. GPL executables (not static/dynamic libraries)
+# are okay if they don't link against any closed source libraries (directly
+# or indirectly)
+
+# It's ok (and necessary) to build the host tools, but nothing that's
+# going to be installed on the target (including static libraries).
+
ifdef is_sdk_build
target_gnu_MODULES := \
$(filter \
@@ -761,6 +805,7 @@
$(TARGET_OUT)/% \
$(TARGET_OUT_DATA)/%, \
$(sort $(call get-tagged-modules,gnu)))
+ target_gnu_MODULES := $(filter-out $(TARGET_OUT_EXECUTABLES)/%,$(target_gnu_MODULES))
$(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
modules_to_install := \
$(filter-out $(target_gnu_MODULES),$(modules_to_install))
@@ -833,12 +878,12 @@
# -------------------------------------------------------------------
.PHONY: checkbuild
-checkbuild: $(modules_to_check)
-ifeq (true,$(ANDROID_BUILD_EVERYTHING_BY_DEFAULT)$(filter $(MAKECMDGOALS),checkbuild))
+checkbuild: $(modules_to_check) droid_targets
+ifeq ($(USE_SOONG),true)
+checkbuild: checkbuild-soong
+endif
+ifeq (true,$(ANDROID_BUILD_EVERYTHING_BY_DEFAULT))
droid: checkbuild
-else
-# ANDROID_BUILD_EVERYTHING_BY_DEFAULT not set, or checkbuild is one of the cmd goals.
-checkbuild: droid
endif
.PHONY: ramdisk
@@ -875,7 +920,8 @@
all_modules: $(ALL_MODULES)
else
# BUILD_MODULES_IN_PATHS is a list of paths relative to the top of the tree
-module_path_patterns := $(foreach p, $(BUILD_MODULES_IN_PATHS),\
+build_modules_in_paths := $(patsubst ./%,%,$(BUILD_MODULES_IN_PATHS))
+module_path_patterns := $(foreach p, $(build_modules_in_paths),\
$(if $(filter %/,$(p)),$(p)%,$(p)/%))
my_all_modules := $(sort $(foreach m, $(ALL_MODULES),$(if $(filter\
$(module_path_patterns), $(addsuffix /,$(ALL_MODULES.$(m).PATH))),$(m))))
@@ -892,7 +938,8 @@
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_CACHEIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_FILES_FILE)
+ $(INSTALLED_FILES_FILE) \
+ $(INSTALLED_FILES_FILE_VENDOR)
# dist_files only for putting your library into the dist directory with a full build.
.PHONY: dist_files
@@ -914,7 +961,9 @@
# For uninstallable modules such as static Java library, we have to dist the built file,
# as <module_name>.<suffix>
apps_only_dist_built_files := $(foreach m,$(unbundled_build_modules),$(if $(ALL_MODULES.$(m).INSTALLED),,\
- $(if $(ALL_MODULES.$(m).BUILT),$(ALL_MODULES.$(m).BUILT):$(m)$(suffix $(ALL_MODULES.$(m).BUILT)))))
+ $(if $(ALL_MODULES.$(m).BUILT),$(ALL_MODULES.$(m).BUILT):$(m)$(suffix $(ALL_MODULES.$(m).BUILT)))\
+ $(if $(ALL_MODULES.$(m).AAR),$(ALL_MODULES.$(m).AAR):$(m).aar)\
+ ))
$(call dist-for-goals,apps_only, $(apps_only_dist_built_files))
ifeq ($(EMMA_INSTRUMENT),true)
@@ -932,7 +981,7 @@
.PHONY: apps_only
apps_only: $(unbundled_build_modules)
-droid: apps_only
+droid_targets: apps_only
# Combine the NOTICE files for a apps_only build
$(eval $(call combine-notice-files, \
@@ -947,8 +996,10 @@
$(call dist-for-goals, droidcore, \
$(INTERNAL_UPDATE_PACKAGE_TARGET) \
$(INTERNAL_OTA_PACKAGE_TARGET) \
+ $(BUILT_OTATOOLS_PACKAGE) \
$(SYMBOLS_ZIP) \
$(INSTALLED_FILES_FILE) \
+ $(INSTALLED_FILES_FILE_VENDOR) \
$(INSTALLED_BUILD_PROP_TARGET) \
$(BUILT_TARGET_FILES_PACKAGE) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
@@ -976,7 +1027,7 @@
endif
# Building a full system-- the default is to build droidcore
-droid: droidcore dist_files
+droid_targets: droidcore dist_files
endif # TARGET_BUILD_APPS
@@ -1008,13 +1059,13 @@
tests : host-tests target-tests
# To catch more build breakage, check build tests modules in eng and userdebug builds.
+ifneq ($(ANDROID_NO_TEST_CHECK),true)
ifneq ($(TARGET_BUILD_PDK),true)
ifneq ($(filter eng userdebug,$(TARGET_BUILD_VARIANT)),)
droidcore : target-tests host-tests
endif
endif
-
-.PHONY: lintall
+endif
ifneq (,$(filter samplecode, $(MAKECMDGOALS)))
.PHONY: samplecode
@@ -1059,3 +1110,4 @@
.PHONY: nothing
nothing:
@echo Successfully read the makefiles.
+endif # !relaunch_with_ninja
diff --git a/core/module_arch_supported.mk b/core/module_arch_supported.mk
index a5e4a7c..9f05060 100644
--- a/core/module_arch_supported.mk
+++ b/core/module_arch_supported.mk
@@ -8,6 +8,8 @@
## LOCAL_MODULE_$(my_prefix)ARCH_WARN
## LOCAL_MODULE_UNSUPPORTED_$(my_prefix)ARCH
## LOCAL_MODULE_UNSUPPORTED_$(my_prefix)ARCH_WARN
+## LOCAL_IS_HOST_MODULE
+## LOCAL_MODULE_HOST_OS
##
## Inputs from build system:
## $(my_prefix)IS_64_BIT
@@ -58,3 +60,14 @@
my_module_arch_supported := false
$(warning $(LOCAL_MODULE): architecture $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) unsupported)
endif
+
+ifdef LOCAL_IS_HOST_MODULE
+ifneq (,$(LOCAL_MODULE_HOST_OS))
+ ifeq (,$(filter $($(my_prefix)OS),$(LOCAL_MODULE_HOST_OS)))
+ my_module_arch_supported := false
+ endif
+else ifeq ($($(my_prefix)OS),windows)
+ # If LOCAL_MODULE_HOST_OS is empty, only linux and darwin are supported
+ my_module_arch_supported := false
+endif
+endif
diff --git a/core/multilib.mk b/core/multilib.mk
index e0615b2..a3ced65 100644
--- a/core/multilib.mk
+++ b/core/multilib.mk
@@ -13,11 +13,3 @@
$(error $(LOCAL_PATH): Invalid LOCAL_MULTILIB specified for module $(LOCAL_MODULE))
endif
endif # my_module_multilib defined
-
-# Windows is a special case. Linux and Darwin are both multilib builds, but we
-# don't have a 64-bit Windows build, so make sure it's not a multilib build.
-ifdef LOCAL_IS_HOST_MODULE
-ifeq ($(HOST_OS),windows)
-my_module_multilib := 32
-endif
-endif
diff --git a/core/native_benchmark.mk b/core/native_benchmark.mk
index 431e40a..e5ca451 100644
--- a/core/native_benchmark.mk
+++ b/core/native_benchmark.mk
@@ -3,7 +3,7 @@
## Common flags for native benchmarks are added.
###########################################
-LOCAL_STATIC_LIBRARIES += libbenchmark
+LOCAL_STATIC_LIBRARIES += libbenchmark libbase
ifndef LOCAL_MODULE_PATH
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
diff --git a/core/ninja.mk b/core/ninja.mk
new file mode 100644
index 0000000..2878514
--- /dev/null
+++ b/core/ninja.mk
@@ -0,0 +1,182 @@
+NINJA ?= prebuilts/ninja/$(HOST_PREBUILT_TAG)/ninja
+
+ifeq ($(USE_SOONG),true)
+USE_SOONG_FOR_KATI := true
+endif
+
+ifeq ($(USE_SOONG_FOR_KATI),true)
+include $(BUILD_SYSTEM)/soong.mk
+else
+KATI ?= $(HOST_OUT_EXECUTABLES)/ckati
+MAKEPARALLEL ?= $(HOST_OUT_EXECUTABLES)/makeparallel
+endif
+
+KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh
+
+# Modifier goals we don't need to pass to Ninja.
+NINJA_EXCLUDE_GOALS := showcommands all dist
+.PHONY : $(NINJA_EXCLUDE_GOALS)
+
+# A list of goals which affect parsing of makefiles and we need to pass to Kati.
+PARSE_TIME_MAKE_GOALS := \
+ $(PARSE_TIME_MAKE_GOALS) \
+ $(dont_bother_goals) \
+ all \
+ APP-% \
+ DUMP_% \
+ ECLIPSE-% \
+ PRODUCT-% \
+ boottarball-nodeps \
+ btnod \
+ build-art% \
+ build_kernel-nodeps \
+ clean-oat% \
+ continuous_instrumentation_tests \
+ continuous_native_tests \
+ cts \
+ custom_images \
+ deps-license \
+ dicttool_aosp \
+ dist \
+ dump-products \
+ dumpvar-% \
+ eng \
+ fusion \
+ oem_image \
+ online-system-api-sdk-docs \
+ pdk \
+ platform \
+ platform-java \
+ product-graph \
+ samplecode \
+ sdk \
+ sdk_addon \
+ sdk_repo \
+ snod \
+ stnod \
+ systemimage-nodeps \
+ systemtarball-nodeps \
+ target-files-package \
+ test-art% \
+ user \
+ userdataimage \
+ userdebug \
+ valgrind-test-art% \
+ win_sdk \
+ winsdk-tools
+
+-include vendor/google/build/ninja_config.mk
+
+# Any Android goals that need to be built.
+ANDROID_GOALS := $(filter-out $(KATI_OUTPUT_PATTERNS) $(KATI) $(MAKEPARALLEL),\
+ $(sort $(ORIGINAL_MAKECMDGOALS) $(MAKECMDGOALS)))
+# Goals we need to pass to Ninja.
+NINJA_GOALS := $(filter-out $(NINJA_EXCLUDE_GOALS), $(ANDROID_GOALS))
+# Goals we need to pass to Kati.
+KATI_GOALS := $(filter $(PARSE_TIME_MAKE_GOALS), $(ANDROID_GOALS))
+
+define replace_space_and_slash
+$(subst /,_,$(subst $(space),_,$(sort $1)))
+endef
+
+KATI_NINJA_SUFFIX := -$(TARGET_PRODUCT)
+ifneq ($(KATI_GOALS),)
+KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-$(call replace_space_and_slash,$(KATI_GOALS))
+endif
+ifneq ($(ONE_SHOT_MAKEFILE),)
+KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE))
+endif
+ifneq ($(BUILD_MODULES_IN_PATHS),)
+KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmma-$(call replace_space_and_slash,$(BUILD_MODULES_IN_PATHS))
+endif
+
+my_checksum_suffix :=
+my_ninja_suffix_too_long := $(filter 1, $(shell v='$(KATI_NINJA_SUFFIX)' && echo $$(($${$(pound)v} > 64))))
+ifneq ($(my_ninja_suffix_too_long),)
+# Replace the suffix with a checksum if it gets too long.
+my_checksum_suffix := $(KATI_NINJA_SUFFIX)
+KATI_NINJA_SUFFIX := -$(word 1, $(shell echo $(my_checksum_suffix) | $(MD5SUM)))
+endif
+
+KATI_BUILD_NINJA := $(OUT_DIR)/build$(KATI_NINJA_SUFFIX).ninja
+KATI_ENV_SH := $(OUT_DIR)/env$(KATI_NINJA_SUFFIX).sh
+
+# Write out a file mapping checksum to the real suffix.
+ifneq ($(my_checksum_suffix),)
+my_ninja_suffix_file := $(basename $(KATI_BUILD_NINJA)).suf
+$(shell mkdir -p $(dir $(my_ninja_suffix_file)) && \
+ echo $(my_checksum_suffix) > $(my_ninja_suffix_file))
+endif
+
+ifeq (,$(NINJA_STATUS))
+NINJA_STATUS := [%p %s/%t]$(space)
+endif
+
+ifneq (,$(filter showcommands,$(ORIGINAL_MAKECMDGOALS)))
+NINJA_ARGS += "-v"
+endif
+
+ifdef USE_GOMA
+KATI_MAKEPARALLEL := $(MAKEPARALLEL)
+# Ninja runs remote jobs (i.e., commands which contain gomacc) with
+# this parallelism. Note the parallelism of all other jobs is still
+# limited by the -j flag passed to GNU make.
+NINJA_REMOTE_NUM_JOBS ?= 500
+NINJA_ARGS += -j$(NINJA_REMOTE_NUM_JOBS)
+else
+NINJA_MAKEPARALLEL := $(MAKEPARALLEL) --ninja
+endif
+
+ifeq ($(USE_SOONG),true)
+COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja
+
+$(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) $(SOONG_ANDROID_MK)
+ $(hide) echo "builddir = $(OUT_DIR)" > $(COMBINED_BUILD_NINJA)
+ $(hide) echo "subninja $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA)
+ $(hide) echo "subninja $(KATI_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA)
+else
+COMBINED_BUILD_NINJA := $(KATI_BUILD_NINJA)
+endif
+
+$(sort $(DEFAULT_GOAL) $(ANDROID_GOALS)) : ninja_wrapper
+ @#empty
+
+.PHONY: ninja_wrapper
+ninja_wrapper: $(COMBINED_BUILD_NINJA) $(MAKEPARALLEL)
+ @echo Starting build with ninja
+ +$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && $(NINJA_MAKEPARALLEL) $(NINJA) $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS)
+
+KATI_FIND_EMULATOR := --use_find_emulator
+ifeq ($(KATI_EMULATE_FIND),false)
+ KATI_FIND_EMULATOR :=
+endif
+$(KATI_BUILD_NINJA): $(KATI) $(MAKEPARALLEL) $(SOONG_ANDROID_MK) FORCE
+ @echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
+ +$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --no_ignore_dirty=$(SOONG_ANDROID_MK) --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo $(KATI_FIND_EMULATOR) -f build/core/main.mk $(KATI_GOALS) --gen_all_targets BUILDING_WITH_NINJA=true SOONG_ANDROID_MK=$(SOONG_ANDROID_MK)
+
+ifneq ($(USE_SOONG_FOR_KATI),true)
+KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
+KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)
+# Build static ckati. Unfortunately Mac OS X doesn't officially support static exectuables.
+ifeq ($(BUILD_OS),linux)
+KATI_LD += -static
+endif
+
+KATI_INTERMEDIATES_PATH := $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/ckati_intermediates
+KATI_BIN_PATH := $(HOST_OUT_EXECUTABLES)
+include build/kati/Makefile.ckati
+
+MAKEPARALLEL_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
+MAKEPARALLEL_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)
+# Build static makeparallel. Unfortunately Mac OS X doesn't officially support static exectuables.
+ifeq ($(BUILD_OS),linux)
+MAKEPARALLEL_LD += -static
+endif
+
+MAKEPARALLEL_INTERMEDIATES_PATH := $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/makeparallel_intermediates
+MAKEPARALLEL_BIN_PATH := $(HOST_OUT_EXECUTABLES)
+include build/tools/makeparallel/Makefile
+endif
+
+.PHONY: FORCE
+FORCE:
diff --git a/core/notice_files.mk b/core/notice_files.mk
index e63cd84..e7f8974 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -2,7 +2,11 @@
## Track NOTICE files
###########################################################
+ifneq ($(LOCAL_NOTICE_FILE),)
+notice_file:=$(strip $(LOCAL_NOTICE_FILE))
+else
notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE))
+endif
ifeq ($(LOCAL_MODULE_CLASS),GYP)
# We ignore NOTICE files for modules of type GYP.
@@ -14,6 +18,7 @@
# so my_prefix is not set at this point.
ifeq ($(LOCAL_IS_HOST_MODULE),true)
my_prefix := HOST_
+ LOCAL_HOST_PREFIX :=
else
my_prefix := TARGET_
endif
@@ -43,7 +48,7 @@
# javalib.jar is the default name for the build module (and isn't meaningful)
# If that's what we have, substitute the module name instead. These files
# aren't included on the device, so this name is synthetic anyway.
- ifeq ($(module_leaf),javalib.jar)
+ ifneq ($(filter javalib.jar classes.jack,$(module_leaf)),)
module_leaf := $(LOCAL_MODULE).jar
endif
module_installed_filename := \
@@ -56,6 +61,7 @@
# In case it's actually a host file
module_installed_filename := $(patsubst $(HOST_OUT)%,%,$(module_installed_filename))
+module_installed_filename := $(patsubst $(HOST_CROSS_OUT)%,%,$(module_installed_filename))
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
diff --git a/core/package_internal.mk b/core/package_internal.mk
index d52997b..f5a00e5 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -57,6 +57,10 @@
endif
LOCAL_MODULE_CLASS := APPS
+#################################
+include $(BUILD_SYSTEM)/configure_local_jack.mk
+#################################
+
# Package LOCAL_MODULE_TAGS default to optional
LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
ifeq ($(LOCAL_MODULE_TAGS),)
@@ -162,10 +166,17 @@
endif # !custom
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
+ifdef LOCAL_JACK_ENABLED
+ifndef LOCAL_JACK_PROGUARD_FLAGS
+ LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
+endif
+LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS)
+endif # LOCAL_JACK_ENABLED
+
ifeq (true,$(EMMA_INSTRUMENT))
ifndef LOCAL_EMMA_INSTRUMENT
# No emma for test apks.
-ifeq (,$(filer tests,$(LOCAL_MODULE_TAGS))$(LOCAL_INSTRUMENTATION_FOR))
+ifeq (,$(LOCAL_INSTRUMENTATION_FOR))
LOCAL_EMMA_INSTRUMENT := true
endif # No test apk
endif # LOCAL_EMMA_INSTRUMENT is not set
@@ -230,7 +241,7 @@
$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
- @rm -f $@
+ @rm -rf $@ && mkdir -p $(dir $@)
$(create-resource-java-files)
$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
-name Manifest.java 2> /dev/null`; do \
@@ -245,7 +256,10 @@
$(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|| exit 31; \
$(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \
- done; \
+ done;
+ @# Ensure that the target file is always created, i.e. also in case we did not
+ @# enter the GENERATED_R_FILE-loop above. This avoids unnecessary rebuilding.
+ $(hide) touch $@
$(proguard_options_file): $(R_file_stamp)
@@ -271,6 +285,18 @@
# they want to use this module's R.java file.
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
+ifdef LOCAL_JACK_ENABLED
+ifneq ($(built_dex_intermediate),)
+$(built_dex_intermediate): $(R_file_stamp)
+endif
+ifneq ($(noshrob_classes_jack),)
+$(noshrob_classes_jack): $(R_file_stamp)
+endif
+ifneq ($(full_classes_jack),)
+$(full_classes_jack): $(R_file_stamp)
+endif
+endif # LOCAL_JACK_ENABLED
+
ifneq ($(full_classes_jar),)
# If full_classes_jar is non-empty, we're building sources.
# If we're building sources, the initial javac step (which
@@ -364,12 +390,11 @@
$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
# Define the rule to build the actual package.
-$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
+$(LOCAL_BUILT_MODULE): $(AAPT)
# PRIVATE_JNI_SHARED_LIBRARIES is a list of <abi>:<path_of_built_lib>.
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
# PRIVATE_JNI_SHARED_LIBRARIES_ABI is a list of ABI names.
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
-$(LOCAL_BUILT_MODULE): PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES := $(LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES)
ifneq ($(TARGET_BUILD_APPS),)
# Include all resources for unbundled apps.
LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
@@ -388,9 +413,13 @@
$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
+ifdef LOCAL_JACK_ENABLED
+ $(create-empty-package)
+else
$(if $(PRIVATE_SOURCE_ARCHIVE),\
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
$(create-empty-package))
+endif
$(add-assets-to-package)
ifneq ($(jni_shared_libraries),)
$(add-jni-shared-libs-to-package)
@@ -401,14 +430,15 @@
else
$(add-dex-to-package)
endif
+ifdef LOCAL_JACK_ENABLED
+ $(add-carried-jack-resources)
+endif
ifdef LOCAL_DEX_PREOPT
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
$(call dexpreopt-remove-classes.dex,$@)
endif
endif
$(sign-package)
- @# Alignment must happen after all other zip operations.
- $(align-package)
###############################
## Build dpi-specific apks, if it's apps_only build.
@@ -443,7 +473,7 @@
installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
# The splits should have been built in the same command building the base apk.
-# This rule just runs signing and zipalign etc.
+# This rule just runs signing.
# Note that we explicily check the existence of the split apk and remove the
# built base apk if the split apk isn't there.
# That way the build system will rerun the aapt after the user changes the splitting parameters.
@@ -455,7 +485,6 @@
rm $<; exit 1; \
fi
$(sign-package)
- $(align-package)
# Rules to install the splits
$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(built_module_path)/package_%.apk | $(ACP)
@@ -480,39 +509,6 @@
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
-# Dist the files that can be bundled in system.img.
-# They include the jni shared libraries and the apk with jni libraries stripped.
-ifeq ($(LOCAL_DIST_BUNDLED_BINARIES),true)
-ifneq ($(filter $(LOCAL_PACKAGE_NAME),$(TARGET_BUILD_APPS)),)
-ifneq ($(strip $(jni_shared_libraries)),)
-dist_subdir := bundled_$(LOCAL_PACKAGE_NAME)
-$(foreach f, $(jni_shared_libraries), \
- $(call dist-for-goals, apps_only, $(f):$(dist_subdir)/$(notdir $(f))))
-
-apk_jni_stripped := $(intermediates)/jni_stripped/package.apk
-$(apk_jni_stripped): PRIVATE_JNI_SHARED_LIBRARIES := $(notdir $(jni_shared_libraries))
-$(apk_jni_stripped) : $(LOCAL_BUILT_MODULE) | $(ZIPALIGN)
- @rm -rf $(dir $@) && mkdir -p $(dir $@)
- $(hide) cp $< $@
- $(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f))
- $(align-package)
-
-$(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk)
-
-endif # jni_shared_libraries
-endif # apps_only build
-endif # LOCAL_DIST_BUNDLED_BINARIES
-
-# Lint phony targets
-.PHONY: lint-$(LOCAL_PACKAGE_NAME)
-lint-$(LOCAL_PACKAGE_NAME): PRIVATE_PATH := $(LOCAL_PATH)
-lint-$(LOCAL_PACKAGE_NAME): PRIVATE_LINT_FLAGS := $(LOCAL_LINT_FLAGS)
-lint-$(LOCAL_PACKAGE_NAME) :
- @echo lint $(PRIVATE_PATH)
- $(LINT) $(PRIVATE_LINT_FLAGS) $(PRIVATE_PATH)
-
-lintall : lint-$(LOCAL_PACKAGE_NAME)
-
endif # skip_definition
# Reset internal variables.
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 2532707..495f1a5 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -16,7 +16,14 @@
#
# A central place to define mappings to paths, to avoid hard-coding
-# them in Android.mk files.
+# them in Android.mk files. Not meant for header file include directories,
+# despite the fact that it was historically used for that!
+#
+# If you want this for a library's header files, use LOCAL_EXPORT_C_INCLUDES
+# instead. Then users of the library don't have to do anything --- they'll
+# have the correct header files added to their include path automatically.
+#
+
#
# TODO: Allow each project to define stuff like this before the per-module
# Android.mk files are included, so we don't need to have a big central
@@ -30,19 +37,13 @@
camera:system/media/camera/include \
frameworks-base:frameworks/base/include \
frameworks-native:frameworks/native/include \
- libc:bionic/libc/include \
libhardware:hardware/libhardware/include \
libhardware_legacy:hardware/libhardware_legacy/include \
- libhost:build/libs/host/include \
- libm:bionic/libm/include \
- libnativehelper:libnativehelper/include \
- libpagemap:system/extras/libpagemap/include \
libril:hardware/ril/include \
- libstdc++:bionic/libstdc++/include \
- mkbootimg:system/core/mkbootimg \
opengl-tests-includes:frameworks/native/opengl/tests/include \
recovery:bootable/recovery \
system-core:system/core/include \
+ audio:system/media/audio/include \
audio-effects:system/media/audio_effects/include \
audio-utils:system/media/audio_utils/include \
audio-route:system/media/audio_route/include \
@@ -66,7 +67,7 @@
# Many modules expect to be able to say "#include <jni.h>",
# so make it easy for them to find the correct path.
#
-JNI_H_INCLUDE := $(call include-path-for,libnativehelper)/nativehelper
+JNI_H_INCLUDE := libnativehelper/include/nativehelper
#
# A list of all source roots under frameworks/base, which will be
@@ -107,14 +108,19 @@
annotations \
v4 \
v7/gridlayout \
- v7/appcompat \
v7/cardview \
v7/mediarouter \
v7/palette \
- v7/recyclerview \
v8/renderscript \
v13 \
- v17/leanback
+ v17/leanback \
+ design \
+ percent \
+ recommendation \
+ v7/preference \
+ v14/preference \
+ v17/preference-leanback \
+ customtabs
#
# A list of all source roots under frameworks/multidex.
@@ -129,13 +135,32 @@
#
FRAMEWORKS_SUPPORT_JAVA_SRC_DIRS := \
$(addprefix frameworks/support/,$(FRAMEWORKS_SUPPORT_SUBDIRS)) \
- $(addprefix frameworks/,$(FRAMEWORKS_MULTIDEX_SUBDIRS))
+ $(addprefix frameworks/,$(FRAMEWORKS_MULTIDEX_SUBDIRS)) \
+ frameworks/support/v7/appcompat/src \
+ frameworks/support/v7/recyclerview/src
#
# A list of support library modules.
#
FRAMEWORKS_SUPPORT_JAVA_LIBRARIES := \
$(foreach dir,$(FRAMEWORKS_SUPPORT_SUBDIRS),android-support-$(subst /,-,$(dir))) \
+ android-support-v7-appcompat \
+ android-support-v7-recyclerview \
android-support-multidex \
android-support-multidex-instrumentation
+#
+# A list of all documented source roots under frameworks/data-binding.
+#
+FRAMEWORKS_DATA_BINDING_SUBDIRS := \
+ baseLibrary/src/main \
+ library/src/main \
+ library/src/doc
+
+#
+# A version of FRAMEWORKS_DATA_BINDING_SUBDIRS that is expanded to full paths from
+# the root of the tree.
+#
+FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS := \
+ $(addprefix frameworks/data-binding/,$(FRAMEWORKS_DATA_BINDING_SUBDIRS))
+
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index 838754f..95eb0cc 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -21,11 +21,11 @@
# Most PDK project paths should be using vendor/pdk/TARGET_DEVICE
# but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup
# with vendor/pdk/TARGET_PRODUCT.
-_pdk_fusion_default_platform_zip = $(wildcard \
-vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip \
-vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip \
-vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip \
-vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip)
+_pdk_fusion_default_platform_zip = $(strip \
+ $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
+ $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
+ $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
+ $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip))
ifneq (,$(_pdk_fusion_default_platform_zip))
PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip))
TARGET_BUILD_PDK := true
@@ -52,18 +52,21 @@
# For these dirs, add classes.jar and javalib.jar from the dir to platform.zip
# all paths under out dir
PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR += \
- target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \
- target/common/obj/JAVA_LIBRARIES/core-libart_intermediates \
- target/common/obj/JAVA_LIBRARIES/core-junit_intermediates \
- target/common/obj/JAVA_LIBRARIES/ext_intermediates \
- target/common/obj/JAVA_LIBRARIES/framework_intermediates \
- target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates \
- target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \
- target/common/obj/JAVA_LIBRARIES/voip-common_intermediates \
- target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \
- target/common/obj/JAVA_LIBRARIES/mms-common_intermediates \
- target/common/obj/JAVA_LIBRARIES/android-ex-camera2_intermediates \
- target/common/obj/JAVA_LIBRARIES/android-common_intermediates \
+ target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates \
+ target/common/obj/JAVA_LIBRARIES/android-common_intermediates \
+ target/common/obj/JAVA_LIBRARIES/android-ex-camera2_intermediates \
+ target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \
+ target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates \
+ target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates \
+ target/common/obj/JAVA_LIBRARIES/core-oj_intermediates \
+ target/common/obj/JAVA_LIBRARIES/core-libart_intermediates \
+ target/common/obj/JAVA_LIBRARIES/core-junit_intermediates \
+ target/common/obj/JAVA_LIBRARIES/ext_intermediates \
+ target/common/obj/JAVA_LIBRARIES/framework_intermediates \
+ target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \
+ target/common/obj/JAVA_LIBRARIES/okhttp_intermediates \
+ target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \
+ target/common/obj/JAVA_LIBRARIES/voip-common_intermediates \
# not java libraries
PDK_PLATFORM_JAVA_ZIP_CONTENTS += \
@@ -76,7 +79,7 @@
$(PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR)
PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
- $(lib_dir)/classes.jar $(lib_dir)/javalib.jar)
+ $(lib_dir)/classes.jack $(lib_dir)/classes.jar $(lib_dir)/javalib.jar)
# check and override java support level
ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP),)
diff --git a/core/phony_package.mk b/core/phony_package.mk
index 30e198c..866b13c 100644
--- a/core/phony_package.mk
+++ b/core/phony_package.mk
@@ -7,7 +7,7 @@
include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(LOCAL_BUILT_MODULE): $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(hide) echo "Fake: $@"
$(hide) mkdir -p $(dir $@)
$(hide) touch $@
diff --git a/core/post_clean.mk b/core/post_clean.mk
index 0273ff2..7fafe4a 100644
--- a/core/post_clean.mk
+++ b/core/post_clean.mk
@@ -88,7 +88,7 @@
$(shell echo 'MODULES_WITH_AIDL_FILES := $(MODULES_WITH_AIDL_FILES)' >> $(current_aidl_config))
# Now current becomes previous.
-$(shell mv -f $(current_aidl_config) $(previous_aidl_config))
+$(shell cmp $(current_aidl_config) $(previous_aidl_config) > /dev/null 2>&1 || mv -f $(current_aidl_config) $(previous_aidl_config))
MODULES_WITH_AIDL_FILES :=
modules_with_aidl_files :=
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index d3f9d1a..ed25f71 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -8,6 +8,7 @@
ifdef LOCAL_IS_HOST_MODULE
my_prefix := HOST_
+ LOCAL_HOST_PREFIX :=
else
my_prefix := TARGET_
endif
@@ -52,4 +53,26 @@
LOCAL_2ND_ARCH_VAR_PREFIX :=
+ifdef LOCAL_IS_HOST_MODULE
+ifdef HOST_CROSS_OS
+ifneq (,$(filter EXECUTABLES STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)))
+my_prefix := HOST_CROSS_
+LOCAL_HOST_PREFIX := $(my_prefix)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# host cross compilation is supported
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_MODULE_STEM :=
+LOCAL_BUILT_MODULE_STEM :=
+LOCAL_INSTALLED_MODULE_STEM :=
+LOCAL_INTERMEDIATE_TARGETS :=
+include $(BUILD_SYSTEM)/prebuilt_internal.mk
+endif
+LOCAL_HOST_PREFIX :=
+endif
+endif
+endif
+
my_module_arch_supported :=
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index f85b0b8..601a79c 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -48,6 +48,10 @@
# Do not pack relocations by default
LOCAL_PACK_MODULE_RELOCATIONS := false
endif
+
+ ifeq ($(DISABLE_RELOCATION_PACKER),true)
+ LOCAL_PACK_MODULE_RELOCATIONS := false
+ endif
endif
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
@@ -88,7 +92,7 @@
ifdef prebuilt_module_is_a_library
export_includes := $(intermediates)/export_includes
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
-$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
+$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP)
@echo Export includes file: $< -- $@
$(hide) mkdir -p $(dir $@) && rm -f $@
ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
@@ -122,7 +126,7 @@
endif
endif
-# We need to enclose the above export_includes and built_shared_libraries in
+# We need to enclose the above export_includes and my_built_shared_libraries in
# "LOCAL_STRIP_MODULE not true" because otherwise the rules are defined in dynamic_binary.mk.
endif # LOCAL_STRIP_MODULE not true
@@ -195,25 +199,35 @@
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
#######################################
# Sign and align non-presigned .apks.
-$(built_module) : PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES := $(LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES)
+
+# The embedded prebuilt jni to uncompress.
+ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
+# For PRESIGNED apks we must uncompress every .so file:
+# even if the .so file isn't for the current TARGET_ARCH,
+# we can't strip the file.
+embedded_prebuilt_jni_libs := 'lib/*.so'
+endif
+ifndef embedded_prebuilt_jni_libs
+# No LOCAL_PREBUILT_JNI_LIBS, uncompress all.
+embedded_prebuilt_jni_libs := 'lib/*.so'
+endif
+$(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs)
+
$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
$(transform-prebuilt-to-target)
+ $(uncompress-shared-libs)
ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
@# Only strip out files if we can re-sign the package.
-ifdef extracted_jni_libs
- $(hide) zip -d $@ 'lib/*.so' # strip embedded JNI libraries.
-endif
ifdef LOCAL_DEX_PREOPT
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
$(call dexpreopt-remove-classes.dex,$@)
endif
endif
$(sign-package)
-endif
-ifeq ($(LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES),true)
- $(uncompress-shared-libs)
-endif
+ # No need for align-package because sign-package takes care of alignment
+else
$(align-package)
+endif
###############################
## Rule to build the odex file
@@ -229,7 +243,7 @@
built_apk_splits := $(addprefix $(built_module_path)/,$(notdir $(LOCAL_PACKAGE_SPLITS)))
installed_apk_splits := $(addprefix $(my_module_path)/,$(notdir $(LOCAL_PACKAGE_SPLITS)))
-# Rules to sign and zipalign the split apks.
+# Rules to sign the split apks.
my_src_dir := $(sort $(dir $(LOCAL_PACKAGE_SPLITS)))
ifneq (1,$(words $(my_src_dir)))
$(error You must put all the split source apks in the same folder: $(LOCAL_PACKAGE_SPLITS))
@@ -241,7 +255,6 @@
$(built_apk_splits) : $(built_module_path)/%.apk : $(my_src_dir)/%.apk | $(ACP)
$(copy-file-to-new-target)
$(sign-package)
- $(align-package)
# Rules to install the split apks.
$(installed_apk_splits) : $(my_module_path)/%.apk : $(built_module_path)/%.apk | $(ACP)
@@ -263,8 +276,13 @@
$(built_module) : $(my_prebuilt_src_file)
$(transform-prebuilt-to-target-strip-comments)
else
+ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(built_module) : $(my_prebuilt_src_file) | $(ACP)
$(transform-prebuilt-to-target)
+else
+$(built_module) : $(my_prebuilt_src_file)
+ $(copy-file-to-target-with-cp)
+endif
endif
endif # LOCAL_MODULE_CLASS != APPS
@@ -298,10 +316,25 @@
$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
$(transform-prebuilt-to-target)
+$(call define-jar-to-toc-rule, $(common_classes_jar))
+
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
$(built_module) : $(common_javalib_jar)
endif # TARGET JAVA_LIBRARIES
-$(built_module) : $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
+$(intermediates.COMMON)/classes.jack : PRIVATE_JILL_FLAGS:=$(LOCAL_JILL_FLAGS)
+$(intermediates.COMMON)/classes.jack : $(my_src_jar) $(LOCAL_MODULE_MAKEFILE_DEP) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JILL_JAR) $(JACK) | setup-jack-server
+ $(transform-jar-to-jack)
+
+# Update timestamps of .toc files for prebuilts so dependents will be
+# always rebuilt.
+$(intermediates.COMMON)/classes.dex.toc: $(intermediates.COMMON)/classes.jack
+ touch $@
+
+endif # JAVA_LIBRARIES
+
+$(built_module) : $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES)
my_prebuilt_src_file :=
diff --git a/core/tasks/product-graph.mk b/core/product-graph.mk
similarity index 98%
rename from core/tasks/product-graph.mk
rename to core/product-graph.mk
index db2cf71..36e9037 100644
--- a/core/tasks/product-graph.mk
+++ b/core/product-graph.mk
@@ -34,7 +34,7 @@
endef
-this_makefile := build/core/tasks/product-graph.mk
+this_makefile := build/core/product-graph.mk
products_svg := $(OUT_DIR)/products.svg
products_pdf := $(OUT_DIR)/products.pdf
diff --git a/core/product.mk b/core/product.mk
index 46fad89..4d35704 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -28,8 +28,9 @@
# $(call ) isn't necessary.
#
define _find-android-products-files
-$(shell test -d device && find device -maxdepth 6 -name AndroidProducts.mk) \
- $(shell test -d vendor && find vendor -maxdepth 6 -name AndroidProducts.mk) \
+$(sort $(shell test -d device && find -L device -maxdepth 6 -name AndroidProducts.mk)) \
+ $(sort $(shell test -d vendor && find -L vendor -maxdepth 6 -name AndroidProducts.mk)) \
+ $(sort $(shell test -d product && find -L product -maxdepth 6 -name AndroidProducts.mk)) \
$(SRC_TARGET_DIR)/product/AndroidProducts.mk
endef
@@ -97,10 +98,15 @@
PRODUCT_RESTRICT_VENDOR_FILES \
PRODUCT_VENDOR_KERNEL_HEADERS \
PRODUCT_BOOT_JARS \
+ PRODUCT_SUPPORTS_BOOT_SIGNER \
+ PRODUCT_SUPPORTS_VBOOT \
PRODUCT_SUPPORTS_VERITY \
+ PRODUCT_SUPPORTS_VERITY_FEC \
PRODUCT_OEM_PROPERTIES \
PRODUCT_SYSTEM_PROPERTY_BLACKLIST \
PRODUCT_SYSTEM_SERVER_JARS \
+ PRODUCT_VBOOT_SIGNING_KEY \
+ PRODUCT_VBOOT_SIGNING_SUBKEY \
PRODUCT_VERITY_SIGNING_KEY \
PRODUCT_SYSTEM_VERITY_PARTITION \
PRODUCT_VENDOR_VERITY_PARTITION \
@@ -129,11 +135,14 @@
# 3. Records that we've visited this node, in ALL_PRODUCTS
#
define inherit-product
+ $(if $(findstring ../,$(1)),\
+ $(eval np := $(call normalize-paths,$(1))),\
+ $(eval np := $(strip $(1))))\
$(foreach v,$(_product_var_list), \
- $(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1)))) \
+ $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
$(eval inherit_var := \
PRODUCTS.$(strip $(word 1,$(_include_stack))).INHERITS_FROM) \
- $(eval $(inherit_var) := $(sort $($(inherit_var)) $(strip $(1)))) \
+ $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
$(eval inherit_var:=) \
$(eval ALL_PRODUCTS := $(sort $(ALL_PRODUCTS) $(word 1,$(_include_stack))))
endef
@@ -234,7 +243,6 @@
TARGET_NO_RECOVERY \
TARGET_NO_RADIOIMAGE \
TARGET_HARDWARE_3D \
- TARGET_PROVIDES_INIT_RC \
TARGET_CPU_ABI \
TARGET_CPU_ABI2 \
@@ -270,6 +278,7 @@
_product_stash_var_list += \
GLOBAL_CFLAGS_NO_OVERRIDE \
GLOBAL_CPPFLAGS_NO_OVERRIDE \
+ GLOBAL_CLANG_CFLAGS_NO_OVERRIDE \
#
# Stash values of the variables in _product_stash_var_list.
diff --git a/core/product_config.mk b/core/product_config.mk
index 5240ae7..ad3b518 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -213,7 +213,19 @@
current_product_makefile := $(strip $(current_product_makefile))
all_product_makefiles := $(strip $(all_product_makefiles))
-ifneq (,$(filter product-graph dump-products, $(MAKECMDGOALS)))
+load_all_product_makefiles :=
+ifneq (,$(filter product-graph, $(MAKECMDGOALS)))
+ifeq ($(ANDROID_PRODUCT_GRAPH),--all)
+load_all_product_makefiles := true
+endif
+endif
+ifneq (,$(filter dump-products,$(MAKECMDGOALS)))
+ifeq ($(ANDROID_DUMP_PRODUCTS),all)
+load_all_product_makefiles := true
+endif
+endif
+
+ifeq ($(load_all_product_makefiles),true)
# Import all product makefiles.
$(call import-products, $(all_product_makefiles))
else
diff --git a/core/proguard_basic_keeps.flags b/core/proguard_basic_keeps.flags
index 4a85db0..4de5221 100644
--- a/core/proguard_basic_keeps.flags
+++ b/core/proguard_basic_keeps.flags
@@ -40,6 +40,11 @@
java.lang.Object readResolve();
}
+# Keep Throwable's constructor that takes a String argument.
+-keepclassmembers class * extends java.lang.Throwable {
+ <init>(java.lang.String);
+}
+
# Please specify classes to be kept explicitly in your package's configuration.
# -keep class * extends android.app.Activity
# -keep class * extends android.view.View
@@ -58,7 +63,12 @@
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
# See proguard-android.txt in the SDK package.
--dontwarn android.support.**
+#
+# DO NOT USE THIS: We figured it's dangerous to blindly ignore all support library warnings.
+# ProGuard may strip members of subclass of unknown super classes, in case an app is linking against
+# LOCAL_SDK_VERSION lower than the support library's LOCAL_SDK_VERSION.
+# See bug/20658265.
+# -dontwarn android.support.**
# Less spammy.
-dontnote
diff --git a/core/sdk_font.mk b/core/sdk_font.mk
index 204403d..c10f19f 100644
--- a/core/sdk_font.mk
+++ b/core/sdk_font.mk
@@ -18,7 +18,7 @@
SDK_FONT_TEMP := $(call intermediates-dir-for,PACKAGING,sdk-fonts,HOST,COMMON)
# The font configuration files - system_fonts.xml, fallback_fonts.xml etc.
-sdk_font_config := $(wildcard frameworks/base/data/fonts/*.xml)
+sdk_font_config := $(sort $(wildcard frameworks/base/data/fonts/*.xml))
sdk_font_config := $(addprefix $(SDK_FONT_TEMP)/, $(notdir $(sdk_font_config)))
$(sdk_font_config): $(SDK_FONT_TEMP)/%.xml: \
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 71a3bb2..73aca78c 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -9,13 +9,13 @@
ifeq ($(my_module_multilib),both)
ifneq ($(LOCAL_MODULE_PATH),)
ifneq ($(TARGET_2ND_ARCH),)
-$(warning $(LOCAL_MODULE): LOCAL_MODULE_PATH for shared libraries is unsupported in multiarch builds, use LOCAL_MODULE_RELATIVE_PATH instead)
+$(error $(LOCAL_MODULE): LOCAL_MODULE_PATH for shared libraries is unsupported in multiarch builds, use LOCAL_MODULE_RELATIVE_PATH instead)
endif
endif
ifneq ($(LOCAL_UNSTRIPPED_PATH),)
ifneq ($(TARGET_2ND_ARCH),)
-$(warning $(LOCAL_MODULE): LOCAL_UNSTRIPPED_PATH for shared libraries is unsupported in multiarch builds)
+$(error $(LOCAL_MODULE): LOCAL_UNSTRIPPED_PATH for shared libraries is unsupported in multiarch builds)
endif
endif
endif # my_module_multilib == both
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 2487fbb0..b9a5e3e 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -40,12 +40,19 @@
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
-my_target_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT)
-my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV)
+ifeq ($(LOCAL_NO_LIBGCC),true)
+my_target_libgcc :=
+else
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
+endif
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
+ifeq ($(LOCAL_NO_CRT),true)
+my_target_crtbegin_so_o :=
+my_target_crtend_so_o :=
+else
my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O)
my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_SO_O)
+endif
ifdef LOCAL_SDK_VERSION
# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
@@ -59,8 +66,6 @@
endif
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
-$(linked_module): PRIVATE_TARGET_LIBPROFILE_RT := $(my_target_libprofile_rt)
-$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
@@ -71,7 +76,7 @@
$(all_libraries) \
$(my_target_crtbegin_so_o) \
$(my_target_crtend_so_o) \
- $(LOCAL_MODULE_MAKEFILE) \
+ $(LOCAL_MODULE_MAKEFILE_DEP) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-o-to-shared-lib)
diff --git a/core/soong.mk b/core/soong.mk
new file mode 100644
index 0000000..646c68e
--- /dev/null
+++ b/core/soong.mk
@@ -0,0 +1,66 @@
+SOONG_OUT_DIR := $(OUT_DIR)/soong
+SOONG := $(SOONG_OUT_DIR)/soong
+SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
+SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk
+SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
+SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make
+SOONG_HOST_EXECUTABLES := $(SOONG_OUT_DIR)/host/$(HOST_PREBUILT_TAG)/bin
+KATI := $(SOONG_HOST_EXECUTABLES)/ckati
+MAKEPARALLEL := $(SOONG_HOST_EXECUTABLES)/makeparallel
+
+ifeq (,$(filter /%,$(SOONG_OUT_DIR)))
+SOONG_TOP_RELPATH := $(shell python -c "import os; print os.path.relpath('$(TOP)', '$(SOONG_OUT_DIR)')")
+else
+SOONG_TOP_RELPATH := $(realpath $(TOP))
+endif
+
+# Bootstrap soong. Run only the first time for clean builds
+$(SOONG):
+ $(hide) mkdir -p $(dir $@)
+ $(hide) cd $(dir $@) && $(SOONG_TOP_RELPATH)/bootstrap.bash
+
+# Create soong.variables with copies of makefile settings. Runs every build,
+# but only updates soong.variables if it changes
+SOONG_VARIABLES_TMP := $(SOONG_VARIABLES).$$$$
+$(SOONG_VARIABLES): FORCE
+ $(hide) mkdir -p $(dir $@)
+ $(hide) (\
+ echo '{'; \
+ echo ' "Device_uses_jemalloc": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
+ echo ' "Device_uses_dlmalloc": $(if $(filter true,$(MALLOC_SVELTE)),true,false),'; \
+ echo ' "Platform_sdk_version": $(PLATFORM_SDK_VERSION),'; \
+ echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
+ echo ' "Brillo": $(if $(BRILLO),true,false),'; \
+ echo ''; \
+ echo ' "DeviceName": "$(TARGET_DEVICE)",'; \
+ echo ' "DeviceArch": "$(TARGET_ARCH)",'; \
+ echo ' "DeviceArchVariant": "$(TARGET_ARCH_VARIANT)",'; \
+ echo ' "DeviceCpuVariant": "$(TARGET_CPU_VARIANT)",'; \
+ echo ' "DeviceAbi": ["$(TARGET_CPU_ABI)", "$(TARGET_CPU_ABI2)"],'; \
+ echo ' "DeviceUsesClang": $(if $(USE_CLANG_PLATFORM_BUILD),$(USE_CLANG_PLATFORM_BUILD),false),'; \
+ echo ''; \
+ echo ' "DeviceSecondaryArch": "$(TARGET_2ND_ARCH)",'; \
+ echo ' "DeviceSecondaryArchVariant": "$(TARGET_2ND_ARCH_VARIANT)",'; \
+ echo ' "DeviceSecondaryCpuVariant": "$(TARGET_2ND_CPU_VARIANT)",'; \
+ echo ' "DeviceSecondaryAbi": ["$(TARGET_2ND_CPU_ABI)", "$(TARGET_2ND_CPU_ABI2)"],'; \
+ echo ''; \
+ echo ' "HostArch": "$(HOST_ARCH)",'; \
+ echo ' "HostSecondaryArch": "$(HOST_2ND_ARCH)"'; \
+ echo '}') > $(SOONG_VARIABLES_TMP); \
+ if ! cmp -s $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); then \
+ mv $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); \
+ else \
+ rm $(SOONG_VARIABLES_TMP); \
+ fi
+
+# Tell soong that it is embedded in make
+$(SOONG_IN_MAKE):
+ $(hide) mkdir -p $(dir $@)
+ $(hide) touch $@
+
+# Build an Android.mk listing all soong outputs as prebuilts
+$(SOONG_ANDROID_MK): $(SOONG) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE
+ $(hide) $(SOONG) $(KATI) $(MAKEPARALLEL) $(NINJA_ARGS)
+
+$(KATI): $(SOONG_ANDROID_MK)
+$(MAKEPARALLEL): $(SOONG_ANDROID_MK)
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 02078e0..d956124 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -23,6 +23,10 @@
LOCAL_IS_STATIC_JAVA_LIBRARY := true
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+#################################
+include $(BUILD_SYSTEM)/configure_local_jack.mk
+#################################
+
# Hack to build static Java library with Android resource
# See bug 5714516
all_resources :=
@@ -56,8 +60,16 @@
ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
proguard_options_file := $(intermediates.COMMON)/proguard_options
endif
+
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
+ifdef LOCAL_JACK_ENABLED
+ifndef LOCAL_JACK_PROGUARD_FLAGS
+ LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
+endif
+LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS)
+endif # LOCAL_JACK_ENABLED
+
endif # LOCAL_RESOURCE_DIR
all_res_assets := $(all_resources)
@@ -92,7 +104,8 @@
$(R_file_stamp): PRIVATE_MODULE := $(LOCAL_MODULE)
# add --non-constant-id to prevent inlining constants.
-$(R_file_stamp): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id
+# AAR needs text symbol file R.txt.
+$(R_file_stamp): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id --output-text-symbols $(LOCAL_INTERMEDIATE_SOURCE_DIR)
$(R_file_stamp): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
$(R_file_stamp): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediates.COMMON)/public_resources.xml
@@ -114,9 +127,32 @@
$(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
-ifneq ($(full_classes_jar),)
+ifdef LOCAL_JACK_ENABLED
+$(noshrob_classes_jack): $(R_file_stamp)
+$(full_classes_jack): $(R_file_stamp)
+endif # LOCAL_JACK_ENABLED
$(full_classes_compiled_jar): $(R_file_stamp)
-endif
+
+# Rule to build AAR, archive including classes.jar, resource, etc.
+built_aar := $(intermediates.COMMON)/javalib.aar
+$(built_aar): PRIVATE_MODULE := $(LOCAL_MODULE)
+$(built_aar): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
+$(built_aar): PRIVATE_CLASSES_JAR := $(LOCAL_BUILT_MODULE)
+$(built_aar): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
+$(built_aar): PRIVATE_R_TXT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.txt
+$(built_aar) : $(LOCAL_BUILT_MODULE)
+ @echo "target AAR: $(PRIVATE_MODULE) ($@)"
+ $(hide) rm -rf $(dir $@)aar && mkdir -p $(dir $@)aar/res
+ $(hide) cp $(PRIVATE_ANDROID_MANIFEST) $(dir $@)aar/AndroidManifest.xml
+ $(hide) cp $(PRIVATE_CLASSES_JAR) $(dir $@)aar/classes.jar
+ # Note: Use "cp -n" to honor the resource overlay rules, if multiple res dirs exist.
+ $(hide) $(foreach res,$(PRIVATE_RESOURCE_DIR),cp -Rfn $(res)/* $(dir $@)aar/res;)
+ $(hide) cp $(PRIVATE_R_TXT) $(dir $@)aar/R.txt
+ $(hide) jar -cMf $@ \
+ -C $(dir $@)aar .
+
+# Register the aar file.
+ALL_MODULES.$(LOCAL_MODULE).AAR := $(built_aar)
endif # need_compile_res
diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk
index f8a9f04..4715fe8 100644
--- a/core/target_test_internal.mk
+++ b/core/target_test_internal.mk
@@ -7,9 +7,9 @@
LOCAL_C_INCLUDES += external/gtest/include
ifndef LOCAL_SDK_VERSION
-LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
+LOCAL_STATIC_LIBRARIES += libgtest_main libgtest
else
-LOCAL_STATIC_LIBRARIES += libgtest_ndk libgtest_main_ndk
+LOCAL_STATIC_LIBRARIES += libgtest_main_ndk libgtest_ndk
endif
ifdef LOCAL_MODULE_PATH
diff --git a/core/tasks/build_custom_images.mk b/core/tasks/build_custom_images.mk
new file mode 100644
index 0000000..8ebf89b
--- /dev/null
+++ b/core/tasks/build_custom_images.mk
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2015 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.
+#
+
+# Build additional images requested by the product makefile.
+# This script gives the ability to build multiple additional images and you can
+# configure what modules/files to include in each image.
+# 1. Define PRODUCT_CUSTOM_IMAGE_MAKEFILES in your product makefile.
+# PRODUCT_CUSTOM_IMAGE_MAKEFILES is a list of makefiles.
+# Each makefile configures an image.
+# For image configuration makefile foo/bar/xyz.mk, the built image file name
+# will be xyz.img. So make sure they won't conflict.
+# 2. In each image's configuration makefile, you can define variables:
+# - CUSTOM_IMAGE_MOUNT_POINT, the mount point, such as "oem", "odm" etc.
+# - CUSTOM_IMAGE_PARTITION_SIZE
+# - CUSTOM_IMAGE_FILE_SYSTEM_TYPE
+# - CUSTOM_IMAGE_DICT_FILE, a text file defines a dictionary accepted by
+# BuildImage() in tools/releasetools/build_image.py.
+# - CUSTOM_IMAGE_MODULES, a list of module names you want to include in
+# the image; Not only the module itself will be installed to proper path in
+# the image, you can also piggyback additional files/directories with the
+# module's LOCAL_PICKUP_FILES.
+# - CUSTOM_IMAGE_COPY_FILES, a list of "<src>:<dest>" to be copied to the
+# image. <dest> is relativ to the root of the image.
+# - CUSTOM_IMAGE_SELINUX, set to "true" if the image supports selinux.
+# - CUSTOM_IMAGE_SUPPORT_VERITY, set to "true" if the product supports verity.
+# - CUSTOM_IMAGE_VERITY_BLOCK_DEVICE
+#
+# To build all those images, run "make custom_images".
+
+ifneq ($(filter $(MAKECMDGOALS),custom_images),)
+
+.PHONY: custom_images
+
+custom_image_parameter_variables := \
+ CUSTOM_IMAGE_MOUNT_POINT \
+ CUSTOM_IMAGE_PARTITION_SIZE \
+ CUSTOM_IMAGE_FILE_SYSTEM_TYPE \
+ CUSTOM_IMAGE_DICT_FILE \
+ CUSTOM_IMAGE_MODULES \
+ CUSTOM_IMAGE_COPY_FILES \
+ CUSTOM_IMAGE_SELINUX \
+ CUSTOM_IMAGE_SUPPORT_VERITY \
+ CUSTOM_IMAGE_VERITY_BLOCK_DEVICE \
+
+# We don't expect product makefile to inherit/override PRODUCT_CUSTOM_IMAGE_MAKEFILES,
+# so we don't put it in the _product_var_list.
+$(foreach mk, $(PRODUCT_CUSTOM_IMAGE_MAKEFILES),\
+ $(eval my_custom_imag_makefile := $(mk))\
+ $(eval include $(BUILD_SYSTEM)/tasks/tools/build_custom_image.mk))
+
+endif
diff --git a/core/tasks/check_boot_jars/package_whitelist.txt b/core/tasks/check_boot_jars/package_whitelist.txt
index 4d62615..48fa4a1 100644
--- a/core/tasks/check_boot_jars/package_whitelist.txt
+++ b/core/tasks/check_boot_jars/package_whitelist.txt
@@ -2,7 +2,7 @@
# Each line is interpreted as a regular expression.
###################################################
-# core-libart.jar
+# core-libart.jar & core-oj.jar
java\.awt\.font
java\.beans
java\.io
@@ -13,6 +13,9 @@
java\.math
java\.net
java\.nio
+java\.nio\.file
+java\.nio\.file\.spi
+java\.nio\.file\.attribute
java\.nio\.channels
java\.nio\.channels\.spi
java\.nio\.charset
@@ -24,6 +27,7 @@
java\.security\.spec
java\.sql
java\.text
+java\.text\.spi
java\.util
java\.util\.concurrent
java\.util\.concurrent\.atomic
@@ -32,6 +36,7 @@
java\.util\.logging
java\.util\.prefs
java\.util\.regex
+java\.util\.spi
java\.util\.zip
javax\.crypto
javax\.crypto\.interfaces
@@ -54,10 +59,18 @@
javax\.xml\.transform\.stream
javax\.xml\.validation
javax\.xml\.xpath
-sun\.misc
org\.w3c\.dom
org\.w3c\.dom\.ls
org\.w3c\.dom\.traversal
+# OpenJdk internal implementation.
+sun\.misc
+sun\.util.*
+sun\.text.*
+sun\.security.*
+sun\.reflect.*
+sun\.nio.*
+sun\.net.*
+com\.sun\..*
# TODO: Move these internal org.apache.harmony classes to libcore.*
org\.apache\.harmony\.crypto\.internal
diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk
index 23648f8..d923c26 100644
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -21,7 +21,7 @@
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_EXEC_PATH ?= $(HOST_OUT_EXECUTABLES)/cts-tradefed
CTS_TF_README_PATH := $(cts_tools_src_dir)/tradefed-host/README
VMTESTSTF_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,vm-tests-tf,HOST)
@@ -64,8 +64,8 @@
CTS_TEST_JAR_LIST := \
- cts-junit \
- CtsJdwp
+ cts-junit \
+ CtsJdwp
# Depend on the full package paths rather than the phony targets to avoid
# rebuilding the packages every time.
@@ -73,24 +73,30 @@
CTS_TEST_JAR_FILES := $(foreach c,$(CTS_TEST_JAR_LIST),$(call intermediates-dir-for,JAVA_LIBRARIES,$(c))/javalib.jar)
-include cts/CtsTestCaseList.mk
-CTS_CASE_LIST := $(CTS_CORE_CASE_LIST) $(CTS_TEST_CASE_LIST)
# A module may have mutliple installed files (e.g. split apks)
CTS_CASE_LIST_APKS :=
-CTS_CASE_LIST_APKS_DIR := $(cts_dir)/$(cts_name)/repository/testcases/
-$(foreach m, $(CTS_CASE_LIST),\
+$(foreach m, $(CTS_TEST_CASE_LIST),\
+ $(foreach fp, $(ALL_MODULES.$(m).BUILT_INSTALLED),\
+ $(eval pair := $(subst :,$(space),$(fp)))\
+ $(eval CTS_CASE_LIST_APKS += $(CTS_TESTCASES_OUT)/$(notdir $(word 2,$(pair))))))\
+$(foreach m, $(CTS_CORE_CASE_LIST),\
$(foreach fp, $(ALL_MODULES.$(m).BUILT_INSTALLED),\
$(eval pair := $(subst :,$(space),$(fp)))\
$(eval built := $(word 1,$(pair)))\
- $(eval installed := $(CTS_CASE_LIST_APKS_DIR)/$(notdir $(word 2,$(pair))))\
+ $(eval installed := $(CTS_TESTCASES_OUT)/$(notdir $(word 2,$(pair))))\
$(eval $(call copy-one-file, $(built), $(installed)))\
$(eval CTS_CASE_LIST_APKS += $(installed))))
-CTS_SHARED_LIBS := \
- $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX)
+CTS_CASE_LIST_JARS :=
+$(foreach m, $(CTS_TEST_JAR_LIST),\
+ $(eval CTS_CASE_LIST_JARS += $(CTS_TESTCASES_OUT)/$(m).jar))
+
+CTS_SHARED_LIBS :=
DEFAULT_TEST_PLAN := $(cts_dir)/$(cts_name)/resource/plans
-$(cts_dir)/all_cts_files_stamp: $(CTS_CORE_CASES) $(CTS_TEST_CASES) $(CTS_CASE_LIST_APKS) $(JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(VMTESTSTF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(ACP) $(CTS_TEST_JAR_FILES) $(CTS_SHARED_LIBS)
+$(cts_dir)/all_cts_files_stamp: $(CTS_CORE_CASES) $(CTS_TEST_JAR_FILES) $(CTS_TEST_CASES) $(CTS_CASE_LIST_APKS) $(CTS_CASE_LIST_JARS) $(JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(VMTESTSTF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(ADDITIONAL_TF_JARS) $(ACP) $(CTS_SHARED_LIBS)
+
# Make necessary directory for CTS
$(hide) mkdir -p $(TMP_DIR)
$(hide) mkdir -p $(PRIVATE_DIR)/docs
@@ -98,12 +104,9 @@
$(hide) mkdir -p $(PRIVATE_DIR)/repository/testcases
$(hide) mkdir -p $(PRIVATE_DIR)/repository/plans
# Copy executable and JARs to CTS directory
- $(hide) $(ACP) -fp $(VMTESTSTF_JAR) $(PRIVATE_DIR)/repository/testcases
- $(hide) $(ACP) -fp $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(PRIVATE_DIR)/tools
+ $(hide) $(ACP) -fp $(VMTESTSTF_JAR) $(CTS_TESTCASES_OUT)
+ $(hide) $(ACP) -fp $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(ADDITIONAL_TF_JARS) $(CTS_TF_README_PATH) $(PRIVATE_DIR)/tools
$(hide) $(call copy-files-with-structure, $(CTS_SHARED_LIBS),$(HOST_OUT)/,$(PRIVATE_DIR))
-# Change mode of the executables
- $(foreach jar,$(CTS_TEST_JAR_LIST),$(call copy-testcase-jar,$(jar)))
- $(foreach testcase,$(CTS_TEST_CASES),$(call copy-testcase,$(testcase)))
$(hide) touch $@
# Generate the test descriptions for the core-tests
@@ -123,6 +126,7 @@
$(PRIVATE_PARAMS) CollectAllTests $(1) $(2) $(3) "$(4)" $(5) $(6) $(7)
endef
+OJ_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-oj,,COMMON)
CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)
CONSCRYPT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,conscrypt,,COMMON)
BOUNCYCASTLE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,bouncycastle,,COMMON)
@@ -139,7 +143,7 @@
TZDATAUPDATETESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,tzdata_update-tests,,COMMON)
GEN_CLASSPATH := \
- $(CORE_INTERMEDIATES)/classes.jar:$(CONSCRYPT_INTERMEDIATES)/classes.jar:$(BOUNCYCASTLE_INTERMEDIATES)/classes.jar:$(APACHEXML_INTERMEDIATES)/classes.jar:$(APACHEHARMONYTESTS_INTERMEDIATES)/classes.jar:$(OKHTTP_INTERMEDIATES)/classes.jar:$(OKHTTPTESTS_INTERMEDIATES)/classes.jar:$(OKHTTP_REPACKAGED_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(SQLITEJDBC_INTERMEDIATES)/javalib.jar:$(CORETESTS_INTERMEDIATES)/javalib.jar:$(JSR166TESTS_INTERMEDIATES)/javalib.jar:$(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar:$(TZDATAUPDATETESTS_INTERMEDIATES)/javalib.jar
+ $(OJ_INTERMEDIATES)/classes.jar:$(CORE_INTERMEDIATES)/classes.jar:$(CONSCRYPT_INTERMEDIATES)/classes.jar:$(BOUNCYCASTLE_INTERMEDIATES)/classes.jar:$(APACHEXML_INTERMEDIATES)/classes.jar:$(APACHEHARMONYTESTS_INTERMEDIATES)/classes.jar:$(OKHTTP_INTERMEDIATES)/classes.jar:$(OKHTTPTESTS_INTERMEDIATES)/classes.jar:$(OKHTTP_REPACKAGED_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(SQLITEJDBC_INTERMEDIATES)/javalib.jar:$(CORETESTS_INTERMEDIATES)/javalib.jar:$(JSR166TESTS_INTERMEDIATES)/javalib.jar:$(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar:$(TZDATAUPDATETESTS_INTERMEDIATES)/javalib.jar
CTS_CORE_XMLS := \
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.dalvik.xml \
@@ -213,7 +217,16 @@
$(hide) mkdir -p $(CTS_TESTCASES_OUT)
$(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.org,\
cts/tests/core/libcore/org/AndroidManifest.xml,\
- $(CORETESTS_INTERMEDIATES)/javalib.jar,org,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,\
+ org.w3c.domts:\
+ org.apache.harmony.security.tests:\
+ org.apache.harmony.nio.tests:\
+ org.apache.harmony.crypto.tests:\
+ org.apache.harmony.regex.tests:\
+ org.apache.harmony.luni.tests:\
+ org.apache.harmony.tests.internal.net.www.protocol:\
+ org.apache.harmony.tests.javax.net:\
+ org.json,\
$(TARGET_ARCH),libcore/expectations)
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.libcore.xml: $(CTS_CORE_XMLS_DEPS)
@@ -340,10 +353,11 @@
CORE_VM_TEST_TF_DESC := $(CTS_TESTCASES_OUT)/android.core.vm-tests-tf.xml
# core tests only needed to get hold of junit-framework-classes
+OJ_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-oj,,COMMON)
CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)
JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON)
-GEN_CLASSPATH := $(CORE_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(VMTESTSTF_JAR):$(TF_JAR)
+GEN_CLASSPATH := $(OJ_INTERMEDIATES)/classes.jar:$(CORE_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(VMTESTSTF_JAR):$(TF_JAR)
$(CORE_VM_TEST_TF_DESC): PRIVATE_CLASSPATH:=$(GEN_CLASSPATH)
# Please see big comment above on why this line depends on javalib.jar instead of classes.jar
@@ -359,8 +373,7 @@
# Generate the default test plan for User.
# Usage: buildCts.py <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath>
-$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/buildCts.py $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CTS_CORE_XMLS) $(CTS_TEST_XMLS) $(CORE_VM_TEST_TF_DESC) | $(ACP)
- $(hide) $(ACP) -fp $(CTS_CORE_XMLS) $(CTS_TEST_XMLS) $(CORE_VM_TEST_TF_DESC) $(PRIVATE_DIR)/repository/testcases
+$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/buildCts.py $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CTS_CORE_XMLS) $(CTS_TEST_XMLS) $(CORE_VM_TEST_TF_DESC)
$(hide) $(cts_tools_src_dir)/utils/buildCts.py cts/tests/tests/ $(PRIVATE_DIR) $(TMP_DIR) \
$(TOP) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar
$(hide) mkdir -p $(dir $@) && touch $@
@@ -376,22 +389,8 @@
$(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp
$(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN)
$(hide) echo "Package CTS: $@"
- $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME)
+ $(hide) cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME)
.PHONY: cts
cts: $(INTERNAL_CTS_TARGET) adb
$(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET))
-
-
-define copy-testcase
-
-$(hide) $(ACP) -fp $(1) $(PRIVATE_DIR)/repository/testcases/$(notdir $1)
-
-endef
-
-define copy-testcase-jar
-
-$(hide) $(ACP) -fp $(call intermediates-dir-for,JAVA_LIBRARIES,$(1))/javalib.jar \
- $(PRIVATE_DIR)/repository/testcases/$(1).jar
-
-endef
diff --git a/core/tasks/oem_image.mk b/core/tasks/oem_image.mk
index 26b9aba..32d56a7 100644
--- a/core/tasks/oem_image.mk
+++ b/core/tasks/oem_image.mk
@@ -36,7 +36,7 @@
$(call generate-userimage-prop-dictionary, $(oemimage_intermediates)/oem_image_info.txt, skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
- $(TARGET_OUT_OEM) $(oemimage_intermediates)/oem_image_info.txt $@
+ $(TARGET_OUT_OEM) $(oemimage_intermediates)/oem_image_info.txt $@ $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$@,$(BOARD_OEMIMAGE_PARTITION_SIZE))
.PHONY: oem_image
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index 5ac9b7d..362b229 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -111,13 +111,13 @@
$(ACP) -r $$d $(PRIVATE_STAGING_DIR)/docs ;\
done
$(hide) mkdir -p $(dir $@)
- $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rq $$F $(notdir $(PRIVATE_STAGING_DIR)) )
+ $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) )
$(full_target_img): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_img))/images/$(TARGET_CPU_ABI)
$(full_target_img): $(full_target) $(addon_img_source_prop)
@echo Packaging SDK Addon System-Image: $@
$(hide) mkdir -p $(dir $@)
- $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rq $$F $(notdir $(PRIVATE_STAGING_DIR)) )
+ $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR)/.. && zip -rqX $$F $(notdir $(PRIVATE_STAGING_DIR)) )
.PHONY: sdk_addon
diff --git a/core/tasks/tools/build_custom_image.mk b/core/tasks/tools/build_custom_image.mk
new file mode 100644
index 0000000..ec491fa
--- /dev/null
+++ b/core/tasks/tools/build_custom_image.mk
@@ -0,0 +1,117 @@
+#
+# Copyright (C) 2015 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.
+#
+
+
+# Define rule to build one custom image.
+# Input variables: my_custom_imag_makefile
+
+$(call clear-var-list, $(custom_image_parameter_variables))
+
+include $(my_custom_imag_makefile)
+
+my_custom_image_name := $(basename $(notdir $(my_custom_imag_makefile)))
+
+intermediates := $(call intermediates-dir-for,PACKAGING,$(my_custom_image_name))
+my_built_custom_image := $(intermediates)/$(my_custom_image_name).img
+my_staging_dir := $(intermediates)/$(CUSTOM_IMAGE_MOUNT_POINT)
+
+# Collect CUSTOM_IMAGE_MODULES's installd files and their PICKUP_FILES.
+my_built_modules :=
+my_copy_pairs :=
+my_pickup_files :=
+
+$(foreach m,$(CUSTOM_IMAGE_MODULES),\
+ $(eval _pickup_files := $(strip $(ALL_MODULES.$(m).PICKUP_FILES)\
+ $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).PICKUP_FILES)))\
+ $(eval _built_files := $(strip $(ALL_MODULES.$(m).BUILT_INSTALLED)\
+ $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).BUILT_INSTALLED)))\
+ $(if $(_pickup_files)$(_built_files),,\
+ $(warning Unknown installed file for module '$(m)'))\
+ $(eval my_pickup_files += $(_pickup_files))\
+ $(foreach i, $(_built_files),\
+ $(eval bui_ins := $(subst :,$(space),$(i)))\
+ $(eval ins := $(word 2,$(bui_ins)))\
+ $(if $(filter $(TARGET_OUT_ROOT)/%,$(ins)),\
+ $(eval bui := $(word 1,$(bui_ins)))\
+ $(eval my_built_modules += $(bui))\
+ $(eval my_copy_dest := $(patsubst $(PRODUCT_OUT)/%,%,$(ins)))\
+ $(eval my_copy_dest := $(subst /,$(space),$(my_copy_dest)))\
+ $(eval my_copy_dest := $(wordlist 2,999,$(my_copy_dest)))\
+ $(eval my_copy_dest := $(subst $(space),/,$(my_copy_dest)))\
+ $(eval my_copy_pairs += $(bui):$(my_staging_dir)/$(my_copy_dest)))\
+ ))
+
+# Collect CUSTOM_IMAGE_COPY_FILES.
+my_image_copy_files :=
+$(foreach f,$(CUSTOM_IMAGE_COPY_FILES),\
+ $(eval pair := $(subst :,$(space),$(f)))\
+ $(eval src := $(word 1,$(pair)))\
+ $(eval my_image_copy_files += $(src))\
+ $(eval my_copy_pairs += $(src):$(my_staging_dir)/$(word 2,$(pair))))
+
+$(my_built_custom_image): PRIVATE_INTERMEDIATES := $(intermediates)
+$(my_built_custom_image): PRIVATE_MOUNT_POINT := $(CUSTOM_IMAGE_MOUNT_POINT)
+$(my_built_custom_image): PRIVATE_PARTITION_SIZE := $(CUSTOM_IMAGE_PARTITION_SIZE)
+$(my_built_custom_image): PRIVATE_FILE_SYSTEM_TYPE := $(CUSTOM_IMAGE_FILE_SYSTEM_TYPE)
+$(my_built_custom_image): PRIVATE_STAGING_DIR := $(my_staging_dir)
+$(my_built_custom_image): PRIVATE_COPY_PAIRS := $(my_copy_pairs)
+$(my_built_custom_image): PRIVATE_PICKUP_FILES := $(my_pickup_files)
+$(my_built_custom_image): PRIVATE_SELINUX := $(CUSTOM_IMAGE_SELINUX)
+$(my_built_custom_image): PRIVATE_SUPPORT_VERITY := $(CUSTOM_IMAGE_SUPPORT_VERITY)
+$(my_built_custom_image): PRIVATE_VERITY_KEY := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY)
+$(my_built_custom_image): PRIVATE_VERITY_BLOCK_DEVICE := $(CUSTOM_IMAGE_VERITY_BLOCK_DEVICE)
+$(my_built_custom_image): PRIVATE_DICT_FILE := $(CUSTOM_IMAGE_DICT_FILE)
+$(my_built_custom_image): $(INTERNAL_USERIMAGES_DEPS) $(my_built_modules) $(my_image_copy_files) \
+ $(CUSTOM_IMAGE_DICT_FILE)
+ @echo "Build image $@"
+ $(hide) rm -rf $(PRIVATE_INTERMEDIATES) && mkdir -p $(PRIVATE_INTERMEDIATES)
+ $(hide) rm -rf $(PRIVATE_STAGING_DIR) && mkdir -p $(PRIVATE_STAGING_DIR)
+ # Copy all the files.
+ $(hide) $(foreach p,$(PRIVATE_COPY_PAIRS),\
+ $(eval pair := $(subst :,$(space),$(p)))\
+ mkdir -p $(dir $(word 2,$(pair)));\
+ cp -Rf $(word 1,$(pair)) $(word 2,$(pair));)
+ $(if $($(PRIVATE_PICKUP_FILES)),$(hide) cp -Rf $(PRIVATE_PICKUP_FILES) $(PRIVATE_STAGING_DIR))
+ # Generate the dict.
+ $(hide) echo "# For all accepted properties, see BuildImage() in tools/releasetools/build_image.py" > $(PRIVATE_INTERMEDIATES)/image_info.txt
+ $(hide) echo "mount_point=$(PRIVATE_MOUNT_POINT)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt
+ $(hide) echo "fs_type=$(PRIVATE_FILE_SYSTEM_TYPE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt
+ $(hide) echo "partition_size=$(PRIVATE_PARTITION_SIZE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt
+ $(if $(PRIVATE_SELINUX),$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt)
+ $(if $(PRIVATE_SUPPORT_VERITY),\
+ $(hide) echo "verity=$(PRIVATE_SUPPORT_VERITY)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\
+ echo "verity_key=$(PRIVATE_VERITY_KEY)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\
+ echo "verity_signer_cmd=$(VERITY_SIGNER)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\
+ echo "verity_block_device=$(PRIVATE_VERITY_BLOCK_DEVICE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt)
+ $(if $(PRIVATE_DICT_FILE),\
+ $(hide) echo "# Properties from $(PRIVATE_DICT_FILE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\
+ cat $(PRIVATE_DICT_FILE) >> $(PRIVATE_INTERMEDIATES)/image_info.txt)
+ # Generate the image.
+ $(if $(filter oem,$(PRIVATE_MOUNT_POINT)), \
+ $(hide) echo "oem.buildnumber=$(BUILD_NUMBER)" >> $(PRIVATE_STAGING_DIR)/oem.prop)
+ $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
+ ./build/tools/releasetools/build_image.py \
+ $(PRIVATE_STAGING_DIR) $(PRIVATE_INTERMEDIATES)/image_info.txt $@ $(TARGET_OUT)
+
+my_installed_custom_image := $(PRODUCT_OUT)/$(notdir $(my_built_custom_image))
+$(my_installed_custom_image) : $(my_built_custom_image)
+ $(call copy-file-to-new-target-with-cp)
+
+.PHONY: $(my_custom_image_name)
+custom_images $(my_custom_image_name) : $(my_installed_custom_image)
+
+# Archive the built image.
+$(call dist-for-goals, $(my_custom_image_name) custom_images,$(my_installed_custom_image))
diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk
index bd9cf57..24a7608 100644
--- a/core/tasks/tools/package-modules.mk
+++ b/core/tasks/tools/package-modules.mk
@@ -41,7 +41,7 @@
$(hide) $(foreach p, $(1),\
$(eval pair := $(subst :,$(space),$(p)))\
mkdir -p $(dir $(word 2,$(pair)));\
- cp -rf $(word 1,$(pair)) $(word 2,$(pair));)
+ cp -Rf $(word 1,$(pair)) $(word 2,$(pair));)
endef
my_package_zip := $(my_staging_dir)/$(my_package_name).zip
@@ -58,5 +58,5 @@
$(call copy-tests-in-batch,$(wordlist 1001,1200,$(PRIVATE_COPY_PAIRS)))
$(call copy-tests-in-batch,$(wordlist 1201,9999,$(PRIVATE_COPY_PAIRS)))
$(hide) $(foreach f, $(PRIVATE_PICKUP_FILES),\
- cp -rf $(f) $(dir $@);)
- $(hide) cd $(dir $@) && zip -rq $(notdir $@) *
+ cp -RfL $(f) $(dir $@);)
+ $(hide) cd $(dir $@) && zip -rqX $(notdir $@) *
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index d8e8ec7..910c8b7 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -22,8 +22,10 @@
broadcom \
csr \
elan \
+ fpc \
google \
htc \
+ huawei \
imgtec \
invensense \
intel \
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index f3b2297..8b9bdba 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -24,6 +24,8 @@
# DEFAULT_APP_TARGET_SDK
# BUILD_ID
# BUILD_NUMBER
+# BUILD_DATETIME
+# SECURITY_PATCH
#
# Look for an optional file containing overrides of the defaults,
@@ -41,7 +43,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 := 5.1.51
+ PLATFORM_VERSION := 6.0.1
endif
ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -53,7 +55,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 := 22
+ PLATFORM_SDK_VERSION := 23
endif
ifeq "" "$(PLATFORM_VERSION_CODENAME)"
@@ -67,6 +69,23 @@
PLATFORM_VERSION_ALL_CODENAMES := $(PLATFORM_VERSION_CODENAME)
endif
+ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
+ PLATFORM_PREVIEW_SDK_VERSION := 0
+else
+ ifeq "" "$(PLATFORM_PREVIEW_SDK_VERSION)"
+ # This is the definition of a preview SDK version over and above the current
+ # platform SDK version. Unlike the platform SDK version, a higher value
+ # for preview SDK version does NOT mean that all prior preview APIs are
+ # included. Packages reading this value to determine compatibility with
+ # known APIs should check that this value is precisely equal to the preview
+ # SDK version the package was built for, otherwise it should fall back to
+ # assuming the device can only support APIs as of the previous official
+ # public release.
+ # This value will always be 0 for release builds.
+ PLATFORM_PREVIEW_SDK_VERSION := 0
+ endif
+endif
+
ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
# This is the default minSdkVersion and targetSdkVersion to use for
# all .apks created by the build system. It can be overridden by explicitly
@@ -80,6 +99,22 @@
endif
endif
+ifeq "" "$(PLATFORM_SECURITY_PATCH)"
+ # Used to indicate the security patch that has been applied to the device.
+ # Can be an arbitrary string, but must be a single word.
+ #
+ # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
+ PLATFORM_SECURITY_PATCH := 2015-12-01
+endif
+
+ifeq "" "$(PLATFORM_BASE_OS)"
+ # Used to indicate the base os applied to the device.
+ # Can be an arbitrary string, but must be a single word.
+ #
+ # If there is no $PLATFORM_BASE_OS set, keep it empty.
+ PLATFORM_BASE_OS :=
+endif
+
ifeq "" "$(BUILD_ID)"
# Used to signify special builds. E.g., branches and/or releases,
# like "M5-RC7". Can be an arbitrary string, but must be a single
@@ -89,6 +124,18 @@
BUILD_ID := UNKNOWN
endif
+ifeq "" "$(BUILD_DATETIME)"
+ # Used to reproduce builds by setting the same time. Must be the number
+ # of seconds since the Epoch.
+ BUILD_DATETIME := $(shell date +%s)
+endif
+
+ifneq (,$(findstring Darwin,$(shell uname -sm)))
+DATE := date -r $(BUILD_DATETIME)
+else
+DATE := date -d @$(BUILD_DATETIME)
+endif
+
ifeq "" "$(BUILD_NUMBER)"
# BUILD_NUMBER should be set to the source control value that
# represents the current state of the source code. E.g., a
@@ -99,5 +146,5 @@
# If no BUILD_NUMBER is set, create a useful "I am an engineering build
# from this date/time" value. Make it start with a non-digit so that
# anyone trying to parse it as an integer will probably get "0".
- BUILD_NUMBER := eng.$(USER).$(shell date +%Y%m%d.%H%M%S)
+ BUILD_NUMBER := eng.$(shell echo $${USER:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
endif
diff --git a/envsetup.sh b/envsetup.sh
index bec6993..61b9ff0 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1,25 +1,27 @@
function hmm() {
cat <<EOF
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
-- lunch: lunch <product_name>-<build_variant>
-- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
-- croot: Changes directory to the top of the tree.
-- m: Makes from the top of the tree.
-- mm: Builds all of the modules in the current directory, but not their dependencies.
-- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
- To limit the modules being built use the syntax: mmm dir/:target1,target2.
-- mma: Builds all of the modules in the current directory, and their dependencies.
-- mmma: Builds all of the modules in the supplied directories, and their dependencies.
-- cgrep: Greps on all local C/C++ files.
-- ggrep: Greps on all local Gradle files.
-- jgrep: Greps on all local Java files.
-- resgrep: Greps on all local res/*.xml files.
-- mangrep: Greps on all local AndroidManifest.xml files.
-- sepgrep: Greps on all local sepolicy files.
-- sgrep: Greps on all local source files.
-- godir: Go to the directory containing a file.
+- lunch: lunch <product_name>-<build_variant>
+- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
+- croot: Changes directory to the top of the tree.
+- m: Makes from the top of the tree.
+- mm: Builds all of the modules in the current directory, but not their dependencies.
+- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
+ To limit the modules being built use the syntax: mmm dir/:target1,target2.
+- mma: Builds all of the modules in the current directory, and their dependencies.
+- mmma: Builds all of the modules in the supplied directories, and their dependencies.
+- provision: Flash device with all required partitions. Options will be passed on to fastboot.
+- cgrep: Greps on all local C/C++ files.
+- ggrep: Greps on all local Gradle files.
+- jgrep: Greps on all local Java files.
+- resgrep: Greps on all local res/*.xml files.
+- mangrep: Greps on all local AndroidManifest.xml files.
+- mgrep: Greps on all local Makefiles files.
+- sepgrep: Greps on all local sepolicy files.
+- sgrep: Greps on all local source files.
+- godir: Go to the directory containing a file.
-Environemnt options:
+Environment options:
- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
ASAN_OPTIONS=detect_leaks=0 will be set by default until the
build is leak-check clean.
@@ -29,7 +31,7 @@
T=$(gettop)
local A
A=""
- for i in `cat $T/build/envsetup.sh | sed -n "/^[ \t]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
+ for i in `cat $T/build/envsetup.sh | sed -n "/^[[:blank:]]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
A="$A $i"
done
echo $A
@@ -160,23 +162,8 @@
export ANDROID_TOOLCHAIN_2ND_ARCH=$gccprebuiltdir/$toolchaindir2
fi
- unset ANDROID_KERNEL_TOOLCHAIN_PATH
- case $ARCH in
- arm)
- # Legacy toolchain configuration used for ARM kernel compilation
- toolchaindir=arm/arm-eabi-$targetgccversion/bin
- if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
- export ARM_EABI_TOOLCHAIN="$gccprebuiltdir/$toolchaindir"
- ANDROID_KERNEL_TOOLCHAIN_PATH="$ARM_EABI_TOOLCHAIN":
- fi
- ;;
- *)
- # No need to set ARM_EABI_TOOLCHAIN for other ARCHs
- ;;
- esac
-
- export ANDROID_DEV_SCRIPTS=$T/development/scripts:$T/prebuilts/devtools/tools
- export ANDROID_BUILD_PATHS=$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_TOOLCHAIN:$ANDROID_TOOLCHAIN_2ND_ARCH:$ANDROID_KERNEL_TOOLCHAIN_PATH$ANDROID_DEV_SCRIPTS:
+ export ANDROID_DEV_SCRIPTS=$T/development/scripts:$T/prebuilts/devtools/tools:$T/external/selinux/prebuilts/bin
+ export ANDROID_BUILD_PATHS=$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_TOOLCHAIN:$ANDROID_TOOLCHAIN_2ND_ARCH:$ANDROID_DEV_SCRIPTS:
# If prebuilts/android-emulator/<system>/ exists, prepend it to our PATH
# to ensure that the corresponding 'emulator' binaries are used.
@@ -197,6 +184,7 @@
fi
export PATH=$ANDROID_BUILD_PATHS$PATH
+ export PYTHONPATH=$T/development/python-packages:$PYTHONPATH
unset ANDROID_JAVA_TOOLCHAIN
unset ANDROID_PRE_BUILD_PATHS
@@ -347,7 +335,7 @@
if [ "x$TARGET_PRODUCT" != x ] ; then
default_value=$TARGET_PRODUCT
else
- default_value=full
+ default_value=aosp_arm
fi
export TARGET_PRODUCT=
@@ -594,10 +582,10 @@
return
fi
- local product=full
+ local product=aosp_arm
case $arch in
- x86) product=full_x86;;
- mips) product=full_mips;;
+ x86) product=aosp_x86;;
+ mips) product=aosp_mips;;
armv5) product=generic_armv5;;
arm64) product=aosp_arm64;;
x86_64) product=aosp_x86_64;;
@@ -764,9 +752,14 @@
MAKEFILE="$MAKEFILE $MFILE"
else
case $DIR in
- showcommands | snod | dist | incrementaljavac) ARGS="$ARGS $DIR";;
+ showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;
GET-INSTALL-PATH) GET_INSTALL_PATH=$DIR;;
- *) echo "No Android.mk in $DIR."; return 1;;
+ *) if [ -d $DIR ]; then
+ echo "No Android.mk in $DIR.";
+ else
+ echo "Couldn't locate the directory $DIR";
+ fi
+ return 1;;
esac
fi
done
@@ -793,7 +786,10 @@
return 1
fi
local MY_PWD=`PWD= /bin/pwd|sed 's:'$T'/::'`
- $DRV make -C $T -f build/core/main.mk $@ all_modules BUILD_MODULES_IN_PATHS="$MY_PWD"
+ local MODULES_IN_PATHS=MODULES-IN-$MY_PWD
+ # Convert "/" to "-".
+ MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
+ $DRV make -C $T -f build/core/main.mk $@ $MODULES_IN_PATHS
fi
}
@@ -811,23 +807,27 @@
MY_PWD=`echo $MY_PWD|sed 's:'$T'/::'`
fi
local DIR=
- local MODULE_PATHS=
+ local MODULES_IN_PATHS=
local ARGS=
for DIR in $DIRS ; do
if [ -d $DIR ]; then
- if [ "$MY_PWD" = "" ]; then
- MODULE_PATHS="$MODULE_PATHS $DIR"
- else
- MODULE_PATHS="$MODULE_PATHS $MY_PWD/$DIR"
+ # Remove the leading ./ and trailing / if any exists.
+ DIR=${DIR#./}
+ DIR=${DIR%/}
+ if [ "$MY_PWD" != "" ]; then
+ DIR=$MY_PWD/$DIR
fi
+ MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR"
else
case $DIR in
- showcommands | snod | dist | incrementaljavac) ARGS="$ARGS $DIR";;
+ showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;
*) echo "Couldn't find directory $DIR"; return 1;;
esac
fi
done
- $DRV make -C $T -f build/core/main.mk $DASH_ARGS $ARGS all_modules BUILD_MODULES_IN_PATHS="$MODULE_PATHS"
+ # Convert "/" to "-".
+ MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
+ $DRV make -C $T -f build/core/main.mk $DASH_ARGS $ARGS $MODULES_IN_PATHS
else
echo "Couldn't locate the top of the tree. Try setting TOP."
return 1
@@ -920,7 +920,7 @@
adb root;
adb wait-for-device;
- echo "Remounting root parition read-write...";
+ echo "Remounting root partition read-write...";
adb shell mount -w -o remount -t rootfs rootfs;
sleep 1;
adb wait-for-device;
@@ -1061,14 +1061,16 @@
Darwin)
function sgrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|S|java|xml|sh|mk|aidl)' -print0 | xargs -0 grep --color -n "$@"
+ find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|S|java|xml|sh|mk|aidl)' \
+ -exec grep --color -n "$@" {} +
}
;;
*)
function sgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|S\|java\|xml\|sh\|mk\|aidl\)' -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|S\|java\|xml\|sh\|mk\|aidl\)' \
+ -exec grep --color -n "$@" {} +
}
;;
esac
@@ -1080,56 +1082,73 @@
function ggrep()
{
- find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.gradle" -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.gradle" \
+ -exec grep --color -n "$@" {} +
}
function jgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.java" \
+ -exec grep --color -n "$@" {} +
}
function cgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \
+ -exec grep --color -n "$@" {} +
}
function resgrep()
{
- for dir in `find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
+ for dir in `find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -name res -type d`; do
+ find $dir -type f -name '*\.xml' -exec grep --color -n "$@" {} +
+ done
}
function mangrep()
{
- find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -name 'AndroidManifest.xml' -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -name 'AndroidManifest.xml' \
+ -exec grep --color -n "$@" {} +
}
function sepgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -name sepolicy -type d -print0 | xargs -0 grep --color -n -r --exclude-dir=\.git "$@"
+ find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -name sepolicy -type d \
+ -exec grep --color -n -r --exclude-dir=\.git "$@" {} +
+}
+
+function rcgrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.rc*" \
+ -exec grep --color -n "$@" {} +
}
case `uname -s` in
Darwin)
function mgrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@"
+ find -E . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' \
+ -exec grep --color -n "$@" {} +
}
function treegrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@"
+ find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml)' \
+ -exec grep --color -n -i "$@" {} +
}
;;
*)
function mgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f \
+ -exec grep --color -n "$@" {} +
}
function treegrep()
{
- find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@"
+ find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f \
+ -exec grep --color -n -i "$@" {} +
}
;;
@@ -1350,14 +1369,20 @@
return
fi
T=$(gettop)
- if [[ ! -f $T/filelist ]]; then
+ if [ ! "$OUT_DIR" = "" ]; then
+ mkdir -p $OUT_DIR
+ FILELIST=$OUT_DIR/filelist
+ else
+ FILELIST=$T/filelist
+ fi
+ if [[ ! -f $FILELIST ]]; then
echo -n "Creating index..."
- (\cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
+ (\cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > $FILELIST)
echo " Done"
echo ""
fi
local lines
- lines=($(\grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq))
+ lines=($(\grep "$1" $FILELIST | sed -e 's/\/[^/]*$//' | sort | uniq))
if [[ ${#lines[@]} = 0 ]]; then
echo "Not found"
return
@@ -1388,11 +1413,7 @@
\cd $T/$pathname
}
-# Force JAVA_HOME to point to java 1.7 if it isn't already set.
-#
-# Note that the MacOS path for java 1.7 includes a minor revision number (sigh).
-# For some reason, installing the JDK doesn't make it show up in the
-# JavaVM.framework/Versions/1.7/ folder.
+# Force JAVA_HOME to point to java 1.7/1.8 if it isn't already set.
function set_java_home() {
# Clear the existing JAVA_HOME value if we set it ourselves, so that
# we can reset it later, depending on the version of java the build
@@ -1405,14 +1426,26 @@
fi
if [ ! "$JAVA_HOME" ]; then
- case `uname -s` in
- Darwin)
- export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
- ;;
- *)
- export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
- ;;
- esac
+ if [ -n "$LEGACY_USE_JAVA7" ]; then
+ echo Warning: Support for JDK 7 will be dropped. Switch to JDK 8.
+ case `uname -s` in
+ Darwin)
+ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
+ ;;
+ *)
+ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
+ ;;
+ esac
+ else
+ case `uname -s` in
+ Darwin)
+ export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
+ ;;
+ *)
+ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+ ;;
+ esac
+ fi
# Keep track of the fact that we set JAVA_HOME ourselves, so that
# we can change it on the next envsetup.sh, if required.
@@ -1426,9 +1459,9 @@
local retval=$?
if [ $retval -ne 0 ]
then
- echo -e "\e[0;31mFAILURE\e[00m"
+ echo $'\E'"[0;31mFAILURE\e[00m"
else
- echo -e "\e[0;32mSUCCESS\e[00m"
+ echo $'\E'"[0;32mSUCCESS\e[00m"
fi
return $retval
}
@@ -1450,9 +1483,9 @@
local secs=$(($tdiff % 60))
local ncolors=$(tput colors 2>/dev/null)
if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then
- color_failed="\e[0;31m"
- color_success="\e[0;32m"
- color_reset="\e[00m"
+ color_failed=$'\E'"[0;31m"
+ color_success=$'\E'"[0;32m"
+ color_reset=$'\E'"[00m"
else
color_failed=""
color_success=""
@@ -1460,9 +1493,9 @@
fi
echo
if [ $ret -eq 0 ] ; then
- echo -n -e "${color_success}#### make completed successfully "
+ echo -n "${color_success}#### make completed successfully "
else
- echo -n -e "${color_failed}#### make failed to build some targets "
+ echo -n "${color_failed}#### make failed to build some targets "
fi
if [ $hours -gt 0 ] ; then
printf "(%02g:%02g:%02g (hh:mm:ss))" $hours $mins $secs
@@ -1471,11 +1504,40 @@
elif [ $secs -gt 0 ] ; then
printf "(%s seconds)" $secs
fi
- echo -e " ####${color_reset}"
+ echo " ####${color_reset}"
echo
return $ret
}
+function provision()
+{
+ if [ ! "$ANDROID_PRODUCT_OUT" ]; then
+ echo "Couldn't locate output files. Try running 'lunch' first." >&2
+ return 1
+ fi
+ if [ ! -e "$ANDROID_PRODUCT_OUT/provision-device" ]; then
+ echo "There is no provisioning script for the device." >&2
+ return 1
+ fi
+
+ # Check if user really wants to do this.
+ if [ "$1" = "--no-confirmation" ]; then
+ shift 1
+ else
+ echo "This action will reflash your device."
+ echo ""
+ echo "ALL DATA ON THE DEVICE WILL BE IRREVOCABLY ERASED."
+ echo ""
+ echo -n "Are you sure you want to do this (yes/no)? "
+ read
+ if [[ "${REPLY}" != "yes" ]] ; then
+ echo "Not taking any action. Exiting." >&2
+ return 1
+ fi
+ fi
+ "$ANDROID_PRODUCT_OUT/provision-device" "$@"
+}
+
if [ "x$SHELL" != "x/bin/bash" ]; then
case `ps -o command -p $$` in
*bash*)
@@ -1488,7 +1550,8 @@
# Execute the contents of any vendorsetup.sh files we can find.
for f in `test -d device && find -L device -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \
- `test -d vendor && find -L vendor -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort`
+ `test -d vendor && find -L vendor -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \
+ `test -d product && find -L product -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort`
do
echo "including $f"
. $f
diff --git a/libs/host/Android.mk b/libs/host/Android.mk
index cab878b..bc25e4b 100644
--- a/libs/host/Android.mk
+++ b/libs/host/Android.mk
@@ -1,28 +1,21 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_SRC_FILES:= \
CopyFile.c
-ifeq ($(HOST_OS),cygwin)
-LOCAL_CFLAGS += -DWIN32_EXE
-endif
-ifeq ($(HOST_OS),darwin)
-LOCAL_CFLAGS += -DMACOSX_RSRC
-endif
-ifeq ($(HOST_OS),linux)
-endif
+LOCAL_CFLAGS := -Werror -Wall
LOCAL_MODULE:= libhost
+LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_CXX_STL := none
# acp uses libhost, so we can't use
# acp to install libhost.
LOCAL_ACP_UNAVAILABLE:= true
-LOCAL_ADDRESS_SANITIZER := false
-
include $(BUILD_HOST_STATIC_LIBRARY)
# Include toolchain prebuilt modules if they exist.
diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c
index 855a565..5be012c 100644
--- a/libs/host/CopyFile.c
+++ b/libs/host/CopyFile.c
@@ -24,11 +24,9 @@
#include <errno.h>
#include <assert.h>
-#ifdef HAVE_MS_C_RUNTIME
-# define mkdir(path,mode) _mkdir(path)
-#endif
-
#if defined(_WIN32)
+#include <direct.h> /* For _mkdir() */
+# define mkdir(path,mode) _mkdir(path)
# define S_ISLNK(s) 0
# define lstat stat
# ifndef EACCESS /* seems to be missing from the Mingw headers */
@@ -69,9 +67,9 @@
*/
static bool isHiresMtime(const struct stat* pSrcStat)
{
-#if defined(__CYGWIN__) || defined(__MINGW32__)
- return 0;
-#elif defined(MACOSX_RSRC)
+#if defined(_WIN32)
+ return 0;
+#elif defined(__APPLE__)
return pSrcStat->st_mtimespec.tv_nsec > 0;
#else
return pSrcStat->st_mtim.tv_nsec > 0;
@@ -85,7 +83,9 @@
*/
static bool isSameFile(const struct stat* pSrcStat, const struct stat* pDstStat)
{
-#ifndef HAVE_VALID_STAT_ST_INO
+#if defined(_WIN32)
+ (void)pSrcStat;
+ (void)pDstStat;
/* with MSVCRT.DLL, stat always sets st_ino to 0, and there is no simple way to */
/* get the equivalent information with Win32 (Cygwin does some weird stuff in */
/* its winsup/cygwin/fhandler_disk_file.cc to emulate this, too complex for us) */
@@ -103,6 +103,7 @@
static void printNotNewerMsg(const char* src, const char* dst, unsigned int options)
{
+ (void)src;
if ((options & COPY_VERBOSE_MASK) > 1)
printf(" '%s' is up-to-date\n", dst);
}
@@ -183,7 +184,7 @@
DBUG(("--- unable to set perms on '%s' to 0%o: %s\n",
dst, pSrcStat->st_mode & ~(S_IFMT), strerror(errno)));
}
-#ifndef HAVE_MS_C_RUNTIME
+#ifndef _WIN32
/*
* Set the owner.
*/
@@ -261,7 +262,7 @@
/* if "force" is set, try removing the destination file and retry */
if (options & COPY_FORCE) {
if (unlink(dst) != 0) {
-#ifdef HAVE_MS_C_RUNTIME
+#ifdef _WIN32
/* MSVCRT.DLL unlink will fail with EACCESS if the file is set read-only */
/* so try to change its mode, and unlink again */
if (errno == EACCESS) {
@@ -274,7 +275,7 @@
(void) close(srcFd);
return -1;
}
-#ifdef HAVE_MS_C_RUNTIME
+#ifdef _WIN32
Open_File:
#endif
dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
@@ -294,7 +295,8 @@
if (copyResult != 0)
return -1;
-#ifdef MACOSX_RSRC
+#if defined(__APPLE__)
+ // Copy Mac OS X resource forks too.
{
char* srcRsrcName = NULL;
char* dstRsrcName = NULL;
@@ -536,6 +538,7 @@
struct stat srcStat;
int retVal = 0;
int statResult, statErrno;
+ (void)isCmdLine;
/*
* Stat the source file. If it doesn't exist, fail.
@@ -546,57 +549,6 @@
statResult = stat(src, &srcStat);
statErrno = errno; /* preserve across .exe attempt */
-#ifdef WIN32_EXE
- /*
- * Here's the interesting part. Under Cygwin, if you have a file
- * called "foo.exe", stat("foo", ...) will succeed, but open("foo", ...)
- * will fail. We need to figure out what its name is supposed to be
- * so we can create the correct destination file.
- *
- * If we don't have the "-e" flag set, we want "acp foo bar" to fail,
- * not automatically find "foo.exe". That way, if we really were
- * trying to copy "foo", it doesn't grab something we don't want.
- */
- if (isCmdLine && statResult == 0) {
- int tmpFd;
- tmpFd = open(src, O_RDONLY | O_BINARY, 0);
- if (tmpFd < 0) {
- statResult = -1;
- statErrno = ENOENT;
- } else {
- (void) close(tmpFd);
- }
- }
-
- /*
- * If we didn't find the file, try it again with ".exe".
- */
- if (isCmdLine && statResult < 0 && statErrno == ENOENT && (options & COPY_TRY_EXE)) {
- srcExe = malloc(strlen(src) + 4 +1);
- strcpy(srcExe, src);
- strcat(srcExe, ".exe");
-
- if (options & COPY_NO_DEREFERENCE)
- statResult = lstat(srcExe, &srcStat);
- else
- statResult = stat(srcExe, &srcStat);
-
- if (statResult == 0 && !S_ISREG(srcStat.st_mode))
- statResult = -1; /* fail, use original statErrno below */
-
- if (statResult == 0) {
- /* found a .exe, copy that instead */
- dstExe = malloc(strlen(dst) + 4 +1);
- strcpy(dstExe, dst);
- strcat(dstExe, ".exe");
-
- src = srcExe;
- dst = dstExe;
- } else {
- DBUG(("--- couldn't find '%s' either\n", srcExe));
- }
- }
-#endif
if (statResult < 0) {
if (statErrno == ENOENT)
fprintf(stderr, "acp: file '%s' does not exist\n", src);
diff --git a/libs/host/include/host/Directories.h b/libs/host/include/host/Directories.h
deleted file mode 100644
index fccce46..0000000
--- a/libs/host/include/host/Directories.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef HOST_MKDIRS_H
-#define HOST_MKDIRS_H
-
-#include <string>
-
-std::string parent_dir(const std::string& path);
-
-extern "C" int mkdirs(const char* path);
-
-#endif // HOST_MKDIRS_H
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 393492b..b1cefca 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -68,7 +68,7 @@
VSYNC_EVENT_PHASE_OFFSET_NS := 0
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
@@ -81,3 +81,5 @@
# include an expanded selection of fonts for the SDK.
EXTENDED_FONT_FOOTPRINT := true
endif
+
+USE_CLANG_PLATFORM_BUILD := true
diff --git a/target/board/generic/sepolicy/domain.te b/target/board/generic/sepolicy/domain.te
index c28ca74..201fa86 100644
--- a/target/board/generic/sepolicy/domain.te
+++ b/target/board/generic/sepolicy/domain.te
@@ -1,3 +1,5 @@
# For /sys/qemu_trace files in the emulator.
allow domain sysfs_writable:file rw_file_perms;
allow domain qemu_device:chr_file rw_file_perms;
+
+get_prop(domain, qemu_prop)
diff --git a/target/board/generic/sepolicy/file_contexts b/target/board/generic/sepolicy/file_contexts
index 444a47f..e704a8e 100644
--- a/target/board/generic/sepolicy/file_contexts
+++ b/target/board/generic/sepolicy/file_contexts
@@ -1,9 +1,12 @@
-/dev/block/mtdblock0 u:object_r:system_block_device:s0
-/dev/block/mtdblock1 u:object_r:userdata_block_device:s0
-/dev/block/mtdblock2 u:object_r:cache_block_device:s0
-/dev/qemu_.* u:object_r:qemu_device:s0
-/dev/socket/qemud u:object_r:qemud_socket:s0
-/system/bin/qemud u:object_r:qemud_exec:s0
-/sys/qemu_trace(/.*)? -- u:object_r:sysfs_writable:s0
+/dev/block/mtdblock0 u:object_r:system_block_device:s0
+/dev/block/mtdblock1 u:object_r:userdata_block_device:s0
+/dev/block/mtdblock2 u:object_r:cache_block_device:s0
+/dev/goldfish_pipe u:object_r:qemu_device:s0
+/dev/qemu_.* u:object_r:qemu_device:s0
+/dev/socket/qemud u:object_r:qemud_socket:s0
+/dev/ttyGF[0-9]* u:object_r:serial_device:s0
+/dev/ttyS2 u:object_r:console_device:s0
+/system/bin/qemud u:object_r:qemud_exec:s0
+/sys/qemu_trace(/.*)? u:object_r:sysfs_writable:s0
/system/etc/init.goldfish.sh u:object_r:goldfish_setup_exec:s0
-/system/bin/qemu-props u:object_r:qemu_props_exec:s0
+/system/bin/qemu-props u:object_r:qemu_props_exec:s0
diff --git a/target/board/generic/sepolicy/goldfish_logcat.te b/target/board/generic/sepolicy/goldfish_logcat.te
deleted file mode 100644
index a785355..0000000
--- a/target/board/generic/sepolicy/goldfish_logcat.te
+++ /dev/null
@@ -1,10 +0,0 @@
-# goldfish-logcat service: runs logcat -Q
-type goldfish_logcat, domain;
-
-domain_auto_trans(init, logcat_exec, goldfish_logcat)
-
-# Read from logd.
-read_logd(goldfish_logcat)
-
-# Write to /dev/ttyS2
-allow goldfish_logcat serial_device:chr_file { write open };
diff --git a/target/board/generic/sepolicy/goldfish_setup.te b/target/board/generic/sepolicy/goldfish_setup.te
index 584731e..bce196a 100644
--- a/target/board/generic/sepolicy/goldfish_setup.te
+++ b/target/board/generic/sepolicy/goldfish_setup.te
@@ -1,5 +1,5 @@
# goldfish-setup service: runs init.goldfish.sh script
-type goldfish_setup, domain;
+type goldfish_setup, domain, domain_deprecated;
type goldfish_setup_exec, exec_type, file_type;
init_daemon_domain(goldfish_setup)
@@ -9,10 +9,19 @@
# Run ifconfig, route commands to configure interfaces and routes.
allow goldfish_setup system_file:file execute_no_trans;
+allow goldfish_setup toolbox_exec:file rx_file_perms;
allow goldfish_setup self:capability { net_admin net_raw };
allow goldfish_setup self:udp_socket create_socket_perms;
+net_domain(goldfish_setup)
+
# Set net.eth0.dns*, debug.sf.nobootanimation
-unix_socket_connect(goldfish_setup, property, init)
-allow goldfish_setup system_prop:property_service set;
-allow goldfish_setup debug_prop:property_service set;
+set_prop(goldfish_setup, system_prop)
+set_prop(goldfish_setup, debug_prop)
+
+# Set ro.radio.noril
+set_prop(goldfish_setup, radio_noril_prop)
+
+# Stop ril-daemon service (by setting ctl.stop to ril-daemon, which
+# transforms to a permission check on ctl.ril-daemon).
+set_prop(goldfish_setup, ctl_rildaemon_prop)
diff --git a/target/board/generic/sepolicy/init.te b/target/board/generic/sepolicy/init.te
new file mode 100644
index 0000000..3aa81d1
--- /dev/null
+++ b/target/board/generic/sepolicy/init.te
@@ -0,0 +1 @@
+allow init tmpfs:lnk_file create_file_perms;
diff --git a/target/board/generic/sepolicy/logd.te b/target/board/generic/sepolicy/logd.te
new file mode 100644
index 0000000..b3e60d7
--- /dev/null
+++ b/target/board/generic/sepolicy/logd.te
@@ -0,0 +1,11 @@
+# goldfish logcat service: runs logcat -Q in logd domain
+
+# See global logd.te, these only set for eng & userdebug, allow for all builds
+
+domain_auto_trans(init, logcat_exec, logd)
+
+# Read from logd.
+read_logd(logd)
+
+# Write to /dev/ttyS2 and /dev/ttyGF2.
+allow logd serial_device:chr_file { write open };
diff --git a/target/board/generic/sepolicy/netd.te b/target/board/generic/sepolicy/netd.te
new file mode 100644
index 0000000..2b002ec
--- /dev/null
+++ b/target/board/generic/sepolicy/netd.te
@@ -0,0 +1 @@
+dontaudit netd self:capability sys_module;
diff --git a/target/board/generic/sepolicy/property.te b/target/board/generic/sepolicy/property.te
index b3d15f8..22d580a 100644
--- a/target/board/generic/sepolicy/property.te
+++ b/target/board/generic/sepolicy/property.te
@@ -1 +1,3 @@
type qemu_prop, property_type;
+type radio_noril_prop, property_type;
+type opengles_prop, property_type;
diff --git a/target/board/generic/sepolicy/property_contexts b/target/board/generic/sepolicy/property_contexts
index 5f741f8..142b062 100644
--- a/target/board/generic/sepolicy/property_contexts
+++ b/target/board/generic/sepolicy/property_contexts
@@ -1 +1,5 @@
qemu. u:object_r:qemu_prop:s0
+ro.emu. u:object_r:qemu_prop:s0
+ro.emulator. u:object_r:qemu_prop:s0
+ro.radio.noril u:object_r:radio_noril_prop:s0
+ro.opengles. u:object_r:opengles_prop:s0
diff --git a/target/board/generic/sepolicy/qemu_props.te b/target/board/generic/sepolicy/qemu_props.te
index 05c7461..6768ce7 100644
--- a/target/board/generic/sepolicy/qemu_props.te
+++ b/target/board/generic/sepolicy/qemu_props.te
@@ -1,9 +1,11 @@
# qemu-props service: Sets system properties on boot.
-type qemu_props, domain;
+type qemu_props, domain, domain_deprecated;
type qemu_props_exec, exec_type, file_type;
init_daemon_domain(qemu_props)
# Set properties.
-unix_socket_connect(qemu_props, property, init)
-allow qemu_props { qemu_prop dalvik_prop config_prop }:property_service set;
+set_prop(qemu_props, qemu_prop)
+set_prop(qemu_props, dalvik_prop)
+set_prop(qemu_props, config_prop)
+set_prop(qemu_props, opengles_prop)
diff --git a/target/board/generic/sepolicy/qemud.te b/target/board/generic/sepolicy/qemud.te
index 41f2065..797cf5c 100644
--- a/target/board/generic/sepolicy/qemud.te
+++ b/target/board/generic/sepolicy/qemud.te
@@ -1,8 +1,8 @@
# qemu support daemon
-type qemud, domain;
+type qemud, domain, domain_deprecated;
type qemud_exec, exec_type, file_type;
init_daemon_domain(qemud)
-# Access /dev/ttyS1.
+# Access /dev/ttyS1 and /dev/ttyGF1.
allow qemud serial_device:chr_file rw_file_perms;
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 4b6136d..40dd184 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -76,7 +76,7 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1073741824
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
@@ -84,3 +84,5 @@
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+
+USE_CLANG_PLATFORM_BUILD := true
diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk
index 13d1c9f..50924f8 100644
--- a/target/board/generic_mips/BoardConfig.mk
+++ b/target/board/generic_mips/BoardConfig.mk
@@ -53,11 +53,13 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1073741824
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1342177280
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 734003200
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+
+USE_CLANG_PLATFORM_BUILD := true
diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk
index 8e8a68b..d5430cd 100644
--- a/target/board/generic_mips64/BoardConfig.mk
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -75,3 +75,5 @@
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
DEX_PREOPT_DEFAULT := nostripping
+
+USE_CLANG_PLATFORM_BUILD := true
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index d5f0531..44772eb 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -18,9 +18,6 @@
# no hardware camera
USE_CAMERA_STUB := true
-# customize the malloced address to be 16-byte aligned
-BOARD_MALLOC_ALIGNMENT := 16
-
# Enable dex-preoptimization to speed up the first boot sequence
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
@@ -35,7 +32,7 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1342177280 # 1.25 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
@@ -45,3 +42,5 @@
BOARD_SEPOLICY_DIRS += \
build/target/board/generic/sepolicy \
build/target/board/generic_x86/sepolicy
+
+USE_CLANG_PLATFORM_BUILD := true
diff --git a/target/board/generic_x86/sepolicy/init.te b/target/board/generic_x86/sepolicy/init.te
new file mode 100644
index 0000000..3aa81d1
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/init.te
@@ -0,0 +1 @@
+allow init tmpfs:lnk_file create_file_perms;
diff --git a/target/board/generic_x86/sepolicy/system_server.te b/target/board/generic_x86/sepolicy/system_server.te
deleted file mode 100644
index 5d98a14..0000000
--- a/target/board/generic_x86/sepolicy/system_server.te
+++ /dev/null
@@ -1 +0,0 @@
-allow system_server self:process execmem;
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index 62753a2..cbfda6b 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -24,9 +24,6 @@
# no hardware camera
USE_CAMERA_STUB := true
-# customize the malloced address to be 16-byte aligned
-BOARD_MALLOC_ALIGNMENT := 16
-
# Enable dex-preoptimization to speed up the first boot sequence
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
@@ -41,7 +38,7 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1073741824 # 1GB
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1342177280 # 1.25 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
@@ -51,3 +48,5 @@
BOARD_SEPOLICY_DIRS += \
build/target/board/generic/sepolicy \
build/target/board/generic_x86/sepolicy
+
+USE_CLANG_PLATFORM_BUILD := true
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index ac5902c..69edc72 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -59,7 +59,6 @@
$(LOCAL_DIR)/aosp_arm64.mk \
$(LOCAL_DIR)/aosp_mips64.mk \
$(LOCAL_DIR)/aosp_x86_64.mk \
- $(LOCAL_DIR)/full_x86_64.mk \
$(LOCAL_DIR)/sdk_phone_armv7.mk \
$(LOCAL_DIR)/sdk_phone_x86.mk \
$(LOCAL_DIR)/sdk_phone_mips.mk \
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index 86b715c..781cae6 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-$(call inherit-product, $(SRC_TARGET_DIR)/product/full.mk)
+include $(SRC_TARGET_DIR)/product/full.mk
PRODUCT_NAME := aosp_arm
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index ea8ec06..6232295 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -19,6 +19,12 @@
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
+# This is for enabling ethernet support for ranchu.
+# Consider removing this after RIL support is provided in ranchu.
+# Having this permission file on the target requires additional
+# dhcpcd_eth0 service defined in the init.ranchu.rc.
+PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
diff --git a/target/product/aosp_base_telephony.mk b/target/product/aosp_base_telephony.mk
index f326a00..0d4e333 100644
--- a/target/product/aosp_base_telephony.mk
+++ b/target/product/aosp_base_telephony.mk
@@ -14,3 +14,6 @@
# limitations under the License.
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
+
+PRODUCT_PACKAGES += \
+ messaging
diff --git a/target/product/aosp_mips.mk b/target/product/aosp_mips.mk
index ceeb433..a76b93a 100644
--- a/target/product/aosp_mips.mk
+++ b/target/product/aosp_mips.mk
@@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-$(call inherit-product, $(SRC_TARGET_DIR)/product/full_mips.mk)
+include $(SRC_TARGET_DIR)/product/full_mips.mk
PRODUCT_NAME := aosp_mips
diff --git a/target/product/aosp_mips64.mk b/target/product/aosp_mips64.mk
index 3a6026c..d485677 100644
--- a/target/product/aosp_mips64.mk
+++ b/target/product/aosp_mips64.mk
@@ -13,6 +13,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-$(call inherit-product, $(SRC_TARGET_DIR)/product/full_mips64.mk)
+# 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
+# mips64 build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+# This is for enabling ethernet support for ranchu.
+# Consider removing this after RIL support is provided in ranchu.
+# Having this permission file on the target requires additional
+# dhcpcd_eth0 service defined in the init.ranchu.rc.
+PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_mips64/device.mk)
+
+include $(SRC_TARGET_DIR)/product/emulator.mk
+
+# Overrides
PRODUCT_NAME := aosp_mips64
+PRODUCT_DEVICE := generic_mips64
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on MIPS64 Emulator
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index 3e9b018..cba43c4 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-$(call inherit-product, $(SRC_TARGET_DIR)/product/full_x86.mk)
+include $(SRC_TARGET_DIR)/product/full_x86.mk
PRODUCT_NAME := aosp_x86
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index 5a12c08..6c01e5a 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -13,6 +13,39 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-$(call inherit-product, $(SRC_TARGET_DIR)/product/full_x86_64.mk)
+# 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.
+
+# If running on an emulator or some other device that has a LAN connection
+# that isn't a wifi connection. This will instruct init.rc to enable the
+# network connection so that you can use it with ADB
+
+# This is for enabling ethernet support for ranchu.
+# Consider removing this after RIL support is provided in ranchu.
+# Having this permission file on the target requires additional
+# dhcpcd_eth0 service defined in the init.ranchu.rc.
+PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+
+include $(SRC_TARGET_DIR)/product/emulator.mk
+
+ifdef NET_ETH0_STARTONBOOT
+ PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
+endif
+
+# Ensure we package the BIOS files too.
+PRODUCT_PACKAGES += \
+ bios.bin \
+ vgabios-cirrus.bin \
+
+# Overrides
PRODUCT_NAME := aosp_x86_64
+PRODUCT_DEVICE := generic_x86_64
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on IA x86_64 Emulator
diff --git a/target/product/base.mk b/target/product/base.mk
index 85c01a2..4c49e86 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -18,6 +18,7 @@
PRODUCT_PACKAGES += \
20-dns.conf \
95-configured \
+ org.apache.http.legacy.boot \
appwidget \
appops \
am \
@@ -35,6 +36,7 @@
dpm \
framework \
fsck_msdos \
+ hid \
ime \
input \
javax.obex \
@@ -65,12 +67,16 @@
libnetlink \
libnetutils \
libpdfium \
+ libradio \
+ libradioservice \
+ libradio_metadata \
libreference-ril \
libreverbwrapper \
libril \
librtp_jni \
libsensorservice \
libskia \
+ libsonic \
libsonivox \
libsoundpool \
libsoundtrigger \
@@ -105,10 +111,14 @@
run-as \
schedtest \
sdcard \
+ secdiscard \
services \
settings \
+ sgdisk \
+ sm \
svc \
tc \
+ telecom \
vdc \
vold \
wm
diff --git a/target/product/core.mk b/target/product/core.mk
index 519dbb8..2992dbd 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -22,8 +22,8 @@
PRODUCT_PACKAGES += \
BasicDreams \
- Browser \
- Calculator \
+ BookmarkProvider \
+ Browser2 \
Calendar \
CalendarProvider \
CaptivePortalLogin \
@@ -33,6 +33,7 @@
DocumentsUI \
DownloadProviderUi \
Email \
+ ExactCalculator \
Exchange2 \
ExternalStorageProvider \
FusedLocation \
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 33b49a6..c39ab2c 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -30,6 +30,7 @@
PackageInstaller \
SettingsProvider \
Shell \
+ StatementService \
bcc \
bu \
com.android.future.usb.accessory \
@@ -49,6 +50,7 @@
ip-up-vpn \
ip6tables \
iptables \
+ gatekeeperd \
keystore \
keystore.default \
ld.mc \
@@ -60,13 +62,12 @@
libdrmframework_jni \
libfilterfw \
libkeystore \
- libsqlite_jni \
+ libgatekeeper \
libwilhelm \
logd \
make_ext4fs \
e2fsck \
resize2fs \
- mms-common \
screencap \
sensorservice \
telephony-common \
@@ -81,6 +82,7 @@
# The order of PRODUCT_BOOT_JARS matters.
PRODUCT_BOOT_JARS := \
+ core-oj \
core-libart \
conscrypt \
okhttp \
@@ -91,9 +93,8 @@
telephony-common \
voip-common \
ims-common \
- mms-common \
- android.policy \
apache-xml \
+ org.apache.http.legacy.boot
# The order of PRODUCT_SYSTEM_SERVER_JARS matters.
PRODUCT_SYSTEM_SERVER_JARS := \
@@ -101,6 +102,13 @@
ethernet-service \
wifi-service
+# Adoptable external storage supports both ext4 and f2fs
+PRODUCT_PACKAGES += \
+ e2fsck \
+ make_ext4fs \
+ fsck.f2fs \
+ make_f2fs \
+
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
ro.zygote=zygote32
PRODUCT_COPY_FILES += \
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
index 39789d9..3e3220b 100644
--- a/target/product/core_tiny.mk
+++ b/target/product/core_tiny.mk
@@ -36,9 +36,6 @@
power.default
PRODUCT_PACKAGES += \
- local_time.default
-
-PRODUCT_PACKAGES += \
BackupRestoreConfirmation \
DefaultContainerService \
SettingsProvider \
@@ -54,14 +51,16 @@
ip-up-vpn \
ip6tables \
iptables \
+ gatekeeperd \
keystore \
keystore.default \
+ ld.mc \
libOpenMAXAL \
libOpenSLES \
libdownmix \
libfilterfw \
+ libgatekeeper \
libkeystore \
- libsqlite_jni \
libwilhelm \
libdrmframework_jni \
libdrmframework \
@@ -76,11 +75,11 @@
telephony-common \
voip-common \
logd \
- mms-common \
wifi-service
# The order matters
PRODUCT_BOOT_JARS := \
+ core-oj \
core-libart \
conscrypt \
okhttp \
@@ -91,10 +90,9 @@
telephony-common \
voip-common \
ims-common \
- mms-common \
- android.policy \
apache-xml \
nullwebview \
+ org.apache.http.legacy.boot
# The order of PRODUCT_SYSTEM_SERVER_JARS matters.
PRODUCT_SYSTEM_SERVER_JARS := \
@@ -112,6 +110,7 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
+$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
# Overrides
PRODUCT_BRAND := tiny
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index f0d74df..71456dc 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -22,6 +22,7 @@
adbd \
atrace \
bootanimation \
+ bootstat \
debuggerd \
dumpstate \
dumpsys \
@@ -38,8 +39,10 @@
libFFTEm \
libGLESv1_CM \
libGLESv2 \
+ libGLESv3 \
libbinder \
libc \
+ libc_malloc_debug \
libcutils \
libdl \
libgui \
@@ -70,11 +73,12 @@
surfaceflinger \
toolbox \
toybox \
+ tzdatacheck \
# SELinux packages
PRODUCT_PACKAGES += \
sepolicy \
- file_contexts \
+ file_contexts.bin \
seapp_contexts \
property_contexts \
mac_permissions.xml \
@@ -88,6 +92,6 @@
PRODUCT_COPY_FILES += \
system/core/rootdir/init.usb.rc:root/init.usb.rc \
- system/core/rootdir/init.trace.rc:root/init.trace.rc \
+ system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \
system/core/rootdir/ueventd.rc:root/ueventd.rc \
system/core/rootdir/etc/hosts:system/etc/hosts
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index 3a8a4aa..acc7a98 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -26,6 +26,7 @@
PRODUCT_PACKAGES += \
egl.cfg \
gralloc.goldfish \
+ gralloc.ranchu \
libGLESv1_CM_emulation \
lib_renderControl_enc \
libEGL_emulation \
@@ -40,15 +41,17 @@
camera.goldfish.jpeg \
lights.goldfish \
gps.goldfish \
+ fingerprint.goldfish \
sensors.goldfish \
- e2fsck \
audio.primary.goldfish \
vibrator.goldfish \
power.goldfish \
+ fingerprint.ranchu \
+ fingerprintd \
sensors.ranchu
-
PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml \
device/generic/goldfish/fstab.goldfish:root/fstab.goldfish \
device/generic/goldfish/init.goldfish.rc:root/init.goldfish.rc \
device/generic/goldfish/init.goldfish.sh:system/etc/init.goldfish.sh \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index d8dad79..65bdf0f 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -35,7 +35,6 @@
MagicSmokeWallpapers \
NoiseField \
PhaseBeam \
- VisualizationWallpapers \
PhotoTable
# Additional settings used in all AOSP builds
@@ -46,9 +45,6 @@
# Put en_US first in the list, so make it default.
PRODUCT_LOCALES := en_US
-# Include drawables for all densities
-PRODUCT_AAPT_CONFIG := normal
-
# Get some sounds
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
diff --git a/target/product/full_mips64.mk b/target/product/full_mips64.mk
deleted file mode 100644
index e813e41..0000000
--- a/target/product/full_mips64.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2013 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
-# mips64 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/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_mips64/device.mk)
-
-include $(SRC_TARGET_DIR)/product/emulator.mk
-
-# Overrides
-PRODUCT_NAME := full_mips64
-PRODUCT_DEVICE := generic_mips64
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on MIPS64 Emulator
diff --git a/target/product/full_x86_64.mk b/target/product/full_x86_64.mk
deleted file mode 100755
index 051a86e..0000000
--- a/target/product/full_x86_64.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# 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.
-
-# If running on an emulator or some other device that has a LAN connection
-# that isn't a wifi connection. This will instruct init.rc to enable the
-# network connection so that you can use it with ADB
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
-
-include $(SRC_TARGET_DIR)/product/emulator.mk
-
-ifdef NET_ETH0_STARTONBOOT
- PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
-endif
-
-# Ensure we package the BIOS files too.
-PRODUCT_PACKAGES += \
- bios.bin \
- vgabios-cirrus.bin \
-
-# Overrides
-PRODUCT_NAME := full_x86_64
-PRODUCT_DEVICE := generic_x86_64
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on IA x86_64 Emulator
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index dd18fab..f6ccd2a 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -19,6 +19,7 @@
PRODUCT_PACKAGES := \
Bluetooth \
+ BluetoothMidiService \
Camera2 \
Gallery2 \
Music \
@@ -60,9 +61,10 @@
$(call inherit-product-if-exists, external/google-fonts/carrois-gothic-sc/fonts.mk)
$(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
$(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk)
-$(call inherit-product-if-exists, external/lohit-fonts/fonts.mk)
$(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
$(call inherit-product-if-exists, external/naver-fonts/fonts.mk)
+$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
+$(call inherit-product-if-exists, external/hyphenation-patterns/patterns.mk)
$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
diff --git a/target/product/languages_full.mk b/target/product/languages_full.mk
index 6d77cde..9d80b0e 100644
--- a/target/product/languages_full.mk
+++ b/target/product/languages_full.mk
@@ -21,4 +21,4 @@
# These are all the locales that have translations and are displayable
# by TextView in this branch.
-PRODUCT_LOCALES := en_US en_AU en_IN fr_FR it_IT es_ES et_EE de_DE nl_NL cs_CZ pl_PL ja_JP zh_TW zh_CN zh_HK ru_RU ko_KR nb_NO es_US da_DK el_GR tr_TR pt_PT pt_BR rm_CH sv_SE bg_BG ca_ES en_GB fi_FI hi_IN hr_HR hu_HU in_ID iw_IL lt_LT lv_LV ro_RO sk_SK sl_SI sr_RS uk_UA vi_VN tl_PH ar_EG fa_IR th_TH sw_TZ ms_MY af_ZA zu_ZA am_ET hi_IN en_XA ar_XB fr_CA km_KH lo_LA ne_NP si_LK mn_MN hy_AM az_AZ ka_GE my_MM mr_IN ml_IN is_IS mk_MK ky_KG eu_ES gl_ES bn_BD ta_IN kn_IN te_IN uz_UZ ur_PK kk_KZ
+PRODUCT_LOCALES := en_US en_AU en_IN fr_FR it_IT es_ES et_EE de_DE nl_NL cs_CZ pl_PL ja_JP zh_TW zh_CN zh_HK ru_RU ko_KR nb_NO es_US da_DK el_GR tr_TR pt_PT pt_BR rm_CH sv_SE bg_BG ca_ES en_GB fi_FI hi_IN hr_HR hu_HU in_ID iw_IL lt_LT lv_LV ro_RO sk_SK sl_SI sr_RS uk_UA vi_VN tl_PH ar_EG fa_IR th_TH sw_TZ ms_MY af_ZA zu_ZA am_ET hi_IN en_XA ar_XB fr_CA km_KH lo_LA ne_NP si_LK mn_MN hy_AM az_AZ ka_GE my_MM mr_IN ml_IN is_IS mk_MK ky_KG eu_ES gl_ES bn_BD ta_IN kn_IN te_IN uz_UZ ur_PK kk_KZ sq_AL gu_IN pa_IN
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index a35122b..94efe52 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -18,9 +18,11 @@
PRODUCT_PACKAGES += \
apache-xml \
+ ahat \
bouncycastle \
cacerts \
conscrypt \
+ core-oj \
core-junit \
core-libart \
dalvikvm \
@@ -38,6 +40,8 @@
libicui18n \
libicuuc \
libjavacore \
+ libopenjdk \
+ libopenjdkjvm \
libnativehelper \
libssl \
libz \
diff --git a/target/product/sdk_base.mk b/target/product/sdk_base.mk
index 451c0b7..73c2524 100644
--- a/target/product/sdk_base.mk
+++ b/target/product/sdk_base.mk
@@ -27,6 +27,7 @@
Fallback \
Gallery \
GestureBuilder \
+ Launcher3 \
LegacyCamera \
librs_jni \
libwnndict \
@@ -62,7 +63,7 @@
device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
frameworks/base/data/sounds/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
frameworks/base/data/sounds/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
- frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
+ device/generic/goldfish/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:system/etc/media_codecs_google_audio.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:system/etc/media_codecs_google_telephony.xml \
@@ -83,6 +84,7 @@
$(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk)
$(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
$(call inherit-product-if-exists, external/naver-fonts/fonts.mk)
+$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
diff --git a/target/product/telephony.mk b/target/product/telephony.mk
index da1497d..919d024 100644
--- a/target/product/telephony.mk
+++ b/target/product/telephony.mk
@@ -18,8 +18,9 @@
# to products that have telephony hardware.
PRODUCT_PACKAGES := \
+ CarrierConfig \
Dialer \
- Mms \
+ CallLogBackup \
rild
PRODUCT_COPY_FILES := \
diff --git a/target/product/vboot.mk b/target/product/vboot.mk
new file mode 100644
index 0000000..48a4883
--- /dev/null
+++ b/target/product/vboot.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2015 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.
+#
+
+# Provides dependencies necessary for verified boot
+
+PRODUCT_SUPPORTS_VBOOT := true
+
+# The dev key is used to sign boot and recovery images.
+# We expect this file to exist with the suffixes ".vbprivk" and ".vbpupk".
+# TODO: find a proper location for this
+PRODUCT_VBOOT_SIGNING_KEY := external/vboot_reference/tests/devkeys/kernel_data_key
+PRODUCT_VBOOT_SIGNING_SUBKEY := external/vboot_reference/tests/devkeys/kernel_subkey
diff --git a/target/product/verity.mk b/target/product/verity.mk
index 0361b64..0badb9f 100644
--- a/target/product/verity.mk
+++ b/target/product/verity.mk
@@ -14,14 +14,20 @@
# limitations under the License.
#
-# Provides dependencies necessary for verified boot
+# Provides dependencies necessary for verified boot (only for user and
+# userdebug builds)
-PRODUCT_SUPPORTS_VERITY := true
+user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
+ifneq (,$(user_variant))
+ PRODUCT_SUPPORTS_BOOT_SIGNER := true
+ PRODUCT_SUPPORTS_VERITY := true
+ PRODUCT_SUPPORTS_VERITY_FEC := true
-# The dev key is used to sign boot and recovery images, and the verity
-# metadata table. Actual product deliverables will be re-signed by hand.
-# We expect this file to exist with the suffixes ".x509.pem" and ".pk8".
-PRODUCT_VERITY_SIGNING_KEY := build/target/product/security/verity
+ # The dev key is used to sign boot and recovery images, and the verity
+ # metadata table. Actual product deliverables will be re-signed by hand.
+ # We expect this file to exist with the suffixes ".x509.pem" and ".pk8".
+ PRODUCT_VERITY_SIGNING_KEY := build/target/product/security/verity
-PRODUCT_PACKAGES += \
- verity_key
+ PRODUCT_PACKAGES += \
+ verity_key
+endif
diff --git a/tools/Android.mk b/tools/Android.mk
index 30febd6..9073ac3 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -16,17 +16,4 @@
LOCAL_PATH := $(call my-dir)
-ifeq (,$(TARGET_BUILD_APPS))
-
-ifeq ($(TARGET_BUILD_PDK),true)
-include $(filter-out %/acp/Android.mk %/signapk/Android.mk %/zipalign/Android.mk,\
- $(call all-makefiles-under,$(LOCAL_PATH)))
-else # !PDK
include $(call all-makefiles-under,$(LOCAL_PATH))
-endif # PDK
-
-else # TARGET_BUILD_APPS
-
-include $(LOCAL_PATH)/apicheck/Android.mk
-
-endif
diff --git a/tools/acp/Android.mk b/tools/acp/Android.mk
index 2b41bc1..eec9c9d 100644
--- a/tools/acp/Android.mk
+++ b/tools/acp/Android.mk
@@ -3,26 +3,15 @@
# Custom version of cp.
LOCAL_PATH:= $(call my-dir)
+
include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_SRC_FILES := \
acp.c
-ifeq ($(HOST_OS),cygwin)
-LOCAL_CFLAGS += -DWIN32_EXE
-endif
-ifeq ($(HOST_OS),darwin)
-LOCAL_CFLAGS += -DMACOSX_RSRC
-endif
-ifeq ($(HOST_OS),linux)
-endif
-
LOCAL_STATIC_LIBRARIES := libhost
-LOCAL_C_INCLUDES := build/libs/host/include
LOCAL_MODULE := acp
LOCAL_ACP_UNAVAILABLE := true
LOCAL_CXX_STL := none
-LOCAL_ADDRESS_SANITIZER := false
include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/atree/Android.mk b/tools/atree/Android.mk
index d895810..f598db5 100644
--- a/tools/atree/Android.mk
+++ b/tools/atree/Android.mk
@@ -12,7 +12,6 @@
LOCAL_STATIC_LIBRARIES := \
libhost
-LOCAL_C_INCLUDES := build/libs/host/include
LOCAL_MODULE := atree
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index dcd9ab5..ece5103 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -7,16 +7,22 @@
echo "ro.build.display.id=$BUILD_DISPLAY_ID"
echo "ro.build.version.incremental=$BUILD_NUMBER"
echo "ro.build.version.sdk=$PLATFORM_SDK_VERSION"
+echo "ro.build.version.preview_sdk=$PLATFORM_PREVIEW_SDK_VERSION"
echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES"
echo "ro.build.version.release=$PLATFORM_VERSION"
-echo "ro.build.date=`date`"
-echo "ro.build.date.utc=`date +%s`"
+echo "ro.build.version.security_patch=$PLATFORM_SECURITY_PATCH"
+echo "ro.build.version.base_os=$PLATFORM_BASE_OS"
+echo "ro.build.date=`$DATE`"
+echo "ro.build.date.utc=`$DATE +%s`"
echo "ro.build.type=$TARGET_BUILD_TYPE"
echo "ro.build.user=$USER"
echo "ro.build.host=`hostname`"
echo "ro.build.tags=$BUILD_VERSION_TAGS"
echo "ro.build.flavor=$TARGET_BUILD_FLAVOR"
+if [ -n "$BOARD_BUILD_SYSTEM_ROOT_IMAGE" ] ; then
+ echo "ro.build.system_root_image=$BOARD_BUILD_SYSTEM_ROOT_IMAGE"
+fi
echo "ro.product.model=$PRODUCT_MODEL"
echo "ro.product.brand=$PRODUCT_BRAND"
echo "ro.product.name=$PRODUCT_NAME"
diff --git a/tools/check_prereq/check_prereq.c b/tools/check_prereq/check_prereq.c
deleted file mode 100644
index d7b8918..0000000
--- a/tools/check_prereq/check_prereq.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/system_properties.h>
-#include <cutils/properties.h>
-
-// Compare the timestamp of the new build (passed on the command line)
-// against the current value of ro.build.date.utc. Exit successfully
-// if the new build is newer than the current build (or if the
-// timestamps are the same).
-int main(int argc, char** argv) {
- if (argc != 2) {
- usage:
- fprintf(stderr, "usage: %s <timestamp>\n", argv[0]);
- return 2;
- }
-
- char value[PROPERTY_VALUE_MAX];
- char* default_value = "0";
-
- property_get("ro.build.date.utc", value, default_value);
-
- long current = strtol(value, NULL, 10);
- char* end;
- long install = strtol(argv[1], &end, 10);
-
- printf("current build time: [%ld] new build time: [%ld]\n",
- current, install);
-
- return (*end == 0 && current > 0 && install >= current) ? 0 : 1;
-}
diff --git a/tools/droiddoc/templates-ds/class.cs b/tools/droiddoc/templates-ds/class.cs
index 23e57ab..d82f1c1 100644
--- a/tools/droiddoc/templates-ds/class.cs
+++ b/tools/droiddoc/templates-ds/class.cs
@@ -184,7 +184,6 @@
<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) ?>
@@ -535,7 +534,6 @@
<?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>
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/GPL-LICENSE.txt b/tools/droiddoc/templates-ndk/assets/GPL-LICENSE.txt
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/GPL-LICENSE.txt
copy to tools/droiddoc/templates-ndk/assets/GPL-LICENSE.txt
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/LICENSE.txt b/tools/droiddoc/templates-ndk/assets/LICENSE.txt
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/LICENSE.txt
copy to tools/droiddoc/templates-ndk/assets/LICENSE.txt
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/android-developer-docs.css b/tools/droiddoc/templates-ndk/assets/android-developer-docs.css
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/android-developer-docs.css
copy to tools/droiddoc/templates-ndk/assets/android-developer-docs.css
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/css/default.css b/tools/droiddoc/templates-ndk/assets/css/default.css
similarity index 84%
copy from tools/droiddoc/templates-sdk-dyn/assets/css/default.css
copy to tools/droiddoc/templates-ndk/assets/css/default.css
index e26aec6..f411d93 100644
--- a/tools/droiddoc/templates-sdk-dyn/assets/css/default.css
+++ b/tools/droiddoc/templates-ndk/assets/css/default.css
@@ -158,12 +158,6 @@
.layout-content-row {
display: inline-block;
margin-bottom: 10px; }
- .layout-content-row:after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden; }
* html .layout-content-row {
height: 1px; }
@@ -430,20 +424,19 @@
/* content header */
.content-header {
height: 30px;
- margin:20px 0 25px;
- padding:0 0 10px;}
+ margin:36px 0 23px; /* same as h1 */
+ padding:0 0 10px;} /* same as h1 */
.content-header.just-links {
margin-bottom:0;
padding-bottom:0;}
.content-header h1 {
- color:#000;
margin:0;
- border-bottom:0;
padding:0;
+ width: 700px;
}
.content-header > div:first-child {
- height:55px; /* set fixed height for the header div to ensure the
+ height:1px; /* set fixed height for the header div to ensure the
next/prev links align with toc on training classes */
}
@@ -451,7 +444,7 @@
border-top: 1px solid #ccc;
margin-top: 10px;
padding-top:10px;
- height: 30px; }
+ width:100%; }
.content-footer .col-9 {
margin-left:0;
@@ -462,20 +455,33 @@
.content-footer.wrap {
width:940px;
}
+.content-footer .plus-container {
+ margin:5px 0 0;
+ text-align:right;
+ float:right;
+}
+a.back-link {
+ text-decoration: none;
+ text-transform: uppercase;
+}
+
+.content-header .paging-links {
+ margin-top:-25px;
+}
.paging-links {
- position: relative; }
+ position: relative;
+ height:30px; }
.paging-links a {
position: absolute; }
.paging-links a,
.training-nav-top a {
- font-size: 14px;
- line-height: 30px;
color: #555555;
text-decoration: none;
text-transform: uppercase; }
.paging-links .prev-page-link:before,
- .training-nav-top .prev-page-link:before {
+ .training-nav-top .prev-page-link:before,
+ a.back-link:before {
content: '';
background: transparent url(../images/styles/disclosure_left.png) no-repeat scroll 50% 50%;
width: 10px;
@@ -489,7 +495,7 @@
.paging-links .prev-page-link {
left: -15px; }
.paging-links .next-page-link {
- right: 0px; }
+ right: 0; }
.next-page-link:after,
.start-class-link:after,
.start-course-link:after,
@@ -506,6 +512,9 @@
.next-page-link.inline:after {
content: none; }
+ .content-footer .paging-links .next-page-link {
+ left:0;
+ }
.training-nav-top a {
display:block;
@@ -544,7 +553,6 @@
.paging-links a.start-class-link {
width:100%;
- text-align:right;
}
/* list of classes on course landing page */
@@ -623,19 +631,6 @@
display:none !important;
}
- .content-footer.next-class {
- display:block;
- border:0;
- margin-top:0;
- padding-top:0;
- }
-
- .content-footer.next-class a.next-class-link {
- display:block;
- float:right;
- text-transform:uppercase;
- }
-
/* inner-doc tabs w/ title */
@@ -713,6 +708,7 @@
color: #33b5e5;
border-bottom-color: #33b5e5; } }
+h1:target,
h2:target,
h3:target {
-webkit-animation-name: glowheader;
@@ -894,7 +890,7 @@
.framed-nexus4-port-216 img {
width: 216px;
height: 360px; }
-
+
.framed-nexus5-port-span-5 {
background: transparent url(../images/styles/device_nexus5_blank_port_span5.png) no-repeat
scroll top left;
@@ -929,6 +925,47 @@
height: 384px;
}
+/* wear device frames */
+
+.framed-wear-square {
+ background: transparent url(../images/styles/device_wear_square.png) no-repeat scroll top left;
+ background-size: 302px 302px;
+ height:222px;
+ width:222px;
+ padding:40px;
+ overflow:hidden;
+}
+
+.framed-wear-square-small {
+ background: transparent url(../images/styles/device_wear_square_small.png) no-repeat scroll top left;
+ background-size: 169px 200px;
+ height:147px;
+ width:147px;
+ padding:27px 11px;
+ overflow:hidden;
+}
+
+#jd-content
+.framed-wear-square img {
+ height:222px;
+ width: 222px;
+ padding:0;
+ margin:0;
+}
+
+#jd-content
+.framed-wear-square-small img {
+ height:147px;
+ width: 147px;
+ padding:0;
+ margin:0;
+}
+
+
+
+
+
+
/* landing page disclosures */
.landing-page-link {
text-decoration: none;
@@ -1102,12 +1139,13 @@
}
h1 {
color:#333;
- font-size: 22px;
- margin: 20px 0 20px;
+ font-size: 34px;
+ margin: 36px 0 27px;
padding:0 0 10px;
+ font-weight:300;
}
h1, h2 {
- line-height: 32px;
+ line-height: 30px;
}
h1.short {
margin-right:320px;
@@ -1120,21 +1158,24 @@
}
h2 {
color:#333;
- font-size: 20px;
- margin: 20px 0 20px;
+ font-size: 26px;
+ margin: 32px 0 20px;
padding:0;
+ font-weight:300;
}
h3 {
color:#333;
- font-size: 18px;
+ font-size: 21px;
+ font-weight:400;
+ margin:21px 0 14px 0;
}
h3, h4 {
- color:#333;
- line-height: 20px;
- margin: 10px 0;
+ line-height: 21px;
}
h4 {
- font-size: 16px;
+ font-size: 18px;
+ margin: 12px 0;
+ font-weight:500;
}
h5 {
font-size: 14px;
@@ -1147,7 +1188,7 @@
}
hr { /* applied to the bottom of h2 elements */
height: 1px;
- margin: 5px 0 20px;
+ margin: 3px 0 12px;
border: 0;
background: #ccc;
}
@@ -1208,7 +1249,7 @@
legend {
display: none;
}
-a:link, a:visited {
+a:link, a:visited, .link-color {
color: #258aaf;
text-decoration: none;
}
@@ -1216,6 +1257,13 @@
color: #33B5E5;
text-decoration: none;
}
+a.white {
+ color: #fff;
+ text-decoration:underline;
+}
+a.white:hover, a.white:active {
+ color: #ccc !important;
+}
strong, b {
font-weight:bold;
color: #222;
@@ -1249,6 +1297,7 @@
tr:first-of-type th:first-of-type:empty {
visibility: hidden;
}
+
/* --------------------------------------------------------------------------
Footer
*/
@@ -1523,6 +1572,9 @@
color: #333;
font-size: 16px;
}
+.about a.selected {
+ color: #9933CC;
+}
.design a.selected {
color: #33b5e5;
}
@@ -1834,6 +1886,11 @@
margin:0 0 0 20px;
}
+.training-nav-top {
+ position:relative;
+ top:73px;
+}
+
.training-nav-bottom {
padding:0 0 20px;
}
@@ -1842,12 +1899,12 @@
#qv-wrapper {
float:right;
clear:right;
- margin:0 0 0 30px; /* negative top-margin to counter the content-header bottom margin */
+ margin:6px 0 0 30px; /* negative top-margin to counter the content-header bottom margin */
padding:0 0 30px;
}
#tb-wrapper {
- margin:-29px 0 0 20px; /* negative top-margin to counter the content-header bottom margin */
+ margin:51px 0 0 20px; /* negative top-margin to counter the content-header bottom margin */
}
#tb,
@@ -1931,6 +1988,10 @@
margin:0 15px 10px 35px;
}
+#tb p {
+ margin:0 15px 10px;
+}
+
#qv ol {
list-style:none;
margin:0 15px 15px;
@@ -1959,28 +2020,12 @@
/* related resources blocks in checklists */
-.rel-resources {
- margin:10px 0px;
- border:1px solid #ccc;
- background-color:rgba(0, 0, 0, 0.027451);
- border:1px solid #ccc;
- font-size:13px;
- color:#6f6f6f;
-}
+/* related resources sections that have dynamic content */
-.rel-resources ul {
-padding: .5em 1em 0 1em;
-}
-.rel-resources a {
-font-weight:500;
-}
-.rel-resources h3 {
- margin:4px 15px 0px 15px;
- font-size:13px;
- font-weight:600;
- text-transform:uppercase;
+h3.rel-resources {
+margin:1.25em auto;
}
/* --------------------------------------------------------------------------
@@ -2360,6 +2405,13 @@
#doc-col {
margin-right:0;
}
+
+/* Uncomment this for preview release watermark
+#doc-col {
+ background: url('../images/preview.png') repeat;
+}
+*/
+
#doc-content-container {
margin-left: 291px
}
@@ -2725,19 +2777,22 @@
width:100%;
}
#butterbar {
- width:940px;
+ width:100%;
margin:0 auto;
}
#butterbar-message {
- background-color:#f80;
- float:right;
- font-size:12px;
- font-weight:bold;
- padding:0 10px;
- border-radius: 0 0 5px 5px;
+ background-color:rgba(255, 187, 51, .4);
+ font-size:13px;
+ padding: 5px 0;
+ text-align:center;
}
-#butterbar-message a {color:#fff !important}
-#butterbar-message a:hover {text-decoration:underline;}
+a#butterbar-message {
+ cursor:pointer;
+ display:block;
+}
+a#butterbar-message:hover {
+ text-decoration:underline;
+}
/* --------------------------------------------------------------------------
Misc
@@ -2761,7 +2816,7 @@
.caption {
margin: 0.5em 0 2em 0;
color: #000;
- font-size: 11.5px;
+ font-size: 11.5px;
}
.nolist, .nolist ul, .nolist ol {
@@ -2994,6 +3049,34 @@
}
+/* for IDE instruction toggle (Studio/Eclipse/Other) */
+select.ide {
+ background: transparent;
+ border: 1px solid #bbb;
+ border-left: 0;
+ border-right: 0;
+ margin: 10px 0;
+ padding: 10px 0;
+ color:#666;
+}
+select.ide,
+select.ide option {
+ font-family: inherit;
+ font-size:16px;
+ font-weight:500;
+}
+/* hide all except studio by default */
+.select-ide.eclipse,
+.select-ide.other {
+ display:none;
+}
+/* ... unless studio also includes one of the others */
+.select-ide.studio.eclipse,
+.select-ide.studio.other {
+ display:none;
+}
+
+
/* -----------------------------------------------
good/bad example containers
*/
@@ -3072,6 +3155,7 @@
-webkit-box-shadow:-5px 5px 10px #ccc;
}
+div#langMessage,
div#naMessage {
display:none;
width:555px;
@@ -3079,6 +3163,8 @@
margin:0 auto;
}
+
+div#langMessage>div,
div#naMessage div {
z-index:99;
width:450px;
@@ -3092,12 +3178,16 @@
-webkit-box-shadow:-10px 10px 40px #888;
}
/* IE6 can't position fixed */
+* html div#langMessage>div,
* html div#naMessage div { position:absolute; }
div#naMessage strong {
font-size:1.1em;
}
+div#langMessage .lang {
+ display:none;
+}
/* --------------------------------------------------------------------------
Slideshow Controls & Next/Prev
@@ -3346,28 +3436,37 @@
}
#jd-header {
- padding: 0 0 5px;
- margin: 20px 0 10px;
- font-size:13px;
+ padding: 0 0 12px;
+ margin: 20px 0 12px;
+ font-size:12px;
+ padding-bottom:12px;
border-bottom:solid 1px #ccc;
}
#jd-header h1 {
margin:0;
- padding:0;
+ padding:0 0 6px 0;
}
+/* not sure if this is needed in the ref docs, disabling for now
+.jd-descr h2 {
+ margin:16px 0;
+}
+*/
+
/* page-top-right container for reference pages (holds
links to summary tables) */
#api-info-block {
- font-size:13px;
+ font-size:12px;
margin:20px 0 0;
padding:0 10px 6px;
font-weight:normal;
float:right;
text-align:right;
color:#999;
- max-width:70%;
+ max-width:80%;
+ font-size: 12px;
+ line-height:14px;
}
#api-info-block div.api-level {
@@ -3384,7 +3483,8 @@
border-spacing:0;
margin:0;
padding:0;
- font-size:13px;
+ font-size:12px;
+ line-height:14px;
background-color:transparent;
}
.jd-inheritance-table tr td {
@@ -3966,7 +4066,7 @@
height: 38px;
}
#header-wrapper #nav-x ul.nav-x li {
- margin-right: 36px !important;
+ margin-right: 31px !important;
margin-top: 5px;
margin-bottom: 0px;
height: 30px;
@@ -4093,6 +4193,7 @@
width: 26px;
height: 25px;
background: url(../images/dac_logo.png);
+ background-image: -webkit-image-set(url(../images/dac_logo.png) 1x, url(../images/dac_logo@2x.png) 2x);
z-index: 52;
position: relative;
}
@@ -4115,6 +4216,14 @@
z-index: 52;
}
+/* offset the <a name=""> tags to account for sticky nav */
+body.reference a[name] {
+ visibility: hidden;
+ display: block;
+ position: relative;
+ top: -56px;
+}
+
}
@@ -4168,13 +4277,13 @@
}
-#header-wrap .logo.wear-logo {
+#header-wrap .logo.landing-logo {
width:220px;
margin:0;
padding:0;
margin-bottom:22px;
}
-#header-wrap .logo.wear-logo img {
+#header-wrap .logo.landing-logo img {
padding:0 0 0 10px;
}
@@ -4246,7 +4355,7 @@
#quicknav {
float:none;
clear:both;
- margin-left:180px;
+ margin-left:0;
margin-top:-30px;
display:none;
overflow:hidden;
@@ -4261,6 +4370,10 @@
padding:0;
}
+#quicknav ul li.about {
+ border-top:1px solid #9933CC;
+}
+
#quicknav ul li.design {
border-top:1px solid #33b5e5;
}
@@ -4311,7 +4424,7 @@
}
#header-wrap.quicknav {
- height:196px;
+ height:216px;
}
@@ -4590,7 +4703,9 @@
}
-
+#landing h1 {
+ margin:17px 0 20px 0 !important;
+}
a.download-sdk {
float:right;
@@ -4761,14 +4876,14 @@
/* Slideshow */
.slideshow-develop {
- height: 300px;
+ height: 316px;
width: 940px;
position: relative;
overflow:hidden;
}
.slideshow-develop .frame {
width: 940px;
- height: 300px;
+ height: 316px;
}
.slideshow-develop img.play {
max-width:350px;
@@ -4800,6 +4915,7 @@
padding:0;
margin-bottom:10px;
border:none;
+ font-size:24px;
}
.slideshow-develop .item {
height: 300px;
@@ -4972,7 +5088,8 @@
margin-bottom:0;
}
.landing-banner h1 {
- margin-top:0;
+ margin-top:16px;
+ padding-bottom:24px;
}
.landing-docs,
.landing-banner {
@@ -5127,22 +5244,6 @@
/************ DISTRIBUTE PAGES ******************/
-/* Article page header line fix */
-.headerLine {
- overflow: hidden;
-}
-.headerLine h1 {
- float: left;
- padding-right: 20px;
- margin-bottom: 0px;
- font-size: 20px;
- color: #363636;
-}
-.headerLine hr {
- overflow: hidden;
- margin: 42px 0 0 0;
-}
-
.article-detail #body-content {
padding-top: 10px;
}
@@ -5155,7 +5256,7 @@
text-transform:uppercase;
border-bottom:1px solid #CCC;
padding:8px 0 0 1px;
- margin-bottom:10px;
+ margin-bottom:14px;
clear:both;
}
@@ -5191,7 +5292,7 @@
/* Basic card-styling with shadow */
.resource-card {
border-radius: 1px;
- box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.14);
+ box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.12);
background: #fefefe;
}
@@ -5220,6 +5321,9 @@
-o-transition: opacity 0.5s;
transition: opacity 0.5s;
}
+.static .card-bg:after {
+ display:none;
+}
.card-bg .card-section-icon {
position: absolute;
top: 50%;
@@ -5366,18 +5470,21 @@
content: ".";
display: block;
height: 0;
+ position:relative;
clear: both;
visibility: hidden;
}
-
.resource-card:hover {
cursor: pointer;
}
+.static .resource-card:hover {
+ cursor: auto;
+}
.resource-card:hover .card-bg:after {
opacity: 0;
}
/* disabled to make way for fade/ellipsis truncation,
- and the plusone moves up.
+ and the plusone moves up.
.resource-card:hover .card-info .description .text {
padding-right: 70px;
} */
@@ -6289,6 +6396,17 @@
display: none;
}
+
+/* Override to show the description instead of the content section */
+.no-section .resource-card-3x2 > .card-info .section,
+.no-section .resource-card-6x2 > .card-info .section {
+ display: none;
+}
+.no-section .resource-card-3x2 > .card-info .description,
+.no-section .resource-card-6x2 > .card-info .description {
+ display: block;
+}
+
/* 1/2 row items */
.resource-card-3x3 > .card-bg, .resource-card-6x3 > .card-bg, .resource-card-9x3 > .card-bg, .resource-card-12x3 > .card-bg, .resource-card-15x3 > .card-bg, .resource-card-18x3 > .card-bg {
left: 0;
@@ -6383,4 +6501,940 @@
div.jd-descr > .resource-widget[data-section=distribute\/tools]
.section-card-menu .card-info ul li {
border-top-color: #7e3794 !important;
-}
\ No newline at end of file
+}
+
+
+
+/**
+ * UTILITIES
+ */
+
+
+.border-box {
+ box-sizing: border-box;
+}
+
+.vertical-center-outer {
+ display: table;
+ height: 100%;
+ width: 100%;
+}
+
+.vertical-center-inner {
+ display: table-cell;
+ vertical-align: middle;
+}
+
+/**
+ * TYPE STYLES
+ */
+
+.landing-h1 {
+ font-weight: 100;
+ font-size: 60px;
+ line-height: 78px;
+ text-align: center;
+ letter-spacing: -1px;
+}
+
+.landing-pre-h1 {
+ font-weight: 400;
+ font-size: 28px;
+ color: #93B73F;
+ line-height: 36px;
+ text-align: center;
+ letter-spacing: -1px;
+ text-transform: uppercase;
+
+}
+
+.landing-h1.hero {
+ text-align: left;
+}
+
+.landing-h2 {
+ font-weight: 300;
+ font-size: 42px;
+ line-height: 64px;
+ text-align: center;
+}
+
+.landing-subhead {
+ color: #999999;
+ font-size: 20px;
+ line-height: 28px;
+ font-weight:300;
+ text-align: center;
+}
+.landing-subhead.hero {
+ text-align: left;
+ color: white;
+}
+
+.landing-hero-description {
+ text-align: left;
+ margin: 1em 0;
+}
+
+.landing-hero-description p {
+ font-weight: 300;
+ margin: 0;
+ font-size: 18px;
+ line-height: 24px;
+}
+
+.landing-body .landing-small {
+ font-size: 14px;
+ line-height: 19px;
+}
+
+.landing-body.landing-align-center {
+ text-align: center;
+}
+
+.landing-align-left {
+ text-align: left;
+}
+
+/**
+ * LAYOUT
+ */
+
+#body-content,
+.fullpage,
+#jd-content,
+.jd-descr,
+.landing-body-content {
+ height: 100%;
+}
+
+.landing-section {
+ padding: 80px 10px 80px;
+ width: 100%;
+ margin-left: -10px;
+ text-rendering: optimizeLegibility;
+}
+
+#extending-android-to-wearables {
+ padding-top: 30px;
+}
+
+.landing-short-section {
+ padding: 40px 10px 28px;
+}
+
+.landing-gray-background {
+ background-color: #e9e9e9;
+}
+
+.landing-white-background {
+ background-color: white;
+}
+
+.landing-red-background {
+ color: white;
+ background-color: hsl(8, 70%, 54%);
+}
+
+.landing-subhead-red {
+ color: hsl(8, 71%, 84%);
+ text-align: left;
+}
+
+.landing-subhead-red p {
+ margin-top: 20px;
+}
+
+.landing-hero-container {
+ height: 100%;
+}
+
+
+.preview-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../preview/images/hero.jpg);
+ background-size: cover;
+ background-position: right center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.wear-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../wear/images/hero.jpg);
+ background-size: cover;
+ background-position: top center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.tv-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../tv/images/hero.jpg);
+ background-size: cover;
+ background-position: right center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.auto-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../auto/images/hero.jpg);
+ background-size: cover;
+ background-position: right center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.landing-hero-scrim {
+ background: black;
+ opacity: .2;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ margin-left: -10px;
+}
+
+.landing-hero-wrap {
+ margin: 0 auto;
+ width: 940px;
+ clear: both;
+ height: 100%;
+ position: relative;
+}
+
+.landing-section-header {
+ margin-bottom: 40px;
+}
+
+.landing-hero-wrap .landing-section-header {
+ margin-bottom: 16px;
+}
+
+.landing-body {
+ font-size: 18px;
+ line-height: 24px;
+}
+
+.landing-button {
+ white-space: nowrap;
+ display: inline-block;
+ padding: 16px 32px;
+ font-size: 18px;
+ font-weight: 500;
+ line-height: 24px;
+ cursor: pointer;
+ color: white;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+ -webkit-transition: .2s background-color ease-in-out;
+ -moz-transition: .2s background-color ease-in-out;
+ -o-transition: .2s background-color ease-in-out;
+ transition: .2s background-color ease-in-out;
+}
+
+.landing-primary {
+ background-color: hsl(8, 70%, 44%);
+ color: #f8f8f8;
+}
+
+.landing-button.landing-primary:hover {
+ background-color: hsl(8, 70%, 36%);
+}
+
+.landing-button.landing-primary:active {
+ background-color: hsl(8, 70%, 30%);
+}
+
+.landing-button.landing-secondary {
+ background-color: #2faddb;
+}
+
+.landing-button.landing-secondary:hover {
+ background-color: #09c;
+}
+
+.landing-button.landing-secondary:active {
+ background-color: #3990ab;
+}
+
+a.landing-button,
+a.landing-button:hover,
+a.landing-button:visited {
+ color: white !important;
+}
+
+.landing-video-link {
+ white-space: nowrap;
+ display: inline-block;
+ padding: 16px 32px 16px 82px;
+ font-size: 18px;
+ font-weight: 400;
+ line-height: 24px;
+ cursor: pointer;
+ color: hsla(0, 0%, 100%, .8);
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+ -webkit-transition: .2s color ease-in-out;
+ -moz-transition: .2s color ease-in-out;
+ -o-transition: .2s color ease-in-out;
+ transition: .2s color ease-in-out;
+}
+
+.landing-video-link:before {
+ height: 64px;
+ width: 64px;
+ display: inline-block;
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAFuklEQVR42u2dXWgcVRSAV9LWtBBTTZVWUhNqEQtq1QeroDRKFRFsROqTYPuo+JCiIoJKFC0USqlUfCiowRcfrBgVUUElefAPkW5T8aeaGn9aRbFsjP0x2cx8PuRMvFxmdjeb2Z17Z8+B85DsZPbO+eaec3/OPSkABdXsVI2gABSAqgJQAKoKQAGoKgAFoKoAFICqAlAAqgpAAai6DqDRAiwDeoFtwB7gPaAInABKwKToCWAMeB/YDdwJrAWWNLh9+QMAXABsBQ4A3wFTwAxQBmaBAAhjNJDPy3L938BXwAvArUCHAkh+kCXAVcA+YBw4bRg7MngtkgTlDPA98CywHmhTAP8/xCbgVeAvMZZpwDQllN7xB/AysKGlAQAXAvuBkzW85UVgCBgENlfQQbmuWAXELPAnsAvoaikAQBtwh/j3coLhS2LIfqCzzu/plL8fkvvFgZiR4L2lHrfkHQBgpQTFUwmGnwC212v0KjC2y/3jQPwDPA+05xYAcBHwubx1YZzhC02QBBBRbxgBzssdAOBy4JgRZE0ZTPuNr7FHDCbEhqNAd24AAN0yUbID7QSwsZChABut3hANXY8Bq70HIMb/Ocb4w81+66v0hmGrN0QQ1ngLQJYRvpWHMWWo4KDIaMnuCcVKgdlZAGL8t2J8vpPGrwChDLyWBMFlAA8D0z4ZvwKEs8D93gCQEc9Jy/jFgkdizaRDGUSs8wXAu1bQLQE9ngHosWbPAXDQeQAypT9rBd3+gociyxi2K9riLABZUj5iuZ6RgsciM2OzFxw2A7JrAO6VwGtKTwpG+Anoy9AVmb3gDHCPcwCAFcChRox6jPu9CazMeFQUAKNRL3AJwE2yopjq228BQPZ/d2bcCyaBTa4BeNGa8Q6naIA4GQWubiKEYWvBbp8zAGQt5VfL/fQ3GEAkTzXDLVkjokA2k5a7AuA2GaLNj/tTfvhq0pQgbcwLQtlQusYVALtlzSR191MjADNI9zbJDZWBR10BMGr5/4GMADQ0SAMDlht62xUAxy0AmzMEEMnhtIO0ZF2YAH5wITd0hQw/5wE04M1bjDyXZpC2hqMlYGnWAHqBf40APOEYgChI35VSWyasWfGqrAH0WVkOIw4CSC1IG2tDoSy7XJE1gPs8ArDoIG0BmJGk30wBDHgGYFFBOgbAtqwB7GxxAHerC8rOBU0Dt2gQzjYIb8gawDor+6HVhqFdrkzEwhabiAVOTMSkUb+06FLEUVfWgj5q0cW4g64AeNo66ZLlcnTDNmesBN4y8KArAG6QU42ttCEzBVzpCoAO4EfLDeV5SzIEvgHaXdqUP2BlQud1Ux55zj2uZUX02cPRnKalRLmu17qYmPWF5YbymJgVAh8Ay5wCII3ZEZOYm6fURGT2u9X43Mnk3CDHybmfmRVYXExPv9nKEcpLejqSC3SjdY2TBzTesHqB7wc0onTEV2KucxLApXKkJy9HlAI5anuJFwCkYQ/EuCJfD+mdBnYkXOssgHY53un7MdVZ4CVgqVcADAhjMafkfTioHc14P04yvvMApIEXy5F/+7S8y6UKolPyR4BVVf7Wi2IdawwIPhTrmAW+rmZ8bwBIQ7vloXwoVzNWS6UUrwAYy9YfOlqwKZDkgneA5Qu4l3cly84F9sqGhislywLmaozuYoGFXr0DII1ukxP1hxJ6QzR7HqLxRfumZaRzXZ3f4XXZyi7gCeB3kqsnzs+kSb9s5XHgMeD8RTxDLgq3rmeuYuFvNYCoR8wqujNi+L3UWBcu9wAMt3QZ8LiMlk5RuU50teq6kcEDgTolveIRYHUQBOek1O5cFu/ukLz7/ZJgNSm+OirebWpgaPS7slxfAr4EngGuX8jopqUBxGzyrAVuB54EXgc+lV4yLhO8cfn5E+ZqUD8kBu9sQvv0Hzj4rmoEBaAAVBWAAlBVAApAVQEoAFUFoABUFYACUFUACkC1CfofXVRJocowZVYAAAAASUVORK5CYII=);
+ background-size: contain;
+ position: absolute;
+ content: "";
+ opacity: .7;
+ margin-top: -19px;
+ margin-left: -64px;
+ -webkit-transition: .2s opacity ease-in-out;
+ -moz-transition: .2s opacity ease-in-out;
+ -o-transition: .2s opacity ease-in-out;
+ transition: .2s opacity ease-in-out;
+}
+
+.landing-video-link:hover {
+ color: hsla(0, 0%, 100%, 1);
+}
+
+.landing-video-link:hover:before {
+ opacity: 1;
+}
+
+.landing-social-image {
+ float: left;
+ margin-right: 14px;
+ height: 64px;
+ width: 64px;
+}
+
+.landing-social-copy {
+ padding-left: 78px;
+}
+
+.landing-scroll-down-affordance {
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ text-align: center;
+ z-index: 10;
+}
+
+.landing-down-arrow {
+ padding: 24px;
+ display: inline-block;
+ opacity: .5;
+ -webkit-transition: .2s opacity ease-in-out;
+ -moz-transition: .2s opacity ease-in-out;
+ -o-transition: .2s opacity ease-in-out;
+ transition: .2s opacity ease-in-out;
+
+ -webkit-animation-name: pulse-opacity;
+ -webkit-animation-duration: 4s;
+}
+
+.landing-down-arrow:hover {
+ opacity: 1;
+}
+
+.landing-down-arrow img {
+ height: 28px;
+ width: 28px;
+ margin: 0 auto;
+ display: block;
+}
+
+.landing-divider {
+ display: inline-block;
+ height: 2px;
+ background-color: white;
+ position: relative;
+ margin: 10px 0;
+}
+
+/* 3 CLOLUMN LAYOUT */
+
+.landing-breakout {
+ margin-top: 40px;
+ margin-bottom: 40px;
+}
+
+.landing-breakout img {
+ margin-bottom: 20px;
+}
+
+.landing-partners img {
+ margin-bottom: 20px;
+}
+
+.landing-breakout p {
+ padding: 0 23px;
+}
+
+.landing-breakout.landing-partners img {
+ margin-bottom: 20px;
+}
+
+.col-3-wide {
+ display: inline;
+ float: left;
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+.col-3-wide {
+ width: 302px;
+}
+
+/**
+ * ANIMATION
+ */
+
+@-webkit-keyframes pulse-opacity {
+ 0% {
+ opacity: .5;
+ }
+ 20% {
+ opacity: .5;
+ }
+ 40% {
+ opacity: 1;
+ }
+ 60% {
+ opacity: .5;
+ }
+ 80% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: .5;
+ }
+}
+
+
+
+/**
+ * VIDEO
+ */
+
+#video-container {
+ display:none;
+ position:fixed;
+ top:0;
+ left:0;
+ width:100%;
+ height:100%;
+ background-color:rgba(0,0,0,0.8);
+ z-index:9999;
+}
+
+#video-frame {
+ width:940px;
+ height:100%;
+ margin:72px auto;
+ display:none;
+ position:relative;
+}
+
+.video-close {
+ cursor: pointer;
+ position: absolute;
+ right: -49px;
+ top: -49px;
+ pointer-events: all;
+}
+
+#icon-video-close {
+ background-image: url("../images/close-white.png");
+ background-image: -webkit-image-set(url(../images/close-white.png) 1x, url(../images/close-white_2x.png) 2x);
+ background-repeat: no-repeat;
+ background-position: 0 0;
+ background-size: 36px 36px;
+ height: 36px;
+ width: 36px;
+ display:block;
+}
+
+#icon-video-close:hover {
+ background-image: url("../images/close-grey.png");
+ background-image: -webkit-image-set(url(../images/close-grey.png) 1x, url(../images/close-grey_2x.png) 2x);
+}
+
+/* Preload the hover images */
+a.video-shadowbox-button.white:after {
+ display:none;
+ content:url("../images/close-grey.png") url("../images/close-grey_2x.png");
+}
+
+a.video-shadowbox-button.white {
+ background-image: url("../images/play-circle-white.png");
+ background-image: -webkit-image-set(url(../images/play-circle-white.png) 1x, url(../images/play-circle-white_2x.png) 2x);
+ background-size: 36px 36px;
+ background-repeat: no-repeat;
+ background-position: right;
+ padding: 16px 42px 16px 8px;
+ font-size: 18px;
+ font-weight: 500;
+ line-height: 24px;
+ color: #fff;
+ text-decoration:none;
+}
+
+a.video-shadowbox-button.white:hover {
+ color:#bababa !important;
+ background-image: url("../images/play-circle-grey.png");
+ background-image: -webkit-image-set(url(../images/play-circle-grey.png) 1x, url(../images/play-circle-grey_2x.png) 2x);
+}
+
+/* Preload the hover images */
+a.video-shadowbox-button.white:after {
+ display:none;
+ content:url("../images/play-circle-grey.png") url("../images/play-circle-grey_2x.png");
+}
+
+/******************
+Styles for d.a.c/index:
+*******************/
+
+
+
+/* Generic full screen carousel styling to be used across pages. */
+.fullscreen-carousel {
+ margin: 0 -10px;
+ width: 100%;
+ overflow: hidden;
+ position: relative;
+}
+
+.fullscreen-carousel-content {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ display: table; /* For vertical centering */
+}
+
+.fullscreen-carousel .vcenter {
+ display: table-cell;
+ vertical-align: middle;
+ position: relative;
+}
+
+.fullscreen-carousel .vcenter > div {
+ margin: 10px auto;
+}
+
+/* Styles for the full-bleed hero image type. */
+.fullscreen-carousel .hero, .fullscreen-carousel .hero h1 {
+ color: #fff;
+}
+
+.fullscreen-carousel .hero h1 {
+ font-weight: 300;
+ font-size: 60px;
+ line-height: 68px;
+ letter-spacing: -1px;
+ margin-top: 0;
+}
+
+.fullscreen-carousel .hero p {
+ font-weight: 300;
+ font-size: 18px;
+ line-height: 24px;
+ -webkit-font-smoothing: antialiased;
+}
+
+.fullscreen-carousel .hero .hero-bg {
+ background-size: cover;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ left: 0px;
+ top: 0px;
+}
+
+
+/* Full screen carousel styling for the resource flow layout type of content */
+.fullscreen-carousel .resource-flow-layout:after {
+ height: 0; /* Dont know why this is set at 10 in default.css */
+}
+
+.fullscreen-carousel .resource-flow-layout {
+ margin-bottom: 20px;
+}
+
+
+
+/* Generic Tab carousel styling to be used across multiple pages. */
+
+.tab-carousel .tab-nav {
+ list-style: none;
+ position: relative;
+ text-align: center;
+}
+
+.tab-carousel .tab-nav li {
+ display: inline-block;
+ font-size: 22px;
+ font-weight: 400;
+ line-height: 50px;
+ list-style: none;
+ margin: 0;
+ padding: 0 25px;
+ position: relative;
+}
+
+.tab-carousel .tab-nav li a,
+.tab-carousel .tab-nav li a:hover {
+ color: #333 !important;
+ padding: 10px 10px 13px 10px;
+ position: relative;
+ z-index: 1000;
+}
+
+.tab-carousel .tab-nav li:after {
+ background: #ddd;
+ bottom: 0;
+ content: '';
+ height: 4px;
+ left: 0;
+ position: absolute;
+ width: 100%;
+ z-index: 0;
+}
+
+.tab-carousel .tab-nav .highlight {
+ position: absolute;
+ height: 4px;
+ width: 100px;
+ bottom: 0;
+ background: #33b5e5;
+}
+
+.tab-carousel .tab-carousel-content {
+ position: relative;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.tab-carousel .tab-carousel-content [data-tab] {
+ display: inline-block;
+ white-space: normal;
+}
+
+
+
+/*
+ Resource styling for the tab carousel. The tab carousel contains either
+ a 3 column layout of resources or a single full-width resource. The
+ latter has the 18x12 class applied to it and can be styled differently
+ that way.
+*/
+
+.tab-carousel .resource .image {
+ width: 100%;
+ height: 250px;
+ background-repeat: no-repeat;
+ background-size: contain;
+ background-position: 50% 50%;
+}
+
+.tab-carousel .resource .info .title {
+ font-size: 18px;
+ line-height: 24px;
+}
+
+.tab-carousel .resource .info .summary,
+.tab-carousel .resource .info .cta {
+ line-height: 24px;
+ font-size: 16px;
+}
+
+.tab-carousel .resource-card-18x12 {
+ position: relative;
+ padding-left: 450px;
+ box-sizing: border-box;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+.tab-carousel .resource-card-18x12 .image {
+ position: absolute;
+ width: 420px;
+ height: 100%;
+ left: 0;
+ top: 0;
+}
+
+.tab-carousel .resource-card-18x12 .info {
+ display: inline-block;
+}
+
+.tab-carousel .resource-card-18x12 .info .title {
+ margin-bottom: 26px;
+}
+
+
+
+
+
+/*
+ Styles for the entity link used in the actions bar and in the cta of
+ the resources that appear in the tab carousel.
+*/
+.actions-bar a:after,
+.resource .cta:after {
+ content: '›';
+ font-weight: 400;
+ font-size: 22px;
+ left: 5px;
+ line-height: 1;
+ position: relative;
+ top: 1px;
+ transition: left 190ms ease-out;
+}
+
+.actions-bar a:hover:after,
+.resource .cta:hover:after {
+ left: 10px;
+}
+
+
+
+
+/*
+ Styles for the actions bar.
+*/
+.actions-bar {
+ background: #9acd00;
+ margin: 0 -10px;
+ text-align: center;
+}
+
+.actions-bar .actions {
+ padding: 30px 0 30px;
+ text-align: justify;
+ font-size: 0.1px;
+ line-height: 0.1px;
+ margin: 0 10px 0 0;
+}
+
+.actions-bar .actions:after {
+ content: '';
+ width: 100%;
+ display: inline-block;
+}
+
+.actions-bar .actions > div {
+ display: inline-block;
+}
+
+.actions-bar a {
+ font-size: 21px;
+ line-height: 27px;
+ color: #fff;
+ font-weight: 300;
+ -webkit-font-smoothing: antialiased;
+}
+
+.actions-bar a:after {
+ top: 0px;
+ font-size: 22px;
+}
+
+.actions-bar a:hover {
+ color: #fff !important;
+}
+
+
+
+
+
+/*
+ Specific styles for new home page layout of the carousels.
+*/
+
+/* Big blue button */
+a.home-new-cta-btn,
+.home-new-carousel-1 .resource-card-18x6 .cta {
+ white-space: nowrap;
+ display: inline-block;
+ padding: 14px 32px;
+ font-size: 18px;
+ font-weight: 500;
+ line-height: 24px;
+ cursor: pointer;
+ background: #33b5e6;
+ border-radius: 4px;
+ margin-top: 20px;
+ color: #fff;
+ transition: 0.2s background-color ease-in-out;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .cta:after {
+ display: none; /* Hide the entity for this button */
+}
+
+a.home-new-cta-btn:hover,
+.home-new-carousel-1 .resource-card-18x6 .cta:hover {
+ color: #fff !important;
+ background: #2d9fca;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .cta {
+ position: absolute;
+ bottom: 20px;
+ left: 16px;
+}
+
+/* Fullscreen carousel. */
+.home-new-carousel-1 {
+ max-height: 700px; /* Set max height so doesn't get too long */
+}
+
+.home-new-carousel-1 .fullscreen-carousel-content {
+ min-height: 450px; /* Set min height for all content */
+}
+
+.home-new-carousel-1 .hero {
+ background: #000;
+}
+
+.home-new-carousel-1 .hero-bg {
+ background-image: url(/home-new/images/hero.jpg);
+ background-position: right center;
+ opacity: 0.85;
+}
+
+/*
+ Styling for special top card of full screen layout resource layout.
+ We need to specifically style the 18x6 card to adjust its size and layout,
+ since it's not a standard card, not sure if this is unique to the home page
+ layout or should be namespaced within the fullscreen-carousel container.
+*/
+.home-new-carousel-1 .resource-flow-layout.col-16 .resource-card-18x6 {
+ height: 320px;
+ background-color:#F9F9F9;
+ border-radius: 0px;
+ box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
+
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-bg {
+ width: 636px;
+ height: 100%;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info {
+ right: 0px;
+ left: 636px;
+ height: 100%;
+ top: 0px;
+ padding: 15px 22px;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info .util {
+ display: none;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info .title {
+ font-size: 20px;
+ font-weight: 500;
+ margin-top: 15px;
+ margin-bottom: 15px;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info .text {
+ font-size: 15px;
+ line-height: 21px;
+}
+
+
+/* Tabbed carousel. */
+.home-new-carousel-2 {
+ margin: 35px auto 100px auto;
+}
+
+.home-new-carousel-2 h1 {
+ font-size: 47px;
+ font-weight: 100;
+ line-height: 54px;
+ text-align: center;
+}
+
+.annotation-message {
+ display: block;
+ font-style: italic;
+ color: #F80;
+}
+
+
+
+/* Helpouts widget */
+.resource-card-6x2.helpouts-card {
+ width: 255px;
+ height: 40px;
+ position:absolute;
+ z-index:999;
+ top:-8px;
+ right:1px;
+}
+
+.resource-card-6x2.helpouts-card > .card-info {
+ left:35px;
+ height:35px;
+ padding:4px 8px 4px 0;
+}
+
+.resource-card-6x2.helpouts-card > .card-info .helpouts-description {
+ display:block;
+ overflow:visible;
+ font-size:12px;
+ line-height:12px;
+ text-align:right;
+ color:#666;
+}
+
+.helpouts-description .link-color {
+ text-transform: uppercase;
+}
+
+.resource-card-6x2 > .card-bg.helpouts-card-bg {
+ width:35px;
+ height:35px;
+ margin:2px 0 0 0;
+ background-image: url(../images/styles/helpouts-logo-35_2x.png);
+ background-image: -webkit-image-set(url(../images/styles/helpouts-logo-35.png) 1x, url(../images/styles/helpouts-logo-35_2x.png) 2x);
+}
+
+.resource-card-6x2 > .card-bg.helpouts-card-bg:after {
+ display:none;
+}
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/css/fullscreen.css b/tools/droiddoc/templates-ndk/assets/css/fullscreen.css
similarity index 99%
rename from tools/droiddoc/templates-sdk-dyn/assets/css/fullscreen.css
rename to tools/droiddoc/templates-ndk/assets/css/fullscreen.css
index 53d9a64..7912e34 100644
--- a/tools/droiddoc/templates-sdk-dyn/assets/css/fullscreen.css
+++ b/tools/droiddoc/templates-ndk/assets/css/fullscreen.css
@@ -197,9 +197,6 @@
left:-20px;
}
-
-}
-
.col-right {
margin-right:0px;
}
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/design/default.js b/tools/droiddoc/templates-ndk/assets/design/default.js
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/design/default.js
copy to tools/droiddoc/templates-ndk/assets/design/default.js
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_more.png b/tools/droiddoc/templates-ndk/assets/images/icon_more.png
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/images/icon_more.png
copy to tools/droiddoc/templates-ndk/assets/images/icon_more.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_search.png b/tools/droiddoc/templates-ndk/assets/images/icon_search.png
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/images/icon_search.png
copy to tools/droiddoc/templates-ndk/assets/images/icon_search.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/more_bottom.png b/tools/droiddoc/templates-ndk/assets/images/more_bottom.png
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/images/more_bottom.png
copy to tools/droiddoc/templates-ndk/assets/images/more_bottom.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/more_mid.png b/tools/droiddoc/templates-ndk/assets/images/more_mid.png
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/images/more_mid.png
copy to tools/droiddoc/templates-ndk/assets/images/more_mid.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/more_top.png b/tools/droiddoc/templates-ndk/assets/images/more_top.png
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/images/more_top.png
copy to tools/droiddoc/templates-ndk/assets/images/more_top.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/js/android_3p-bundle.js b/tools/droiddoc/templates-ndk/assets/js/android_3p-bundle.js
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/js/android_3p-bundle.js
copy to tools/droiddoc/templates-ndk/assets/js/android_3p-bundle.js
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/js/docs.js b/tools/droiddoc/templates-ndk/assets/js/docs.js
similarity index 83%
rename from tools/droiddoc/templates-sdk-dyn/assets/js/docs.js
rename to tools/droiddoc/templates-ndk/assets/js/docs.js
index e6befe3..192d219 100644
--- a/tools/droiddoc/templates-sdk-dyn/assets/js/docs.js
+++ b/tools/droiddoc/templates-ndk/assets/js/docs.js
@@ -19,9 +19,19 @@
/****** ON LOAD SET UP STUFF *********/
-var navBarIsFixed = false;
$(document).ready(function() {
+ // show lang dialog if the URL includes /intl/
+ //if (location.pathname.substring(0,6) == "/intl/") {
+ // var lang = location.pathname.split('/')[2];
+ // if (lang != getLangPref()) {
+ // $("#langMessage a.yes").attr("onclick","changeLangPref('" + lang
+ // + "', true); $('#langMessage').hide(); return false;");
+ // $("#langMessage .lang." + lang).show();
+ // $("#langMessage").show();
+ // }
+ //}
+
// load json file for JD doc search suggestions
$.getScript(toRoot + 'jd_lists_unified.js');
// load json file for Android API search suggestions
@@ -64,7 +74,12 @@
$('.scroll-pane').jScrollPane( {verticalGutter:0} );
// add HRs below all H2s (except for a few other h2 variants)
- $('h2').not('#qv h2').not('#tb h2').not('.sidebox h2').not('#devdoc-nav h2').not('h2.norule').css({marginBottom:0}).after('<hr/>');
+ $('h2').not('#qv h2')
+ .not('#tb h2')
+ .not('.sidebox h2')
+ .not('#devdoc-nav h2')
+ .not('h2.norule').css({marginBottom:0})
+ .after('<hr/>');
// set up the search close button
$('.search .close').click(function() {
@@ -169,6 +184,18 @@
$("#header li.design a").addClass("selected");
$("#sticky-header").addClass("design");
+ // highlight About tabs
+ } else if ($("body").hasClass("about")) {
+ var rootDir = pagePathOriginal.substring(1,pagePathOriginal.indexOf('/', 1));
+ if (rootDir == "about") {
+ $("#nav-x li.about a").addClass("selected");
+ } else if (rootDir == "wear") {
+ $("#nav-x li.wear a").addClass("selected");
+ } else if (rootDir == "tv") {
+ $("#nav-x li.tv a").addClass("selected");
+ } else if (rootDir == "auto") {
+ $("#nav-x li.auto a").addClass("selected");
+ }
// highlight Develop tab
} else if ($("body").hasClass("develop") || $("body").hasClass("google")) {
$("#header li.develop a").addClass("selected");
@@ -192,6 +219,16 @@
$("#nav-x li.google a").addClass("selected");
} else if ($("body").hasClass("samples")) {
$("#nav-x li.samples a").addClass("selected");
+ } else if (rootDir == "ndk") {
+ if ($("body").hasClass("guide")) {
+ $("#nav-x li.guide a").addClass("selected");
+ } else if ($("body").hasClass("samples")) {
+ $("#nav-x li.samples a").addClass("selected");
+ } else if ($("body").hasClass("downloads")) {
+ $("#nav-x li.downloads a").addClass("selected");
+ } else if ($("body").hasClass("reference")) {
+ $("#nav-x li.reference a").addClass("selected");
+ }
}
// highlight Distribute tab
@@ -207,6 +244,8 @@
$("#nav-x li.engage a").addClass("selected");
} else if (secondFrag == "monetize") {
$("#nav-x li.monetize a").addClass("selected");
+ } else if (secondFrag == "analyze") {
+ $("#nav-x li.analyze a").addClass("selected");
} else if (secondFrag == "tools") {
$("#nav-x li.disttools a").addClass("selected");
} else if (secondFrag == "stories") {
@@ -218,7 +257,7 @@
}
} else if ($("body").hasClass("about")) {
$("#sticky-header").addClass("about");
- }
+ }
// set global variable so we can highlight the sidenav a bit later (such as for google reference)
// and highlight the sidenav
@@ -239,7 +278,7 @@
var crossBoundaries = ($("body.design").length > 0) || ($("body.guide").length > 0) ? true :
false; // navigate across topic boundaries only in design docs
if ($prevListItem.length) {
- if ($prevListItem.hasClass('nav-section')) {
+ if ($prevListItem.hasClass('nav-section') || crossBoundaries) {
// jump to last topic of previous section
$prevLink = $prevListItem.find('a:last');
} else if (!$selListItem.hasClass('nav-section')) {
@@ -262,7 +301,6 @@
// set up next links
var $nextLink = [];
var startClass = false;
- var training = $(".next-class-link").length; // decides whether to provide "next class" link
var isCrossingBoundary = false;
if ($selListItem.hasClass('nav-section') && $selListItem.children('div.empty').length == 0) {
@@ -289,13 +327,15 @@
if ($nextLink.length == 0) {
isCrossingBoundary = true;
// no more topics in this section, jump to the first topic in the next section
- $nextLink = $selListItem.parents('li:eq(0)').next('li.nav-section').find('a:eq(0)');
+ $nextLink = $selListItem.parents('li:eq(0)').next('li').find('a:eq(0)');
if (!$nextLink.length) { // Go up another layer to look for next page (lesson > class > course)
$nextLink = $selListItem.parents('li:eq(1)').next('li.nav-section').find('a:eq(0)');
if ($nextLink.length == 0) {
// if that doesn't work, we're at the end of the list, so disable NEXT link
$('.next-page-link').attr('href','').addClass("disabled")
.click(function() { return false; });
+ // and completely hide the one in the footer
+ $('.content-footer .next-page-link').hide();
}
}
}
@@ -314,13 +354,19 @@
$('.next-page-link').attr('href','')
.removeClass("hide").addClass("disabled")
.click(function() { return false; });
+ // and completely hide the one in the footer
+ $('.content-footer .next-page-link').hide();
if ($nextLink.length) {
$('.next-class-link').attr('href',$nextLink.attr('href'))
- .removeClass("hide").append($nextLink.html());
+ .removeClass("hide")
+ .append(": " + $nextLink.html());
$('.next-class-link').find('.new').empty();
}
} else {
- $('.next-page-link').attr('href', $nextLink.attr('href')).removeClass("hide");
+ $('.next-page-link').attr('href', $nextLink.attr('href'))
+ .removeClass("hide");
+ // for the footer link, also add the next page title
+ $('.content-footer .next-page-link').append(": " + $nextLink.html());
}
if (!startClass && $prevLink.length) {
@@ -332,14 +378,6 @@
}
}
- // If this is a training 'article', there should be no prev/next nav
- // ... if the grandparent is the "nav" ... and it has no child list items...
- if (training && $selListItem.parents('ul').eq(1).is('[id="nav"]') &&
- !$selListItem.find('li').length) {
- $('.next-page-link,.prev-page-link').attr('href','').addClass("disabled")
- .click(function() { return false; });
- }
-
}
@@ -347,7 +385,20 @@
// Set up the course landing pages for Training with class names and descriptions
if ($('body.trainingcourse').length) {
var $classLinks = $selListItem.find('ul li a').not('#nav .nav-section .nav-section ul a');
- var $classDescriptions = $classLinks.attr('description');
+
+ // create an array for all the class descriptions
+ var $classDescriptions = new Array($classLinks.length);
+ var lang = getLangPref();
+ $classLinks.each(function(index) {
+ var langDescr = $(this).attr(lang + "-description");
+ if (typeof langDescr !== 'undefined' && langDescr !== false) {
+ // if there's a class description in the selected language, use that
+ $classDescriptions[index] = langDescr;
+ } else {
+ // otherwise, use the default english description
+ $classDescriptions[index] = $(this).attr("description");
+ }
+ });
var $olClasses = $('<ol class="class-list"></ol>');
var $liClass;
@@ -359,7 +410,7 @@
$classLinks.each(function(index) {
$liClass = $('<li></li>');
$h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>');
- $pSummary = $('<p class="description">' + $(this).attr('description') + '</p>');
+ $pSummary = $('<p class="description">' + $classDescriptions[index] + '</p>');
$olLessons = $('<ol class="lesson-list"></ol>');
@@ -398,7 +449,7 @@
var stylesheet = $('link[rel="stylesheet"][class="fullscreen"]');
setNavBarLeftPos(); // do this even if sidenav isn't fixed because it could become fixed
// make sidenav behave when resizing the window and side-scolling is a concern
- if (navBarIsFixed) {
+ if (sticky) {
if ((stylesheet.attr("disabled") == "disabled") || stylesheet.length == 0) {
updateSideNavPosition();
} else {
@@ -482,7 +533,11 @@
}
}
+ // Resize once loading is finished
resizeNav();
+ // Check if there's an anchor that we need to scroll into view.
+ // A delay is needed, because some browsers do not immediately scroll down to the anchor
+ window.setTimeout(offsetScrollForSticky, 100);
/* init the language selector based on user cookie for lang */
loadLangPref();
@@ -515,10 +570,147 @@
cookiePath = "distribute_";
}
+
+ /* setup shadowbox for any videos that want it */
+ var $videoLinks = $("a.video-shadowbox-button, a.notice-developers-video");
+ if ($videoLinks.length) {
+ // if there's at least one, add the shadowbox HTML to the body
+ $('body').prepend(
+'<div id="video-container">'+
+ '<div id="video-frame">'+
+ '<div class="video-close">'+
+ '<span id="icon-video-close" onclick="closeVideo()"> </span>'+
+ '</div>'+
+ '<div id="youTubePlayer"></div>'+
+ '</div>'+
+'</div>');
+
+ // loads the IFrame Player API code asynchronously.
+ $.getScript("https://www.youtube.com/iframe_api");
+
+ $videoLinks.each(function() {
+ var videoId = $(this).attr('href').split('?v=')[1];
+ $(this).click(function(event) {
+ event.preventDefault();
+ startYouTubePlayer(videoId);
+ });
+ });
+ }
});
// END of the onload event
+var youTubePlayer;
+function onYouTubeIframeAPIReady() {
+}
+
+/* Returns the height the shadowbox video should be. It's based on the current
+ height of the "video-frame" element, which is 100% height for the window.
+ Then minus the margin so the video isn't actually the full window height. */
+function getVideoHeight() {
+ var frameHeight = $("#video-frame").height();
+ var marginTop = $("#video-frame").css('margin-top').split('px')[0];
+ return frameHeight - (marginTop * 2);
+}
+
+var mPlayerPaused = false;
+
+function startYouTubePlayer(videoId) {
+ $("#video-container").show();
+ $("#video-frame").show();
+ mPlayerPaused = false;
+
+ // compute the size of the player so it's centered in window
+ var maxWidth = 940; // the width of the web site content
+ var videoAspect = .5625; // based on 1280x720 resolution
+ var maxHeight = maxWidth * videoAspect;
+ var videoHeight = getVideoHeight();
+ var videoWidth = videoHeight / videoAspect;
+ if (videoWidth > maxWidth) {
+ videoWidth = maxWidth;
+ videoHeight = maxHeight;
+ }
+ $("#video-frame").css('width', videoWidth);
+
+ // check if we've already created this player
+ if (youTubePlayer == null) {
+ // check if there's a start time specified
+ var idAndHash = videoId.split("#");
+ var startTime = 0;
+ if (idAndHash.length > 1) {
+ startTime = idAndHash[1].split("t=")[1] != undefined ? idAndHash[1].split("t=")[1] : 0;
+ }
+ // enable localized player
+ var lang = getLangPref();
+ var captionsOn = lang == 'en' ? 0 : 1;
+
+ youTubePlayer = new YT.Player('youTubePlayer', {
+ height: videoHeight,
+ width: videoWidth,
+ videoId: idAndHash[0],
+ playerVars: {start: startTime, hl: lang, cc_load_policy: captionsOn},
+ events: {
+ 'onReady': onPlayerReady,
+ 'onStateChange': onPlayerStateChange
+ }
+ });
+ } else {
+ // reset the size in case the user adjusted the window since last play
+ youTubePlayer.setSize(videoWidth, videoHeight);
+ // if a video different from the one already playing was requested, cue it up
+ if (videoId != youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0]) {
+ youTubePlayer.cueVideoById(videoId);
+ }
+ youTubePlayer.playVideo();
+ }
+}
+
+function onPlayerReady(event) {
+ event.target.playVideo();
+ mPlayerPaused = false;
+}
+
+function closeVideo() {
+ try {
+ youTubePlayer.pauseVideo();
+ } catch(e) {
+ }
+ $("#video-container").fadeOut(200);
+}
+
+/* Track youtube playback for analytics */
+function onPlayerStateChange(event) {
+ // Video starts, send the video ID
+ if (event.data == YT.PlayerState.PLAYING) {
+ if (mPlayerPaused) {
+ ga('send', 'event', 'Videos', 'Resume',
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0]);
+ } else {
+ // track the start playing event so we know from which page the video was selected
+ ga('send', 'event', 'Videos', 'Start: ' +
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0],
+ 'on: ' + document.location.href);
+ }
+ mPlayerPaused = false;
+ }
+ // Video paused, send video ID and video elapsed time
+ if (event.data == YT.PlayerState.PAUSED) {
+ ga('send', 'event', 'Videos', 'Paused',
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0],
+ youTubePlayer.getCurrentTime());
+ mPlayerPaused = true;
+ }
+ // Video finished, send video ID and video elapsed time
+ if (event.data == YT.PlayerState.ENDED) {
+ ga('send', 'event', 'Videos', 'Finished',
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0],
+ youTubePlayer.getCurrentTime());
+ mPlayerPaused = true;
+ }
+}
+
+
+
function initExpandableNavItems(rootTag) {
$(rootTag + ' li.nav-section .nav-section-header').click(function() {
var section = $(this).closest('li.nav-section');
@@ -626,7 +818,7 @@
setTimeout(updateSidenavFixedWidth,delay); // need to wait a moment for css to switch
enabled = false;
}
- writeCookie("fullscreen", enabled, null, null);
+ writeCookie("fullscreen", enabled, null);
setNavBarLeftPos();
resizeNav(delay);
updateSideNavPosition();
@@ -787,7 +979,7 @@
function saveNavPanels() {
var basePath = getBaseUri(location.pathname);
var section = basePath.substring(1,basePath.indexOf("/",1));
- writeCookie("height", resizePackagesNav.css("height"), section, null);
+ writeCookie("height", resizePackagesNav.css("height"), section);
}
@@ -868,119 +1060,111 @@
return 0;
}
-function writeCookie(cookie, val, section, expiration) {
+function writeCookie(cookie, val, section) {
if (val==undefined) return;
section = section == null ? "_" : "_"+section+"_";
- if (expiration == null) {
- var date = new Date();
- date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
- expiration = date.toGMTString();
- }
+ var age = 2*365*24*60*60; // set max-age to 2 years
var cookieValue = cookie_namespace + section + cookie + "=" + val
- + "; expires=" + expiration+"; path=/";
+ + "; max-age=" + age +"; path=/";
document.cookie = cookieValue;
}
/* ######### END COOKIES! ########## */
-
-
+var sticky = false;
var stickyTop;
+var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
/* Sets the vertical scoll position at which the sticky bar should appear.
This method is called to reset the position when search results appear or hide */
function setStickyTop() {
stickyTop = $('#header-wrapper').outerHeight() - $('#sticky-header').outerHeight();
}
+/*
+ * Displays sticky nav bar on pages when dac header scrolls out of view
+ */
+$(window).scroll(function(event) {
-/*
- * Displays sticky nav bar on pages when dac header scrolls out of view
+ setStickyTop();
+ var hiding = false;
+ var $stickyEl = $('#sticky-header');
+ var $menuEl = $('.menu-container');
+ // Exit if there's no sidenav
+ if ($('#side-nav').length == 0) return;
+ // Exit if the mouse target is a DIV, because that means the event is coming
+ // from a scrollable div and so there's no need to make adjustments to our layout
+ if ($(event.target).nodeName == "DIV") {
+ return;
+ }
+
+ var top = $(window).scrollTop();
+ // we set the navbar fixed when the scroll position is beyond the height of the site header...
+ var shouldBeSticky = top >= stickyTop;
+ // ... except if the document content is shorter than the sidenav height.
+ // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
+ if ($("#doc-col").height() < $("#side-nav").height()) {
+ shouldBeSticky = false;
+ }
+ // Account for horizontal scroll
+ var scrollLeft = $(window).scrollLeft();
+ // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
+ if (sticky && (scrollLeft != prevScrollLeft)) {
+ updateSideNavPosition();
+ prevScrollLeft = scrollLeft;
+ }
+
+ // Don't continue if the header is sufficently far away
+ // (to avoid intensive resizing that slows scrolling)
+ if (sticky == shouldBeSticky) {
+ return;
+ }
+
+ // If sticky header visible and position is now near top, hide sticky
+ if (sticky && !shouldBeSticky) {
+ sticky = false;
+ hiding = true;
+ // make the sidenav static again
+ $('#devdoc-nav')
+ .removeClass('fixed')
+ .css({'width':'auto','margin':''})
+ .prependTo('#side-nav');
+ // delay hide the sticky
+ $menuEl.removeClass('sticky-menu');
+ $stickyEl.fadeOut(250);
+ hiding = false;
+
+ // update the sidenaav position for side scrolling
+ updateSideNavPosition();
+ } else if (!sticky && shouldBeSticky) {
+ sticky = true;
+ $stickyEl.fadeIn(10);
+ $menuEl.addClass('sticky-menu');
+
+ // make the sidenav fixed
+ var width = $('#devdoc-nav').width();
+ $('#devdoc-nav')
+ .addClass('fixed')
+ .css({'width':width+'px'})
+ .prependTo('#body-content');
+
+ // update the sidenaav position for side scrolling
+ updateSideNavPosition();
+
+ } else if (hiding && top < 15) {
+ $menuEl.removeClass('sticky-menu');
+ $stickyEl.hide();
+ hiding = false;
+ }
+ resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
+});
+
+/*
+ * Manages secion card states and nav resize to conclude loading
*/
(function() {
$(document).ready(function() {
- setStickyTop();
- var sticky = false;
- var hiding = false;
- var $stickyEl = $('#sticky-header');
- var $menuEl = $('.menu-container');
-
- var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
-
- $(window).scroll(function() {
- // Exit if there's no sidenav
- if ($('#side-nav').length == 0) return;
- // Exit if the mouse target is a DIV, because that means the event is coming
- // from a scrollable div and so there's no need to make adjustments to our layout
- if (event.target.nodeName == "DIV") {
- return;
- }
-
-
- var top = $(window).scrollTop();
- // we set the navbar fixed when the scroll position is beyond the height of the site header...
- var shouldBeSticky = top >= stickyTop;
- // ... except if the document content is shorter than the sidenav height.
- // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
- if ($("#doc-col").height() < $("#side-nav").height()) {
- shouldBeSticky = false;
- }
-
- // Don't continue if the header is sufficently far away
- // (to avoid intensive resizing that slows scrolling)
- if (sticky && shouldBeSticky) {
- return;
- }
-
- // Account for horizontal scroll
- var scrollLeft = $(window).scrollLeft();
- // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
- if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
- updateSideNavPosition();
- prevScrollLeft = scrollLeft;
- }
-
- // If sticky header visible and position is now near top, hide sticky
- if (sticky && !shouldBeSticky) {
- sticky = false;
- hiding = true;
- // make the sidenav static again
- $('#devdoc-nav')
- .removeClass('fixed')
- .css({'width':'auto','margin':''})
- .prependTo('#side-nav');
- // delay hide the sticky
- $menuEl.removeClass('sticky-menu');
- $stickyEl.fadeOut(250);
- hiding = false;
-
- // update the sidenaav position for side scrolling
- updateSideNavPosition();
- } else if (!sticky && shouldBeSticky) {
- sticky = true;
- $stickyEl.fadeIn(10);
- $menuEl.addClass('sticky-menu');
-
- // make the sidenav fixed
- var width = $('#devdoc-nav').width();
- $('#devdoc-nav')
- .addClass('fixed')
- .css({'width':width+'px'})
- .prependTo('#body-content');
-
- // update the sidenaav position for side scrolling
- updateSideNavPosition();
-
- } else if (hiding && top < 15) {
- $menuEl.removeClass('sticky-menu');
- $stickyEl.hide();
- hiding = false;
- }
-
- resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
- });
-
// Stack hover states
$('.section-card-menu').each(function(index, el) {
var height = $(el).height();
@@ -990,7 +1174,6 @@
$cardInfo.css({position: 'absolute', bottom:'0px', left:'0px', right:'0px', overflow:'visible'});
});
- resizeNav(); // must resize once loading is finished
});
})();
@@ -1060,8 +1243,16 @@
}
+/* Call this to add listeners to a <select> element for Studio/Eclipse/Other docs */
+function setupIdeDocToggle() {
+ $( "select.ide" ).change(function() {
+ var selected = $(this).find("option:selected").attr("value");
+ $(".select-ide").hide();
+ $(".select-ide."+selected).show();
-
+ $("select.ide").val(selected);
+ });
+}
@@ -1114,9 +1305,7 @@
nav_pref = NAV_PREF_TREE;
init_default_navtree(toRoot);
}
- var date = new Date();
- date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
- writeCookie("nav", nav_pref, "reference", date.toGMTString());
+ writeCookie("nav", nav_pref, "reference");
$("#nav-panels").toggle();
$("#panel-link").toggle();
@@ -1184,11 +1373,7 @@
}
function changeLangPref(lang, submit) {
- var date = new Date();
- expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000)));
- // keep this for 50 years
- //alert("expires: " + expires)
- writeCookie("pref_lang", lang, null, expires);
+ writeCookie("pref_lang", lang, null);
// ####### TODO: Remove this condition once we're stable on devsite #######
// This condition is only needed if we still need to support legacy GAE server
@@ -1607,8 +1792,8 @@
function onSuggestionClick(link) {
// When user clicks a suggested document, track it
- _gaq.push(['_trackEvent', 'Suggestion Click', 'clicked: ' + $(link).text(),
- 'from: ' + $("#search_autocomplete").val()]);
+ ga('send', 'event', 'Suggestion Click', 'clicked: ' + $(link).attr('href'),
+ 'query: ' + $("#search_autocomplete").val().toLowerCase());
}
function set_item_selected($li, selected)
@@ -1825,8 +2010,12 @@
return false;
}
}
- // Stop here if Google results are showing
+ // If Google results are showing, return true to allow ajax search to execute
else if ($("#searchResults").is(":visible")) {
+ // Also, if search_results is scrolled out of view, scroll to top to make results visible
+ if ((sticky ) && (search.value != "")) {
+ $('body,html').animate({scrollTop:0}, '500', 'swing');
+ }
return true;
}
// 38 UP ARROW
@@ -1949,7 +2138,7 @@
// Search for matching JD docs
- if (text.length >= 3) {
+ if (text.length >= 2) {
// Regex to match only the beginning of a word
var textRegex = new RegExp("\\b" + text.toLowerCase(), "g");
@@ -2496,8 +2685,29 @@
}
}, true);
+/* Adjust the scroll position to account for sticky header, only if the hash matches an id.
+ This does not handle <a name=""> tags. Some CSS fixes those, but only for reference docs. */
+function offsetScrollForSticky() {
+ // Ignore if there's no search bar (some special pages have no header)
+ if ($("#search-container").length < 1) return;
+
+ var hash = escape(location.hash.substr(1));
+ var $matchingElement = $("#"+hash);
+ // Sanity check that there's an element with that ID on the page
+ if ($matchingElement.length) {
+ // If the position of the target element is near the top of the page (<20px, where we expect it
+ // to be because we need to move it down 60px to become in view), then move it down 60px
+ if (Math.abs($matchingElement.offset().top - $(window).scrollTop()) < 20) {
+ $(window).scrollTop($(window).scrollTop() - 60);
+ }
+ }
+}
+
// when an event on the browser history occurs (back, forward, load) requery hash and do search
$(window).hashchange( function(){
+ // Ignore if there's no search bar (some special pages have no header)
+ if ($("#search-container").length < 1) return;
+
// If the hash isn't a search query or there's an error in the query,
// then adjust the scroll position to account for sticky header, then exit.
if ((location.hash.indexOf("q=") == -1) || (query == "undefined")) {
@@ -2505,8 +2715,7 @@
if (!$("#searchResults").is(":hidden")) {
hideResults();
}
- // Adjust the scroll position to account for sticky header
- $(window).scrollTop($(window).scrollTop() - 60);
+ offsetScrollForSticky();
return;
}
@@ -2557,8 +2766,8 @@
$("#searchResults a.gs-title").each(function(index, link) {
// When user clicks enter for Google search results, track it
$(link).click(function() {
- _gaq.push(['_trackEvent', 'Google Click', 'clicked: ' + $(this).text(),
- 'from: ' + $("#search_autocomplete").val()]);
+ ga('send', 'event', 'Google Click', 'clicked: ' + $(this).attr('href'),
+ 'query: ' + $("#search_autocomplete").val().toLowerCase());
});
});
}
@@ -2621,7 +2830,7 @@
}
function updateSidenavFixedWidth() {
- if (!navBarIsFixed) return;
+ if (!sticky) return;
$('#devdoc-nav').css({
'width' : $('#side-nav').css('width'),
'margin' : $('#side-nav').css('margin')
@@ -2632,7 +2841,7 @@
}
function updateSidenavFullscreenWidth() {
- if (!navBarIsFixed) return;
+ if (!sticky) return;
$('#devdoc-nav').css({
'width' : $('#side-nav').css('width'),
'margin' : $('#side-nav').css('margin')
@@ -2673,10 +2882,7 @@
selectedLevel = parseInt($("#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);
+ writeCookie(API_LEVEL_COOKIE, selectedLevel, null);
if (selectedLevel < minLevel) {
var thing = ($("#jd-header").html().indexOf("package") != -1) ? "package" : "class";
@@ -3349,7 +3555,7 @@
showing lines that are cut off. This works with the css ellipsis
classes to fade last text line and apply an ellipsis char. */
- //card text currently uses 15px line height.
+ //card text currently uses 15px line height.
var lineHeight = 15;
$('.card-info .text').ellipsisfade(lineHeight);
});
@@ -3380,7 +3586,10 @@
sortOrder: $widget.data('sortorder'),
query: $widget.data('query'),
section: $widget.data('section'),
- sizeCols: sizeCols
+ sizeCols: sizeCols,
+ /* Added by LFL 6/6/14 */
+ resourceStyle: $widget.data('resourcestyle') || 'card',
+ stackSort: $widget.data('stacksort') || 'true'
};
// run the search for the set of resources to show
@@ -3392,9 +3601,13 @@
} else if (isCarousel) {
drawResourcesCarouselWidget($widget, opts, resources);
} else if (isStack) {
- var sections = buildSectionList(opts);
+ /* Looks like this got removed and is not used, so repurposing for the
+ homepage style layout.
+ Modified by LFL 6/6/14
+ */
+ //var sections = buildSectionList(opts);
opts['numStacks'] = $widget.data('numstacks');
- drawResourcesStackWidget($widget, opts, resources, sections);
+ drawResourcesStackWidget($widget, opts, resources/*, sections*/);
}
}
@@ -3413,10 +3626,8 @@
var $ul = $('<ul>');
for (var i = 0; i < resources.length; ++i) {
- //keep url clean for matching and offline mode handling
- var urlPrefix = resources[i].url.indexOf("//") > -1 ? "" : toRoot;
var $card = $('<a>')
- .attr('href', urlPrefix + resources[i].url)
+ .attr('href', cleanUrl(resources[i].url))
.decorateResourceCard(resources[i],plusone);
$('<li>').css(css)
@@ -3435,7 +3646,9 @@
});
};
- /* Initializes a Resource Card Stack Widget (column-based layout) */
+ /* Initializes a Resource Card Stack Widget (column-based layout)
+ Modified by LFL 6/6/14
+ */
function drawResourcesStackWidget($widget, opts, resources, sections) {
// Don't empty widget, grab all items inside since they will be the first
// items stacked, followed by the resource query
@@ -3453,60 +3666,88 @@
var sectionResources = [];
// Extract any subsections that are actually resource cards
- for (var i = 0; i < sections.length; ++i) {
- if (!sections[i].sections || !sections[i].sections.length) {
- //keep url clean for matching and offline mode handling
- urlPrefix = sections[i].url.indexOf("//") > -1 ? "" : toRoot;
- // Render it as a resource card
+ if (sections) {
+ for (var i = 0; i < sections.length; ++i) {
+ if (!sections[i].sections || !sections[i].sections.length) {
+ // Render it as a resource card
+ sectionResources.push(
+ $('<a>')
+ .addClass('resource-card section-card')
+ .attr('href', cleanUrl(sections[i].resource.url))
+ .decorateResourceCard(sections[i].resource,plusone)[0]
+ );
- sectionResources.push(
- $('<a>')
- .addClass('resource-card section-card')
- .attr('href', urlPrefix + sections[i].resource.url)
- .decorateResourceCard(sections[i].resource,plusone)[0]
- );
-
- } else {
- cards.push(
- $('<div>')
- .addClass('resource-card section-card-menu')
- .decorateResourceSection(sections[i],plusone)[0]
- );
+ } else {
+ cards.push(
+ $('<div>')
+ .addClass('resource-card section-card-menu')
+ .decorateResourceSection(sections[i],plusone)[0]
+ );
+ }
}
}
cards = cards.concat(sectionResources);
for (var i = 0; i < resources.length; ++i) {
- //keep url clean for matching and offline mode handling
- urlPrefix = resources[i].url.indexOf("//") > -1 ? "" : toRoot;
- var $card = $('<a>')
- .addClass('resource-card related-card')
- .attr('href', urlPrefix + resources[i].url)
- .decorateResourceCard(resources[i],plusone);
+ var $card = createResourceElement(resources[i], opts);
+
+ if (opts.resourceStyle.indexOf('related') > -1) {
+ $card.addClass('related-card');
+ }
cards.push($card[0]);
}
- for (var i = 0; i < cards.length; ++i) {
- // Find the stack with the shortest height, but give preference to
- // left to right order.
- var minHeight = $stacks[0].height();
- var minIndex = 0;
+ if (opts.stackSort != 'false') {
+ for (var i = 0; i < cards.length; ++i) {
+ // Find the stack with the shortest height, but give preference to
+ // left to right order.
+ var minHeight = $stacks[0].height();
+ var minIndex = 0;
- for (var j = 1; j < numStacks; ++j) {
- var height = $stacks[j].height();
- if (height < minHeight - 45) {
- minHeight = height;
- minIndex = j;
+ for (var j = 1; j < numStacks; ++j) {
+ var height = $stacks[j].height();
+ if (height < minHeight - 45) {
+ minHeight = height;
+ minIndex = j;
+ }
}
- }
- $stacks[minIndex].append($(cards[i]));
+ $stacks[minIndex].append($(cards[i]));
+ }
}
};
+ /*
+ Create a resource card using the given resource object and a list of html
+ configured options. Returns a jquery object containing the element.
+ */
+ function createResourceElement(resource, opts, plusone) {
+ var $el;
+
+ // The difference here is that generic cards are not entirely clickable
+ // so its a div instead of an a tag, also the generic one is not given
+ // the resource-card class so it appears with a transparent background
+ // and can be styled in whatever way the css setup.
+ if (opts.resourceStyle == 'generic') {
+ $el = $('<div>')
+ .addClass('resource')
+ .attr('href', cleanUrl(resource.url))
+ .decorateResource(resource, opts);
+ } else {
+ var cls = 'resource resource-card';
+
+ $el = $('<a>')
+ .addClass(cls)
+ .attr('href', cleanUrl(resource.url))
+ .decorateResourceCard(resource, plusone);
+ }
+
+ return $el;
+ }
+
/* Initializes a flow widget, see distribute.scss for generating accompanying css */
function drawResourcesFlowWidget($widget, opts, resources) {
$widget.empty();
@@ -3517,7 +3758,6 @@
while (i < resources.length) {
var cardSize = cardSizes[j++ % cardSizes.length];
cardSize = cardSize.replace(/^\s+|\s+$/,'');
- console.log("cardsize is " + cardSize);
// Some card sizes do not get a plusone button, such as where space is constrained
// or for cards commonly embedded in docs (to improve overall page speed).
plusone = !((cardSize == "6x2") || (cardSize == "6x3") ||
@@ -3539,11 +3779,11 @@
// Build each stack item or just a single item
do {
var resource = resources[i];
- //keep url clean for matching and offline mode handling
- urlPrefix = resource.url.indexOf("//") > -1 ? "" : toRoot;
- var $card = $('<a>')
- .addClass('resource-card resource-card-' + cardSize + ' resource-card-' + resource.type)
- .attr('href', urlPrefix + resource.url);
+
+ var $card = createResourceElement(resources[i], opts, plusone);
+
+ $card.addClass('resource-card-' + cardSize +
+ ' resource-card-' + resource.type);
if (isStack) {
$card.addClass('resource-card-' + isStack[1] + 'x' + isStack[2]);
@@ -3555,8 +3795,7 @@
stackCount = 0;
}
- $card.decorateResourceCard(resource,plusone)
- .appendTo($stackDiv || $widget);
+ $card.appendTo($stackDiv || $widget);
} while (++i < resources.length && stackCount > 0);
}
@@ -3696,6 +3935,15 @@
return true;
}
+ function cleanUrl(url)
+ {
+ if (url && url.indexOf('//') === -1) {
+ url = toRoot + url;
+ }
+
+ return url;
+ }
+
function parseResourceQuery(query) {
// Parse query into array of expressions (expression e.g. 'tag:foo + type:video')
@@ -3743,41 +3991,55 @@
})();
(function($) {
+
+ /*
+ Utility method for creating dom for the description area of a card.
+ Used in decorateResourceCard and decorateResource.
+ */
+ function buildResourceCardDescription(resource, plusone) {
+ var $description = $('<div>').addClass('description ellipsis');
+
+ $description.append($('<div>').addClass('text').html(resource.summary));
+
+ if (resource.cta) {
+ $description.append($('<a>').addClass('cta').html(resource.cta));
+ }
+
+ if (plusone) {
+ var plusurl = resource.url.indexOf("//") > -1 ? resource.url :
+ "//developer.android.com/" + resource.url;
+
+ $description.append($('<div>').addClass('util')
+ .append($('<div>').addClass('g-plusone')
+ .attr('data-size', 'small')
+ .attr('data-align', 'right')
+ .attr('data-href', plusurl)));
+ }
+
+ return $description;
+ }
+
+
/* Simple jquery function to create dom for a standard resource card */
$.fn.decorateResourceCard = function(resource,plusone) {
var section = resource.group || resource.type;
- var imgUrl;
- if (resource.image) {
- //keep url clean for matching and offline mode handling
- var urlPrefix = resource.image.indexOf("//") > -1 ? "" : toRoot;
- imgUrl = urlPrefix + resource.image;
+ var imgUrl = resource.image ||
+ 'assets/images/resource-card-default-android.jpg';
+
+ if (imgUrl.indexOf('//') === -1) {
+ imgUrl = toRoot + imgUrl;
}
- //add linkout logic here. check url or type, assign a class, map to css :after
- $('<div>')
- .addClass('card-bg')
- .css('background-image', 'url(' + (imgUrl || toRoot + 'assets/images/resource-card-default-android.jpg') + ')')
+
+ $('<div>').addClass('card-bg')
+ .css('background-image', 'url(' + (imgUrl || toRoot +
+ 'assets/images/resource-card-default-android.jpg') + ')')
.appendTo(this);
- if (!plusone) {
- $('<div>').addClass('card-info' + (!resource.summary ? ' empty-desc' : ''))
- .append($('<div>').addClass('section').text(section))
- .append($('<div>').addClass('title').html(resource.title))
- .append($('<div>').addClass('description ellipsis')
- .append($('<div>').addClass('text').html(resource.summary))
- .append($('<div>').addClass('util')))
- .appendTo(this);
- } else {
- $('<div>').addClass('card-info' + (!resource.summary ? ' empty-desc' : ''))
- .append($('<div>').addClass('section').text(section))
- .append($('<div>').addClass('title').html(resource.title))
- .append($('<div>').addClass('description ellipsis')
- .append($('<div>').addClass('text').html(resource.summary))
- .append($('<div>').addClass('util')
- .append($('<div>').addClass('g-plusone')
- .attr('data-size', 'small')
- .attr('data-align', 'right')
- .attr('data-href', resource.url))))
- .appendTo(this);
- }
+
+ $('<div>').addClass('card-info' + (!resource.summary ? ' empty-desc' : ''))
+ .append($('<div>').addClass('section').text(section))
+ .append($('<div>').addClass('title').html(resource.title))
+ .append(buildResourceCardDescription(resource, plusone))
+ .appendTo(this);
return this;
};
@@ -3860,7 +4122,39 @@
return this;
};
+
+
+
+
+ /* Render other types of resource styles that are not cards. */
+ $.fn.decorateResource = function(resource, opts) {
+ var imgUrl = resource.image ||
+ 'assets/images/resource-card-default-android.jpg';
+ var linkUrl = resource.url;
+
+ if (imgUrl.indexOf('//') === -1) {
+ imgUrl = toRoot + imgUrl;
+ }
+
+ if (linkUrl && linkUrl.indexOf('//') === -1) {
+ linkUrl = toRoot + linkUrl;
+ }
+
+ $(this).append(
+ $('<div>').addClass('image')
+ .css('background-image', 'url(' + imgUrl + ')'),
+ $('<div>').addClass('info').append(
+ $('<h4>').addClass('title').html(resource.title),
+ $('<p>').addClass('summary').html(resource.summary),
+ $('<a>').attr('href', linkUrl).addClass('cta').html('Learn More')
+ )
+ );
+
+ return this;
+ };
})(jQuery);
+
+
/* Calculate the vertical area remaining */
(function($) {
$.fn.ellipsisfade= function(lineHeight) {
@@ -3870,8 +4164,10 @@
var remainingHeight = $this.parent().parent().height();
$this.parent().siblings().each(function ()
{
- var h = $(this).height();
- remainingHeight = remainingHeight - h;
+ if ($(this).is(":visible")) {
+ var h = $(this).height();
+ remainingHeight = remainingHeight - h;
+ }
});
adjustedRemainingHeight = ((remainingHeight)/lineHeight>>0)*lineHeight
@@ -3882,3 +4178,189 @@
return this;
};
}) (jQuery);
+
+/*
+ Fullscreen Carousel
+
+ The following allows for an area at the top of the page that takes over the
+ entire browser height except for its top offset and an optional bottom
+ padding specified as a data attribute.
+
+ HTML:
+
+ <div class="fullscreen-carousel">
+ <div class="fullscreen-carousel-content">
+ <!-- content here -->
+ </div>
+ <div class="fullscreen-carousel-content">
+ <!-- content here -->
+ </div>
+
+ etc ...
+
+ </div>
+
+ Control over how the carousel takes over the screen can mostly be defined in
+ a css file. Setting min-height on the .fullscreen-carousel-content elements
+ will prevent them from shrinking to far vertically when the browser is very
+ short, and setting max-height on the .fullscreen-carousel itself will prevent
+ the area from becoming to long in the case that the browser is stretched very
+ tall.
+
+ There is limited functionality for having multiple sections since that request
+ was removed, but it is possible to add .next-arrow and .prev-arrow elements to
+ scroll between multiple content areas.
+*/
+
+(function() {
+ $(document).ready(function() {
+ $('.fullscreen-carousel').each(function() {
+ initWidget(this);
+ });
+ });
+
+ function initWidget(widget) {
+ var $widget = $(widget);
+
+ var topOffset = $widget.offset().top;
+ var padBottom = parseInt($widget.data('paddingbottom')) || 0;
+ var maxHeight = 0;
+ var minHeight = 0;
+ var $content = $widget.find('.fullscreen-carousel-content');
+ var $nextArrow = $widget.find('.next-arrow');
+ var $prevArrow = $widget.find('.prev-arrow');
+ var $curSection = $($content[0]);
+
+ if ($content.length <= 1) {
+ $nextArrow.hide();
+ $prevArrow.hide();
+ } else {
+ $nextArrow.click(function() {
+ var index = ($content.index($curSection) + 1);
+ $curSection.hide();
+ $curSection = $($content[index >= $content.length ? 0 : index]);
+ $curSection.show();
+ });
+
+ $prevArrow.click(function() {
+ var index = ($content.index($curSection) - 1);
+ $curSection.hide();
+ $curSection = $($content[index < 0 ? $content.length - 1 : 0]);
+ $curSection.show();
+ });
+ }
+
+ // Just hide all content sections except first.
+ $content.each(function(index) {
+ if ($(this).height() > minHeight) minHeight = $(this).height();
+ $(this).css({position: 'absolute', display: index > 0 ? 'none' : ''});
+ });
+
+ // Register for changes to window size, and trigger.
+ $(window).resize(resizeWidget);
+ resizeWidget();
+
+ function resizeWidget() {
+ var height = $(window).height() - topOffset - padBottom;
+ $widget.width($(window).width());
+ $widget.height(height < minHeight ? minHeight :
+ (maxHeight && height > maxHeight ? maxHeight : height));
+ }
+ }
+})();
+
+
+
+
+
+/*
+ Tab Carousel
+
+ The following allows tab widgets to be installed via the html below. Each
+ tab content section should have a data-tab attribute matching one of the
+ nav items'. Also each tab content section should have a width matching the
+ tab carousel.
+
+ HTML:
+
+ <div class="tab-carousel">
+ <ul class="tab-nav">
+ <li><a href="#" data-tab="handsets">Handsets</a>
+ <li><a href="#" data-tab="wearable">Wearable</a>
+ <li><a href="#" data-tab="tv">TV</a>
+ </ul>
+
+ <div class="tab-carousel-content">
+ <div data-tab="handsets">
+ <!--Full width content here-->
+ </div>
+
+ <div data-tab="wearable">
+ <!--Full width content here-->
+ </div>
+
+ <div data-tab="tv">
+ <!--Full width content here-->
+ </div>
+ </div>
+ </div>
+
+*/
+(function() {
+ $(document).ready(function() {
+ $('.tab-carousel').each(function() {
+ initWidget(this);
+ });
+ });
+
+ function initWidget(widget) {
+ var $widget = $(widget);
+ var $nav = $widget.find('.tab-nav');
+ var $anchors = $nav.find('[data-tab]');
+ var $li = $nav.find('li');
+ var $contentContainer = $widget.find('.tab-carousel-content');
+ var $tabs = $contentContainer.find('[data-tab]');
+ var $curTab = $($tabs[0]); // Current tab is first tab.
+ var width = $widget.width();
+
+ // Setup nav interactivity.
+ $anchors.click(function(evt) {
+ evt.preventDefault();
+ var query = '[data-tab=' + $(this).data('tab') + ']';
+ transitionWidget($tabs.filter(query));
+ });
+
+ // Add highlight for navigation on first item.
+ var $highlight = $('<div>').addClass('highlight')
+ .css({left:$li.position().left + 'px', width:$li.outerWidth() + 'px'})
+ .appendTo($nav);
+
+ // Store height since we will change contents to absolute.
+ $contentContainer.height($contentContainer.height());
+
+ // Absolutely position tabs so they're ready for transition.
+ $tabs.each(function(index) {
+ $(this).css({position: 'absolute', left: index > 0 ? width + 'px' : '0'});
+ });
+
+ function transitionWidget($toTab) {
+ if (!$curTab.is($toTab)) {
+ var curIndex = $tabs.index($curTab[0]);
+ var toIndex = $tabs.index($toTab[0]);
+ var dir = toIndex > curIndex ? 1 : -1;
+
+ // Animate content sections.
+ $toTab.css({left:(width * dir) + 'px'});
+ $curTab.animate({left:(width * -dir) + 'px'});
+ $toTab.animate({left:'0'});
+
+ // Animate navigation highlight.
+ $highlight.animate({left:$($li[toIndex]).position().left + 'px',
+ width:$($li[toIndex]).outerWidth() + 'px'})
+
+ // Store new current section.
+ $curTab = $toTab;
+ }
+ }
+ }
+})();
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/js/prettify.js b/tools/droiddoc/templates-ndk/assets/js/prettify.js
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/js/prettify.js
copy to tools/droiddoc/templates-ndk/assets/js/prettify.js
diff --git a/tools/droiddoc/templates-sdk-dyn/class.cs b/tools/droiddoc/templates-ndk/class.cs
similarity index 94%
rename from tools/droiddoc/templates-sdk-dyn/class.cs
rename to tools/droiddoc/templates-ndk/class.cs
index 0461af6..e033fa2 100644
--- a/tools/droiddoc/templates-sdk-dyn/class.cs
+++ b/tools/droiddoc/templates-ndk/class.cs
@@ -1,9 +1,12 @@
<?cs include:"doctype.cs" ?>
<?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>" itemscope itemtype="http://schema.org/Article">
@@ -123,6 +126,7 @@
<?cs /if ?>
<?cs set:colspan = colspan-1 ?>
<?cs /each ?>
+<?cs call:show_annotations_list(class) ?>
</div><!-- end header -->
@@ -184,7 +188,6 @@
<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) ?>
@@ -193,7 +196,10 @@
<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>
+ <div class="jd-descrdiv">
+ <?cs call:short_descr(method) ?>
+ <?cs call:show_annotations_list(method) ?>
+ </div>
<?cs /if ?>
</td></tr>
<?cs set:count = count + #1 ?>
@@ -210,7 +216,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(field) ?>
+ <?cs call:show_annotations_list(field) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -222,7 +231,10 @@
<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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(field) ?>
+ <?cs call:show_annotations_list(field) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -242,7 +254,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(attr) ?>
+ <?cs call:show_annotations_list(attr) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -259,7 +274,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(cl) ?>
+ <?cs call:show_annotations_list(cl) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -335,7 +353,10 @@
<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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(field) ?>
+ <?cs call:show_annotations_list(field) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -504,6 +525,7 @@
<?cs call:federated_refs(field) ?>
</div>
<div class="jd-details-descr">
+ <?cs call:show_annotations_list(field) ?>
<?cs call:description(field) ?>
<?cs if:subcount(field.constantValue) ?>
<div class="jd-tagdata">
@@ -535,7 +557,6 @@
<?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>
@@ -546,6 +567,7 @@
<?cs call:federated_refs(method) ?>
</div>
<div class="jd-details-descr">
+ <?cs call:show_annotations_list(method) ?>
<?cs call:description(method) ?>
</div>
</div>
@@ -560,6 +582,7 @@
<h4 class="jd-details-title"><?cs var:attr.name ?>
</h4>
<div class="jd-details-descr">
+ <?cs call:show_annotations_list(attr) ?>
<?cs call:description(attr) ?>
<div class="jd-tagdata">
diff --git a/tools/droiddoc/templates-sdk-dyn/classes.cs b/tools/droiddoc/templates-ndk/classes.cs
similarity index 84%
rename from tools/droiddoc/templates-sdk-dyn/classes.cs
rename to tools/droiddoc/templates-ndk/classes.cs
index 6769f47..405892d 100644
--- a/tools/droiddoc/templates-sdk-dyn/classes.cs
+++ b/tools/droiddoc/templates-ndk/classes.cs
@@ -1,9 +1,12 @@
<?cs include:"doctype.cs" ?>
<?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>" itemscope itemtype="http://schema.org/Article">
@@ -30,7 +33,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(cl) ?>
+ <?cs call:show_annotations_list(cl) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
diff --git a/tools/droiddoc/templates-ndk/components/masthead.cs b/tools/droiddoc/templates-ndk/components/masthead.cs
new file mode 100644
index 0000000..01d0e55
--- /dev/null
+++ b/tools/droiddoc/templates-ndk/components/masthead.cs
@@ -0,0 +1,180 @@
+<?cs def:custom_masthead() ?>
+<?cs if:preview ?>
+ <?cs call:preview_masthead() ?>
+<?cs else ?>
+<a name="top"></a>
+
+<!-- dialog to prompt lang pref change when loaded from hardcoded URL
+<div id="langMessage" style="display:none">
+ <div>
+ <div class="lang en">
+ <p>You requested a page in English, would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang es">
+ <p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang ja">
+ <p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang ko">
+ <p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang ru">
+ <p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang zh-cn">
+ <p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang zh-tw">
+ <p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p>
+ </div>
+ <a href="#" class="button yes" onclick="return false;">
+ <span class="lang en">Yes</span>
+ <span class="lang es">Sí</span>
+ <span class="lang ja">Yes</span>
+ <span class="lang ko">Yes</span>
+ <span class="lang ru">Yes</span>
+ <span class="lang zh-cn">是的</span>
+ <span class="lang zh-tw">没有</span>
+ </a>
+ <a href="#" class="button" onclick="$('#langMessage').hide();return false;">
+ <span class="lang en">No</span>
+ <span class="lang es">No</span>
+ <span class="lang ja">No</span>
+ <span class="lang ko">No</span>
+ <span class="lang ru">No</span>
+ <span class="lang zh-cn">没有</span>
+ <span class="lang zh-tw">没有</span>
+ </a>
+ </div>
+</div> -->
+
+<?cs if:!devsite ?><?cs # leave out the global header for devsite; it is in devsite template ?>
+ <!-- Header -->
+ <div id="header-wrapper">
+ <div id="header"><?cs call:butter_bar() ?>
+ <div class="wrap" id="header-wrap">
+ <div class="col-3 logo">
+ <a href="<?cs var:toroot ?>index.html">
+ <img src="<?cs var:toroot ?>assets/images/dac_logo.png"
+ srcset="<?cs var:toroot ?>assets/images/dac_logo@2x.png 2x"
+ width="123" height="25" alt="Android Developers" />
+ </a>
+ <div class="btn-quicknav" id="btn-quicknav">
+ <a href="#" class="arrow-inactive">Quicknav</a>
+ <a href="#" class="arrow-active">Quicknav</a>
+ </div>
+ </div>
+
+ <?cs # design/dev/dist tabs usually here ?>
+
+ <?cs # call:header_search_widget() ?>
+
+ </div><!-- end header-wrap.wrap -->
+ </div><!-- end header -->
+
+
+ <!-- Secondary x-nav -->
+ <div id="nav-x">
+ <div class="wrap" style="position:relative;z-index:1">
+
+ <ul class="nav-x col-9 develop" style="width:100%">
+ <li class="guide"><a href="<?cs var:toroot ?>ndk/guides/index.html">
+ Guides</a></li>
+ <li class="reference"><a href="<?cs var:toroot ?>ndk/reference/index.html">
+ Reference</a></li>
+ <li class="samples"><a href="<?cs var:toroot ?>ndk/samples/index.html">
+ Samples</a></li>
+ <li class="downloads"><a href="<?cs var:toroot ?>ndk/downloads/index.html">
+ Downloads</a></li>
+ </li>
+ </ul>
+ </div>
+ </div>
+
+
+ <div id="searchResults" class="wrap" style="display:none;">
+ <h2 id="searchTitle">Results</h2>
+ <div id="leftSearchControl" class="search-control">Loading...</div>
+ </div>
+ </div> <!--end header-wrapper -->
+
+ <div id="sticky-header">
+ <div>
+ <a class="logo" href="#top"></a>
+ <a class="top" href="#top"></a>
+ <ul class="breadcrumb">
+ <?cs # More <li> elements added here with javascript ?>
+ <?cs if:!section.landing ?><li class="current"><?cs var:page.title ?></li><?cs
+ /if ?>
+ </ul>
+ </div>
+ </div>
+
+<?cs /if ?><?cs # end if/else !devsite ?>
+<?cs /if ?><?cs # end if/else preview ?><?cs
+/def ?>
+
+<?cs def:preview_masthead() ?>
+<a name="top"></a>
+
+
+<!-- Header -->
+<div id="header-wrapper">
+ <div id="header"><?cs call:butter_bar() ?>
+ <div class="wrap" id="header-wrap">
+ <div class="col_3 logo landing-logo" style="width:240px">
+ <a href="<?cs var:toroot ?>preview/index.html">
+ <img src="<?cs var:toroot ?>assets/images/android.png" height="25" alt="Android"
+ style="margin:-3px 0 0" />
+ </a>
+ </div>
+ <div class="col-8" style="margin:0"><h1 style="margin: 4px 0 0 0px;padding:0;line-height:16px;
+color:#666;font-weight:100;font-size:27px;">L Developer Preview</h1></div>
+
+ <?cs # ADD SEARCH AND MENU ?>
+ <?cs # call:header_search_widget() ?>
+
+ </div><!-- end header-wrap -->
+ </div><!-- /Header -->
+
+
+ <div id="searchResults" class="wrap" style="display:none;">
+ <h2 id="searchTitle">Results</h2>
+ <div id="leftSearchControl" class="search-control">Loading...</div>
+ </div>
+</div> <!--end header-wrapper -->
+
+<div id="sticky-header">
+ <div>
+ <a class="logo" href="#top"></a>
+ <a class="top" href="#top"></a>
+ <ul class="breadcrumb">
+ <?cs # More <li> elements added here with javascript ?>
+ <?cs if:!section.landing ?><li class="current"><?cs var:page.title ?></li><?cs
+ /if ?>
+ </ul>
+ </div>
+</div>
+
+ <?cs
+/def ?>
+
+
+<?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?>
+<?cs def:butter_bar() ?>
+
+<?cs # HIDE THE BUTTER BAR
+
+ <div style="height:20px"><!-- spacer to bump header down --></div>
+ <div id="butterbar-wrapper">
+ <div id="butterbar">
+ <a href="http://googleblog.blogspot.com/" id="butterbar-message">
+ The Android 5.0 SDK will be available on October 17th!
+ </a>
+ </div>
+ </div>
+
+?>
+
+<?cs /def ?>
diff --git a/tools/droiddoc/templates-sdk-dyn/customizations.cs b/tools/droiddoc/templates-ndk/customizations.cs
similarity index 79%
copy from tools/droiddoc/templates-sdk-dyn/customizations.cs
copy to tools/droiddoc/templates-ndk/customizations.cs
index 27822d5..0c640de 100644
--- a/tools/droiddoc/templates-sdk-dyn/customizations.cs
+++ b/tools/droiddoc/templates-ndk/customizations.cs
@@ -1,14 +1,14 @@
-<?cs
+<?cs
def:fullpage() ?>
<div id="body-content">
<?cs /def ?>
-<?cs
+<?cs
def:sdk_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
-<?cs
+<?cs
include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?>
@@ -24,10 +24,10 @@
<div class="wrap clearfix" id="body-content">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
-<?cs
+<?cs
include:"../../../../frameworks/base/docs/html/tools/tools_toc.cs" ?>
-
-
+
+
</div>
</div> <!-- end side-nav -->
<script>
@@ -37,15 +37,91 @@
</script>
<?cs /def ?>
<?cs
+
+def:ndk_guides_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+<?cs
+ include:"../../../../frameworks/base/docs/html-ndk/ndk/guides/guides_toc.cs" ?>
+
+
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
+<?cs
+
+def:ndk_reference_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+<?cs
+ include:"../../../../frameworks/base/docs/html-ndk/ndk/reference/reference_toc.cs" ?>
+
+
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
+<?cs
+
+def:ndk_samples_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+<?cs
+ include:"../../../../frameworks/base/docs/html-ndk/ndk/samples/samples_toc.cs" ?>
+
+
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
+<?cs
+
+def:ndk_downloads_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+<?cs
+ include:"../../../../frameworks/base/docs/html-ndk/ndk/downloads/downloads_toc.cs" ?>
+
+
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
+<?cs
def:training_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
-<?cs
+<?cs
include:"../../../../frameworks/base/docs/html/training/training_toc.cs" ?>
-
+
</div>
</div> <!-- end side-nav -->
@@ -112,6 +188,20 @@
</script>
<?cs /def ?><?cs
+def:analyze_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/distribute/analyze/analyze_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?><?cs
+
def:monetize_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
@@ -159,9 +249,9 @@
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
-<?cs
+<?cs
include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?>
-
+
</div>
</div> <!-- end side-nav -->
@@ -180,7 +270,7 @@
<?cs
include:"../../../../frameworks/base/docs/html/design/design_toc.cs" ?>
-
+
</div>
</div> <!-- end side-nav -->
@@ -198,7 +288,7 @@
<?cs
include:"../../../../frameworks/base/docs/html/distribute/distribute_toc.cs" ?>
-
+
</div>
</div> <!-- end side-nav -->
@@ -236,12 +326,12 @@
<?cs
include:"../../../../frameworks/base/docs/html/google/google_toc.cs" ?>
-
+
</div>
<script type="text/javascript">
showGoogleRefTree();
-
+
</script>
</div> <!-- end side-nav -->
<script>
@@ -259,7 +349,7 @@
<?cs
include:"../../../../frameworks/base/docs/html/about/about_toc.cs" ?>
-
+
</div>
</div> <!-- end side-nav -->
@@ -290,7 +380,23 @@
</script>
<?cs /def ?>
-<?cs # The default side navigation for the reference docs ?><?cs
+<?cs
+def:preview_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+ <?cs
+ include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
+<?cs # The default side navigation for the reference docs ?><?cs
def:default_left_nav() ?>
<?cs if:reference.gcm || reference.gms ?>
<?cs call:google_nav() ?>
@@ -311,15 +417,15 @@
<div id="api-nav-title">Android APIs</div>
</div><!-- end nav header -->
<script>
- var SINCE_DATA = [ <?cs
- each:since = since ?>'<?cs
- var:since.name ?>'<?cs
+ var SINCE_DATA = [ <?cs
+ each:since = since ?>'<?cs
+ var:since.name ?>'<?cs
if:!last(since) ?>, <?cs /if ?><?cs
- /each
+ /each
?> ];
buildApiLevelSelector();
</script>
-
+
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
@@ -334,27 +440,29 @@
<div id="classes-nav" class="scroll-pane">
-<?cs
+<?cs
if:subcount(class.package) ?>
<ul>
+ <?cs call:list("Annotations", class.package.annotations) ?>
<?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
+ </ul><?cs
elif:subcount(package) ?>
<ul>
+ <?cs call:class_link_list("Annotations", package.annotations) ?>
<?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
+ </ul><?cs
else ?>
- <p style="padding:10px">Select a package to view its members</p><?cs
+ <p style="padding:10px">Select a package to view its members</p><?cs
/if ?><br/>
-
+
</div><!-- end classes -->
</div><!-- end nav-panels -->
@@ -395,7 +503,7 @@
});
</script>
<?cs /if ?>
- <?cs
+ <?cs
/def ?>
@@ -431,8 +539,8 @@
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
- <option value="zh-cn">中文 (中国)</option>
- <option value="zh-tw">中文 (台灣)</option>
+ <option value="zh-cn">中文(简体)</option>
+ <option value="zh-tw">中文(繁體)</option>
</select>
</div>
<script type="text/javascript">
@@ -497,25 +605,35 @@
-<?cs
+<?cs
def:custom_left_nav() ?><?cs
if:fullpage ?><?cs
call:fullpage() ?><?cs
elif:nonavpage ?><?cs
call:no_nav() ?><?cs
- elif:guide ?><?cs
- call:guide_nav() ?><?cs
+ elif:ndk ?><?cs
+ if:guide ?><?cs
+ call:ndk_guides_nav() ?><?cs
+ elif:reference ?><?cs
+ call:ndk_reference_nav() ?><?cs
+ elif:samples ?><?cs
+ call:ndk_samples_nav() ?><?cs
+ elif:downloads ?><?cs
+ call:ndk_downloads_nav() ?><?cs
+ /if ?><?cs
+ elif:guide ?><?cs
+ call:guide_nav() ?><?cs
elif:design ?><?cs
- call:design_nav() ?><?cs
- elif:training ?><?cs
- call:training_nav() ?><?cs
- elif:tools ?><?cs
+ call:design_nav() ?><?cs
+ elif:training ?><?cs
+ call:training_nav() ?><?cs
+ elif:tools ?><?cs
call:tools_nav() ?><?cs
- elif:google ?><?cs
- call:google_nav() ?><?cs
+ elif:google ?><?cs
+ call:google_nav() ?><?cs
elif:samples ?><?cs
call:samples_nav() ?><?cs
- elif:distribute ?><?cs
+ elif:distribute ?><?cs
if:googleplay ?><?cs
call:googleplay_nav() ?><?cs
elif:essentials ?><?cs
@@ -526,6 +644,8 @@
call:engage_nav() ?><?cs
elif:monetize ?><?cs
call:monetize_nav() ?><?cs
+ elif:analyze ?><?cs
+ call:analyze_nav() ?><?cs
elif:disttools ?><?cs
call:disttools_nav() ?><?cs
elif:stories ?><?cs
@@ -537,38 +657,40 @@
call:distribute_nav() ?><?cs
elif:wear ?><?cs
call:wear_nav() ?><?cs
+ elif:preview ?><?cs
+ call:preview_nav() ?><?cs
else ?><?cs
call:default_left_nav() ?> <?cs
/if ?><?cs
/def ?>
-<?cs # appears at the bottom of every page ?><?cs
+<?cs # appears at the bottom of every page ?><?cs
def:custom_cc_copyright() ?>
- Except as noted, this content is
+ 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
+ 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
+<?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>.
+ 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
+ Content License</a>.<?cs
/def ?>
-<?cs
+<?cs
def:custom_footerlinks() ?>
<p>
<a href="<?cs var:toroot ?>about/index.html">About Android</a> |
<a href="<?cs var:toroot ?>legal.html">Legal</a> |
<a href="<?cs var:toroot ?>support.html">Support</a>
- </p><?cs
+ </p><?cs
/def ?>
-<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
+<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
def:custom_buildinfo() ?><?cs
if:!google && !reference.gcm && !reference.gms ?>
Android <?cs var:sdk.version ?> r<?cs var:sdk.rel.id ?> — <?cs
diff --git a/tools/droiddoc/templates-sdk-dyn/data.hdf b/tools/droiddoc/templates-ndk/data.hdf
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/data.hdf
copy to tools/droiddoc/templates-ndk/data.hdf
diff --git a/tools/droiddoc/templates-sdk-dyn/designpage.cs b/tools/droiddoc/templates-ndk/designpage.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/designpage.cs
copy to tools/droiddoc/templates-ndk/designpage.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/docpage.cs b/tools/droiddoc/templates-ndk/docpage.cs
similarity index 71%
copy from tools/droiddoc/templates-sdk-dyn/docpage.cs
copy to tools/droiddoc/templates-ndk/docpage.cs
index 7eae405..fa6dde6 100644
--- a/tools/droiddoc/templates-sdk-dyn/docpage.cs
+++ b/tools/droiddoc/templates-ndk/docpage.cs
@@ -2,27 +2,11 @@
<?cs include:"macros.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
-<body class="gc-documentation
-
-<?cs
-if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?><?cs
- if:(guide||develop||training||reference||tools||sdk||samples) ?>develop<?cs
+<body class="gc-documentation develop <?cs
if:guide ?> guide<?cs /if ?><?cs
+ if:reference ?> reference<?cs /if ?><?cs
if:samples ?> samples<?cs /if ?><?cs
- elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories)
- ?>distribute<?cs
- if:googleplay ?> googleplay<?cs /if ?><?cs
- if:essentials ?> essentials<?cs /if ?><?cs
- if:users ?> users<?cs /if ?><?cs
- if:engage ?> engage<?cs /if ?><?cs
- if:monetize ?> monetize<?cs /if ?><?cs
- if:disttools ?> disttools<?cs /if ?><?cs
- if:stories ?> stories<?cs /if ?><?cs
- elif:about ?>about<?cs
- elif:design ?>design<?cs
-/if ?><?cs
-if:page.trainingcourse ?> trainingcourse<?cs
-/if ?>" itemscope itemtype="http://schema.org/Article"><?cs
+ if:downloads ?> downloads<?cs /if ?>" itemscope itemtype="http://schema.org/Article"><?cs
include:"header.cs" ?>
<div <?cs
@@ -90,7 +74,7 @@
</div>
<?cs /if ?><?cs # end if training ?>
</div>
- <?cs /if ?>
+ <?cs /if ?><?cs # end if header.hide ?>
<?cs elif:samplesProjectIndex ?>
<div id="api-info-block">
@@ -103,7 +87,14 @@
<h1 itemprop="name"><?cs var:projectDir ?></h1>
<?cs else ?>
-
+ <?cs if:training ?>
+<?cs # horrible horrible hack to move TOC up when the next/prev links are not there ?>
+<style>
+ #tb-wrapper {
+ margin-top:6px;
+ }
+</style>
+ <?cs /if ?>
<?cs if:(!fullpage && !header.hide) ?>
<?cs if:page.landing ?><?cs # header logic for docs that are landing pages ?>
@@ -150,25 +141,9 @@
if:fullpage ?>wrap<?cs
else ?>layout-content-row<?cs /if ?>"
itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div class="layout-content-col <?cs
- if:fullpage ?>col-16<?cs
- elif:training||guide ?>col-8<?cs
- else ?>col-9<?cs /if ?>" style="padding-top:4px">
- <?cs if:!page.noplus ?><?cs if:fullpage ?><style>#___plusone_0 {float:right !important;}</style><?cs /if ?>
- <div class="g-plusone" data-size="medium"></div>
- <?cs /if ?>
- </div>
<?cs if:!fullscreen ?>
- <div class="paging-links layout-content-col col-4">
+ <div class="paging-links layout-content-col col-10">
<?cs if:(design||training||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
- <a href="#" class="prev-page-link hide"
- zh-tw-lang="上一堂課"
- zh-cn-lang="上一课"
- ru-lang="Предыдущий"
- ko-lang="이전"
- ja-lang="前へ"
- es-lang="Anterior"
- >Previous</a>
<a href="#" class="next-page-link hide"
zh-tw-lang="下一堂課"
zh-cn-lang="下一课"
@@ -185,41 +160,28 @@
ja-lang="開始する"
es-lang="Empezar"
>Get started</a>
+ <a href="#" class="next-class-link hide">Next class</a>
+ <?cs /if ?>
+ </div>
+ <div class="layout-content-col plus-container col-2" >
+ <?cs if:!page.noplus ?><?cs if:fullpage ?><style>#___plusone_0 {float:right !important;}</style><?cs /if ?>
+ <div class="g-plusone" data-size="medium"></div>
<?cs /if ?>
</div>
<?cs /if ?>
</div>
- <?cs # for training classes, provide a different kind of link when the next page is a different class ?>
- <?cs if:training && !page.article ?>
- <div class="layout-content-row content-footer next-class" style="display:none" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <a href="#" class="next-class-link hide">Next class: </a>
- </div>
- <?cs /if ?>
-
</div> <!-- end jd-content -->
<?cs include:"footer.cs" ?>
</div><!-- end doc-content -->
-<!-- Start of Tag -->
-<script type="text/javascript">
-var axel = Math.random() + "";
-var a = axel * 10000000000000;
-document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
-</script>
-<noscript>
-<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
-</noscript>
-<!-- End of Tag -->
-
-
<?cs include:"trailer.cs" ?>
<script src="https://developer.android.com/ytblogger_lists_unified.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_lists_unified.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_extras.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_collections.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_tag_helpers.js" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_lists_unified.js?v=8" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_extras.js?v=10" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_collections.js?v=10" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_tag_helpers.js?v=5" type="text/javascript"></script>
</body>
</html>
diff --git a/tools/droiddoc/templates-sdk-dyn/footer.cs b/tools/droiddoc/templates-ndk/footer.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/footer.cs
copy to tools/droiddoc/templates-ndk/footer.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/gcm_navtree_data.cs b/tools/droiddoc/templates-ndk/gcm_navtree_data.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/gcm_navtree_data.cs
copy to tools/droiddoc/templates-ndk/gcm_navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/gms_navtree_data.cs b/tools/droiddoc/templates-ndk/gms_navtree_data.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/gms_navtree_data.cs
copy to tools/droiddoc/templates-ndk/gms_navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/head_tag.cs b/tools/droiddoc/templates-ndk/head_tag.cs
similarity index 65%
copy from tools/droiddoc/templates-sdk-dyn/head_tag.cs
copy to tools/droiddoc/templates-ndk/head_tag.cs
index 732118f..d9dca8b 100644
--- a/tools/droiddoc/templates-sdk-dyn/head_tag.cs
+++ b/tools/droiddoc/templates-ndk/head_tag.cs
@@ -24,8 +24,8 @@
<meta name="Description" content="<?cs var:page.metaDescription ?>"><?cs
/if ?>
<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>favicon.ico" />
-<title><?cs
- if:page.title ?><?cs
+<title><?cs
+ if:page.title ?><?cs
var:page.title ?> | <?cs
/if ?>Android Developers</title>
@@ -38,13 +38,7 @@
if:android.whichdoc != 'online' ?>http:<?cs
/if ?>//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
title="roboto">
-<link href="<?cs var:toroot ?>assets/css/default.css" rel="stylesheet" type="text/css">
-
-<?cs if:reference && !(reference.gms || reference.gcm || wear) ?>
-<!-- FULLSCREEN STYLESHEET -->
-<link href="<?cs var:toroot ?>assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
-type="text/css">
-<?cs /if ?>
+<link href="<?cs var:toroot ?>assets/css/default.css?v=5" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="<?cs if:android.whichdoc != 'online' ?>http:<?cs /if ?>//www.google.com/jsapi" type="text/javascript"></script>
@@ -62,17 +56,25 @@
var metaTags = [<?cs var:meta.tags ?>];
var devsite = <?cs if:devsite ?>true<?cs else ?>false<?cs /if ?>;
</script>
-<script src="<?cs var:toroot ?>assets/js/docs.js" type="text/javascript"></script>
+<script src="<?cs var:toroot ?>assets/js/docs.js?v=3" type="text/javascript"></script>
-<script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-5831155-1']);
- _gaq.push(['_trackPageview']);
+<?cs if:helpoutsWidget ?>
+<script type="text/javascript" src="https://helpouts.google.com/ps/res/embed.js" defer async
+ data-helpouts-embed data-helpouts-vertical="programming"
+ data-helpouts-tags="<?cs var:page.tags ?>" data-helpouts-prefix="android"
+ data-helpouts-standalone="true"></script>
+<?cs /if ?>
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
+<script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-5831155-1', 'android.com');
+ ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
+ ga('send', 'pageview');
+ ga('universal.send', 'pageview'); // Send page view for new tracker.
</script>
+
</head>
diff --git a/tools/droiddoc/templates-sdk-dyn/header.cs b/tools/droiddoc/templates-ndk/header.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/header.cs
copy to tools/droiddoc/templates-ndk/header.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/header_tabs.cs b/tools/droiddoc/templates-ndk/header_tabs.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/header_tabs.cs
copy to tools/droiddoc/templates-ndk/header_tabs.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/jd_lists_unified.cs b/tools/droiddoc/templates-ndk/jd_lists_unified.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/jd_lists_unified.cs
copy to tools/droiddoc/templates-ndk/jd_lists_unified.cs
diff --git a/tools/droiddoc/templates-ndk/macros_override.cs b/tools/droiddoc/templates-ndk/macros_override.cs
new file mode 100644
index 0000000..0a94598
--- /dev/null
+++ b/tools/droiddoc/templates-ndk/macros_override.cs
@@ -0,0 +1,36 @@
+<?cs # Create a comma separated list of annotations on obj that were in showAnnotations in Doclava ?>
+<?cs # pre is an HTML string to start the list, post is an HTML string to close the list ?>
+<?cs # for example call:show_annotations_list(cl, "<td>Annotations: ", "</td>") ?>
+<?cs # if obj has nothing on obj.showAnnotations, nothing will be output ?>
+<?cs def:show_annotations_list(obj) ?>
+ <?cs each:anno = obj.showAnnotations ?>
+ <?cs if:first(anno) ?>
+ <span class='annotation-message'>
+ Included in documentation by the annotations:
+ <?cs /if ?>
+ @<?cs var:anno.type.label ?>
+ <?cs if:last(anno) == 0 ?>
+ ,
+ <?cs /if ?>
+ <?cs if:last(anno)?>
+ </span>
+ <?cs /if ?>
+ <?cs /each ?>
+<?cs /def ?>
+
+<?cs # Override default class_link_table to display annotations ?>
+<?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) ?>
+ <?cs call:show_annotations_list(cl) ?>
+ </td>
+ </tr>
+ <?cs set:count = count + #1 ?>
+ <?cs /each ?>
+ </table>
+<?cs /def ?>
\ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk-dyn/navtree_data.cs b/tools/droiddoc/templates-ndk/navtree_data.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/navtree_data.cs
copy to tools/droiddoc/templates-ndk/navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/nosidenavpage.cs b/tools/droiddoc/templates-ndk/nosidenavpage.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/nosidenavpage.cs
copy to tools/droiddoc/templates-ndk/nosidenavpage.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/package.cs b/tools/droiddoc/templates-ndk/package.cs
similarity index 91%
rename from tools/droiddoc/templates-sdk-dyn/package.cs
rename to tools/droiddoc/templates-ndk/package.cs
index 99eaff2..2225565 100644
--- a/tools/droiddoc/templates-sdk-dyn/package.cs
+++ b/tools/droiddoc/templates-ndk/package.cs
@@ -1,10 +1,13 @@
<?cs include:"doctype.cs" ?>
<?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>">
@@ -45,6 +48,7 @@
<?cs /if ?>
<?cs /def ?>
+<?cs call:class_table("Annotations", package.annotations) ?>
<?cs call:class_table("Interfaces", package.interfaces) ?>
<?cs call:class_table("Classes", package.classes) ?>
<?cs call:class_table("Enums", package.enums) ?>
diff --git a/tools/droiddoc/templates-sdk-dyn/packages.cs b/tools/droiddoc/templates-ndk/packages.cs
similarity index 95%
rename from tools/droiddoc/templates-sdk-dyn/packages.cs
rename to tools/droiddoc/templates-ndk/packages.cs
index 44680c3..5056d3a 100644
--- a/tools/droiddoc/templates-sdk-dyn/packages.cs
+++ b/tools/droiddoc/templates-ndk/packages.cs
@@ -4,6 +4,8 @@
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>">
diff --git a/tools/droiddoc/templates-sdk-dyn/sample.cs b/tools/droiddoc/templates-ndk/sample.cs
similarity index 97%
rename from tools/droiddoc/templates-sdk-dyn/sample.cs
rename to tools/droiddoc/templates-ndk/sample.cs
index c6f28f8..32a0788 100644
--- a/tools/droiddoc/templates-sdk-dyn/sample.cs
+++ b/tools/droiddoc/templates-ndk/sample.cs
@@ -18,7 +18,7 @@
<a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/index.html">Overview</a>
| <a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/project.html">Project</a>
| <a href="<?cs var:toroot ?>downloads/samples/<?cs var:projectDir ?>.zip"
- onclick="_gaq.push(['_trackEvent', 'Samples', 'Download', <?cs var:projectDir ?>]);"
+ onclick="ga('send', 'event', 'Samples', 'Download', <?cs var:projectDir ?>);"
>Download</a>
</div><!-- end sum-details-links -->
diff --git a/tools/droiddoc/templates-sdk-dyn/sampleindex.cs b/tools/droiddoc/templates-ndk/sampleindex.cs
similarity index 97%
rename from tools/droiddoc/templates-sdk-dyn/sampleindex.cs
rename to tools/droiddoc/templates-ndk/sampleindex.cs
index 98767b1..1bacb53 100644
--- a/tools/droiddoc/templates-sdk-dyn/sampleindex.cs
+++ b/tools/droiddoc/templates-ndk/sampleindex.cs
@@ -21,7 +21,7 @@
| <a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/project.html">Project</a>
<?cs /if ?>
| <a href="<?cs var:toroot ?>downloads/samples/<?cs var:projectDir ?>.zip"
- onclick="_gaq.push(['_trackEvent', 'Samples', 'Download', <?cs var:projectDir ?>]);"
+ onclick="ga('send', 'event', 'Samples', 'Download', <?cs var:projectDir ?>);"
>Download</a>
</div><!-- end sum-details-links -->
diff --git a/tools/droiddoc/templates-sdk-dyn/samples_navtree_data.cs b/tools/droiddoc/templates-ndk/samples_navtree_data.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/samples_navtree_data.cs
copy to tools/droiddoc/templates-ndk/samples_navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/sdkpage.cs b/tools/droiddoc/templates-ndk/sdkpage.cs
similarity index 69%
rename from tools/droiddoc/templates-sdk-dyn/sdkpage.cs
rename to tools/droiddoc/templates-ndk/sdkpage.cs
index 95f6596..817ac47 100644
--- a/tools/droiddoc/templates-sdk-dyn/sdkpage.cs
+++ b/tools/droiddoc/templates-ndk/sdkpage.cs
@@ -183,21 +183,7 @@
<td><?cs var:ndk.linux64.legacy_bytes ?></td>
<td><?cs var:ndk.linux64.legacy_checksum ?></td>
</tr> -->
- <tr>
- <th>Additional Download</th>
- <th>Package</th>
- <th style="white-space:nowrap">Size (Bytes)</th>
- <th>MD5 Checksum</th>
- </tr>
- <tr>
- <td>STL debug info</td>
- <td>
- <a onClick="return onDownload(this)"
- href="http://dl.google.com/android/ndk/<?cs var:ndk.debug_info_download ?>"><?cs var:ndk.debug_info_download ?></a>
- </td>
- <td><?cs var:ndk.debug_info_bytes ?></td>
- <td><?cs var:ndk.debug_info_checksum ?></td>
- </tr>
+
</table>
<?cs ######## HERE IS THE JD DOC CONTENT ######### ?>
@@ -278,89 +264,25 @@
-<h4><a href='' class="expandable"
- onclick="toggleExpandable(this,'.pax');hideExpandable('.myide,.reqs');return false;"
- >DOWNLOAD FOR OTHER PLATFORMS</a></h4>
+<div class="pax col-13 online" style="margin:0;">
-<div class="pax col-13 online" style="display:none;margin:0;">
+<h3>SDK Tools Only</h3>
+<p>If you prefer to use a different IDE or run the tools from the
+command line or with build scripts, you can instead download the stand-alone Android SDK Tools.
+These packages provide the basic SDK tools for app development, without an IDE.
+Also see the <a href="<?cs var:toroot ?>tools/sdk/tools-notes.html">SDK tools release notes</a>.</p>
-<p class="table-caption"><strong>ADT Bundle</strong></p>
<table class="download">
<tr>
<th>Platform</th>
<th>Package</th>
<th>Size</th>
- <th>MD5 Checksum</th>
+ <th>SHA-1 Checksum</th>
</tr>
<tr>
- <td>Windows 32-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="win-bundle32"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.win32_bundle_download ?>"><?cs var:sdk.win32_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.win32_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.win32_bundle_checksum ?></td>
- </tr>
- <tr>
- <td>Windows 64-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="win-bundle64"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.win64_bundle_download ?>"><?cs var:sdk.win64_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.win64_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.win64_bundle_checksum ?></td>
- </tr>
- <tr>
- <td><nobr>Mac OS X 64-bit</nobr></td>
- <td>
- <a onClick="return onDownload(this)" id="mac-bundle64"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.mac64_bundle_download ?>"><?cs var:sdk.mac64_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.mac64_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.mac64_bundle_checksum ?></td>
- </tr>
- <tr>
- <td>Linux 32-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="linux-bundle32"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.linux32_bundle_download ?>"><?cs var:sdk.linux32_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.linux32_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.linux32_bundle_checksum ?></td>
- </tr>
- <tr>
- <td>Linux 64-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="linux-bundle64"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.linux64_bundle_download ?>"><?cs var:sdk.linux64_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.linux64_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.linux64_bundle_checksum ?></td>
- </tr>
- </table>
-
-
-<p class="table-caption"><strong>SDK Tools Only</strong></p>
- <table class="download">
- <tr>
- <th>Platform</th>
- <th>Package</th>
- <th>Size</th>
- <th>MD5 Checksum</th>
- </tr>
- <tr>
- <td rowspan="2">Windows<br>32 & 64-bit</td>
- <td>
- <a onclick="return onDownload(this)" href="http://dl.google.com/android/<?cs var:sdk.win_download
-?>"><?cs var:sdk.win_download ?></a>
- </td>
- <td><?cs var:sdk.win_bytes ?> bytes</td>
- <td><?cs var:sdk.win_checksum ?></td>
- </tr>
- <tr>
- <!-- blank TD from Windows rowspan -->
+ <td rowspan="2">Windows</td>
<td>
<a onclick="return onDownload(this)" id="win-tools" href="http://dl.google.com/android/<?cs
var:sdk.win_installer
@@ -370,7 +292,16 @@
<td><?cs var:sdk.win_installer_checksum ?></td>
</tr>
<tr>
- <td><nobr>Mac OS X</nobr><br>32 & 64-bit</td>
+ <!-- blank TD from Windows rowspan -->
+ <td>
+ <a onclick="return onDownload(this)" href="http://dl.google.com/android/<?cs var:sdk.win_download
+?>"><?cs var:sdk.win_download ?></a>
+ </td>
+ <td><?cs var:sdk.win_bytes ?> bytes</td>
+ <td><?cs var:sdk.win_checksum ?></td>
+ </tr>
+ <tr>
+ <td><nobr>Mac OS X</nobr></td>
<td>
<a onclick="return onDownload(this)" id="mac-tools" href="http://dl.google.com/android/<?cs
var:sdk.mac_download
@@ -380,7 +311,7 @@
<td><?cs var:sdk.mac_checksum ?></td>
</tr>
<tr>
- <td>Linux<br>32 & 64-bit</td>
+ <td>Linux</td>
<td>
<a onclick="return onDownload(this)" id="linux-tools" href="http://dl.google.com/android/<?cs
var:sdk.linux_download
@@ -391,6 +322,79 @@
</tr>
</table>
+
+
+<h3>All Android Studio Packages</h3>
+
+<p>Select a specific Android Studio package for your platform. Also see the
+<a href="<?cs var:toroot ?>tools/revisions/studio.html">Android Studio release notes</a>.</p>
+
+ <table class="download">
+ <tr>
+ <th>Platform</th>
+ <th>Package</th>
+ <th>Size</th>
+ <th>SHA-1 Checksum</th>
+ </tr>
+
+ <tr>
+ <td rowspan="3">Windows</td>
+ <td>
+ <a onclick="return onDownload(this)" id="win-bundle"
+ href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_exe_download ?>"
+ ><?cs var:studio.win_bundle_exe_download ?></a><br>(Recommended)
+ </td>
+ <td><?cs var:studio.win_bundle_exe_bytes ?> bytes</td>
+ <td><?cs var:studio.win_bundle_exe_checksum ?></td>
+ </tr>
+
+ <tr>
+ <!-- blank TD from Windows rowspan -->
+ <td>
+ <a onclick="return onDownload(this)"
+ href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.win_notools_exe_download ?>"
+ ><?cs var:studio.win_notools_exe_download ?></a><br>(No SDK tools included)
+ </td>
+ <td><?cs var:studio.win_notools_exe_bytes ?> bytes</td>
+ <td><?cs var:studio.win_notools_exe_checksum ?></td>
+ </tr>
+
+ <tr>
+ <!-- blank TD from Windows rowspan -->
+ <td>
+ <a onclick="return onDownload(this)"
+ href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_download ?>"
+ ><?cs var:studio.win_bundle_download ?></a>
+ </td>
+ <td><?cs var:studio.win_bundle_bytes ?> bytes</td>
+ <td><?cs var:studio.win_bundle_checksum ?></td>
+ </tr>
+
+ <tr>
+ <td><nobr>Mac OS X</nobr></td>
+ <td>
+ <a onclick="return onDownload(this)" id="mac-bundle"
+ href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.mac_bundle_download ?>"
+ ><?cs var:studio.mac_bundle_download ?></a>
+ </td>
+ <td><?cs var:studio.mac_bundle_bytes ?> bytes</td>
+ <td><?cs var:studio.mac_bundle_checksum ?></td>
+ </tr>
+
+ <tr>
+ <td>Linux</td>
+ <td>
+ <a onclick="return onDownload(this)" id="linux-bundle"
+ href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.linux_bundle_download ?>"
+ ><?cs var:studio.linux_bundle_download ?></a>
+ </td>
+ <td><?cs var:studio.linux_bundle_bytes ?> bytes</td>
+ <td><?cs var:studio.linux_bundle_checksum ?></td>
+ </tr>
+ </table>
+
+
+
</div><!-- end pax -->
@@ -411,7 +415,9 @@
var bundlename;
var $toolslink;
- if (navigator.appVersion.indexOf("Win")!=-1) {
+ if (navigator.appVersion.indexOf("Mobile")!=-1) {
+ // Do nothing for any "mobile" user agent
+ } else if (navigator.appVersion.indexOf("Win")!=-1) {
os = "Windows";
bundlename = '#win-bundle';
$toolslink = $('#win-tools');
@@ -419,26 +425,18 @@
os = "Mac";
bundlename = '#mac-bundle';
$toolslink = $('#mac-tools');
- } else if (navigator.appVersion.indexOf("Linux")!=-1) {
+ } else if (navigator.appVersion.indexOf("Linux")!=-1 && navigator.appVersion.indexOf("Android")==-1) {
os = "Linux";
bundlename = '#linux-bundle';
$toolslink = $('#linux-tools');
}
- if (os) {
+ if (os != undefined) {
$('#not-supported').hide();
- /* set up primary adt download button */
- $('#download-bundle-button').show();
- $('#download-bundle-button').append("Download the SDK <br/><span class='small'>ADT Bundle for " + os + "</span>");
- $('#download-bundle-button').click(function() {return onDownload(this,true,true);}).attr('href', bundlename);
-
- /* set up sdk tools only button */
- $('#download-tools-button').show();
- $('#download-tools-button').append("Download the SDK Tools for " + os);
- $('#download-tools-button').click(function() {return onDownload(this,true);}).attr('href', $toolslink.attr('href'));
- } else {
- $('.pax').show();
+ /* set up primary Android Studio download button */
+ $('.download-bundle-button').append(" <br/><span class='small'>for " + os + "</span>");
+ $('.download-bundle-button').click(function() {return onDownload(this,true,true);}).attr('href', bundlename);
}
@@ -451,44 +449,29 @@
$("#downloadForRealz").html("Download " + $(link).text());
}
- /* if it's a bundle, show the 32/64-bit picker */
- if (bundle) {
- $("#downloadForRealz").attr('bundle','true');
- if ($("#downloadForRealz").text().indexOf("Mac") == -1) {
- $("p#bitpicker").show();
- } else {
- /* mac is always 64 bit, so set it checked */
- $("p#bitpicker input[value=64]").attr('checked', true);
- }
- /* save link name until the bit version is chosen */
- $("#downloadForRealz").attr('name',$(link).attr('href'));
- } else {
- /* if not using bundle, set download button to ignore bitpicker and set url */
- $("#downloadForRealz").attr('bundle','false');
- $("#downloadForRealz").attr('href',$(link).attr('href'));
- /* set picker checked as a fake default */
- $("p#bitpicker input[value=64]").attr('checked', true);
- $("a#next-link").html("Setting Up an Existing IDE").attr('href',toRoot + 'sdk/installing/index.html');
- }
+ $("#downloadForRealz").attr('bundle', bundle);
+ $("a#downloadForRealz").attr("name", $(link).attr('href'));
- $("#tos").fadeIn('fast');
- $("#landing").fadeOut('fast');
+ $("#tos").show();
+ $("#landing").hide();
- location.hash = "download";
+ location.hash = "top";
return false;
}
function onAgreeChecked() {
- /* verify that the TOS is agreed and a bit version is chosen */
- if ($("input#agree").is(":checked") && $("#bitpicker input:checked").length) {
+ /* verify that the TOS is agreed */
+ if ($("input#agree").is(":checked")) {
/* if downloading the bundle */
if ($("#downloadForRealz").attr('bundle')) {
- /* construct the name of the link we want based on the bit version */
- linkId = $("a#downloadForRealz").attr("name") + $("#bitpicker input:checked").val();
+ /* construct the name of the link we want */
+ linkId = $("a#downloadForRealz").attr("name");
/* set the real url for download */
$("a#downloadForRealz").attr("href", $(linkId).attr("href"));
+ } else {
+ $("a#downloadForRealz").attr("href", $("a#downloadForRealz").attr("name"));
}
/* reveal the download button */
@@ -499,16 +482,28 @@
}
function onDownloadForRealz(link) {
- if ($("input#agree").is(':checked') && $("#bitpicker input:checked").length) {
+ if ($("input#agree").is(':checked')) {
+ location.hash = "";
+ location.hash = "top";
$("div.sdk-terms").slideUp();
- $("#sdk-terms-form,.sdk-terms-intro").fadeOut('slow');
- $("#next-steps").fadeIn('slow');
- $("h1#tos-header").text('Get Ready to Code!');
- _gaq.push(['_trackEvent', 'SDK', 'ADT and Tools', $("#downloadForRealz").html()]);
+ $("h1#tos-header").text('Now downloading...');
+ $(".sdk-terms-intro").text('You\'ll be redirected to the install instructions in a moment.');
+ $("#sdk-terms-form").fadeOut('slow', function() {
+ setTimeout(function() {
+ if ($("#downloadForRealz").attr('bundle') == 'true') {
+ // User downloaded the studio Bundle
+ window.location = "/sdk/installing/index.html?pkg=studio";
+ } else {
+ // User downloaded the SDK Tools
+ window.location = "/sdk/installing/index.html?pkg=tools";
+ }
+ }, 3000);
+ });
+ ga('send', 'event', 'SDK', 'IDE and Tools', $("#downloadForRealz").html());
return true;
} else {
- $("label#agreeLabel,#bitpicker input").parent().stop().animate({color: "#258AAF"}, 200,
- function() {$("label#agreeLabel,#bitpicker input").parent().stop().animate({color: "#222"}, 200)}
+ $("label#agreeLabel").parent().stop().animate({color: "#258AAF"}, 200,
+ function() {$("label#agreeLabel").parent().stop().animate({color: "#222"}, 200)}
);
return false;
}
diff --git a/tools/droiddoc/templates-sdk-dyn/timestamp.cs b/tools/droiddoc/templates-ndk/timestamp.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/timestamp.cs
copy to tools/droiddoc/templates-ndk/timestamp.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/trailer.cs b/tools/droiddoc/templates-ndk/trailer.cs
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/trailer.cs
copy to tools/droiddoc/templates-ndk/trailer.cs
diff --git a/tools/droiddoc/templates-pdk/assets/images/android_logo.png b/tools/droiddoc/templates-pdk/assets/images/android_logo.png
new file mode 100644
index 0000000..4040f3f
--- /dev/null
+++ b/tools/droiddoc/templates-pdk/assets/images/android_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-pdk/components/masthead.cs b/tools/droiddoc/templates-pdk/components/masthead.cs
index 05437f3..874c11c 100644
--- a/tools/droiddoc/templates-pdk/components/masthead.cs
+++ b/tools/droiddoc/templates-pdk/components/masthead.cs
@@ -1,10 +1,9 @@
-<?cs
+<?cs
def:custom_masthead() ?>
<div id="header">
<div id="headerLeft">
<a href="<?cs var:toroot ?>guide/index.html"><img
- src="<?cs var:toroot ?>assets/images/android-partner-logo.png" alt="Android Platform Development Kit" /></a>
-
+ src="<?cs var:toroot ?>assets/images/android_logo.png" alt="Android Platform Development Kit" /></a>
</div>
<div id="headerRight">
<div id="headerLinks">
diff --git a/tools/droiddoc/templates-sac/assets/css/default.css b/tools/droiddoc/templates-sac/assets/css/default.css
index c1a0c19..9b1fe5a 100644
--- a/tools/droiddoc/templates-sac/assets/css/default.css
+++ b/tools/droiddoc/templates-sac/assets/css/default.css
@@ -408,7 +408,7 @@
.content-header.just-links {
margin-bottom:0;
padding-bottom:0;}
-
+
.content-header h1 {
color:#000;
margin:0;
@@ -420,8 +420,12 @@
border-top: 1px solid #ccc;
margin-top: 10px;
padding-top:10px;
- height: 30px; }
+ height: 30px;
+}
+.content-footer-sac {
+ border-top: 1px solid #ccc;
+}
.content-footer .col-9 {
margin-left:0;
}
@@ -1093,8 +1097,12 @@
li {
margin:0 0 5px;
}
+dt {
+ font-weight:bold;
+}
dd {
margin:0 0 10px 30px;
+ padding: 5px;
}
dd p,
dd pre,
@@ -1503,7 +1511,7 @@
.devices a.selected {
color: #F80;
}
-.accessories a.selected {
+.security a.selected {
color: #9C0;
}
.compatibility a.selected {
@@ -2200,6 +2208,7 @@
#nav-swap {
height:30px;
border-top:1px solid #ccc;
+ display: none;
}
#nav-swap a {
display:inline-block;
@@ -2234,6 +2243,10 @@
margin-left:0;
}
+#nav-tree, #swapper {
+ display: none;
+}
+
#nav-tree ul {
list-style:none;
padding:0;
@@ -2328,11 +2341,13 @@
border-bottom: 1px solid #CCC;
background:#e9e9e9;
background: rgba(0, 0, 0, 0.05); /* matches #nav li.expanded */
+ display: none;
}
#api-nav-title {
padding:0 5px;
white-space:nowrap;
+ display: none;
}
#api-level-toggle {
@@ -3572,8 +3587,9 @@
border-color: #33b5e5;
}
+// Fudging this so SAC looks OK
.develop #header .wrap {
- border-color: #F80;
+ border-color: #CCC;
}
.distribute #header .wrap {
@@ -4457,6 +4473,11 @@
float:right;
}
+.feedback {
+ float:right !important;
+ margin: 0 0 0 10px;
+ font-size: 14px;
+}
/************* HOME/LANDING PAGE *****************/
@@ -4551,3 +4572,87 @@
.fullpage #footer {
margin-top: -40px;
}
+
+.annotation-message {
+ display: block;
+}
+
+.dac-custom-search {
+ background: #fff;
+ margin: 0 -10px;
+ padding: 20px 10px;
+ z-index: 1;
+}
+
+.dac-custom-search .dac-fab, .dac-custom-search .dac-button-social {
+ top: -48px;
+}
+
+.dac-custom-search-section-title {
+ color: #505050;
+}
+
+.dac-custom-search-entry {
+ margin-bottom: 36px;
+ margin-top: 24px;
+ margin-left: 0em;
+}
+
+.dac-custom-search-image {
+ background-size: cover;
+ height: 112px;
+}
+
+.dac-custom-search-title {
+ color: #333;
+ font-size: 14px;
+ font-weight: 700;
+ line-height: 0px;
+ padding: 0;
+ margin: 1em 0em 1em 0em;
+}
+
+.dac-custom-search-title a {
+ color: inherit;
+}
+
+.dac-custom-search-section {
+ color: #999;
+ font-size: 16px;
+ font-variant: small-caps;
+ font-weight: 700;
+ margin: -5px 0 0 0;
+}
+
+.dac-custom-search-snippet {
+ color: #666;
+ margin: 0em 0em .25em 0em;
+}
+
+.dac-custom-search-link {
+ font-weight: 500;
+ word-wrap: break-word;
+ width: 100%;
+}
+
+.dac-custom-search-load-more {
+ background: none;
+ border: none;
+ color: #333;
+ cursor: pointer;
+ display: block;
+ font-size: 14px;
+ font-weight: 700;
+ margin: 75px auto;
+ outline: none;
+ padding: 10px;
+}
+
+.dac-custom-search-load-more:hover {
+ opacity: 0.7;
+}
+
+.dac-custom-search-no-results {
+ color: #999;
+}
+
diff --git a/tools/droiddoc/templates-sac/assets/js/docs.js b/tools/droiddoc/templates-sac/assets/js/docs.js
index d3a9223..d0c12a8 100644
--- a/tools/droiddoc/templates-sac/assets/js/docs.js
+++ b/tools/droiddoc/templates-sac/assets/js/docs.js
@@ -1630,7 +1630,10 @@
} else {
// otherwise, results are already showing, so allow ajax to auto refresh the results
// and ignore this Enter press to avoid the reload.
- return false;
+ // return false;
+ //
+ // For now, we're not using AJAX so we respond to every Enter.
+ return true;
}
} else if (kd && gSelectedIndex >= 0) {
window.location = $("a",$('#search_filtered li')[gSelectedIndex]).attr("href");
@@ -1691,6 +1694,11 @@
// Search for Google matches
+ /*
+ * Commented this out because GOOGLE_DATA not defined for us and code
+ * causes an error. This probably has to do with the missing
+ * gms_lists.js file in SAC. TODO figure it all out.
+ *
for (var i=0; i<GOOGLE_DATA.length; i++) {
var s = GOOGLE_DATA[i];
if (text.length != 0 &&
@@ -1703,6 +1711,7 @@
for (var i=0; i<gGoogleMatches.length; i++) {
var s = gGoogleMatches[i];
}
+ */
highlight_autocomplete_result_labels(text);
sync_selection_table(toroot);
@@ -1830,81 +1839,138 @@
$("#search_autocomplete").val("").blur();
// reset the ajax search callback to nothing, so results don't appear unless ENTER
- searchControl.setSearchStartingCallback(this, function(control, searcher, query) {});
+ // searchControl.setSearchStartingCallback(this, function(control, searcher, query) {});
return false;
}
-
/* ########################################################## */
/* ################ CUSTOM SEARCH ENGINE ################## */
/* ########################################################## */
-google.load('search', '1');
-var searchControl;
+// TODO, add localized search.
+function getLangPref() {
+ return "en";
+}
+
+// Package of functions that does custom search, from DAC redesign.
+(function($) {
+ var LANG;
+
+ function getSearchLang() {
+ if (!LANG) {
+ LANG = getLangPref();
+
+ // Fix zh-cn to be zh-CN.
+ LANG = LANG.replace(/-\w+/, function(m) { return m.toUpperCase(); });
+ }
+ return LANG;
+ }
+
+ function customSearch(query, start) {
+ var searchParams = {
+ // Keys for SAC
+ cx:'016258643462168859875:qqpm8fiwgc0',
+ key: 'AIzaSyBOWHD3JAF6Q9LIJ4NiahGAF70W7iDAI9M',
+
+ // Keys for DAC
+ // cx: '000521750095050289010:zpcpi1ea4s8',
+ // key: 'AIzaSyCFhbGnjW06dYwvRCU8h_zjdpS4PYYbEe8',
+
+ q: query,
+ start: start || 1,
+ num: 6,
+ hl: getSearchLang(),
+ fields: 'queries,items(pagemap,link,title,htmlSnippet,formattedUrl)'
+ };
+
+ return $.get('https://content.googleapis.com/customsearch/v1?' + $.param(searchParams));
+ }
+
+ function renderResults(el, results) {
+ if (!results.items) {
+ el.append($('<div>').text('No results'));
+ return;
+ }
+
+ for (var i = 0; i < results.items.length; i++) {
+ var item = results.items[i];
+ // No thumbnail images in SAC.
+ // var hasImage = item.pagemap && item.pagemap.cse_thumbnail;
+ var sectionMatch = item.link.match(/source\.android\.com\/(\w*)/);
+ var section = (sectionMatch && sectionMatch[1]) || 'blog';
+
+ var entry = $('<div>').addClass('dac-custom-search-entry cols');
+
+// No thumbnail images in SAC.
+// if (hasImage) {
+// var image = item.pagemap.cse_thumbnail[0];
+// entry.append($('<div>').addClass('col-1of6')
+// .append($('<div>').addClass('dac-custom-search-image').css('background-image', 'url(' + image.src + ')')));
+// }
+// entry.append($('<div>').addClass(hasImage ? 'col-5of6' : 'col-6of6')
+ entry.append($('<div>')
+ .append($('<p>').addClass('dac-custom-search-section').text(section))
+ .append(
+ $('<a>').text(item.title).attr('href', item.link).wrap('<h2>').parent().addClass('dac-custom-search-title')
+ )
+ .append($('<p>').addClass('dac-custom-search-snippet').html(item.htmlSnippet.replace(/<br>/g, '')))
+ .append($('<a>').addClass('dac-custom-search-link').text(item.formattedUrl).attr('href', item.link)));
+
+ el.append(entry);
+ }
+
+ if (results.queries.nextPage) {
+ var loadMoreButton = $('<button id="dac-custom-search-load-more">')
+ .addClass('dac-custom-search-load-more')
+ .text('Load more')
+ .click(function() {
+ loadMoreResults(el, results);
+ });
+
+ el.append(loadMoreButton);
+ }
+ }
+
+ function loadMoreResults(el, results) {
+ var query = results.queries.request.searchTerms;
+ var start = results.queries.nextPage.startIndex;
+ var loadMoreButton = el.find('#dac-custom-search-load-more');
+
+ loadMoreButton.text('Loading more...');
+
+ customSearch(query, start).then(function(results) {
+ loadMoreButton.remove();
+ renderResults(el, results);
+ });
+ }
+
+ $.fn.customSearch = function(query) {
+ var el = $(this);
+
+ customSearch(query).then(function(results) {
+ el.empty();
+ renderResults(el, results);
+ });
+ };
+})(jQuery);
+
function loadSearchResults() {
- document.getElementById("search_autocomplete").style.color = "#000";
- // create search control
- searchControl = new google.search.SearchControl();
-
- // use our existing search form and use tabs when multiple searchers are used
- drawOptions = new google.search.DrawOptions();
- drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
- drawOptions.setInput(document.getElementById("search_autocomplete"));
-
- // configure search result options
- searchOptions = new google.search.SearcherOptions();
- searchOptions.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
-
- // Configure s.a.c searchers
- sacSiteSearcher = new google.search.WebSearch();
- sacSiteSearcher.setUserDefinedLabel("All");
- sacSiteSearcher.setSiteRestriction("http://source.android.com/");
-
- sourceSearcher = new google.search.WebSearch();
- sourceSearcher.setUserDefinedLabel("Source");
- sourceSearcher.setSiteRestriction("http://source.android.com/source/");
-
- devicesSearcher = new google.search.WebSearch();
- devicesSearcher.setUserDefinedLabel("Devices");
- devicesSearcher.setSiteRestriction("http://source.android.com/devices/");
-
- accessoriesSearcher = new google.search.WebSearch();
- accessoriesSearcher.setUserDefinedLabel("Accessories");
- accessoriesSearcher.setSiteRestriction("http://source.android.com/accessories/");
-
- compatibilitySearcher = new google.search.WebSearch();
- compatibilitySearcher.setUserDefinedLabel("Compatibility");
- compatibilitySearcher.setSiteRestriction("http://source.android.com/compatibility/");
-
- // add each searcher to the search control
- searchControl.addSearcher(sacSiteSearcher, searchOptions);
- searchControl.addSearcher(sourceSearcher, searchOptions);
- searchControl.addSearcher(devicesSearcher, searchOptions);
- searchControl.addSearcher(accessoriesSearcher, searchOptions);
- searchControl.addSearcher(compatibilitySearcher, searchOptions);
+ // Draw the search results box
+ //searchControl.draw(document.getElementById("leftSearchControl"), drawOptions);
+ $(searchResults).append('<div class="leftSearchControl"></div>');
- // configure result options
- searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
- searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
- searchControl.setTimeoutInterval(google.search.SearchControl.TIMEOUT_SHORT);
- searchControl.setNoResultsString(google.search.SearchControl.NO_RESULTS_DEFAULT_STRING);
-
- // upon ajax search, refresh the url and search title
- searchControl.setSearchStartingCallback(this, function(control, searcher, query) {
- updateResultTitle(query);
- var query = document.getElementById('search_autocomplete').value;
- location.hash = 'q=' + query;
- });
-
- // draw the search results box
- searchControl.draw(document.getElementById("leftSearchControl"), drawOptions);
+ // Refresh the url and search title
+ var query = document.getElementById('search_autocomplete').value || getQuery(location.hash);
+ updateResultTitle(query);
+ location.hash = 'q=' + query;
// get query and execute the search
- searchControl.execute(decodeURI(getQuery(location.hash)));
+ //searchControl.execute(decodeURI(getQuery(location.hash)));
+ $(leftSearchControl).customSearch(getQuery(location.hash));
document.getElementById("search_autocomplete").focus();
addTabListeners();
@@ -1912,7 +1978,9 @@
// End of loadSearchResults
google.setOnLoadCallback(function(){
- if (location.hash.indexOf("q=") == -1) {
+
+ var query = decodeURI(getQuery(location.hash));
+ if (location.hash.indexOf("q=") == -1 || query == '') {
// if there's no query in the url, don't search and make sure results are hidden
$('#searchResults').hide();
return;
@@ -1937,7 +2005,8 @@
// Otherwise, we have a search to do
var query = decodeURI(getQuery(location.hash));
- searchControl.execute(query);
+ //searchControl.execute(query);
+ $('#leftSearchControl').customSearch(query);
$('#searchResults').slideDown('slow');
$("#search_autocomplete").focus();
$(".search .close").removeClass("hide");
@@ -1946,7 +2015,7 @@
});
function updateResultTitle(query) {
- $("#searchTitle").html("Results for <em>" + escapeHTML(query) + "</em>");
+ $("#searchTitle").html("Results for <em>" + encodeURIComponent(query) + "</em>");
}
// forcefully regain key-up event control (previously jacked by search api)
@@ -1983,18 +2052,6 @@
return queryParts[1];
}
-/* returns the given string with all HTML brackets converted to entities
- TODO: move this to the site's JS library */
-function escapeHTML(string) {
- return string.replace(/</g,"<")
- .replace(/>/g,">");
-}
-
-
-
-
-
-
/* ######################################################## */
/* ################# JAVADOC REFERENCE ################### */
@@ -2077,7 +2134,9 @@
// 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);
+// Another piece of functionality that we don't use that produces an error.
+// TODO figure it all out.
+// selectedLevelItem.setAttribute('selected',true);
}
function changeApiLevel() {
diff --git a/tools/droiddoc/templates-sac/class.cs b/tools/droiddoc/templates-sac/class.cs
index 0461af6..440e705 100644
--- a/tools/droiddoc/templates-sac/class.cs
+++ b/tools/droiddoc/templates-sac/class.cs
@@ -123,6 +123,7 @@
<?cs /if ?>
<?cs set:colspan = colspan-1 ?>
<?cs /each ?>
+<?cs call:show_annotations_list(class, "<span class='annotation-message'>", "</span><span class='annotation-message'>", "</span>") ?>
</div><!-- end header -->
@@ -184,7 +185,6 @@
<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) ?>
@@ -210,7 +210,10 @@
<?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>
+ <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?>
+ <?cs each:anno = field.showAnnotations ?>
+ <?cs call:show_annotations_list(field, "<span class='annotation-message'>", "</span><span class='annotation-message'>", "</span>") ?>
+ <?cs /each ?></td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -535,7 +538,6 @@
<?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>
diff --git a/tools/droiddoc/templates-sac/components/masthead.cs b/tools/droiddoc/templates-sac/components/masthead.cs
index a8618c0..ee2582f 100644
--- a/tools/droiddoc/templates-sac/components/masthead.cs
+++ b/tools/droiddoc/templates-sac/components/masthead.cs
@@ -255,7 +255,7 @@
<a href="<?cs var:toroot ?>index.html">
<img src="<?cs var:toroot ?>assets/images/sac_logo.png"
srcset="<?cs var:toroot ?>assets/images/sac_logo@2x.png 2x"
- width="123" height="25" alt="Android Developers" />
+ width="123" height="25" alt="Android Open Source Project" />
</a>
</div>
<ul class="nav-x col-9">
@@ -266,9 +266,9 @@
<li class="devices"><a href="<?cs var:toroot ?>devices/index.html" <?cs
if:devices ?>class="selected"<?cs /if ?>
>Devices</a></li>
- <li class="accessories"><a href="<?cs var:toroot ?>accessories/index.html" <?cs
- if:accessories ?>class="selected"<?cs /if ?>
- >Accessories</a></li>
+ <li class="security"><a href="<?cs var:toroot ?>security/index.html" <?cs
+ if:security ?>class="selected"<?cs /if ?>
+ >Security</a></li>
<li class="compatibility last"><a href="<?cs var:toroot ?>compatibility/index.html" <?cs
if:compatibility ?>class="selected"<?cs /if ?>
>Compatibility</a></li>
diff --git a/tools/droiddoc/templates-sac/customizations.cs b/tools/droiddoc/templates-sac/customizations.cs
index 6bdfe36..1120e70 100644
--- a/tools/droiddoc/templates-sac/customizations.cs
+++ b/tools/droiddoc/templates-sac/customizations.cs
@@ -355,7 +355,7 @@
def:custom_footerlinks() ?>
<p>
<a href="<?cs var:toroot ?>source/index.html">About Android</a> |
- <a href="<?cs var:toroot ?>source/community/index.html">Community</a> |
+ <a href="<?cs var:toroot ?>source/community.html">Community</a> |
<a href="<?cs var:toroot ?>legal.html">Legal</a> |
</p><?cs
/def ?>
@@ -382,8 +382,8 @@
<?cs call:compatibility_nav() ?>
<?cs elif:source ?>
<?cs call:source_nav() ?>
- <?cs elif:accessories ?>
- <?cs call:accessories_nav() ?>
+ <?cs elif:security ?>
+ <?cs call:security_nav() ?>
<?cs elif:reference ?>
<?cs call:default_left_nav() ?>
<?cs /if ?>
@@ -450,14 +450,14 @@
<?cs /def ?>
<?cs
-def:accessories_nav() ?>
+def:security_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<?cs
- include:"../../../../docs/source.android.com/src/accessories/accessories_toc.cs" ?>
+ include:"../../../../docs/source.android.com/src/security/security_toc.cs" ?>
</div>
</div> <!-- end side-nav -->
diff --git a/tools/droiddoc/templates-sac/docpage.cs b/tools/droiddoc/templates-sac/docpage.cs
index 3e5c24f..3d120b6 100644
--- a/tools/droiddoc/templates-sac/docpage.cs
+++ b/tools/droiddoc/templates-sac/docpage.cs
@@ -34,7 +34,7 @@
ru-lang="Предыдущий"
ko-lang="이전"
ja-lang="前へ"
- es-lang="Anterior"
+ es-lang="Anterior"
>Previous</a>
<a href="#" class="next-page-link hide"
zh-TW-lang="下一堂課"
@@ -42,7 +42,7 @@
ru-lang="Следующий"
ko-lang="다음"
ja-lang="次へ"
- es-lang="Siguiente"
+ es-lang="Siguiente"
>Next</a>
<a href="#" class="start-class-link hide"
zh-TW-lang="開始上課"
@@ -50,7 +50,7 @@
ru-lang="Начало работы"
ko-lang="시작하기"
ja-lang="開始する"
- es-lang="Empezar"
+ es-lang="Empezar"
>Get started</a>
</div>
<?cs elif:!page.trainingcourse ?>
@@ -61,7 +61,7 @@
ru-lang="Предыдущий"
ko-lang="이전"
ja-lang="前へ"
- es-lang="Anterior"
+ es-lang="Anterior"
>Previous</a>
<a href="#" class="next-page-link hide"
zh-TW-lang="下一堂課"
@@ -69,7 +69,7 @@
ru-lang="Следующий"
ko-lang="다음"
ja-lang="次へ"
- es-lang="Siguiente"
+ es-lang="Siguiente"
>Next</a>
</div>
<?cs /if ?><?cs # end if training ?>
@@ -87,7 +87,6 @@
<?cs /if ?>
<h1 itemprop="name" style="margin-bottom:0;"><?cs var:page.title ?></h1>
<p itemprop="description"><?cs var:page.landing.intro ?></p>
-
<p><a class="next-page-link topic-start-link"></a></p>
<?cs if:page.landing.image ?>
</div>
@@ -112,22 +111,16 @@
<?cs # THIS IS THE MAIN DOC CONTENT ?>
<div id="jd-content">
-
<div class="jd-descr" itemprop="articleBody">
<?cs call:tag_list(root.descr) ?>
</div>
-
- <div class="content-footer <?cs
- if:fullpage ?>wrap<?cs
- else ?>layout-content-row<?cs /if ?>"
+
+ <div class="content-footer-sac"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col <?cs
if:fullpage ?>col-16<?cs
elif:training||guide ?>col-8<?cs
else ?>col-9<?cs /if ?>" style="padding-top:4px">
- <?cs if:!page.noplus ?><?cs if:fullpage ?><style>#___plusone_0 {float:right !important;}</style><?cs /if ?>
- <div class="g-plusone" data-size="medium"></div>
- <?cs /if ?>
</div>
<?cs if:!fullscreen ?>
<div class="paging-links layout-content-col col-4">
@@ -138,7 +131,7 @@
ru-lang="Предыдущий"
ko-lang="이전"
ja-lang="前へ"
- es-lang="Anterior"
+ es-lang="Anterior"
>Previous</a>
<a href="#" class="next-page-link hide"
zh-TW-lang="下一堂課"
@@ -146,23 +139,20 @@
ru-lang="Следующий"
ko-lang="다음"
ja-lang="次へ"
- es-lang="Siguiente"
+ es-lang="Siguiente"
>Next</a>
<?cs /if ?>
</div>
<?cs /if ?>
</div>
-
<?cs # for training classes, provide a different kind of link when the next page is a different class ?>
<?cs if:training && !page.article ?>
<div class="layout-content-row content-footer next-class" style="display:none" itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="#" class="next-class-link hide">Next class: </a>
</div>
<?cs /if ?>
-
- </div> <!-- end jd-content -->
-
-<?cs include:"footer.cs" ?>
+ </div> <!-- end jd-content -->
+ <?cs include:"footer.cs" ?>
</div><!-- end doc-content -->
<?cs include:"trailer.cs" ?>
diff --git a/tools/droiddoc/templates-sac/footer.cs b/tools/droiddoc/templates-sac/footer.cs
index 6979ca0..e43adb0 100644
--- a/tools/droiddoc/templates-sac/footer.cs
+++ b/tools/droiddoc/templates-sac/footer.cs
@@ -1,4 +1,9 @@
<div id="footer" class="wrap" <?cs if:fullpage ?>style="width:940px"<?cs /if ?>>
+ <style>.feedback { float: right !Important }</style>
+ <div class="feedback">
+ <a href="#" class="button" onclick=" try {
+ userfeedback.api.startFeedback({'productId':'715571','authuser':'1'});return false;}catch(e){}">Site Feedback</a>
+ </div>
<div id="copyright">
<?cs call:custom_cc_copyright() ?>
</div>
diff --git a/tools/droiddoc/templates-sac/head_tag.cs b/tools/droiddoc/templates-sac/head_tag.cs
index 5cee68c..b672b25 100644
--- a/tools/droiddoc/templates-sac/head_tag.cs
+++ b/tools/droiddoc/templates-sac/head_tag.cs
@@ -46,6 +46,8 @@
<script src="<?cs var:toroot ?>navtree_data.js" async type="text/javascript"></script>
<?cs /if ?>
+<script type="text/javascript" src="//www.gstatic.com/feedback/api.js"></script>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-45455297-1']);
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/GPL-LICENSE.txt b/tools/droiddoc/templates-sdk-dev/assets/GPL-LICENSE.txt
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/GPL-LICENSE.txt
rename to tools/droiddoc/templates-sdk-dev/assets/GPL-LICENSE.txt
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/LICENSE.txt b/tools/droiddoc/templates-sdk-dev/assets/LICENSE.txt
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/LICENSE.txt
rename to tools/droiddoc/templates-sdk-dev/assets/LICENSE.txt
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/android-developer-docs.css b/tools/droiddoc/templates-sdk-dev/assets/android-developer-docs.css
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/android-developer-docs.css
rename to tools/droiddoc/templates-sdk-dev/assets/android-developer-docs.css
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/css/default.css b/tools/droiddoc/templates-sdk-dev/assets/css/default.css
similarity index 84%
rename from tools/droiddoc/templates-sdk-dyn/assets/css/default.css
rename to tools/droiddoc/templates-sdk-dev/assets/css/default.css
index e26aec6..cc4dce7 100644
--- a/tools/droiddoc/templates-sdk-dyn/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk-dev/assets/css/default.css
@@ -158,12 +158,6 @@
.layout-content-row {
display: inline-block;
margin-bottom: 10px; }
- .layout-content-row:after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden; }
* html .layout-content-row {
height: 1px; }
@@ -430,20 +424,19 @@
/* content header */
.content-header {
height: 30px;
- margin:20px 0 25px;
- padding:0 0 10px;}
+ margin:36px 0 23px; /* same as h1 */
+ padding:0 0 10px;} /* same as h1 */
.content-header.just-links {
margin-bottom:0;
padding-bottom:0;}
.content-header h1 {
- color:#000;
margin:0;
- border-bottom:0;
padding:0;
+ width: 700px;
}
.content-header > div:first-child {
- height:55px; /* set fixed height for the header div to ensure the
+ height:1px; /* set fixed height for the header div to ensure the
next/prev links align with toc on training classes */
}
@@ -451,7 +444,7 @@
border-top: 1px solid #ccc;
margin-top: 10px;
padding-top:10px;
- height: 30px; }
+ width:100%; }
.content-footer .col-9 {
margin-left:0;
@@ -462,20 +455,33 @@
.content-footer.wrap {
width:940px;
}
+.content-footer .plus-container {
+ margin:5px 0 0;
+ text-align:right;
+ float:right;
+}
+a.back-link {
+ text-decoration: none;
+ text-transform: uppercase;
+}
+
+.content-header .paging-links {
+ margin-top:-25px;
+}
.paging-links {
- position: relative; }
+ position: relative;
+ height:30px; }
.paging-links a {
position: absolute; }
.paging-links a,
.training-nav-top a {
- font-size: 14px;
- line-height: 30px;
color: #555555;
text-decoration: none;
text-transform: uppercase; }
.paging-links .prev-page-link:before,
- .training-nav-top .prev-page-link:before {
+ .training-nav-top .prev-page-link:before,
+ a.back-link:before {
content: '';
background: transparent url(../images/styles/disclosure_left.png) no-repeat scroll 50% 50%;
width: 10px;
@@ -489,7 +495,7 @@
.paging-links .prev-page-link {
left: -15px; }
.paging-links .next-page-link {
- right: 0px; }
+ right: 0; }
.next-page-link:after,
.start-class-link:after,
.start-course-link:after,
@@ -506,6 +512,9 @@
.next-page-link.inline:after {
content: none; }
+ .content-footer .paging-links .next-page-link {
+ left:0;
+ }
.training-nav-top a {
display:block;
@@ -544,7 +553,6 @@
.paging-links a.start-class-link {
width:100%;
- text-align:right;
}
/* list of classes on course landing page */
@@ -623,19 +631,6 @@
display:none !important;
}
- .content-footer.next-class {
- display:block;
- border:0;
- margin-top:0;
- padding-top:0;
- }
-
- .content-footer.next-class a.next-class-link {
- display:block;
- float:right;
- text-transform:uppercase;
- }
-
/* inner-doc tabs w/ title */
@@ -713,6 +708,7 @@
color: #33b5e5;
border-bottom-color: #33b5e5; } }
+h1:target,
h2:target,
h3:target {
-webkit-animation-name: glowheader;
@@ -894,7 +890,7 @@
.framed-nexus4-port-216 img {
width: 216px;
height: 360px; }
-
+
.framed-nexus5-port-span-5 {
background: transparent url(../images/styles/device_nexus5_blank_port_span5.png) no-repeat
scroll top left;
@@ -929,6 +925,47 @@
height: 384px;
}
+/* wear device frames */
+
+.framed-wear-square {
+ background: transparent url(../images/styles/device_wear_square.png) no-repeat scroll top left;
+ background-size: 302px 302px;
+ height:222px;
+ width:222px;
+ padding:40px;
+ overflow:hidden;
+}
+
+.framed-wear-square-small {
+ background: transparent url(../images/styles/device_wear_square_small.png) no-repeat scroll top left;
+ background-size: 169px 200px;
+ height:147px;
+ width:147px;
+ padding:27px 11px;
+ overflow:hidden;
+}
+
+#jd-content
+.framed-wear-square img {
+ height:222px;
+ width: 222px;
+ padding:0;
+ margin:0;
+}
+
+#jd-content
+.framed-wear-square-small img {
+ height:147px;
+ width: 147px;
+ padding:0;
+ margin:0;
+}
+
+
+
+
+
+
/* landing page disclosures */
.landing-page-link {
text-decoration: none;
@@ -1102,12 +1139,13 @@
}
h1 {
color:#333;
- font-size: 22px;
- margin: 20px 0 20px;
+ font-size: 34px;
+ margin: 36px 0 27px;
padding:0 0 10px;
+ font-weight:300;
}
h1, h2 {
- line-height: 32px;
+ line-height: 30px;
}
h1.short {
margin-right:320px;
@@ -1120,21 +1158,24 @@
}
h2 {
color:#333;
- font-size: 20px;
- margin: 20px 0 20px;
+ font-size: 26px;
+ margin: 32px 0 20px;
padding:0;
+ font-weight:300;
}
h3 {
color:#333;
- font-size: 18px;
+ font-size: 21px;
+ font-weight:400;
+ margin:21px 0 14px 0;
}
h3, h4 {
- color:#333;
- line-height: 20px;
- margin: 10px 0;
+ line-height: 21px;
}
h4 {
- font-size: 16px;
+ font-size: 18px;
+ margin: 12px 0;
+ font-weight:500;
}
h5 {
font-size: 14px;
@@ -1147,7 +1188,7 @@
}
hr { /* applied to the bottom of h2 elements */
height: 1px;
- margin: 5px 0 20px;
+ margin: 3px 0 12px;
border: 0;
background: #ccc;
}
@@ -1208,7 +1249,7 @@
legend {
display: none;
}
-a:link, a:visited {
+a:link, a:visited, .link-color {
color: #258aaf;
text-decoration: none;
}
@@ -1216,6 +1257,13 @@
color: #33B5E5;
text-decoration: none;
}
+a.white {
+ color: #fff;
+ text-decoration:underline;
+}
+a.white:hover, a.white:active {
+ color: #ccc !important;
+}
strong, b {
font-weight:bold;
color: #222;
@@ -1249,6 +1297,7 @@
tr:first-of-type th:first-of-type:empty {
visibility: hidden;
}
+
/* --------------------------------------------------------------------------
Footer
*/
@@ -1523,6 +1572,9 @@
color: #333;
font-size: 16px;
}
+.about a.selected {
+ color: #9933CC;
+}
.design a.selected {
color: #33b5e5;
}
@@ -1834,6 +1886,11 @@
margin:0 0 0 20px;
}
+.training-nav-top {
+ position:relative;
+ top:73px;
+}
+
.training-nav-bottom {
padding:0 0 20px;
}
@@ -1842,12 +1899,12 @@
#qv-wrapper {
float:right;
clear:right;
- margin:0 0 0 30px; /* negative top-margin to counter the content-header bottom margin */
+ margin:6px 0 0 30px; /* negative top-margin to counter the content-header bottom margin */
padding:0 0 30px;
}
#tb-wrapper {
- margin:-29px 0 0 20px; /* negative top-margin to counter the content-header bottom margin */
+ margin:51px 0 0 20px; /* negative top-margin to counter the content-header bottom margin */
}
#tb,
@@ -1931,6 +1988,10 @@
margin:0 15px 10px 35px;
}
+#tb p {
+ margin:0 15px 10px;
+}
+
#qv ol {
list-style:none;
margin:0 15px 15px;
@@ -1959,28 +2020,12 @@
/* related resources blocks in checklists */
-.rel-resources {
- margin:10px 0px;
- border:1px solid #ccc;
- background-color:rgba(0, 0, 0, 0.027451);
- border:1px solid #ccc;
- font-size:13px;
- color:#6f6f6f;
-}
+/* related resources sections that have dynamic content */
-.rel-resources ul {
-padding: .5em 1em 0 1em;
-}
-.rel-resources a {
-font-weight:500;
-}
-.rel-resources h3 {
- margin:4px 15px 0px 15px;
- font-size:13px;
- font-weight:600;
- text-transform:uppercase;
+h3.rel-resources {
+margin:1.25em auto;
}
/* --------------------------------------------------------------------------
@@ -2360,6 +2405,13 @@
#doc-col {
margin-right:0;
}
+
+/* Uncomment this for preview release watermark
+#doc-col {
+ background: url('../images/preview.png') repeat;
+}
+*/
+
#doc-content-container {
margin-left: 291px
}
@@ -2725,19 +2777,22 @@
width:100%;
}
#butterbar {
- width:940px;
+ width:100%;
margin:0 auto;
}
#butterbar-message {
- background-color:#f80;
- float:right;
- font-size:12px;
- font-weight:bold;
- padding:0 10px;
- border-radius: 0 0 5px 5px;
+ background-color:rgba(255, 187, 51, .4);
+ font-size:13px;
+ padding: 5px 0;
+ text-align:center;
}
-#butterbar-message a {color:#fff !important}
-#butterbar-message a:hover {text-decoration:underline;}
+a#butterbar-message {
+ cursor:pointer;
+ display:block;
+}
+a#butterbar-message:hover {
+ text-decoration:underline;
+}
/* --------------------------------------------------------------------------
Misc
@@ -2761,7 +2816,7 @@
.caption {
margin: 0.5em 0 2em 0;
color: #000;
- font-size: 11.5px;
+ font-size: 11.5px;
}
.nolist, .nolist ul, .nolist ol {
@@ -2910,7 +2965,8 @@
a.notice-developers-video,
a.notice-developers,
a.notice-designers-video,
-a.notice-designers {
+a.notice-designers,
+a.notice-designers-material {
float:right;
clear:right;
width:238px;
@@ -2921,13 +2977,15 @@
a.notice-developers-video.wide,
a.notice-developers.wide,
a.notice-designers-video.wide,
-a.notice-designers.wide {
+a.notice-designers.wide,
+a.notice-designers-material.wide {
width:278px;
}
a.notice-developers-video div,
a.notice-developers div,
a.notice-designers-video div,
-a.notice-designers div {
+a.notice-designers div,
+a.notice-designers-material div {
min-height:40px;
background:url('../images/styles/notice-developers@2x.png') no-repeat 10px 10px;
background-size:40px 40px;
@@ -2945,16 +3003,22 @@
background:url('../images/styles/notice-developers-video@2x.png') no-repeat 10px 10px;
background-size:40px 40px;
}
+a.notice-designers-material div {
+ background:url('../images/styles/notice-designers-material@2x.png') no-repeat 10px 10px;
+ background-size:40px 40px;
+}
a.notice-developers-video:hover,
a.notice-developers:hover,
a.notice-designers-video:hover,
-a.notice-designers:hover {
+a.notice-designers:hover,
+a.notice-designers-material:hover {
background:#eee;
}
a.notice-developers-video h3,
a.notice-developers h3,
a.notice-designers-video h3,
-a.notice-designers h3 {
+a.notice-designers h3,
+a.notice-designers-material h3 {
font-size:13px;
line-height:18px;
font-weight:bold;
@@ -2965,14 +3029,16 @@
a.notice-developers-video p,
a.notice-developers p,
a.notice-designers-video p,
-a.notice-designers p {
+a.notice-designers p,
+a.notice-designers-material p {
margin:0;
line-height:14px;
}
a.notice-developers-video.left,
a.notice-developers.left,
a.notice-designers-video.left,
-a.notice-designers.left {
+a.notice-designers.left,
+a.notice-designers-material.left {
margin-left:0;
float:left;
}
@@ -2994,6 +3060,34 @@
}
+/* for IDE instruction toggle (Studio/Eclipse/Other) */
+select.ide {
+ background: transparent;
+ border: 1px solid #bbb;
+ border-left: 0;
+ border-right: 0;
+ margin: 10px 0;
+ padding: 10px 0;
+ color:#666;
+}
+select.ide,
+select.ide option {
+ font-family: inherit;
+ font-size:16px;
+ font-weight:500;
+}
+/* hide all except studio by default */
+.select-ide.eclipse,
+.select-ide.other {
+ display:none;
+}
+/* ... unless studio also includes one of the others */
+.select-ide.studio.eclipse,
+.select-ide.studio.other {
+ display:none;
+}
+
+
/* -----------------------------------------------
good/bad example containers
*/
@@ -3072,6 +3166,7 @@
-webkit-box-shadow:-5px 5px 10px #ccc;
}
+div#langMessage,
div#naMessage {
display:none;
width:555px;
@@ -3079,6 +3174,8 @@
margin:0 auto;
}
+
+div#langMessage>div,
div#naMessage div {
z-index:99;
width:450px;
@@ -3092,12 +3189,16 @@
-webkit-box-shadow:-10px 10px 40px #888;
}
/* IE6 can't position fixed */
+* html div#langMessage>div,
* html div#naMessage div { position:absolute; }
div#naMessage strong {
font-size:1.1em;
}
+div#langMessage .lang {
+ display:none;
+}
/* --------------------------------------------------------------------------
Slideshow Controls & Next/Prev
@@ -3346,28 +3447,37 @@
}
#jd-header {
- padding: 0 0 5px;
- margin: 20px 0 10px;
- font-size:13px;
+ padding: 0 0 12px;
+ margin: 20px 0 12px;
+ font-size:12px;
+ padding-bottom:12px;
border-bottom:solid 1px #ccc;
}
#jd-header h1 {
margin:0;
- padding:0;
+ padding:0 0 6px 0;
}
+/* not sure if this is needed in the ref docs, disabling for now
+.jd-descr h2 {
+ margin:16px 0;
+}
+*/
+
/* page-top-right container for reference pages (holds
links to summary tables) */
#api-info-block {
- font-size:13px;
+ font-size:12px;
margin:20px 0 0;
padding:0 10px 6px;
font-weight:normal;
float:right;
text-align:right;
color:#999;
- max-width:70%;
+ max-width:80%;
+ font-size: 12px;
+ line-height:14px;
}
#api-info-block div.api-level {
@@ -3384,7 +3494,8 @@
border-spacing:0;
margin:0;
padding:0;
- font-size:13px;
+ font-size:12px;
+ line-height:14px;
background-color:transparent;
}
.jd-inheritance-table tr td {
@@ -3966,7 +4077,7 @@
height: 38px;
}
#header-wrapper #nav-x ul.nav-x li {
- margin-right: 36px !important;
+ margin-right: 31px !important;
margin-top: 5px;
margin-bottom: 0px;
height: 30px;
@@ -4093,6 +4204,7 @@
width: 26px;
height: 25px;
background: url(../images/dac_logo.png);
+ background-image: -webkit-image-set(url(../images/dac_logo.png) 1x, url(../images/dac_logo@2x.png) 2x);
z-index: 52;
position: relative;
}
@@ -4115,6 +4227,15 @@
z-index: 52;
}
+/* offset the <a name=""> tags to account for sticky nav */
+body.reference a[name],
+div.renderscript a[name] {
+ visibility: hidden;
+ display: block;
+ position: relative;
+ top: -56px;
+}
+
}
@@ -4168,13 +4289,13 @@
}
-#header-wrap .logo.wear-logo {
+#header-wrap .logo.landing-logo {
width:220px;
margin:0;
padding:0;
margin-bottom:22px;
}
-#header-wrap .logo.wear-logo img {
+#header-wrap .logo.landing-logo img {
padding:0 0 0 10px;
}
@@ -4246,7 +4367,7 @@
#quicknav {
float:none;
clear:both;
- margin-left:180px;
+ margin-left:0;
margin-top:-30px;
display:none;
overflow:hidden;
@@ -4261,6 +4382,10 @@
padding:0;
}
+#quicknav ul li.about {
+ border-top:1px solid #9933CC;
+}
+
#quicknav ul li.design {
border-top:1px solid #33b5e5;
}
@@ -4311,7 +4436,7 @@
}
#header-wrap.quicknav {
- height:196px;
+ height:216px;
}
@@ -4590,7 +4715,9 @@
}
-
+#landing h1 {
+ margin:17px 0 20px 0 !important;
+}
a.download-sdk {
float:right;
@@ -4761,14 +4888,14 @@
/* Slideshow */
.slideshow-develop {
- height: 300px;
+ height: 316px;
width: 940px;
position: relative;
overflow:hidden;
}
.slideshow-develop .frame {
width: 940px;
- height: 300px;
+ height: 316px;
}
.slideshow-develop img.play {
max-width:350px;
@@ -4800,6 +4927,7 @@
padding:0;
margin-bottom:10px;
border:none;
+ font-size:24px;
}
.slideshow-develop .item {
height: 300px;
@@ -4972,7 +5100,8 @@
margin-bottom:0;
}
.landing-banner h1 {
- margin-top:0;
+ margin-top:16px;
+ padding-bottom:24px;
}
.landing-docs,
.landing-banner {
@@ -5127,22 +5256,6 @@
/************ DISTRIBUTE PAGES ******************/
-/* Article page header line fix */
-.headerLine {
- overflow: hidden;
-}
-.headerLine h1 {
- float: left;
- padding-right: 20px;
- margin-bottom: 0px;
- font-size: 20px;
- color: #363636;
-}
-.headerLine hr {
- overflow: hidden;
- margin: 42px 0 0 0;
-}
-
.article-detail #body-content {
padding-top: 10px;
}
@@ -5155,7 +5268,7 @@
text-transform:uppercase;
border-bottom:1px solid #CCC;
padding:8px 0 0 1px;
- margin-bottom:10px;
+ margin-bottom:14px;
clear:both;
}
@@ -5191,7 +5304,7 @@
/* Basic card-styling with shadow */
.resource-card {
border-radius: 1px;
- box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.14);
+ box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.12);
background: #fefefe;
}
@@ -5220,6 +5333,9 @@
-o-transition: opacity 0.5s;
transition: opacity 0.5s;
}
+.static .card-bg:after {
+ display:none;
+}
.card-bg .card-section-icon {
position: absolute;
top: 50%;
@@ -5366,18 +5482,21 @@
content: ".";
display: block;
height: 0;
+ position:relative;
clear: both;
visibility: hidden;
}
-
.resource-card:hover {
cursor: pointer;
}
+.static .resource-card:hover {
+ cursor: auto;
+}
.resource-card:hover .card-bg:after {
opacity: 0;
}
/* disabled to make way for fade/ellipsis truncation,
- and the plusone moves up.
+ and the plusone moves up.
.resource-card:hover .card-info .description .text {
padding-right: 70px;
} */
@@ -6289,6 +6408,17 @@
display: none;
}
+
+/* Override to show the description instead of the content section */
+.no-section .resource-card-3x2 > .card-info .section,
+.no-section .resource-card-6x2 > .card-info .section {
+ display: none;
+}
+.no-section .resource-card-3x2 > .card-info .description,
+.no-section .resource-card-6x2 > .card-info .description {
+ display: block;
+}
+
/* 1/2 row items */
.resource-card-3x3 > .card-bg, .resource-card-6x3 > .card-bg, .resource-card-9x3 > .card-bg, .resource-card-12x3 > .card-bg, .resource-card-15x3 > .card-bg, .resource-card-18x3 > .card-bg {
left: 0;
@@ -6383,4 +6513,940 @@
div.jd-descr > .resource-widget[data-section=distribute\/tools]
.section-card-menu .card-info ul li {
border-top-color: #7e3794 !important;
-}
\ No newline at end of file
+}
+
+
+
+/**
+ * UTILITIES
+ */
+
+
+.border-box {
+ box-sizing: border-box;
+}
+
+.vertical-center-outer {
+ display: table;
+ height: 100%;
+ width: 100%;
+}
+
+.vertical-center-inner {
+ display: table-cell;
+ vertical-align: middle;
+}
+
+/**
+ * TYPE STYLES
+ */
+
+.landing-h1 {
+ font-weight: 100;
+ font-size: 60px;
+ line-height: 78px;
+ text-align: center;
+ letter-spacing: -1px;
+}
+
+.landing-pre-h1 {
+ font-weight: 400;
+ font-size: 28px;
+ color: #93B73F;
+ line-height: 36px;
+ text-align: center;
+ letter-spacing: -1px;
+ text-transform: uppercase;
+
+}
+
+.landing-h1.hero {
+ text-align: left;
+}
+
+.landing-h2 {
+ font-weight: 300;
+ font-size: 42px;
+ line-height: 64px;
+ text-align: center;
+}
+
+.landing-subhead {
+ color: #999999;
+ font-size: 20px;
+ line-height: 28px;
+ font-weight:300;
+ text-align: center;
+}
+.landing-subhead.hero {
+ text-align: left;
+ color: white;
+}
+
+.landing-hero-description {
+ text-align: left;
+ margin: 1em 0;
+}
+
+.landing-hero-description p {
+ font-weight: 300;
+ margin: 0;
+ font-size: 18px;
+ line-height: 24px;
+}
+
+.landing-body .landing-small {
+ font-size: 14px;
+ line-height: 19px;
+}
+
+.landing-body.landing-align-center {
+ text-align: center;
+}
+
+.landing-align-left {
+ text-align: left;
+}
+
+/**
+ * LAYOUT
+ */
+
+#body-content,
+.fullpage,
+#jd-content,
+.jd-descr,
+.landing-body-content {
+ height: 100%;
+}
+
+.landing-section {
+ padding: 80px 10px 80px;
+ width: 100%;
+ margin-left: -10px;
+ text-rendering: optimizeLegibility;
+}
+
+#extending-android-to-wearables {
+ padding-top: 30px;
+}
+
+.landing-short-section {
+ padding: 40px 10px 28px;
+}
+
+.landing-gray-background {
+ background-color: #e9e9e9;
+}
+
+.landing-white-background {
+ background-color: white;
+}
+
+.landing-red-background {
+ color: white;
+ background-color: hsl(8, 70%, 54%);
+}
+
+.landing-subhead-red {
+ color: hsl(8, 71%, 84%);
+ text-align: left;
+}
+
+.landing-subhead-red p {
+ margin-top: 20px;
+}
+
+.landing-hero-container {
+ height: 100%;
+}
+
+
+.preview-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../preview/images/hero.jpg);
+ background-size: cover;
+ background-position: right center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.wear-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../wear/images/hero.jpg);
+ background-size: cover;
+ background-position: top center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.tv-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../tv/images/hero.jpg);
+ background-size: cover;
+ background-position: right center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.auto-hero {
+ height: calc(100% - 110px);
+ min-height: 504px;
+ margin-top: -5px;
+ padding-top: 0;
+ padding-bottom: 0;
+ background-image: url(../../auto/images/hero.jpg);
+ background-size: cover;
+ background-position: right center;
+ color: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.landing-hero-scrim {
+ background: black;
+ opacity: .2;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ margin-left: -10px;
+}
+
+.landing-hero-wrap {
+ margin: 0 auto;
+ width: 940px;
+ clear: both;
+ height: 100%;
+ position: relative;
+}
+
+.landing-section-header {
+ margin-bottom: 40px;
+}
+
+.landing-hero-wrap .landing-section-header {
+ margin-bottom: 16px;
+}
+
+.landing-body {
+ font-size: 18px;
+ line-height: 24px;
+}
+
+.landing-button {
+ white-space: nowrap;
+ display: inline-block;
+ padding: 16px 32px;
+ font-size: 18px;
+ font-weight: 500;
+ line-height: 24px;
+ cursor: pointer;
+ color: white;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+ -webkit-transition: .2s background-color ease-in-out;
+ -moz-transition: .2s background-color ease-in-out;
+ -o-transition: .2s background-color ease-in-out;
+ transition: .2s background-color ease-in-out;
+}
+
+.landing-primary {
+ background-color: hsl(8, 70%, 44%);
+ color: #f8f8f8;
+}
+
+.landing-button.landing-primary:hover {
+ background-color: hsl(8, 70%, 36%);
+}
+
+.landing-button.landing-primary:active {
+ background-color: hsl(8, 70%, 30%);
+}
+
+.landing-button.landing-secondary {
+ background-color: #2faddb;
+}
+
+.landing-button.landing-secondary:hover {
+ background-color: #09c;
+}
+
+.landing-button.landing-secondary:active {
+ background-color: #3990ab;
+}
+
+a.landing-button,
+a.landing-button:hover,
+a.landing-button:visited {
+ color: white !important;
+}
+
+.landing-video-link {
+ white-space: nowrap;
+ display: inline-block;
+ padding: 16px 32px 16px 82px;
+ font-size: 18px;
+ font-weight: 400;
+ line-height: 24px;
+ cursor: pointer;
+ color: hsla(0, 0%, 100%, .8);
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+ -webkit-transition: .2s color ease-in-out;
+ -moz-transition: .2s color ease-in-out;
+ -o-transition: .2s color ease-in-out;
+ transition: .2s color ease-in-out;
+}
+
+.landing-video-link:before {
+ height: 64px;
+ width: 64px;
+ display: inline-block;
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAFuklEQVR42u2dXWgcVRSAV9LWtBBTTZVWUhNqEQtq1QeroDRKFRFsROqTYPuo+JCiIoJKFC0USqlUfCiowRcfrBgVUUElefAPkW5T8aeaGn9aRbFsjP0x2cx8PuRMvFxmdjeb2Z17Z8+B85DsZPbO+eaec3/OPSkABdXsVI2gABSAqgJQAKoKQAGoKgAFoKoAFICqAlAAqgpAAai6DqDRAiwDeoFtwB7gPaAInABKwKToCWAMeB/YDdwJrAWWNLh9+QMAXABsBQ4A3wFTwAxQBmaBAAhjNJDPy3L938BXwAvArUCHAkh+kCXAVcA+YBw4bRg7MngtkgTlDPA98CywHmhTAP8/xCbgVeAvMZZpwDQllN7xB/AysKGlAQAXAvuBkzW85UVgCBgENlfQQbmuWAXELPAnsAvoaikAQBtwh/j3coLhS2LIfqCzzu/plL8fkvvFgZiR4L2lHrfkHQBgpQTFUwmGnwC212v0KjC2y/3jQPwDPA+05xYAcBHwubx1YZzhC02QBBBRbxgBzssdAOBy4JgRZE0ZTPuNr7FHDCbEhqNAd24AAN0yUbID7QSwsZChABut3hANXY8Bq70HIMb/Ocb4w81+66v0hmGrN0QQ1ngLQJYRvpWHMWWo4KDIaMnuCcVKgdlZAGL8t2J8vpPGrwChDLyWBMFlAA8D0z4ZvwKEs8D93gCQEc9Jy/jFgkdizaRDGUSs8wXAu1bQLQE9ngHosWbPAXDQeQAypT9rBd3+gociyxi2K9riLABZUj5iuZ6RgsciM2OzFxw2A7JrAO6VwGtKTwpG+Anoy9AVmb3gDHCPcwCAFcChRox6jPu9CazMeFQUAKNRL3AJwE2yopjq228BQPZ/d2bcCyaBTa4BeNGa8Q6naIA4GQWubiKEYWvBbp8zAGQt5VfL/fQ3GEAkTzXDLVkjokA2k5a7AuA2GaLNj/tTfvhq0pQgbcwLQtlQusYVALtlzSR191MjADNI9zbJDZWBR10BMGr5/4GMADQ0SAMDlht62xUAxy0AmzMEEMnhtIO0ZF2YAH5wITd0hQw/5wE04M1bjDyXZpC2hqMlYGnWAHqBf40APOEYgChI35VSWyasWfGqrAH0WVkOIw4CSC1IG2tDoSy7XJE1gPs8ArDoIG0BmJGk30wBDHgGYFFBOgbAtqwB7GxxAHerC8rOBU0Dt2gQzjYIb8gawDor+6HVhqFdrkzEwhabiAVOTMSkUb+06FLEUVfWgj5q0cW4g64AeNo66ZLlcnTDNmesBN4y8KArAG6QU42ttCEzBVzpCoAO4EfLDeV5SzIEvgHaXdqUP2BlQud1Ux55zj2uZUX02cPRnKalRLmu17qYmPWF5YbymJgVAh8Ay5wCII3ZEZOYm6fURGT2u9X43Mnk3CDHybmfmRVYXExPv9nKEcpLejqSC3SjdY2TBzTesHqB7wc0onTEV2KucxLApXKkJy9HlAI5anuJFwCkYQ/EuCJfD+mdBnYkXOssgHY53un7MdVZ4CVgqVcADAhjMafkfTioHc14P04yvvMApIEXy5F/+7S8y6UKolPyR4BVVf7Wi2IdawwIPhTrmAW+rmZ8bwBIQ7vloXwoVzNWS6UUrwAYy9YfOlqwKZDkgneA5Qu4l3cly84F9sqGhislywLmaozuYoGFXr0DII1ukxP1hxJ6QzR7HqLxRfumZaRzXZ3f4XXZyi7gCeB3kqsnzs+kSb9s5XHgMeD8RTxDLgq3rmeuYuFvNYCoR8wqujNi+L3UWBcu9wAMt3QZ8LiMlk5RuU50teq6kcEDgTolveIRYHUQBOek1O5cFu/ukLz7/ZJgNSm+OirebWpgaPS7slxfAr4EngGuX8jopqUBxGzyrAVuB54EXgc+lV4yLhO8cfn5E+ZqUD8kBu9sQvv0Hzj4rmoEBaAAVBWAAlBVAApAVQEoAFUFoABUFYACUFUACkC1CfofXVRJocowZVYAAAAASUVORK5CYII=);
+ background-size: contain;
+ position: absolute;
+ content: "";
+ opacity: .7;
+ margin-top: -19px;
+ margin-left: -64px;
+ -webkit-transition: .2s opacity ease-in-out;
+ -moz-transition: .2s opacity ease-in-out;
+ -o-transition: .2s opacity ease-in-out;
+ transition: .2s opacity ease-in-out;
+}
+
+.landing-video-link:hover {
+ color: hsla(0, 0%, 100%, 1);
+}
+
+.landing-video-link:hover:before {
+ opacity: 1;
+}
+
+.landing-social-image {
+ float: left;
+ margin-right: 14px;
+ height: 64px;
+ width: 64px;
+}
+
+.landing-social-copy {
+ padding-left: 78px;
+}
+
+.landing-scroll-down-affordance {
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ text-align: center;
+ z-index: 10;
+}
+
+.landing-down-arrow {
+ padding: 24px;
+ display: inline-block;
+ opacity: .5;
+ -webkit-transition: .2s opacity ease-in-out;
+ -moz-transition: .2s opacity ease-in-out;
+ -o-transition: .2s opacity ease-in-out;
+ transition: .2s opacity ease-in-out;
+
+ -webkit-animation-name: pulse-opacity;
+ -webkit-animation-duration: 4s;
+}
+
+.landing-down-arrow:hover {
+ opacity: 1;
+}
+
+.landing-down-arrow img {
+ height: 28px;
+ width: 28px;
+ margin: 0 auto;
+ display: block;
+}
+
+.landing-divider {
+ display: inline-block;
+ height: 2px;
+ background-color: white;
+ position: relative;
+ margin: 10px 0;
+}
+
+/* 3 CLOLUMN LAYOUT */
+
+.landing-breakout {
+ margin-top: 40px;
+ margin-bottom: 40px;
+}
+
+.landing-breakout img {
+ margin-bottom: 20px;
+}
+
+.landing-partners img {
+ margin-bottom: 20px;
+}
+
+.landing-breakout p {
+ padding: 0 23px;
+}
+
+.landing-breakout.landing-partners img {
+ margin-bottom: 20px;
+}
+
+.col-3-wide {
+ display: inline;
+ float: left;
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+.col-3-wide {
+ width: 302px;
+}
+
+/**
+ * ANIMATION
+ */
+
+@-webkit-keyframes pulse-opacity {
+ 0% {
+ opacity: .5;
+ }
+ 20% {
+ opacity: .5;
+ }
+ 40% {
+ opacity: 1;
+ }
+ 60% {
+ opacity: .5;
+ }
+ 80% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: .5;
+ }
+}
+
+
+
+/**
+ * VIDEO
+ */
+
+#video-container {
+ display:none;
+ position:fixed;
+ top:0;
+ left:0;
+ width:100%;
+ height:100%;
+ background-color:rgba(0,0,0,0.8);
+ z-index:9999;
+}
+
+#video-frame {
+ width:940px;
+ height:100%;
+ margin:72px auto;
+ display:none;
+ position:relative;
+}
+
+.video-close {
+ cursor: pointer;
+ position: absolute;
+ right: -49px;
+ top: -49px;
+ pointer-events: all;
+}
+
+#icon-video-close {
+ background-image: url("../images/close-white.png");
+ background-image: -webkit-image-set(url(../images/close-white.png) 1x, url(../images/close-white_2x.png) 2x);
+ background-repeat: no-repeat;
+ background-position: 0 0;
+ background-size: 36px 36px;
+ height: 36px;
+ width: 36px;
+ display:block;
+}
+
+#icon-video-close:hover {
+ background-image: url("../images/close-grey.png");
+ background-image: -webkit-image-set(url(../images/close-grey.png) 1x, url(../images/close-grey_2x.png) 2x);
+}
+
+/* Preload the hover images */
+a.video-shadowbox-button.white:after {
+ display:none;
+ content:url("../images/close-grey.png") url("../images/close-grey_2x.png");
+}
+
+a.video-shadowbox-button.white {
+ background-image: url("../images/play-circle-white.png");
+ background-image: -webkit-image-set(url(../images/play-circle-white.png) 1x, url(../images/play-circle-white_2x.png) 2x);
+ background-size: 36px 36px;
+ background-repeat: no-repeat;
+ background-position: right;
+ padding: 16px 42px 16px 8px;
+ font-size: 18px;
+ font-weight: 500;
+ line-height: 24px;
+ color: #fff;
+ text-decoration:none;
+}
+
+a.video-shadowbox-button.white:hover {
+ color:#bababa !important;
+ background-image: url("../images/play-circle-grey.png");
+ background-image: -webkit-image-set(url(../images/play-circle-grey.png) 1x, url(../images/play-circle-grey_2x.png) 2x);
+}
+
+/* Preload the hover images */
+a.video-shadowbox-button.white:after {
+ display:none;
+ content:url("../images/play-circle-grey.png") url("../images/play-circle-grey_2x.png");
+}
+
+/******************
+Styles for d.a.c/index:
+*******************/
+
+
+
+/* Generic full screen carousel styling to be used across pages. */
+.fullscreen-carousel {
+ margin: 0 -10px;
+ width: 100%;
+ overflow: hidden;
+ position: relative;
+}
+
+.fullscreen-carousel-content {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ display: table; /* For vertical centering */
+}
+
+.fullscreen-carousel .vcenter {
+ display: table-cell;
+ vertical-align: middle;
+ position: relative;
+}
+
+.fullscreen-carousel .vcenter > div {
+ margin: 10px auto;
+}
+
+/* Styles for the full-bleed hero image type. */
+.fullscreen-carousel .hero, .fullscreen-carousel .hero h1 {
+ color: #fff;
+}
+
+.fullscreen-carousel .hero h1 {
+ font-weight: 300;
+ font-size: 60px;
+ line-height: 68px;
+ letter-spacing: -1px;
+ margin-top: 0;
+}
+
+.fullscreen-carousel .hero p {
+ font-weight: 300;
+ font-size: 18px;
+ line-height: 24px;
+ -webkit-font-smoothing: antialiased;
+}
+
+.fullscreen-carousel .hero .hero-bg {
+ background-size: cover;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ left: 0px;
+ top: 0px;
+}
+
+
+/* Full screen carousel styling for the resource flow layout type of content */
+.fullscreen-carousel .resource-flow-layout:after {
+ height: 0; /* Dont know why this is set at 10 in default.css */
+}
+
+.fullscreen-carousel .resource-flow-layout {
+ margin-bottom: 20px;
+}
+
+
+
+/* Generic Tab carousel styling to be used across multiple pages. */
+
+.tab-carousel .tab-nav {
+ list-style: none;
+ position: relative;
+ text-align: center;
+}
+
+.tab-carousel .tab-nav li {
+ display: inline-block;
+ font-size: 22px;
+ font-weight: 400;
+ line-height: 50px;
+ list-style: none;
+ margin: 0;
+ padding: 0 25px;
+ position: relative;
+}
+
+.tab-carousel .tab-nav li a,
+.tab-carousel .tab-nav li a:hover {
+ color: #333 !important;
+ padding: 10px 10px 13px 10px;
+ position: relative;
+ z-index: 1000;
+}
+
+.tab-carousel .tab-nav li:after {
+ background: #ddd;
+ bottom: 0;
+ content: '';
+ height: 4px;
+ left: 0;
+ position: absolute;
+ width: 100%;
+ z-index: 0;
+}
+
+.tab-carousel .tab-nav .highlight {
+ position: absolute;
+ height: 4px;
+ width: 100px;
+ bottom: 0;
+ background: #33b5e5;
+}
+
+.tab-carousel .tab-carousel-content {
+ position: relative;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.tab-carousel .tab-carousel-content [data-tab] {
+ display: inline-block;
+ white-space: normal;
+}
+
+
+
+/*
+ Resource styling for the tab carousel. The tab carousel contains either
+ a 3 column layout of resources or a single full-width resource. The
+ latter has the 18x12 class applied to it and can be styled differently
+ that way.
+*/
+
+.tab-carousel .resource .image {
+ width: 100%;
+ height: 250px;
+ background-repeat: no-repeat;
+ background-size: contain;
+ background-position: 50% 50%;
+}
+
+.tab-carousel .resource .info .title {
+ font-size: 18px;
+ line-height: 24px;
+}
+
+.tab-carousel .resource .info .summary,
+.tab-carousel .resource .info .cta {
+ line-height: 24px;
+ font-size: 16px;
+}
+
+.tab-carousel .resource-card-18x12 {
+ position: relative;
+ padding-left: 450px;
+ box-sizing: border-box;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+.tab-carousel .resource-card-18x12 .image {
+ position: absolute;
+ width: 420px;
+ height: 100%;
+ left: 0;
+ top: 0;
+}
+
+.tab-carousel .resource-card-18x12 .info {
+ display: inline-block;
+}
+
+.tab-carousel .resource-card-18x12 .info .title {
+ margin-bottom: 26px;
+}
+
+
+
+
+
+/*
+ Styles for the entity link used in the actions bar and in the cta of
+ the resources that appear in the tab carousel.
+*/
+.actions-bar a:after,
+.resource .cta:after {
+ content: '›';
+ font-weight: 400;
+ font-size: 22px;
+ left: 5px;
+ line-height: 1;
+ position: relative;
+ top: 1px;
+ transition: left 190ms ease-out;
+}
+
+.actions-bar a:hover:after,
+.resource .cta:hover:after {
+ left: 10px;
+}
+
+
+
+
+/*
+ Styles for the actions bar.
+*/
+.actions-bar {
+ background: #9acd00;
+ margin: 0 -10px;
+ text-align: center;
+}
+
+.actions-bar .actions {
+ padding: 30px 0 30px;
+ text-align: justify;
+ font-size: 0.1px;
+ line-height: 0.1px;
+ margin: 0 10px 0 0;
+}
+
+.actions-bar .actions:after {
+ content: '';
+ width: 100%;
+ display: inline-block;
+}
+
+.actions-bar .actions > div {
+ display: inline-block;
+}
+
+.actions-bar a {
+ font-size: 21px;
+ line-height: 27px;
+ color: #fff;
+ font-weight: 300;
+ -webkit-font-smoothing: antialiased;
+}
+
+.actions-bar a:after {
+ top: 0px;
+ font-size: 22px;
+}
+
+.actions-bar a:hover {
+ color: #fff !important;
+}
+
+
+
+
+
+/*
+ Specific styles for new home page layout of the carousels.
+*/
+
+/* Big blue button */
+a.home-new-cta-btn,
+.home-new-carousel-1 .resource-card-18x6 .cta {
+ white-space: nowrap;
+ display: inline-block;
+ padding: 14px 32px;
+ font-size: 18px;
+ font-weight: 500;
+ line-height: 24px;
+ cursor: pointer;
+ background: #33b5e6;
+ border-radius: 4px;
+ margin-top: 20px;
+ color: #fff;
+ transition: 0.2s background-color ease-in-out;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .cta:after {
+ display: none; /* Hide the entity for this button */
+}
+
+a.home-new-cta-btn:hover,
+.home-new-carousel-1 .resource-card-18x6 .cta:hover {
+ color: #fff !important;
+ background: #2d9fca;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .cta {
+ position: absolute;
+ bottom: 20px;
+ left: 16px;
+}
+
+/* Fullscreen carousel. */
+.home-new-carousel-1 {
+ max-height: 700px; /* Set max height so doesn't get too long */
+}
+
+.home-new-carousel-1 .fullscreen-carousel-content {
+ min-height: 450px; /* Set min height for all content */
+}
+
+.home-new-carousel-1 .hero {
+ background: #000;
+}
+
+.home-new-carousel-1 .hero-bg {
+ background-image: url(/home-new/images/hero.jpg);
+ background-position: right center;
+ opacity: 0.85;
+}
+
+/*
+ Styling for special top card of full screen layout resource layout.
+ We need to specifically style the 18x6 card to adjust its size and layout,
+ since it's not a standard card, not sure if this is unique to the home page
+ layout or should be namespaced within the fullscreen-carousel container.
+*/
+.home-new-carousel-1 .resource-flow-layout.col-16 .resource-card-18x6 {
+ height: 320px;
+ background-color:#F9F9F9;
+ border-radius: 0px;
+ box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
+
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-bg {
+ width: 636px;
+ height: 100%;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info {
+ right: 0px;
+ left: 636px;
+ height: 100%;
+ top: 0px;
+ padding: 15px 22px;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info .util {
+ display: none;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info .title {
+ font-size: 20px;
+ font-weight: 500;
+ margin-top: 15px;
+ margin-bottom: 15px;
+}
+
+.home-new-carousel-1 .resource-card-18x6 .card-info .text {
+ font-size: 15px;
+ line-height: 21px;
+}
+
+
+/* Tabbed carousel. */
+.home-new-carousel-2 {
+ margin: 35px auto 100px auto;
+}
+
+.home-new-carousel-2 h1 {
+ font-size: 47px;
+ font-weight: 100;
+ line-height: 54px;
+ text-align: center;
+}
+
+.annotation-message {
+ display: block;
+ font-style: italic;
+ color: #F80;
+}
+
+
+
+/* Helpouts widget */
+.resource-card-6x2.helpouts-card {
+ width: 255px;
+ height: 40px;
+ position:absolute;
+ z-index:999;
+ top:-8px;
+ right:1px;
+}
+
+.resource-card-6x2.helpouts-card > .card-info {
+ left:35px;
+ height:35px;
+ padding:4px 8px 4px 0;
+}
+
+.resource-card-6x2.helpouts-card > .card-info .helpouts-description {
+ display:block;
+ overflow:visible;
+ font-size:12px;
+ line-height:12px;
+ text-align:right;
+ color:#666;
+}
+
+.helpouts-description .link-color {
+ text-transform: uppercase;
+}
+
+.resource-card-6x2 > .card-bg.helpouts-card-bg {
+ width:35px;
+ height:35px;
+ margin:2px 0 0 0;
+ background-image: url(../images/styles/helpouts-logo-35_2x.png);
+ background-image: -webkit-image-set(url(../images/styles/helpouts-logo-35.png) 1x, url(../images/styles/helpouts-logo-35_2x.png) 2x);
+}
+
+.resource-card-6x2 > .card-bg.helpouts-card-bg:after {
+ display:none;
+}
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/css/fullscreen.css b/tools/droiddoc/templates-sdk-dev/assets/css/fullscreen.css
similarity index 99%
copy from tools/droiddoc/templates-sdk-dyn/assets/css/fullscreen.css
copy to tools/droiddoc/templates-sdk-dev/assets/css/fullscreen.css
index 53d9a64..7912e34 100644
--- a/tools/droiddoc/templates-sdk-dyn/assets/css/fullscreen.css
+++ b/tools/droiddoc/templates-sdk-dev/assets/css/fullscreen.css
@@ -197,9 +197,6 @@
left:-20px;
}
-
-}
-
.col-right {
margin-right:0px;
}
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/design/default.js b/tools/droiddoc/templates-sdk-dev/assets/design/default.js
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/design/default.js
rename to tools/droiddoc/templates-sdk-dev/assets/design/default.js
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/android-developers-logo.png b/tools/droiddoc/templates-sdk-dev/assets/images/android-developers-logo.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/android-developers-logo.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/android-developers-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/android.png b/tools/droiddoc/templates-sdk-dev/assets/images/android.png
new file mode 100644
index 0000000..4040f3f
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/android.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/android_wrench.png b/tools/droiddoc/templates-sdk-dev/assets/images/android_wrench.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/android_wrench.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/android_wrench.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow-left-develop.png b/tools/droiddoc/templates-sdk-dev/assets/images/arrow-left-develop.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow-left-develop.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow-left-develop.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow-left.png b/tools/droiddoc/templates-sdk-dev/assets/images/arrow-left.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow-left.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow-left.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow-right-develop.png b/tools/droiddoc/templates-sdk-dev/assets/images/arrow-right-develop.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow-right-develop.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow-right-develop.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow-right.png b/tools/droiddoc/templates-sdk-dev/assets/images/arrow-right.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow-right.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow-right.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow_bluelink_down.png b/tools/droiddoc/templates-sdk-dev/assets/images/arrow_bluelink_down.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow_bluelink_down.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow_bluelink_down.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow_bluelink_up.png b/tools/droiddoc/templates-sdk-dev/assets/images/arrow_bluelink_up.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow_bluelink_up.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow_bluelink_up.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow_left_off.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/arrow_left_off.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow_left_off.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow_left_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow_left_on.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/arrow_left_on.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow_left_on.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow_left_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow_right_off.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/arrow_right_off.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow_right_off.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow_right_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrow_right_on.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/arrow_right_on.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrow_right_on.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrow_right_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/arrows-up-down.png b/tools/droiddoc/templates-sdk-dev/assets/images/arrows-up-down.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/arrows-up-down.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/arrows-up-down.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/bg_community_leftDiv.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/bg_community_leftDiv.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/bg_community_leftDiv.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/bg_community_leftDiv.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/bg_fade.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/bg_fade.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/bg_fade.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/bg_fade.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/bg_gradient.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/bg_gradient.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/bg_gradient.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/bg_gradient.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/bg_images_sprite.png b/tools/droiddoc/templates-sdk-dev/assets/images/bg_images_sprite.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/bg_images_sprite.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/bg_images_sprite.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/bg_logo.png b/tools/droiddoc/templates-sdk-dev/assets/images/bg_logo.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/bg_logo.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/bg_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/blog-default.png b/tools/droiddoc/templates-sdk-dev/assets/images/blog-default.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/blog-default.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/blog-default.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/body-gradient-tab.png b/tools/droiddoc/templates-sdk-dev/assets/images/body-gradient-tab.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/body-gradient-tab.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/body-gradient-tab.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/body-gradient.png b/tools/droiddoc/templates-sdk-dev/assets/images/body-gradient.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/body-gradient.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/body-gradient.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/breadcrumb.png b/tools/droiddoc/templates-sdk-dev/assets/images/breadcrumb.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/breadcrumb.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/breadcrumb.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/close-grey.png b/tools/droiddoc/templates-sdk-dev/assets/images/close-grey.png
new file mode 100644
index 0000000..1b0d7f1
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/close-grey.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/close-grey_2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/close-grey_2x.png
new file mode 100644
index 0000000..1355507
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/close-grey_2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/close-white.png b/tools/droiddoc/templates-sdk-dev/assets/images/close-white.png
new file mode 100644
index 0000000..ef02018
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/close-white.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/close-white_2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/close-white_2x.png
new file mode 100644
index 0000000..9b9c41d
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/close-white_2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/close.png b/tools/droiddoc/templates-sdk-dev/assets/images/close.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/close.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/close.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/dac_logo.png b/tools/droiddoc/templates-sdk-dev/assets/images/dac_logo.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/dac_logo.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/dac_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/dac_logo@2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/dac_logo@2x.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/dac_logo@2x.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/dac_logo@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/developers-logo.png b/tools/droiddoc/templates-sdk-dev/assets/images/developers-logo.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/developers-logo.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/developers-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/file-generic.png b/tools/droiddoc/templates-sdk-dev/assets/images/file-generic.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/file-generic.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/file-generic.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/file-image.png b/tools/droiddoc/templates-sdk-dev/assets/images/file-image.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/file-image.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/file-image.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/file-java.png b/tools/droiddoc/templates-sdk-dev/assets/images/file-java.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/file-java.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/file-java.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/file-manifest.png b/tools/droiddoc/templates-sdk-dev/assets/images/file-manifest.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/file-manifest.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/file-manifest.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/file-xml.png b/tools/droiddoc/templates-sdk-dev/assets/images/file-xml.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/file-xml.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/file-xml.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/folder.png b/tools/droiddoc/templates-sdk-dev/assets/images/folder.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/folder.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/folder.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/fullscreen.png b/tools/droiddoc/templates-sdk-dev/assets/images/fullscreen.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/fullscreen.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/fullscreen.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/grad-rule-qv.png b/tools/droiddoc/templates-sdk-dev/assets/images/grad-rule-qv.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/grad-rule-qv.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/grad-rule-qv.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/Android_Dev_Lab_l.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/Android_Dev_Lab_l.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/Android_Dev_Lab_l.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/Android_Dev_Lab_l.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/GDC2011.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/GDC2011.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/GDC2011.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/GDC2011.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/GTV_icon_large.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/GTV_icon_large.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/GTV_icon_large.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/GTV_icon_large.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/GTV_icon_small.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/GTV_icon_small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/GTV_icon_small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/GTV_icon_small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/IO-logo-2011.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/IO-logo-2011.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/IO-logo-2011.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/IO-logo-2011.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/IO-logo.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/IO-logo.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/IO-logo.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/IO-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/adc2_l.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/adc2_l.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/adc2_l.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/adc2_l.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/adc2_s.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/adc2_s.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/adc2_s.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/adc2_s.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/android_adc.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/android_adc.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/android_adc.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/android_adc.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_announcement.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_announcement.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_announcement.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_announcement.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_bottom.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_bottom.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_bottom.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_bottom.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_carousel.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_carousel.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_carousel.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_carousel.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_carousel_board.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_carousel_board.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_carousel_board.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_carousel_board.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_carousel_wheel.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_carousel_wheel.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/bg_home_carousel_wheel.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/bg_home_carousel_wheel.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/carousel_buttons_sprite.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/carousel_buttons_sprite.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/carousel_buttons_sprite.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/carousel_buttons_sprite.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/devphone-large.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/devphone-large.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/devphone-large.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/devphone-large.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/devphone-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/devphone-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/devphone-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/devphone-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/donut-android.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/donut-android.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/donut-android.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/donut-android.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/eclair-android.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/eclair-android.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/eclair-android.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/eclair-android.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/froyo-android.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/froyo-android.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/froyo-android.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/froyo-android.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/gdc-logo.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/gdc-logo.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/gdc-logo.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/gdc-logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/gingerdroid.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/gingerdroid.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/gingerdroid.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/gingerdroid.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/google-plus-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/google-plus-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/google-plus-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/google-plus-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/google-plus.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/google-plus.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/google-plus.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/google-plus.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/honeycomb-android.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/honeycomb-android.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/honeycomb-android.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/honeycomb-android.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-about.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/icon-about.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-about.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/icon-about.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-design.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/icon-design.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-design.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/icon-design.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-develop.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/icon-develop.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-develop.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/icon-develop.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-distribute.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/icon-distribute.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/icon-distribute.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/icon-distribute.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/ics-android.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/ics-android.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/ics-android.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/ics-android.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/io-large.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/io-large.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/io-large.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/io-large.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/io-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/io-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/io-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/io-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/maps-large.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/maps-large.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/maps-large.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/maps-large.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/maps-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/maps-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/maps-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/maps-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/market-large.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/market-large.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/market-large.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/market-large.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/market-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/market-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/market-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/market-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/sdk-large.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/sdk-large.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/sdk-large.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/sdk-large.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/home/sdk-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/home/sdk-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/home/sdk-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/home/sdk-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/hr_gray_main.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/hr_gray_main.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/hr_gray_main.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/hr_gray_main.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/hr_gray_side.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/hr_gray_side.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/hr_gray_side.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/hr_gray_side.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_contribute.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/icon_contribute.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_contribute.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_contribute.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_design.png b/tools/droiddoc/templates-sdk-dev/assets/images/icon_design.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_design.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_design.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_download.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/icon_download.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_download.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_download.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_download2.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/icon_download2.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_download2.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_download2.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_guidelines_logo.png b/tools/droiddoc/templates-sdk-dev/assets/images/icon_guidelines_logo.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_guidelines_logo.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_guidelines_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_market.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/icon_market.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_market.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_market.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_more.png b/tools/droiddoc/templates-sdk-dev/assets/images/icon_more.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_more.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_more.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_play.png b/tools/droiddoc/templates-sdk-dev/assets/images/icon_play.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_play.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_play.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_robot.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/icon_robot.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_robot.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_robot.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_search.png b/tools/droiddoc/templates-sdk-dev/assets/images/icon_search.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_search.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_search.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/icon_world.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/icon_world.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/icon_world.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/icon_world.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/left_off.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/left_off.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/left_off.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/left_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/left_on.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/left_on.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/left_on.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/left_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/link-out.png b/tools/droiddoc/templates-sdk-dev/assets/images/link-out.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/link-out.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/link-out.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/locale.png b/tools/droiddoc/templates-sdk-dev/assets/images/locale.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/locale.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/locale.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/logo_breadcrumbz.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/logo_breadcrumbz.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/logo_breadcrumbz.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/logo_breadcrumbz.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/more_bottom.png b/tools/droiddoc/templates-sdk-dev/assets/images/more_bottom.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/more_bottom.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/more_bottom.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/more_check.png b/tools/droiddoc/templates-sdk-dev/assets/images/more_check.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/more_check.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/more_check.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/more_mid.png b/tools/droiddoc/templates-sdk-dev/assets/images/more_mid.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/more_mid.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/more_mid.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/more_top.png b/tools/droiddoc/templates-sdk-dev/assets/images/more_top.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/more_top.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/more_top.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/open_source.png b/tools/droiddoc/templates-sdk-dev/assets/images/open_source.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/open_source.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/open_source.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-grey.png b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-grey.png
new file mode 100644
index 0000000..5e7e7ba
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-grey.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-grey_2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-grey_2x.png
new file mode 100644
index 0000000..3e01635
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-grey_2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-white.png b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-white.png
new file mode 100644
index 0000000..017d846
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-white.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-white_2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-white_2x.png
new file mode 100644
index 0000000..e48c1fd
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/play-circle-white_2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/preliminary.png b/tools/droiddoc/templates-sdk-dev/assets/images/preliminary.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/preliminary.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/preliminary.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/preview.png b/tools/droiddoc/templates-sdk-dev/assets/images/preview.png
new file mode 100644
index 0000000..e5856db
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/preview.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/quicknav_arrow.png b/tools/droiddoc/templates-sdk-dev/assets/images/quicknav_arrow.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/quicknav_arrow.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/quicknav_arrow.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/quicknav_btn_bg.png b/tools/droiddoc/templates-sdk-dev/assets/images/quicknav_btn_bg.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/quicknav_btn_bg.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/quicknav_btn_bg.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resizable-e.gif b/tools/droiddoc/templates-sdk-dev/assets/images/resizable-e.gif
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resizable-e.gif
rename to tools/droiddoc/templates-sdk-dev/assets/images/resizable-e.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resizable-e2.gif b/tools/droiddoc/templates-sdk-dev/assets/images/resizable-e2.gif
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resizable-e2.gif
rename to tools/droiddoc/templates-sdk-dev/assets/images/resizable-e2.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resizable-eg.gif b/tools/droiddoc/templates-sdk-dev/assets/images/resizable-eg.gif
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resizable-eg.gif
rename to tools/droiddoc/templates-sdk-dev/assets/images/resizable-eg.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resizable-s.gif b/tools/droiddoc/templates-sdk-dev/assets/images/resizable-s.gif
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resizable-s.gif
rename to tools/droiddoc/templates-sdk-dev/assets/images/resizable-s.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resizable-s2.gif b/tools/droiddoc/templates-sdk-dev/assets/images/resizable-s2.gif
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resizable-s2.gif
rename to tools/droiddoc/templates-sdk-dev/assets/images/resizable-s2.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resizable-s2.png b/tools/droiddoc/templates-sdk-dev/assets/images/resizable-s2.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resizable-s2.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resizable-s2.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resizable-sg.gif b/tools/droiddoc/templates-sdk-dev/assets/images/resizable-sg.gif
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resizable-sg.gif
rename to tools/droiddoc/templates-sdk-dev/assets/images/resizable-sg.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-article.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-article.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-article.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-article.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-article.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-big-article.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-article.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-big-article.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-sample.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-big-sample.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-sample.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-big-sample.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-tutorial.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-big-tutorial.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-tutorial.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-big-tutorial.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-video.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-big-video.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-big-video.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-big-video.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-card-default-android.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/resource-card-default-android.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-card-default-android.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-card-default-android.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-sample.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-sample.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-sample.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-sample.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-tutorial.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-tutorial.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-tutorial.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-tutorial.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/resource-video.png b/tools/droiddoc/templates-sdk-dev/assets/images/resource-video.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/resource-video.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/resource-video.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/right_off.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/right_off.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/right_off.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/right_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/right_on.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/right_on.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/right_on.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/right_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/sidenav-rule.png b/tools/droiddoc/templates-sdk-dev/assets/images/sidenav-rule.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/sidenav-rule.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/sidenav-rule.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_1.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_1.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_1.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_1.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_2.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_2.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_2.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_2.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_3.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_3.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_3.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_3.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_large_1.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_large_1.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_large_1.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_large_1.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_large_2.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_large_2.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_large_2.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_large_2.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_large_3.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_large_3.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_large_3.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_large_3.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_off.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_off.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_off.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_off.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/slide_on.jpg b/tools/droiddoc/templates-sdk-dev/assets/images/slide_on.jpg
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/slide_on.jpg
rename to tools/droiddoc/templates-sdk-dev/assets/images/slide_on.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/spacer.gif b/tools/droiddoc/templates-sdk-dev/assets/images/spacer.gif
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/spacer.gif
rename to tools/droiddoc/templates-sdk-dev/assets/images/spacer.gif
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/stack-arrow-right.png b/tools/droiddoc/templates-sdk-dev/assets/images/stack-arrow-right.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/stack-arrow-right.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/stack-arrow-right.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/callout.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/callout.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/callout.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/callout.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_land_span13.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_land_span13.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_land_span13.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_land_span13.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_land_span8.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_land_span8.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_land_span8.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_land_span8.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_port_span5.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_port_span5.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_port_span5.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_port_span5.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_port_span9.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_port_span9.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_galaxynexus_blank_port_span9.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/device_galaxynexus_blank_port_span9.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_nexus4_blank_port_432.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_nexus4_blank_port_432.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_nexus4_blank_port_432.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/device_nexus4_blank_port_432.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_nexus5_blank_land_span13.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_nexus5_blank_land_span13.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_nexus5_blank_land_span13.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/device_nexus5_blank_land_span13.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_nexus5_blank_port_span5.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_nexus5_blank_port_span5.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/device_nexus5_blank_port_span5.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/device_nexus5_blank_port_span5.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_wear_square.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_wear_square.png
new file mode 100644
index 0000000..077a7e6
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_wear_square.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_wear_square_small.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_wear_square_small.png
new file mode 100644
index 0000000..e7e1540
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/styles/device_wear_square_small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_down.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_down.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_down.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_down.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_left.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_left.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_left.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_left.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_right.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_right.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_right.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_right.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_up.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_up.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/disclosure_up.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/disclosure_up.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/gototop.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/gototop.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/gototop.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/gototop.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/styles/helpouts-logo-35.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/helpouts-logo-35.png
new file mode 100644
index 0000000..3c2dc1a
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/styles/helpouts-logo-35.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dev/assets/images/styles/helpouts-logo-35_2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/helpouts-logo-35_2x.png
new file mode 100644
index 0000000..e34be2e
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/assets/images/styles/helpouts-logo-35_2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_action.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_action.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_action.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_action.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_good.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_good.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_good.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_good.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_movie_inline.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_movie_inline.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_movie_inline.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_movie_inline.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_phone_tablet.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_phone_tablet.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_phone_tablet.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_phone_tablet.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_use.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_use.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_use.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_use.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_web.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_web.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_web.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_web.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_wrong.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_wrong.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/ico_wrong.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/ico_wrong.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-material.png
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers.png
copy to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-material.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers@2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-material@2x.png
similarity index 100%
copy from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers@2x.png
copy to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-material@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers-video.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-video.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers-video.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-video.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers-video@2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-video@2x.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers-video@2x.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers-video@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers@2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers@2x.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-designers@2x.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-designers@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers-video.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers-video.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers-video.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers-video.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers-video@2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers-video@2x.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers-video@2x.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers-video@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers@2x.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers@2x.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/notice-developers@2x.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/notice-developers@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/styles/open_new_page.png b/tools/droiddoc/templates-sdk-dev/assets/images/styles/open_new_page.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/styles/open_new_page.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/styles/open_new_page.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/triangle-closed-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/triangle-closed-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/triangle-closed-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/triangle-closed-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/triangle-closed.png b/tools/droiddoc/templates-sdk-dev/assets/images/triangle-closed.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/triangle-closed.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/triangle-closed.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/triangle-opened-small.png b/tools/droiddoc/templates-sdk-dev/assets/images/triangle-opened-small.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/triangle-opened-small.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/triangle-opened-small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/triangle-opened.png b/tools/droiddoc/templates-sdk-dev/assets/images/triangle-opened.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/triangle-opened.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/triangle-opened.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/uiguidelines1.png b/tools/droiddoc/templates-sdk-dev/assets/images/uiguidelines1.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/uiguidelines1.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/uiguidelines1.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/images/video-droid.png b/tools/droiddoc/templates-sdk-dev/assets/images/video-droid.png
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/images/video-droid.png
rename to tools/droiddoc/templates-sdk-dev/assets/images/video-droid.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/js/android_3p-bundle.js b/tools/droiddoc/templates-sdk-dev/assets/js/android_3p-bundle.js
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/js/android_3p-bundle.js
rename to tools/droiddoc/templates-sdk-dev/assets/js/android_3p-bundle.js
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/js/docs.js b/tools/droiddoc/templates-sdk-dev/assets/js/docs.js
similarity index 83%
copy from tools/droiddoc/templates-sdk-dyn/assets/js/docs.js
copy to tools/droiddoc/templates-sdk-dev/assets/js/docs.js
index e6befe3..7f4be4e 100644
--- a/tools/droiddoc/templates-sdk-dyn/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk-dev/assets/js/docs.js
@@ -19,9 +19,19 @@
/****** ON LOAD SET UP STUFF *********/
-var navBarIsFixed = false;
$(document).ready(function() {
+ // show lang dialog if the URL includes /intl/
+ //if (location.pathname.substring(0,6) == "/intl/") {
+ // var lang = location.pathname.split('/')[2];
+ // if (lang != getLangPref()) {
+ // $("#langMessage a.yes").attr("onclick","changeLangPref('" + lang
+ // + "', true); $('#langMessage').hide(); return false;");
+ // $("#langMessage .lang." + lang).show();
+ // $("#langMessage").show();
+ // }
+ //}
+
// load json file for JD doc search suggestions
$.getScript(toRoot + 'jd_lists_unified.js');
// load json file for Android API search suggestions
@@ -64,7 +74,12 @@
$('.scroll-pane').jScrollPane( {verticalGutter:0} );
// add HRs below all H2s (except for a few other h2 variants)
- $('h2').not('#qv h2').not('#tb h2').not('.sidebox h2').not('#devdoc-nav h2').not('h2.norule').css({marginBottom:0}).after('<hr/>');
+ $('h2').not('#qv h2')
+ .not('#tb h2')
+ .not('.sidebox h2')
+ .not('#devdoc-nav h2')
+ .not('h2.norule').css({marginBottom:0})
+ .after('<hr/>');
// set up the search close button
$('.search .close').click(function() {
@@ -169,6 +184,18 @@
$("#header li.design a").addClass("selected");
$("#sticky-header").addClass("design");
+ // highlight About tabs
+ } else if ($("body").hasClass("about")) {
+ var rootDir = pagePathOriginal.substring(1,pagePathOriginal.indexOf('/', 1));
+ if (rootDir == "about") {
+ $("#nav-x li.about a").addClass("selected");
+ } else if (rootDir == "wear") {
+ $("#nav-x li.wear a").addClass("selected");
+ } else if (rootDir == "tv") {
+ $("#nav-x li.tv a").addClass("selected");
+ } else if (rootDir == "auto") {
+ $("#nav-x li.auto a").addClass("selected");
+ }
// highlight Develop tab
} else if ($("body").hasClass("develop") || $("body").hasClass("google")) {
$("#header li.develop a").addClass("selected");
@@ -207,6 +234,8 @@
$("#nav-x li.engage a").addClass("selected");
} else if (secondFrag == "monetize") {
$("#nav-x li.monetize a").addClass("selected");
+ } else if (secondFrag == "analyze") {
+ $("#nav-x li.analyze a").addClass("selected");
} else if (secondFrag == "tools") {
$("#nav-x li.disttools a").addClass("selected");
} else if (secondFrag == "stories") {
@@ -218,7 +247,7 @@
}
} else if ($("body").hasClass("about")) {
$("#sticky-header").addClass("about");
- }
+ }
// set global variable so we can highlight the sidenav a bit later (such as for google reference)
// and highlight the sidenav
@@ -239,7 +268,7 @@
var crossBoundaries = ($("body.design").length > 0) || ($("body.guide").length > 0) ? true :
false; // navigate across topic boundaries only in design docs
if ($prevListItem.length) {
- if ($prevListItem.hasClass('nav-section')) {
+ if ($prevListItem.hasClass('nav-section') || crossBoundaries) {
// jump to last topic of previous section
$prevLink = $prevListItem.find('a:last');
} else if (!$selListItem.hasClass('nav-section')) {
@@ -262,7 +291,6 @@
// set up next links
var $nextLink = [];
var startClass = false;
- var training = $(".next-class-link").length; // decides whether to provide "next class" link
var isCrossingBoundary = false;
if ($selListItem.hasClass('nav-section') && $selListItem.children('div.empty').length == 0) {
@@ -289,13 +317,15 @@
if ($nextLink.length == 0) {
isCrossingBoundary = true;
// no more topics in this section, jump to the first topic in the next section
- $nextLink = $selListItem.parents('li:eq(0)').next('li.nav-section').find('a:eq(0)');
+ $nextLink = $selListItem.parents('li:eq(0)').next('li').find('a:eq(0)');
if (!$nextLink.length) { // Go up another layer to look for next page (lesson > class > course)
$nextLink = $selListItem.parents('li:eq(1)').next('li.nav-section').find('a:eq(0)');
if ($nextLink.length == 0) {
// if that doesn't work, we're at the end of the list, so disable NEXT link
$('.next-page-link').attr('href','').addClass("disabled")
.click(function() { return false; });
+ // and completely hide the one in the footer
+ $('.content-footer .next-page-link').hide();
}
}
}
@@ -314,13 +344,19 @@
$('.next-page-link').attr('href','')
.removeClass("hide").addClass("disabled")
.click(function() { return false; });
+ // and completely hide the one in the footer
+ $('.content-footer .next-page-link').hide();
if ($nextLink.length) {
$('.next-class-link').attr('href',$nextLink.attr('href'))
- .removeClass("hide").append($nextLink.html());
+ .removeClass("hide")
+ .append(": " + $nextLink.html());
$('.next-class-link').find('.new').empty();
}
} else {
- $('.next-page-link').attr('href', $nextLink.attr('href')).removeClass("hide");
+ $('.next-page-link').attr('href', $nextLink.attr('href'))
+ .removeClass("hide");
+ // for the footer link, also add the next page title
+ $('.content-footer .next-page-link').append(": " + $nextLink.html());
}
if (!startClass && $prevLink.length) {
@@ -332,14 +368,6 @@
}
}
- // If this is a training 'article', there should be no prev/next nav
- // ... if the grandparent is the "nav" ... and it has no child list items...
- if (training && $selListItem.parents('ul').eq(1).is('[id="nav"]') &&
- !$selListItem.find('li').length) {
- $('.next-page-link,.prev-page-link').attr('href','').addClass("disabled")
- .click(function() { return false; });
- }
-
}
@@ -347,7 +375,20 @@
// Set up the course landing pages for Training with class names and descriptions
if ($('body.trainingcourse').length) {
var $classLinks = $selListItem.find('ul li a').not('#nav .nav-section .nav-section ul a');
- var $classDescriptions = $classLinks.attr('description');
+
+ // create an array for all the class descriptions
+ var $classDescriptions = new Array($classLinks.length);
+ var lang = getLangPref();
+ $classLinks.each(function(index) {
+ var langDescr = $(this).attr(lang + "-description");
+ if (typeof langDescr !== 'undefined' && langDescr !== false) {
+ // if there's a class description in the selected language, use that
+ $classDescriptions[index] = langDescr;
+ } else {
+ // otherwise, use the default english description
+ $classDescriptions[index] = $(this).attr("description");
+ }
+ });
var $olClasses = $('<ol class="class-list"></ol>');
var $liClass;
@@ -359,7 +400,7 @@
$classLinks.each(function(index) {
$liClass = $('<li></li>');
$h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>');
- $pSummary = $('<p class="description">' + $(this).attr('description') + '</p>');
+ $pSummary = $('<p class="description">' + $classDescriptions[index] + '</p>');
$olLessons = $('<ol class="lesson-list"></ol>');
@@ -398,7 +439,7 @@
var stylesheet = $('link[rel="stylesheet"][class="fullscreen"]');
setNavBarLeftPos(); // do this even if sidenav isn't fixed because it could become fixed
// make sidenav behave when resizing the window and side-scolling is a concern
- if (navBarIsFixed) {
+ if (sticky) {
if ((stylesheet.attr("disabled") == "disabled") || stylesheet.length == 0) {
updateSideNavPosition();
} else {
@@ -482,7 +523,11 @@
}
}
+ // Resize once loading is finished
resizeNav();
+ // Check if there's an anchor that we need to scroll into view.
+ // A delay is needed, because some browsers do not immediately scroll down to the anchor
+ window.setTimeout(offsetScrollForSticky, 100);
/* init the language selector based on user cookie for lang */
loadLangPref();
@@ -515,10 +560,147 @@
cookiePath = "distribute_";
}
+
+ /* setup shadowbox for any videos that want it */
+ var $videoLinks = $("a.video-shadowbox-button, a.notice-developers-video");
+ if ($videoLinks.length) {
+ // if there's at least one, add the shadowbox HTML to the body
+ $('body').prepend(
+'<div id="video-container">'+
+ '<div id="video-frame">'+
+ '<div class="video-close">'+
+ '<span id="icon-video-close" onclick="closeVideo()"> </span>'+
+ '</div>'+
+ '<div id="youTubePlayer"></div>'+
+ '</div>'+
+'</div>');
+
+ // loads the IFrame Player API code asynchronously.
+ $.getScript("https://www.youtube.com/iframe_api");
+
+ $videoLinks.each(function() {
+ var videoId = $(this).attr('href').split('?v=')[1];
+ $(this).click(function(event) {
+ event.preventDefault();
+ startYouTubePlayer(videoId);
+ });
+ });
+ }
});
// END of the onload event
+var youTubePlayer;
+function onYouTubeIframeAPIReady() {
+}
+
+/* Returns the height the shadowbox video should be. It's based on the current
+ height of the "video-frame" element, which is 100% height for the window.
+ Then minus the margin so the video isn't actually the full window height. */
+function getVideoHeight() {
+ var frameHeight = $("#video-frame").height();
+ var marginTop = $("#video-frame").css('margin-top').split('px')[0];
+ return frameHeight - (marginTop * 2);
+}
+
+var mPlayerPaused = false;
+
+function startYouTubePlayer(videoId) {
+ $("#video-container").show();
+ $("#video-frame").show();
+ mPlayerPaused = false;
+
+ // compute the size of the player so it's centered in window
+ var maxWidth = 940; // the width of the web site content
+ var videoAspect = .5625; // based on 1280x720 resolution
+ var maxHeight = maxWidth * videoAspect;
+ var videoHeight = getVideoHeight();
+ var videoWidth = videoHeight / videoAspect;
+ if (videoWidth > maxWidth) {
+ videoWidth = maxWidth;
+ videoHeight = maxHeight;
+ }
+ $("#video-frame").css('width', videoWidth);
+
+ // check if we've already created this player
+ if (youTubePlayer == null) {
+ // check if there's a start time specified
+ var idAndHash = videoId.split("#");
+ var startTime = 0;
+ if (idAndHash.length > 1) {
+ startTime = idAndHash[1].split("t=")[1] != undefined ? idAndHash[1].split("t=")[1] : 0;
+ }
+ // enable localized player
+ var lang = getLangPref();
+ var captionsOn = lang == 'en' ? 0 : 1;
+
+ youTubePlayer = new YT.Player('youTubePlayer', {
+ height: videoHeight,
+ width: videoWidth,
+ videoId: idAndHash[0],
+ playerVars: {start: startTime, hl: lang, cc_load_policy: captionsOn},
+ events: {
+ 'onReady': onPlayerReady,
+ 'onStateChange': onPlayerStateChange
+ }
+ });
+ } else {
+ // reset the size in case the user adjusted the window since last play
+ youTubePlayer.setSize(videoWidth, videoHeight);
+ // if a video different from the one already playing was requested, cue it up
+ if (videoId != youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0]) {
+ youTubePlayer.cueVideoById(videoId);
+ }
+ youTubePlayer.playVideo();
+ }
+}
+
+function onPlayerReady(event) {
+ event.target.playVideo();
+ mPlayerPaused = false;
+}
+
+function closeVideo() {
+ try {
+ youTubePlayer.pauseVideo();
+ } catch(e) {
+ }
+ $("#video-container").fadeOut(200);
+}
+
+/* Track youtube playback for analytics */
+function onPlayerStateChange(event) {
+ // Video starts, send the video ID
+ if (event.data == YT.PlayerState.PLAYING) {
+ if (mPlayerPaused) {
+ ga('send', 'event', 'Videos', 'Resume',
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0]);
+ } else {
+ // track the start playing event so we know from which page the video was selected
+ ga('send', 'event', 'Videos', 'Start: ' +
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0],
+ 'on: ' + document.location.href);
+ }
+ mPlayerPaused = false;
+ }
+ // Video paused, send video ID and video elapsed time
+ if (event.data == YT.PlayerState.PAUSED) {
+ ga('send', 'event', 'Videos', 'Paused',
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0],
+ youTubePlayer.getCurrentTime());
+ mPlayerPaused = true;
+ }
+ // Video finished, send video ID and video elapsed time
+ if (event.data == YT.PlayerState.ENDED) {
+ ga('send', 'event', 'Videos', 'Finished',
+ youTubePlayer.getVideoUrl().split('?v=')[1].split('&')[0].split('%')[0],
+ youTubePlayer.getCurrentTime());
+ mPlayerPaused = true;
+ }
+}
+
+
+
function initExpandableNavItems(rootTag) {
$(rootTag + ' li.nav-section .nav-section-header').click(function() {
var section = $(this).closest('li.nav-section');
@@ -626,7 +808,7 @@
setTimeout(updateSidenavFixedWidth,delay); // need to wait a moment for css to switch
enabled = false;
}
- writeCookie("fullscreen", enabled, null, null);
+ writeCookie("fullscreen", enabled, null);
setNavBarLeftPos();
resizeNav(delay);
updateSideNavPosition();
@@ -787,7 +969,7 @@
function saveNavPanels() {
var basePath = getBaseUri(location.pathname);
var section = basePath.substring(1,basePath.indexOf("/",1));
- writeCookie("height", resizePackagesNav.css("height"), section, null);
+ writeCookie("height", resizePackagesNav.css("height"), section);
}
@@ -868,119 +1050,111 @@
return 0;
}
-function writeCookie(cookie, val, section, expiration) {
+function writeCookie(cookie, val, section) {
if (val==undefined) return;
section = section == null ? "_" : "_"+section+"_";
- if (expiration == null) {
- var date = new Date();
- date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
- expiration = date.toGMTString();
- }
+ var age = 2*365*24*60*60; // set max-age to 2 years
var cookieValue = cookie_namespace + section + cookie + "=" + val
- + "; expires=" + expiration+"; path=/";
+ + "; max-age=" + age +"; path=/";
document.cookie = cookieValue;
}
/* ######### END COOKIES! ########## */
-
-
+var sticky = false;
var stickyTop;
+var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
/* Sets the vertical scoll position at which the sticky bar should appear.
This method is called to reset the position when search results appear or hide */
function setStickyTop() {
stickyTop = $('#header-wrapper').outerHeight() - $('#sticky-header').outerHeight();
}
+/*
+ * Displays sticky nav bar on pages when dac header scrolls out of view
+ */
+$(window).scroll(function(event) {
-/*
- * Displays sticky nav bar on pages when dac header scrolls out of view
+ setStickyTop();
+ var hiding = false;
+ var $stickyEl = $('#sticky-header');
+ var $menuEl = $('.menu-container');
+ // Exit if there's no sidenav
+ if ($('#side-nav').length == 0) return;
+ // Exit if the mouse target is a DIV, because that means the event is coming
+ // from a scrollable div and so there's no need to make adjustments to our layout
+ if ($(event.target).nodeName == "DIV") {
+ return;
+ }
+
+ var top = $(window).scrollTop();
+ // we set the navbar fixed when the scroll position is beyond the height of the site header...
+ var shouldBeSticky = top >= stickyTop;
+ // ... except if the document content is shorter than the sidenav height.
+ // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
+ if ($("#doc-col").height() < $("#side-nav").height()) {
+ shouldBeSticky = false;
+ }
+ // Account for horizontal scroll
+ var scrollLeft = $(window).scrollLeft();
+ // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
+ if (sticky && (scrollLeft != prevScrollLeft)) {
+ updateSideNavPosition();
+ prevScrollLeft = scrollLeft;
+ }
+
+ // Don't continue if the header is sufficently far away
+ // (to avoid intensive resizing that slows scrolling)
+ if (sticky == shouldBeSticky) {
+ return;
+ }
+
+ // If sticky header visible and position is now near top, hide sticky
+ if (sticky && !shouldBeSticky) {
+ sticky = false;
+ hiding = true;
+ // make the sidenav static again
+ $('#devdoc-nav')
+ .removeClass('fixed')
+ .css({'width':'auto','margin':''})
+ .prependTo('#side-nav');
+ // delay hide the sticky
+ $menuEl.removeClass('sticky-menu');
+ $stickyEl.fadeOut(250);
+ hiding = false;
+
+ // update the sidenaav position for side scrolling
+ updateSideNavPosition();
+ } else if (!sticky && shouldBeSticky) {
+ sticky = true;
+ $stickyEl.fadeIn(10);
+ $menuEl.addClass('sticky-menu');
+
+ // make the sidenav fixed
+ var width = $('#devdoc-nav').width();
+ $('#devdoc-nav')
+ .addClass('fixed')
+ .css({'width':width+'px'})
+ .prependTo('#body-content');
+
+ // update the sidenaav position for side scrolling
+ updateSideNavPosition();
+
+ } else if (hiding && top < 15) {
+ $menuEl.removeClass('sticky-menu');
+ $stickyEl.hide();
+ hiding = false;
+ }
+ resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
+});
+
+/*
+ * Manages secion card states and nav resize to conclude loading
*/
(function() {
$(document).ready(function() {
- setStickyTop();
- var sticky = false;
- var hiding = false;
- var $stickyEl = $('#sticky-header');
- var $menuEl = $('.menu-container');
-
- var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
-
- $(window).scroll(function() {
- // Exit if there's no sidenav
- if ($('#side-nav').length == 0) return;
- // Exit if the mouse target is a DIV, because that means the event is coming
- // from a scrollable div and so there's no need to make adjustments to our layout
- if (event.target.nodeName == "DIV") {
- return;
- }
-
-
- var top = $(window).scrollTop();
- // we set the navbar fixed when the scroll position is beyond the height of the site header...
- var shouldBeSticky = top >= stickyTop;
- // ... except if the document content is shorter than the sidenav height.
- // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
- if ($("#doc-col").height() < $("#side-nav").height()) {
- shouldBeSticky = false;
- }
-
- // Don't continue if the header is sufficently far away
- // (to avoid intensive resizing that slows scrolling)
- if (sticky && shouldBeSticky) {
- return;
- }
-
- // Account for horizontal scroll
- var scrollLeft = $(window).scrollLeft();
- // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
- if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
- updateSideNavPosition();
- prevScrollLeft = scrollLeft;
- }
-
- // If sticky header visible and position is now near top, hide sticky
- if (sticky && !shouldBeSticky) {
- sticky = false;
- hiding = true;
- // make the sidenav static again
- $('#devdoc-nav')
- .removeClass('fixed')
- .css({'width':'auto','margin':''})
- .prependTo('#side-nav');
- // delay hide the sticky
- $menuEl.removeClass('sticky-menu');
- $stickyEl.fadeOut(250);
- hiding = false;
-
- // update the sidenaav position for side scrolling
- updateSideNavPosition();
- } else if (!sticky && shouldBeSticky) {
- sticky = true;
- $stickyEl.fadeIn(10);
- $menuEl.addClass('sticky-menu');
-
- // make the sidenav fixed
- var width = $('#devdoc-nav').width();
- $('#devdoc-nav')
- .addClass('fixed')
- .css({'width':width+'px'})
- .prependTo('#body-content');
-
- // update the sidenaav position for side scrolling
- updateSideNavPosition();
-
- } else if (hiding && top < 15) {
- $menuEl.removeClass('sticky-menu');
- $stickyEl.hide();
- hiding = false;
- }
-
- resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
- });
-
// Stack hover states
$('.section-card-menu').each(function(index, el) {
var height = $(el).height();
@@ -990,7 +1164,6 @@
$cardInfo.css({position: 'absolute', bottom:'0px', left:'0px', right:'0px', overflow:'visible'});
});
- resizeNav(); // must resize once loading is finished
});
})();
@@ -1060,8 +1233,16 @@
}
+/* Call this to add listeners to a <select> element for Studio/Eclipse/Other docs */
+function setupIdeDocToggle() {
+ $( "select.ide" ).change(function() {
+ var selected = $(this).find("option:selected").attr("value");
+ $(".select-ide").hide();
+ $(".select-ide."+selected).show();
-
+ $("select.ide").val(selected);
+ });
+}
@@ -1114,9 +1295,7 @@
nav_pref = NAV_PREF_TREE;
init_default_navtree(toRoot);
}
- var date = new Date();
- date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
- writeCookie("nav", nav_pref, "reference", date.toGMTString());
+ writeCookie("nav", nav_pref, "reference");
$("#nav-panels").toggle();
$("#panel-link").toggle();
@@ -1184,11 +1363,7 @@
}
function changeLangPref(lang, submit) {
- var date = new Date();
- expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000)));
- // keep this for 50 years
- //alert("expires: " + expires)
- writeCookie("pref_lang", lang, null, expires);
+ writeCookie("pref_lang", lang, null);
// ####### TODO: Remove this condition once we're stable on devsite #######
// This condition is only needed if we still need to support legacy GAE server
@@ -1607,8 +1782,8 @@
function onSuggestionClick(link) {
// When user clicks a suggested document, track it
- _gaq.push(['_trackEvent', 'Suggestion Click', 'clicked: ' + $(link).text(),
- 'from: ' + $("#search_autocomplete").val()]);
+ ga('send', 'event', 'Suggestion Click', 'clicked: ' + $(link).attr('href'),
+ 'query: ' + $("#search_autocomplete").val().toLowerCase());
}
function set_item_selected($li, selected)
@@ -1825,8 +2000,12 @@
return false;
}
}
- // Stop here if Google results are showing
+ // If Google results are showing, return true to allow ajax search to execute
else if ($("#searchResults").is(":visible")) {
+ // Also, if search_results is scrolled out of view, scroll to top to make results visible
+ if ((sticky ) && (search.value != "")) {
+ $('body,html').animate({scrollTop:0}, '500', 'swing');
+ }
return true;
}
// 38 UP ARROW
@@ -1949,7 +2128,7 @@
// Search for matching JD docs
- if (text.length >= 3) {
+ if (text.length >= 2) {
// Regex to match only the beginning of a word
var textRegex = new RegExp("\\b" + text.toLowerCase(), "g");
@@ -2496,8 +2675,29 @@
}
}, true);
+/* Adjust the scroll position to account for sticky header, only if the hash matches an id.
+ This does not handle <a name=""> tags. Some CSS fixes those, but only for reference docs. */
+function offsetScrollForSticky() {
+ // Ignore if there's no search bar (some special pages have no header)
+ if ($("#search-container").length < 1) return;
+
+ var hash = escape(location.hash.substr(1));
+ var $matchingElement = $("#"+hash);
+ // Sanity check that there's an element with that ID on the page
+ if ($matchingElement.length) {
+ // If the position of the target element is near the top of the page (<20px, where we expect it
+ // to be because we need to move it down 60px to become in view), then move it down 60px
+ if (Math.abs($matchingElement.offset().top - $(window).scrollTop()) < 20) {
+ $(window).scrollTop($(window).scrollTop() - 60);
+ }
+ }
+}
+
// when an event on the browser history occurs (back, forward, load) requery hash and do search
$(window).hashchange( function(){
+ // Ignore if there's no search bar (some special pages have no header)
+ if ($("#search-container").length < 1) return;
+
// If the hash isn't a search query or there's an error in the query,
// then adjust the scroll position to account for sticky header, then exit.
if ((location.hash.indexOf("q=") == -1) || (query == "undefined")) {
@@ -2505,8 +2705,7 @@
if (!$("#searchResults").is(":hidden")) {
hideResults();
}
- // Adjust the scroll position to account for sticky header
- $(window).scrollTop($(window).scrollTop() - 60);
+ offsetScrollForSticky();
return;
}
@@ -2557,8 +2756,8 @@
$("#searchResults a.gs-title").each(function(index, link) {
// When user clicks enter for Google search results, track it
$(link).click(function() {
- _gaq.push(['_trackEvent', 'Google Click', 'clicked: ' + $(this).text(),
- 'from: ' + $("#search_autocomplete").val()]);
+ ga('send', 'event', 'Google Click', 'clicked: ' + $(this).attr('href'),
+ 'query: ' + $("#search_autocomplete").val().toLowerCase());
});
});
}
@@ -2621,7 +2820,7 @@
}
function updateSidenavFixedWidth() {
- if (!navBarIsFixed) return;
+ if (!sticky) return;
$('#devdoc-nav').css({
'width' : $('#side-nav').css('width'),
'margin' : $('#side-nav').css('margin')
@@ -2632,7 +2831,7 @@
}
function updateSidenavFullscreenWidth() {
- if (!navBarIsFixed) return;
+ if (!sticky) return;
$('#devdoc-nav').css({
'width' : $('#side-nav').css('width'),
'margin' : $('#side-nav').css('margin')
@@ -2673,10 +2872,7 @@
selectedLevel = parseInt($("#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);
+ writeCookie(API_LEVEL_COOKIE, selectedLevel, null);
if (selectedLevel < minLevel) {
var thing = ($("#jd-header").html().indexOf("package") != -1) ? "package" : "class";
@@ -3349,7 +3545,7 @@
showing lines that are cut off. This works with the css ellipsis
classes to fade last text line and apply an ellipsis char. */
- //card text currently uses 15px line height.
+ //card text currently uses 15px line height.
var lineHeight = 15;
$('.card-info .text').ellipsisfade(lineHeight);
});
@@ -3380,7 +3576,10 @@
sortOrder: $widget.data('sortorder'),
query: $widget.data('query'),
section: $widget.data('section'),
- sizeCols: sizeCols
+ sizeCols: sizeCols,
+ /* Added by LFL 6/6/14 */
+ resourceStyle: $widget.data('resourcestyle') || 'card',
+ stackSort: $widget.data('stacksort') || 'true'
};
// run the search for the set of resources to show
@@ -3392,9 +3591,13 @@
} else if (isCarousel) {
drawResourcesCarouselWidget($widget, opts, resources);
} else if (isStack) {
- var sections = buildSectionList(opts);
+ /* Looks like this got removed and is not used, so repurposing for the
+ homepage style layout.
+ Modified by LFL 6/6/14
+ */
+ //var sections = buildSectionList(opts);
opts['numStacks'] = $widget.data('numstacks');
- drawResourcesStackWidget($widget, opts, resources, sections);
+ drawResourcesStackWidget($widget, opts, resources/*, sections*/);
}
}
@@ -3413,10 +3616,8 @@
var $ul = $('<ul>');
for (var i = 0; i < resources.length; ++i) {
- //keep url clean for matching and offline mode handling
- var urlPrefix = resources[i].url.indexOf("//") > -1 ? "" : toRoot;
var $card = $('<a>')
- .attr('href', urlPrefix + resources[i].url)
+ .attr('href', cleanUrl(resources[i].url))
.decorateResourceCard(resources[i],plusone);
$('<li>').css(css)
@@ -3435,7 +3636,9 @@
});
};
- /* Initializes a Resource Card Stack Widget (column-based layout) */
+ /* Initializes a Resource Card Stack Widget (column-based layout)
+ Modified by LFL 6/6/14
+ */
function drawResourcesStackWidget($widget, opts, resources, sections) {
// Don't empty widget, grab all items inside since they will be the first
// items stacked, followed by the resource query
@@ -3453,60 +3656,88 @@
var sectionResources = [];
// Extract any subsections that are actually resource cards
- for (var i = 0; i < sections.length; ++i) {
- if (!sections[i].sections || !sections[i].sections.length) {
- //keep url clean for matching and offline mode handling
- urlPrefix = sections[i].url.indexOf("//") > -1 ? "" : toRoot;
- // Render it as a resource card
+ if (sections) {
+ for (var i = 0; i < sections.length; ++i) {
+ if (!sections[i].sections || !sections[i].sections.length) {
+ // Render it as a resource card
+ sectionResources.push(
+ $('<a>')
+ .addClass('resource-card section-card')
+ .attr('href', cleanUrl(sections[i].resource.url))
+ .decorateResourceCard(sections[i].resource,plusone)[0]
+ );
- sectionResources.push(
- $('<a>')
- .addClass('resource-card section-card')
- .attr('href', urlPrefix + sections[i].resource.url)
- .decorateResourceCard(sections[i].resource,plusone)[0]
- );
-
- } else {
- cards.push(
- $('<div>')
- .addClass('resource-card section-card-menu')
- .decorateResourceSection(sections[i],plusone)[0]
- );
+ } else {
+ cards.push(
+ $('<div>')
+ .addClass('resource-card section-card-menu')
+ .decorateResourceSection(sections[i],plusone)[0]
+ );
+ }
}
}
cards = cards.concat(sectionResources);
for (var i = 0; i < resources.length; ++i) {
- //keep url clean for matching and offline mode handling
- urlPrefix = resources[i].url.indexOf("//") > -1 ? "" : toRoot;
- var $card = $('<a>')
- .addClass('resource-card related-card')
- .attr('href', urlPrefix + resources[i].url)
- .decorateResourceCard(resources[i],plusone);
+ var $card = createResourceElement(resources[i], opts);
+
+ if (opts.resourceStyle.indexOf('related') > -1) {
+ $card.addClass('related-card');
+ }
cards.push($card[0]);
}
- for (var i = 0; i < cards.length; ++i) {
- // Find the stack with the shortest height, but give preference to
- // left to right order.
- var minHeight = $stacks[0].height();
- var minIndex = 0;
+ if (opts.stackSort != 'false') {
+ for (var i = 0; i < cards.length; ++i) {
+ // Find the stack with the shortest height, but give preference to
+ // left to right order.
+ var minHeight = $stacks[0].height();
+ var minIndex = 0;
- for (var j = 1; j < numStacks; ++j) {
- var height = $stacks[j].height();
- if (height < minHeight - 45) {
- minHeight = height;
- minIndex = j;
+ for (var j = 1; j < numStacks; ++j) {
+ var height = $stacks[j].height();
+ if (height < minHeight - 45) {
+ minHeight = height;
+ minIndex = j;
+ }
}
- }
- $stacks[minIndex].append($(cards[i]));
+ $stacks[minIndex].append($(cards[i]));
+ }
}
};
+ /*
+ Create a resource card using the given resource object and a list of html
+ configured options. Returns a jquery object containing the element.
+ */
+ function createResourceElement(resource, opts, plusone) {
+ var $el;
+
+ // The difference here is that generic cards are not entirely clickable
+ // so its a div instead of an a tag, also the generic one is not given
+ // the resource-card class so it appears with a transparent background
+ // and can be styled in whatever way the css setup.
+ if (opts.resourceStyle == 'generic') {
+ $el = $('<div>')
+ .addClass('resource')
+ .attr('href', cleanUrl(resource.url))
+ .decorateResource(resource, opts);
+ } else {
+ var cls = 'resource resource-card';
+
+ $el = $('<a>')
+ .addClass(cls)
+ .attr('href', cleanUrl(resource.url))
+ .decorateResourceCard(resource, plusone);
+ }
+
+ return $el;
+ }
+
/* Initializes a flow widget, see distribute.scss for generating accompanying css */
function drawResourcesFlowWidget($widget, opts, resources) {
$widget.empty();
@@ -3517,7 +3748,6 @@
while (i < resources.length) {
var cardSize = cardSizes[j++ % cardSizes.length];
cardSize = cardSize.replace(/^\s+|\s+$/,'');
- console.log("cardsize is " + cardSize);
// Some card sizes do not get a plusone button, such as where space is constrained
// or for cards commonly embedded in docs (to improve overall page speed).
plusone = !((cardSize == "6x2") || (cardSize == "6x3") ||
@@ -3539,11 +3769,11 @@
// Build each stack item or just a single item
do {
var resource = resources[i];
- //keep url clean for matching and offline mode handling
- urlPrefix = resource.url.indexOf("//") > -1 ? "" : toRoot;
- var $card = $('<a>')
- .addClass('resource-card resource-card-' + cardSize + ' resource-card-' + resource.type)
- .attr('href', urlPrefix + resource.url);
+
+ var $card = createResourceElement(resources[i], opts, plusone);
+
+ $card.addClass('resource-card-' + cardSize +
+ ' resource-card-' + resource.type);
if (isStack) {
$card.addClass('resource-card-' + isStack[1] + 'x' + isStack[2]);
@@ -3555,8 +3785,7 @@
stackCount = 0;
}
- $card.decorateResourceCard(resource,plusone)
- .appendTo($stackDiv || $widget);
+ $card.appendTo($stackDiv || $widget);
} while (++i < resources.length && stackCount > 0);
}
@@ -3696,6 +3925,15 @@
return true;
}
+ function cleanUrl(url)
+ {
+ if (url && url.indexOf('//') === -1) {
+ url = toRoot + url;
+ }
+
+ return url;
+ }
+
function parseResourceQuery(query) {
// Parse query into array of expressions (expression e.g. 'tag:foo + type:video')
@@ -3743,41 +3981,55 @@
})();
(function($) {
+
+ /*
+ Utility method for creating dom for the description area of a card.
+ Used in decorateResourceCard and decorateResource.
+ */
+ function buildResourceCardDescription(resource, plusone) {
+ var $description = $('<div>').addClass('description ellipsis');
+
+ $description.append($('<div>').addClass('text').html(resource.summary));
+
+ if (resource.cta) {
+ $description.append($('<a>').addClass('cta').html(resource.cta));
+ }
+
+ if (plusone) {
+ var plusurl = resource.url.indexOf("//") > -1 ? resource.url :
+ "//developer.android.com/" + resource.url;
+
+ $description.append($('<div>').addClass('util')
+ .append($('<div>').addClass('g-plusone')
+ .attr('data-size', 'small')
+ .attr('data-align', 'right')
+ .attr('data-href', plusurl)));
+ }
+
+ return $description;
+ }
+
+
/* Simple jquery function to create dom for a standard resource card */
$.fn.decorateResourceCard = function(resource,plusone) {
var section = resource.group || resource.type;
- var imgUrl;
- if (resource.image) {
- //keep url clean for matching and offline mode handling
- var urlPrefix = resource.image.indexOf("//") > -1 ? "" : toRoot;
- imgUrl = urlPrefix + resource.image;
+ var imgUrl = resource.image ||
+ 'assets/images/resource-card-default-android.jpg';
+
+ if (imgUrl.indexOf('//') === -1) {
+ imgUrl = toRoot + imgUrl;
}
- //add linkout logic here. check url or type, assign a class, map to css :after
- $('<div>')
- .addClass('card-bg')
- .css('background-image', 'url(' + (imgUrl || toRoot + 'assets/images/resource-card-default-android.jpg') + ')')
+
+ $('<div>').addClass('card-bg')
+ .css('background-image', 'url(' + (imgUrl || toRoot +
+ 'assets/images/resource-card-default-android.jpg') + ')')
.appendTo(this);
- if (!plusone) {
- $('<div>').addClass('card-info' + (!resource.summary ? ' empty-desc' : ''))
- .append($('<div>').addClass('section').text(section))
- .append($('<div>').addClass('title').html(resource.title))
- .append($('<div>').addClass('description ellipsis')
- .append($('<div>').addClass('text').html(resource.summary))
- .append($('<div>').addClass('util')))
- .appendTo(this);
- } else {
- $('<div>').addClass('card-info' + (!resource.summary ? ' empty-desc' : ''))
- .append($('<div>').addClass('section').text(section))
- .append($('<div>').addClass('title').html(resource.title))
- .append($('<div>').addClass('description ellipsis')
- .append($('<div>').addClass('text').html(resource.summary))
- .append($('<div>').addClass('util')
- .append($('<div>').addClass('g-plusone')
- .attr('data-size', 'small')
- .attr('data-align', 'right')
- .attr('data-href', resource.url))))
- .appendTo(this);
- }
+
+ $('<div>').addClass('card-info' + (!resource.summary ? ' empty-desc' : ''))
+ .append($('<div>').addClass('section').text(section))
+ .append($('<div>').addClass('title').html(resource.title))
+ .append(buildResourceCardDescription(resource, plusone))
+ .appendTo(this);
return this;
};
@@ -3860,7 +4112,39 @@
return this;
};
+
+
+
+
+ /* Render other types of resource styles that are not cards. */
+ $.fn.decorateResource = function(resource, opts) {
+ var imgUrl = resource.image ||
+ 'assets/images/resource-card-default-android.jpg';
+ var linkUrl = resource.url;
+
+ if (imgUrl.indexOf('//') === -1) {
+ imgUrl = toRoot + imgUrl;
+ }
+
+ if (linkUrl && linkUrl.indexOf('//') === -1) {
+ linkUrl = toRoot + linkUrl;
+ }
+
+ $(this).append(
+ $('<div>').addClass('image')
+ .css('background-image', 'url(' + imgUrl + ')'),
+ $('<div>').addClass('info').append(
+ $('<h4>').addClass('title').html(resource.title),
+ $('<p>').addClass('summary').html(resource.summary),
+ $('<a>').attr('href', linkUrl).addClass('cta').html('Learn More')
+ )
+ );
+
+ return this;
+ };
})(jQuery);
+
+
/* Calculate the vertical area remaining */
(function($) {
$.fn.ellipsisfade= function(lineHeight) {
@@ -3870,8 +4154,10 @@
var remainingHeight = $this.parent().parent().height();
$this.parent().siblings().each(function ()
{
- var h = $(this).height();
- remainingHeight = remainingHeight - h;
+ if ($(this).is(":visible")) {
+ var h = $(this).height();
+ remainingHeight = remainingHeight - h;
+ }
});
adjustedRemainingHeight = ((remainingHeight)/lineHeight>>0)*lineHeight
@@ -3882,3 +4168,189 @@
return this;
};
}) (jQuery);
+
+/*
+ Fullscreen Carousel
+
+ The following allows for an area at the top of the page that takes over the
+ entire browser height except for its top offset and an optional bottom
+ padding specified as a data attribute.
+
+ HTML:
+
+ <div class="fullscreen-carousel">
+ <div class="fullscreen-carousel-content">
+ <!-- content here -->
+ </div>
+ <div class="fullscreen-carousel-content">
+ <!-- content here -->
+ </div>
+
+ etc ...
+
+ </div>
+
+ Control over how the carousel takes over the screen can mostly be defined in
+ a css file. Setting min-height on the .fullscreen-carousel-content elements
+ will prevent them from shrinking to far vertically when the browser is very
+ short, and setting max-height on the .fullscreen-carousel itself will prevent
+ the area from becoming to long in the case that the browser is stretched very
+ tall.
+
+ There is limited functionality for having multiple sections since that request
+ was removed, but it is possible to add .next-arrow and .prev-arrow elements to
+ scroll between multiple content areas.
+*/
+
+(function() {
+ $(document).ready(function() {
+ $('.fullscreen-carousel').each(function() {
+ initWidget(this);
+ });
+ });
+
+ function initWidget(widget) {
+ var $widget = $(widget);
+
+ var topOffset = $widget.offset().top;
+ var padBottom = parseInt($widget.data('paddingbottom')) || 0;
+ var maxHeight = 0;
+ var minHeight = 0;
+ var $content = $widget.find('.fullscreen-carousel-content');
+ var $nextArrow = $widget.find('.next-arrow');
+ var $prevArrow = $widget.find('.prev-arrow');
+ var $curSection = $($content[0]);
+
+ if ($content.length <= 1) {
+ $nextArrow.hide();
+ $prevArrow.hide();
+ } else {
+ $nextArrow.click(function() {
+ var index = ($content.index($curSection) + 1);
+ $curSection.hide();
+ $curSection = $($content[index >= $content.length ? 0 : index]);
+ $curSection.show();
+ });
+
+ $prevArrow.click(function() {
+ var index = ($content.index($curSection) - 1);
+ $curSection.hide();
+ $curSection = $($content[index < 0 ? $content.length - 1 : 0]);
+ $curSection.show();
+ });
+ }
+
+ // Just hide all content sections except first.
+ $content.each(function(index) {
+ if ($(this).height() > minHeight) minHeight = $(this).height();
+ $(this).css({position: 'absolute', display: index > 0 ? 'none' : ''});
+ });
+
+ // Register for changes to window size, and trigger.
+ $(window).resize(resizeWidget);
+ resizeWidget();
+
+ function resizeWidget() {
+ var height = $(window).height() - topOffset - padBottom;
+ $widget.width($(window).width());
+ $widget.height(height < minHeight ? minHeight :
+ (maxHeight && height > maxHeight ? maxHeight : height));
+ }
+ }
+})();
+
+
+
+
+
+/*
+ Tab Carousel
+
+ The following allows tab widgets to be installed via the html below. Each
+ tab content section should have a data-tab attribute matching one of the
+ nav items'. Also each tab content section should have a width matching the
+ tab carousel.
+
+ HTML:
+
+ <div class="tab-carousel">
+ <ul class="tab-nav">
+ <li><a href="#" data-tab="handsets">Handsets</a>
+ <li><a href="#" data-tab="wearable">Wearable</a>
+ <li><a href="#" data-tab="tv">TV</a>
+ </ul>
+
+ <div class="tab-carousel-content">
+ <div data-tab="handsets">
+ <!--Full width content here-->
+ </div>
+
+ <div data-tab="wearable">
+ <!--Full width content here-->
+ </div>
+
+ <div data-tab="tv">
+ <!--Full width content here-->
+ </div>
+ </div>
+ </div>
+
+*/
+(function() {
+ $(document).ready(function() {
+ $('.tab-carousel').each(function() {
+ initWidget(this);
+ });
+ });
+
+ function initWidget(widget) {
+ var $widget = $(widget);
+ var $nav = $widget.find('.tab-nav');
+ var $anchors = $nav.find('[data-tab]');
+ var $li = $nav.find('li');
+ var $contentContainer = $widget.find('.tab-carousel-content');
+ var $tabs = $contentContainer.find('[data-tab]');
+ var $curTab = $($tabs[0]); // Current tab is first tab.
+ var width = $widget.width();
+
+ // Setup nav interactivity.
+ $anchors.click(function(evt) {
+ evt.preventDefault();
+ var query = '[data-tab=' + $(this).data('tab') + ']';
+ transitionWidget($tabs.filter(query));
+ });
+
+ // Add highlight for navigation on first item.
+ var $highlight = $('<div>').addClass('highlight')
+ .css({left:$li.position().left + 'px', width:$li.outerWidth() + 'px'})
+ .appendTo($nav);
+
+ // Store height since we will change contents to absolute.
+ $contentContainer.height($contentContainer.height());
+
+ // Absolutely position tabs so they're ready for transition.
+ $tabs.each(function(index) {
+ $(this).css({position: 'absolute', left: index > 0 ? width + 'px' : '0'});
+ });
+
+ function transitionWidget($toTab) {
+ if (!$curTab.is($toTab)) {
+ var curIndex = $tabs.index($curTab[0]);
+ var toIndex = $tabs.index($toTab[0]);
+ var dir = toIndex > curIndex ? 1 : -1;
+
+ // Animate content sections.
+ $toTab.css({left:(width * dir) + 'px'});
+ $curTab.animate({left:(width * -dir) + 'px'});
+ $toTab.animate({left:'0'});
+
+ // Animate navigation highlight.
+ $highlight.animate({left:$($li[toIndex]).position().left + 'px',
+ width:$($li[toIndex]).outerWidth() + 'px'})
+
+ // Store new current section.
+ $curTab = $toTab;
+ }
+ }
+ }
+})();
diff --git a/tools/droiddoc/templates-sdk-dyn/assets/js/prettify.js b/tools/droiddoc/templates-sdk-dev/assets/js/prettify.js
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/assets/js/prettify.js
rename to tools/droiddoc/templates-sdk-dev/assets/js/prettify.js
diff --git a/tools/droiddoc/templates-sdk-dyn/class.cs b/tools/droiddoc/templates-sdk-dev/class.cs
similarity index 93%
copy from tools/droiddoc/templates-sdk-dyn/class.cs
copy to tools/droiddoc/templates-sdk-dev/class.cs
index 0461af6..649aaff 100644
--- a/tools/droiddoc/templates-sdk-dyn/class.cs
+++ b/tools/droiddoc/templates-sdk-dev/class.cs
@@ -1,9 +1,12 @@
<?cs include:"doctype.cs" ?>
<?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>" itemscope itemtype="http://schema.org/Article">
@@ -123,6 +126,7 @@
<?cs /if ?>
<?cs set:colspan = colspan-1 ?>
<?cs /each ?>
+<?cs call:show_annotations_list(class) ?>
</div><!-- end header -->
@@ -165,13 +169,15 @@
<div class="jd-descr">
<?cs call:deprecated_warning(class) ?>
-<?cs if:subcount(class.descr) ?>
+<?cs if:subcount(class.descr) || subcount(class.annotationdocumentation) ?>
<h2>Class Overview</h2>
-<p itemprop="articleBody"><?cs call:tag_list(class.descr) ?></p>
+<?cs if:subcount(class.descr) ?><p itemprop="articleBody"><?cs call:tag_list(class.descr) ?></p><?cs /if ?>
+<?cs if:subcount(class.annotationdocumentation) ?><?cs each:annodoc = class.annotationdocumentation?>
+<p><?cs var:annodoc.text ?></p>
+<?cs /each?><?cs /if?>
<?cs /if ?>
<?cs call:see_also_tags(class.seeAlso) ?>
-
</div><!-- jd-descr -->
@@ -184,7 +190,6 @@
<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) ?>
@@ -192,9 +197,12 @@
</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 ?>
+ <?cs if:subcount(method.shortDescr) || subcount(method.deprecated) || subcount(method.showAnnotations) ?>
+ <div class="jd-descrdiv">
+ <?cs if:subcount(method.shortDescr) || subcount(method.annotationdocumentation) ?><?cs call:short_descr(method)?><?cs /if?>
+ <?cs call:show_annotations_list(method) ?>
+ </div>
+ <?cs /if ?>
</td></tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -210,7 +218,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(field) ?>
+ <?cs call:show_annotations_list(field) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -222,7 +233,10 @@
<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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(field) ?>
+ <?cs call:show_annotations_list(field) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -242,7 +256,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(attr) ?>
+ <?cs call:show_annotations_list(attr) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -259,7 +276,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(cl) ?>
+ <?cs call:show_annotations_list(cl) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -335,7 +355,10 @@
<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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(field) ?>
+ <?cs call:show_annotations_list(field) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
@@ -504,6 +527,7 @@
<?cs call:federated_refs(field) ?>
</div>
<div class="jd-details-descr">
+ <?cs call:show_annotations_list(field) ?>
<?cs call:description(field) ?>
<?cs if:subcount(field.constantValue) ?>
<div class="jd-tagdata">
@@ -535,7 +559,6 @@
<?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>
@@ -546,6 +569,7 @@
<?cs call:federated_refs(method) ?>
</div>
<div class="jd-details-descr">
+ <?cs call:show_annotations_list(method) ?>
<?cs call:description(method) ?>
</div>
</div>
@@ -560,6 +584,7 @@
<h4 class="jd-details-title"><?cs var:attr.name ?>
</h4>
<div class="jd-details-descr">
+ <?cs call:show_annotations_list(attr) ?>
<?cs call:description(attr) ?>
<div class="jd-tagdata">
diff --git a/tools/droiddoc/templates-sdk-dyn/classes.cs b/tools/droiddoc/templates-sdk-dev/classes.cs
similarity index 84%
copy from tools/droiddoc/templates-sdk-dyn/classes.cs
copy to tools/droiddoc/templates-sdk-dev/classes.cs
index 6769f47..405892d 100644
--- a/tools/droiddoc/templates-sdk-dyn/classes.cs
+++ b/tools/droiddoc/templates-sdk-dev/classes.cs
@@ -1,9 +1,12 @@
<?cs include:"doctype.cs" ?>
<?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>" itemscope itemtype="http://schema.org/Article">
@@ -30,7 +33,10 @@
<?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>
+ <td class="jd-descrcol" width="100%">
+ <?cs call:short_descr(cl) ?>
+ <?cs call:show_annotations_list(cl) ?>
+ </td>
</tr>
<?cs set:count = count + #1 ?>
<?cs /each ?>
diff --git a/tools/droiddoc/templates-sdk-dyn/components/masthead.cs b/tools/droiddoc/templates-sdk-dev/components/masthead.cs
similarity index 67%
rename from tools/droiddoc/templates-sdk-dyn/components/masthead.cs
rename to tools/droiddoc/templates-sdk-dev/components/masthead.cs
index d0ff64d..d48ea29 100644
--- a/tools/droiddoc/templates-sdk-dyn/components/masthead.cs
+++ b/tools/droiddoc/templates-sdk-dev/components/masthead.cs
@@ -1,12 +1,58 @@
<?cs def:custom_masthead() ?>
-<?cs if:wear ?>
- <?cs call:wear_masthead() ?>
+<?cs if:preview ?>
+ <?cs call:preview_masthead() ?>
<?cs else ?>
<a name="top"></a>
+
+<!-- dialog to prompt lang pref change when loaded from hardcoded URL
+<div id="langMessage" style="display:none">
+ <div>
+ <div class="lang en">
+ <p>You requested a page in English, would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang es">
+ <p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang ja">
+ <p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang ko">
+ <p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang ru">
+ <p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang zh-cn">
+ <p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p>
+ </div>
+ <div class="lang zh-tw">
+ <p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p>
+ </div>
+ <a href="#" class="button yes" onclick="return false;">
+ <span class="lang en">Yes</span>
+ <span class="lang es">Sí</span>
+ <span class="lang ja">Yes</span>
+ <span class="lang ko">Yes</span>
+ <span class="lang ru">Yes</span>
+ <span class="lang zh-cn">是的</span>
+ <span class="lang zh-tw">没有</span>
+ </a>
+ <a href="#" class="button" onclick="$('#langMessage').hide();return false;">
+ <span class="lang en">No</span>
+ <span class="lang es">No</span>
+ <span class="lang ja">No</span>
+ <span class="lang ko">No</span>
+ <span class="lang ru">No</span>
+ <span class="lang zh-cn">没有</span>
+ <span class="lang zh-tw">没有</span>
+ </a>
+ </div>
+</div> -->
+
<?cs if:!devsite ?><?cs # leave out the global header for devsite; it is in devsite template ?>
<!-- Header -->
<div id="header-wrapper">
- <div id="header">
+ <div id="header"><?cs call:butter_bar() ?>
<div class="wrap" id="header-wrap">
<div class="col-3 logo">
<a href="<?cs var:toroot ?>index.html">
@@ -54,11 +100,20 @@
<!-- Expanded quicknav -->
- <div id="quicknav" class="col-9">
+ <div id="quicknav" class="col-13">
<ul>
+ <li class="about">
+ <ul>
+ <li><a href="<?cs var:toroot ?>about/index.html">About</a></li>
+ <li><a href="<?cs var:toroot ?>wear/index.html">Wear</a></li>
+ <li><a href="<?cs var:toroot ?>tv/index.html">TV</a></li>
+ <li><a href="<?cs var:toroot ?>auto/index.html">Auto</a></li>
+ </ul>
+ </li>
<li class="design">
<ul>
<li><a href="<?cs var:toroot ?>design/index.html">Get Started</a></li>
+ <li><a href="<?cs var:toroot ?>design/devices.html">Devices</a></li>
<li><a href="<?cs var:toroot ?>design/style/index.html">Style</a></li>
<li><a href="<?cs var:toroot ?>design/patterns/index.html">Patterns</a></li>
<li><a href="<?cs var:toroot ?>design/building-blocks/index.html">Building Blocks</a></li>
@@ -92,7 +147,7 @@
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
- <li><a href="<?cs var:toroot ?>tools/index.html"
+ <li><a href="<?cs var:toroot ?>sdk/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
@@ -100,7 +155,6 @@
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a>
- <ul><li><a href="<?cs var:toroot ?>sdk/index.html">Get the SDK</a></li></ul>
</li>
<li><a href="<?cs var:toroot ?>google/index.html">Google Services</a>
</li>
@@ -117,6 +171,7 @@
<li><a href="<?cs var:toroot ?>distribute/users/index.html">Get Users</a></li>
<li><a href="<?cs var:toroot ?>distribute/engage/index.html">Engage & Retain</a></li>
<li><a href="<?cs var:toroot ?>distribute/monetize/index.html">Monetize</a></li>
+ <li><a href="<?cs var:toroot ?>distribute/analyze/index.html">Analyze</a></li>
<li><a href="<?cs var:toroot ?>distribute/tools/index.html">Tools & Reference</a></li>
<li><a href="<?cs var:toroot ?>distribute/stories/index.html">Developer Stories</a></li>
</ul>
@@ -126,10 +181,35 @@
</div><!-- end header-wrap.wrap -->
</div><!-- end header -->
- <?cs if:training || guide || reference || tools || develop || google || samples ?>
+ <?cs if:about || wear || tv || auto ?>
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap">
+ <ul class="nav-x col-9 about" style="width:100%">
+ <li class="about"><a href="<?cs var:toroot ?>about/index.html"
+ >About</a></li>
+ <li class="wear"><a href="<?cs var:toroot ?>wear/index.html"
+ >Wear</a></li>
+ <li class="tv"><a href="<?cs var:toroot ?>tv/index.html"
+ >TV</a></li>
+ <li class="auto"><a href="<?cs var:toroot ?>auto/index.html"
+ >Auto</a></li>
+ </ul>
+ </div>
+ </div>
+ <!-- /Sendondary x-nav ABOUT -->
+
+
+
+ <?cs elif:training || guide || reference || tools || develop || google || samples ?>
+ <!-- Secondary x-nav -->
+ <div id="nav-x">
+ <div class="wrap" style="position:relative;z-index:1">
+
+ <?cs if:reference ?>
+
+ <?cs /if ?>
+
<ul class="nav-x col-9 develop" style="width:100%">
<li class="training"><a href="<?cs var:toroot ?>training/index.html"
zh-tw-lang="訓練課程"
@@ -155,7 +235,7 @@
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
- <li class="tools"><a href="<?cs var:toroot ?>tools/index.html"
+ <li class="tools"><a href="<?cs var:toroot ?>sdk/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
@@ -174,9 +254,9 @@
</ul>
</div>
</div>
- <!-- /Sendondary x-nav -->
+ <!-- /Sendondary x-nav DEVELOP -->
- <?cs elif:distribute || googleplay || essentials || users || engage || monetize || disttools || stories ?>
+ <?cs elif:distribute || googleplay || essentials || users || engage || monetize || analyze || disttools || stories ?>
<!-- Secondary distribute x-nav -->
<div id="nav-x">
<div class="wrap">
@@ -192,6 +272,9 @@
<li class="monetize"><a href="<?cs var:toroot ?>distribute/monetize/index.html"
>Monetize</a>
</li>
+ <li class="analyze"><a href="<?cs var:toroot ?>distribute/analyze/index.html"
+ >Analyze</a>
+ </li>
<li class="disttools"><a href="<?cs var:toroot ?>distribute/tools/index.html"
>Tools</a>
</li>
@@ -202,6 +285,7 @@
<a href="https://play.google.com/apps/publish/" class="developer-console-btn">Developer Console</a>
</div> <!-- /Secondary distribute x-nav -->
</div>
+ <!-- /Sendondary x-nav DISTRIBUTE -->
<?cs /if ?>
<div id="searchResults" class="wrap" style="display:none;">
@@ -223,23 +307,25 @@
</div>
<?cs /if ?><?cs # end if/else !devsite ?>
-<?cs /if ?><?cs # end if/else wear ?><?cs
+<?cs /if ?><?cs # end if/else preview ?><?cs
/def ?>
-<?cs def:wear_masthead() ?>
+<?cs def:preview_masthead() ?>
<a name="top"></a>
+
<!-- Header -->
<div id="header-wrapper">
- <div id="header">
+ <div id="header"><?cs call:butter_bar() ?>
<div class="wrap" id="header-wrap">
- <div class="col_3 logo wear-logo">
- <a href="<?cs var:toroot ?>wear/index.html">
- <img src="<?cs var:toroot ?>wear/images/android-wear.png" height="16" alt="Android Wear" />
+ <div class="col_3 logo landing-logo" style="width:240px">
+ <a href="<?cs var:toroot ?>preview/index.html">
+ <img src="<?cs var:toroot ?>assets/images/android.png" height="25" alt="Android"
+ style="margin:-3px 0 0" />
</a>
</div>
- <div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
-color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
+ <div class="col-8" style="margin:0"><h1 style="margin: 4px 0 0 0px;padding:0;line-height:16px;
+color:#666;font-weight:100;font-size:27px;">M Developer Preview</h1></div>
<?cs # ADD SEARCH AND MENU ?>
<?cs call:header_search_widget() ?>
@@ -268,3 +354,22 @@
<?cs
/def ?>
+
+
+<?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?>
+<?cs def:butter_bar() ?>
+
+<?cs # HIDE THE BUTTER BAR
+
+ <div style="height:20px"><!-- spacer to bump header down --></div>
+ <div id="butterbar-wrapper">
+ <div id="butterbar">
+ <a href="http://googleblog.blogspot.com/" id="butterbar-message">
+ The Android {version_number} SDK will be available on {Month} {Day}!
+ </a>
+ </div>
+ </div>
+
+?>
+
+<?cs /def ?>
diff --git a/tools/droiddoc/templates-sdk-dyn/customizations.cs b/tools/droiddoc/templates-sdk-dev/customizations.cs
similarity index 92%
rename from tools/droiddoc/templates-sdk-dyn/customizations.cs
rename to tools/droiddoc/templates-sdk-dev/customizations.cs
index 27822d5..c8c88cc 100644
--- a/tools/droiddoc/templates-sdk-dyn/customizations.cs
+++ b/tools/droiddoc/templates-sdk-dev/customizations.cs
@@ -112,6 +112,20 @@
</script>
<?cs /def ?><?cs
+def:analyze_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/distribute/analyze/analyze_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?><?cs
+
def:monetize_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
@@ -290,6 +304,22 @@
</script>
<?cs /def ?>
+<?cs
+def:preview_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+ <?cs
+ include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
<?cs # The default side navigation for the reference docs ?><?cs
def:default_left_nav() ?>
<?cs if:reference.gcm || reference.gms ?>
@@ -337,6 +367,7 @@
<?cs
if:subcount(class.package) ?>
<ul>
+ <?cs call:list("Annotations", class.package.annotations) ?>
<?cs call:list("Interfaces", class.package.interfaces) ?>
<?cs call:list("Classes", class.package.classes) ?>
<?cs call:list("Enums", class.package.enums) ?>
@@ -345,6 +376,7 @@
</ul><?cs
elif:subcount(package) ?>
<ul>
+ <?cs call:class_link_list("Annotations", package.annotations) ?>
<?cs call:class_link_list("Interfaces", package.interfaces) ?>
<?cs call:class_link_list("Classes", package.classes) ?>
<?cs call:class_link_list("Enums", package.enums) ?>
@@ -431,8 +463,8 @@
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
- <option value="zh-cn">中文 (中国)</option>
- <option value="zh-tw">中文 (台灣)</option>
+ <option value="zh-cn">中文(简体)</option>
+ <option value="zh-tw">中文(繁體)</option>
</select>
</div>
<script type="text/javascript">
@@ -526,6 +558,8 @@
call:engage_nav() ?><?cs
elif:monetize ?><?cs
call:monetize_nav() ?><?cs
+ elif:analyze ?><?cs
+ call:analyze_nav() ?><?cs
elif:disttools ?><?cs
call:disttools_nav() ?><?cs
elif:stories ?><?cs
@@ -537,6 +571,8 @@
call:distribute_nav() ?><?cs
elif:wear ?><?cs
call:wear_nav() ?><?cs
+ elif:preview ?><?cs
+ call:preview_nav() ?><?cs
else ?><?cs
call:default_left_nav() ?> <?cs
/if ?><?cs
diff --git a/tools/droiddoc/templates-sdk-dyn/data.hdf b/tools/droiddoc/templates-sdk-dev/data.hdf
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/data.hdf
rename to tools/droiddoc/templates-sdk-dev/data.hdf
diff --git a/tools/droiddoc/templates-sdk-dyn/designpage.cs b/tools/droiddoc/templates-sdk-dev/designpage.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/designpage.cs
rename to tools/droiddoc/templates-sdk-dev/designpage.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/docpage.cs b/tools/droiddoc/templates-sdk-dev/docpage.cs
similarity index 78%
rename from tools/droiddoc/templates-sdk-dyn/docpage.cs
rename to tools/droiddoc/templates-sdk-dev/docpage.cs
index 7eae405..83b1199 100644
--- a/tools/droiddoc/templates-sdk-dyn/docpage.cs
+++ b/tools/droiddoc/templates-sdk-dev/docpage.cs
@@ -2,7 +2,7 @@
<?cs include:"macros.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
-<body class="gc-documentation
+<body class="gc-documentation
<?cs
if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?><?cs
@@ -18,7 +18,7 @@
if:monetize ?> monetize<?cs /if ?><?cs
if:disttools ?> disttools<?cs /if ?><?cs
if:stories ?> stories<?cs /if ?><?cs
- elif:about ?>about<?cs
+ elif:(about||wear||tv||auto) ?>about<?cs
elif:design ?>design<?cs
/if ?><?cs
if:page.trainingcourse ?> trainingcourse<?cs
@@ -90,7 +90,7 @@
</div>
<?cs /if ?><?cs # end if training ?>
</div>
- <?cs /if ?>
+ <?cs /if ?><?cs # end if header.hide ?>
<?cs elif:samplesProjectIndex ?>
<div id="api-info-block">
@@ -103,7 +103,14 @@
<h1 itemprop="name"><?cs var:projectDir ?></h1>
<?cs else ?>
-
+ <?cs if:training ?>
+<?cs # horrible horrible hack to move TOC up when the next/prev links are not there ?>
+<style>
+ #tb-wrapper {
+ margin-top:6px;
+ }
+</style>
+ <?cs /if ?>
<?cs if:(!fullpage && !header.hide) ?>
<?cs if:page.landing ?><?cs # header logic for docs that are landing pages ?>
@@ -150,25 +157,9 @@
if:fullpage ?>wrap<?cs
else ?>layout-content-row<?cs /if ?>"
itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div class="layout-content-col <?cs
- if:fullpage ?>col-16<?cs
- elif:training||guide ?>col-8<?cs
- else ?>col-9<?cs /if ?>" style="padding-top:4px">
- <?cs if:!page.noplus ?><?cs if:fullpage ?><style>#___plusone_0 {float:right !important;}</style><?cs /if ?>
- <div class="g-plusone" data-size="medium"></div>
- <?cs /if ?>
- </div>
<?cs if:!fullscreen ?>
- <div class="paging-links layout-content-col col-4">
+ <div class="paging-links layout-content-col col-10">
<?cs if:(design||training||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
- <a href="#" class="prev-page-link hide"
- zh-tw-lang="上一堂課"
- zh-cn-lang="上一课"
- ru-lang="Предыдущий"
- ko-lang="이전"
- ja-lang="前へ"
- es-lang="Anterior"
- >Previous</a>
<a href="#" class="next-page-link hide"
zh-tw-lang="下一堂課"
zh-cn-lang="下一课"
@@ -185,41 +176,28 @@
ja-lang="開始する"
es-lang="Empezar"
>Get started</a>
+ <a href="#" class="next-class-link hide">Next class</a>
+ <?cs /if ?>
+ </div>
+ <div class="layout-content-col plus-container col-2" >
+ <?cs if:!page.noplus ?><?cs if:fullpage ?><style>#___plusone_0 {float:right !important;}</style><?cs /if ?>
+ <div class="g-plusone" data-size="medium"></div>
<?cs /if ?>
</div>
<?cs /if ?>
</div>
- <?cs # for training classes, provide a different kind of link when the next page is a different class ?>
- <?cs if:training && !page.article ?>
- <div class="layout-content-row content-footer next-class" style="display:none" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <a href="#" class="next-class-link hide">Next class: </a>
- </div>
- <?cs /if ?>
-
</div> <!-- end jd-content -->
<?cs include:"footer.cs" ?>
</div><!-- end doc-content -->
-<!-- Start of Tag -->
-<script type="text/javascript">
-var axel = Math.random() + "";
-var a = axel * 10000000000000;
-document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
-</script>
-<noscript>
-<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
-</noscript>
-<!-- End of Tag -->
-
-
<?cs include:"trailer.cs" ?>
<script src="https://developer.android.com/ytblogger_lists_unified.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_lists_unified.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_extras.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_collections.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_tag_helpers.js" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_lists_unified.js?v=9" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_extras.js?v=11" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_collections.js?v=12" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_tag_helpers.js?v=5" type="text/javascript"></script>
</body>
</html>
diff --git a/tools/droiddoc/templates-sdk-dyn/footer.cs b/tools/droiddoc/templates-sdk-dev/footer.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/footer.cs
rename to tools/droiddoc/templates-sdk-dev/footer.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/gcm_navtree_data.cs b/tools/droiddoc/templates-sdk-dev/gcm_navtree_data.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/gcm_navtree_data.cs
rename to tools/droiddoc/templates-sdk-dev/gcm_navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/gms_navtree_data.cs b/tools/droiddoc/templates-sdk-dev/gms_navtree_data.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/gms_navtree_data.cs
rename to tools/droiddoc/templates-sdk-dev/gms_navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/head_tag.cs b/tools/droiddoc/templates-sdk-dev/head_tag.cs
similarity index 65%
rename from tools/droiddoc/templates-sdk-dyn/head_tag.cs
rename to tools/droiddoc/templates-sdk-dev/head_tag.cs
index 732118f..9f79f54 100644
--- a/tools/droiddoc/templates-sdk-dyn/head_tag.cs
+++ b/tools/droiddoc/templates-sdk-dev/head_tag.cs
@@ -24,8 +24,8 @@
<meta name="Description" content="<?cs var:page.metaDescription ?>"><?cs
/if ?>
<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>favicon.ico" />
-<title><?cs
- if:page.title ?><?cs
+<title><?cs
+ if:page.title ?><?cs
var:page.title ?> | <?cs
/if ?>Android Developers</title>
@@ -38,9 +38,9 @@
if:android.whichdoc != 'online' ?>http:<?cs
/if ?>//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
title="roboto">
-<link href="<?cs var:toroot ?>assets/css/default.css" rel="stylesheet" type="text/css">
+<link href="<?cs var:toroot ?>assets/css/default.css?v=5" rel="stylesheet" type="text/css">
-<?cs if:reference && !(reference.gms || reference.gcm || wear) ?>
+<?cs if:reference && !(reference.gms || reference.gcm || preview) ?>
<!-- FULLSCREEN STYLESHEET -->
<link href="<?cs var:toroot ?>assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">
@@ -62,17 +62,25 @@
var metaTags = [<?cs var:meta.tags ?>];
var devsite = <?cs if:devsite ?>true<?cs else ?>false<?cs /if ?>;
</script>
-<script src="<?cs var:toroot ?>assets/js/docs.js" type="text/javascript"></script>
+<script src="<?cs var:toroot ?>assets/js/docs.js?v=3" type="text/javascript"></script>
-<script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-5831155-1']);
- _gaq.push(['_trackPageview']);
+<?cs if:helpoutsWidget ?>
+<script type="text/javascript" src="https://helpouts.google.com/ps/res/embed.js" defer async
+ data-helpouts-embed data-helpouts-vertical="programming"
+ data-helpouts-tags="<?cs var:page.tags ?>" data-helpouts-prefix="android"
+ data-helpouts-standalone="true"></script>
+<?cs /if ?>
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
+<script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-5831155-1', 'android.com');
+ ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
+ ga('send', 'pageview');
+ ga('universal.send', 'pageview'); // Send page view for new tracker.
</script>
+
</head>
diff --git a/tools/droiddoc/templates-sdk-dyn/header.cs b/tools/droiddoc/templates-sdk-dev/header.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/header.cs
rename to tools/droiddoc/templates-sdk-dev/header.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/header_tabs.cs b/tools/droiddoc/templates-sdk-dev/header_tabs.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/header_tabs.cs
rename to tools/droiddoc/templates-sdk-dev/header_tabs.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/jd_lists_unified.cs b/tools/droiddoc/templates-sdk-dev/jd_lists_unified.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/jd_lists_unified.cs
rename to tools/droiddoc/templates-sdk-dev/jd_lists_unified.cs
diff --git a/tools/droiddoc/templates-sdk-dev/macros_override.cs b/tools/droiddoc/templates-sdk-dev/macros_override.cs
new file mode 100644
index 0000000..0a94598
--- /dev/null
+++ b/tools/droiddoc/templates-sdk-dev/macros_override.cs
@@ -0,0 +1,36 @@
+<?cs # Create a comma separated list of annotations on obj that were in showAnnotations in Doclava ?>
+<?cs # pre is an HTML string to start the list, post is an HTML string to close the list ?>
+<?cs # for example call:show_annotations_list(cl, "<td>Annotations: ", "</td>") ?>
+<?cs # if obj has nothing on obj.showAnnotations, nothing will be output ?>
+<?cs def:show_annotations_list(obj) ?>
+ <?cs each:anno = obj.showAnnotations ?>
+ <?cs if:first(anno) ?>
+ <span class='annotation-message'>
+ Included in documentation by the annotations:
+ <?cs /if ?>
+ @<?cs var:anno.type.label ?>
+ <?cs if:last(anno) == 0 ?>
+ ,
+ <?cs /if ?>
+ <?cs if:last(anno)?>
+ </span>
+ <?cs /if ?>
+ <?cs /each ?>
+<?cs /def ?>
+
+<?cs # Override default class_link_table to display annotations ?>
+<?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) ?>
+ <?cs call:show_annotations_list(cl) ?>
+ </td>
+ </tr>
+ <?cs set:count = count + #1 ?>
+ <?cs /each ?>
+ </table>
+<?cs /def ?>
\ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk-dyn/navtree_data.cs b/tools/droiddoc/templates-sdk-dev/navtree_data.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/navtree_data.cs
rename to tools/droiddoc/templates-sdk-dev/navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/nosidenavpage.cs b/tools/droiddoc/templates-sdk-dev/nosidenavpage.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/nosidenavpage.cs
rename to tools/droiddoc/templates-sdk-dev/nosidenavpage.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/package.cs b/tools/droiddoc/templates-sdk-dev/package.cs
similarity index 91%
copy from tools/droiddoc/templates-sdk-dyn/package.cs
copy to tools/droiddoc/templates-sdk-dev/package.cs
index 99eaff2..2225565 100644
--- a/tools/droiddoc/templates-sdk-dyn/package.cs
+++ b/tools/droiddoc/templates-sdk-dev/package.cs
@@ -1,10 +1,13 @@
<?cs include:"doctype.cs" ?>
<?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>">
@@ -45,6 +48,7 @@
<?cs /if ?>
<?cs /def ?>
+<?cs call:class_table("Annotations", package.annotations) ?>
<?cs call:class_table("Interfaces", package.interfaces) ?>
<?cs call:class_table("Classes", package.classes) ?>
<?cs call:class_table("Enums", package.enums) ?>
diff --git a/tools/droiddoc/templates-sdk-dyn/packages.cs b/tools/droiddoc/templates-sdk-dev/packages.cs
similarity index 95%
copy from tools/droiddoc/templates-sdk-dyn/packages.cs
copy to tools/droiddoc/templates-sdk-dev/packages.cs
index 44680c3..5056d3a 100644
--- a/tools/droiddoc/templates-sdk-dyn/packages.cs
+++ b/tools/droiddoc/templates-sdk-dev/packages.cs
@@ -4,6 +4,8 @@
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
<?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs
+ if:reference ?> reference<?cs
+ /if ?><?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
/if ?>">
diff --git a/tools/droiddoc/templates-sdk-dyn/sample.cs b/tools/droiddoc/templates-sdk-dev/sample.cs
similarity index 97%
copy from tools/droiddoc/templates-sdk-dyn/sample.cs
copy to tools/droiddoc/templates-sdk-dev/sample.cs
index c6f28f8..32a0788 100644
--- a/tools/droiddoc/templates-sdk-dyn/sample.cs
+++ b/tools/droiddoc/templates-sdk-dev/sample.cs
@@ -18,7 +18,7 @@
<a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/index.html">Overview</a>
| <a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/project.html">Project</a>
| <a href="<?cs var:toroot ?>downloads/samples/<?cs var:projectDir ?>.zip"
- onclick="_gaq.push(['_trackEvent', 'Samples', 'Download', <?cs var:projectDir ?>]);"
+ onclick="ga('send', 'event', 'Samples', 'Download', <?cs var:projectDir ?>);"
>Download</a>
</div><!-- end sum-details-links -->
diff --git a/tools/droiddoc/templates-sdk-dyn/sampleindex.cs b/tools/droiddoc/templates-sdk-dev/sampleindex.cs
similarity index 97%
copy from tools/droiddoc/templates-sdk-dyn/sampleindex.cs
copy to tools/droiddoc/templates-sdk-dev/sampleindex.cs
index 98767b1..1bacb53 100644
--- a/tools/droiddoc/templates-sdk-dyn/sampleindex.cs
+++ b/tools/droiddoc/templates-sdk-dev/sampleindex.cs
@@ -21,7 +21,7 @@
| <a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/project.html">Project</a>
<?cs /if ?>
| <a href="<?cs var:toroot ?>downloads/samples/<?cs var:projectDir ?>.zip"
- onclick="_gaq.push(['_trackEvent', 'Samples', 'Download', <?cs var:projectDir ?>]);"
+ onclick="ga('send', 'event', 'Samples', 'Download', <?cs var:projectDir ?>);"
>Download</a>
</div><!-- end sum-details-links -->
diff --git a/tools/droiddoc/templates-sdk-dyn/samples_navtree_data.cs b/tools/droiddoc/templates-sdk-dev/samples_navtree_data.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/samples_navtree_data.cs
rename to tools/droiddoc/templates-sdk-dev/samples_navtree_data.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/sdkpage.cs b/tools/droiddoc/templates-sdk-dev/sdkpage.cs
similarity index 69%
copy from tools/droiddoc/templates-sdk-dyn/sdkpage.cs
copy to tools/droiddoc/templates-sdk-dev/sdkpage.cs
index 95f6596..817ac47 100644
--- a/tools/droiddoc/templates-sdk-dyn/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk-dev/sdkpage.cs
@@ -183,21 +183,7 @@
<td><?cs var:ndk.linux64.legacy_bytes ?></td>
<td><?cs var:ndk.linux64.legacy_checksum ?></td>
</tr> -->
- <tr>
- <th>Additional Download</th>
- <th>Package</th>
- <th style="white-space:nowrap">Size (Bytes)</th>
- <th>MD5 Checksum</th>
- </tr>
- <tr>
- <td>STL debug info</td>
- <td>
- <a onClick="return onDownload(this)"
- href="http://dl.google.com/android/ndk/<?cs var:ndk.debug_info_download ?>"><?cs var:ndk.debug_info_download ?></a>
- </td>
- <td><?cs var:ndk.debug_info_bytes ?></td>
- <td><?cs var:ndk.debug_info_checksum ?></td>
- </tr>
+
</table>
<?cs ######## HERE IS THE JD DOC CONTENT ######### ?>
@@ -278,89 +264,25 @@
-<h4><a href='' class="expandable"
- onclick="toggleExpandable(this,'.pax');hideExpandable('.myide,.reqs');return false;"
- >DOWNLOAD FOR OTHER PLATFORMS</a></h4>
+<div class="pax col-13 online" style="margin:0;">
-<div class="pax col-13 online" style="display:none;margin:0;">
+<h3>SDK Tools Only</h3>
+<p>If you prefer to use a different IDE or run the tools from the
+command line or with build scripts, you can instead download the stand-alone Android SDK Tools.
+These packages provide the basic SDK tools for app development, without an IDE.
+Also see the <a href="<?cs var:toroot ?>tools/sdk/tools-notes.html">SDK tools release notes</a>.</p>
-<p class="table-caption"><strong>ADT Bundle</strong></p>
<table class="download">
<tr>
<th>Platform</th>
<th>Package</th>
<th>Size</th>
- <th>MD5 Checksum</th>
+ <th>SHA-1 Checksum</th>
</tr>
<tr>
- <td>Windows 32-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="win-bundle32"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.win32_bundle_download ?>"><?cs var:sdk.win32_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.win32_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.win32_bundle_checksum ?></td>
- </tr>
- <tr>
- <td>Windows 64-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="win-bundle64"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.win64_bundle_download ?>"><?cs var:sdk.win64_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.win64_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.win64_bundle_checksum ?></td>
- </tr>
- <tr>
- <td><nobr>Mac OS X 64-bit</nobr></td>
- <td>
- <a onClick="return onDownload(this)" id="mac-bundle64"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.mac64_bundle_download ?>"><?cs var:sdk.mac64_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.mac64_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.mac64_bundle_checksum ?></td>
- </tr>
- <tr>
- <td>Linux 32-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="linux-bundle32"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.linux32_bundle_download ?>"><?cs var:sdk.linux32_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.linux32_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.linux32_bundle_checksum ?></td>
- </tr>
- <tr>
- <td>Linux 64-bit</td>
- <td>
- <a onClick="return onDownload(this)" id="linux-bundle64"
- href="http://dl.google.com/android/adt/<?cs var:sdk.version ?>/<?cs var:sdk.linux64_bundle_download ?>"><?cs var:sdk.linux64_bundle_download ?></a>
- </td>
- <td><?cs var:sdk.linux64_bundle_bytes ?> bytes</td>
- <td><?cs var:sdk.linux64_bundle_checksum ?></td>
- </tr>
- </table>
-
-
-<p class="table-caption"><strong>SDK Tools Only</strong></p>
- <table class="download">
- <tr>
- <th>Platform</th>
- <th>Package</th>
- <th>Size</th>
- <th>MD5 Checksum</th>
- </tr>
- <tr>
- <td rowspan="2">Windows<br>32 & 64-bit</td>
- <td>
- <a onclick="return onDownload(this)" href="http://dl.google.com/android/<?cs var:sdk.win_download
-?>"><?cs var:sdk.win_download ?></a>
- </td>
- <td><?cs var:sdk.win_bytes ?> bytes</td>
- <td><?cs var:sdk.win_checksum ?></td>
- </tr>
- <tr>
- <!-- blank TD from Windows rowspan -->
+ <td rowspan="2">Windows</td>
<td>
<a onclick="return onDownload(this)" id="win-tools" href="http://dl.google.com/android/<?cs
var:sdk.win_installer
@@ -370,7 +292,16 @@
<td><?cs var:sdk.win_installer_checksum ?></td>
</tr>
<tr>
- <td><nobr>Mac OS X</nobr><br>32 & 64-bit</td>
+ <!-- blank TD from Windows rowspan -->
+ <td>
+ <a onclick="return onDownload(this)" href="http://dl.google.com/android/<?cs var:sdk.win_download
+?>"><?cs var:sdk.win_download ?></a>
+ </td>
+ <td><?cs var:sdk.win_bytes ?> bytes</td>
+ <td><?cs var:sdk.win_checksum ?></td>
+ </tr>
+ <tr>
+ <td><nobr>Mac OS X</nobr></td>
<td>
<a onclick="return onDownload(this)" id="mac-tools" href="http://dl.google.com/android/<?cs
var:sdk.mac_download
@@ -380,7 +311,7 @@
<td><?cs var:sdk.mac_checksum ?></td>
</tr>
<tr>
- <td>Linux<br>32 & 64-bit</td>
+ <td>Linux</td>
<td>
<a onclick="return onDownload(this)" id="linux-tools" href="http://dl.google.com/android/<?cs
var:sdk.linux_download
@@ -391,6 +322,79 @@
</tr>
</table>
+
+
+<h3>All Android Studio Packages</h3>
+
+<p>Select a specific Android Studio package for your platform. Also see the
+<a href="<?cs var:toroot ?>tools/revisions/studio.html">Android Studio release notes</a>.</p>
+
+ <table class="download">
+ <tr>
+ <th>Platform</th>
+ <th>Package</th>
+ <th>Size</th>
+ <th>SHA-1 Checksum</th>
+ </tr>
+
+ <tr>
+ <td rowspan="3">Windows</td>
+ <td>
+ <a onclick="return onDownload(this)" id="win-bundle"
+ href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_exe_download ?>"
+ ><?cs var:studio.win_bundle_exe_download ?></a><br>(Recommended)
+ </td>
+ <td><?cs var:studio.win_bundle_exe_bytes ?> bytes</td>
+ <td><?cs var:studio.win_bundle_exe_checksum ?></td>
+ </tr>
+
+ <tr>
+ <!-- blank TD from Windows rowspan -->
+ <td>
+ <a onclick="return onDownload(this)"
+ href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.win_notools_exe_download ?>"
+ ><?cs var:studio.win_notools_exe_download ?></a><br>(No SDK tools included)
+ </td>
+ <td><?cs var:studio.win_notools_exe_bytes ?> bytes</td>
+ <td><?cs var:studio.win_notools_exe_checksum ?></td>
+ </tr>
+
+ <tr>
+ <!-- blank TD from Windows rowspan -->
+ <td>
+ <a onclick="return onDownload(this)"
+ href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_download ?>"
+ ><?cs var:studio.win_bundle_download ?></a>
+ </td>
+ <td><?cs var:studio.win_bundle_bytes ?> bytes</td>
+ <td><?cs var:studio.win_bundle_checksum ?></td>
+ </tr>
+
+ <tr>
+ <td><nobr>Mac OS X</nobr></td>
+ <td>
+ <a onclick="return onDownload(this)" id="mac-bundle"
+ href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.mac_bundle_download ?>"
+ ><?cs var:studio.mac_bundle_download ?></a>
+ </td>
+ <td><?cs var:studio.mac_bundle_bytes ?> bytes</td>
+ <td><?cs var:studio.mac_bundle_checksum ?></td>
+ </tr>
+
+ <tr>
+ <td>Linux</td>
+ <td>
+ <a onclick="return onDownload(this)" id="linux-bundle"
+ href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.linux_bundle_download ?>"
+ ><?cs var:studio.linux_bundle_download ?></a>
+ </td>
+ <td><?cs var:studio.linux_bundle_bytes ?> bytes</td>
+ <td><?cs var:studio.linux_bundle_checksum ?></td>
+ </tr>
+ </table>
+
+
+
</div><!-- end pax -->
@@ -411,7 +415,9 @@
var bundlename;
var $toolslink;
- if (navigator.appVersion.indexOf("Win")!=-1) {
+ if (navigator.appVersion.indexOf("Mobile")!=-1) {
+ // Do nothing for any "mobile" user agent
+ } else if (navigator.appVersion.indexOf("Win")!=-1) {
os = "Windows";
bundlename = '#win-bundle';
$toolslink = $('#win-tools');
@@ -419,26 +425,18 @@
os = "Mac";
bundlename = '#mac-bundle';
$toolslink = $('#mac-tools');
- } else if (navigator.appVersion.indexOf("Linux")!=-1) {
+ } else if (navigator.appVersion.indexOf("Linux")!=-1 && navigator.appVersion.indexOf("Android")==-1) {
os = "Linux";
bundlename = '#linux-bundle';
$toolslink = $('#linux-tools');
}
- if (os) {
+ if (os != undefined) {
$('#not-supported').hide();
- /* set up primary adt download button */
- $('#download-bundle-button').show();
- $('#download-bundle-button').append("Download the SDK <br/><span class='small'>ADT Bundle for " + os + "</span>");
- $('#download-bundle-button').click(function() {return onDownload(this,true,true);}).attr('href', bundlename);
-
- /* set up sdk tools only button */
- $('#download-tools-button').show();
- $('#download-tools-button').append("Download the SDK Tools for " + os);
- $('#download-tools-button').click(function() {return onDownload(this,true);}).attr('href', $toolslink.attr('href'));
- } else {
- $('.pax').show();
+ /* set up primary Android Studio download button */
+ $('.download-bundle-button').append(" <br/><span class='small'>for " + os + "</span>");
+ $('.download-bundle-button').click(function() {return onDownload(this,true,true);}).attr('href', bundlename);
}
@@ -451,44 +449,29 @@
$("#downloadForRealz").html("Download " + $(link).text());
}
- /* if it's a bundle, show the 32/64-bit picker */
- if (bundle) {
- $("#downloadForRealz").attr('bundle','true');
- if ($("#downloadForRealz").text().indexOf("Mac") == -1) {
- $("p#bitpicker").show();
- } else {
- /* mac is always 64 bit, so set it checked */
- $("p#bitpicker input[value=64]").attr('checked', true);
- }
- /* save link name until the bit version is chosen */
- $("#downloadForRealz").attr('name',$(link).attr('href'));
- } else {
- /* if not using bundle, set download button to ignore bitpicker and set url */
- $("#downloadForRealz").attr('bundle','false');
- $("#downloadForRealz").attr('href',$(link).attr('href'));
- /* set picker checked as a fake default */
- $("p#bitpicker input[value=64]").attr('checked', true);
- $("a#next-link").html("Setting Up an Existing IDE").attr('href',toRoot + 'sdk/installing/index.html');
- }
+ $("#downloadForRealz").attr('bundle', bundle);
+ $("a#downloadForRealz").attr("name", $(link).attr('href'));
- $("#tos").fadeIn('fast');
- $("#landing").fadeOut('fast');
+ $("#tos").show();
+ $("#landing").hide();
- location.hash = "download";
+ location.hash = "top";
return false;
}
function onAgreeChecked() {
- /* verify that the TOS is agreed and a bit version is chosen */
- if ($("input#agree").is(":checked") && $("#bitpicker input:checked").length) {
+ /* verify that the TOS is agreed */
+ if ($("input#agree").is(":checked")) {
/* if downloading the bundle */
if ($("#downloadForRealz").attr('bundle')) {
- /* construct the name of the link we want based on the bit version */
- linkId = $("a#downloadForRealz").attr("name") + $("#bitpicker input:checked").val();
+ /* construct the name of the link we want */
+ linkId = $("a#downloadForRealz").attr("name");
/* set the real url for download */
$("a#downloadForRealz").attr("href", $(linkId).attr("href"));
+ } else {
+ $("a#downloadForRealz").attr("href", $("a#downloadForRealz").attr("name"));
}
/* reveal the download button */
@@ -499,16 +482,28 @@
}
function onDownloadForRealz(link) {
- if ($("input#agree").is(':checked') && $("#bitpicker input:checked").length) {
+ if ($("input#agree").is(':checked')) {
+ location.hash = "";
+ location.hash = "top";
$("div.sdk-terms").slideUp();
- $("#sdk-terms-form,.sdk-terms-intro").fadeOut('slow');
- $("#next-steps").fadeIn('slow');
- $("h1#tos-header").text('Get Ready to Code!');
- _gaq.push(['_trackEvent', 'SDK', 'ADT and Tools', $("#downloadForRealz").html()]);
+ $("h1#tos-header").text('Now downloading...');
+ $(".sdk-terms-intro").text('You\'ll be redirected to the install instructions in a moment.');
+ $("#sdk-terms-form").fadeOut('slow', function() {
+ setTimeout(function() {
+ if ($("#downloadForRealz").attr('bundle') == 'true') {
+ // User downloaded the studio Bundle
+ window.location = "/sdk/installing/index.html?pkg=studio";
+ } else {
+ // User downloaded the SDK Tools
+ window.location = "/sdk/installing/index.html?pkg=tools";
+ }
+ }, 3000);
+ });
+ ga('send', 'event', 'SDK', 'IDE and Tools', $("#downloadForRealz").html());
return true;
} else {
- $("label#agreeLabel,#bitpicker input").parent().stop().animate({color: "#258AAF"}, 200,
- function() {$("label#agreeLabel,#bitpicker input").parent().stop().animate({color: "#222"}, 200)}
+ $("label#agreeLabel").parent().stop().animate({color: "#258AAF"}, 200,
+ function() {$("label#agreeLabel").parent().stop().animate({color: "#222"}, 200)}
);
return false;
}
diff --git a/tools/droiddoc/templates-sdk-dyn/timestamp.cs b/tools/droiddoc/templates-sdk-dev/timestamp.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/timestamp.cs
rename to tools/droiddoc/templates-sdk-dev/timestamp.cs
diff --git a/tools/droiddoc/templates-sdk-dyn/trailer.cs b/tools/droiddoc/templates-sdk-dev/trailer.cs
similarity index 100%
rename from tools/droiddoc/templates-sdk-dyn/trailer.cs
rename to tools/droiddoc/templates-sdk-dev/trailer.cs
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index f411d93..d493566 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -17,18 +17,32 @@
height: 100%;
margin: 0;
padding: 0;
- background-color:#F9F9F9;
+ background-color: #fff;
-webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
/* prevent subpixel antialiasing, which thickens the text */
/* text-rendering: optimizeLegibility; */
/* turned off ligatures due to bug 5945455 */ }
body {
- color: #222;
- font: 14px/19px Roboto, sans-serif;
+ color: #515151;
+ color: rgba(0, 0, 0, .68);
+ font: 14px/24px Roboto, sans-serif;
font-weight: 400;
letter-spacing:.1;
- padding:0 10px; }
+ padding:0 20px;
+}
+
+@media (max-width: 719px) {
+ html {
+ /* Disable accidental horizontal overflow. */
+ overflow-x: hidden;
+ }
+
+ body {
+ padding: 0 10px;
+ }
+}
#page-container {
width: 940px;
@@ -83,13 +97,8 @@
}
#side-nav {
- min-height:5px; /* silly way to avoid doc floating left when nav goes fixed */
- margin-bottom:1px;
+ padding-top: 20px;
}
-#devdoc-nav {
- outline:none;
- width:auto;
- margin: 20px 0 0; }
#devdoc-nav h2 {
border:0;
@@ -98,44 +107,251 @@
#devdoc-nav.fixed {
position: fixed;
margin:0;
- top: 65px; /* sticky-header height + 20px gutter */
+ top: 84px; /* sticky-header height + 20px gutter */
}
-#devdoc-nav span.small {
- font-size:12px;
- font-weight:normal;
+.dac-devdoc-toggle {
+ cursor: pointer;
+ padding: 8px 0;
+}
+
+.scroll-pane {
+ /* Match height of fixed parent. */
+ height: 100%;
}
#content {
width: 760px;
float: left; }
-a:hover,
-acronym:hover {
- color: #7aa1b0 !important; }
-a:focus,
-a:active {
- color: #33b5e5 !important; }
+/***** PREVIOUSLY style.css ******************/
+/* This should be close to the top, so it is easier to override. */
+[dir='rtl'] {
+ direction: rtl;
+}
+html {
+ line-height: 20px;
+}
+pre, table, input, textarea, code {
+ font-size: 1em;
+}
+address, abbr, cite {
+ font-style: normal;
+}
+[dir='rtl'] th {
+ text-align: right;
+}
+html[lang^=ja] blockquote, html[lang^=ja] q, html[lang^=ko] blockquote, html[lang^=ko] q,
+html[lang^=zh] blockquote, html[lang^=zh] q {
+ font-style: normal;
+}
+q {
+ font-style: italic;
+}
+fieldset, iframe, img {
+ border: 0;
+}
+img {
+ border: none;
+ -ms-interpolation-mode: bicubic;
+ max-width: 100%;
+ vertical-align: middle;
+}
+video {
+ max-width: 100%;
+ object-fit: cover;
+}
+q {
+ quotes: none;
+}
+sup, sub {
+ font-size: 11px;
+ line-height: 0;
+}
+
+table, fieldset {
+ margin: 0;
+}
+/* Biggest type */
+.display-1 {
+ font-size: 56px;
+ line-height: 68px;
+}
+@media (max-width: 719px) {
+ .display-1 {
+ font-size: 44px;
+ line-height: 56px;
+ }
+}
+h1, h2, h3 {
+ color: #212121;
+ color: rgba(0, 0, 0, .87);
+}
+h1 {
+ font-size: 44px;
+ line-height: 56px;
+ margin: 24px 0 12px;
+ font-weight: 300;
+}
+h1.short {
+ margin-right:320px;
+}
+@media (max-width: 719px) {
+ h1 {
+ font-size: 36px;
+ line-height: 48px;
+ }
+}
+h2 {
+ clear: left;
+ font-size: 28px;
+ font-weight: 400;
+ line-height: 32px;
+ margin: 24px 0 16px;
+}
+h3 {
+ font-size: 24px;
+ line-height: 32px;
+ font-weight: 400;
+ margin: 16px 0;
+}
+h4 {
+ font-size: 18px;
+ line-height: 24px;
+ margin: 12px 0;
+ font-weight: 500;
+}
+h5, h6 {
+ font-size: 16px;
+ line-height: 24px;
+ margin: 8px 0;
+}
+hr { /* applied to the bottom of h2 elements */
+ height: 1px;
+ margin: 7px 0 12px;
+ border: 0;
+ background: #e5e5e5;
+}
+p, pre, table, form {
+ margin: 0 0 12px;
+}
+small {
+ font-size: 11.5px;
+ color: #000;
+}
+ul, ol {
+ margin: 0 0 15px 20px;
+ padding: 0;
+}
+[dir='rtl'] ul, [dir='rtl'] ol {
+ margin: 10px 30px 10px 10px;
+}
+ul ul, ul ol, ol ul, ol ol {
+ margin-bottom: 0;
+ margin-top: 0;
+}
+li {
+ margin: 0 0 12px;
+}
+dt {
+ margin: 24px 0 12px;
+}
+dd {
+ margin:0 0 10px 40px;
+}
+dd p,
+dd pre,
+dd ul,
+dd ol,
+dd dl {
+ margin-top:10px;
+}
+li p,
+li pre,
+li ul,
+li ol,
+li dl {
+ margin-top: 6px;
+ margin-bottom: 6px;
+}
+dl dd dl:first-child {
+ margin-top: 0;
+}
+pre strong, pre b, a strong, a b, a code {
+ color: inherit;
+}
+pre, code {
+ color: #060;
+ font: 13px/18px Consolas, "Liberation Mono", Menlo, Courier, monospace;
+ -webkit-font-smoothing: subpixel-antialiased;
+ -moz-osx-font-smoothing: auto;
+}
+code {
+ background-color: #f7f7f7;
+ padding: 3px 5px;
+}
+
+legend {
+ display: none;
+}
+a, .link-color {
+ color: #039BE5;
+ text-decoration: none;
+}
+a:focus, a:hover {
+ color: rgba(3, 155, 229, .7);
+ text-decoration: none;
+}
+a.white {
+ color: #fff;
+ text-decoration:underline;
+}
+a.white:hover, a.white:active {
+ color: #ccc;
+}
+strong, b {
+ font-weight: bold;
+}
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ border:0;
+ margin: .5em 1em 1em 0;
+ width:100%; /* consistent table widths; within IE's quirks */
+ background-color:#f7f7f7;
+}
+th, td {
+ padding: 4px 12px;
+ vertical-align: top;
+ text-align: left;
+}
+td {
+ background-color:inherit;
+ border:solid 1px #DDD;
+}
+td *:last-child {
+ margin-bottom:0;
+}
+th {
+ background-color: #999;
+ color: #fff;
+ border:solid 1px #DDD;
+ font-weight: normal;
+}
+tr:first-of-type th:first-of-type:empty {
+ visibility: hidden;
+}
a.external-link {
background:url('../images/styles/open_new_page.png') no-repeat 100% 50%;
padding-right:16px;
}
-img {
- border: none; }
#jd-content img {
margin-bottom:15px;
}
-ul {
- margin: 0;
- padding: 0; }
-
-strong {
- font-weight: 500; }
-
em {
font-style: italic; }
@@ -155,6 +371,7 @@
/* disclosures mixin */
/* content layout */
+/* This grid is deprecated in favor of .cols and .col-X */
.layout-content-row {
display: inline-block;
margin-bottom: 10px; }
@@ -264,33 +481,32 @@
/* sublinks */ }
#nav li {
list-style-type: none;
- font-size: 14px;
+ font-size: 12px;
margin:0;
padding:0;
- line-height: 15px; }
+ line-height: 18px; }
#nav a {
- color: #555555;
+ color: #505050;
text-decoration: none;
word-wrap:break-word; }
#nav .nav-section-header {
position: relative;
margin-bottom: 1px;
padding: 0 30px 0 0; }
- #nav li.selected a, #nav li.selected > .nav-section-header > a {
- color: #09C;
+ #nav li.selected a {
+ color: #039BE5;
}
#nav li.selected ul li a {
/* don't highlight child items */
- color: #555555; }
+ color: #505050; }
#nav .nav-section .nav-section .nav-section-header {
/* no white line between second level sections */
margin-bottom: 0; }
/* section header links */
#nav > li > div > a {
display: block;
- color: #333333;
- font-weight: 500;
- padding: 10px 0 10px 10px; }
+ font-weight: 700;
+ padding: 13px 0 12px 10px; }
#nav .nav-section-header:after {
content: '';
background: transparent url(../images/styles/disclosure_down.png) no-repeat scroll 50% 50%;
@@ -298,7 +514,7 @@
height: 34px;
display: block;
position: absolute;
- top: 0;
+ top: 6px;
right: 0; }
#nav .nav-section-header.empty {
padding:0; }
@@ -312,22 +528,24 @@
#nav .nav-section li a {
/* first gen child (2nd level li) */
display:block;
- font-weight: normal;
+ font-weight: 700;
text-transform: none;
- padding: 7px 5px 7px 10px;
+ padding: 13px 5px 13px 10px;
}
#nav .nav-section li li a {
/* second gen child (3rd level li) */
- padding: 5px 5px 5px 10px;
+ font-weight: 400;
+ padding: 7px 5px 7px 10px;
}
#nav li.expanded .nav-section-header {
- background:#e9e9e9;
- background: rgba(0, 0, 0, 0.05); }
+ background: #f0f0f0; }
+ #nav li.expanded .nav-section-header.empty {
+ background: none; }
#nav li.expanded li .nav-section-header {
- background: transparent; }
+ background: none; }
#nav li.expanded li ul {
/* 3rd level ul */
- padding:0 0 0 10px;
+ padding:6px 0 1px 20px;
}
#nav li.expanded > .nav-section-header:after {
content: '';
@@ -394,16 +612,12 @@
padding-bottom:0;
}
#nav li.expanded ul > li {
- background:#efefef;
- background: rgba(0, 0, 0, 0.03); }
+ background:#f7f7f7; }
#nav li.expanded ul > li li {
background:inherit; }
#nav li ul.tree-list-children ul {
display:block; }
-#nav.samples-nav li li li {
- font-size:13px;
-}
#nav.samples-nav li li li a {
padding-top:3px;
padding-bottom:3px;
@@ -423,25 +637,19 @@
/* content header */
.content-header {
- height: 30px;
- margin:36px 0 23px; /* same as h1 */
- padding:0 0 10px;} /* same as h1 */
+ position: relative;
+}
+.content-header:before,
+.content-header:after {
+ content: '';
+ display: table;
+ /* Clear heading margins, to make absolutely positioned nav a bit more predictable. */
+}
.content-header.just-links {
margin-bottom:0;
padding-bottom:0;}
-.content-header h1 {
- margin:0;
- padding:0;
- width: 700px;
-}
-.content-header > div:first-child {
- height:1px; /* set fixed height for the header div to ensure the
- next/prev links align with toc on training classes */
-}
-
.content-footer {
- border-top: 1px solid #ccc;
margin-top: 10px;
padding-top:10px;
width:100%; }
@@ -453,7 +661,7 @@
margin-right:0;
}
.content-footer.wrap {
- width:940px;
+ max-width:940px;
}
.content-footer .plus-container {
margin:5px 0 0;
@@ -467,7 +675,10 @@
}
.content-header .paging-links {
- margin-top:-25px;
+ position: absolute;
+ right: 0;
+ top: 8px;
+ width: 220px;
}
.paging-links {
position: relative;
@@ -476,9 +687,7 @@
position: absolute; }
.paging-links a,
.training-nav-top a {
- color: #555555;
- text-decoration: none;
- text-transform: uppercase; }
+ text-decoration: none; }
.paging-links .prev-page-link:before,
.training-nav-top .prev-page-link:before,
a.back-link:before {
@@ -488,10 +697,6 @@
height: 10px;
display: inline-block;
margin-right: 5px; }
- .training-nav-top .next-page-link,
- .training-nav-top .start-class-link,
- .training-nav-top .start-course-link {
- right: 10px; }
.paging-links .prev-page-link {
left: -15px; }
.paging-links .next-page-link {
@@ -517,20 +722,25 @@
}
.training-nav-top a {
+ border-bottom:0;
+ box-sizing: border-box;
+ color: inherit;
display:block;
float:left;
- width:122px;
- height:28px;
- padding: 8px;
- line-height:28px;
+ padding:10px 0;
+ line-height:30px;
text-align:center;
- border:1px solid #DADADA;
- border-bottom:0;
+ width: 50%;
+ }
+
+ .training-nav-top a.prev-page-link {
+ padding-left: 15px;
+ text-align: left;
}
.training-nav-top a.next-page-link {
- border-left:0;
- width:123px;
+ padding-right: 15px;
+ text-align: right;
}
.paging-links a.disabled,
@@ -547,41 +757,57 @@
}
.training-nav-top a.start-class-link,
- .training-nav-top a.start-course-link {
- width:262px;
- }
-
+ .training-nav-top a.start-course-link,
.paging-links a.start-class-link {
width:100%;
}
/* list of classes on course landing page */
ol.class-list {
- list-style:none;
- margin-left:0;
+ counter-reset: class;
+ list-style: none;
+ margin: 60px 0 0;
}
ol.class-list>li {
- margin:0 0 15px;
- padding:5px 0 0;
- overflow:hidden;
- border-top:1px solid #ccc;
+ box-shadow: 0px 2px 5px 0 rgba(0, 0, 0, 0.26);
+ margin: 0 0 20px;
+ overflow: hidden;
}
- ol.class-list li a.title {
- font-size:16px;
- margin:0;
- clear:left;
- display:block;
- height:32px;
- padding:0 4px;
+ ol.class-list .title {
+ background: #00bcd4;
+ color: #fff;
+ display: block;
+ font-size: 20px;
+ font-weight: 500;
+ height: 32px;
+ margin: 0;
+ padding: 52px 16px 12px;
+ position: relative;
}
- ol.class-list li a.title h2 {
- color:inherit;
+ ol.class-list .title:before {
+ border-bottom: 1px solid white;
+ box-sizing: border-box;
+ /* Disable the numbers for now, since vert few classes need to be taken in order. */
+ /* content: counter(class); */
+ counter-increment: class;
+ height: 40px;
+ left: 0;
+ padding: 10px 1px 0 5px;
+ position: absolute;
+ top: 0;
+ text-align: right;
+ min-width: 30px;
+ }
+ ol.class-list .title h2 {
+ color: currentColor;
+ font-size: inherit;
+ font-weight: inherit;
margin:0 0 10px;
display:block;
float:left;
width:675px;
}
- ol.class-list li a.title span {
+ ol.class-list .title span {
display:none;
float:left;
font-size:18px;
@@ -590,40 +816,71 @@
width: 10px;
height: 32px;
}
- ol.class-list li a.title:hover {
- background:#ddd;
- color:#258AAF !important;
- }
- ol.class-list li a.title:hover span {
- display:block;
- }
- #jd-content
- ol.class-list li img {
- float:left;
- clear:left;
- width:64px;
- margin:0 20px 0 0;
- }
- ol.class-list li p.description {
+ ol.class-list .description {
+ box-sizing: border-box;
float:left;
display:block;
- width:250px;
margin:0;
+ padding: 16px 10px 16px 16px;
+ width: 50%;
}
- ol.class-list li p.description.article {
+ ol.class-list .description.article {
width: 550px;
}
ol.class-list ol {
- float:left;
- width:320px;
- margin:0 0 0 30px;
- list-style:none;
- margin:0 0 0 20px;
+ box-sizing: border-box;
+ float: left;
+ list-style: none;
+ margin: 0;
+ padding: 16px 16px 16px 10px;
+ width: 50%;
}
- ol.class-list div.lessons li {
- margin:0 0 6px;
- line-height:16px;
+ ol.class-list .lessons li {
+ margin: 0 0 6px;
+ line-height: 16px;
+ }
+
+ /* Class colors */
+ ol.class-list li:nth-child(10n+1) .title {
+ background: #00bcd4;
+ }
+ ol.class-list li:nth-child(10n+2) .title {
+ background: #4db6ac;
+ }
+ ol.class-list li:nth-child(10n+3) .title {
+ background: #66bb6a;
+ }
+ ol.class-list li:nth-child(10n+4) .title {
+ background: #7cb342;
+ }
+ ol.class-list li:nth-child(10n+5) .title {
+ background: #afb42b;
+ }
+ ol.class-list li:nth-child(10n+6) .title {
+ background: #ffb300;
+ }
+ ol.class-list li:nth-child(10n+7) .title {
+ background: #ff7043;
+ }
+ ol.class-list li:nth-child(10n+8) .title {
+ background: #ec407a;
+ }
+ ol.class-list li:nth-child(10n+9) .title {
+ background: #ab47bc;
+ }
+ ol.class-list li:nth-child(10n+10) .title {
+ background: #7e57c2;
+ }
+
+ @media (max-width: 719px) {
+ ol.class-list ol,
+ ol.class-list .description {
+ float: none;
+ margin: 16px;
+ padding: 0;
+ width: auto;
+ }
}
@@ -669,7 +926,7 @@
}
ul#title-tabs li a:hover,
ul#title-tabs li a:active {
- color:#93C !important;
+ color:#039BE5 !important;
}
@@ -798,46 +1055,6 @@
.design li.with-icon.use:before {
background-image: url(../images/styles/ico_use.png); }
-/* figures and callouts */
-.figure {
- position: relative; }
- .figure.pad-below {
- margin-bottom: 20px; }
- .figure .figure-callout {
- position: absolute;
- color: #fff;
- font-weight: 500;
- font-size: 16px;
- line-height: 23px;
- text-align: center;
- background: transparent url(../images/styles/callout.png) no-repeat scroll 50% 50%;
- padding-right: 2px;
- width: 30px;
- height: 29px;
- z-index: 1000; }
- .figure .figure-callout.top {
- top: -9px; }
- .figure .figure-callout.right {
- right: -5px; }
-
-.figure-caption {
- margin: 0 10px 20px 0;
- font-size: 14px;
- line-height: 20px;
- font-style: italic; }
-
-/* rows of figures */
-.figure-row {
- font-size: 0;
- line-height: 0;
- /* to prevent space between figures */ }
- .figure-row .figure {
- display: inline-block;
- vertical-align: top; }
- .figure-row .figure + .figure {
- margin-left: 10px;
- /* reintroduce space between figures */ }
-
/* video containers */
.framed-galaxynexus-land-span-13 {
background: transparent url(../images/styles/device_galaxynexus_blank_land_span13.png) no-repeat
@@ -1031,6 +1248,15 @@
.download-button:active {
background-color: #006699; }
+.button.disabled,
+.button.disabled:hover,
+.button.disabled:active {
+ background:#ebebeb;
+ color:#999 !important;
+ border-color:#999;
+ cursor:default;
+}
+
/* UI tables and other things found in Writing style and Settings pattern */
.ui-table {
width: 100%;
@@ -1071,233 +1297,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/***** PREVIOUSLY style.css ******************/
-
-
-
-
-
-@media screen, projection, print {
-[dir='rtl'] {
- direction: rtl;
-}
-html {
- line-height: 20px;
-}
-pre, table, input, textarea, code {
- font-size: 1em;
-}
-address, abbr, cite {
- font-style: normal;
-}
-[dir='rtl'] th {
- text-align: right;
-}
-html[lang^=ja] blockquote, html[lang^=ja] q, html[lang^=ko] blockquote, html[lang^=ko] q,
-html[lang^=zh] blockquote, html[lang^=zh] q {
- font-style: normal;
-}
-q {
- font-style: italic;
-}
-fieldset, iframe, img {
- border: 0;
-}
-img {
- -ms-interpolation-mode: bicubic;
- vertical-align: middle;
- max-width: 100%;
-}
-q {
- quotes: none;
-}
-sup, sub {
- font-size: 11px;
- line-height: 0;
-}
-}
-
-@media screen, projection {
-
-table, fieldset {
- margin: 0;
-}
-h1 {
- color:#333;
- font-size: 34px;
- margin: 36px 0 27px;
- padding:0 0 10px;
- font-weight:300;
-}
-h1, h2 {
- line-height: 30px;
-}
-h1.short {
- margin-right:320px;
-}
-h1.short {
- margin-right:320px;
-}
-h1.super {
- font-size: 37px;
-}
-h2 {
- color:#333;
- font-size: 26px;
- margin: 32px 0 20px;
- padding:0;
- font-weight:300;
-}
-h3 {
- color:#333;
- font-size: 21px;
- font-weight:400;
- margin:21px 0 14px 0;
-}
-h3, h4 {
- line-height: 21px;
-}
-h4 {
- font-size: 18px;
- margin: 12px 0;
- font-weight:500;
-}
-h5 {
- font-size: 14px;
-}
-h5, h6 {
- margin: 5px 0;
-}
-h6 {
- font-size: 12px;
-}
-hr { /* applied to the bottom of h2 elements */
- height: 1px;
- margin: 3px 0 12px;
- border: 0;
- background: #ccc;
-}
-p, pre, table, form {
- margin: 0 0 15px;
-}
-small {
- font-size: 11.5px;
- color: #000;
-}
-ul, ol {
- margin: 0 0 15px 18px;
- padding: 0;
-}
-[dir='rtl'] ul, [dir='rtl'] ol {
- margin: 10px 30px 10px 10px;
-}
-ul ul, ul ol, ol ul, ol ol {
- margin-bottom: 0;
- margin-top: 0;
-}
-li {
- margin:0 0 5px;
-}
-dd {
- margin:0 0 10px 30px;
-}
-dd p,
-dd pre,
-dd ul,
-dd ol,
-dd dl {
- margin-top:10px;
-}
-li p,
-li pre,
-li ul,
-li ol,
-li dl {
- margin-top:5px;
- margin-bottom:5px;
-}
-dl dd dl:first-child {
- margin-top:0;
-}
-pre strong, pre b, a strong, a b, a code {
- color: inherit;
-}
-pre, code {
- color: #060;
- font: 13px/1.5 monospace;
-}
-code {
- font-weight:bold;
- font: 13px/14px monospace;
-}
-
-legend {
- display: none;
-}
-a:link, a:visited, .link-color {
- color: #258aaf;
- text-decoration: none;
-}
-a:focus, a:hover, a:active {
- color: #33B5E5;
- text-decoration: none;
-}
-a.white {
- color: #fff;
- text-decoration:underline;
-}
-a.white:hover, a.white:active {
- color: #ccc !important;
-}
-strong, b {
- font-weight:bold;
- color: #222;
-}
-table {
- border-collapse: collapse;
- border-spacing: 0;
- border:0;
- margin: .5em 1em 1em 0;
- width:100%; /* consistent table widths; within IE's quirks */
- background-color:#f7f7f7;
-}
-th, td {
- padding: 4px 12px;
- vertical-align: top;
- text-align: left;
-}
-td {
- background-color:inherit;
- border:solid 1px #DDD;
-}
-td *:last-child {
- margin-bottom:0;
-}
-th {
- background-color: #999;
- color: #fff;
- border:solid 1px #DDD;
- font-weight: normal;
-}
-tr:first-of-type th:first-of-type:empty {
- visibility: hidden;
-}
-
/* --------------------------------------------------------------------------
Footer
*/
@@ -1468,430 +1467,23 @@
}
/* =============================================================================
- Columns
- ========================================================================== */
-
-@media screen, projection, print {
-.full {
- padding: 2.5em 0;
- border-top: solid 1px #ddd;
- border-bottom: solid 1px #ddd;
- background: #f7f7f7;
-}
-.wrap {
- margin: 0 auto;
- width: 940px;
- clear: both;
-}
-.cols {
- height: 1%;
- margin: 0 -1.533742331288343558282%;
- width: 103.06748466257669%}
-*+html .cols {
- margin-bottom: 20px;
-}
-.cols:after {
- clear: both;
- content: ' ';
- display: block;
- height: 0;
- visibility: hidden;
-}
-.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
-.col-13, .col-14, .col-15, .col-16 {
- display: inline;
- float: left;
- margin-left: 10px;
- margin-right: 10px;
-}
-/*
-* html .col-1, * html .col-2, * html .col-3, * html .col-4, * html .col-5, * html .col-6, * html
-.col-7, * html .col-8, * html .col-9, * html .col-10, * html .col-11, * html .col-12 {
- margin: 0;
- padding: 0 1.4% 20px;
-}
-[dir='rtl'] .col-1, [dir='rtl'] .col-2, [dir='rtl'] .col-3, [dir='rtl'] .col-4, [dir='rtl'] .col-5,
-[dir='rtl'] .col-6, [dir='rtl'] .col-7, [dir='rtl'] .col-8, [dir='rtl'] .col-9, [dir='rtl'] .col-10,
-[dir='rtl'] .col-11, [dir='rtl'] .col-12 {
- float: right;
-}
-*/
-.col-1 { width: 40px }
-.col-2 { width: 100px }
-.col-3 { width: 160px }
-.col-4 { width: 220px }
-.col-5 { width: 280px }
-.col-6 { width: 340px }
-.col-7 { width: 400px }
-.col-8 { width: 460px }
-.col-9 { width: 520px }
-.col-10 { width: 580px }
-.col-11 { width: 640px }
-.col-12 { width: 700px }
-.col-13 { width: 760px }
-.col-14 { width: 820px }
-.col-15 { width: 880px }
-.col-16 { width: 940px }
-}
-
-.col-right {
- margin-right:0px;
-}
-
-@media screen and (max-width:772px) {
-.col-5, .col-6, .col-7 {
- clear: both;
- width: 97.0238096%}
-}
-
-/* =============================================================================
Layout
========================================================================== */
@media screen, projection, print {
-/* --------------------------------------------------------------------------
-Header, Login, Nav-X, Search
-*/
-#header {
- margin: 0;
- padding: 0;
-}
-#header:before, #header:after {
- content: "";
- display: table;
- clear: both
-}
-.logo, .nav-x {
- float: left;
-}
-.nav-x {
- margin-top: -2px;
- list-style-type: none;
-}
-.nav-x a {
- color: #333;
- font-size: 16px;
-}
-.about a.selected {
- color: #9933CC;
-}
-.design a.selected {
- color: #33b5e5;
-}
-.develop a.selected {
- color: #F80;
-}
-.distribute a.selected {
- color: #9C0;
-}
-
-
-
-.nav-x li {
- display: inline;
- margin-right: 45px;
-}
-.search {
- float: right;
- position: relative;
- width: 220px
-}
-.search .bottom, .search .left, .search .right {
+.training-nav-top {
+ border:1px solid #e5e5e5;
+ border-width: 1px 1px 0;
+ bottom: -56px;
+ box-sizing: border-box;
position: absolute;
- background-color: #a3a3a3;
-}
-.search .bottom {
- width: 220px;
- height: 1px;
- top: 24px;
- left: 0
-}
-.search .left, .search .right {
- height: 5px;
- width: 1px
-}
-.search .left { top: 19px; left: 0 }
-.search .right { top: 19px; right: 0 }
-.search form {
- float: left;
- margin-top: 2px;
- width: inherit;
-}
-.search .close,
-#player-frame .close {
- position: absolute;
- right: 8px;
- bottom: 4px;
- width: 16px;
- height: 16px;
- margin: 0;
- text-indent: -1000em;
- background: url(../images/close.png) no-repeat 0 0;
- z-index:9999;
-}
-.search .close:hover, .search .close:focus,
-#player-frame .close:hover, #player-frame .close:focus {
- background-position: -16px 0;
- cursor:pointer;
-}
-#player-frame .close {
- top: 6px;
-}
-.search form input {
- color: #999;
- font-size: 1em;
- width: inherit;
- border: none;
- margin: 0;
- padding:0 0 0 6px;
- z-index: 1500;
- background-color: transparent
-}
-.search:hover .bottom, .search:hover .left, .search:hover .right {
- background-color: #33b5e5;
-}
-.search:hover .icon {
- background-position: -8px 0
-}
-.search form input:focus {
- color: #222;
- font-weight: bold;
- outline:0;
-}
-/* Search Dropdown */
-.search-dropdown {
- padding: 15px;
- width: 192px;
- border: solid 1px #c5c5c5;
- background: #fff;
- position: absolute;
- top: 35px;
- left: 0;
- -moz-box-shadow: 0 0 10px rgba(0,0,0,0.2);
- -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.2);
- box-shadow: 0 0 10px rgba(0,0,0,0.2)
-}
-.search-dropdown ul, .search-dropdown ul li {
- list-style-type: none;
- margin: 0;
- padding: 0
-}
-.search-dropdown ul li {
- clear: both
-}
-.search-dropdown img {
- float: left;
- margin: 0 10px 10px 0
-}
-.search-dropdown h6 {
- color: #222;
- margin: 0;
- line-height: normal
-}
-.search-dropdown .desc {
- color: #999;
- font-size: 11.5px;
- line-height: normal;
- margin: 0;
-}
-.search-dropdown li a:hover h6, .search-dropdown li a:hover .desc {
- color: #33b5e5
-}
-/* --------------------------------------------------------------------------
-Buttons
-*/
-.button, a.button, .button-secondary, a.button-secondary {
- border-image: initial;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px;
- cursor: pointer;
-}
-.button, a.button {
- display:inline-block;
- background-color: #09c;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#2faddb), to(#09c));
- background-image: -webkit-linear-gradient(top, #2faddb, #09c);
- background-image: -moz-linear-gradient(top, #2faddb, #09c);
- background-image: -ms-linear-gradient(top, #2faddb, #09c);
- background-image: -o-linear-gradient(top, #2faddb, #09c);
- background-image: linear-gradient(top, #2faddb, #09c);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#2faddb', EndColorStr='#0099cc',GradientType=0);
- border: 1px solid #3990ab;
- color: #fff;
-}
-.button-secondary, a.button-secondary {
- background-color: #f3f3f3;
- border: 1px solid #dcdcdc;
- color: #444;
-}
-a.button, a.button:visited, a.button-secondary, a.button-secondary:visited {
- margin-right: 16px;
- font-weight: 400;
- min-width: 54px;
- outline: 0;
- padding: 8px 15px;
- text-align: center;
-}
-.button, .button-secondary {
- margin-right: 16px;
- font-weight: 400;
- min-width: 54px;
- outline: 0;
- padding: 0 15px;
- text-align: center;
-}
-.button:hover, a.button:hover {
- border-color: #09c;
- background-color: #4cadcb;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#5dbcd9), to(#4cadcb));
- background-image: -webkit-linear-gradient(top, #5dbcd9, #4cadcb);
- background-image: -moz-linear-gradient(top, #5dbcd9, #4cadcb);
- background-image: -ms-linear-gradient(top, #5dbcd9, #4cadcb);
- background-image: -o-linear-gradient(top, #5dbcd9, #4cadcb);
- background-image: linear-gradient(top, #5dbcd9, #4cadcb);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#5dbcd9',
-EndColorStr='#4cadcb',GradientType=0);
- color: #fff !important;
-}
-.button:active, a.button:active {
- background-color: #1e799a;
- background-image: none;
- border-color: #30b7e6;
-}
-a.button.big.subtitle {
- line-height:18px;
-}
-.button-secondary:hover, a.button-secondary:hover {
- border-color: #dbdbdb;
- background-color: #f3f3f3;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));
- background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
- background-image: -moz-linear-gradient(top, #f9f9f9, #ececec);
- background-image: -ms-linear-gradient(top, #f9f9f9, #ececec);
- background-image: -o-linear-gradient(top, #f9f9f9, #ececec);
- background-image: linear-gradient(top, #f9f9f9, #ececec);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f9f9f9',
-EndColorStr='#ececec');
- color: #33B5E5 !important;
-}
-.button-secondary:active, a.button-secondary:active {
- border-color: #dadada;
- background: #ebebeb; /* Old browsers */
- /* IE9 SVG, needs conditional override of 'filter' to 'none' */
- background:
-url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/
-Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0Jv
-eD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+
-CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIg
-eDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ViZWJl
-YiIgc3RvcC1vcGFjaXR5PSIxIi8+
-CiAgICA8c3RvcCBvZmZzZXQ9IjEwJSIgc3RvcC1jb2xvcj0iI2Y5ZjlmOSIgc3RvcC1vcGFjaXR5PSIxIi8+
-CiAgICA8c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2ZhZmFmYSIgc3RvcC1vcGFjaXR5PSIxIi8+
-CiAgICA8c3RvcCBvZmZzZXQ9IjkwJSIgc3RvcC1jb2xvcj0iI2Y5ZjlmOSIgc3RvcC1vcGFjaXR5PSIxIi8+
-CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmNmY2ZjYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFy
-R3JhZGllbnQ+
-CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIg
-Lz4KPC9zdmc+);
- background: -moz-linear-gradient(top, #ebebeb 0%, #f9f9f9 5%, #fafafa 50%, #f9f9f9 90%,
-#ffffff 100%); /* FF3.6+ */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ebebeb),
-color-stop(5%,#f9f9f9), color-stop(50%,#fafafa), color-stop(90%,#f9f9f9), color-stop(100%,#ffffff));
-/* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, #ebebeb 0%,#f9f9f9 5%,#fafafa 50%,#f9f9f9
-90%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, #ebebeb 0%,#f9f9f9 5%,#fafafa 50%,#f9f9f9 90%,#ffffff
-100%); /* Opera 11.10+ */
- background: -ms-linear-gradient(top, #ebebeb 0%,#f9f9f9 5%,#fafafa 50%,#f9f9f9 90%,#ffffff
-100%); /* IE10+ */
- background: linear-gradient(top, #ebebeb 0%,#f9f9f9 5%,#fafafa 50%,#f9f9f9 90%,#ffffff
-100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebebeb',
-endColorstr='#ffffff',GradientType=0 ); /* IE6-8 */
- -webkit-box-shadow: inset 0px 0px 5px 2px rgba(0, 0, 0, .05);
- -moz-box-shadow: inset 0px 0px 5px 2px rgba(0, 0, 0, .05);
- box-shadow: inset 0px 0px 5px 2px rgba(0, 0, 0, .05);
- color: #258AAF !important;
-}
-.button.big {
- font-size:20px;
- display:inline-block;
-}
-.button.big span.small {
- font-size:14px;
-}
-.button-caption {
- margin-top:10px;
- font-size:12px;
- font-style:italic;
+ right: 0;
+ width: 280px;
}
-.button.disabled,
-.button.disabled:hover,
-.button.disabled:active {
- background:#ebebeb;
- color:#999 !important;
- border-color:#999;
- cursor:default;
-}
-
-.training-nav-top a.button-secondary,
-.training-nav-bottom a.button-secondary {
- display:block;
- float:left;
- margin:0;
- width:130px;
- text-transform:uppercase;
- font-weight:bold;
-
- background-color: #f3f3f3;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));
- background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
- background-image: -moz-linear-gradient(top, #f9f9f9, #ececec);
- background-image: -ms-linear-gradient(top, #f9f9f9, #ececec);
- background-image: -o-linear-gradient(top, #f9f9f9, #ececec);
- background-image: linear-gradient(top, #f9f9f9, #ececec);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f9f9f9',
-EndColorStr='#ececec');
- color: #33B5E5;
-}
-
-.training-nav-top a.button-secondary:hover,
-.training-nav-bottom a.button-secondary:hover {
- background-color: #09c;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#2faddb), to(#09c));
- background-image: -webkit-linear-gradient(top, #2faddb, #09c);
- background-image: -moz-linear-gradient(top, #2faddb, #09c);
- background-image: -ms-linear-gradient(top, #2faddb, #09c);
- background-image: -o-linear-gradient(top, #2faddb, #09c);
- background-image: linear-gradient(top, #2faddb, #09c);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#2faddb', EndColorStr='#09c');
- border: 1px solid #3990ab;
- color: #fff !important;
-}
-
-.training-nav-top a.button-secondary.last,
-.training-nav-bottom a.button-secondary.last {
- border-left:0;
-}
-
-.training-nav-top a.button-secondary.double-size,
-.training-nav-bottom a.button-secondary.double-size {
- width:291px;
-}
-
-.training-nav-top,
.training-nav-bottom {
float:right;
margin:0 0 0 20px;
-}
-
-.training-nav-top {
- position:relative;
- top:73px;
-}
-
-.training-nav-bottom {
padding:0 0 20px;
}
@@ -1904,33 +1496,38 @@
}
#tb-wrapper {
- margin:51px 0 0 20px; /* negative top-margin to counter the content-header bottom margin */
+ margin:56px 0 0 20px; /* negative top-margin to counter the content-header bottom margin */
}
#tb,
#qv {
- font-size:13px;
- line-height:18px;
- width:238px;
- border:1px solid #ccc;
- float:right;
+ border: 1px solid #e5e5e5;
+ box-sizing: border-box;
+ float: right;
+ line-height: 16px;
+ padding: 5px 0;
+ width: 240px;
}
#tb {
- width:278px;
+ width:280px;
}
#tb h2,
#qv h2 {
- margin:10px 15px;
- padding:0;
- text-transform:uppercase;
- border-bottom:1px solid gainsboro;
+ border-top: 1px solid #e5e5e5;
+ color: inherit;
+ font-size: 16px;
+ line-height: 24px;
+ margin: 15px 0 4px;
+ padding: 10px 15px 0;
}
-#tb *,
-#qv * {
- font-size:inherit;
+#tb h2:first-child,
+#qv h2:first-child {
+ border-top: 0;
+ padding-top: 0;
+ margin-top: 10px;
}
#tb .download-box,
@@ -1942,7 +1539,28 @@
#qv .download-box .filename {
font-size:11px;
margin:4px 4px 10px;
- color:#666;
+}
+
+@media (max-width: 719px) {
+ .training-nav-top {
+ left: 0;
+ width: auto;
+ }
+
+ #tb-wrapper {
+ clear: none;
+ float: none;
+ margin-left: 0;
+ }
+
+ #tb {
+ float: none;
+ width: auto;
+ }
+
+ #qv-wrapper {
+ display: none;
+ }
}
@@ -1959,9 +1577,9 @@
width:226px;
font-size:13px;
line-height:18px;
- border-left:4px solid #99CC00;
+ border-left:3px solid #a9e27d;
float:right;
- padding:0 0 0 10px;
+ padding:0 0 0 20px;
margin:0 0 1em 20px;
}
@@ -1985,7 +1603,15 @@
#tb ol,
#tb ul,
#qv ul {
- margin:0 15px 10px 35px;
+ list-style-type: none;
+ margin:0 15px 10px 15px;
+}
+
+#tb li,
+#qv li {
+ margin: 8px 0;
+ padding: 0 0 0 16px;
+ position: relative;
}
#tb p {
@@ -2005,11 +1631,7 @@
#qv ul ul,
.sidebox ol ol,
.sidebox ul ul {
- margin-bottom:0;
-}
-
-#qv ol ol {
- margin:3px 0 3px 15px;
+ margin: 8px 0;
}
.sidebox p,
@@ -2145,7 +1767,6 @@
border-radius: 2px;
margin: 10px 0;
padding: 20px;
- color: #666;
position: relative;
background: #f9f9f9;
}
@@ -2332,16 +1953,11 @@
/* nav tree */
-#side-nav, #swapper,
-#nav-tree, #tree-list {
+#swapper, #nav-tree, #tree-list {
overflow:hidden;
margin-left:0;
}
-#devdoc-nav {
- overflow:visible !important; /* To keep the "to top" button visible */
-}
-
#nav-tree ul {
list-style:none;
padding:0;
@@ -2443,7 +2059,7 @@
border-bottom: 1px solid #CCC;
background:#e9e9e9;
background: rgba(0, 0, 0, 0.05); /* matches #nav li.expanded */
-
+ line-height: 19px; /* Fix regression after page line-height is bumped to 24px */
}
#api-nav-title {
padding:0 5px;
@@ -2795,7 +2411,7 @@
}
/* --------------------------------------------------------------------------
-Misc
+Misc and article typography
*/
@@ -2842,27 +2458,121 @@
p.img-caption {
margin: -10px 0 20px;
- font-size:13px;
- color:#666;
+ font-size: 13px;
}
-div.figure,
-div.figure-right {
- float:right;
- clear:right;
- margin:10px 0 0 0;
- padding:0 0 0 20px;
+/* figures and callouts */
+.figure {
+ position: relative;
+}
+
+.figure.pad-below {
+ margin-bottom: 20px;
+}
+
+.figure .figure-callout {
+ position: absolute;
+ color: #fff;
+ font-weight: 500;
+ font-size: 16px;
+ line-height: 23px;
+ text-align: center;
+ background: transparent url(../images/styles/callout.png) no-repeat scroll 50% 50%;
+ padding-right: 2px;
+ width: 30px;
+ height: 29px;
+ z-index: 1000;
+}
+
+.figure .figure-callout.top {
+ top: -9px;
+}
+
+.figure .figure-callout.right {
+ right: -5px;
+}
+
+.figure-caption {
+ margin: 0 10px 20px 0;
+ font-size: 14px;
+ line-height: 20px;
+ font-style: italic;
+}
+
+/* rows of figures */
+.figure-row {
+ font-size: 0;
+ line-height: 0;
+ /* to prevent space between figures */
+}
+
+.figure-row .figure {
+ display: inline-block;
+ vertical-align: top;
+}
+
+.figure-row .figure + .figure {
+ margin-left: 10px;
+ /* reintroduce space between figures */
+}
+
+.border-img {
+ border: 1px solid #CCC;
+}
+
+.center-img {
+ margin: auto;
+ text-align: center;
+}
+.center-img img {
+ margin-bottom: 15px;
+}
+
+.figure img,
+.figure-right img,
+.figure-left img,
+.figure-center img,
+.border-img {
+ margin-bottom: 15px;
+}
+
+.figure-center {
+ margin: 32px auto 24px;
+ max-width: 100%;
+}
+
+.figure,
+.figure-right {
+ clear: right;
+ float: right;
+ margin: 10px 0 0 0;
+ padding: 0 0 0 20px;
+ max-width: 50%;
/* width must be defined w/ an inline style matching the image width */
}
-div.figure-left {
- float:left;
- clear:left;
- margin:10px 0 0 0;
- padding:0 20px 0 0;
+.figure-left {
+ clear: left;
+ float: left;
+ margin: 10px 0 0 0;
+ padding: 0 20px 0 0;
+ max-width: 50%;
/* width must be defined w/ an inline style matching the image width */
}
+@media (max-width: 719px) {
+ /* Collapse on mobile. */
+ .figure,
+ .figure-right,
+ .figure-left {
+ float: none;
+ clear: none;
+ padding: 0;
+ margin: 32px auto 24px;
+ max-width: 100%;
+ }
+}
+
img.frame {
border:1px solid #DDD;
padding:4px;
@@ -2871,38 +2581,31 @@
p.table-caption {
margin: 0 0 4px 0;
font-size:13px;
- color:#666;
}
p.code-caption {
margin-bottom: 4px;
font: 12px/1.5 monospace;
- color:#666;
-}
-
-div.note,
-div.caution,
-div.warning {
- margin: 0 0 15px;
}
p.note, div.note,
p.caution, div.caution,
p.warning, div.warning {
- padding: 0 0 0 10px;
- border-left: 4px solid;
+ padding: 0 0 0 20px;
+ border-left: 3px solid;
+ margin: 16px 0;
}
p.note, div.note {
- border-color: #258AAF;
+ border-color: #66c2ff;
}
p.caution, div.caution {
- border-color: #FF8800;
+ border-color: #f81;
}
p.warning, div.warning {
- border-color: #ff4443;
+ border-color: #f55;
}
div.note.design {
@@ -3454,6 +3157,15 @@
}
*/
+/* First paragraph of a content pages is a bit larger
+ - note the very specific selector. */
+.jd-descr > p:first-child,
+.jd-descr > #tb-wrapper + p,
+.jd-descr > #qv-wrapper + p {
+ font-size: 16px;
+ margin-bottom: 16px;
+}
+
/* page-top-right container for reference pages (holds
links to summary tables) */
#api-info-block {
@@ -3665,6 +3377,7 @@
font-style:italic;
}
+
/* Inline api level indicator for methods */
div.api-level {
font-size:.8em;
@@ -3685,27 +3398,6 @@
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/* SEARCH FILTER */
.menu-container {
@@ -3715,53 +3407,38 @@
font-weight:normal;
}
-.search_filtered_wrapper.reference {
- width: 193px;
- float: right;
-}
-.search_filtered_wrapper.docs {
- width:875px;
- float: left;
- position:absolute;
- top:26px;
- right:66px;
+.search_filtered_wrapper {
+ position: absolute;
+ right: 18px;
+ top: 64px;
}
.suggest-card {
+ float:right;
position:relative;
width:170px;
min-height:90px;
- padding:5px;
border: solid 1px #C5C5C5;
background: white;
- top: 15px;
margin-right:-5px;
-moz-box-shadow: 0 0 10px rgba(0,0,0,0.2);
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.suggest-card.reference {
- position:absolute;
- z-index:999;
- min-width:171px; /* +padding and border makes this match input width */
- min-height:93px; /* add 3px because this has 1 not 4px top border */
- width:auto;
- top:41px;
- margin:0;
+ z-index: 998;
+ width: auto;
}
.suggest-card.develop {
z-index:997;
- border-top: solid 4px #F80;
- float:right;
+ border-top: solid 4px #ff7043;
}
.suggest-card.design {
z-index:996;
- border-top: solid 4px #33b5e5;
- float:right;
+ border-top: solid 4px #00bcd4;
}
.suggest-card.distribute {
z-index:995;
- border-top: solid 4px #9C0;
- float:right;
+ border-top: solid 4px #afb42b;
}
.child-card {
width:100%;
@@ -3779,7 +3456,7 @@
ul.search_filtered {
min-width:100%;
list-style: none;
- margin: 0 0 5px;
+ margin: 5px 0;
padding: 0;
}
.search_filtered .jd-selected {
@@ -3788,7 +3465,7 @@
}
.search_filtered .jd-selected,
.search_filtered .jd-selected a {
- color:#09C !important;
+ color:#039BE5 !important;
}
.no-display {
@@ -3798,13 +3475,13 @@
.search_filtered li.jd-autocomplete {
font-size: 0.81em;
border: none;
- margin: 0 0 2px;
+ margin: 0;
padding: 0;
line-height:1.5em;
}
.search_filtered li a {
- padding:0 5px;
+ padding: 2px 10px;
color:#222 !important;
display:inline-block;
line-height:12px;
@@ -3814,8 +3491,8 @@
font-weight:bold;
color:#444;
border: none;
- margin: 8px 0 2px;
- padding:1px 5px;
+ margin: 0;
+ padding: 2px 10px;
line-height:1.5em;
}
.search_filtered li.header.small {
@@ -3832,6 +3509,51 @@
margin: 0 0 2px;
}
+@media (max-width: 719px) {
+ .search_filtered_wrapper {
+ left: 24px;
+ right: 24px;
+ top: 44px;
+ }
+
+ .suggest-card {
+ box-shadow: 0 2px 1px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1);
+ float: none;
+ margin-right: 0;
+ min-height: 0;
+ max-height: 204px;
+ overflow: hidden;
+ }
+
+ .suggest-card.develop,
+ .suggest-card.design,
+ .suggest-card.distribute {
+ display: none !important;
+ }
+
+ ul.search_filtered {
+ margin: 0;
+ }
+
+ .search_filtered li.jd-autocomplete {
+ border-top: solid 1px #C5C5C5;
+ font-size: inherit;
+ text-align: left;
+ }
+
+ .search_filtered li.jd-autocomplete:first-child {
+ border-top: 0;
+ }
+
+ .search_filtered li a {
+ display: block;
+ overflow: hidden;
+ padding: 14px 10px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+}
+
.show-item {
display: table-row;
}
@@ -3841,8 +3563,6 @@
-
-
/* SEARCH RESULTS */
@@ -3939,10 +3659,10 @@
}
#searchResults .gsc-tabsArea {
- position:relative;
- white-space:nowrap;
- float:left;
- width:200px;
+ position: relative;
+ white-space: nowrap;
+ float: left;
+ width: 25%;
}
#searchResults .gsc-above-wrapper-area {
@@ -3950,12 +3670,26 @@
}
#searchResults .gsc-resultsbox-visible {
- float:left;
- width:720px;
- margin-left:20px;
+ box-sizing: border-box;
+ float: left;
+ padding-left:20px;
+ width: 75%;
+}
+
+@media (max-width: 719px) {
+ #searchResults .gsc-tabsArea {
+ display: none;
+ }
+
+ #searchResults .gsc-resultsbox-visible {
+ float: none;
+ padding-left: 0;
+ width: auto;
+ }
}
#searchResults .gsc-tabHeader {
+ margin-top: 4px;
padding: 3px 6px;
position:relative;
width:auto;
@@ -3964,7 +3698,7 @@
#searchResults h2#searchTitle {
padding:0;
- margin:5px 0;
+ margin:30px 0 5px;
border:none;
}
@@ -4012,98 +3746,25 @@
#searchResults .gsc-tabHeader.gsc-tabhInactive,
#searchResults .gsc-cursor-page {
- text-decoration:none;
- color:#258AAF;
- border: solid 1px #DADADA;
-}
-
-#searchResults .gsc-tabHeader.gsc-tabhInactive:hover,
-#searchResults .gsc-cursor-page:hover {
- border-color: #DBDBDB;
- background-color: #F3F3F3;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#F9F9F9), to(#ECECEC));
- background-image: -webkit-linear-gradient(top, #F9F9F9, #ECECEC);
- background-image: -moz-linear-gradient(top, #F9F9F9, #ECECEC);
- background-image: -ms-linear-gradient(top, #F9F9F9, #ECECEC);
- background-image: -o-linear-gradient(top, #F9F9F9, #ECECEC);
- background-image: linear-gradient(top, #F9F9F9, #ECECEC);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f9f9f9',
-EndColorStr='#ececec');
- color: #33B5E5;
+ background: #F0F0F0;
+ border: 0;
+ color: #039BE5;
}
#searchResults .gsc-tabHeader.gsc-tabhActive,
#searchResults .gsc-tabHeader.gsc-tabhActive:hover,
#searchResults .gsc-cursor-page.gsc-cursor-current-page,
#searchResults .gsc-cursor-page.gsc-cursor-current-page:hover {
- color:#fff;
- background-color: #09C;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#2FADDB), to(#09C));
- background-image: -webkit-linear-gradient(top, #2FADDB, #09C);
- background-image: -moz-linear-gradient(top, #2FADDB, #09C);
- background-image: -ms-linear-gradient(top, #2FADDB, #09C);
- background-image: -o-linear-gradient(top, #2FADDB, #09C);
- background-image: linear-gradient(top, #2FADDB, #09C);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#2faddb', EndColorStr='#09c');
- border: 1px solid #3990AB;
- z-index:100;
+ background-color: #039BE5;
+ border: 0;
+ color: #fff;
}
-
/************ STICKY NAV BAR ******************/
-#header-wrapper {
- background: #f9f9f9;
- margin: 0 -10px 0 -10px;
- padding: 31px 10px 0px 10px;
- position: relative;
-}
-#header-wrapper #nav-x div.wrap {
- max-width: 940px;
- height: 38px;
-}
-#header-wrapper #nav-x ul.nav-x li {
- margin-right: 31px !important;
- margin-top: 5px;
- margin-bottom: 0px;
- height: 30px;
-}
-#header-wrapper #nav-x > div.wrap ul.nav-x li.active {
- color: #669900;
- border-bottom: 3px solid #669900;
-}
-#header-wrapper #nav-x > div.wrap ul.nav-x li.active a {
- color: #669900;
-}
-#header-wrapper #nav-x > div.wrap ul.nav-x a {
- font-size: 14.5px;
-}
-#header-wrapper .developer-console-btn {
- float: right;
- background: #fefefe;
- border-radius: 4px;
- padding: 8px 14px;
- box-shadow: 1px 1px 0px #7a7a7a;
- font-size: 14px;
- margin-top: -6px;
- cursor: pointer;
- color: #464646;
- margin-right: 20px;
-}
-/* not currently used */
-#header-wrapper .shadow {
- width: 1034px;
- height: 4px;
- position: absolute;
- left: 50%;
- margin-left: -517px;
- bottom: -4px;
- background-image: url(../images/header-shadow.png);
-}
-
#context {
clear: both;
padding-top: 14px;
@@ -4147,75 +3808,6 @@
display: none;
}
-/* Sticky Nav overrides */
-.sticky-menu {
- position: fixed;
- width: 940px;
- height: 0px;
- z-index: 51;
- top: 12px;
-}
-#sticky-header {
- display: none;
- padding: 0 10px;
- position: fixed;
- background: #f9f9f9;
- top: 0px;
- left: 0px;
- right: 0px;
- height: 45px;
- box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1);
- border-bottom: 1px solid #a5c43a;
- z-index: 50;
-}
-#sticky-header.design {
- border-bottom: 1px solid #33b5e5;
-}
-#sticky-header.develop {
- border-bottom: 1px solid #F80;
-}
-#sticky-header.distribute {
- border-bottom: 1px solid #9C0;
-}
-#sticky-header.about {
- border-bottom: 1px solid #9933CC;
-}
-#sticky-header > div {
- overflow: hidden;
- *zoom: 1;
- width: 940px;
- margin: 0 auto;
- clear: both;
- padding-top: 9px;
-}
-#sticky-header > div .logo {
- float: left;
- width: 26px;
- height: 25px;
- background: url(../images/dac_logo.png);
- background-image: -webkit-image-set(url(../images/dac_logo.png) 1x, url(../images/dac_logo@2x.png) 2x);
- z-index: 52;
- position: relative;
-}
-#sticky-header > div .top {
- float: left;
- width: 38px;
- height: 38px;
- position: relative;
- background: url(../images/styles/gototop.png);
- z-index: 52;
-}
-#sticky-header > div .breadcrumb {
- float: left;
- padding: 0 0 0 10px;
- border-left: 1px solid #d2d2d2;
- line-height: 24px;
- font-size: 14px;
- position: relative;
- top: 0px;
- z-index: 52;
-}
-
/* offset the <a name=""> tags to account for sticky nav */
body.reference a[name] {
visibility: hidden;
@@ -4225,76 +3817,6 @@
}
-}
-
-
-
-
-
-
-
-/*********** PREVIOUSLY dac-styles.css ***************/
-
-
-#header {
- border-bottom:0;
-}
-
-#header .wrap {
- max-width:940px;
- height:41px;
- border-bottom:1px solid;
- border-color: #ccc;
- position:relative;
-}
-
-.about #header .wrap {
- border-color: #9933CC;
-}
-
-.design #header .wrap {
- border-color: #33b5e5;
-}
-
-.develop #header .wrap {
- border-color: #F80;
-}
-
-.distribute #header .wrap {
- border-color: #9C0;
-}
-
-.logo a {
- float:left;
-}
-
-#header .logo {
- margin-top: -6px;
- margin-left: 0px;
- margin-bottom:0px;
- width: 160px;
- padding-right:10px;
-}
-
-
-#header-wrap .logo.landing-logo {
- width:220px;
- margin:0;
- padding:0;
- margin-bottom:22px;
-}
-#header-wrap .logo.landing-logo img {
- padding:0 0 0 10px;
-}
-
-.search {
- height:25px;
- margin-top: -3px;
- margin-bottom: 0px;
-}
-
-
-
/* Quicknav */
.btn-quicknav {
width:20px;
@@ -4332,17 +3854,6 @@
display:block;
}
-.nav-x li {
- display:block;
- float:left;
- margin-right:45px;
- -webkit-transition: all 0.25s linear;
- -moz-transition: all 0.25s linear;
- -ms-transition: all 0.25s linear;
- -o-transition: all 0.25s linear;
- transition: all 0.25s linear;
-}
-
#header-wrap.quicknav .nav-x li {
min-width:160px;
margin-right:20px;
@@ -4428,105 +3939,6 @@
}
-/* SEARCH AND MORE */
-.search {
- position: absolute;
- width: 50px;
- height:28px;
- display: block;
- margin-top:-3px;
- margin-bottom:7px;
- overflow:hidden;
- z-index:100;
- right:54px;
- -webkit-transition: width 0.4s ease;
- -moz-transition: width 0.4s ease;
- -o-transition: width 0.4s ease;
- transition: width 0.4s ease;
-}
-
-.search #search-btn {
- width:50px;
- height:28px;
- background:url(../images/icon_search.png) no-repeat;
- float:left;
-}
-
-.search-inner {
- width:245px;
-}
-
-.search:hover, .search.active {
- width:245px;
-}
-
-.search .bottom, .search .left, .search .right {
- position: absolute;
- background-color: #a2a2a2
-}
-
-.search .bottom {
- width: 214px;
- height: 1px;
- top: 24px;
- left: 0
-}
-
-.search .left, .search .right {
- height: 5px;
- width: 1px
-}
-
-.search .left {
- top: 22px;
- left: 56px;
- background-color:#CCC;
-}
-
-.search .right {
- top: 22px;
- left: 238px;
- background-color:#CCC;
-}
-
-.search form {
- margin-top: 2px;
- width: 162px;
- float:left;
-}
-
-.search form input {
- color: #2f2f2f;
- font-size: 0.95em;
- width: 178px;
- border: none;
- margin-left: 6px;
- z-index: 1500;
- position: relative;
- background-color: transparent;
- border-bottom:1px solid #CCC;
- padding:0 0 0 4px;
- outline:none;
- height:24px;
-}
-
-.search:hover form input {
- border-bottom:1px solid #33B5E5;
-}
-
-.search:hover .bottom, .search:hover .left, .search:hover .right {
- background-color: #33b5e5;
-}
-
-.search:hover #search-btn {
- background-position: 0 -28px
-}
-
-.search form input:focus {
- color: #222;
- font-weight: bold
-}
-
.moremenu {
float: right;
position: relative;
@@ -4679,9 +4091,9 @@
height:12px;
text-indent:-8000px;
list-style:none;
- margin: 0 2px;
+ margin: 0 3px;
border-radius:6px;
- background-color:#ccc;
+ background-color:#ddd;
cursor:pointer;
-webkit-transition:color .5s ease-in;
-moz-transition:color .5s ease-in;
@@ -4689,13 +4101,13 @@
transition:color .5s ease-in;
}
.slideshow-container .pagination ul li:hover {
- background-color:#999;
+ background-color:#bbb;
}
.slideshow-container .pagination ul li.active {
- background-color:#33b5e5;
+ background-color:#6ab344;
}
.slideshow-container .pagination ul li.active:hover {
- background-color:#33b5e5;
+ background-color:#6ab344;
}
.slideshow-container ul li {
display:inline;
@@ -4715,27 +4127,14 @@
padding-bottom:0px;
}
-#nav-x {
- padding-top: 13px;
-}
-
-#nav-x .wrap {
- min-height:32px;
-}
-
-#nav-x .wrap,
#searchResults.wrap {
max-width:940px;
- border-bottom:1px solid #CCC;
+ border-bottom:1px solid #e5e5e5;
}
#searchResults.wrap #leftSearchControl {
min-height:700px
}
-.nav-x {
- margin-left:0;
- margin-bottom:0;
-}
@@ -4805,7 +4204,7 @@
}
.jspDrag {
- background: #bbb;
+ background: #ccc;
position: relative;
top: 0;
left: 0;
@@ -5048,7 +4447,7 @@
display:none;
margin: -1px auto 0;
position: relative;
- width: 940px;
+ max-width: 940px;
height: 0px;
}
#player-frame {
@@ -5060,6 +4459,22 @@
height: 330px;
position: relative;
}
+#player-frame .close {
+ position: absolute;
+ right: 8px;
+ bottom: 4px;
+ width: 16px;
+ height: 16px;
+ margin: 0;
+ text-indent: -1000em;
+ top: 6px;
+ background: url(../images/close.png) no-repeat 0 0;
+ z-index:9999;
+}
+#player-frame .close:hover, #player-frame .close:focus {
+ background-position: -16px 0;
+ cursor:pointer;
+}
@@ -5114,7 +4529,7 @@
}
.landing-docs .normal-links a {
- color:#258aaf !important;
+ color:#039BE5 !important;
}
.plusone {
@@ -5221,7 +4636,7 @@
float: left;
width: 100%;
text-align: center;
- color: #09c !important;
+ color: #039BE5 !important;
}
.home-sections ul li a {
font-weight: bold;
@@ -5238,9 +4653,6 @@
.home-sections ul li.last {
margin-right: 0px;
}
-.fullpage #footer {
- margin-top: -40px;
-}
/************ DISTRIBUTE PAGES ******************/
@@ -5269,1241 +4681,6 @@
clear: both;
}
-.border-img {
- border: 1px solid #CCC;
-}
-
-.center-img {
- margin: auto;
- text-align: center;
-}
-.center-img img {
- margin-bottom: 15px;
-}
-
-.figure img, .border-img {
- margin-bottom: 15px;
-}
-
-/************ RESOURCE CARDS ******************/
-
-/* Resource cards, 12, 13, 16-col */
-
-/* Basic card-styling with shadow */
-.resource-card {
- border-radius: 1px;
- box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.12);
- background: #fefefe;
-}
-
-/* Styling for background image including tinting and section icons in stacks */
-.card-bg {
- display: block;
- position: absolute;
- vertical-align: top;
- width: 100%;
- left: 0;
- top: 0;
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- background-image: url(../images/resource-card-default-android.jpg);
-}
-.card-bg:after {
- content: "";
- display: block;
- height: 100%;
- width: 100%;
- opacity: 1;
- background: rgba(0, 0, 0, 0.2);
- -webkit-transition: opacity 0.5s;
- -moz-transition: opacity 0.5s;
- -o-transition: opacity 0.5s;
- transition: opacity 0.5s;
-}
-.static .card-bg:after {
- display:none;
-}
-.card-bg .card-section-icon {
- position: absolute;
- top: 50%;
- width: 100%;
- margin-top: -35px;
- text-align: center;
- padding-top: 65px;
- z-index: 100;
-}
-.card-bg .card-section-icon .icon {
- position: absolute;
- left: 50%;
- margin-left: -28px;
- top: 0px;
- width: 56px;
- height: 56px;
- background-repeat: no-repeat;
- background-position: 50% 50%;
- background-image: url(../images/stack-icon.png);
-}
-.card-bg .card-section-icon .section {
- text-transform: uppercase;
- color: white;
- font-size: 14px;
-}
-
-.card-info {
- position: absolute;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- overflow: hidden;
- background: #fefefe;
- padding: 4px 12px 6px 12px;
-}
-.card-info .section {
- text-transform: uppercase;
- color: #898989;
- font-size: 12px;
- margin-bottom: 1px;
-}
-.card-info .title {
- color: #363636;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- padding-bottom: 5px;
- margin-bottom: -2px;
- font-size: 16px;
-}
-.card-info .description {
- overflow: hidden;
-}
-.card-info .description .text {
- color: #464646;
- font: 13px/15px Roboto Condensed;
- overflow: hidden;
- width:100%;
-}
-.card-info .description .util {
- position: absolute;
- right: 5px;
- bottom: 70px; /*-2px;*/
- opacity: 0;
- -webkit-transition: opacity 0.5s;
- -moz-transition: opacity 0.5s;
- -o-transition: opacity 0.5s;
- transition: opacity 0.5s;
-}
-.card-info.empty-desc .title {
- white-space: normal;
- overflow: visible;
-}
-.card-info.empty-desc .description {
- display: none;
-}
-/* Truncate card summaries at bounding box and
- * and apply ellipsis at lower right */
-.ellipsis {
- overflow: hidden;
- float:right;
- line-height: 15px;
- width:100%;
-}
-.resource-card-6x6 .card-info .description .teddddddxt {
- float:left;
- position:relative;
- margin-left:0;
-}
-.ellipsis:before {
- content:"";
- float: left;
- width: 5px;
- height:100%;
-}
-.ellipsis > *:first-child.text {
- float: right;
- width: 100% !important;
- margin-left: -5px;
-}
-.ellipsis:after {
- content: "\02026";
- height:17px;
- padding-bottom:4px;
-
- box-sizing: content-box;
- -webkit-box-sizing: content-box;
- -moz-box-sizing: content-box;
-
- float: right; position: relative;
- top: -16px; left: 100%;
- width: 4em; margin-left: -4em;
- padding-right: 5px;
-
- background: -webkit-gradient(linear, left top, right top,
- from(rgba(255, 255, 255, 0)), to(white), color-stop(65%, white));
- background: -moz-linear-gradient(to right, rgba(255, 255, 255, 0), white 65%, white);
- background: -o-linear-gradient(to right, rgba(255, 255, 255, 0), white 65%, white);
- background: -ms-linear-gradient(to right, rgba(255, 255, 255, 0), white 65%, white);
- background: linear-gradient(to right, rgba(255, 255, 255, 0), white 65%, white);
-}
-.ellipsis:after {
- font-style: normal; color: #aaa;
- font-size:13px;
- text-align: right;
-}
-
-/* Flow Layout */
-.resource-flow-layout {
- display: inline-block;
-}
-.resource-flow-layout .resource-card, .resource-flow-layout .resource-card-stack {
- float: left;
- position: relative;
-}
-.resource-flow-layout .resource-card-stack > .resource-card {
- margin-right: 0px !important;
-}
-.resource-flow-layout:after {
- content: ".";
- display: block;
- height: 0;
- position:relative;
- clear: both;
- visibility: hidden;
-}
-.resource-card:hover {
- cursor: pointer;
-}
-.static .resource-card:hover {
- cursor: auto;
-}
-.resource-card:hover .card-bg:after {
- opacity: 0;
-}
-/* disabled to make way for fade/ellipsis truncation,
- and the plusone moves up.
-.resource-card:hover .card-info .description .text {
- padding-right: 70px;
-} */
-.resource-card:hover .card-info .description .util {
- opacity: 1;
-}
-
-/* Carousel Layout */
-/* Carousel styles for landing page */
-.resource-carousel-layout {
- margin: 20px 0 20px 0;
- position: relative;
- overflow: hidden;
-}
-.resource-carousel-layout .slideshow-prev, .resource-carousel-layout .slideshow-next {
- display: none;
-}
-.resource-carousel-layout .pagination {
- bottom: 0px;
-}
-.resource-carousel-layout .frame li {
- position: relative;
-}
-.resource-carousel-layout .frame li .card-bg {
- height: 300px;
-}
-.resource-carousel-layout .frame li .card-info {
- padding: 7px 15px 0px 15px;
- top: 300px;
-}
-.resource-carousel-layout .frame li .card-info .section {
- font-size: 13px;
- margin-bottom: 7px;
-}
-.resource-carousel-layout .frame li .card-info .title {
- font-size: 25px;
- margin-bottom: 2px;
-}
-.resource-carousel-layout .frame li .card-info .description {
- font-family: 15px/16px Roboto Condensed, sans-serif;
-}
-.resource-carousel-layout .frame li .card-info .description .text {
- height: 40px;
-}
-.resource-carousel-layout .frame li .card-info .description .util {
- bottom:97px;
- right:4px;
-}
-
-/* Stack Layout */
-.resource-stack-layout {
- display: inline-block;
-}
-.resource-stack-layout .resource-card-stack {
- float: left;
- position: relative;
-}
-.resource-stack-layout .resource-card {
- margin-bottom: 20px;
- display: block;
- position: relative;
-}
-.resource-stack-layout .section-card-menu > .card-info .section, .resource-stack-layout .section-card > .card-info .title {
- /*text-transform: uppercase;*/
- color: #898989;
- font-size: 17px;
- line-height: 24px;
- margin-bottom: 6px;
-}
-.resource-stack-layout .section-card {
- height: 284px;
-}
-.resource-stack-layout .section-card > .card-bg {
- height: 192px;
-}
-.resource-stack-layout .section-card > .card-info {
- padding: 4px 12px 6px 12px;
- top: 192px;
-}
-.resource-stack-layout .section-card > .card-info .section {
- display: none;
-}
-.resource-stack-layout .section-card > .card-info .title {
- font-size: 17px;
- border-bottom: 1px solid #959595;
- padding-bottom: 0px;
-}
-.resource-stack-layout .section-card > .card-info .description {
- font-size: 13px;
- line-height: 15px;
-}
-.resource-stack-layout .section-card > .card-info .description .text {
- height: 30px;
-}
-.resource-stack-layout .related-card {
- height: 90px;
-}
-.resource-stack-layout .related-card > .card-bg {
- left: 0;
- top: 0;
- width: 90px;
- height: 100%;
- position: absolute;
- display: block;
-}
-.resource-stack-layout .related-card > .card-info {
- left: 90px;
- padding: 4px 12px 4px 12px;
-}
-.resource-stack-layout .related-card > .card-info .section {
- font-size: 12px;
- margin-bottom: 1px;
- display: none;
-}
-.resource-stack-layout .related-card > .card-info .title {
- font-size: 16px;
- margin-bottom: -2px;
- white-space: normal;
- overflow: visible;
- text-overflow: ellipsis;
-}
-.resource-stack-layout .related-card > .card-info .title:after {
- content: url(../images/link-out.png);
- display: block;
-}
-.resource-stack-layout .related-card > .card-info .description {
- display: none;
-}
-.resource-stack-layout .section-card-menu {
- /* Flexible height */
- display: block;
- height: auto;
- width: auto;
-}
-.resource-stack-layout .section-card-menu .card-bg {
- height: 155px;
- /* Flexible height */
- position: relative;
- display: inline-block;
- vertical-align: top;
-}
-.resource-stack-layout .section-card-menu .card-info {
- padding: 4px 12px 0px 12px;
- /* Flexible height */
- position: relative;
- left: auto;
- top: auto;
- right: auto;
- bottom: auto;
-}
-.resource-stack-layout .section-card-menu .card-info ul {
- list-style: none;
- margin: 0;
-}
-.resource-stack-layout .section-card-menu .card-info ul li {
- list-style: none;
- margin: 0;
- padding: 15px 0;
- border-top-width: 1px;
- border-top-style: solid;
- border-top-color: #959595;
-}
-.resource-stack-layout .section-card-menu .card-info ul li a, .resource-stack-layout .section-card-menu .card-info ul li a:focus, .resource-stack-layout .section-card-menu .card-info ul li a:link, .resource-stack-layout .section-card-menu .card-info ul li a:visited, .resource-stack-layout .section-card-menu .card-info ul li a:active, .resource-stack-layout .section-card-menu .card-info ul li a:hover {
- color: #363636 !important;
-}
-.resource-stack-layout .section-card-menu .card-info ul li:first-child {
- border-top: none;
-}
-.resource-stack-layout .section-card-menu .card-info ul li:hover .title:after {
- opacity: 1;
- -webkit-transition: opacity 0.5s;
- -moz-transition: opacity 0.5s;
- -o-transition: opacity 0.5s;
- transition: opacity 0.5s;
-}
-.resource-stack-layout .section-card-menu .card-info ul li:hover .description {
- max-height: 30px;
- opacity: 1;
- -webkit-transition: max-height 0.5s, opacity 1s;
- -moz-transition: max-height 0.5s, opacity 1s;
- -o-transition: max-height 0.5s, opacity 1s;
- transition: max-height 0.5s, opacity 1s;
-}
-.resource-stack-layout .section-card-menu .card-info .title {
- font-size: 16px;
- margin-bottom: -2px;
- position: relative;
-}
-.resource-stack-layout .section-card-menu .card-info .title:after {
- background: url(../images/stack-arrow-right.png);
- content: '';
- opacity: 0;
- -webkit-transition: opacity 0.25s;
- -moz-transition: opacity 0.25s;
- -o-transition: opacity 0.25s;
- transition: opacity 0.25s;
- position: absolute;
- right: 0px;
- top: 3px;
- width: 10px;
- height: 15px;
-}
-.resource-stack-layout .section-card-menu .card-info .title.more {
- text-transform: uppercase;
- color: #898989;
- display: inline-block;
-}
-.resource-stack-layout .section-card-menu .card-info .title.more:after {
- background: url(../images/stack-arrow-right.png);
- content: '';
- display: block;
- position: absolute;
- right: -20px;
- top: 3px;
- width: 10px;
- height: 15px;
-}
-.resource-stack-layout .section-card-menu .card-info .description {
- max-height: 0px;
- opacity: 0;
- overflow: hidden;
- font-size: 13px;
- line-height: 15px;
- /* Hover off */
- -webkit-transition: max-height 0.5s, opacity 0.5s;
- -moz-transition: max-height 0.5s, opacity 0.5s;
- -o-transition: max-height 0.5s, opacity 0.5s;
- transition: max-height 0.5s, opacity 0.5s;
-}
-.resource-stack-layout .section-card-menu .card-info .description .text {
- height: 30px;
-}
-.resource-stack-layout:after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
-}
-
-/* Generate the flow layout styles for a 3-column 16-col span */
-.resource-flow-layout.col-16 {
- margin: 0 -14px 0 0;
- width: 954px;
-}
-.resource-flow-layout.col-16 .resource-card, .resource-flow-layout.col-16 .resource-card-stack {
- margin: 0 14px 20px 0;
-}
-.resource-flow-layout.col-16 .resource-card-row-stack-last {
- margin-bottom: 0px !important;
-}
-.resource-flow-layout.col-16 .resource-card-col-stack-last {
- margin-bottom: 0px !important;
-}
-.resource-flow-layout.col-16 .resource-card-3x6 {
- width: 145px;
- height: 284px;
-}
-.resource-flow-layout.col-16 .resource-card-3x12 {
- width: 145px;
- height: 588px;
-}
-.resource-flow-layout.col-16 .resource-card-3x18 {
- width: 145px;
- height: 892px;
-}
-.resource-flow-layout.col-16 .resource-card-6x6 {
- width: 304px;
- height: 284px;
-}
-.resource-flow-layout.col-16 .resource-card-6x12 {
- width: 304px;
- height: 588px;
-}
-.resource-flow-layout.col-16 .resource-card-6x18 {
- width: 304px;
- height: 892px;
-}
-.resource-flow-layout.col-16 .resource-card-9x6 {
- width: 463px;
- height: 284px;
-}
-.resource-flow-layout.col-16 .resource-card-9x12 {
- width: 463px;
- height: 588px;
-}
-.resource-flow-layout.col-16 .resource-card-9x18 {
- width: 463px;
- height: 892px;
-}
-.resource-flow-layout.col-16 .resource-card-12x6 {
- width: 622px;
- height: 284px;
-}
-.resource-flow-layout.col-16 .resource-card-12x12 {
- width: 622px;
- height: 588px;
-}
-.resource-flow-layout.col-16 .resource-card-12x18 {
- width: 622px;
- height: 892px;
-}
-.resource-flow-layout.col-16 .resource-card-15x6 {
- width: 781px;
- height: 284px;
-}
-.resource-flow-layout.col-16 .resource-card-15x12 {
- width: 781px;
- height: 588px;
-}
-.resource-flow-layout.col-16 .resource-card-15x18 {
- width: 781px;
- height: 892px;
-}
-.resource-flow-layout.col-16 .resource-card-18x6 {
- width: 940px;
- height: 284px;
-}
-.resource-flow-layout.col-16 .resource-card-18x12 {
- width: 940px;
- height: 420px;
-}
-.resource-flow-layout.col-16 .resource-card-18x18 {
- width: 940px;
- height: 892px;
-}
-.resource-flow-layout.col-16 .resource-card-3x2 {
- width: 145px;
- height: 95px;
-}
-.resource-flow-layout.col-16 .resource-card-3x2x3 {
- width: 145px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-16 .resource-card-3x3 {
- width: 145px;
- height: 142px;
-}
-.resource-flow-layout.col-16 .resource-card-3x3x2 {
- width: 145px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-16 .resource-card-6x2 {
- width: 304px;
- height: 95px;
-}
-.resource-flow-layout.col-16 .resource-card-6x2x3 {
- width: 304px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-16 .resource-card-6x3 {
- width: 304px;
- height: 142px;
-}
-.resource-flow-layout.col-16 .resource-card-6x3x2 {
- width: 304px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-16 .resource-card-9x2 {
- width: 463px;
- height: 95px;
-}
-.resource-flow-layout.col-16 .resource-card-9x2x3 {
- width: 463px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-16 .resource-card-9x3 {
- width: 463px;
- height: 142px;
-}
-.resource-flow-layout.col-16 .resource-card-9x3x2 {
- width: 463px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-16 .resource-card-12x2 {
- width: 622px;
- height: 95px;
-}
-.resource-flow-layout.col-16 .resource-card-12x2x3 {
- width: 622px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-16 .resource-card-12x3 {
- width: 622px;
- height: 142px;
-}
-.resource-flow-layout.col-16 .resource-card-12x3x2 {
- width: 622px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-16 .resource-card-15x2 {
- width: 781px;
- height: 95px;
-}
-.resource-flow-layout.col-16 .resource-card-15x2x3 {
- width: 781px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-16 .resource-card-15x3 {
- width: 781px;
- height: 142px;
-}
-.resource-flow-layout.col-16 .resource-card-15x3x2 {
- width: 781px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-16 .resource-card-18x2 {
- width: 940px;
- height: 95px;
-}
-.resource-flow-layout.col-16 .resource-card-18x2x3 {
- width: 940px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-16 .resource-card-18x3 {
- width: 940px;
- height: 142px;
-}
-.resource-flow-layout.col-16 .resource-card-18x3x2 {
- width: 940px;
- height: 138px;
- margin-bottom: 8px;
-}
-
-/* Generate the flow layout styles for a 3-column 16-col span */
-.resource-flow-layout.col-12 {
- margin: 0 -14px 0 0;
- width: 714px;
-}
-
-.resource-flow-layout.col-12 .resource-card, .resource-flow-layout.col-12 .resource-card-stack {
- margin: 0 14px 20px 0;
-}
-.resource-flow-layout.col-12 .resource-card-row-stack-last {
- margin-bottom: 0px !important;
-}
-.resource-flow-layout.col-12 .resource-card-col-stack-last {
- margin-bottom: 0px !important;
-}
-.resource-flow-layout.col-12 .resource-card-3x6 {
- width: 105px;
- height: 284px;
-}
-.resource-flow-layout.col-12 .resource-card-3x12 {
- width: 105px;
- height: 588px;
-}
-.resource-flow-layout.col-12 .resource-card-3x18 {
- width: 105px;
- height: 892px;
-}
-.resource-flow-layout.col-12 .resource-card-6x6 {
- width: 224px;
- height: 284px;
-}
-.resource-flow-layout.col-12 .resource-card-6x12 {
- width: 224px;
- height: 588px;
-}
-.resource-flow-layout.col-12 .resource-card-6x18 {
- width: 224px;
- height: 892px;
-}
-.resource-flow-layout.col-12 .resource-card-9x6 {
- width: 343px;
- height: 284px;
-}
-.resource-flow-layout.col-12 .resource-card-9x12 {
- width: 343px;
- height: 588px;
-}
-.resource-flow-layout.col-12 .resource-card-9x18 {
- width: 343px;
- height: 892px;
-}
-.resource-flow-layout.col-12 .resource-card-12x6 {
- width: 462px;
- height: 284px;
-}
-.resource-flow-layout.col-12 .resource-card-12x12 {
- width: 462px;
- height: 588px;
-}
-.resource-flow-layout.col-12 .resource-card-12x18 {
- width: 462px;
- height: 892px;
-}
-.resource-flow-layout.col-12 .resource-card-15x6 {
- width: 581px;
- height: 284px;
-}
-.resource-flow-layout.col-12 .resource-card-15x12 {
- width: 581px;
- height: 588px;
-}
-.resource-flow-layout.col-12 .resource-card-15x18 {
- width: 581px;
- height: 892px;
-}
-.resource-flow-layout.col-12 .resource-card-18x6 {
- width: 700px;
- height: 284px;
-}
-.resource-flow-layout.col-12 .resource-card-18x12 {
- width: 700px;
- height: 420px;
-}
-.resource-flow-layout.col-12 .resource-card-18x18 {
- width: 700px;
- height: 892px;
-}
-.resource-flow-layout.col-12 .resource-card-3x2 {
- width: 105px;
- height: 95px;
-}
-.resource-flow-layout.col-12 .resource-card-3x2x3 {
- width: 105px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-12 .resource-card-3x3 {
- width: 105px;
- height: 142px;
-}
-.resource-flow-layout.col-12 .resource-card-3x3x2 {
- width: 105px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-12 .resource-card-6x2 {
- width: 224px;
- height: 95px;
-}
-.resource-flow-layout.col-12 .resource-card-6x2x3 {
- width: 224px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-12 .resource-card-6x3 {
- width: 224px;
- height: 142px;
-}
-.resource-flow-layout.col-12 .resource-card-6x3x2 {
- width: 224px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-12 .resource-card-9x2 {
- width: 343px;
- height: 95px;
-}
-.resource-flow-layout.col-12 .resource-card-9x2x3 {
- width: 343px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-12 .resource-card-9x3 {
- width: 343px;
- height: 142px;
-}
-.resource-flow-layout.col-12 .resource-card-9x3x2 {
- width: 343px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-12 .resource-card-12x2 {
- width: 462px;
- height: 95px;
-}
-.resource-flow-layout.col-12 .resource-card-12x2x3 {
- width: 462px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-12 .resource-card-12x3 {
- width: 462px;
- height: 142px;
-}
-.resource-flow-layout.col-12 .resource-card-12x3x2 {
- width: 462px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-12 .resource-card-15x2 {
- width: 581px;
- height: 95px;
-}
-.resource-flow-layout.col-12 .resource-card-15x2x3 {
- width: 581px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-12 .resource-card-15x3 {
- width: 581px;
- height: 142px;
-}
-.resource-flow-layout.col-12 .resource-card-15x3x2 {
- width: 581px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-12 .resource-card-18x2 {
- width: 700px;
- height: 95px;
-}
-.resource-flow-layout.col-12 .resource-card-18x2x3 {
- width: 700px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-12 .resource-card-18x3 {
- width: 700px;
- height: 142px;
-}
-.resource-flow-layout.col-12 .resource-card-18x3x2 {
- width: 700px;
- height: 138px;
- margin-bottom: 8px;
-}
-
-/* Generate the flow layout styles for a 3-column 13-col span */
-
-.resource-flow-layout.col-13 {
- margin: 0 -14px 0 0;
- width: 774px;
-}
-.resource-flow-layout.col-13 .resource-card, .resource-flow-layout.col-13 .resource-card-stack {
- margin: 0 14px 20px 0;
-}
-.resource-flow-layout.col-13 .resource-card-row-stack-last {
- margin-bottom: 0px !important;
-}
-.resource-flow-layout.col-13 .resource-card-col-stack-last {
- margin-bottom: 0px !important;
-}
-.resource-flow-layout.col-13 .resource-card-3x6 {
- width: 115px;
- height: 284px;
-}
-.resource-flow-layout.col-13 .resource-card-3x12 {
- width: 115px;
- height: 588px;
-}
-.resource-flow-layout.col-13 .resource-card-3x18 {
- width: 115px;
- height: 892px;
-}
-.resource-flow-layout.col-13 .resource-card-6x6 {
- width: 244px;
- height: 284px;
-}
-.resource-flow-layout.col-13 .resource-card-6x12 {
- width: 244px;
- height: 588px;
-}
-.resource-flow-layout.col-13 .resource-card-6x18 {
- width: 244px;
- height: 892px;
-}
-.resource-flow-layout.col-13 .resource-card-9x6 {
- width: 373px;
- height: 284px;
-}
-.resource-flow-layout.col-13 .resource-card-9x12 {
- width: 373px;
- height: 588px;
-}
-.resource-flow-layout.col-13 .resource-card-9x18 {
- width: 373px;
- height: 892px;
-}
-.resource-flow-layout.col-13 .resource-card-12x6 {
- width: 502px;
- height: 284px;
-}
-.resource-flow-layout.col-13 .resource-card-12x12 {
- width: 502px;
- height: 588px;
-}
-.resource-flow-layout.col-13 .resource-card-12x18 {
- width: 502px;
- height: 892px;
-}
-.resource-flow-layout.col-13 .resource-card-15x6 {
- width: 631px;
- height: 284px;
-}
-.resource-flow-layout.col-13 .resource-card-15x12 {
- width: 631px;
- height: 588px;
-}
-.resource-flow-layout.col-13 .resource-card-15x18 {
- width: 631px;
- height: 892px;
-}
-.resource-flow-layout.col-13 .resource-card-18x6 {
- width: 760px;
- height: 284px;
-}
-.resource-flow-layout.col-13 .resource-card-18x12 {
- width: 760px;
- height: 420px;
-}
-.resource-flow-layout.col-13 .resource-card-18x18 {
- width: 760px;
- height: 892px;
-}
-.resource-flow-layout.col-13 .resource-card-3x2 {
- width: 115px;
- height: 95px;
-}
-.resource-flow-layout.col-13 .resource-card-3x2x3 {
- width: 115px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-13 .resource-card-3x3 {
- width: 115px;
- height: 142px;
-}
-.resource-flow-layout.col-13 .resource-card-3x3x2 {
- width: 115px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-13 .resource-card-6x2 {
- width: 244px;
- height: 95px;
-}
-.resource-flow-layout.col-13 .resource-card-6x2x3 {
- width: 244px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-13 .resource-card-6x3 {
- width: 244px;
- height: 142px;
-}
-.resource-flow-layout.col-13 .resource-card-6x3x2 {
- width: 244px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-13 .resource-card-9x2 {
- width: 373px;
- height: 95px;
-}
-.resource-flow-layout.col-13 .resource-card-9x2x3 {
- width: 373px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-13 .resource-card-9x3 {
- width: 373px;
- height: 142px;
-}
-.resource-flow-layout.col-13 .resource-card-9x3x2 {
- width: 373px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-13 .resource-card-12x2 {
- width: 502px;
- height: 95px;
-}
-.resource-flow-layout.col-13 .resource-card-12x2x3 {
- width: 502px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-13 .resource-card-12x3 {
- width: 502px;
- height: 142px;
-}
-.resource-flow-layout.col-13 .resource-card-12x3x2 {
- width: 502px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-13 .resource-card-15x2 {
- width: 631px;
- height: 95px;
-}
-.resource-flow-layout.col-13 .resource-card-15x2x3 {
- width: 631px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-13 .resource-card-15x3 {
- width: 631px;
- height: 142px;
-}
-.resource-flow-layout.col-13 .resource-card-15x3x2 {
- width: 631px;
- height: 138px;
- margin-bottom: 8px;
-}
-.resource-flow-layout.col-13 .resource-card-18x2 {
- width: 760px;
- height: 95px;
-}
-.resource-flow-layout.col-13 .resource-card-18x2x3 {
- width: 760px;
- height: 90px;
- margin-bottom: 7px;
-}
-.resource-flow-layout.col-13 .resource-card-18x3 {
- width: 760px;
- height: 142px;
-}
-.resource-flow-layout.col-13 .resource-card-18x3x2 {
- width: 760px;
- height: 138px;
- margin-bottom: 8px;
-}
-
-/*
- The following are styles for cards in the flowlayout above, styled by the number of rows they span
-*/
-/* Single row items, might be simpler to just apply a class */
-.resource-card-3x6 > .card-bg, .resource-card-6x6 > .card-bg, .resource-card-9x6 > .card-bg, .resource-card-12x6 > .card-bg, .resource-card-15x6 > .card-bg, .resource-card-18x6 > .card-bg {
- height: 192px;
-}
-.resource-card-3x6 > .card-info, .resource-card-6x6 > .card-info, .resource-card-9x6 > .card-info, .resource-card-12x6 > .card-info, .resource-card-15x6 > .card-info, .resource-card-18x6 > .card-info {
- padding: 4px 12px 6px 12px;
- top: 192px;
-}
-.resource-card-3x6 > .card-info .section, .resource-card-6x6 > .card-info .section, .resource-card-9x6 > .card-info .section, .resource-card-12x6 > .card-info .section, .resource-card-15x6 > .card-info .section, .resource-card-18x6 > .card-info .section {
- font-size: 12px;
- margin-bottom: 1px;
-}
-.resource-card-3x6 > .card-info .title, .resource-card-6x6 > .card-info .title, .resource-card-9x6 > .card-info .title, .resource-card-12x6 > .card-info .title, .resource-card-15x6 > .card-info .title, .resource-card-18x6 > .card-info .title {
- font-size: 16px;
- margin-bottom: -2px;
-}
-.resource-card-3x6 > .card-info .description, .resource-card-6x6 > .card-info .description, .resource-card-9x6 > .card-info .description, .resource-card-12x6 > .card-info .description, .resource-card-15x6 > .card-info .description, .resource-card-18x6 > .card-info .description {
- font-size: 13px;
- line-height: 15px;
-}
-.resource-card-3x6 > .card-info .description .text, .resource-card-6x6 > .card-info .description .text, .resource-card-9x6 > .card-info .description .text, .resource-card-12x6 > .card-info .description .text, .resource-card-15x6 > .card-info .description .text, .resource-card-18x6 > .card-info .description .text {
- height: 30px;
-}
-
-/* Double row items */
-.resource-card-3x12 > .card-bg, .resource-card-6x12 > .card-bg, .resource-card-9x12 > .card-bg, .resource-card-12x12 > .card-bg, .resource-card-15x12 > .card-bg, .resource-card-18x12 > .card-bg {
- height: 320px;
-}
-.resource-card-3x12 > .card-info, .resource-card-6x12 > .card-info, .resource-card-9x12 > .card-info, .resource-card-12x12 > .card-info, .resource-card-15x12 > .card-info, .resource-card-18x12 > .card-info {
- padding: 4px 12px 6px 12px;
- top: 320px;
-}
-.resource-card-3x12 > .card-info .section, .resource-card-6x12 > .card-info .section, .resource-card-9x12 > .card-info .section, .resource-card-12x12 > .card-info .section, .resource-card-15x12 > .card-info .section, .resource-card-18x12 > .card-info .section {
- font-size: 12px;
- margin-bottom: 1px;
-}
-.resource-card-3x12 > .card-info .title, .resource-card-6x12 > .card-info .title, .resource-card-9x12 > .card-info .title, .resource-card-12x12 > .card-info .title, .resource-card-15x12 > .card-info .title, .resource-card-18x12 > .card-info .title {
- font-size: 16px;
- margin-bottom: -2px;
- white-space: normal;
-}
-.resource-card-3x12 > .card-info .description, .resource-card-6x12 > .card-info .description, .resource-card-9x12 > .card-info .description, .resource-card-12x12 > .card-info .description, .resource-card-15x12 > .card-info .description, .resource-card-18x12 > .card-info .description {
- font-size: 13px;
- line-height: 15px;
-}
-
-/* 1/3 row items */
-.resource-card-3x2 > .card-bg, .resource-card-6x2 > .card-bg, .resource-card-9x2 > .card-bg, .resource-card-12x2 > .card-bg, .resource-card-15x2 > .card-bg, .resource-card-18x2 > .card-bg {
- left: 0;
- top: 0;
- width: 90px;
- height: 100%;
- position: absolute;
- display: block;
-}
-.resource-card-3x2 > .card-info, .resource-card-6x2 > .card-info, .resource-card-9x2 > .card-info, .resource-card-12x2 > .card-info, .resource-card-15x2 > .card-info, .resource-card-18x2 > .card-info {
- left: 90px;
- padding: 4px 12px 4px 12px;
- height: 80px;
- overflow: hidden;
-}
-.resource-card-3x2 > .card-info .section, .resource-card-6x2 > .card-info .section, .resource-card-6x3 > .card-info .section, .resource-card-9x2 > .card-info .section, .resource-card-12x2 > .card-info .section, .resource-card-15x2 > .card-info .section, .resource-card-18x2 > .card-info .section {
- font-size: 12px;
- margin-bottom: 1px;
- /* display: none; */
-}
-.resource-card-3x2 > .card-info .title, .resource-card-6x2 > .card-info .title, .resource-card-9x2 > .card-info .title, .resource-card-12x2 > .card-info .title, .resource-card-15x2 > .card-info .title, .resource-card-18x2 > .card-info .title {
- font-size: 16px;
- margin-bottom: -2px;
- white-space: normal;
- overflow: visible;
- text-overflow: ellipsis;
-}
-.resource-card-3x2 > .card-info .title:after, .resource-card-6x2 > .card-info .title:after, .resource-card-9x2 > .card-info .title:after, .resource-card-12x2 > .card-info .title:after, .resource-card-15x2 > .card-info .title:after, .resource-card-18x2 > .card-info .title:after {
- /* content: url(../images/link-out.png); */
- display: block;
-}
-.resource-card-3x2 > .card-info .description, .resource-card-6x2 > .card-info .description, .resource-card-9x2 > .card-info .description, .resource-card-12x2 > .card-info .description, .resource-card-15x2 > .card-info .description, .resource-card-18x2 > .card-info .description {
- display: none;
-}
-
-
-/* Override to show the description instead of the content section */
-.no-section .resource-card-3x2 > .card-info .section,
-.no-section .resource-card-6x2 > .card-info .section {
- display: none;
-}
-.no-section .resource-card-3x2 > .card-info .description,
-.no-section .resource-card-6x2 > .card-info .description {
- display: block;
-}
-
-/* 1/2 row items */
-.resource-card-3x3 > .card-bg, .resource-card-6x3 > .card-bg, .resource-card-9x3 > .card-bg, .resource-card-12x3 > .card-bg, .resource-card-15x3 > .card-bg, .resource-card-18x3 > .card-bg {
- left: 0;
- top: 0;
- width: 90px;
- height: 100%;
- position: absolute;
- display: block;
-}
-.resource-card-3x3 > .card-info, .resource-card-6x3 > .card-info, .resource-card-9x3 > .card-info, .resource-card-12x3 > .card-info, .resource-card-15x3 > .card-info, .resource-card-18x3 > .card-info {
- left: 90px;
- padding: 4px 12px 0px 12px;
-}
-.resource-card-3x3 > .card-info .section, .resource-card-6x3 > .card-info .section, .resource-card-9x3 > .card-info .section, .resource-card-12x3 > .card-info .section, .resource-card-15x3 > .card-info .section, .resource-card-18x3 > .card-info .section {
- font-size: 12px;
- margin-bottom: 1px;
- display: none;
-}
-.resource-card-3x3 > .card-info .title, .resource-card-6x3 > .card-info .title, .resource-card-9x3 > .card-info .title, .resource-card-12x3 > .card-info .title, .resource-card-15x3 > .card-info .title, .resource-card-18x3 > .card-info .title {
- font-size: 16px;
- margin-bottom: -2px;
- white-space: normal;
- overflow: visible;
-}
-.resource-card-3x3 > .card-info .description .text, .resource-card-6x3 > .card-info .description .text, .resource-card-9x3 > .card-info .description .text, .resource-card-12x3 > .card-info .description .text, .resource-card-15x3 > .card-info .description .text, .resource-card-18x3 > .card-info .description .text {
- font-size: 12px;
- line-height: 15px;
- padding-right: 0px !important;
- height: 80px;
-}
-.resource-card-3x3 > .card-info .description .util, .resource-card-6x3 > .card-info .description .util, .resource-card-9x3 > .card-info .description .util, .resource-card-12x3 > .card-info .description .util, .resource-card-15x3 > .card-info .description .util, .resource-card-18x3 > .card-info .description .util {
- display: none;
-}
-/* placement of plusone */
-.resource-card-6x12 > .card-info .description .util, .resource-card-9x12 > .card-info .description .util, .resource-card-12x12 > .card-info .description .util, .resource-card-15x12 > .card-info .description .util {
- bottom:2px;
-}
-.resource-card-18x12 > .card-info .description .util {
- bottom:2px;
-}
-/* Overrides for col-16 6x6 cards linking to local content on landing pages.
- Suppresses "section" and puts the title above a hairline rule. */
-.landing .card-info .section, .resource-flow-layout.col-16.landing .resource-card-9x6 .card-info .section {
- display:none;
-}
-.landing .card-info .title {
- color: #898989;
- font-size: 17px;
- line-height: 24px;
- margin-bottom: 6px;
- border-bottom: 1px solid #959595;
- padding-bottom: 0px;
-}
-.landing .card-info .description {
- font-size: 13px;
- line-height: 15px;
-}
-.landing .card-info .description .text {
-height:30px;
-}
-.landing .resource-card-6x6 > .card-info .description .util, .landing .resource-card-9x6 > .card-info .description .util {
- bottom:2px;
-}
-/*
- Generate a resource stack layout for a 3 column widget spanning 16 grid cols
-*/
-.resource-stack-layout.col-16 {
- margin: 0 -14px 0 0;
- width: 954px;
-}
-.resource-stack-layout.col-16 .resource-card-stack {
- margin: 0 14px 0 0;
- width: 304px;
-}
-
-/* Example of card menu tinting */
-.resource-widget[data-section=distribute\/tools] .section-card-menu
-.card-bg:after {
- background: rgba(126, 55, 148, 0.4) !important;
-}
-.resource-widget[data-section=distribute\/tools] .section-card-menu
-.card-section-icon .icon {
- background-color: #7e3794 !important;
-}
-.resource-widget[data-section=distribute\/tools] .section-card-menu
-.card-info ul li {
- border-top-color: #7e3794 !important;
-}
-
-/* tinting for stacks */
-
-div.jd-descr > .resource-widget[data-section=distribute\/tools]
-.section-card-menu .card-info ul li {
- border-top-color: #7e3794 !important;
-}
-
-
/**
* UTILITIES
@@ -6530,11 +4707,13 @@
*/
.landing-h1 {
- font-weight: 100;
- font-size: 60px;
- line-height: 78px;
+ color: #44555d;
+ font-weight: 300;
+ font-size: 56px;
+ line-height: 80px;
text-align: center;
letter-spacing: -1px;
+ margin-bottom: 6px;
}
.landing-pre-h1 {
@@ -6545,11 +4724,11 @@
text-align: center;
letter-spacing: -1px;
text-transform: uppercase;
-
}
.landing-h1.hero {
text-align: left;
+ color: #fff;
}
.landing-h2 {
@@ -6560,10 +4739,10 @@
}
.landing-subhead {
- color: #999999;
+ color: #78868d;
font-size: 20px;
- line-height: 28px;
- font-weight:300;
+ font-weight: 300;
+ line-height: 32px;
text-align: center;
}
.landing-subhead.hero {
@@ -6600,23 +4779,21 @@
* LAYOUT
*/
-#body-content,
-.fullpage,
-#jd-content,
-.jd-descr,
-.landing-body-content {
- height: 100%;
-}
-
.landing-section {
- padding: 80px 10px 80px;
- width: 100%;
- margin-left: -10px;
+ background: #eceff1;
+ clear: both;
+ padding: 80px 20px 80px;
+ margin: 0 -20px;
text-rendering: optimizeLegibility;
}
-#extending-android-to-wearables {
- padding-top: 30px;
+@media (max-width: 719px) {
+ .landing-section {
+ margin-left: -10px;
+ margin-right: -10px;
+ padding-left: 10px;
+ padding-right: 10px;
+ }
}
.landing-short-section {
@@ -6624,7 +4801,7 @@
}
.landing-gray-background {
- background-color: #e9e9e9;
+ background-color: #b0bec5;
}
.landing-white-background {
@@ -6636,24 +4813,19 @@
background-color: hsl(8, 70%, 54%);
}
-.landing-subhead-red {
+.landing-red-background .landing-h1 {
+ color: white;
+}
+
+.landing-red-background .landing-subhead {
color: hsl(8, 71%, 84%);
text-align: left;
}
-.landing-subhead-red p {
- margin-top: 20px;
-}
-
-.landing-hero-container {
- height: 100%;
-}
-
.preview-hero {
- height: calc(100% - 110px);
+ height: calc(100vh - 128px);
min-height: 504px;
- margin-top: -5px;
padding-top: 0;
padding-bottom: 0;
background-image: url(../../preview/images/hero.jpg);
@@ -6665,9 +4837,8 @@
}
.wear-hero {
- height: calc(100% - 110px);
+ height: calc(100vh - 128px);
min-height: 504px;
- margin-top: -5px;
padding-top: 0;
padding-bottom: 0;
background-image: url(../../wear/images/hero.jpg);
@@ -6679,9 +4850,8 @@
}
.tv-hero {
- height: calc(100% - 110px);
+ height: calc(100vh - 128px);
min-height: 504px;
- margin-top: -5px;
padding-top: 0;
padding-bottom: 0;
background-image: url(../../tv/images/hero.jpg);
@@ -6693,9 +4863,8 @@
}
.auto-hero {
- height: calc(100% - 110px);
+ height: calc(100vh - 128px);
min-height: 504px;
- margin-top: -5px;
padding-top: 0;
padding-bottom: 0;
background-image: url(../../auto/images/hero.jpg);
@@ -6708,16 +4877,16 @@
.landing-hero-scrim {
background: black;
- opacity: .2;
- position: absolute;
- width: 100%;
height: 100%;
- margin-left: -10px;
+ left: 0;
+ position: absolute;
+ opacity: .2;
+ width: 100%;
}
.landing-hero-wrap {
margin: 0 auto;
- width: 940px;
+ max-width: 940px;
clear: both;
height: 100%;
position: relative;
@@ -6736,56 +4905,6 @@
line-height: 24px;
}
-.landing-button {
- white-space: nowrap;
- display: inline-block;
- padding: 16px 32px;
- font-size: 18px;
- font-weight: 500;
- line-height: 24px;
- cursor: pointer;
- color: white;
- -webkit-user-select: none;
- -moz-user-select: none;
- -o-user-select: none;
- user-select: none;
- -webkit-transition: .2s background-color ease-in-out;
- -moz-transition: .2s background-color ease-in-out;
- -o-transition: .2s background-color ease-in-out;
- transition: .2s background-color ease-in-out;
-}
-
-.landing-primary {
- background-color: hsl(8, 70%, 44%);
- color: #f8f8f8;
-}
-
-.landing-button.landing-primary:hover {
- background-color: hsl(8, 70%, 36%);
-}
-
-.landing-button.landing-primary:active {
- background-color: hsl(8, 70%, 30%);
-}
-
-.landing-button.landing-secondary {
- background-color: #2faddb;
-}
-
-.landing-button.landing-secondary:hover {
- background-color: #09c;
-}
-
-.landing-button.landing-secondary:active {
- background-color: #3990ab;
-}
-
-a.landing-button,
-a.landing-button:hover,
-a.landing-button:visited {
- color: white !important;
-}
-
.landing-video-link {
white-space: nowrap;
display: inline-block;
@@ -6904,17 +5023,6 @@
margin-bottom: 20px;
}
-.col-3-wide {
- display: inline;
- float: left;
- margin-left: 10px;
- margin-right: 10px;
-}
-
-.col-3-wide {
- width: 302px;
-}
-
/**
* ANIMATION
*/
@@ -6958,7 +5066,7 @@
}
#video-frame {
- width:940px;
+ max-width:940px;
height:100%;
margin:72px auto;
display:none;
@@ -7021,6 +5129,69 @@
content:url("../images/play-circle-grey.png") url("../images/play-circle-grey_2x.png");
}
+/*
+ * Responsive YouTube embeds from DevSite
+ *
+ * When applied to a <div> that wraps a video, "video-wrapper" forces the video
+ * to float right at 50% of the column width on desktop, but appear as a block
+ * element at 100% of the column width on smaller screens.
+ * "video-wrapper-full-width" works the same but is always 100% width.
+ */
+.video-wrapper,
+.video-wrapper-left {
+ float: right;
+ margin: 0 0 40px 40px;
+ padding-top: calc(((100% - 40px) / 2) / 16 * 9); /* 16:9 including margin */
+ position: relative;
+ width: calc((100% - 40px) / 2); /* 50% including margin */
+}
+
+/*
+ * "video-wrapper-left" forces 50% without the float
+ * This is useful for heading content when you want the video to
+ * appear next to an element that is already floated right
+ * (e.g. tb-wrapper <div>)
+ */
+.video-wrapper-left {
+ float: none;
+ margin: 16px 0 20px 0;
+}
+
+.video-wrapper-full-width {
+ margin: 16px 0;
+ padding-top: 56.25%; /* Forces div to 16:9 at 100% width */
+ position: relative;
+ width: 100%;
+}
+
+.video-wrapper embed,
+.video-wrapper iframe,
+.video-wrapper object,
+.video-wrapper-full-width embed,
+.video-wrapper-full-width iframe,
+.video-wrapper-full-width object,
+.video-wrapper-left embed,
+.video-wrapper-left iframe,
+.video-wrapper-left object {
+ height: 100%;
+ left: 0;
+ position: absolute;
+ top: 0;
+ width: 100%;
+}
+
+@media screen and (max-width: 1000px) {
+
+ .video-wrapper,
+ .video-wrapper-left {
+ float: none;
+ margin: 16px 0;
+ padding-top: 56.25%; /* Forces div to 16:9 at 100% width */
+ width: 100%;
+ }
+}
+
+
/******************
Styles for d.a.c/index:
*******************/
@@ -7029,8 +5200,7 @@
/* Generic full screen carousel styling to be used across pages. */
.fullscreen-carousel {
- margin: 0 -10px;
- width: 100%;
+ margin: 0 -20px;
overflow: hidden;
position: relative;
}
@@ -7069,7 +5239,6 @@
font-weight: 300;
font-size: 18px;
line-height: 24px;
- -webkit-font-smoothing: antialiased;
}
.fullscreen-carousel .hero .hero-bg {
@@ -7203,48 +5372,18 @@
}
-
-
-
-/*
- Styles for the entity link used in the actions bar and in the cta of
- the resources that appear in the tab carousel.
-*/
-.actions-bar a:after,
-.resource .cta:after {
- content: '›';
- font-weight: 400;
- font-size: 22px;
- left: 5px;
- line-height: 1;
- position: relative;
- top: 1px;
- transition: left 190ms ease-out;
-}
-
-.actions-bar a:hover:after,
-.resource .cta:hover:after {
- left: 10px;
-}
-
-
-
-
/*
Styles for the actions bar.
*/
.actions-bar {
- background: #9acd00;
- margin: 0 -10px;
+ background: #b0bec5;
text-align: center;
}
.actions-bar .actions {
- padding: 30px 0 30px;
- text-align: justify;
+ padding: 24px 0;
font-size: 0.1px;
line-height: 0.1px;
- margin: 0 10px 0 0;
}
.actions-bar .actions:after {
@@ -7255,26 +5394,36 @@
.actions-bar .actions > div {
display: inline-block;
+ margin: 0 16px;
}
-.actions-bar a {
- font-size: 21px;
- line-height: 27px;
+.actions-bar .actions a {
color: #fff;
+ font-size: 24px;
font-weight: 300;
- -webkit-font-smoothing: antialiased;
+ line-height: 50px;
+ -webkit-transition: opacity .3s;
+ transition: opacity .3s;
}
-.actions-bar a:after {
- top: 0px;
- font-size: 22px;
+.actions-bar .actions a:hover {
+ opacity: .54;
}
-.actions-bar a:hover {
- color: #fff !important;
+.actions-bar .actions .dac-sprite {
+ margin: 0 -8px 0 -12px;
}
+@media (max-width: 719px) {
+ .actions-bar {
+ text-align: left;
+ }
+ .actions-bar .actions > div {
+ display: block;
+ margin: 0;
+ }
+}
@@ -7438,3 +5587,3273 @@
.resource-card-6x2 > .card-bg.helpouts-card-bg:after {
display:none;
}
+
+.dac-visible-mobile-block, .dac-mobile-only, .dac-visible-mobile-inline, .dac-visible-mobile-inline-block, .dac-visible-tablet-block, .dac-visible-tablet-inline, .dac-visible-tablet-inline-block, .dac-visible-desktop-block, .dac-visible-desktop-inline, .dac-visible-desktop-inline-block {
+ display: none !important;
+}
+
+@media (max-width: 719px) {
+ .dac-hidden-mobile {
+ display: none !important;
+ }
+
+ .dac-visible-mobile-block, .dac-mobile-only {
+ display: block !important;
+ }
+
+ .dac-visible-mobile-inline {
+ display: inline !important;
+ }
+
+ .dac-visible-mobile-inline-block {
+ display: inline-block !important;
+ }
+}
+
+@media (min-width: 720px) and (max-width: 979px) {
+ .dac-hidden-tablet {
+ display: none !important;
+ }
+
+ .dac-visible-tablet-block {
+ display: block !important;
+ }
+
+ .dac-visible-tablet-inline {
+ display: inline !important;
+ }
+
+ .dac-visible-tablet-inline-block {
+ display: inline-block !important;
+ }
+}
+
+@media (min-width: 980px) {
+ .dac-hidden-desktop {
+ display: none !important;
+ }
+
+ .dac-visible-desktop-block {
+ display: block !important;
+ }
+
+ .dac-visible-desktop-inline {
+ display: inline !important;
+ }
+
+ .dac-visible-desktop-inline-block {
+ display: inline-block !important;
+ }
+}
+
+.dac-offset-parent {
+ position: relative !important;
+}
+
+/**
+ * Break strings when their length exceeds the width of their container.
+ */
+.dac-text-break {
+ word-wrap: break-word !important;
+}
+
+/**
+ * Horizontal text alignment
+ */
+.dac-text-center {
+ text-align: center !important;
+}
+
+.dac-text-left {
+ text-align: left !important;
+}
+
+.dac-text-right {
+ text-align: right !important;
+}
+
+/**
+ * Prevent whitespace wrapping
+ */
+.dac-text-no-wrap {
+ white-space: nowrap !important;
+}
+
+/**
+ * Prevent text from wrapping onto multiple lines, instead truncate with an ellipsis.
+ */
+.dac-text-truncate {
+ max-width: 100%;
+ overflow: hidden !important;
+ text-overflow: ellipsis !important;
+ white-space: nowrap !important;
+ word-wrap: normal !important;
+}
+
+/**
+ * Floats
+ */
+.dac-float-left {
+ float: left !important;
+}
+
+.dac-float-right {
+ float: right !important;
+}
+
+/**
+ * New block formatting context
+ *
+ * This affords some useful properties to the element. It won't wrap under
+ * floats. Will also contain any floated children.
+ * N.B. This will clip overflow. Use the alternative method below if this is
+ * problematic.
+ */
+.dac-nbfc {
+ overflow: hidden !important; }
+
+/**
+ * New block formatting context (alternative)
+ *
+ * Alternative method when overflow must not be clipped.
+ *
+ * N.B. This breaks down in some browsers when elements within this element
+ * exceed its width.
+ */
+.dac-nbfc-alt {
+ display: table-cell !important;
+ width: 10000px !important; }
+
+/* New CSS */
+/************ RESOURCE CARDS ******************/
+/* Basic card-styling with shadow */
+.resource-card {
+ background: #fff;
+ box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.21);
+ display: block;
+ position: relative; }
+
+/* Play button is only visible on 6by6 cards */
+.play-button {
+ background-color: #000;
+ border-radius: 50%;
+ box-sizing: border-box;
+ display: none;
+ height: 70px;
+ left: 50%;
+ margin-left: -35px;
+ line-height: 65px;
+ padding-left: 4px;
+ position: absolute;
+ opacity: .6;
+ text-align: center;
+ -webkit-transition: opacity .5s;
+ transition: opacity .5s;
+ top: 50px;
+ width: 70px;
+ z-index: 1; }
+ .resource-card-6x6 .play-button {
+ display: block; }
+
+/* Styling for background image including tinting and section icons in stacks */
+.card-bg {
+ bottom: 131px;
+ display: block;
+ position: absolute;
+ vertical-align: top;
+ width: 100%;
+ left: 0;
+ top: 0;
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: center;
+ background-image: url(../images/resource-card-default-android.jpg); }
+ .card-bg:after {
+ content: "";
+ display: block;
+ height: 100%;
+ width: 100%;
+ opacity: 1;
+ background: rgba(0, 0, 0, 0.05);
+ -webkit-transition: opacity 0.5s;
+ transition: opacity 0.5s; }
+ .static .card-bg:after {
+ display: none; }
+ .card-bg .card-section-icon {
+ position: absolute;
+ top: 50%;
+ width: 100%;
+ margin-top: -35px;
+ text-align: center;
+ padding-top: 65px;
+ z-index: 100; }
+ .card-bg .card-section-icon .icon {
+ position: absolute;
+ left: 50%;
+ margin-left: -28px;
+ top: 0px;
+ width: 56px;
+ height: 56px;
+ background-repeat: no-repeat;
+ background-position: 50% 50%;
+ background-image: url(../images/stack-icon.png); }
+ .card-bg .card-section-icon .section {
+ text-transform: uppercase;
+ color: white;
+ font-size: 14px; }
+
+.card-info {
+ position: absolute;
+ box-sizing: border-box;
+ height: 131px;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ overflow: hidden;
+ background: #fefefe;
+ padding: 6px 12px; }
+ .card-info .section {
+ color: #898989;
+ font-size: 11px;
+ font-weight: 700;
+ letter-spacing: .3px;
+ line-height: 20px;
+ text-transform: uppercase; }
+ .card-info .title {
+ color: #333;
+ font-size: 18px;
+ font-weight: 500;
+ line-height: 24px;
+ margin-bottom: 2px;
+ max-height: 48px;
+ overflow: hidden;
+ padding-bottom: 5px;
+ text-overflow: ellipsis;
+ white-space: normal; }
+ .card-info .description {
+ overflow: hidden; }
+ .card-info .description .text {
+ color: #666;
+ font-size: 14px;
+ height: 60px;
+ line-height: 20px;
+ overflow: hidden;
+ width: 100%; }
+ .card-info .description .util {
+ position: absolute;
+ right: 5px;
+ bottom: 70px;
+ opacity: 0;
+ -webkit-transition: opacity 0.5s;
+ transition: opacity 0.5s; }
+ .card-info.empty-desc .title {
+ white-space: normal;
+ overflow: visible; }
+ .card-info.empty-desc .description {
+ display: none; }
+
+/* Truncate card summaries at bounding box and
+ * and apply ellipsis at lower right */
+.ellipsis {
+ overflow: hidden;
+ float: right;
+ line-height: 15px;
+ width: 100%; }
+ .ellipsis:before {
+ content: "";
+ float: left;
+ width: 5px;
+ height: 100%; }
+ .ellipsis > *:first-child.text {
+ float: right;
+ width: 100% !important;
+ margin-left: -5px; }
+ .ellipsis:after {
+ content: "\02026";
+ height: 17px;
+ padding-bottom: 4px;
+ box-sizing: content-box;
+ float: right;
+ position: relative;
+ top: -16px;
+ left: 100%;
+ width: 4em;
+ margin-left: -4em;
+ padding-right: 5px;
+ background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(white), color-stop(65%, white));
+ background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0), white 65%, white);
+ background: linear-gradient(to right, rgba(255, 255, 255, 0), white 65%, white); }
+ .ellipsis:after {
+ font-style: normal;
+ color: #aaa;
+ font-size: 13px;
+ text-align: right; }
+
+.resource-card:hover {
+ cursor: pointer; }
+ .static .resource-card:hover {
+ cursor: auto; }
+ .resource-card:hover .card-bg:after {
+ opacity: 0; }
+ .resource-card:hover .play-button {
+ opacity: .3; }
+ .resource-card:hover .card-info .description .util {
+ opacity: 1; }
+
+/* Carousel Layout */
+/* Carousel styles for landing page */
+.resource-carousel-layout {
+ height: 531px;
+ margin: 20px 0 20px 0;
+ padding: 0 !important;
+ position: relative;
+ overflow: hidden; }
+ .resource-carousel-layout .slideshow-prev, .resource-carousel-layout .slideshow-next {
+ display: none; }
+ .resource-carousel-layout .pagination {
+ bottom: 97px;
+ left: auto;
+ padding-right: 10px;
+ right: 0;
+ text-align: right;
+ width: 16.66666667%; }
+ .resource-carousel-layout .pagination ul li {
+ text-indent: 8000px; }
+ .resource-carousel-layout .frame li {
+ position: relative; }
+ .resource-carousel-layout .frame li .card-bg {
+ bottom: 131px; }
+ .resource-carousel-layout .frame li .card-info {
+ height: 131px;
+ padding: 6px 12px;
+ top: auto; }
+ .resource-carousel-layout .frame li .card-info .title {
+ font-size: 28px;
+ font-weight: 400;
+ line-height: 32px; }
+ .resource-carousel-layout .frame li .card-info .description .text {
+ height: 40px; }
+ .resource-carousel-layout .frame li .card-info .description .util {
+ bottom: 97px;
+ right: 4px; }
+
+/* Stack Layout */
+.resource-stack-layout {
+ display: inline-block;
+ padding: 0; }
+ .resource-stack-layout .section-card-menu > .card-info .section, .resource-stack-layout .section-card > .card-info .title {
+ /*text-transform: uppercase;*/
+ color: #898989;
+ font-size: 17px;
+ line-height: 24px;
+ margin-bottom: 6px; }
+ .resource-stack-layout .section-card {
+ height: 284px; }
+ .resource-stack-layout .section-card > .card-bg {
+ height: 192px; }
+ .resource-stack-layout .section-card > .card-info {
+ padding: 4px 12px 6px 12px;
+ top: 192px; }
+ .resource-stack-layout .section-card > .card-info .section {
+ display: none; }
+ .resource-stack-layout .section-card > .card-info .title {
+ font-size: 17px;
+ border-bottom: 1px solid #959595;
+ padding-bottom: 0px; }
+ .resource-stack-layout .section-card > .card-info .description {
+ font-size: 13px;
+ line-height: 15px; }
+ .resource-stack-layout .section-card > .card-info .description .text {
+ height: 30px; }
+ .resource-stack-layout .related-card {
+ height: 90px; }
+ .resource-stack-layout .related-card > .card-bg {
+ left: 0;
+ top: 0;
+ width: 90px;
+ height: 100%;
+ position: absolute;
+ display: block; }
+ .resource-stack-layout .related-card > .card-info {
+ left: 90px;
+ padding: 4px 12px 4px 12px; }
+ .resource-stack-layout .related-card > .card-info .section {
+ font-size: 12px;
+ margin-bottom: 1px;
+ display: none; }
+ .resource-stack-layout .related-card > .card-info .title {
+ font-size: 16px;
+ margin-bottom: -2px;
+ white-space: normal;
+ overflow: visible;
+ text-overflow: ellipsis; }
+ .resource-stack-layout .related-card > .card-info .title:after {
+ content: url(../images/link-out.png);
+ display: block; }
+ .resource-stack-layout .related-card > .card-info .description {
+ display: none; }
+ .resource-stack-layout .section-card-menu {
+ /* Flexible height */
+ display: block;
+ height: auto;
+ width: auto; }
+ .resource-stack-layout .section-card-menu .card-bg {
+ height: 155px;
+ /* Flexible height */
+ position: relative;
+ display: inline-block;
+ vertical-align: top; }
+ .resource-stack-layout .section-card-menu .card-info {
+ padding: 4px 12px 0px 12px;
+ /* Flexible height */
+ position: relative;
+ left: auto;
+ top: auto;
+ right: auto;
+ bottom: auto; }
+ .resource-stack-layout .section-card-menu .card-info ul {
+ list-style: none;
+ margin: 0; }
+ .resource-stack-layout .section-card-menu .card-info ul li {
+ list-style: none;
+ margin: 0;
+ padding: 15px 0;
+ border-top-width: 1px;
+ border-top-style: solid;
+ border-top-color: #959595; }
+ .resource-stack-layout .section-card-menu .card-info ul li a, .resource-stack-layout .section-card-menu .card-info ul li a:focus, .resource-stack-layout .section-card-menu .card-info ul li a:hover {
+ color: #333 !important; }
+ .resource-stack-layout .section-card-menu .card-info ul li:first-child {
+ border-top: none; }
+ .resource-stack-layout .section-card-menu .card-info ul li:hover .title:after {
+ opacity: 1;
+ -webkit-transition: opacity 0.5s;
+ transition: opacity 0.5s; }
+ .resource-stack-layout .section-card-menu .card-info ul li:hover .description {
+ max-height: 30px;
+ opacity: 1;
+ -webkit-transition: max-height 0.5s, opacity 1s;
+ transition: max-height 0.5s, opacity 1s; }
+ .resource-stack-layout .section-card-menu .card-info .title {
+ font-size: 16px;
+ margin-bottom: -2px;
+ position: relative; }
+ .resource-stack-layout .section-card-menu .card-info .title:after {
+ background: url(../images/stack-arrow-right.png);
+ content: '';
+ opacity: 0;
+ -webkit-transition: opacity 0.25s;
+ transition: opacity 0.25s;
+ position: absolute;
+ right: 0px;
+ top: 3px;
+ width: 10px;
+ height: 15px; }
+ .resource-stack-layout .section-card-menu .card-info .title.more {
+ text-transform: uppercase;
+ color: #898989;
+ display: inline-block; }
+ .resource-stack-layout .section-card-menu .card-info .title.more:after {
+ background: url(../images/stack-arrow-right.png);
+ content: '';
+ display: block;
+ position: absolute;
+ right: -20px;
+ top: 3px;
+ width: 10px;
+ height: 15px; }
+ .resource-stack-layout .section-card-menu .card-info .description {
+ max-height: 0px;
+ opacity: 0;
+ overflow: hidden;
+ font-size: 13px;
+ line-height: 15px;
+ /* Hover off */
+ -webkit-transition: max-height 0.5s, opacity 0.5s;
+ transition: max-height 0.5s, opacity 0.5s; }
+ .resource-stack-layout .section-card-menu .card-info .description .text {
+ height: 30px; }
+ .resource-stack-layout:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden; }
+
+.resource-card, .resource-card-stack {
+ margin-bottom: 20px; }
+
+.resource-card-row-stack-last {
+ margin-bottom: 0px !important; }
+
+.resource-card-col-stack-last {
+ margin-bottom: 0px !important; }
+
+.resource-card-3x6 {
+ height: 300px; }
+
+.resource-card-3x12 {
+ height: 620px; }
+
+.resource-card-3x18 {
+ height: 940px; }
+
+.resource-card-6x6 {
+ height: 300px; }
+
+.resource-card-6x12 {
+ height: 620px; }
+
+.resource-card-6x18 {
+ height: 940px; }
+
+.resource-card-9x6 {
+ height: 300px; }
+
+.resource-card-9x12 {
+ height: 620px; }
+
+.resource-card-9x18 {
+ height: 940px; }
+
+.resource-card-12x6 {
+ height: 300px; }
+
+.resource-card-12x12 {
+ height: 620px; }
+
+.resource-card-12x18 {
+ height: 940px; }
+
+.resource-card-15x6 {
+ height: 300px; }
+
+.resource-card-15x12 {
+ height: 620px; }
+
+.resource-card-15x18 {
+ height: 940px; }
+
+.resource-card-18x6 {
+ height: 300px; }
+
+.resource-card-18x12 {
+ height: 620px; }
+
+.resource-card-18x18 {
+ height: 940px; }
+
+.resource-card-3x2 {
+ height: 100px; }
+
+.resource-card-3x2x3 {
+ height: 90px;
+ margin-bottom: 15px; }
+
+.resource-card-3x3 {
+ height: 150px; }
+
+.resource-card-3x3x2 {
+ height: 142px;
+ margin-bottom: 16px; }
+
+.resource-card-6x2 {
+ height: 100px; }
+
+.resource-card-6x2x3 {
+ height: 90px;
+ margin-bottom: 15px; }
+
+.resource-card-6x3 {
+ height: 150px; }
+
+.resource-card-6x3x2 {
+ height: 142px;
+ margin-bottom: 16px; }
+
+.resource-card-9x2 {
+ height: 100px; }
+
+.resource-card-9x2x3 {
+ height: 90px;
+ margin-bottom: 15px; }
+
+.resource-card-9x3 {
+ height: 150px; }
+
+.resource-card-9x3x2 {
+ height: 142px;
+ margin-bottom: 16px; }
+
+.resource-card-12x2 {
+ height: 100px; }
+
+.resource-card-12x2x3 {
+ height: 90px;
+ margin-bottom: 15px; }
+
+.resource-card-12x3 {
+ height: 150px; }
+
+.resource-card-12x3x2 {
+ height: 142px;
+ margin-bottom: 16px; }
+
+.resource-card-15x2 {
+ height: 100px; }
+
+.resource-card-15x2x3 {
+ height: 90px;
+ margin-bottom: 15px; }
+
+.resource-card-15x3 {
+ height: 150px; }
+
+.resource-card-15x3x2 {
+ height: 142px;
+ margin-bottom: 16px; }
+
+.resource-card-18x2 {
+ height: 100px; }
+
+.resource-card-18x2x3 {
+ height: 90px;
+ margin-bottom: 15px; }
+
+.resource-card-18x3 {
+ height: 150px; }
+
+.resource-card-18x3x2 {
+ height: 142px;
+ margin-bottom: 16px; }
+
+/*
+ The following are styles for cards in the flowlayout above, styled by the number of rows they span
+*/
+/* Single row, 2 column items. */
+.resource-card-9x6 {
+ height: 390px; }
+
+/* Double row, 1 column items. Eg full width video thumbnails. */
+.resource-card-18x12 {
+ height: 558px; }
+
+/* 1/3 row items */
+.resource-card-3x2 > .card-bg, .resource-card-6x2 > .card-bg, .resource-card-9x2 > .card-bg, .resource-card-12x2 > .card-bg, .resource-card-15x2 > .card-bg, .resource-card-18x2 > .card-bg {
+ left: 0;
+ top: 0;
+ width: 90px;
+ height: 100%;
+ position: absolute;
+ display: block; }
+.resource-card-3x2 > .card-info, .resource-card-6x2 > .card-info, .resource-card-9x2 > .card-info, .resource-card-12x2 > .card-info, .resource-card-15x2 > .card-info, .resource-card-18x2 > .card-info {
+ height: 100%;
+ left: 90px;
+ padding: 6px 12px;
+ overflow: hidden; }
+ .resource-card-3x2 > .card-info .title, .resource-card-6x2 > .card-info .title, .resource-card-9x2 > .card-info .title, .resource-card-12x2 > .card-info .title, .resource-card-15x2 > .card-info .title, .resource-card-18x2 > .card-info .title {
+ max-height: 48px;
+ white-space: normal; }
+ .resource-card-3x2 > .card-info .description, .resource-card-6x2 > .card-info .description, .resource-card-9x2 > .card-info .description, .resource-card-12x2 > .card-info .description, .resource-card-15x2 > .card-info .description, .resource-card-18x2 > .card-info .description {
+ display: none; }
+ .resource-card-3x2 > .card-info .text, .resource-card-6x2 > .card-info .text, .resource-card-9x2 > .card-info .text, .resource-card-12x2 > .card-info .text, .resource-card-15x2 > .card-info .text, .resource-card-18x2 > .card-info .text {
+ height: auto; }
+
+/* Override to show the description instead of the content section */
+.no-section .resource-card-3x2 > .card-info .section, .no-section .resource-card-6x2 > .card-info .section {
+ display: none; }
+
+.no-section .resource-card-3x2 > .card-info .description, .no-section .resource-card-6x2 > .card-info .description {
+ display: block; }
+
+/* 1/2 row items */
+.resource-card-3x3, .resource-card-6x3, .resource-card-9x3, .resource-card-12x3, .resource-card-15x3, .resource-card-18x3 {
+ height: 160px; }
+ .resource-card-3x3 > .card-bg, .resource-card-6x3 > .card-bg, .resource-card-9x3 > .card-bg, .resource-card-12x3 > .card-bg, .resource-card-15x3 > .card-bg, .resource-card-18x3 > .card-bg {
+ left: 0;
+ top: 0;
+ width: 90px;
+ height: 100%;
+ position: absolute;
+ display: block; }
+ .resource-card-3x3 > .card-info, .resource-card-6x3 > .card-info, .resource-card-9x3 > .card-info, .resource-card-12x3 > .card-info, .resource-card-15x3 > .card-info, .resource-card-18x3 > .card-info {
+ height: 100%;
+ left: 90px;
+ padding: 6px 12px; }
+ .resource-card-3x3 > .card-info .section, .resource-card-6x3 > .card-info .section, .resource-card-9x3 > .card-info .section, .resource-card-12x3 > .card-info .section, .resource-card-15x3 > .card-info .section, .resource-card-18x3 > .card-info .section {
+ display: none; }
+ .resource-card-3x3 > .card-info .title, .resource-card-6x3 > .card-info .title, .resource-card-9x3 > .card-info .title, .resource-card-12x3 > .card-info .title, .resource-card-15x3 > .card-info .title, .resource-card-18x3 > .card-info .title {
+ max-height: 96px;
+ white-space: normal; }
+ .resource-card-3x3 > .card-info .text, .resource-card-6x3 > .card-info .text, .resource-card-9x3 > .card-info .text, .resource-card-12x3 > .card-info .text, .resource-card-15x3 > .card-info .text, .resource-card-18x3 > .card-info .text {
+ height: auto; }
+ .resource-card-3x3 > .card-info .util, .resource-card-6x3 > .card-info .util, .resource-card-9x3 > .card-info .util, .resource-card-12x3 > .card-info .util, .resource-card-15x3 > .card-info .util, .resource-card-18x3 > .card-info .util {
+ display: none; }
+
+/* placement of plusone */
+.resource-card-6x12 > .card-info .description .util, .resource-card-9x12 > .card-info .description .util, .resource-card-12x12 > .card-info .description .util, .resource-card-15x12 > .card-info .description .util {
+ bottom: 2px; }
+
+.resource-card-18x12 > .card-info .description .util {
+ bottom: 2px; }
+
+/* Overrides for col-16 6x6 cards linking to local content on landing pages.
+ Suppresses "section". */
+.landing .card-info .section {
+ display: none; }
+
+/*
+ Generate a resource stack layout for a 3 column widget spanning 16 grid cols
+*/
+.resource-stack-layout.col-16 {
+ margin: 0 -14px 0 0;
+ width: 954px; }
+ .resource-stack-layout.col-16 .resource-card-stack {
+ margin: 0 14px 0 0;
+ width: 304px; }
+
+/* Example of card menu tinting */
+.resource-widget[data-section=distribute\/tools] .section-card-menu .card-bg:after {
+ background: rgba(126, 55, 148, 0.4) !important; }
+.resource-widget[data-section=distribute\/tools] .section-card-menu .card-section-icon .icon {
+ background-color: #7e3794 !important; }
+.resource-widget[data-section=distribute\/tools] .section-card-menu .card-info ul li {
+ border-top-color: #7e3794 !important; }
+
+/* tinting for stacks */
+div.jd-descr > .resource-widget[data-section=distribute\/tools] .section-card-menu .card-info ul li {
+ border-top-color: #7e3794 !important; }
+
+.dac-fab, .button, .landing-button, .dac-button {
+ background: transparent;
+ border: 0;
+ border-radius: 3px;
+ box-sizing: border-box;
+ color: currentColor;
+ cursor: pointer;
+ display: inline-block;
+ font-weight: 500;
+ font-size: 14px;
+ font-style: inherit;
+ font-variant: inherit;
+ font-family: inherit;
+ letter-spacing: .5px;
+ line-height: 24px;
+ margin: 6px 16px 6px 0;
+ min-width: 88px;
+ outline: 0;
+ padding: 6px 12px;
+ position: relative;
+ text-align: center;
+ text-decoration: none;
+ text-transform: uppercase;
+ -webkit-transition: box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
+ transition: box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ white-space: nowrap; }
+
+.button, .landing-button, .dac-button.dac-raised {
+ background-color: #FAFAFA;
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); }
+
+.dac-button.dac-raised.dac-primary, .landing-secondary, .button {
+ background-color: #039bef; }
+ .dac-button.dac-raised.dac-primary:hover, .landing-secondary:hover, .button:hover {
+ background-color: #0288d1; color:#fff; }
+ .dac-button.dac-raised.dac-primary:active, .landing-secondary:active, .button:active {
+ background-color: #0277bd; }
+
+.dac-button.dac-raised.dac-red, .landing-primary {
+ background-color: #bf3722; }
+ .dac-button.dac-raised.dac-red:hover, .landing-primary:hover {
+ background-color: #9c2d1c; }
+ .dac-button.dac-raised.dac-red:active, .landing-primary:active {
+ background-color: #822517; }
+
+.dac-button.dac-raised.dac-green, .landing-button.green {
+ background-color: #90C653; }
+
+.dac-button.dac-raised.dac-primary, .landing-secondary, .button, .dac-button.dac-raised.dac-red, .landing-primary, .dac-button.dac-raised.dac-green, .landing-button.green {
+ color: #fff; }
+
+.dac-button.dac-large, .landing-button {
+ padding: 12px 24px; }
+
+.dac-fab {
+ background: #fff;
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26);
+ border-radius: 50%;
+ font-size: 0;
+ height: 36px;
+ line-height: 36px;
+ min-width: 0;
+ overflow: hidden;
+ padding: 0;
+ vertical-align: middle;
+ width: 36px; }
+ .dac-fab:hover, a:hover > .dac-fab {
+ box-shadow: 0 3px 8px rgba(0, 0, 0, 0.26); }
+ .dac-fab.dac-primary {
+ background: #00c7a0; }
+ .dac-fab.dac-large {
+ height: 54px;
+ line-height: 54px;
+ width: 54px; }
+
+.dac-scroll-button {
+ height: 54px;
+ line-height: 54px;
+ margin: 0;
+ position: absolute;
+ right: 0;
+ top: -27px;
+ width: 54px;
+ z-index: 1; }
+ @media (max-width: 719px) {
+ .dac-scroll-button {
+ display: none; } }
+
+/* Footer component */
+.dac-footer {
+ background-color: #fff;
+ border-top: 1px solid #f0f0f0;
+ clear: both;
+ color: #999;
+ font-size: 12px;
+ margin-top: 96px;
+ padding-bottom: 20px;
+ position: relative;
+ /* Modifier for landing pages, to snuggle closer to sections. */ }
+ .dac-footer a {
+ color: #999; }
+ .dac-footer p {
+ margin: 7px 0 0; }
+ .dac-footer-main {
+ padding: 30px 0; }
+ .dac-footer-reachout {
+ text-align: right; }
+ .dac-footer-contact, .dac-footer-social {
+ display: inline-block; }
+ .dac-footer .dac-footer-getnews, .dac-footer .dac-footer-contact-link {
+ color: #000;
+ cursor: pointer;
+ font-size: 20px;
+ font-weight: 300;
+ margin: 8px 0;
+ vertical-align: middle; }
+ .dac-footer .dac-footer-contact-link, .dac-footer .dac-footer-social-link {
+ margin-left: 16px;
+ margin-right: 0; }
+ .dac-footer-getnews > .dac-fab {
+ margin-left: 4px; }
+ .dac-footer-separator {
+ background: #f0f0f0;
+ margin: 0 0 12px; }
+ .dac-footer-links a + a:before {
+ content: '|';
+ cursor: default;
+ margin: 0 10px 0 8px; }
+ .dac-footer .locales {
+ float: right;
+ margin: 0; }
+ .dac-footer .locales select {
+ background-color: #f0f0f0;
+ border-radius: 3px;
+ font-size: 12px;
+ height: auto;
+ margin-top: -2px;
+ padding: 8px 12px;
+ width: 146px; }
+ .dac-footer.dac-landing {
+ margin-top: 0;
+ border-top: 0; }
+ @media (max-width: 719px) {
+ .dac-footer-reachout {
+ text-align: left; }
+ .dac-footer-social {
+ display: block; }
+ .dac-footer-social-link, .dac-footer-contact-link {
+ display: inline-block; }
+ .dac-footer .dac-footer-contact-link, .dac-footer .dac-footer-social-link {
+ margin-left: 0;
+ margin-right: 16px; }
+ .dac-footer .locales {
+ display: block;
+ float: none;
+ margin-top: 15px; } }
+
+/* =============================================================================
+ Columns
+ ========================================================================== */
+.wrap {
+ margin: 0 auto;
+ max-width: 940px;
+ clear: both; }
+
+.cols {
+ margin-left: -10px;
+ margin-right: -10px;
+ /**
+ * For modern browsers
+ * 1. The space content is one way to avoid an Opera bug when the
+ * contenteditable attribute is included anywhere else in the document.
+ * Otherwise it causes space to appear at the top and bottom of elements
+ * that are clearfixed.
+ * 2. The use of `table` rather than `block` is only necessary if using
+ * `:before` to contain the top-margins of child elements.
+ */ }
+ .cols:before, .cols:after {
+ content: ' ';
+ /* 1 */
+ display: table;
+ /* 2 */ }
+ .cols:after {
+ clear: both; }
+
+[class*=col-] {
+ box-sizing: border-box;
+ float: left;
+ min-height: 1px;
+ padding-left: 10px;
+ padding-right: 10px;
+ position: relative; }
+
+.col-1 {
+ width: 6.25%; }
+
+.col-2 {
+ width: 12.5%; }
+
+.col-3 {
+ width: 18.75%; }
+
+.col-4 {
+ width: 25%; }
+
+.col-5 {
+ width: 31.25%; }
+
+.col-6 {
+ width: 37.5%; }
+
+.col-7 {
+ width: 43.75%; }
+
+.col-8 {
+ width: 50%; }
+
+.col-9 {
+ width: 56.25%; }
+
+.col-10 {
+ width: 62.5%; }
+
+.col-11 {
+ width: 68.75%; }
+
+.col-12 {
+ width: 75%; }
+
+.col-13 {
+ width: 81.25%; }
+
+.col-14 {
+ width: 87.5%; }
+
+.col-15 {
+ width: 93.75%; }
+
+.col-16 {
+ width: 100%; }
+
+.col-13 .col-1 {
+ width: 7.69230769%; }
+
+.col-13 .col-2 {
+ width: 15.38461538%; }
+
+.col-13 .col-3 {
+ width: 23.07692308%; }
+
+.col-13 .col-4 {
+ width: 30.76923077%; }
+
+.col-13 .col-5 {
+ width: 38.46153846%; }
+
+.col-13 .col-6 {
+ width: 46.15384615%; }
+
+.col-13 .col-7 {
+ width: 53.84615385%; }
+
+.col-13 .col-8 {
+ width: 61.53846154%; }
+
+.col-13 .col-9 {
+ width: 69.23076923%; }
+
+.col-13 .col-10 {
+ width: 76.92307692%; }
+
+.col-13 .col-11 {
+ width: 84.61538462%; }
+
+.col-13 .col-12 {
+ width: 92.30769231%; }
+
+.col-13 .col-13 {
+ width: 100%; }
+
+.col-12 .col-1 {
+ width: 8.33333333%; }
+
+.col-12 .col-2 {
+ width: 16.66666667%; }
+
+.col-12 .col-3 {
+ width: 25%; }
+
+.col-12 .col-4 {
+ width: 33.33333333%; }
+
+.col-12 .col-5 {
+ width: 41.66666667%; }
+
+.col-12 .col-6 {
+ width: 50%; }
+
+.col-12 .col-7 {
+ width: 58.33333333%; }
+
+.col-12 .col-8 {
+ width: 66.66666667%; }
+
+.col-12 .col-9 {
+ width: 75%; }
+
+.col-12 .col-10 {
+ width: 83.33333333%; }
+
+.col-12 .col-11 {
+ width: 91.66666667%; }
+
+.col-12 .col-12 {
+ width: 100%; }
+
+.col-1of1, .col-2of2, .col-3of3, .col-4of4, .col-5of5, .col-6of6, .col-8of8, .col-10of10, .col-12of12, .col-16of16 {
+ width: 100%; }
+
+.col-1of2, .col-2of4, .col-3of6, .col-4of8, .col-5of10, .col-6of12, .col-8of16 {
+ width: 50%; }
+
+.col-1of3, .col-2of6, .col-4of12 {
+ width: 33.33333333%; }
+
+.col-2of3, .col-4of6, .col-8of12 {
+ width: 66.66666667%; }
+
+.col-1of4, .col-2of8, .col-3of12, .col-4of16 {
+ width: 25%; }
+
+.col-3of4, .col-6of8, .col-9of12, .col-12of16 {
+ width: 75%; }
+
+.col-1of5, .col-2of10 {
+ width: 20%; }
+
+.col-2of5, .col-4of10 {
+ width: 40%; }
+
+.col-3of5, .col-6of10 {
+ width: 60%; }
+
+.col-4of5, .col-8of10 {
+ width: 80%; }
+
+.col-1of6, .col-2of12 {
+ width: 16.66666667%; }
+
+.col-5of6, .col-10of12 {
+ width: 83.33333333%; }
+
+.col-1of8, .col-2of16 {
+ width: 12.5%; }
+
+.col-3of8, .col-6of16 {
+ width: 37.5%; }
+
+.col-5of8, .col-10of16 {
+ width: 62.5%; }
+
+.col-7of8, .col-14of16 {
+ width: 87.5%; }
+
+.col-1of10 {
+ width: 10%; }
+
+.col-3of10 {
+ width: 30%; }
+
+.col-7of10 {
+ width: 70%; }
+
+.col-9of10 {
+ width: 90%; }
+
+.col-1of12 {
+ width: 8.33333333%; }
+
+.col-5of12 {
+ width: 41.66666667%; }
+
+.col-7of12 {
+ width: 58.33333333%; }
+
+.col-11of12 {
+ width: 91.66666667%; }
+
+.col-1of16 {
+ width: 6.25%; }
+
+.col-3of16 {
+ width: 18.75%; }
+
+.col-5of16 {
+ width: 31.25%; }
+
+.col-7of16 {
+ width: 43.75%; }
+
+.col-9of16 {
+ width: 56.25%; }
+
+.col-11of16 {
+ width: 68.75%; }
+
+.col-13of16 {
+ width: 81.25%; }
+
+.col-15of16 {
+ width: 93.75%; }
+
+.col-pull-1of1, .col-pull-2of2, .col-pull-3of3, .col-pull-4of4, .col-pull-5of5, .col-pull-6of6, .col-pull-8of8, .col-pull-10of10, .col-pull-12of12, .col-pull-16of16 {
+ left: -100%; }
+
+.col-pull-1of2, .col-pull-2of4, .col-pull-3of6, .col-pull-4of8, .col-pull-5of10, .col-pull-6of12, .col-pull-8of16 {
+ left: -50%; }
+
+.col-pull-1of3, .col-pull-2of6, .col-pull-4of12 {
+ left: -33.33333333%; }
+
+.col-pull-2of3, .col-pull-4of6, .col-pull-8of12 {
+ left: -66.66666667%; }
+
+.col-pull-1of4, .col-pull-2of8, .col-pull-3of12, .col-pull-4of16 {
+ left: -25%; }
+
+.col-pull-3of4, .col-pull-6of8, .col-pull-9of12, .col-pull-12of16 {
+ left: -75%; }
+
+.col-pull-1of5, .col-pull-2of10 {
+ left: -20%; }
+
+.col-pull-2of5, .col-pull-4of10 {
+ left: -40%; }
+
+.col-pull-3of5, .col-pull-6of10 {
+ left: -60%; }
+
+.col-pull-4of5, .col-pull-8of10 {
+ left: -80%; }
+
+.col-pull-1of6, .col-pull-2of12 {
+ left: -16.66666667%; }
+
+.col-pull-5of6, .col-pull-10of12 {
+ left: -83.33333333%; }
+
+.col-pull-1of8, .col-pull-2of16 {
+ left: -12.5%; }
+
+.col-pull-3of8, .col-pull-6of16 {
+ left: -37.5%; }
+
+.col-pull-5of8, .col-pull-10of16 {
+ left: -62.5%; }
+
+.col-pull-7of8, .col-pull-14of16 {
+ left: -87.5%; }
+
+.col-pull-1of10 {
+ left: -10%; }
+
+.col-pull-3of10 {
+ left: -30%; }
+
+.col-pull-7of10 {
+ left: -70%; }
+
+.col-pull-9of10 {
+ left: -90%; }
+
+.col-pull-1of12 {
+ left: -8.33333333%; }
+
+.col-pull-5of12 {
+ left: -41.66666667%; }
+
+.col-pull-7of12 {
+ left: -58.33333333%; }
+
+.col-pull-11of12 {
+ left: -91.66666667%; }
+
+.col-pull-1of16 {
+ left: -6.25%; }
+
+.col-pull-3of16 {
+ left: -18.75%; }
+
+.col-pull-5of16 {
+ left: -31.25%; }
+
+.col-pull-7of16 {
+ left: -43.75%; }
+
+.col-pull-9of16 {
+ left: -56.25%; }
+
+.col-pull-11of16 {
+ left: -68.75%; }
+
+.col-pull-13of16 {
+ left: -81.25%; }
+
+.col-pull-15of16 {
+ left: -93.75%; }
+
+.col-push-1of1, .col-push-2of2, .col-push-3of3, .col-push-4of4, .col-push-5of5, .col-push-6of6, .col-push-8of8, .col-push-10of10, .col-push-12of12, .col-push-16of16 {
+ left: 100%; }
+
+.col-push-1of2, .col-push-2of4, .col-push-3of6, .col-push-4of8, .col-push-5of10, .col-push-6of12, .col-push-8of16 {
+ left: 50%; }
+
+.col-push-1of3, .col-push-2of6, .col-push-4of12 {
+ left: 33.33333333%; }
+
+.col-push-2of3, .col-push-4of6, .col-push-8of12 {
+ left: 66.66666667%; }
+
+.col-push-1of4, .col-push-2of8, .col-push-3of12, .col-push-4of16 {
+ left: 25%; }
+
+.col-push-3of4, .col-push-6of8, .col-push-9of12, .col-push-12of16 {
+ left: 75%; }
+
+.col-push-1of5, .col-push-2of10 {
+ left: 20%; }
+
+.col-push-2of5, .col-push-4of10 {
+ left: 40%; }
+
+.col-push-3of5, .col-push-6of10 {
+ left: 60%; }
+
+.col-push-4of5, .col-push-8of10 {
+ left: 80%; }
+
+.col-push-1of6, .col-push-2of12 {
+ left: 16.66666667%; }
+
+.col-push-5of6, .col-push-10of12 {
+ left: 83.33333333%; }
+
+.col-push-1of8, .col-push-2of16 {
+ left: 12.5%; }
+
+.col-push-3of8, .col-push-6of16 {
+ left: 37.5%; }
+
+.col-push-5of8, .col-push-10of16 {
+ left: 62.5%; }
+
+.col-push-7of8, .col-push-14of16 {
+ left: 87.5%; }
+
+.col-push-1of10 {
+ left: 10%; }
+
+.col-push-3of10 {
+ left: 30%; }
+
+.col-push-7of10 {
+ left: 70%; }
+
+.col-push-9of10 {
+ left: 90%; }
+
+.col-push-1of12 {
+ left: 8.33333333%; }
+
+.col-push-5of12 {
+ left: 41.66666667%; }
+
+.col-push-7of12 {
+ left: 58.33333333%; }
+
+.col-push-11of12 {
+ left: 91.66666667%; }
+
+.col-push-1of16 {
+ left: 6.25%; }
+
+.col-push-3of16 {
+ left: 18.75%; }
+
+.col-push-5of16 {
+ left: 31.25%; }
+
+.col-push-7of16 {
+ left: 43.75%; }
+
+.col-push-9of16 {
+ left: 56.25%; }
+
+.col-push-11of16 {
+ left: 68.75%; }
+
+.col-push-13of16 {
+ left: 81.25%; }
+
+.col-push-15of16 {
+ left: 93.75%; }
+
+@media (max-width: 960px) and (min-width: 720px) {
+ .col-tablet-1of1, .col-tablet-2of2, .col-tablet-3of3, .col-tablet-4of4, .col-tablet-5of5, .col-tablet-6of6, .col-tablet-8of8, .col-tablet-10of10, .col-tablet-12of12, .col-tablet-16of16 {
+ width: 100%; }
+ .col-tablet-1of2, .col-tablet-2of4, .col-tablet-3of6, .col-tablet-4of8, .col-tablet-5of10, .col-tablet-6of12, .col-tablet-8of16 {
+ width: 50%; }
+ .col-tablet-1of3, .col-tablet-2of6, .col-tablet-4of12 {
+ width: 33.33333333%; }
+ .col-tablet-2of3, .col-tablet-4of6, .col-tablet-8of12 {
+ width: 66.66666667%; }
+ .col-tablet-1of4, .col-tablet-2of8, .col-tablet-3of12, .col-tablet-4of16 {
+ width: 25%; }
+ .col-tablet-3of4, .col-tablet-6of8, .col-tablet-9of12, .col-tablet-12of16 {
+ width: 75%; }
+ .col-tablet-1of5, .col-tablet-2of10 {
+ width: 20%; }
+ .col-tablet-2of5, .col-tablet-4of10 {
+ width: 40%; }
+ .col-tablet-3of5, .col-tablet-6of10 {
+ width: 60%; }
+ .col-tablet-4of5, .col-tablet-8of10 {
+ width: 80%; }
+ .col-tablet-1of6, .col-tablet-2of12 {
+ width: 16.66666667%; }
+ .col-tablet-5of6, .col-tablet-10of12 {
+ width: 83.33333333%; }
+ .col-tablet-1of8, .col-tablet-2of16 {
+ width: 12.5%; }
+ .col-tablet-3of8, .col-tablet-6of16 {
+ width: 37.5%; }
+ .col-tablet-5of8, .col-tablet-10of16 {
+ width: 62.5%; }
+ .col-tablet-7of8, .col-tablet-14of16 {
+ width: 87.5%; }
+ .col-tablet-1of10 {
+ width: 10%; }
+ .col-tablet-3of10 {
+ width: 30%; }
+ .col-tablet-7of10 {
+ width: 70%; }
+ .col-tablet-9of10 {
+ width: 90%; }
+ .col-tablet-1of12 {
+ width: 8.33333333%; }
+ .col-tablet-5of12 {
+ width: 41.66666667%; }
+ .col-tablet-7of12 {
+ width: 58.33333333%; }
+ .col-tablet-11of12 {
+ width: 91.66666667%; }
+ .col-tablet-1of16 {
+ width: 6.25%; }
+ .col-tablet-3of16 {
+ width: 18.75%; }
+ .col-tablet-5of16 {
+ width: 31.25%; }
+ .col-tablet-7of16 {
+ width: 43.75%; }
+ .col-tablet-9of16 {
+ width: 56.25%; }
+ .col-tablet-11of16 {
+ width: 68.75%; }
+ .col-tablet-13of16 {
+ width: 81.25%; }
+ .col-tablet-15of16 {
+ width: 93.75%; }
+ .col-tablet-pull-1of1, .col-tablet-pull-2of2, .col-tablet-pull-3of3, .col-tablet-pull-4of4, .col-tablet-pull-5of5, .col-tablet-pull-6of6, .col-tablet-pull-8of8, .col-tablet-pull-10of10, .col-tablet-pull-12of12, .col-tablet-pull-16of16 {
+ left: -100%; }
+ .col-tablet-pull-1of2, .col-tablet-pull-2of4, .col-tablet-pull-3of6, .col-tablet-pull-4of8, .col-tablet-pull-5of10, .col-tablet-pull-6of12, .col-tablet-pull-8of16 {
+ left: -50%; }
+ .col-tablet-pull-1of3, .col-tablet-pull-2of6, .col-tablet-pull-4of12 {
+ left: -33.33333333%; }
+ .col-tablet-pull-2of3, .col-tablet-pull-4of6, .col-tablet-pull-8of12 {
+ left: -66.66666667%; }
+ .col-tablet-pull-1of4, .col-tablet-pull-2of8, .col-tablet-pull-3of12, .col-tablet-pull-4of16 {
+ left: -25%; }
+ .col-tablet-pull-3of4, .col-tablet-pull-6of8, .col-tablet-pull-9of12, .col-tablet-pull-12of16 {
+ left: -75%; }
+ .col-tablet-pull-1of5, .col-tablet-pull-2of10 {
+ left: -20%; }
+ .col-tablet-pull-2of5, .col-tablet-pull-4of10 {
+ left: -40%; }
+ .col-tablet-pull-3of5, .col-tablet-pull-6of10 {
+ left: -60%; }
+ .col-tablet-pull-4of5, .col-tablet-pull-8of10 {
+ left: -80%; }
+ .col-tablet-pull-1of6, .col-tablet-pull-2of12 {
+ left: -16.66666667%; }
+ .col-tablet-pull-5of6, .col-tablet-pull-10of12 {
+ left: -83.33333333%; }
+ .col-tablet-pull-1of8, .col-tablet-pull-2of16 {
+ left: -12.5%; }
+ .col-tablet-pull-3of8, .col-tablet-pull-6of16 {
+ left: -37.5%; }
+ .col-tablet-pull-5of8, .col-tablet-pull-10of16 {
+ left: -62.5%; }
+ .col-tablet-pull-7of8, .col-tablet-pull-14of16 {
+ left: -87.5%; }
+ .col-tablet-pull-1of10 {
+ left: -10%; }
+ .col-tablet-pull-3of10 {
+ left: -30%; }
+ .col-tablet-pull-7of10 {
+ left: -70%; }
+ .col-tablet-pull-9of10 {
+ left: -90%; }
+ .col-tablet-pull-1of12 {
+ left: -8.33333333%; }
+ .col-tablet-pull-5of12 {
+ left: -41.66666667%; }
+ .col-tablet-pull-7of12 {
+ left: -58.33333333%; }
+ .col-tablet-pull-11of12 {
+ left: -91.66666667%; }
+ .col-tablet-pull-1of16 {
+ left: -6.25%; }
+ .col-tablet-pull-3of16 {
+ left: -18.75%; }
+ .col-tablet-pull-5of16 {
+ left: -31.25%; }
+ .col-tablet-pull-7of16 {
+ left: -43.75%; }
+ .col-tablet-pull-9of16 {
+ left: -56.25%; }
+ .col-tablet-pull-11of16 {
+ left: -68.75%; }
+ .col-tablet-pull-13of16 {
+ left: -81.25%; }
+ .col-tablet-pull-15of16 {
+ left: -93.75%; }
+ .col-tablet-push-1of1, .col-tablet-push-2of2, .col-tablet-push-3of3, .col-tablet-push-4of4, .col-tablet-push-5of5, .col-tablet-push-6of6, .col-tablet-push-8of8, .col-tablet-push-10of10, .col-tablet-push-12of12, .col-tablet-push-16of16 {
+ left: 100%; }
+ .col-tablet-push-1of2, .col-tablet-push-2of4, .col-tablet-push-3of6, .col-tablet-push-4of8, .col-tablet-push-5of10, .col-tablet-push-6of12, .col-tablet-push-8of16 {
+ left: 50%; }
+ .col-tablet-push-1of3, .col-tablet-push-2of6, .col-tablet-push-4of12 {
+ left: 33.33333333%; }
+ .col-tablet-push-2of3, .col-tablet-push-4of6, .col-tablet-push-8of12 {
+ left: 66.66666667%; }
+ .col-tablet-push-1of4, .col-tablet-push-2of8, .col-tablet-push-3of12, .col-tablet-push-4of16 {
+ left: 25%; }
+ .col-tablet-push-3of4, .col-tablet-push-6of8, .col-tablet-push-9of12, .col-tablet-push-12of16 {
+ left: 75%; }
+ .col-tablet-push-1of5, .col-tablet-push-2of10 {
+ left: 20%; }
+ .col-tablet-push-2of5, .col-tablet-push-4of10 {
+ left: 40%; }
+ .col-tablet-push-3of5, .col-tablet-push-6of10 {
+ left: 60%; }
+ .col-tablet-push-4of5, .col-tablet-push-8of10 {
+ left: 80%; }
+ .col-tablet-push-1of6, .col-tablet-push-2of12 {
+ left: 16.66666667%; }
+ .col-tablet-push-5of6, .col-tablet-push-10of12 {
+ left: 83.33333333%; }
+ .col-tablet-push-1of8, .col-tablet-push-2of16 {
+ left: 12.5%; }
+ .col-tablet-push-3of8, .col-tablet-push-6of16 {
+ left: 37.5%; }
+ .col-tablet-push-5of8, .col-tablet-push-10of16 {
+ left: 62.5%; }
+ .col-tablet-push-7of8, .col-tablet-push-14of16 {
+ left: 87.5%; }
+ .col-tablet-push-1of10 {
+ left: 10%; }
+ .col-tablet-push-3of10 {
+ left: 30%; }
+ .col-tablet-push-7of10 {
+ left: 70%; }
+ .col-tablet-push-9of10 {
+ left: 90%; }
+ .col-tablet-push-1of12 {
+ left: 8.33333333%; }
+ .col-tablet-push-5of12 {
+ left: 41.66666667%; }
+ .col-tablet-push-7of12 {
+ left: 58.33333333%; }
+ .col-tablet-push-11of12 {
+ left: 91.66666667%; }
+ .col-tablet-push-1of16 {
+ left: 6.25%; }
+ .col-tablet-push-3of16 {
+ left: 18.75%; }
+ .col-tablet-push-5of16 {
+ left: 31.25%; }
+ .col-tablet-push-7of16 {
+ left: 43.75%; }
+ .col-tablet-push-9of16 {
+ left: 56.25%; }
+ .col-tablet-push-11of16 {
+ left: 68.75%; }
+ .col-tablet-push-13of16 {
+ left: 81.25%; }
+ .col-tablet-push-15of16 {
+ left: 93.75%; } }
+
+.col-3-wide {
+ width: 33.33333333%; }
+
+@media (max-width: 719px) {
+ /* Remove .col-12 and .col-13 backward compatibility support as soon as it's been removed. */
+[class*=col-], .col-12 [class*=col-], .col-13 [class*=col-] {
+ float: none;
+ left: 0;
+ width: auto;
+} }
+
+/* Header component */
+.dac-header {
+ background: #fff;
+ height: 64px;
+ margin: 0 -20px;
+}
+
+@media (max-width: 719px) {
+ .dac-header {
+ margin: 0 -10px;
+ }
+}
+
+.about .dac-header, .distribute .dac-header, .develop .dac-header {
+ height: 128px;
+}
+
+.dac-header-inner {
+ background: #fff;
+ box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.07);
+ box-sizing: border-box;
+ height: 64px;
+ left: 0;
+ right: 0;
+ top: 0;
+ z-index: 52;
+}
+
+.dac-header.dac-sub .dac-header-inner {
+ border-bottom: 1px solid #e5e5e5;
+ box-shadow: none;
+}
+
+.dac-header.is-sticky .dac-header-inner {
+ position: fixed;
+ -webkit-animation: .3s dac-header-show;
+ animation: .3s dac-header-show;
+}
+
+.dac-header-logo {
+ border-right: 1px solid #e5e5e5;
+ display: block;
+ font-size: 20px;
+ font-weight: 300;
+ float: left;
+ letter-spacing: .3px;
+ line-height: 36px;
+ margin-right: 16px;
+ padding: 14px 24px 14px;
+}
+
+.dac-header-logo, .dac-header-logo:hover, .dac-header-logo:focus {
+ color: #444;
+}
+
+.dac-header-logo-image {
+ margin-right: 5px;
+ vertical-align: top;
+}
+
+.dac-header-console-btn {
+ border: 1px solid #c5c5c5;
+ border-radius: 3px;
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.11);
+ background: #fff;
+ float: right;
+ font-size: 14px;
+ line-height: 28px;
+ margin: 17px 30px 17px 10px;
+ padding: 0 10px;
+ position: relative;
+ z-index: 52;
+}
+
+.dac-header-console-btn > .dac-sprite {
+ margin-right: 5px;
+}
+
+.dac-header-console-btn, .dac-header-console-btn:hover, .dac-header-console-btn:focus {
+ color: #666;
+}
+
+.dac-header-console-btn:focus {
+ background: rgba(63, 81, 181, 0.1);
+ outline: 0;
+}
+
+@media (max-width: 719px) {
+ .dac-header {
+ height: 64px !important;
+ text-align: center;
+ }
+
+ .dac-header-inner {
+ position: fixed;
+ }
+
+ .dac-header-logo {
+ border-right: 0;
+ display: inline-block;
+ margin-right: 0;
+ float: none;
+ }
+
+ .dac-header.dac-sub {
+ display: none;
+ }
+
+ .dac-header-console-btn {
+ display: none;
+ }
+}
+
+@-webkit-keyframes dac-header-show {
+ 0% {
+ -webkit-transform: translateY(-64px);
+ transform: translateY(-64px);
+ }
+
+ 100% {
+ -webkit-transform: translateY(0);
+ transform: translateY(0);
+ }
+}
+
+@keyframes dac-header-show {
+ 0% {
+ -webkit-transform: translateY(-64px);
+ transform: translateY(-64px);
+ }
+
+ 100% {
+ -webkit-transform: translateY(0);
+ transform: translateY(0);
+ }
+}
+
+/* Header Breadcrumbs component */
+.dac-header-crumbs {
+ display: none;
+ list-style-type: none;
+ margin: 0;
+}
+
+.is-sticky .dac-header-crumbs {
+ display: block;
+}
+
+.dac-header-crumbs-item {
+ float: left;
+ position: relative;
+ margin: 0;
+ padding-left: 10px;
+}
+
+.dac-header-crumbs-item:before {
+ color: #444;
+ content: '>';
+ font-weight: 300;
+ font-size: 20px;
+ left: 0;
+ line-height: 28px;
+ padding: 16px 0;
+ position: absolute;
+}
+
+.dac-header-crumbs-item:first-child:before {
+ content: none;
+}
+
+.dac-header-crumbs-link {
+ color: #444;
+ display: block;
+ font-size: 16px;
+ font-weight: 300;
+ line-height: 32px;
+ padding: 16px 16px;
+ -webkit-transition: background-color 0.35s cubic-bezier(0.35, 0, 0.25, 1);
+ transition: background-color 0.35s cubic-bezier(0.35, 0, 0.25, 1);
+}
+
+.dac-header-crumbs-link:hover, .dac-header-crumbs-link:focus {
+ color: rgba(68, 68, 68, 0.7);
+}
+
+.dac-header-crumbs-link:focus {
+ background: rgba(63, 81, 181, 0.1);
+ outline: 0;
+}
+
+.dac-header-crumbs-link.current {
+ color: #6ab344;
+ font-weight: 400;
+}
+
+.dac-header-crumbs-link.current.ndk {
+ color: #00BCD4;
+}
+
+@media (max-width: 719px) {
+ .dac-header-crumbs {
+ display: none;
+ }
+}
+
+/* Header site search component */
+.dac-header-search {
+ background: #fff;
+ border-left: 1px solid #e5e5e5;
+ display: block;
+ float: right;
+ height: 28px;
+ padding: 18px 0;
+ position: relative;
+ overflow: hidden;
+ -webkit-transition: width 0.4s ease, left 0.4s ease;
+ transition: width 0.4s ease, left 0.4s ease;
+ width: 64px;
+ z-index: 52;
+}
+
+.dac-header-search:hover, .dac-header-search.active {
+ width: 228px;
+}
+
+.dac-header-search-inner {
+ width: 228px;
+}
+
+.dac-header-search-btn {
+ left: 20px;
+ position: absolute;
+ top: 20px;
+ opacity: .54;
+}
+
+.dac-header-search-form {
+ left: 54px;
+ opacity: 0;
+ position: absolute;
+ right: 24px;
+ top: 20px;
+ -webkit-transition: opacity .4s;
+ transition: opacity .4s;
+}
+
+.dac-header-search:hover .dac-header-search-form, .dac-header-search.active .dac-header-search-form {
+ opacity: 1;
+}
+
+.dac-header-search-input {
+ background-color: transparent;
+ border: none;
+ border-bottom: 1px solid #CCC;
+ border-radius: 0;
+ box-sizing: border-box;
+ color: #2f2f2f;
+ font-size: 14px;
+ height: 24px;
+ outline: none;
+ padding: 4px 20px 4px 0;
+ width: 100%;
+ z-index: 1500;
+}
+
+.dac-header-search-input:focus {
+ color: #222;
+ font-weight: bold;
+ outline: 0;
+}
+
+.dac-header-search-close {
+ position: absolute;
+ right: 4px;
+ bottom: 4px;
+ width: 16px;
+ height: 16px;
+ margin: 0;
+ text-indent: -1000em;
+ background: url(../images/close.png) no-repeat 0 0;
+ z-index: 9999;
+}
+
+.dac-header-search-close:hover, .dac-header-search-close:focus {
+ background-position: -16px 0;
+ cursor: pointer;
+}
+
+@media (max-width: 719px) {
+ .dac-header-search {
+ position: absolute;
+ left: calc(100% - 64px);
+ right: 0;
+ top: 0;
+ width: auto;
+ }
+
+ .dac-header-search:hover, .dac-header-search.active {
+ left: 64px;
+ width: auto;
+ }
+}
+
+/* Main navigation component */
+.is-sticky .dac-nav, .dac-nav-head, .dac-nav-toggle {
+ display: none;
+}
+
+.dac-nav-list {
+ list-style-type: none;
+ left: 192px;
+ margin: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+ z-index: 51;
+}
+
+.dac-nav-item {
+ float: left;
+ margin: 0;
+}
+
+.dac-nav-head {
+ margin-bottom: 10px;
+}
+
+.dac-nav-dimmer {
+ background: #000;
+ display: none;
+ height: 100%;
+ left: 0;
+ opacity: 0;
+ position: fixed;
+ top: 0;
+ -webkit-transition: visibility 0s linear .3s, opacity .3s linear;
+ transition: visibility 0s linear .3s, opacity .3s linear;
+ -webkit-transform: translateZ(0);
+ transform: translateZ(0);
+ visibility: hidden;
+ width: 100%;
+ z-index: 52;
+}
+
+.dac-nav-hamburger {
+ display: inline-block;
+ height: 15px;
+ width: 16px;
+}
+
+.dac-nav-hamburger-top, .dac-nav-hamburger-mid, .dac-nav-hamburger-bot {
+ background: #999;
+ display: block;
+ height: 3px;
+ margin: 3px 0 0;
+ width: 100%;
+}
+
+.dac-nav-link {
+ color: #444;
+ display: block;
+ font-size: 16px;
+ font-weight: 300;
+ letter-spacing: .24px;
+ line-height: 32px;
+ padding: 18px 16px 14px;
+ -webkit-transition: background-color 0.35s cubic-bezier(0.35, 0, 0.25, 1);
+ transition: background-color 0.35s cubic-bezier(0.35, 0, 0.25, 1);
+}
+
+.dac-nav-link:hover, .dac-nav-link:focus {
+ color: rgba(68, 68, 68, 0.7);
+}
+
+.dac-nav-link:focus {
+ background: rgba(63, 81, 181, 0.1);
+ outline: 0;
+}
+
+.dac-nav-link.has-subnav, .dac-nav-link.selected {
+ border-bottom: 3px solid #6ab344;
+ font-weight: 500;
+ padding-bottom: 11px;
+}
+
+.dac-nav-link.has-subnav.ndk, .dac-nav-link.selected.ndk {
+ border-bottom: 3px solid #00BCD4;
+}
+
+.dac-nav-secondary {
+ border-bottom: 1px solid #e5e5e5;
+ display: none;
+ left: -192px;
+ list-style-type: none;
+ margin: 0;
+ position: absolute;
+ top: 64px;
+ right: 0;
+}
+
+.dac-nav-link.has-subnav + .dac-nav-secondary, .dac-nav-link.selected + .dac-nav-secondary {
+ display: block;
+}
+
+.dac-nav-secondary .dac-nav-link {
+ color: #666;
+ padding: 17px 16px 15px;
+}
+
+.dac-nav-secondary .dac-nav-link:hover, .dac-nav-secondary .dac-nav-link:focus {
+ color: rgba(102, 102, 102, 0.7);
+}
+
+@media (min-width: 720px) and (max-width: 979px) {
+ .dac-nav-secondary .dac-nav-link {
+ padding-left: 8px;
+ padding-right: 8px;
+ }
+}
+
+.dac-nav-secondary .dac-nav-link.selected {
+ border: none;
+ font-weight: 700;
+}
+
+.dac-nav-secondary .dac-nav-link.selected.ndk {
+ border: none;
+ font-weight: 700;
+}
+
+@media (max-width: 719px) {
+ .dac-nav-open {
+ overflow: hidden;
+ }
+
+ .dac-nav-toggle {
+ border-right: 1px solid #e5e5e5;
+ display: inline-block;
+ position: absolute;
+ left: 0;
+ line-height: 64px;
+ text-align: center;
+ width: 64px;
+ }
+
+ .dac-nav-head, .dac-nav-secondary, .dac-nav-dimmer {
+ display: block;
+ }
+
+ .dac-nav-dimmer.dac-nav-open {
+ opacity: .8;
+ -webkit-transition-delay: 0s;
+ transition-delay: 0s;
+ visibility: visible;
+ }
+
+ .dac-nav-list {
+ background: #fff;
+ bottom: 0;
+ left: auto;
+ max-width: 280px;
+ -webkit-overflow-scrolling: touch;
+ overflow-y: scroll;
+ padding: 0 0 20px 0;
+ position: fixed;
+ right: 100%;
+ top: 0;
+ -webkit-transition: -webkit-transform .3s ease;
+ transition: transform .3s ease;
+ width: 85%;
+ z-index: 52;
+ }
+
+ .dac-nav-list.dac-nav-open {
+ -webkit-transform: translate3d(100%, 0, 0);
+ transform: translate3d(100%, 0, 0);
+ }
+
+ .dac-nav-secondary {
+ border: none;
+ position: static;
+ width: 100%;
+ }
+
+ .dac-nav-item {
+ float: none;
+ }
+
+ .dac-nav-link {
+ display: block;
+ font-size: 12px;
+ font-weight: 600;
+ color: #333;
+ padding: 0 20px;
+ }
+
+ .dac-nav-link.selected {
+ color: #09f;
+ }
+
+ .dac-nav-secondary .dac-nav-link {
+ font-weight: 400;
+ margin-left: 20px;
+ margin-right: 20px;
+ padding: 0 20px;
+ }
+
+ .dac-nav-link.has-subnav, .dac-nav-link.selected {
+ border: none;
+ padding: 0 20px;
+ }
+
+ .dac-nav-link.has-subnav.ndk, .dac-nav-link.selected.ndk {
+ border: none;
+ padding: 0 20px;
+ }
+
+ .dac-logo-image {
+ margin-right: 5px;
+ vertical-align: top;
+ }
+
+ .dac-nav-logo {
+ box-shadow: 0 2px 2px rgba(0, 0, 0, 0.04);
+ font-size: 20px;
+ font-weight: 300;
+ letter-spacing: .3px;
+ line-height: 36px;
+ padding: 14px 24px;
+ }
+
+ .dac-nav-logo, .dac-nav-logo:hover, .dac-nav-logo:focus {
+ color: #444;
+ }
+}
+
+/* Hero carousel */
+.dac-hero {
+ background-color: #fff;
+ background-position: 50% 30%;
+ background-size: cover;
+ box-sizing: border-box;
+ font-size: 16px;
+ min-height: 550px;
+ padding-top: 88px;
+}
+
+.dac-hero.dac-darken::before {
+ background: rgba(0, 0, 0, 0.3);
+ bottom: 0;
+ content: '';
+ display: block;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+}
+
+@media (max-width: 719px) {
+ .dac-hero.dac-darken::before {
+ background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9) 80%);
+ background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9) 80%);
+ }
+}
+
+.dac-hero.dac-darken .dac-hero-content {
+ position: relative;
+}
+
+@media (max-width: 719px) {
+ .dac-hero {
+ padding-bottom: 20px;
+ padding-top: 20px;
+ }
+}
+
+.dac-hero-tag {
+ font-size: 11px;
+ font-weight: 700;
+ letter-spacing: .07em;
+ margin-bottom: 2px;
+ text-transform: uppercase;
+}
+
+.dac-hero-title {
+ margin: 0 0 14px;
+}
+
+@media (max-width: 719px) {
+ .dac-hero-title {
+ font-size: 28px;
+ line-height: 35px;
+ }
+}
+
+.dac-hero-description {
+ margin-bottom: 16px;
+}
+
+@media (max-width: 719px) {
+ .dac-hero-description {
+ font-size: 14px;
+ }
+}
+
+.dac-hero-cta {
+ display: inline-block;
+ line-height: 40px;
+ margin-right: 20px;
+ -webkit-transition: opacity .3s;
+ transition: opacity .3s;
+}
+
+.dac-hero-cta:hover {
+ color: currentColor;
+ opacity: .54;
+}
+
+.dac-hero-cta .dac-sprite {
+ margin-left: -8px;
+}
+
+@media (max-width: 719px) {
+ .dac-hero-cta {
+ line-height: 28px;
+ }
+}
+
+.dac-hero-figure {
+ text-align: center;
+}
+
+@media (max-width: 719px) {
+ .dac-hero-figure {
+ height: 150px;
+ margin: 15px 0;
+ }
+
+ .dac-hero-figure img {
+ max-height: 150px;
+ }
+}
+
+.dac-hero-carousel {
+ height: 550px;
+ position: relative;
+}
+
+.dac-hero-carousel > .dac-hero {
+ bottom: 0;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+ will-change: opacity;
+}
+
+.dac-hero-carousel > .dac-hero, .dac-hero-carousel > .dac-hero .wrap {
+ opacity: 0;
+}
+
+.dac-hero-carousel > .dac-hero.active {
+ opacity: 1;
+ -webkit-transition: opacity .5s;
+ transition: opacity .5s;
+ z-index: 1;
+}
+
+.dac-hero-carousel > .dac-hero.active .wrap {
+ opacity: 1;
+ -webkit-transition: opacity .5s .5s;
+ transition: opacity .5s .5s;
+}
+
+.dac-hero-carousel > .dac-hero.out, .dac-hero-carousel > .dac-hero.out .wrap {
+ -webkit-transition: opacity 0s .5s;
+ transition: opacity 0s .5s;
+ opacity: 0;
+}
+
+.dac-hero-carousel-action {
+ bottom: 0;
+ display: block;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+ z-index: 1;
+}
+
+.dac-hero-carousel .dac-hero-cta {
+ position: relative;
+ z-index: 1;
+}
+
+.dac-hero-carousel-pagination {
+ bottom: 33px;
+ left: 0;
+ position: absolute;
+ right: 0;
+}
+
+@media (max-width: 719px) {
+ .dac-hero-carousel-pagination {
+ text-align: center;
+ bottom: 20px;
+ }
+}
+
+.dac-hero-carousel-pagination .dac-pagination-item {
+ position: relative;
+ z-index: 1;
+}
+
+.dac-pagination {
+ list-style: none;
+ margin: 0 -6px;
+}
+
+.dac-pagination-item {
+ background-clip: content-box;
+ background-color: rgba(153, 153, 153, 0.4);
+ border-radius: 50%;
+ cursor: pointer;
+ display: inline-block;
+ height: 14px;
+ overflow: hidden;
+ padding: 6px;
+ pointer-events: all;
+ text-indent: 100%;
+ -webkit-transition: background-color .1s ease-in;
+ transition: background-color .1s ease-in;
+ white-space: nowrap;
+ width: 14px;
+ will-change: background-color;
+}
+
+.dac-pagination-item:hover {
+ background-color: rgba(153, 153, 153, 0.6);
+}
+
+.dac-pagination-item.active, .dac-pagination-item.active:hover {
+ background-color: #6ab344;
+}
+
+.dac-invert .dac-pagination-item {
+ background-color: rgba(204, 204, 204, 0.2);
+}
+
+.dac-invert .dac-pagination-item:hover {
+ background-color: rgba(153, 153, 153, 0.4);
+}
+
+@media (max-width: 719px) {
+ .dac-pagination-item {
+ height: 12px;
+ width: 12px;
+ }
+}
+
+/* Form component */
+.dac-form {
+ color: #505050;
+ font-size: 16px;
+ /* Modal Responsive */
+}
+
+.dac-form a {
+ color: #000;
+}
+
+.dac-form-aside {
+ display: inline-block;
+ font-size: 12px;
+ margin-top: 0;
+}
+
+.dac-form-required {
+ color: #ef4300;
+}
+
+.dac-form-fieldset {
+ padding: 0;
+}
+
+.dac-form-legend {
+ display: block;
+ color: #333;
+ font-weight: 500;
+ margin: 20px 0 12px;
+ padding: 0;
+ width: 100%;
+}
+
+.dac-form-legend > .dac-form-required {
+ float: right;
+ margin-top: 3px;
+}
+
+.dac-form-input {
+ border: 0 solid #e3e3e3;
+ border-bottom-width: 1px;
+ display: block;
+ outline: 0;
+ padding: 1px 0 8px;
+ -webkit-transition: border-color .2s;
+ transition: border-color .2s;
+ width: 100%;
+}
+
+.dac-form-input-group {
+ position: relative;
+}
+
+.dac-form-input-group > .dac-form-required {
+ display: block;
+ bottom: 3px;
+ position: absolute;
+ right: 0;
+}
+
+.dac-form-input:focus {
+ border-bottom-color: #09f;
+}
+
+.dac-form-floatlabel {
+ display: block;
+ cursor: text;
+ margin-top: 5px;
+ pointer-events: none;
+ -webkit-transform-origin: 0 100%;
+ -ms-transform-origin: 0 100%;
+ transform-origin: 0 100%;
+ -webkit-transform: translate3d(0, 22px, 0) scale(1);
+ transform: translate3d(0, 22px, 0) scale(1);
+ -webkit-transition: -webkit-transform .2s;
+ transition: transform .2s;
+}
+
+.dac-focused > .dac-form-floatlabel, .dac-has-value > .dac-form-floatlabel {
+ cursor: default;
+ -webkit-transform: translate3d(0, 0, 0) scale(.75);
+ transform: translate3d(0, 0, 0) scale(.75);
+}
+
+.dac-form-radio, .dac-form-checkbox {
+ opacity: 0;
+ position: absolute;
+}
+
+.dac-form-radio-group, .dac-form-checkbox-group {
+ display: table;
+ margin-top: 10px;
+}
+
+.dac-form-radio-button, .dac-form-checkbox-button {
+ box-sizing: border-box;
+ cursor: pointer;
+ display: table-cell;
+ float: left;
+ height: 18px;
+ margin: 2px 10px 0 0;
+ position: relative;
+ width: 18px;
+}
+
+.dac-form-radio-button::after, .dac-form-radio-button::before, .dac-form-checkbox-button::after, .dac-form-checkbox-button::before {
+ box-sizing: border-box;
+ content: '';
+ border-radius: 50%;
+ display: block;
+ height: 100%;
+ position: absolute;
+ width: 100%;
+}
+
+.dac-form-radio-button::before, .dac-form-checkbox-button::before {
+ background: rgba(0, 0, 0, 0.7);
+ -webkit-transform: translateZ(0) scale(0);
+ transform: translateZ(0) scale(0);
+ -webkit-transition: -webkit-transform .3s;
+ transition: transform .3s;
+}
+
+.dac-form-radio-button::after, .dac-form-checkbox-button::after {
+ border: 2px solid rgba(0, 0, 0, 0.7);
+}
+
+.dac-form-radio:checked + .dac-form-radio-button::before, .dac-form-checkbox:checked + .dac-form-checkbox-button::before {
+ -webkit-transform: translateZ(0) scale(.5);
+ transform: translateZ(0) scale(.5);
+}
+
+.dac-form-radio:focus + .dac-form-radio-button::after, .dac-form-checkbox:focus + .dac-form-checkbox-button::after {
+ border: 2px solid #09f;
+}
+
+.dac-form-checkbox-button::after, .dac-form-checkbox-button::before {
+ border-radius: 0;
+}
+
+@media (max-width: 719px) {
+ .dac-form-legend {
+ margin-bottom: 0;
+ }
+}
+
+/* Media component */
+.dac-media {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-flow: row wrap;
+ -ms-flex-flow: row wrap;
+ flex-flow: row wrap;
+}
+
+.dac-media-figure {
+ margin: 0;
+}
+
+.dac-media-body {
+ -webkit-box-flex: 1;
+ -webkit-flex: 1;
+ -ms-flex: 1;
+ flex: 1;
+}
+
+.no-flexbox .dac-media {
+ display: table;
+ width: 100%;
+}
+
+.no-flexbox .dac-media-body, .no-flexbox .dac-media-figure {
+ display: table-cell;
+}
+
+.no-flexbox .dac-media-figure {
+ padding: 0;
+}
+
+.no-flexbox .dac-media-body {
+ width: 100%;
+}
+
+.dac-swap {
+ overflow: hidden;
+ position: relative;
+}
+
+.dac-swap-section {
+ left: 0;
+ opacity: 0;
+ position: absolute;
+ top: 0;
+ width: 100%;
+ -webkit-transition: opacity 1s, -webkit-transform .5s;
+ transition: opacity 1s, transform .5s;
+}
+
+.dac-swap-section.dac-up {
+ -webkit-transform: translateY(-100%);
+ -ms-transform: translateY(-100%);
+ transform: translateY(-100%);
+}
+
+.dac-swap-section.dac-down {
+ -webkit-transform: translateY(100%);
+ -ms-transform: translateY(100%);
+ transform: translateY(100%);
+}
+
+.dac-swap-section.dac-left {
+ -webkit-transform: translateX(-100%);
+ -ms-transform: translateX(-100%);
+ transform: translateX(-100%);
+}
+
+.dac-swap-section.dac-right {
+ -webkit-transform: translateX(100%);
+ -ms-transform: translateX(100%);
+ transform: translateX(100%);
+}
+
+.dac-swap-section.dac-active {
+ opacity: 1;
+ position: relative;
+ -webkit-transform: translate(0, 0);
+ -ms-transform: translate(0, 0);
+ transform: translate(0, 0);
+ width: auto;
+}
+
+/* Modal component */
+.dac-modal {
+ background: rgba(0, 0, 0, 0.8);
+ bottom: 0;
+ left: 0;
+ opacity: 0;
+ overflow-x: hidden;
+ overflow-y: auto;
+ position: fixed;
+ right: 0;
+ top: 0;
+ -webkit-transition: visibility 0s linear .3s, opacity .3s linear;
+ transition: visibility 0s linear .3s, opacity .3s linear;
+ visibility: hidden;
+ z-index: 52;
+}
+
+.dac-modal.dac-active {
+ opacity: 1;
+ -webkit-transition-delay: 0s;
+ transition-delay: 0s;
+ visibility: visible;
+}
+
+.dac-modal-open {
+ overflow: hidden;
+}
+
+.dac-modal-container {
+ -webkit-box-align: center;
+ -webkit-align-items: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
+ filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ min-height: 100%;
+ width: 100%;
+}
+
+.dac-modal-window {
+ background: #fff;
+ border-radius: 5px;
+ box-sizing: border-box;
+ margin: 20px auto;
+ -webkit-transition: -webkit-transform .3s;
+ transition: transform .3s;
+ -webkit-transform: translate(0, -30px);
+ -ms-transform: translate(0, -30px);
+ transform: translate(0, -30px);
+ width: 960px;
+}
+
+.dac-modal.dac-active .dac-modal-window {
+ -webkit-transform: translate(0, 0);
+ -ms-transform: translate(0, 0);
+ transform: translate(0, 0);
+}
+
+.dac-modal-header {
+ background: #00695c;
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+ padding: 35px 35px 30px;
+ position: relative;
+}
+
+.dac-modal-header-close {
+ background: none;
+ border: none;
+ cursor: pointer;
+ line-height: 0;
+ outline: 0;
+ opacity: .7;
+ padding: 8px;
+ position: absolute;
+ right: 5px;
+ -webkit-transition: background-color .3s;
+ transition: background-color .3s;
+ top: 5px;
+}
+
+.dac-modal-header-close:active {
+ background: rgba(255, 255, 255, 0.2);
+}
+
+.dac-modal-header-title {
+ color: #fff;
+ font-size: 24px;
+ font-weight: 300;
+ line-height: 32px;
+ margin: 0;
+ padding-right: 150px;
+}
+
+.dac-modal-header-subtitle {
+ bottom: 0;
+ color: #fff;
+ display: inline-block;
+ font: inherit;
+ font-size: 14px;
+ margin: 0;
+ opacity: .8;
+ position: absolute;
+ right: 0;
+}
+
+.dac-modal-content {
+ padding: 12px 35px;
+}
+
+.dac-modal-action {
+ margin: 0;
+}
+
+.dac-modal-footer {
+ padding: 24px 35px;
+}
+
+@media (max-width: 1000px) {
+ .dac-modal-window {
+ margin: 20px;
+ width: auto;
+ }
+
+ .dac-modal-container {
+ z-index: auto;
+ }
+}
+
+@media (max-width: 719px) {
+ .dac-modal-window {
+ margin: 10px;
+ }
+
+ .dac-modal-header {
+ padding: 35px 10px 10px;
+ }
+
+ .dac-modal-header-title {
+ font-size: 16px;
+ line-height: 24px;
+ padding: 0;
+ }
+
+ .dac-modal-header-subtitle {
+ display: block;
+ margin: 0;
+ position: static;
+ text-align: right;
+ }
+
+ .dac-modal-content {
+ padding: 10px;
+ }
+
+ .dac-modal-footer {
+ border-top: 1px solid #e3e3e3;
+ padding: 35px 10px;
+ }
+}
+
+.newsletter .dac-modal-footer {
+ padding-top: 0;
+ text-align: right;
+}
+
+.newsletter-checkboxes {
+ padding-top: 20px;
+}
+
+.newsletter-success-message {
+ font-size: 32px;
+ line-height: 1.4;
+ padding: 40px 30px;
+ text-align: center;
+}
+
+@media (max-width: 719px) {
+ .newsletter-success-message {
+ font-size: 16px;
+ padding: 12px 0 0;
+ }
+}
+
+@media (min-width: 720px) {
+ .newsletter-checkboxes {
+ padding-top: 46px;
+ }
+
+ .newsletter-leftCol {
+ padding-right: 40px;
+ }
+
+ .newsletter-rightCol {
+ padding-left: 40px;
+ }
+}
+
+@media (max-width: 719px) {
+ .newsletter .dac-modal-footer {
+ margin-top: 30px;
+ padding: 30px 10px;
+ text-align: center;
+ }
+}
+
+.dac-expand, .dac-section {
+ margin-left: -20px;
+ margin-right: -20px;
+ padding-left: 20px;
+ padding-right: 20px;
+}
+
+@media (max-width: 719px) {
+ .dac-expand, .dac-section {
+ margin-left: -10px;
+ margin-right: -10px;
+ padding-left: 10px;
+ padding-right: 10px;
+ }
+}
+
+.dac-invert {
+ color: #b2b2b2;
+ color: rgba(255, 255, 255, 0.7);
+}
+
+.dac-invert h1, .dac-invert h2, .dac-invert h3 {
+ color: #fff;
+}
+
+.dac-light.dac-hero, .dac-light.dac-section {
+ background-color: #eceff1;
+}
+
+.dac-gray.dac-hero, .dac-gray.dac-section {
+ background-color: #b0bec5;
+}
+
+.dac-dark.dac-hero, .dac-dark.dac-section {
+ background-color: #37474f;
+}
+
+.dac-red.dac-hero, .dac-red.dac-section {
+ background-color: #dc4d38;
+}
+
+.dac-hero-cta, .dac-section-title, .dac-section-links {
+ color: #212121;
+ color: rgba(0, 0, 0, 0.87);
+}
+
+.dac-invert .dac-hero-cta, .dac-invert .dac-section-title, .dac-invert .dac-section-links {
+ color: white;
+}
+
+.dac-hero-cta .dac-sprite, .dac-section-title .dac-sprite, .dac-section-links .dac-sprite {
+ opacity: .87;
+}
+
+.dac-invert .dac-hero-cta .dac-sprite, .dac-invert .dac-section-title .dac-sprite, .dac-invert .dac-section-links .dac-sprite {
+ opacity: 1;
+}
+
+.dac-hero-tag, .dac-hero-description, .dac-section-subtitle {
+ color: #757575;
+ color: rgba(0, 0, 0, 0.54);
+}
+
+.dac-invert .dac-hero-tag, .dac-invert .dac-hero-description, .dac-invert .dac-section-subtitle {
+ color: #b2b2b2;
+ color: rgba(255, 255, 255, 0.7);
+}
+
+.dac-section {
+ background-position: 50% 50%;
+ background-size: cover;
+ padding-bottom: 84px;
+ padding-top: 84px;
+ position: relative;
+}
+
+@media (max-width: 719px) {
+ .dac-section {
+ padding-bottom: 52px;
+ padding-top: 52px;
+ }
+}
+
+.dac-section.dac-small {
+ padding-bottom: 32px;
+ padding-top: 32px;
+}
+
+.dac-section-title {
+ text-align: center;
+ margin-bottom: 40px;
+ margin-top: 0;
+}
+
+.dac-section-subtitle {
+ font-size: 16px;
+ margin-bottom: 40px;
+ margin-top: -24px;
+ text-align: center;
+}
+
+.dac-section-links {
+ font-size: 16px;
+ list-style: none;
+ line-height: 40px;
+ margin: 16px 0 0;
+ text-align: center;
+}
+
+@media (max-width: 719px) {
+ .dac-section-links {
+ margin-left: -8px;
+ text-align: left;
+ }
+}
+
+.dac-section-link {
+ display: inline-block;
+ margin: 0 32px;
+ -webkit-transition: opacity .3s;
+ transition: opacity .3s;
+}
+
+.dac-section-link:hover {
+ opacity: .54;
+}
+
+@media (max-width: 719px) {
+ .dac-section-link {
+ display: block;
+ margin: 0;
+ }
+}
+
+.dac-section-link a {
+ color: inherit;
+}
+
+/*
+SCSS variables are information about icon's compiled state, stored under its original file name
+
+.icon-home {
+ width: $icon-home-width;
+}
+
+The large array-like variables contain all information about a single icon
+$icon-home: x y offset_x offset_y width height total_width total_height image_path;
+
+At the bottom of this section, we provide information about the spritesheet itself
+$spritesheet: width height image $spritesheet-sprites;
+*/
+.dac-sprite, #tb li:before, #qv li:before {
+ background-image: url(/assets/images/sprite.png);
+ display: inline-block;
+ vertical-align: middle; }
+ @media screen and (min-device-pixel-ratio: 1.5) {
+ .dac-sprite, #tb li:before, #qv li:before {
+ background-image: url(/assets/images/sprite-2x.png);
+ background-size: 50% 50%; } }
+
+.dac-sprite.dac-auto-chevron {
+ background-position: 0px -196px;
+ height: 24px;
+ width: 24px;
+ vertical-align: -6px; }
+ .dac-invert .dac-sprite.dac-auto-chevron {
+ background-position: 0px -222px;
+ height: 24px;
+ width: 24px; }
+.dac-sprite.dac-auto-chevron-large {
+ background-position: 0px -404px;
+ height: 36px;
+ width: 36px;
+ vertical-align: -10px; }
+ .dac-invert .dac-sprite.dac-auto-chevron-large {
+ background-position: 0px -442px;
+ height: 36px;
+ width: 36px; }
+.dac-sprite.dac-auto-unfold-less {
+ background-position: 0px -352px;
+ height: 24px;
+ width: 24px;
+ vertical-align: -6px; }
+ .dac-invert .dac-sprite.dac-auto-unfold-less {
+ background-position: 0px -326px;
+ height: 24px;
+ width: 24px; }
+.dac-sprite.dac-auto-unfold-more {
+ background-position: 0px -300px;
+ height: 24px;
+ width: 24px;
+ vertical-align: -6px; }
+ .dac-invert .dac-sprite.dac-auto-unfold-more {
+ background-position: 0px -378px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-arrow-down-gray {
+ background-position: 0px 0px;
+ height: 11px;
+ width: 19px; }
+
+.dac-sprite.dac-arrow-right {
+ background-position: 0px -128px;
+ height: 18px;
+ width: 11px; }
+
+.dac-sprite.dac-chevron-large-right-black {
+ background-position: 0px -404px;
+ height: 36px;
+ width: 36px; }
+
+.dac-sprite.dac-chevron-large-right-white {
+ background-position: 0px -442px;
+ height: 36px;
+ width: 36px; }
+
+.dac-sprite.dac-chevron-right-black {
+ background-position: 0px -196px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-chevron-right-white {
+ background-position: 0px -222px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-close {
+ background-position: 0px -27px;
+ height: 12px;
+ width: 12px; }
+
+.dac-sprite.dac-expand-less-black {
+ background-position: 0px -248px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-expand-more-black {
+ background-position: 0px -170px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-google-play {
+ background-position: 0px -108px;
+ height: 18px;
+ width: 16px; }
+
+.dac-sprite.dac-gplus {
+ background-position: 0px -89px;
+ height: 17px;
+ width: 16px; }
+
+.dac-sprite.dac-mail {
+ background-position: 0px -13px;
+ height: 12px;
+ width: 16px; }
+
+.dac-sprite.dac-play-white {
+ background-position: 0px -148px;
+ height: 20px;
+ width: 16px; }
+
+.dac-sprite.dac-rss {
+ background-position: 0px -41px;
+ height: 14px;
+ width: 14px; }
+
+.dac-sprite.dac-search {
+ background-position: 0px -274px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-twitter {
+ background-position: 0px -73px;
+ height: 14px;
+ width: 16px; }
+
+.dac-sprite.dac-unfold-less-white {
+ background-position: 0px -326px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-unfold-less {
+ background-position: 0px -352px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-unfold-more-white {
+ background-position: 0px -378px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-unfold-more {
+ background-position: 0px -300px;
+ height: 24px;
+ width: 24px; }
+
+.dac-sprite.dac-youtube {
+ background-position: 0px -57px;
+ height: 14px;
+ width: 18px; }
+
+.dac-toggle-expand {
+ cursor: pointer;
+ display: inline-block; }
+.dac-toggle-collapse {
+ cursor: pointer;
+ display: none; }
+.dac-toggle.is-expanded .dac-toggle-expand {
+ display: none; }
+.dac-toggle.is-expanded .dac-toggle-collapse {
+ display: inline-block; }
+.dac-toggle-content {
+ clear: left;
+ overflow: hidden;
+ max-height: 0;
+ -webkit-transition: .3s max-height;
+ transition: .3s max-height; }
+.dac-toggle.is-expanded .dac-toggle-content {
+ max-height: none; }
+.dac-toggle.dac-mobile .dac-toggle-content {
+ max-height: none; }
+@media (max-width: 719px) {
+ .dac-toggle.dac-mobile .dac-toggle-content {
+ max-height: 0; }
+ .dac-toggle.is-expanded .dac-toggle-content {
+ max-height: none; } }
+
+.dac-visible-mobile-block, .dac-mobile-only, .dac-visible-mobile-inline, .dac-visible-mobile-inline-block, .dac-visible-tablet-block, .dac-visible-tablet-inline, .dac-visible-tablet-inline-block, .dac-visible-desktop-block, .dac-visible-desktop-inline, .dac-visible-desktop-inline-block {
+ display: none !important; }
+
+@media (max-width: 719px) {
+ .dac-hidden-mobile {
+ display: none !important; }
+ .dac-visible-mobile-block, .dac-mobile-only {
+ display: block !important; }
+ .dac-visible-mobile-inline {
+ display: inline !important; }
+ .dac-visible-mobile-inline-block {
+ display: inline-block !important; } }
+
+@media (min-width: 720px) and (max-width: 979px) {
+ .dac-hidden-tablet {
+ display: none !important; }
+ .dac-visible-tablet-block {
+ display: block !important; }
+ .dac-visible-tablet-inline {
+ display: inline !important; }
+ .dac-visible-tablet-inline-block {
+ display: inline-block !important; } }
+
+@media (min-width: 980px) {
+ .dac-hidden-desktop {
+ display: none !important; }
+ .dac-visible-desktop-block {
+ display: block !important; }
+ .dac-visible-desktop-inline {
+ display: inline !important; }
+ .dac-visible-desktop-inline-block {
+ display: inline-block !important; } }
+
+.dac-offset-parent {
+ position: relative !important; }
+
+/**
+ * Break strings when their length exceeds the width of their container.
+ */
+.dac-text-break {
+ word-wrap: break-word !important; }
+
+/**
+ * Horizontal text alignment
+ */
+.dac-text-center {
+ text-align: center !important; }
+
+.dac-text-left {
+ text-align: left !important; }
+
+.dac-text-right {
+ text-align: right !important; }
+
+/**
+ * Prevent whitespace wrapping
+ */
+.dac-text-no-wrap {
+ white-space: nowrap !important; }
+
+/**
+ * Prevent text from wrapping onto multiple lines, instead truncate with an ellipsis.
+ */
+.dac-text-truncate {
+ max-width: 100%;
+ overflow: hidden !important;
+ text-overflow: ellipsis !important;
+ white-space: nowrap !important;
+ word-wrap: normal !important; }
+
+/**
+ * Floats
+ */
+.dac-float-left {
+ float: left !important; }
+
+.dac-float-right {
+ float: right !important; }
+
+/**
+ * New block formatting context
+ *
+ * This affords some useful properties to the element. It won't wrap under
+ * floats. Will also contain any floated children.
+ * N.B. This will clip overflow. Use the alternative method below if this is
+ * problematic.
+ */
+.dac-nbfc {
+ overflow: hidden !important;
+}
+
+/**
+ * New block formatting context (alternative)
+ *
+ * Alternative method when overflow must not be clipped.
+ *
+ * N.B. This breaks down in some browsers when elements within this element
+ * exceed its width.
+ */
+.dac-nbfc-alt {
+ display: table-cell !important;
+ width: 10000px !important;
+}
+
+#tb li:before, #qv li:before {
+ background-position: 0px -196px;
+ height: 24px;
+ width: 24px;
+ content: '';
+ left: -8px;
+ opacity: .7;
+ position: absolute;
+ top: -4px;
+}
+
+/* CHANGE EXISTING SELECTOR FOR ANDROID M HERO ONLY
+ REMOVE THE BELOW STYLES WHEN THE ANDROID M CAROUSEL
+ GRAPHIC ON THE MAIN LANDING IS TAKEN DOWN */
+.dac-hero.mprev {
+ background-color: #fff;
+ background-position: 50% 53%;
+ background-size: cover;
+ background-image: url(../../assets/images/home/android_m_hero_1200.jpg);
+ box-sizing: border-box;
+ font-size: 16px;
+ min-height: 550px;
+ padding-top: 88px;
+}
+.dac-hero.dac-darken.mprev::before {
+ background: rgba(0, 0, 0, 0.3);
+ bottom: 0;
+ content: '';
+ display: block;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+}
+
+.dac-hero.dac-darken.mprev::before {
+ background: -webkit-linear-gradient(top, rgba(0, 0, 0, .05), rgba(0, 0, 0, .05), #000 950px);
+ background: linear-gradient(to bottom, rgba(0, 0, 0, .05), rgba(0, 0, 0, 0.05), #000 950px);
+}
+
+@media (max-width: 719px) {
+
+ .dac-hero.dac-darken.mprev {
+ background-size: auto 600px;
+ background-position: 55% 0;
+ background-repeat: no-repeat;
+ }
+
+ .dac-hero-figure.mprev {
+ height: 10px;
+ margin: 15px 0;
+ }
+}
+
+@media (max-width: 719px) {
+
+ .dac-hero.dac-darken.mprev {
+ background-size: auto 600px;
+ background-position: 55% 0;
+ background-repeat: no-repeat;
+ }
+
+ .dac-hero-figure.mprev {
+ height: 10px;
+ margin: 15px 0;
+ }
+}
+
+@media (max-width: 1200px) {
+
+ .dac-hero.dac-darken.mprev {
+ background-size: auto 700px;
+ background-position: 55% 0;
+ background-repeat: no-repeat;
+ }
+
+ .dac-hero-cta.mprev {
+ white-space:nowrap;
+ }
+}
\ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk/assets/css/fullscreen.css b/tools/droiddoc/templates-sdk/assets/css/fullscreen.css
index 7912e34..0f108e0 100644
--- a/tools/droiddoc/templates-sdk/assets/css/fullscreen.css
+++ b/tools/droiddoc/templates-sdk/assets/css/fullscreen.css
@@ -14,195 +14,7 @@
*/
@media screen, projection, print {
-.full {
- padding: 2.5em 0;
- border-top: solid 1px #ddd;
- border-bottom: solid 1px #ddd;
- background: #f7f7f7;
+ .wrap {
+ max-width: none;
+ }
}
-.wrap {
- margin: 0 auto;
- width: 100%;
- min-width:600px;
- clear: both;
-}
-.cols {
- height: 1%;
- margin: 0 -1.533742331288343558282%;
- width: 103.06748466257669%}
-*+html .cols {
- margin-bottom: 20px;
-}
-.cols:after {
- clear: both;
- content: ' ';
- display: block;
- height: 0;
- visibility: hidden;
-}
-.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
-.col-13, .col-14, .col-15, .col-16 {
- float: left;
- margin: 0 1.063829787234% 20px 1.063829787234%;
-}
-* html .col-1, * html .col-2, * html .col-3, * html .col-4, * html .col-5, * html .col-6, * html
-.col-7, * html .col-8, * html .col-9, * html .col-10, * html .col-11, * html .col-12, * html
-.col-13, * html .col-14, * html .col-15, * html .col-16 {
- margin: 0;
- margin: 0 1.063829787234% 20px 1.063829787234%;
-}
-[dir='rtl'] .col-1, [dir='rtl'] .col-2, [dir='rtl'] .col-3, [dir='rtl'] .col-4, [dir='rtl'] .col-5,
-[dir='rtl'] .col-6, [dir='rtl'] .col-7, [dir='rtl'] .col-8, [dir='rtl'] .col-9, [dir='rtl'] .col-10,
-[dir='rtl'] .col-11, [dir='rtl'] .col-12 {
- float: right;
-}
-.col-1 {
- width: 4.16666666666667%;
-}
-.col-2 {
- width: 10.4166666666667%;
-}
-.col-3 {
- width: 16.6666666666667%;
-}
-.col-4 {
- width: 22.9166666666667%;
-}
-.col-5 {
- width: 29.1666666666667%;
-}
-.col-6 {
- width: 35.4166666666667%;
-}
-.col-7 {
- width: 41.6666666666667%;
-}
-.col-8 {
- width: 47.9166666666667%;
-}
-.col-9 {
- width: 55.3333333333333%;
-}
-.col-10 {
- width: 60.4166666666667%;
-}
-.col-11 {
- width: 66.6666666666667%;
-}
-.col-12 {
- width: 72.9166666666667%;
-}
-.col-13 {
- width: 79.1666666666667%;
-}
-.col-14 {
- width: 85.4166666666667%;
-}
-.col-15 {
- width: 91.6666666666667%;
-}
-.col-16 {
- width: 97.9166666666667%;
-}
-
-
-
-
-
-
-
-#header .col-1,
-#nav-x .col-1 { width: 40px }
-#header .col-2,
-#nav-x .col-2 { width: 100px }
-#header .col-3,
-#nav-x .col-3 { width: 160px }
-#header .col-4,
-#nav-x .col-4 { width: 220px }
-#header .col-5,
-#nav-x .col-5 { width: 280px }
-#header .col-6,
-#nav-x .col-6 { width: 340px }
-#header .col-7,
-#nav-x .col-7 { width: 400px }
-#header .col-8,
-#nav-x .col-8 { width: 460px }
-#header .col-9,
-#nav-x .col-9 { width: 520px }
-#header .col-10,
-#nav-x .col-10 { width: 580px }
-#header .col-11,
-#nav-x .col-11 { width: 640px }
-#header .col-12,
-#nav-x .col-12 { width: 700px }
-#header .col-13,
-#nav-x .col-13 { width: 760px }
-#header .col-14,
-#nav-x .col-14 { width: 820px }
-#header .col-15,
-#nav-x .col-15 { width: 880px }
-#header .col-16,
-#nav-x .col-16 { width: 940px }
-
-
-
-body {
- padding:0 20px;
-}
-#header,
-#searchResults,
-#nav-x {
- margin:0;
-}
-#body-content {
- margin:0;
-}
-#body-content > .col-12 {
- width:77.9804965%;
- margin:0 0 0 0.97%; /* this percentage chosen to make IE9 happy */
-}
-#side-nav {
- width: 19.9804965%;
- margin:0 1.063829787234% 0 0;
-}
-
-#header .wrap {
- max-width: 100%;
-}
-
-#header-wrapper #nav-x div.wrap,
-#searchResults.wrap {
- max-width:100%;
-}
-
-.nav-x {
- margin:-2px 0 0 0;
-}
-
-#devdoc-nav.fixed,
-#devdoc-nav.fixed a.totop {
- left:20px; /* !important ... for IE i think */
-}
-
-#sticky-header {
- padding: 0 20px;
-}
-
-#sticky-header > div {
- width: 100%;
-}
-
-.sticky-menu {
- width:100%;
- left:-20px;
-}
-
-.col-right {
- margin-right:0px;
-}
-
-@media screen and (max-width:772px) {
-.col-5, .col-6, .col-7 {
- clear: both;
- width: 97.0238096%}
-}
\ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk/assets/images/android_logo.png b/tools/droiddoc/templates-sdk/assets/images/android_logo.png
new file mode 100644
index 0000000..5f19215
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/android_logo.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/android_logo@2x.png b/tools/droiddoc/templates-sdk/assets/images/android_logo@2x.png
new file mode 100644
index 0000000..04132cc
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/android_logo@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/android_logo_ndk.png b/tools/droiddoc/templates-sdk/assets/images/android_logo_ndk.png
new file mode 100644
index 0000000..3f39f4d
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/android_logo_ndk.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/android_logo_ndk@2x.png b/tools/droiddoc/templates-sdk/assets/images/android_logo_ndk@2x.png
new file mode 100644
index 0000000..8081ac5
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/android_logo_ndk@2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/home/android_m_hero_1200.jpg b/tools/droiddoc/templates-sdk/assets/images/home/android_m_hero_1200.jpg
new file mode 100644
index 0000000..6b79295
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/home/android_m_hero_1200.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/resource-card-default-android.jpg b/tools/droiddoc/templates-sdk/assets/images/resource-card-default-android.jpg
index 8050744..398030f 100644
--- a/tools/droiddoc/templates-sdk/assets/images/resource-card-default-android.jpg
+++ b/tools/droiddoc/templates-sdk/assets/images/resource-card-default-android.jpg
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/sprite-2x.png b/tools/droiddoc/templates-sdk/assets/images/sprite-2x.png
new file mode 100644
index 0000000..185b7e8
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/sprite-2x.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/sprite.png b/tools/droiddoc/templates-sdk/assets/images/sprite.png
new file mode 100644
index 0000000..7fef43e
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/sprite.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index 7f4be4e..d88c0e6 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -56,7 +56,7 @@
// setup keyboard listener for search shortcut
$('body').keyup(function(event) {
- if (event.which == 191) {
+ if (event.which == 191 && $(event.target).is(':not(:input)')) {
$('#search_autocomplete').focus();
}
});
@@ -71,18 +71,12 @@
});
// initialize the divs with custom scrollbars
- $('.scroll-pane').jScrollPane( {verticalGutter:0} );
-
- // add HRs below all H2s (except for a few other h2 variants)
- $('h2').not('#qv h2')
- .not('#tb h2')
- .not('.sidebox h2')
- .not('#devdoc-nav h2')
- .not('h2.norule').css({marginBottom:0})
- .after('<hr/>');
+ if (window.innerWidth >= 720) {
+ $('.scroll-pane').jScrollPane({verticalGutter: 0});
+ }
// set up the search close button
- $('.search .close').click(function() {
+ $('#search-close').on('click touchend', function() {
$searchInput = $('#search_autocomplete');
$searchInput.attr('value', '');
$(this).addClass("hide");
@@ -92,38 +86,13 @@
hideResults();
});
- // Set up quicknav
- var quicknav_open = false;
- $("#btn-quicknav").click(function() {
- if (quicknav_open) {
- $(this).removeClass('active');
- quicknav_open = false;
- collapse();
- } else {
- $(this).addClass('active');
- quicknav_open = true;
- expand();
- }
- })
-
- var expand = function() {
- $('#header-wrap').addClass('quicknav');
- $('#quicknav').stop().show().animate({opacity:'1'});
- }
-
- var collapse = function() {
- $('#quicknav').stop().animate({opacity:'0'}, 100, function() {
- $(this).hide();
- $('#header-wrap').removeClass('quicknav');
- });
- }
-
//Set up search
$("#search_autocomplete").focus(function() {
$("#search-container").addClass('active');
})
- $("#search-container").mouseover(function() {
+ $("#search-container").on('mouseover touchend', function(e) {
+ if ($(e.target).is('#search-close')) { return; }
$("#search-container").addClass('active');
$("#search_autocomplete").focus();
})
@@ -180,73 +149,88 @@
// Highlight the header tabs...
// highlight Design tab
- if ($("body").hasClass("design")) {
- $("#header li.design a").addClass("selected");
- $("#sticky-header").addClass("design");
+ var urlSegments = pagePathOriginal.split('/');
+ var navEl = $(".dac-nav-list");
+ var subNavEl = navEl.find(".dac-nav-secondary");
+ var parentNavEl;
+ if ($("body").hasClass("design")) {
+ navEl.find("> li.design > a").addClass("selected");
// highlight About tabs
} else if ($("body").hasClass("about")) {
- var rootDir = pagePathOriginal.substring(1,pagePathOriginal.indexOf('/', 1));
- if (rootDir == "about") {
- $("#nav-x li.about a").addClass("selected");
- } else if (rootDir == "wear") {
- $("#nav-x li.wear a").addClass("selected");
- } else if (rootDir == "tv") {
- $("#nav-x li.tv a").addClass("selected");
- } else if (rootDir == "auto") {
- $("#nav-x li.auto a").addClass("selected");
+ if (urlSegments[1] == "about" || urlSegments[1] == "wear" || urlSegments[1] == "tv" || urlSegments[1] == "auto") {
+ navEl.find("> li.home > a").addClass('has-subnav');
+ subNavEl.find("li." + urlSegments[1] + " > a").addClass("selected");
+ } else {
+ navEl.find("> li.home > a").addClass('selected');
}
+
+// highlight NDK tabs
+ } else if ($("body").hasClass("ndk")) {
+ parentNavEl = navEl.find("> li.ndk > a");
+ parentNavEl.addClass('has-subnav');
+ if ($("body").hasClass("guide")) {
+ navEl.find("> li.guides > a").addClass("selected ndk");
+ } else if ($("body").hasClass("reference")) {
+ navEl.find("> li.reference > a").addClass("selected ndk");
+ } else if ($("body").hasClass("samples")) {
+ navEl.find("> li.samples > a").addClass("selected ndk");
+ } else if ($("body").hasClass("downloads")) {
+ navEl.find("> li.downloads > a").addClass("selected ndk");
+ }
+
// highlight Develop tab
} else if ($("body").hasClass("develop") || $("body").hasClass("google")) {
- $("#header li.develop a").addClass("selected");
- $("#sticky-header").addClass("develop");
+ parentNavEl = navEl.find("> li.develop > a");
+ parentNavEl.addClass('has-subnav');
+
// In Develop docs, also highlight appropriate sub-tab
- var rootDir = pagePathOriginal.substring(1,pagePathOriginal.indexOf('/', 1));
- if (rootDir == "training") {
- $("#nav-x li.training a").addClass("selected");
- } else if (rootDir == "guide") {
- $("#nav-x li.guide a").addClass("selected");
- } else if (rootDir == "reference") {
+ if (urlSegments[1] == "training") {
+ subNavEl.find("li.training > a").addClass("selected");
+ } else if (urlSegments[1] == "guide") {
+ subNavEl.find("li.guide > a").addClass("selected");
+ } else if (urlSegments[1] == "reference") {
// If the root is reference, but page is also part of Google Services, select Google
if ($("body").hasClass("google")) {
- $("#nav-x li.google a").addClass("selected");
+ subNavEl.find("li.google > a").addClass("selected");
} else {
- $("#nav-x li.reference a").addClass("selected");
+ subNavEl.find("li.reference > a").addClass("selected");
}
- } else if ((rootDir == "tools") || (rootDir == "sdk")) {
- $("#nav-x li.tools a").addClass("selected");
+ } else if ((urlSegments[1] == "tools") || (urlSegments[1] == "sdk")) {
+ subNavEl.find("li.tools > a").addClass("selected");
} else if ($("body").hasClass("google")) {
- $("#nav-x li.google a").addClass("selected");
+ subNavEl.find("li.google > a").addClass("selected");
} else if ($("body").hasClass("samples")) {
- $("#nav-x li.samples a").addClass("selected");
+ subNavEl.find("li.samples > a").addClass("selected");
+ } else if ($("body").hasClass("preview")) {
+ subNavEl.find("li.preview > a").addClass("selected");
+ } else {
+ parentNavEl.removeClass('has-subnav').addClass("selected");
}
-
// highlight Distribute tab
} else if ($("body").hasClass("distribute")) {
- $("#header li.distribute a").addClass("selected");
- $("#sticky-header").addClass("distribute");
+ parentNavEl = navEl.find("> li.distribute > a");
+ parentNavEl.addClass('has-subnav');
- var baseFrag = pagePathOriginal.indexOf('/', 1) + 1;
- var secondFrag = pagePathOriginal.substring(baseFrag, pagePathOriginal.indexOf('/', baseFrag));
- if (secondFrag == "users") {
- $("#nav-x li.users a").addClass("selected");
- } else if (secondFrag == "engage") {
- $("#nav-x li.engage a").addClass("selected");
- } else if (secondFrag == "monetize") {
- $("#nav-x li.monetize a").addClass("selected");
- } else if (secondFrag == "analyze") {
- $("#nav-x li.analyze a").addClass("selected");
- } else if (secondFrag == "tools") {
- $("#nav-x li.disttools a").addClass("selected");
- } else if (secondFrag == "stories") {
- $("#nav-x li.stories a").addClass("selected");
- } else if (secondFrag == "essentials") {
- $("#nav-x li.essentials a").addClass("selected");
- } else if (secondFrag == "googleplay") {
- $("#nav-x li.googleplay a").addClass("selected");
+ if (urlSegments[2] == "users") {
+ subNavEl.find("li.users > a").addClass("selected");
+ } else if (urlSegments[2] == "engage") {
+ subNavEl.find("li.engage > a").addClass("selected");
+ } else if (urlSegments[2] == "monetize") {
+ subNavEl.find("li.monetize > a").addClass("selected");
+ } else if (urlSegments[2] == "analyze") {
+ subNavEl.find("li.analyze > a").addClass("selected");
+ } else if (urlSegments[2] == "tools") {
+ subNavEl.find("li.essentials > a").addClass("selected");
+ } else if (urlSegments[2] == "stories") {
+ subNavEl.find("li.stories > a").addClass("selected");
+ } else if (urlSegments[2] == "essentials") {
+ subNavEl.find("li.essentials > a").addClass("selected");
+ } else if (urlSegments[2] == "googleplay") {
+ subNavEl.find("li.googleplay > a").addClass("selected");
+ } else {
+ parentNavEl.removeClass('has-subnav').addClass("selected");
}
- } else if ($("body").hasClass("about")) {
- $("#sticky-header").addClass("about");
}
// set global variable so we can highlight the sidenav a bit later (such as for google reference)
@@ -392,14 +376,13 @@
var $olClasses = $('<ol class="class-list"></ol>');
var $liClass;
- var $imgIcon;
var $h2Title;
var $pSummary;
var $olLessons;
var $liLesson;
$classLinks.each(function(index) {
- $liClass = $('<li></li>');
- $h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>');
+ $liClass = $('<li class="clearfix"></li>');
+ $h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2 class="norule">' + $(this).html()+'</h2><span></span></a>');
$pSummary = $('<p class="description">' + $classDescriptions[index] + '</p>');
$olLessons = $('<ol class="lesson-list"></ol>');
@@ -407,18 +390,14 @@
$lessons = $(this).closest('li').find('ul li a');
if ($lessons.length) {
- $imgIcon = $('<img src="'+toRoot+'assets/images/resource-tutorial.png" '
- + ' width="64" height="64" alt=""/>');
$lessons.each(function(index) {
$olLessons.append('<li><a href="'+$(this).attr('href')+'">' + $(this).html()+'</a></li>');
});
} else {
- $imgIcon = $('<img src="'+toRoot+'assets/images/resource-article.png" '
- + ' width="64" height="64" alt=""/>');
$pSummary.addClass('article');
}
- $liClass.append($h2Title).append($imgIcon).append($pSummary).append($olLessons);
+ $liClass.append($h2Title).append($pSummary).append($olLessons);
$olClasses.append($liClass);
});
$('.jd-descr').append($olClasses);
@@ -436,23 +415,15 @@
/* Resize nav height when window height changes */
$(window).resize(function() {
if ($('#side-nav').length == 0) return;
- var stylesheet = $('link[rel="stylesheet"][class="fullscreen"]');
- setNavBarLeftPos(); // do this even if sidenav isn't fixed because it could become fixed
+ setNavBarDimensions(); // do this even if sidenav isn't fixed because it could become fixed
// make sidenav behave when resizing the window and side-scolling is a concern
- if (sticky) {
- if ((stylesheet.attr("disabled") == "disabled") || stylesheet.length == 0) {
- updateSideNavPosition();
- } else {
- updateSidenavFullscreenWidth();
- }
- }
- resizeNav();
+ updateSideNavDimensions();
+ checkSticky();
+ resizeNav(250);
});
-
- var navBarLeftPos;
if ($('#devdoc-nav').length) {
- setNavBarLeftPos();
+ setNavBarDimensions();
}
@@ -495,7 +466,12 @@
$('h2').click(function() {
var id = $(this).attr('id');
if (id) {
- document.location.hash = id;
+ if (history && history.replaceState) {
+ // Change url without scrolling.
+ history.replaceState({}, '', '#' + id);
+ } else {
+ document.location.hash = id;
+ }
}
});
@@ -504,15 +480,6 @@
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
-
- // Revise the sidenav widths to make room for the scrollbar
- // which avoids the visible width from changing each time the bar appears
- var $sidenav = $("#side-nav");
- var sidenav_width = parseInt($sidenav.innerWidth());
-
- $("#devdoc-nav #nav").css("width", sidenav_width - 4 + "px"); // 4px is scrollbar width
-
-
$(".scroll-pane").removeAttr("tabindex"); // get rid of tabindex added by jscroller
if ($(".scroll-pane").length > 1) {
@@ -738,21 +705,28 @@
/** Create the list of breadcrumb links in the sticky header */
function buildBreadcrumbs() {
- var $breadcrumbUl = $("#sticky-header ul.breadcrumb");
+ var $breadcrumbUl = $(".dac-header-crumbs");
+ var primaryNavLink = ".dac-nav-list > .dac-nav-item > .dac-nav-link";
+
// Add the secondary horizontal nav item, if provided
- var $selectedSecondNav = $("div#nav-x ul.nav-x a.selected").clone().removeClass("selected");
+ var $selectedSecondNav = $(".dac-nav-secondary .dac-nav-link.selected").clone()
+ .attr('class', 'dac-header-crumbs-link');
+
if ($selectedSecondNav.length) {
- $breadcrumbUl.prepend($("<li>").append($selectedSecondNav))
+ $breadcrumbUl.prepend($('<li class="dac-header-crumbs-item">').append($selectedSecondNav));
}
+
// Add the primary horizontal nav
- var $selectedFirstNav = $("div#header-wrap ul.nav-x a.selected").clone().removeClass("selected");
+ var $selectedFirstNav = $(primaryNavLink + ".selected, " + primaryNavLink + ".has-subnav").clone()
+ .attr('class', 'dac-header-crumbs-link');
+
// If there's no header nav item, use the logo link and title from alt text
if ($selectedFirstNav.length < 1) {
- $selectedFirstNav = $("<a>")
+ $selectedFirstNav = $('<a class="dac-header-crumbs-link">')
.attr('href', $("div#header .logo a").attr('href'))
.text($("div#header .logo img").attr('alt'));
}
- $breadcrumbUl.prepend($("<li>").append($selectedFirstNav));
+ $breadcrumbUl.prepend($('<li class="dac-header-crumbs-item">').append($selectedFirstNav));
}
@@ -809,22 +783,25 @@
enabled = false;
}
writeCookie("fullscreen", enabled, null);
- setNavBarLeftPos();
+ setNavBarDimensions();
resizeNav(delay);
- updateSideNavPosition();
+ updateSideNavDimensions();
setTimeout(initSidenavHeightResize,delay);
}
-
-function setNavBarLeftPos() {
+// TODO: Refactor into a closure.
+var navBarLeftPos;
+var navBarWidth;
+function setNavBarDimensions() {
navBarLeftPos = $('#body-content').offset().left;
+ navBarWidth = $('#side-nav').width();
}
-function updateSideNavPosition() {
+function updateSideNavDimensions() {
var newLeft = $(window).scrollLeft() - navBarLeftPos;
- $('#devdoc-nav').css({left: -newLeft});
- $('#devdoc-nav .totop').css({left: -(newLeft - parseInt($('#side-nav').css('margin-left')))});
+ $('#devdoc-nav').css({left: -newLeft, width: navBarWidth});
+ $('#devdoc-nav .totop').css({left: -(newLeft - parseInt($('#side-nav').css('padding-left')))});
}
// TODO: use $(document).ready instead
@@ -858,7 +835,7 @@
-/* ######### RESIZE THE SIDENAV HEIGHT ########## */
+/* ######### RESIZE THE SIDENAV ########## */
function resizeNav(delay) {
var $nav = $("#devdoc-nav");
@@ -874,7 +851,7 @@
// get the height of space between nav and top of window.
// Could be either margin or top position, depending on whether the nav is fixed.
- var topMargin = (parseInt($nav.css('margin-top')) || parseInt($nav.css('top'))) + 1;
+ var topMargin = (parseInt($nav.css('top')) || 20) + 1;
// add 1 for the #side-nav bottom margin
// Depending on whether the header is visible, set the side nav's height.
@@ -889,7 +866,9 @@
$scrollPanes = $(".scroll-pane");
- if ($scrollPanes.length > 1) {
+ if ($window.width() < 720) {
+ $nav.css('height', '');
+ } else if ($scrollPanes.length > 1) {
// subtract the height of the api level widget and nav swapper from the available nav height
navHeight -= ($('#api-nav-header').outerHeight(true) + $('#nav-swap').outerHeight(true));
@@ -957,7 +936,7 @@
function reInitScrollbars() {
var pane = $(".scroll-pane").each(function(){
var api = $(this).data('jsp');
- if (!api) { setTimeout(reInitScrollbars,300); return;}
+ if (!api) {return;}
api.reinitialise( {verticalGutter:0} );
});
$(".scroll-pane").removeAttr("tabindex"); // get rid of tabindex added by jscroller
@@ -993,6 +972,7 @@
/** Scroll the jScrollPane to make the currently selected item visible
This is called when the page finished loading. */
function scrollIntoView(nav) {
+ return;
var $nav = $("#"+nav);
var element = $nav.jScrollPane({/* ...settings... */});
var api = element.data('jsp');
@@ -1068,39 +1048,45 @@
/* Sets the vertical scoll position at which the sticky bar should appear.
This method is called to reset the position when search results appear or hide */
function setStickyTop() {
- stickyTop = $('#header-wrapper').outerHeight() - $('#sticky-header').outerHeight();
+ stickyTop = $('#header-wrapper').outerHeight() - $('#header > .dac-header-inner').outerHeight();
}
/*
* Displays sticky nav bar on pages when dac header scrolls out of view
*/
$(window).scroll(function(event) {
-
- setStickyTop();
- var hiding = false;
- var $stickyEl = $('#sticky-header');
- var $menuEl = $('.menu-container');
- // Exit if there's no sidenav
- if ($('#side-nav').length == 0) return;
// Exit if the mouse target is a DIV, because that means the event is coming
// from a scrollable div and so there's no need to make adjustments to our layout
if ($(event.target).nodeName == "DIV") {
return;
}
+ checkSticky();
+});
+
+function checkSticky() {
+ setStickyTop();
+ var $headerEl = $('#header');
+ // Exit if there's no sidenav
+ if ($('#side-nav').length == 0) return;
+
var top = $(window).scrollTop();
// we set the navbar fixed when the scroll position is beyond the height of the site header...
- var shouldBeSticky = top >= stickyTop;
+ var shouldBeSticky = top > stickyTop;
// ... except if the document content is shorter than the sidenav height.
// (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
if ($("#doc-col").height() < $("#side-nav").height()) {
shouldBeSticky = false;
}
+ // Nor on mobile
+ if (window.innerWidth < 720) {
+ shouldBeSticky = false;
+ }
// Account for horizontal scroll
var scrollLeft = $(window).scrollLeft();
// When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
if (sticky && (scrollLeft != prevScrollLeft)) {
- updateSideNavPosition();
+ updateSideNavDimensions();
prevScrollLeft = scrollLeft;
}
@@ -1113,41 +1099,29 @@
// If sticky header visible and position is now near top, hide sticky
if (sticky && !shouldBeSticky) {
sticky = false;
- hiding = true;
// make the sidenav static again
$('#devdoc-nav')
- .removeClass('fixed')
- .css({'width':'auto','margin':''})
- .prependTo('#side-nav');
+ .removeClass('fixed')
+ .css({'width':'auto','margin':''});
// delay hide the sticky
- $menuEl.removeClass('sticky-menu');
- $stickyEl.fadeOut(250);
- hiding = false;
+ $headerEl.removeClass('is-sticky');
// update the sidenaav position for side scrolling
- updateSideNavPosition();
+ updateSideNavDimensions();
} else if (!sticky && shouldBeSticky) {
sticky = true;
- $stickyEl.fadeIn(10);
- $menuEl.addClass('sticky-menu');
+ $headerEl.addClass('is-sticky');
// make the sidenav fixed
- var width = $('#devdoc-nav').width();
$('#devdoc-nav')
- .addClass('fixed')
- .css({'width':width+'px'})
- .prependTo('#body-content');
+ .addClass('fixed');
// update the sidenaav position for side scrolling
- updateSideNavPosition();
+ updateSideNavDimensions();
- } else if (hiding && top < 15) {
- $menuEl.removeClass('sticky-menu');
- $stickyEl.hide();
- hiding = false;
}
resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
-});
+}
/*
* Manages secion card states and nav resize to conclude loading
@@ -1352,13 +1326,13 @@
function changeNavLang(lang) {
- var $links = $("#devdoc-nav,#header,#nav-x,.training-nav-top,.content-footer").find("a["+lang+"-lang]");
- $links.each(function(i){ // for each link with a translation
+ if (lang === 'en') { return; }
+
+ var $links = $('a[' + lang + '-lang]');
+ $links.each(function(){ // for each link with a translation
var $link = $(this);
- if (lang != "en") { // No need to worry about English, because a language change invokes new request
- // put the desired language from the attribute as the text
- $link.text($link.attr(lang+"-lang"))
- }
+ // put the desired language from the attribute as the text
+ $link.text($link.attr(lang + '-lang'))
});
}
@@ -1841,12 +1815,11 @@
// if there are api results
if ((gMatches.length > 0) || (gGoogleMatches.length > 0)) {
// reveal suggestion list
- $('.suggest-card.dummy').show();
$('.suggest-card.reference').show();
var listIndex = 0; // list index position
// reset the lists
- $(".search_filtered_wrapper.reference li").remove();
+ $(".suggest-card.reference li").remove();
// ########### ANDROID RESULTS #############
if (gMatches.length > 0) {
@@ -1876,13 +1849,12 @@
}
} else {
$('.suggest-card.reference').hide();
- $('.suggest-card.dummy').hide();
}
// ########### JD DOC RESULTS #############
if (gDocsMatches.length > 0) {
// reset the lists
- $(".search_filtered_wrapper.docs li").remove();
+ $(".suggest-card:not(.reference) li").remove();
// determine google results to show
// NOTE: The order of the conditions below for the sugg.type MUST BE SPECIFIC:
@@ -1947,7 +1919,7 @@
}
} else {
- $('.search_filtered_wrapper.docs .suggest-card:not(.dummy)').hide(300);
+ $('.suggest-card:not(.reference)').hide(300);
}
}
@@ -1971,14 +1943,14 @@
// show/hide the close button
if (text != '') {
- $(".search .close").removeClass("hide");
+ $("#search-close").removeClass("hide");
} else {
- $(".search .close").addClass("hide");
+ $("#search-close").addClass("hide");
}
// 27 = esc
if (e.keyCode == 27) {
// close all search results
- if (kd) $('.search .close').trigger('click');
+ if (kd) $('#search-close').trigger('click');
return true;
}
// 13 = enter
@@ -2129,9 +2101,8 @@
// Search for matching JD docs
if (text.length >= 2) {
- // Regex to match only the beginning of a word
- var textRegex = new RegExp("\\b" + text.toLowerCase(), "g");
-
+ // match only the beginning of a word
+ var queryStr = text.toLowerCase();
// Search for Training classes
for (var i=0; i<TRAINING_RESOURCES.length; i++) {
@@ -2145,7 +2116,7 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2155,7 +2126,7 @@
if ((s.lang == currentLang) &&
(!(s.type == "training" && s.url.indexOf("index.html") == -1) || matched)) {
// it matches the doc title
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2179,7 +2150,8 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
+
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2187,7 +2159,7 @@
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2211,7 +2183,7 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2219,7 +2191,7 @@
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2243,7 +2215,7 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2251,7 +2223,7 @@
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2275,7 +2247,7 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2283,7 +2255,7 @@
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2307,7 +2279,7 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2315,7 +2287,7 @@
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2339,7 +2311,7 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2347,7 +2319,7 @@
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2370,7 +2342,7 @@
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
- if (s.keywords[j].toLowerCase().match(textRegex)) {
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
@@ -2378,7 +2350,38 @@
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title.t
- if (s.title.toLowerCase().match(textRegex)) {
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
+ matched = true;
+ s.matched_title = 1;
+ }
+ }
+ if (matched) {
+ gDocsMatches[matchedCountDocs] = s;
+ matchedCountDocs++;
+ }
+ }
+
+ // Search for Preview Guides
+ for (var i=0; i<PREVIEW_RESOURCES.length; i++) {
+ // current search comparison, with counters for tag and title,
+ // used later to improve ranking
+ var s = PREVIEW_RESOURCES[i];
+ s.matched_tag = 0;
+ s.matched_title = 0;
+ var matched = false;
+
+ // Check if query matches any tags; work backwards toward 1 to assist ranking
+ for (var j = s.keywords.length - 1; j >= 0; j--) {
+ // it matches a tag
+ if (s.keywords[j].toLowerCase().indexOf(queryStr) == 0) {
+ matched = true;
+ s.matched_tag = j + 1; // add 1 to index position
+ }
+ }
+ // Check if query matches the doc title, but only for current language
+ if (s.lang == currentLang) {
+ // if query matches the doc title
+ if (s.title.toLowerCase().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
@@ -2536,7 +2539,7 @@
{
if (!focused) {
if(obj.value == ""){
- $(".search .close").addClass("hide");
+ $("#search-close").addClass("hide");
}
$(".suggest-card").hide();
}
@@ -2553,7 +2556,7 @@
function hideResults() {
$("#searchResults").slideUp('fast', setStickyTop);
- $(".search .close").addClass("hide");
+ $("#search-close").addClass("hide");
location.hash = '';
$("#search_autocomplete").val("").blur();
@@ -2670,7 +2673,7 @@
} else {
// first time loading search results for this page
$('#searchResults').slideDown('slow', setStickyTop);
- $(".search .close").removeClass("hide");
+ $("#search-close").removeClass("hide");
loadSearchResults();
}
}, true);
@@ -2714,7 +2717,7 @@
searchControl.execute(query);
$('#searchResults').slideDown('slow', setStickyTop);
$("#search_autocomplete").focus();
- $(".search .close").removeClass("hide");
+ $("#search-close").removeClass("hide");
updateResultTitle(query);
});
@@ -3146,6 +3149,10 @@
me.node = new Object();
me.node.li = document.getElementById(navtree_id);
+ if (!me.node.li) {
+ return;
+ }
+
me.node.children_data = root_nodes;
me.node.children = new Array();
me.node.children_ul = document.createElement("ul");
@@ -3536,6 +3543,10 @@
var addedPageResources = {};
$(document).ready(function() {
+ // Need to initialize hero carousel before other sections for dedupe
+ // to work correctly.
+ $('[data-carousel-query]').dacCarouselQuery();
+
$('.resource-widget').each(function() {
initResourceWidget(this);
});
@@ -3545,8 +3556,8 @@
showing lines that are cut off. This works with the css ellipsis
classes to fade last text line and apply an ellipsis char. */
- //card text currently uses 15px line height.
- var lineHeight = 15;
+ //card text currently uses 20px line height.
+ var lineHeight = 20;
$('.card-info .text').ellipsisfade(lineHeight);
});
@@ -3562,21 +3573,20 @@
isCarousel = $widget.hasClass('resource-carousel-layout'),
isStack = $widget.hasClass('resource-stack-layout');
- // find size of widget by pulling out its class name
- var sizeCols = 1;
+ // remove illegal col-x class which is not relevant anymore thanks to responsive styles.
var m = $widget.get(0).className.match(/\bcol-(\d+)\b/);
- if (m) {
- sizeCols = parseInt(m[1], 10);
+ if (m && !$widget.is('.cols > *')) {
+ $widget.removeClass('col-' + m[1]);
}
var opts = {
cardSizes: ($widget.data('cardsizes') || '').split(','),
maxResults: parseInt($widget.data('maxresults') || '100', 10),
+ initialResults: $widget.data('initialResults'),
itemsPerPage: $widget.data('itemsperpage'),
sortOrder: $widget.data('sortorder'),
query: $widget.data('query'),
section: $widget.data('section'),
- sizeCols: sizeCols,
/* Added by LFL 6/6/14 */
resourceStyle: $widget.data('resourcestyle') || 'card',
stackSort: $widget.data('stacksort') || 'true'
@@ -3604,7 +3614,7 @@
/* Initializes a Resource Carousel Widget */
function drawResourcesCarouselWidget($widget, opts, resources) {
$widget.empty();
- var plusone = true; //always show plusone on carousel
+ var plusone = false; // stop showing plusone buttons on cards
$widget.addClass('resource-card slideshow-container')
.append($('<a>').addClass('slideshow-prev').text('Prev'))
@@ -3642,7 +3652,7 @@
function drawResourcesStackWidget($widget, opts, resources, sections) {
// Don't empty widget, grab all items inside since they will be the first
// items stacked, followed by the resource query
- var plusone = true; //by default show plusone on section cards
+ var plusone = false; // stop showing plusone buttons on cards
var cards = $widget.find('.resource-card').detach().toArray();
var numStacks = opts.numStacks || 1;
var $stacks = [];
@@ -3737,22 +3747,49 @@
return $el;
}
+
+ function createResponsiveFlowColumn(cardSize) {
+ var cardWidth = parseInt(cardSize.match(/(\d+)/)[1], 10);
+ var column = $('<div>').addClass('col-' + (cardWidth / 3) + 'of6');
+ if (cardWidth < 9) {
+ column.addClass('col-tablet-1of2');
+ } else if (cardWidth > 9 && cardWidth < 18) {
+ column.addClass('col-tablet-1of1');
+ }
+ if (cardWidth < 18) {
+ column.addClass('col-mobile-1of1')
+ }
+ return column;
+ }
/* Initializes a flow widget, see distribute.scss for generating accompanying css */
function drawResourcesFlowWidget($widget, opts, resources) {
- $widget.empty();
+ $widget.empty().addClass('cols');
var cardSizes = opts.cardSizes || ['6x6'];
+ var initialResults = opts.initialResults || resources.length;
var i = 0, j = 0;
- var plusone = true; // by default show plusone on resource cards
+ var plusone = false; // stop showing plusone buttons on cards
+ var cardParent = $widget;
while (i < resources.length) {
+
+ if (i === initialResults && initialResults < resources.length) {
+ // Toggle remaining cards
+ cardParent = $('<div class="dac-toggle-content clearfix">').appendTo($widget);
+ $widget.addClass('dac-toggle');
+ $('<div class="col-1of1 dac-section-links dac-text-center">')
+ .append(
+ $('<div class="dac-section-link" data-toggle="section">')
+ .append('<span class="dac-toggle-expand">More<i class="dac-sprite dac-auto-unfold-more"></i></span>')
+ .append('<span class="dac-toggle-collapse">Less<i class="dac-sprite dac-auto-unfold-less"></i></span>')
+ )
+ .appendTo($widget)
+ }
+
var cardSize = cardSizes[j++ % cardSizes.length];
cardSize = cardSize.replace(/^\s+|\s+$/,'');
- // Some card sizes do not get a plusone button, such as where space is constrained
- // or for cards commonly embedded in docs (to improve overall page speed).
- plusone = !((cardSize == "6x2") || (cardSize == "6x3") ||
- (cardSize == "9x2") || (cardSize == "9x3") ||
- (cardSize == "12x2") || (cardSize == "12x3"));
+
+ var column = createResponsiveFlowColumn(cardSize).appendTo(cardParent);
// A stack has a third dimension which is the number of stacked items
var isStack = cardSize.match(/(\d+)x(\d+)x(\d+)/);
@@ -3763,7 +3800,7 @@
// Create a stack container which should have the dimensions defined
// by the product of the items inside.
$stackDiv = $('<div>').addClass('resource-card-stack resource-card-' + isStack[1]
- + 'x' + isStack[2] * isStack[3]) .appendTo($widget);
+ + 'x' + isStack[2] * isStack[3]) .appendTo(column);
}
// Build each stack item or just a single item
@@ -3785,7 +3822,7 @@
stackCount = 0;
}
- $card.appendTo($stackDiv || $widget);
+ $card.appendTo($stackDiv || column);
} while (++i < resources.length && stackCount > 0);
}
@@ -3800,6 +3837,10 @@
}
function buildResourceList(opts) {
+ return $.queryResources(opts);
+ }
+
+ $.queryResources = function(opts) {
var maxResults = opts.maxResults || 100;
var query = opts.query || '';
@@ -3848,8 +3889,9 @@
// add to list of already added indices
for (var j = 0; j < resources.length; j++) {
- // console.log(resources[j].title);
- addedResourceIndices[resources[j].index] = 1;
+ if (resources[j]) {
+ addedResourceIndices[resources[j].index] = 1;
+ }
}
// concat to final results list
@@ -3891,7 +3933,7 @@
function getResourceNotAlreadyAddedFilter(addedResourceIndices) {
return function(resource) {
- return !addedResourceIndices[resource.index];
+ return resource && !addedResourceIndices[resource.index];
};
}
@@ -4020,6 +4062,12 @@
imgUrl = toRoot + imgUrl;
}
+ if (resource.type === 'youtube') {
+ $('<div>').addClass('play-button')
+ .append($('<i class="dac-sprite dac-play-white">'))
+ .appendTo(this);
+ }
+
$('<div>').addClass('card-bg')
.css('background-image', 'url(' + (imgUrl || toRoot +
'assets/images/resource-card-default-android.jpg') + ')')
@@ -4155,7 +4203,7 @@
$this.parent().siblings().each(function ()
{
if ($(this).is(":visible")) {
- var h = $(this).height();
+ var h = $(this).outerHeight(true);
remainingHeight = remainingHeight - h;
}
});
@@ -4354,3 +4402,895 @@
}
}
})();
+
+/**
+ * Auto TOC
+ *
+ * Upgrades h2s on the page to have a rule and be toggle-able on mobile.
+ */
+(function($) {
+ var upgraded = false;
+ var h2Titles;
+
+ function initWidget() {
+ // add HRs below all H2s (except for a few other h2 variants)
+ // Consider doing this with css instead.
+ h2Titles = $('h2').not('#qv h2, #tb h2, .sidebox h2, #devdoc-nav h2, h2.norule');
+ h2Titles.css({marginBottom:0}).after('<hr/>');
+
+ // Exit early if on older browser.
+ if (!window.matchMedia) {
+ return;
+ }
+
+ // Only run logic in mobile layout.
+ var query = window.matchMedia('(max-width: 719px)');
+ if (query.matches) {
+ makeTogglable();
+ } else {
+ query.addListener(makeTogglable);
+ }
+ }
+
+ function makeTogglable() {
+ // Only run this logic once.
+ if (upgraded) { return; }
+ upgraded = true;
+
+ // Only make content h2s togglable.
+ var contentTitles = h2Titles.filter('#jd-content *');
+
+ // If there are more than 1
+ if (contentTitles.size() < 2) {
+ return;
+ }
+
+ contentTitles.each(function() {
+ // Find all the relevant nodes.
+ var $title = $(this);
+ var $hr = $title.next();
+ var $contents = $hr.nextUntil('h2, .next-docs');
+ var $section = $($title)
+ .add($hr)
+ .add($title.prev('a[name]'))
+ .add($contents);
+ var $anchor = $section.first().prev();
+ var anchorMethod = 'after';
+ if ($anchor.length === 0) {
+ $anchor = $title.parent();
+ anchorMethod = 'prepend';
+ }
+
+ // Some h2s are in their own container making it pretty hard to find the end, so skip.
+ if ($contents.length === 0) {
+ return;
+ }
+
+ // Remove from DOM before messing with it. DOM is slow!
+ $section.detach();
+
+ // Add mobile-only expand arrows.
+ $title.prepend('<span class="dac-visible-mobile-inline-block">' +
+ '<i class="dac-toggle-expand dac-sprite dac-expand-more-black"></i>' +
+ '<i class="dac-toggle-collapse dac-sprite dac-expand-less-black"></i>' +
+ '</span>')
+ .attr('data-toggle', 'section');
+
+ // Wrap in magic markup.
+ $section = $section.wrapAll('<div class="dac-toggle dac-mobile">').parent();
+ $contents.wrapAll('<div class="dac-toggle-content"><div>'); // extra div used for max-height calculation.
+
+ // Pre-expand section if requested.
+ if ($title.hasClass('is-expanded')) {
+ $section.addClass('is-expanded');
+ }
+
+ // Pre-expand section if targetted by hash.
+ if (location.hash && $section.find(location.hash).length) {
+ $section.addClass('is-expanded');
+ }
+
+ // Add it back to the dom.
+ $anchor[anchorMethod].call($anchor, $section);
+ });
+ }
+
+ $(function() {
+ initWidget();
+ });
+})(jQuery);
+
+(function($) {
+ 'use strict';
+
+ /**
+ * Toggle Floating Label state.
+ * @param {HTMLElement} el - The DOM element.
+ * @param options
+ * @constructor
+ */
+ function FloatingLabel(el, options) {
+ this.el = $(el);
+ this.options = $.extend({}, FloatingLabel.DEFAULTS_, options);
+ this.group = this.el.closest('.dac-form-input-group');
+ this.input = this.group.find('.dac-form-input');
+
+ this.checkValue_ = this.checkValue_.bind(this);
+ this.checkValue_();
+
+ this.input.on('focus', function() {
+ this.group.addClass('dac-focused');
+ }.bind(this));
+ this.input.on('blur', function() {
+ this.group.removeClass('dac-focused');
+ this.checkValue_();
+ }.bind(this));
+ this.input.on('keyup', this.checkValue_);
+ }
+
+ /**
+ * The label is moved out of the textbox when it has a value.
+ */
+ FloatingLabel.prototype.checkValue_ = function() {
+ if (this.input.val().length) {
+ this.group.addClass('dac-has-value');
+ } else {
+ this.group.removeClass('dac-has-value');
+ }
+ };
+
+ /**
+ * jQuery plugin
+ * @param {object} options - Override default options.
+ */
+ $.fn.dacFloatingLabel = function(options) {
+ return this.each(function() {
+ new FloatingLabel(this, options);
+ });
+ };
+
+ $(document).on('ready.aranja', function() {
+ $('.dac-form-floatlabel').each(function() {
+ $(this).dacFloatingLabel($(this).data());
+ });
+ });
+})(jQuery);
+
+/* global toRoot, CAROUSEL_OVERRIDE */
+(function($) {
+ // Ordering matters
+ var TAG_MAP = [
+ {from: 'developerstory', to: 'Android Developer Story'},
+ {from: 'googleplay', to: 'Google Play'}
+ ];
+
+ function DacCarouselQuery(el) {
+ this.el = $(el);
+
+ var opts = this.el.data();
+ opts.maxResults = parseInt(opts.maxResults || '100', 10);
+ opts.query = opts.carouselQuery;
+ var resources = $.queryResources(opts);
+
+ this.el.empty();
+ $(resources).map(function() {
+ var resource = $.extend({}, this, CAROUSEL_OVERRIDE[this.url]);
+ var slide = $('<article class="dac-expand dac-hero">');
+ var image = cleanUrl(resource.heroImage || resource.image);
+ var fullBleed = image && !resource.heroColor;
+
+ // Configure background
+ slide.css({
+ backgroundImage: fullBleed ? 'url(' + image + ')' : '',
+ backgroundColor: resource.heroColor || ''
+ });
+
+ // Should copy be inverted
+ slide.toggleClass('dac-invert', resource.heroInvert || fullBleed);
+ slide.toggleClass('dac-darken', fullBleed);
+
+ // Should be clickable
+ slide.append($('<a class="dac-hero-carousel-action">').attr('href', cleanUrl(resource.url)));
+
+ var cols = $('<div class="cols dac-hero-content">');
+
+ // inline image column
+ var rightCol = $('<div class="col-1of2 col-push-1of2 dac-hero-figure">')
+ .appendTo(cols);
+
+ if (!fullBleed && image) {
+ rightCol.append($('<img>').attr('src', image));
+ }
+
+ // info column
+ $('<div class="col-1of2 col-pull-1of2">')
+ .append($('<div class="dac-hero-tag">').text(formatTag(resource)))
+ .append($('<h1 class="dac-hero-title">').text(formatTitle(resource)))
+ .append($('<p class="dac-hero-description">').text(resource.summary))
+ .append($('<a class="dac-hero-cta">')
+ .text(formatCTA(resource))
+ .attr('href', cleanUrl(resource.url))
+ .prepend($('<span class="dac-sprite dac-auto-chevron">'))
+ )
+ .appendTo(cols);
+
+ slide.append(cols.wrap('<div class="wrap">').parent());
+ return slide[0];
+ }).prependTo(this.el);
+
+ // Pagination element.
+ this.el.append('<div class="dac-hero-carousel-pagination"><div class="wrap" data-carousel-pagination>');
+
+ this.el.dacCarousel();
+ }
+
+ function cleanUrl(url) {
+ if (url && url.indexOf('//') === -1) {
+ url = toRoot + url;
+ }
+ return url;
+ }
+
+ function formatTag(resource) {
+ // Hmm, need a better more scalable solution for this.
+ for (var i = 0, mapping; mapping = TAG_MAP[i]; i++) {
+ if (resource.tags.indexOf(mapping.from) > -1) {
+ return mapping.to;
+ }
+ }
+ return resource.type;
+ }
+
+ function formatTitle(resource) {
+ return resource.title.replace(/android developer story: /i, '');
+ }
+
+ function formatCTA(resource) {
+ return resource.type === 'youtube' ? 'Watch the video' : 'Learn more';
+ }
+
+ // jQuery plugin
+ $.fn.dacCarouselQuery = function() {
+ return this.each(function() {
+ var el = $(this);
+ var data = el.data('dac.carouselQuery');
+
+ if (!data) { el.data('dac.carouselQuery', (data = new DacCarouselQuery(el))); }
+ });
+ };
+
+ // Data API
+ $(function() {
+ $('[data-carousel-query]').dacCarouselQuery();
+ });
+})(jQuery);
+
+(function($) {
+ /**
+ * A CSS based carousel, inspired by SequenceJS.
+ * @param {jQuery} el
+ * @param {object} options
+ * @constructor
+ */
+ function DacCarousel(el, options) {
+ this.el = $(el);
+ this.options = options = $.extend({}, DacCarousel.OPTIONS, this.el.data(), options || {});
+ this.frames = this.el.find(options.frameSelector);
+ this.count = this.frames.size();
+ this.current = options.start;
+
+ this.initPagination();
+ this.initEvents();
+ this.initFrame();
+ }
+
+ DacCarousel.OPTIONS = {
+ auto: true,
+ autoTime: 10000,
+ autoMinTime: 5000,
+ btnPrev: '[data-carousel-prev]',
+ btnNext: '[data-carousel-next]',
+ frameSelector: 'article',
+ loop: true,
+ start: 0,
+ swipeThreshold: 160,
+ pagination: '[data-carousel-pagination]'
+ };
+
+ DacCarousel.prototype.initPagination = function() {
+ this.pagination = $([]);
+ if (!this.options.pagination) { return; }
+
+ var pagination = $('<ul class="dac-pagination">');
+ var parent = this.el;
+ if (typeof this.options.pagination === 'string') { parent = this.el.find(this.options.pagination); }
+
+ if (this.count > 1) {
+ for (var i = 0; i < this.count; i++) {
+ var li = $('<li class="dac-pagination-item">').text(i);
+ if (i === this.options.start) { li.addClass('active'); }
+ li.click(this.go.bind(this, i));
+
+ pagination.append(li);
+ }
+ this.pagination = pagination.children();
+ parent.append(pagination);
+ }
+ };
+
+ DacCarousel.prototype.initEvents = function() {
+ var that = this;
+
+ this.touch = {
+ start: {x: 0, y: 0},
+ end: {x: 0, y: 0}
+ };
+
+ this.el.on('touchstart', this.touchstart_.bind(this));
+ this.el.on('touchend', this.touchend_.bind(this));
+ this.el.on('touchmove', this.touchmove_.bind(this));
+
+ this.el.hover(function() {
+ that.pauseRotateTimer();
+ }, function() {
+ that.startRotateTimer();
+ });
+
+ $(this.options.btnPrev).click(function(e) {
+ e.preventDefault();
+ that.prev();
+ });
+
+ $(this.options.btnNext).click(function(e) {
+ e.preventDefault();
+ that.next();
+ });
+ };
+
+ DacCarousel.prototype.touchstart_ = function(event) {
+ var t = event.originalEvent.touches[0];
+ this.touch.start = {x: t.screenX, y: t.screenY};
+ };
+
+ DacCarousel.prototype.touchend_ = function() {
+ var deltaX = this.touch.end.x - this.touch.start.x;
+ var deltaY = Math.abs(this.touch.end.y - this.touch.start.y);
+ var shouldSwipe = (deltaY < Math.abs(deltaX)) && (Math.abs(deltaX) >= this.options.swipeThreshold);
+
+ if (shouldSwipe) {
+ if (deltaX > 0) {
+ this.prev();
+ } else {
+ this.next();
+ }
+ }
+ };
+
+ DacCarousel.prototype.touchmove_ = function(event) {
+ var t = event.originalEvent.touches[0];
+ this.touch.end = {x: t.screenX, y: t.screenY};
+ };
+
+ DacCarousel.prototype.initFrame = function() {
+ this.frames.removeClass('active').eq(this.options.start).addClass('active');
+ };
+
+ DacCarousel.prototype.startRotateTimer = function() {
+ if (!this.options.auto || this.rotateTimer) { return; }
+ this.rotateTimer = setTimeout(this.next.bind(this), this.options.autoTime);
+ };
+
+ DacCarousel.prototype.pauseRotateTimer = function() {
+ clearTimeout(this.rotateTimer);
+ this.rotateTimer = null;
+ };
+
+ DacCarousel.prototype.prev = function() {
+ this.go(this.current - 1);
+ };
+
+ DacCarousel.prototype.next = function() {
+ this.go(this.current + 1);
+ };
+
+ DacCarousel.prototype.go = function(next) {
+ // Figure out what the next slide is.
+ while (this.count > 0 && next >= this.count) { next -= this.count; }
+ while (next < 0) { next += this.count; }
+
+ // Cancel if we're already on that slide.
+ if (next === this.current) { return; }
+
+ // Prepare next slide.
+ this.frames.eq(next).removeClass('out');
+
+ // Recalculate styles before starting slide transition.
+ this.el.resolveStyles();
+ // Update pagination
+ this.pagination.removeClass('active').eq(next).addClass('active');
+
+ // Transition out current frame
+ this.frames.eq(this.current).toggleClass('active out');
+
+ // Transition in a new frame
+ this.frames.eq(next).toggleClass('active');
+
+ this.current = next;
+ };
+
+ // Helper which resolves new styles for an element, so it can start transitioning
+ // from the new values.
+ $.fn.resolveStyles = function() {
+ /*jshint expr:true*/
+ this[0] && this[0].offsetTop;
+ return this;
+ };
+
+ // jQuery plugin
+ $.fn.dacCarousel = function() {
+ this.each(function() {
+ var $el = $(this);
+ $el.data('dac-carousel', new DacCarousel(this));
+ });
+ return this;
+ };
+
+ // Data API
+ $(function() {
+ $('[data-carousel]').dacCarousel();
+ });
+})(jQuery);
+
+(function($) {
+ 'use strict';
+
+ function Modal(el, options) {
+ this.el = $(el);
+ this.options = $.extend({}, ToggleModal.DEFAULTS_, options);
+ this.isOpen = false;
+
+ this.el.on('click', function(event) {
+ if (!$.contains($('.dac-modal-window')[0], event.target)) {
+ return this.el.trigger('modal-close');
+ }
+ }.bind(this));
+
+ this.el.on('modal-open', this.open_.bind(this));
+ this.el.on('modal-close', this.close_.bind(this));
+ this.el.on('modal-toggle', this.toggle_.bind(this));
+ }
+
+ Modal.prototype.toggle_ = function() {
+ this.el.trigger('modal-' + (this.isOpen ? 'close' : 'open'));
+ };
+
+ Modal.prototype.close_ = function() {
+ this.el.removeClass('dac-active');
+ $('body').removeClass('dac-modal-open');
+ this.isOpen = false;
+ };
+
+ Modal.prototype.open_ = function() {
+ this.el.addClass('dac-active');
+ $('body').addClass('dac-modal-open');
+ this.isOpen = true;
+ };
+
+ function ToggleModal(el, options) {
+ this.el = $(el);
+ this.options = $.extend({}, ToggleModal.DEFAULTS_, options);
+ this.modal = this.options.modalToggle ? $('[data-modal="' + this.options.modalToggle + '"]') :
+ this.el.closest('[data-modal]');
+
+ this.el.on('click', this.clickHandler_.bind(this));
+ }
+
+ ToggleModal.prototype.clickHandler_ = function(event) {
+ event.preventDefault();
+ this.modal.trigger('modal-toggle');
+ };
+
+ /**
+ * jQuery plugin
+ * @param {object} options - Override default options.
+ */
+ $.fn.dacModal = function(options) {
+ return this.each(function() {
+ new Modal(this, options);
+ });
+ };
+
+ $.fn.dacToggleModal = function(options) {
+ return this.each(function() {
+ new ToggleModal(this, options);
+ });
+ };
+
+ /**
+ * Data Attribute API
+ */
+ $(document).on('ready.aranja', function() {
+ $('[data-modal]').each(function() {
+ $(this).dacModal($(this).data());
+ });
+
+ $('[data-modal-toggle]').each(function() {
+ $(this).dacToggleModal($(this).data());
+ });
+ });
+})(jQuery);
+
+(function($) {
+ 'use strict';
+
+ /**
+ * Toggle the visabilty of the mobile navigation.
+ * @param {HTMLElement} el - The DOM element.
+ * @param options
+ * @constructor
+ */
+ function ToggleNav(el, options) {
+ this.el = $(el);
+ this.options = $.extend({}, ToggleNav.DEFAULTS_, options);
+ this.options.target = [this.options.navigation];
+
+ if (this.options.body) {this.options.target.push('body')}
+ if (this.options.dimmer) {this.options.target.push(this.options.dimmer)}
+
+ this.el.on('click', this.clickHandler_.bind(this));
+ }
+
+ /**
+ * ToggleNav Default Settings
+ * @type {{body: boolean, dimmer: string, navigation: string, toggleClass: string}}
+ * @private
+ */
+ ToggleNav.DEFAULTS_ = {
+ body: true,
+ dimmer: '.dac-nav-dimmer',
+ navigation: '[data-dac-nav]',
+ toggleClass: 'dac-nav-open'
+ };
+
+ /**
+ * The actual toggle logic.
+ * @param event
+ * @private
+ */
+ ToggleNav.prototype.clickHandler_ = function(event) {
+ event.preventDefault();
+ $(this.options.target.join(', ')).toggleClass(this.options.toggleClass);
+ };
+
+ /**
+ * jQuery plugin
+ * @param {object} options - Override default options.
+ */
+ $.fn.dacToggleMobileNav = function(options) {
+ return this.each(function() {
+ new ToggleNav(this, options);
+ });
+ };
+
+ /**
+ * Data Attribute API
+ */
+ $(window).on('load.aranja', function() {
+ $('[data-dac-toggle-nav]').each(function() {
+ $(this).dacToggleMobileNav($(this).data());
+ });
+ });
+})(jQuery);
+
+(function($) {
+ 'use strict';
+
+ /**
+ * Submit the newsletter form to a Google Form.
+ * @param {HTMLElement} el - The Form DOM element.
+ * @constructor
+ */
+ function NewsletterForm(el) {
+ this.el = $(el);
+ this.form = this.el.find('form');
+ $('<iframe/>').hide()
+ .attr('name', 'dac-newsletter-iframe')
+ .attr('src', '')
+ .insertBefore(this.form);
+ this.form.on('submit', this.submitHandler_.bind(this));
+ }
+
+ /**
+ * Milliseconds until modal has vanished after modal-close is triggered.
+ * @type {number}
+ * @private
+ */
+ NewsletterForm.CLOSE_DELAY_ = 300;
+
+ /**
+ * Switch view to display form after close.
+ * @private
+ */
+ NewsletterForm.prototype.closeHandler_ = function() {
+ setTimeout(function() {
+ this.el.trigger('swap-reset');
+ }.bind(this), NewsletterForm.CLOSE_DELAY_);
+ };
+
+ /**
+ * Reset the modal to initial state.
+ * @private
+ */
+ NewsletterForm.prototype.reset_ = function() {
+ this.form.trigger('reset');
+ this.el.one('modal-close', this.closeHandler_.bind(this));
+ };
+
+ /**
+ * Display a success view on submit.
+ * @private
+ */
+ NewsletterForm.prototype.submitHandler_ = function() {
+ this.el.one('swap-complete', this.reset_.bind(this));
+ this.el.trigger('swap-content');
+ };
+
+ /**
+ * jQuery plugin
+ * @param {object} options - Override default options.
+ */
+ $.fn.dacNewsletterForm = function(options) {
+ return this.each(function() {
+ new NewsletterForm(this, options);
+ });
+ };
+
+ /**
+ * Data Attribute API
+ */
+ $(document).on('ready.aranja', function() {
+ $('[data-newsletter]').each(function() {
+ $(this).dacNewsletterForm();
+ });
+ });
+})(jQuery);
+
+(function($) {
+ 'use strict';
+
+ /**
+ * Smoothly scroll to location on current page.
+ * @param el
+ * @param options
+ * @constructor
+ */
+ function ScrollButton(el, options) {
+ this.el = $(el);
+ this.target = $(this.el.attr('href'));
+ this.options = $.extend({}, ScrollButton.DEFAULTS_, options);
+
+ if (typeof this.options.offset === 'string') {
+ this.options.offset = $(this.options.offset).height();
+ }
+
+ this.el.on('click', this.clickHandler_.bind(this));
+ }
+
+ /**
+ * Default options
+ * @type {{duration: number, easing: string, offset: number, scrollContainer: string}}
+ * @private
+ */
+ ScrollButton.DEFAULTS_ = {
+ duration: 300,
+ easing: 'swing',
+ offset: 0,
+ scrollContainer: 'html, body'
+ };
+
+ /**
+ * Scroll logic
+ * @param event
+ * @private
+ */
+ ScrollButton.prototype.clickHandler_ = function(event) {
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
+ return;
+ }
+
+ event.preventDefault();
+
+ $(this.options.scrollContainer).animate({
+ scrollTop: this.target.offset().top - this.options.offset
+ }, this.options);
+ };
+
+ /**
+ * jQuery plugin
+ * @param {object} options - Override default options.
+ */
+ $.fn.dacScrollButton = function(options) {
+ return this.each(function() {
+ new ScrollButton(this, options);
+ });
+ };
+
+ /**
+ * Data Attribute API
+ */
+ $(document).on('ready.aranja', function() {
+ $('[data-scroll-button]').each(function() {
+ $(this).dacScrollButton($(this).data());
+ });
+ });
+})(jQuery);
+
+(function($) {
+ 'use strict';
+
+ /**
+ * A component that swaps two dynamic height views with an animation.
+ * Listens for the following events:
+ * * swap-content: triggers SwapContent.swap_()
+ * * swap-reset: triggers SwapContent.reset()
+ * @param el
+ * @param options
+ * @constructor
+ */
+ function SwapContent(el, options) {
+ this.el = $(el);
+ this.options = $.extend({}, SwapContent.DEFAULTS_, options);
+ this.containers = this.el.find(this.options.container);
+ this.initiallyActive = this.containers.children('.' + this.options.activeClass).eq(0);
+ this.el.on('swap-content', this.swap.bind(this));
+ this.el.on('swap-reset', this.reset.bind(this));
+ }
+
+ /**
+ * SwapContent's default settings.
+ * @type {{activeClass: string, container: string, transitionSpeed: number}}
+ * @private
+ */
+ SwapContent.DEFAULTS_ = {
+ activeClass: 'dac-active',
+ container: '[data-swap-container]',
+ transitionSpeed: 500
+ };
+
+ /**
+ * Returns container's visible height.
+ * @param container
+ * @returns {number}
+ */
+ SwapContent.prototype.currentHeight = function(container) {
+ return container.children('.' + this.options.activeClass).outerHeight();
+ };
+
+ /**
+ * Reset to show initial content
+ */
+ SwapContent.prototype.reset = function() {
+ if (!this.initiallyActive.hasClass(this.initiallyActive)) {
+ this.containers.children().toggleClass(this.options.activeClass);
+ }
+ };
+
+ /**
+ * Complete the swap.
+ */
+ SwapContent.prototype.complete = function() {
+ this.containers.height('auto');
+ this.containers.trigger('swap-complete');
+ };
+
+ /**
+ * Perform the swap of content.
+ */
+ SwapContent.prototype.swap = function() {
+ console.log(this.containers);
+ this.containers.each(function(index, container) {
+ container = $(container);
+ container.height(this.currentHeight(container)).children().toggleClass(this.options.activeClass);
+ container.animate({height: this.currentHeight(container)}, this.options.transitionSpeed,
+ this.complete.bind(this));
+ }.bind(this));
+ };
+
+ /**
+ * jQuery plugin
+ * @param {object} options - Override default options.
+ */
+ $.fn.dacSwapContent = function(options) {
+ return this.each(function() {
+ new SwapContent(this, options);
+ });
+ };
+
+ /**
+ * Data Attribute API
+ */
+ $(document).on('ready.aranja', function() {
+ $('[data-swap]').each(function() {
+ $(this).dacSwapContent($(this).data());
+ });
+ });
+})(jQuery);
+
+(function($) {
+ function Toggle(el) {
+ $(el).on('click.dac.togglesection', this.toggle);
+ }
+
+ Toggle.prototype.toggle = function() {
+ var $this = $(this);
+
+ var $parent = getParent($this);
+ var isExpanded = $parent.hasClass('is-expanded');
+
+ transitionMaxHeight($parent.find('.dac-toggle-content'), !isExpanded);
+ $parent.toggleClass('is-expanded');
+
+ return false;
+ };
+
+ function getParent($this) {
+ var selector = $this.attr('data-target');
+
+ if (!selector) {
+ selector = $this.attr('href');
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '');
+ }
+
+ var $parent = selector && $(selector);
+
+ $parent = $parent && $parent.length ? $parent : $this.closest('.dac-toggle');
+
+ return $parent.length ? $parent : $this.parent();
+ }
+
+ /**
+ * Runs a transition of max-height along with responsive styles which hide or expand the element.
+ * @param $el
+ * @param visible
+ */
+ function transitionMaxHeight($el, visible) {
+ var contentHeight = $el.prop('scrollHeight');
+ var targetHeight = visible ? contentHeight : 0;
+ var duration = $el.transitionDuration();
+
+ // If we're hiding, first set the maxHeight we're transitioning from.
+ if (!visible) {
+ $el.css('maxHeight', contentHeight + 'px')
+ .resolveStyles();
+ }
+
+ // Transition to new state
+ $el.css('maxHeight', targetHeight);
+
+ // Reset maxHeight to css value after transition.
+ setTimeout(function() {
+ $el.css('maxHeight', '');
+ }, duration);
+ }
+
+ // Utility to get the transition duration for the element.
+ $.fn.transitionDuration = function() {
+ var d = $(this).css('transitionDuration') || '0s';
+
+ return +(parseFloat(d) * (/ms/.test(d) ? 1 : 1000)).toFixed(0);
+ };
+
+ // jQuery plugin
+ $.fn.toggleSection = function(option) {
+ return this.each(function() {
+ var $this = $(this);
+ var data = $this.data('dac.togglesection');
+ if (!data) {$this.data('dac.togglesection', (data = new Toggle(this)));}
+ if (typeof option === 'string') {data[option].call($this);}
+ });
+ };
+
+ // Data api
+ $(document)
+ .on('click.toggle', '[data-toggle="section"]', Toggle.prototype.toggle);
+})(jQuery);
diff --git a/tools/droiddoc/templates-sdk/class.cs b/tools/droiddoc/templates-sdk/class.cs
index 7aa99f9..93fcf88 100644
--- a/tools/droiddoc/templates-sdk/class.cs
+++ b/tools/droiddoc/templates-sdk/class.cs
@@ -188,7 +188,6 @@
<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) ?>
@@ -558,7 +557,6 @@
<?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>
@@ -667,10 +665,9 @@
<?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 -->
+<?cs include:"footer.cs" ?>
</div><!-- end doc-content -->
<?cs include:"trailer.cs" ?>
diff --git a/tools/droiddoc/templates-sdk/classes.cs b/tools/droiddoc/templates-sdk/classes.cs
index 405892d..32966a0 100644
--- a/tools/droiddoc/templates-sdk/classes.cs
+++ b/tools/droiddoc/templates-sdk/classes.cs
@@ -43,11 +43,12 @@
</table>
<?cs /each ?>
-<?cs include:"footer.cs" ?>
</div><!-- end jd-content -->
+
+<?cs include:"footer.cs" ?>
</div><!-- end doc-content -->
<?cs include:"trailer.cs" ?>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs
index c09dc02..838ddbe 100644
--- a/tools/droiddoc/templates-sdk/components/masthead.cs
+++ b/tools/droiddoc/templates-sdk/components/masthead.cs
@@ -1,10 +1,7 @@
<?cs def:custom_masthead() ?>
-<?cs if:preview ?>
- <?cs call:preview_masthead() ?>
-<?cs else ?>
<a name="top"></a>
-<!-- dialog to prompt lang pref change when loaded from hardcoded URL
+<!-- dialog to prompt lang pref change when loaded from hardcoded URL
<div id="langMessage" style="display:none">
<div>
<div class="lang en">
@@ -52,254 +49,47 @@
<?cs if:!devsite ?><?cs # leave out the global header for devsite; it is in devsite template ?>
<!-- Header -->
<div id="header-wrapper">
- <div id="header"><?cs call:butter_bar() ?>
- <div class="wrap" id="header-wrap">
- <div class="col-3 logo">
- <a href="<?cs var:toroot ?>index.html">
- <img src="<?cs var:toroot ?>assets/images/dac_logo.png"
- srcset="<?cs var:toroot ?>assets/images/dac_logo@2x.png 2x"
- width="123" height="25" alt="Android Developers" />
- </a>
- <div class="btn-quicknav" id="btn-quicknav">
- <a href="#" class="arrow-inactive">Quicknav</a>
- <a href="#" class="arrow-active">Quicknav</a>
- </div>
- </div>
- <ul class="nav-x col-9">
- <li class="design">
- <a href="<?cs var:toroot ?>design/index.html"
- zh-tw-lang="設計"
- zh-cn-lang="设计"
- ru-lang="Проектирование"
- ko-lang="디자인"
- ja-lang="設計"
- es-lang="Diseñar"
- >Design</a></li>
- <li class="develop"><a href="<?cs var:toroot ?>develop/index.html"
- zh-tw-lang="開發"
- zh-cn-lang="开发"
- ru-lang="Разработка"
- ko-lang="개발"
- ja-lang="開発"
- es-lang="Desarrollar"
- >Develop</a></li>
- <li class="distribute last"><a href="<?cs var:toroot ?>distribute/<?cs
- if:android.whichdoc == "offline" ?>googleplay/<?cs /if ?>index.html"
- zh-tw-lang="發佈"
- zh-cn-lang="分发"
- ru-lang="Распространение"
- ko-lang="배포"
- ja-lang="配布"
- es-lang="Distribuir"
- >Distribute</a></li>
+ <div class="dac-header" id="header"><?cs call:butter_bar() ?>
+ <div class="dac-header-inner">
+ <a class="dac-nav-toggle" data-dac-toggle-nav href="javascript:;" title="Open navigation">
+ <span class="dac-nav-hamburger">
+ <span class="dac-nav-hamburger-top"></span>
+ <span class="dac-nav-hamburger-mid"></span>
+ <span class="dac-nav-hamburger-bot"></span>
+ </span>
+ </a>
+ <?cs if:ndk ?><a class="dac-header-logo" href="<?cs var:toroot ?>ndk/index.html">
+ <img class="dac-header-logo-image" src="<?cs var:toroot ?>assets/images/android_logo_ndk.png"
+ srcset="<?cs var:toroot ?>assets/images/android_logo_ndk@2x.png 2x"
+ width="32" height="36" alt="Android" /> NDK
+ </a><?cs else ?><a class="dac-header-logo" href="<?cs var:toroot ?>index.html">
+ <img class="dac-header-logo-image" src="<?cs var:toroot ?>assets/images/android_logo.png"
+ srcset="<?cs var:toroot ?>assets/images/android_logo@2x.png 2x"
+ width="32" height="36" alt="Android" /> Developers
+ </a><?cs /if ?>
+
+ <ul class="dac-header-crumbs">
+ <?cs # More <li> elements added here with javascript ?>
+ <?cs if:!section.landing ?><li class="dac-header-crumbs-item"><span class="dac-header-crumbs-link current <?cs
+ if:ndk ?>ndk<?cs /if ?>"><?cs var:page.title ?></a></li><?cs
+ /if ?>
</ul>
-
<?cs # ADD SEARCH AND MENU ?>
+ <?cs if:!ndk ?>
<?cs call:header_search_widget() ?>
-
-
- <!-- Expanded quicknav -->
- <div id="quicknav" class="col-13">
- <ul>
- <li class="about">
- <ul>
- <li><a href="<?cs var:toroot ?>about/index.html">About</a></li>
- <li><a href="<?cs var:toroot ?>wear/index.html">Wear</a></li>
- <li><a href="<?cs var:toroot ?>tv/index.html">TV</a></li>
- <li><a href="<?cs var:toroot ?>auto/index.html">Auto</a></li>
- </ul>
- </li>
- <li class="design">
- <ul>
- <li><a href="<?cs var:toroot ?>design/index.html">Get Started</a></li>
- <li><a href="<?cs var:toroot ?>design/devices.html">Devices</a></li>
- <li><a href="<?cs var:toroot ?>design/style/index.html">Style</a></li>
- <li><a href="<?cs var:toroot ?>design/patterns/index.html">Patterns</a></li>
- <li><a href="<?cs var:toroot ?>design/building-blocks/index.html">Building Blocks</a></li>
- <li><a href="<?cs var:toroot ?>design/downloads/index.html">Downloads</a></li>
- <li><a href="<?cs var:toroot ?>design/videos/index.html">Videos</a></li>
- </ul>
- </li>
- <li class="develop">
- <ul>
- <li><a href="<?cs var:toroot ?>training/index.html"
- zh-tw-lang="訓練課程"
- zh-cn-lang="培训"
- ru-lang="Курсы"
- ko-lang="교육"
- ja-lang="トレーニング"
- es-lang="Capacitación"
- >Training</a></li>
- <li><a href="<?cs var:toroot ?>guide/index.html"
- zh-tw-lang="API 指南"
- zh-cn-lang="API 指南"
- ru-lang="Руководства по API"
- ko-lang="API 가이드"
- ja-lang="API ガイド"
- es-lang="Guías de la API"
- >API Guides</a></li>
- <li><a href="<?cs var:toroot ?>reference/packages.html"
- zh-tw-lang="參考資源"
- zh-cn-lang="参考"
- ru-lang="Справочник"
- ko-lang="참조문서"
- ja-lang="リファレンス"
- es-lang="Referencia"
- >Reference</a></li>
- <li><a href="<?cs var:toroot ?>sdk/index.html"
- zh-tw-lang="相關工具"
- zh-cn-lang="工具"
- ru-lang="Инструменты"
- ko-lang="도구"
- ja-lang="ツール"
- es-lang="Herramientas"
- >Tools</a>
- </li>
- <li><a href="<?cs var:toroot ?>google/index.html">Google Services</a>
- </li>
- <?cs if:android.hasSamples ?>
- <li><a href="<?cs var:toroot ?>samples/index.html">Samples</a>
- </li>
- <?cs /if ?>
- </ul>
- </li>
- <li class="distribute last">
- <ul>
- <li><a href="<?cs var:toroot ?>distribute/googleplay/index.html">Google Play</a></li>
- <li><a href="<?cs var:toroot ?>distribute/essentials/index.html">Essentials</a></li>
- <li><a href="<?cs var:toroot ?>distribute/users/index.html">Get Users</a></li>
- <li><a href="<?cs var:toroot ?>distribute/engage/index.html">Engage & Retain</a></li>
- <li><a href="<?cs var:toroot ?>distribute/monetize/index.html">Monetize</a></li>
- <li><a href="<?cs var:toroot ?>distribute/analyze/index.html">Analyze</a></li>
- <li><a href="<?cs var:toroot ?>distribute/tools/index.html">Tools & Reference</a></li>
- <li><a href="<?cs var:toroot ?>distribute/stories/index.html">Developer Stories</a></li>
- </ul>
- </li>
- </ul>
- </div><!-- /Expanded quicknav -->
- </div><!-- end header-wrap.wrap -->
- </div><!-- end header -->
-
- <?cs if:about || wear || tv || auto ?>
- <!-- Secondary x-nav -->
- <div id="nav-x">
- <div class="wrap">
- <ul class="nav-x col-9 about" style="width:100%">
- <li class="about"><a href="<?cs var:toroot ?>about/index.html"
- >About</a></li>
- <li class="wear"><a href="<?cs var:toroot ?>wear/index.html"
- >Wear</a></li>
- <li class="tv"><a href="<?cs var:toroot ?>tv/index.html"
- >TV</a></li>
- <li class="auto"><a href="<?cs var:toroot ?>auto/index.html"
- >Auto</a></li>
- </ul>
- </div>
- </div>
- <!-- /Sendondary x-nav ABOUT -->
-
-
-
- <?cs elif:training || guide || reference || tools || develop || google || samples ?>
- <!-- Secondary x-nav -->
- <div id="nav-x">
- <div class="wrap" style="position:relative;z-index:1">
-
- <?cs if:reference ?>
- <?cs # HIDE HELPOUTS RECRUIT BANNER
- <a id="helpoutsLink" class="resource resource-card resource-card-6x2x3 resource-card-6x2 helpouts-card"
- href="http://helpouts.google.com/partner/landing/provider/googledevelopers?utm_source=dac&utm_medium=banner&utm_campaign=android_provider_banner3" target="_blank">
- <div class="card-bg helpouts-card-bg"></div>
- <div class="card-info">
- <div class="helpouts-description">
- <div class="text">Help Android Wear and TV developers<br/>
- <span id="helpoutsLinkText" class="link-color"
- style="display:block;padding-top:5px;text-align:right">Learn more</span>
- </div>
- </div>
- </div>
- </a>
- # END HIDE HELPOUTS ?>
<?cs /if ?>
- <ul class="nav-x col-9 develop" style="width:100%">
- <li class="training"><a href="<?cs var:toroot ?>training/index.html"
- zh-tw-lang="訓練課程"
- zh-cn-lang="培训"
- ru-lang="Курсы"
- ko-lang="교육"
- ja-lang="トレーニング"
- es-lang="Capacitación"
- >Training</a></li>
- <li class="guide"><a href="<?cs var:toroot ?>guide/index.html"
- zh-tw-lang="API 指南"
- zh-cn-lang="API 指南"
- ru-lang="Руководства по API"
- ko-lang="API 가이드"
- ja-lang="API ガイド"
- es-lang="Guías de la API"
- >API Guides</a></li>
- <li class="reference"><a href="<?cs var:toroot ?>reference/packages.html"
- zh-tw-lang="參考資源"
- zh-cn-lang="参考"
- ru-lang="Справочник"
- ko-lang="참조문서"
- ja-lang="リファレンス"
- es-lang="Referencia"
- >Reference</a></li>
- <li class="tools"><a href="<?cs var:toroot ?>sdk/index.html"
- zh-tw-lang="相關工具"
- zh-cn-lang="工具"
- ru-lang="Инструменты"
- ko-lang="도구"
- ja-lang="ツール"
- es-lang="Herramientas"
- >Tools</a></li>
- <li class="google"><a href="<?cs var:toroot ?>google/index.html"
- >Google Services</a>
- </li>
- <?cs if:android.hasSamples ?>
- <li class="samples"><a href="<?cs var:toroot ?>samples/index.html"
- >Samples</a>
- </li>
- <?cs /if ?>
- </ul>
- </div>
- </div>
- <!-- /Sendondary x-nav DEVELOP -->
+ <?cs if:ndk ?><a class="dac-header-console-btn" href="http://developer.android.com">
+ <span class="dac-visible-desktop-inline">Back to Android Developers</span>
+ </a><?cs else ?><a class="dac-header-console-btn" href="https://play.google.com/apps/publish/">
+ <span class="dac-sprite dac-google-play"></span>
+ <span class="dac-visible-desktop-inline">Developer</span>
+ Console
+ </a><?cs /if ?>
- <?cs elif:distribute || googleplay || essentials || users || engage || monetize || analyze || disttools || stories ?>
- <!-- Secondary distribute x-nav -->
- <div id="nav-x">
- <div class="wrap">
- <ul class="nav-x distribute">
- <li class="googleplay"><a href="<?cs var:toroot ?>distribute/googleplay/index.html"
- >Google Play</a></li>
- <li class="essentials"><a href="<?cs var:toroot ?>distribute/essentials/index.html"
- >Essentials</a></li>
- <li class="users"><a href="<?cs var:toroot ?>distribute/users/index.html"
- >Get Users</a></li>
- <li class="engage"><a href="<?cs var:toroot ?>distribute/engage/index.html"
- >Engage & Retain</a></li>
- <li class="monetize"><a href="<?cs var:toroot ?>distribute/monetize/index.html"
- >Monetize</a>
- </li>
- <li class="analyze"><a href="<?cs var:toroot ?>distribute/analyze/index.html"
- >Analyze</a>
- </li>
- <li class="disttools"><a href="<?cs var:toroot ?>distribute/tools/index.html"
- >Tools</a>
- </li>
- <li class="stories"><a href="<?cs var:toroot ?>distribute/stories/index.html"
- >Stories</a>
- </li>
- </ul>
- <a href="https://play.google.com/apps/publish/" class="developer-console-btn">Developer Console</a>
- </div> <!-- /Secondary distribute x-nav -->
- </div>
- <!-- /Sendondary x-nav DISTRIBUTE -->
- <?cs /if ?>
+ </div><!-- end header-wrap.wrap -->
+ </div><!-- end header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
@@ -307,66 +97,180 @@
</div>
</div> <!--end header-wrapper -->
- <div id="sticky-header">
- <div>
- <a class="logo" href="#top"></a>
- <a class="top" href="#top"></a>
- <ul class="breadcrumb">
- <?cs # More <li> elements added here with javascript ?>
- <?cs if:!section.landing ?><li class="current"><?cs var:page.title ?></li><?cs
- /if ?>
- </ul>
- </div>
- </div>
+ <?cs if:ndk ?>
+ <!-- NDK Navigation-->
+ <nav class="dac-nav">
+ <div class="dac-nav-dimmer" data-dac-toggle-nav></div>
-<?cs /if ?><?cs # end if/else !devsite ?>
-<?cs /if ?><?cs # end if/else preview ?><?cs
-/def ?>
-
-<?cs def:preview_masthead() ?>
-<a name="top"></a>
-
-
-<!-- Header -->
-<div id="header-wrapper">
- <div id="header"><?cs call:butter_bar() ?>
- <div class="wrap" id="header-wrap">
- <div class="col_3 logo landing-logo" style="width:240px">
- <a href="<?cs var:toroot ?>preview/index.html">
- <img src="<?cs var:toroot ?>assets/images/android.png" height="25" alt="Android"
- style="margin:-3px 0 0" />
+ <ul class="dac-nav-list" data-dac-nav>
+ <li class="dac-nav-item dac-nav-head">
+ <a class="dac-nav-link dac-nav-logo" data-dac-toggle-nav href="javascript:;" title="Close navigation">
+ <img class="dac-logo-image" src="<?cs var:toroot ?>assets/images/android_logo_ndk.png"
+ srcset="<?cs var:toroot ?>assets/images/android_logo_ndk@2x.png 2x"
+ width="32" height="36" alt="Android" /> NDK
</a>
- </div>
- <div class="col-8" style="margin:0"><h1 style="margin: 4px 0 0 0px;padding:0;line-height:16px;
-color:#666;font-weight:100;font-size:27px;">L Developer Preview</h1></div>
-
- <?cs # ADD SEARCH AND MENU ?>
- <?cs call:header_search_widget() ?>
-
- </div><!-- end header-wrap -->
- </div><!-- /Header -->
-
-
- <div id="searchResults" class="wrap" style="display:none;">
- <h2 id="searchTitle">Results</h2>
- <div id="leftSearchControl" class="search-control">Loading...</div>
- </div>
-</div> <!--end header-wrapper -->
-
-<div id="sticky-header">
- <div>
- <a class="logo" href="#top"></a>
- <a class="top" href="#top"></a>
- <ul class="breadcrumb">
- <?cs # More <li> elements added here with javascript ?>
- <?cs if:!section.landing ?><li class="current"><?cs var:page.title ?></li><?cs
- /if ?>
+ </li>
+ <li class="dac-nav-item guides">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>ndk/guides/index.html"
+ zh-tw-lang="API 指南"
+ zh-cn-lang="API 指南"
+ ru-lang="Руководства по API"
+ ko-lang="API 가이드"
+ ja-lang="API ガイド"
+ es-lang="Guías de la API">Guides</a>
+ </li>
+ <li class="dac-nav-item reference">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>ndk/reference/index.html"
+ zh-tw-lang="參考資源"
+ zh-cn-lang="参考"
+ ru-lang="Справочник"
+ ko-lang="참조문서"
+ ja-lang="リファレンス"
+ es-lang="Referencia">Reference</a>
+ </li>
+ <li class="dac-nav-item samples">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>ndk/samples/index.html"
+ >Samples</a>
+ </li>
+ <li class="dac-nav-item downloads">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>ndk/downloads/index.html"
+ >Downloads</a>
+ </li>
</ul>
- </div>
-</div>
+ </nav>
+ <!-- end NDK navigation-->
+ <?cs else ?>
+ <!-- Navigation-->
+ <nav class="dac-nav">
+ <div class="dac-nav-dimmer" data-dac-toggle-nav></div>
- <?cs
-/def ?>
+ <ul class="dac-nav-list" data-dac-nav>
+ <li class="dac-nav-item dac-nav-head">
+ <a class="dac-nav-link dac-nav-logo" data-dac-toggle-nav href="javascript:;" title="Close navigation">
+ <img class="dac-logo-image" src="<?cs var:toroot ?>assets/images/android_logo.png"
+ srcset="<?cs var:toroot ?>assets/images/android_logo@2x.png 2x"
+ width="32" height="36" alt="Android" /> Developers
+ </a>
+ </li>
+ <li class="dac-nav-item home">
+ <a class="dac-nav-link dac-visible-mobile-block" href="<?cs var:toroot ?>index.html">Home</a>
+ <ul class="dac-nav-secondary about">
+ <li class="dac-nav-item about">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>about/index.html">Android</a>
+ </li>
+ <li class="dac-nav-item wear">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>wear/index.html">Wear</a>
+ </li>
+ <li class="dac-nav-item tv">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>tv/index.html">TV</a>
+ </li>
+ <li class="dac-nav-item auto">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>auto/index.html">Auto</a>
+ </li>
+ </ul>
+ </li>
+ <li class="dac-nav-item design">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>design/index.html"
+ zh-tw-lang="設計"
+ zh-cn-lang="设计"
+ ru-lang="Проектирование"
+ ko-lang="디자인"
+ ja-lang="設計"
+ es-lang="Diseñar">Design</a>
+ </li>
+ <li class="dac-nav-item develop">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>develop/index.html"
+ zh-tw-lang="開發"
+ zh-cn-lang="开发"
+ ru-lang="Разработка"
+ ko-lang="개발"
+ ja-lang="開発"
+ es-lang="Desarrollar">Develop</a>
+ <ul class="dac-nav-secondary develop">
+ <li class="dac-nav-item training">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>training/index.html"
+ zh-tw-lang="訓練課程"
+ zh-cn-lang="培训"
+ ru-lang="Курсы"
+ ko-lang="교육"
+ ja-lang="トレーニング"
+ es-lang="Capacitación">Training</a>
+ </li>
+ <li class="dac-nav-item guide">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>guide/index.html"
+ zh-tw-lang="API 指南"
+ zh-cn-lang="API 指南"
+ ru-lang="Руководства по API"
+ ko-lang="API 가이드"
+ ja-lang="API ガイド"
+ es-lang="Guías de la API">API Guides</a>
+ </li>
+ <li class="dac-nav-item reference">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>reference/packages.html"
+ zh-tw-lang="參考資源"
+ zh-cn-lang="参考"
+ ru-lang="Справочник"
+ ko-lang="참조문서"
+ ja-lang="リファレンス"
+ es-lang="Referencia">Reference</a>
+ </li>
+ <li class="dac-nav-item tools">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>sdk/index.html"
+ zh-tw-lang="相關工具"
+ zh-cn-lang="工具"
+ ru-lang="Инструменты"
+ ko-lang="도구"
+ ja-lang="ツール"
+ es-lang="Herramientas">Tools</a></li>
+ <li class="dac-nav-item google">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>google/index.html">Google Services</a>
+ </li>
+ <?cs if:android.hasSamples ?>
+ <li class="dac-nav-item samples">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>samples/index.html">Samples</a>
+ </li>
+ <?cs /if ?>
+ <li class="dac-nav-item preview">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>preview/index.html">Preview</a>
+ </li>
+ </ul>
+ </li>
+ <li class="dac-nav-item distribute">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/<?cs if:android.whichdoc == 'offline' ?>googleplay/<?cs /if ?>index.html"
+ zh-tw-lang="發佈"
+ zh-cn-lang="分发"
+ ru-lang="Распространение"
+ ko-lang="배포"
+ ja-lang="配布"
+ es-lang="Distribuir">Distribute</a>
+ <ul class="dac-nav-secondary distribute">
+ <li class="dac-nav-item googleplay">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/googleplay/index.html">Google Play</a></li>
+ <li class="dac-nav-item essentials">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/essentials/index.html">Essentials</a></li>
+ <li class="dac-nav-item users">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/users/index.html">Get Users</a></li>
+ <li class="dac-nav-item engage">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/engage/index.html">Engage & Retain</a></li>
+ <li class="dac-nav-item monetize">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/monetize/index.html">Earn</a>
+ </li>
+ <li class="dac-nav-item analyze">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/analyze/index.html">Analyze</a>
+ </li>
+ <li class="dac-nav-item stories">
+ <a class="dac-nav-link" href="<?cs var:toroot ?>distribute/stories/index.html">Stories</a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </nav>
+ <!-- end navigation-->
+ <?cs /if ?>
+<?cs /if ?><?cs # end if/else !devsite ?>
+
+<?cs
+/def ?><?cs # end custom_masthead() ?>
<?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?>
@@ -383,6 +287,6 @@
</div>
</div>
-?>
+?>
<?cs /def ?>
diff --git a/tools/droiddoc/templates-sdk/customizations.cs b/tools/droiddoc/templates-sdk/customizations.cs
index c8c88cc..aaef8ed 100644
--- a/tools/droiddoc/templates-sdk/customizations.cs
+++ b/tools/droiddoc/templates-sdk/customizations.cs
@@ -1,33 +1,41 @@
-<?cs
+<?cs
+def:mobile_nav_toggle() ?>
+ <div class="dac-visible-mobile-block" data-toggle="section">
+ <span class="dac-toggle-expand dac-devdoc-toggle"><i class="dac-sprite dac-expand-more-black"></i> Show navigation</span>
+ <span class="dac-toggle-collapse dac-devdoc-toggle" data-toggle-section><i class="dac-sprite dac-expand-less-black"></i> Hide navigation</span>
+ </div>
+<?cs /def ?><?cs
+
def:fullpage() ?>
<div id="body-content">
+ <div>
<?cs /def ?>
<?cs
def:sdk_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-<?cs
- include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<?cs /def ?><?cs
def:no_nav() ?>
<div class="wrap clearfix" id="body-content">
+ <div>
<?cs /def ?><?cs
def:tools_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-<?cs
- include:"../../../../frameworks/base/docs/html/tools/tools_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/tools/tools_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -38,15 +46,13 @@
<?cs /def ?>
<?cs
def:training_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-
-<?cs
- include:"../../../../frameworks/base/docs/html/training/training_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/training/training_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -57,10 +63,30 @@
<?cs /def ?><?cs
def:googleplay_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/googleplay/googleplay_toc.cs" ?>
+ </div>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?><?cs
+
+def:preview_nav() ?>
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -71,10 +97,13 @@
<?cs /def ?><?cs
def:essentials_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/essentials/essentials_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -85,10 +114,13 @@
<?cs /def ?><?cs
def:users_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/users/users_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -99,10 +131,13 @@
<?cs /def ?><?cs
def:engage_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/engage/engage_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -113,10 +148,13 @@
<?cs /def ?><?cs
def:analyze_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/analyze/analyze_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -127,10 +165,13 @@
<?cs /def ?><?cs
def:monetize_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/monetize/monetize_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -141,10 +182,13 @@
<?cs /def ?><?cs
def:disttools_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/tools/disttools_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -155,10 +199,13 @@
<?cs /def ?><?cs
def:stories_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/distribute/stories/stories_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -169,14 +216,13 @@
<?cs /def ?><?cs
def:guide_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-<?cs
- include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -187,15 +233,13 @@
<?cs /def ?>
<?cs
def:design_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-
-<?cs
- include:"../../../../frameworks/base/docs/html/design/design_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/design/design_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -206,14 +250,13 @@
<?cs /def ?>
<?cs
def:distribute_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-<?cs
- include:"../../../../frameworks/base/docs/html/distribute/distribute_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/distribute/distribute_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -225,13 +268,13 @@
<?cs
def:samples_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-<?cs
- include:"../../../../frameworks/base/docs/html/samples/samples_toc.cs" ?>
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/samples/samples_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
@@ -244,14 +287,13 @@
<?cs
def:google_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-<?cs
- include:"../../../../frameworks/base/docs/html/google/google_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/google/google_toc.cs" ?>
+ </div>
</div>
<script type="text/javascript">
showGoogleRefTree();
@@ -267,14 +309,13 @@
<?cs
def:about_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-<?cs
- include:"../../../../frameworks/base/docs/html/about/about_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/about/about_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -287,14 +328,13 @@
<?cs
def:wear_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-
-<?cs
- include:"../../../../frameworks/base/docs/html/wear/wear_toc.cs" ?>
-
-
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs include:"../../../../frameworks/base/docs/html/wear/wear_toc.cs" ?>
+ </div>
</div>
</div> <!-- end side-nav -->
<script>
@@ -304,29 +344,14 @@
</script>
<?cs /def ?>
-<?cs
-def:preview_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
- <?cs
- include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
- </div>
- </div> <!-- end side-nav -->
- <script>
- $(document).ready(function() {
- scrollIntoView("devdoc-nav");
- });
- </script>
-<?cs /def ?>
-<?cs # The default side navigation for the reference docs ?><?cs
+<?cs # The default side navigation for the reference docs ?><?cs
def:default_left_nav() ?>
<?cs if:reference.gcm || reference.gms ?>
<?cs call:google_nav() ?>
<?cs else ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-4 dac-hidden-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav">
<div id="api-nav-header">
<div id="api-level-toggle">
@@ -341,15 +366,15 @@
<div id="api-nav-title">Android APIs</div>
</div><!-- end nav header -->
<script>
- var SINCE_DATA = [ <?cs
- each:since = since ?>'<?cs
- var:since.name ?>'<?cs
+ var SINCE_DATA = [ <?cs
+ each:since = since ?>'<?cs
+ var:since.name ?>'<?cs
if:!last(since) ?>, <?cs /if ?><?cs
- /each
+ /each
?> ];
buildApiLevelSelector();
</script>
-
+
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
@@ -364,7 +389,7 @@
<div id="classes-nav" class="scroll-pane">
-<?cs
+<?cs
if:subcount(class.package) ?>
<ul>
<?cs call:list("Annotations", class.package.annotations) ?>
@@ -373,7 +398,7 @@
<?cs call:list("Enums", class.package.enums) ?>
<?cs call:list("Exceptions", class.package.exceptions) ?>
<?cs call:list("Errors", class.package.errors) ?>
- </ul><?cs
+ </ul><?cs
elif:subcount(package) ?>
<ul>
<?cs call:class_link_list("Annotations", package.annotations) ?>
@@ -382,11 +407,11 @@
<?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
+ </ul><?cs
else ?>
- <p style="padding:10px">Select a package to view its members</p><?cs
+ <p style="padding:10px">Select a package to view its members</p><?cs
/if ?><br/>
-
+
</div><!-- end classes -->
</div><!-- end nav-panels -->
@@ -427,84 +452,53 @@
});
</script>
<?cs /if ?>
- <?cs
+ <?cs
/def ?>
+<?cs
+def:ndk_nav() ?>
+ <div class="wrap clearfix" id="body-content"><div class="cols">
+ <div class="col-3 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <?cs call:mobile_nav_toggle() ?>
+ <div class="dac-toggle-content" id="devdoc-nav">
+ <div class="scroll-pane">
+<?cs
+if:guide ?><?cs include:"../../../../frameworks/base/docs/html/ndk/guides/guides_toc.cs" ?><?cs
+elif:reference ?><?cs include:"../../../../frameworks/base/docs/html/ndk/reference/reference_toc.cs" ?><?cs
+elif:downloads ?><?cs include:"../../../../frameworks/base/docs/html/ndk/downloads/downloads_toc.cs" ?><?cs
+elif:samples ?><?cs include:"../../../../frameworks/base/docs/html/ndk/samples/samples_toc.cs" ?><?cs
+/if ?>
+ </div>
+ </div>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
<?cs
def:header_search_widget() ?>
-<div class="menu-container">
- <div class="moremenu">
- <div id="more-btn"></div>
- </div>
- <div class="morehover" id="moremenu">
- <div class="top"></div>
- <div class="mid">
- <div class="header">Links</div>
- <ul>
- <li><a href="https://play.google.com/apps/publish/" target="_googleplay">Google Play Developer Console</a></li>
- <li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
- <li><a href="<?cs var:toroot ?>about/index.html">About Android</a></li>
- </ul>
- <div class="header">Android Sites</div>
- <ul>
- <li><a href="http://www.android.com">Android.com</a></li>
- <li class="active"><a>Android Developers</a></li>
- <li><a href="http://source.android.com">Android Open Source Project</a></li>
- </ul>
-
- <?cs # Include language switcher only in online docs ?>
- <?cs if:android.whichdoc == "online" ?>
- <div class="header">Language</div>
- <div id="language" class="locales">
- <select name="language" onChange="changeLangPref(this.value, true)">
- <option value="en">English</option>
- <option value="es">Español</option>
- <option value="ja">日本語</option>
- <option value="ko">한국어</option>
- <option value="ru">Русский</option>
- <option value="zh-cn">中文(简体)</option>
- <option value="zh-tw">中文(繁體)</option>
- </select>
- </div>
- <script type="text/javascript">
- <!--
- loadLangPref();
- //-->
- </script>
- <?cs /if ?>
- <?cs # End of lang switcher ?>
- <br class="clearfix" />
- </div><!-- end 'mid' -->
- <div class="bottom"></div>
- </div><!-- end 'moremenu' -->
-
- <div class="search" id="search-container">
- <div class="search-inner">
- <div id="search-btn"></div>
- <div class="left"></div>
- <form onsubmit="return submit_search()">
+ <div class="dac-header-search" id="search-container">
+ <div class="dac-header-search-inner">
+ <div class="dac-sprite dac-search dac-header-search-btn" id="search-btn"></div>
+ <form class="dac-header-search-form" onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
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 ?>')" />
+ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')"
+ class="dac-header-search-input" placeholder="Search" />
+ <a class="dac-header-search-close hide" id="search-close">close</a>
</form>
- <div class="right"></div>
- <a class="close hide">close</a>
- <div class="left"></div>
- <div class="right"></div>
- </div><!-- end search-inner -->
- </div><!-- end search-container -->
+ </div><!-- end dac-header-search-inner -->
+ </div><!-- end dac-header-search -->
- <div class="search_filtered_wrapper reference">
+ <div class="search_filtered_wrapper">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
- </div>
-
- <div class="search_filtered_wrapper docs">
- <div class="suggest-card dummy no-display"> </div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
@@ -524,87 +518,98 @@
</ul>
</div>
</div>
-</div><!-- end menu-container (search and menu widget) -->
<?cs /def ?>
-
-<?cs
+<?cs
def:custom_left_nav() ?><?cs
- if:fullpage ?><?cs
- call:fullpage() ?><?cs
- elif:nonavpage ?><?cs
- call:no_nav() ?><?cs
- elif:guide ?><?cs
- call:guide_nav() ?><?cs
- elif:design ?><?cs
- call:design_nav() ?><?cs
- elif:training ?><?cs
- call:training_nav() ?><?cs
- elif:tools ?><?cs
- call:tools_nav() ?><?cs
- elif:google ?><?cs
- call:google_nav() ?><?cs
- elif:samples ?><?cs
- call:samples_nav() ?><?cs
- elif:distribute ?><?cs
- if:googleplay ?><?cs
- call:googleplay_nav() ?><?cs
- elif:essentials ?><?cs
- call:essentials_nav() ?><?cs
- elif:users ?><?cs
- call:users_nav() ?><?cs
- elif:engage ?><?cs
- call:engage_nav() ?><?cs
- elif:monetize ?><?cs
- call:monetize_nav() ?><?cs
- elif:analyze ?><?cs
- call:analyze_nav() ?><?cs
- elif:disttools ?><?cs
- call:disttools_nav() ?><?cs
- elif:stories ?><?cs
- call:stories_nav() ?><?cs
+ if:ndk ?><?cs
+ if:fullpage ?><?cs
+ call:fullpage() ?><?cs
+ elif:nonavpage ?><?cs
+ call:no_nav() ?><?cs
+ elif:guide || reference || samples || downloads ?><?cs
+ call:ndk_nav() ?><?cs
+ else ?><?cs
+ call:default_left_nav() ?> <?cs
/if ?><?cs
- elif:about ?><?cs
- call:about_nav() ?><?cs
- elif:distribute ?><?cs
- call:distribute_nav() ?><?cs
- elif:wear ?><?cs
- call:wear_nav() ?><?cs
- elif:preview ?><?cs
- call:preview_nav() ?><?cs
else ?><?cs
- call:default_left_nav() ?> <?cs
+ if:fullpage ?><?cs
+ call:fullpage() ?><?cs
+ elif:nonavpage ?><?cs
+ call:no_nav() ?><?cs
+ elif:guide ?><?cs
+ call:guide_nav() ?><?cs
+ elif:design ?><?cs
+ call:design_nav() ?><?cs
+ elif:training ?><?cs
+ call:training_nav() ?><?cs
+ elif:tools ?><?cs
+ call:tools_nav() ?><?cs
+ elif:google ?><?cs
+ call:google_nav() ?><?cs
+ elif:samples ?><?cs
+ call:samples_nav() ?><?cs
+ elif:preview ?><?cs
+ call:preview_nav() ?><?cs
+ elif:distribute ?><?cs
+ if:googleplay ?><?cs
+ call:googleplay_nav() ?><?cs
+ elif:essentials ?><?cs
+ call:essentials_nav() ?><?cs
+ elif:users ?><?cs
+ call:users_nav() ?><?cs
+ elif:engage ?><?cs
+ call:engage_nav() ?><?cs
+ elif:monetize ?><?cs
+ call:monetize_nav() ?><?cs
+ elif:analyze ?><?cs
+ call:analyze_nav() ?><?cs
+ elif:disttools ?><?cs
+ call:disttools_nav() ?><?cs
+ elif:stories ?><?cs
+ call:stories_nav() ?><?cs
+ /if ?><?cs
+ elif:about ?><?cs
+ call:about_nav() ?><?cs
+ elif:distribute ?><?cs
+ call:distribute_nav() ?><?cs
+ elif:wear ?><?cs
+ call:wear_nav() ?><?cs
+ else ?><?cs
+ call:default_left_nav() ?> <?cs
+ /if ?><?cs
/if ?><?cs
/def ?>
-<?cs # appears at the bottom of every page ?><?cs
+<?cs # appears at the bottom of every page ?><?cs
def:custom_cc_copyright() ?>
- Except as noted, this content is
+ 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
+ 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
+<?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>.
+ 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
+ Content License</a>.<?cs
/def ?>
-<?cs
+<?cs
def:custom_footerlinks() ?>
- <p>
- <a href="<?cs var:toroot ?>about/index.html">About Android</a> |
- <a href="<?cs var:toroot ?>legal.html">Legal</a> |
- <a href="<?cs var:toroot ?>support.html">Support</a>
- </p><?cs
+ <a href="<?cs var:toroot ?>about/index.html">About Android</a>
+ <a href="<?cs var:toroot ?>auto/index.html">Auto</a>
+ <a href="<?cs var:toroot ?>tv/index.html">TV</a>
+ <a href="<?cs var:toroot ?>wear/index.html">Wear</a>
+ <a href="<?cs var:toroot ?>legal.html">Legal</a>
+ <?cs
/def ?>
-<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
+<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
def:custom_buildinfo() ?><?cs
if:!google && !reference.gcm && !reference.gms ?>
Android <?cs var:sdk.version ?> r<?cs var:sdk.rel.id ?> — <?cs
diff --git a/tools/droiddoc/templates-sdk/designpage.cs b/tools/droiddoc/templates-sdk/designpage.cs
index 2be179d..b945a1c 100644
--- a/tools/droiddoc/templates-sdk/designpage.cs
+++ b/tools/droiddoc/templates-sdk/designpage.cs
@@ -37,14 +37,12 @@
<?cs if:header.hide ?>
<?cs else ?>
-<div class="layout-content-row content-header <?cs if:header.justLinks ?>just-links<?cs /if ?>">
- <div class="layout-content-col span-9">
+<div class="content-header <?cs if:header.justLinks ?>just-links<?cs /if ?>">
<?cs if:header.justLinks ?>
<?cs elif:header.title ?><h2><?cs var:header.title ?></h2>
<?cs else ?><h2><?cs var:page.title ?></h2>
<?cs /if ?>
- </div>
- <div class="paging-links layout-content-col span-4" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div class="paging-links" itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="#" class="prev-page-link">Previous</a>
<a href="#" class="next-page-link">Next</a>
</div>
@@ -55,9 +53,9 @@
<?cs if:footer.hide ?>
<?cs else ?>
-<div class="layout-content-row content-footer" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div class="paging-links layout-content-col span-9"> </div>
- <div class="paging-links layout-content-col span-4">
+<div class="cols content-footer" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div class="paging-links col-9"> </div>
+ <div class="paging-links col-4">
<a href="#" class="prev-page-link">Previous</a>
<a href="#" class="next-page-link">Next</a>
</div>
diff --git a/tools/droiddoc/templates-sdk/docpage.cs b/tools/droiddoc/templates-sdk/docpage.cs
index d064222..668105b 100644
--- a/tools/droiddoc/templates-sdk/docpage.cs
+++ b/tools/droiddoc/templates-sdk/docpage.cs
@@ -4,31 +4,39 @@
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation
+<?cs # add document classes for navigation header selection (and other stuff) ?>
<?cs
-if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?><?cs
- if:(guide||develop||training||reference||tools||sdk||samples) ?>develop<?cs
+ if:(google || reference.gms || reference.gcm) ?>google <?cs /if ?><?cs
+ if:ndk ?>ndk<?cs
if:guide ?> guide<?cs /if ?><?cs
if:samples ?> samples<?cs /if ?><?cs
- elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories)
- ?>distribute<?cs
- if:googleplay ?> googleplay<?cs /if ?><?cs
- if:essentials ?> essentials<?cs /if ?><?cs
- if:users ?> users<?cs /if ?><?cs
- if:engage ?> engage<?cs /if ?><?cs
- if:monetize ?> monetize<?cs /if ?><?cs
- if:disttools ?> disttools<?cs /if ?><?cs
- if:stories ?> stories<?cs /if ?><?cs
- elif:(about||wear||tv||auto) ?>about<?cs
- elif:design ?>design<?cs
-/if ?><?cs
-if:page.trainingcourse ?> trainingcourse<?cs
+ if:reference ?> reference<?cs /if ?><?cs
+ if:downloads ?> downloads<?cs /if ?><?cs
+ else ?><?cs
+ if:(guide||develop||training||reference||tools||sdk||google||samples||preview) ?>develop<?cs
+ if:guide ?> guide<?cs /if ?><?cs
+ if:samples ?> samples<?cs /if ?><?cs
+ if:preview ?> preview<?cs /if ?><?cs
+ elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?>distribute<?cs
+ if:googleplay ?> googleplay<?cs /if ?><?cs
+ if:essentials ?> essentials<?cs /if ?><?cs
+ if:users ?> users<?cs /if ?><?cs
+ if:engage ?> engage<?cs /if ?><?cs
+ if:monetize ?> monetize<?cs /if ?><?cs
+ if:disttools ?> disttools<?cs /if ?><?cs
+ if:stories ?> stories<?cs /if ?><?cs
+ if:analyze ?> analyze<?cs /if ?><?cs
+ elif:(about||wear||tv||auto) ?>about<?cs
+ elif:design ?>design<?cs
+ /if ?><?cs
+ if:page.trainingcourse ?> trainingcourse<?cs /if ?><?cs
/if ?>" itemscope itemtype="http://schema.org/Article"><?cs
include:"header.cs" ?>
<div <?cs
if:fullpage
?>class="fullpage"<?cs
- elif:(design||tools||about||sdk||googleplay||essentials||users||monetize||disttools) && !nonavpage
+ elif:(design||tools||about||sdk||googleplay||essentials||users||engage||monetize||disttools||stories) && !nonavpage
?>class="col-13" id="doc-col"<?cs
elif:!nonavpage
?>class="col-12" id="doc-col"<?cs /if ?> >
@@ -36,14 +44,12 @@
<?cs if:(design||training||walkthru) && !page.trainingcourse && !page.article ?><?cs # header logic for docs that provide previous/next buttons ?>
<?cs if:header.hide ?>
<?cs else ?>
- <div class="layout-content-row content-header <?cs if:header.justLinks ?>just-links<?cs /if ?>">
- <div class="layout-content-col <?cs if:training ?>span-7<?cs else ?>span-9<?cs /if ?>">
+ <div class="content-header <?cs if:header.justLinks ?>just-links<?cs /if ?>">
<?cs if:header.justLinks ?>
<?cs else ?><h1 itemprop="name"><?cs var:page.title ?></h1>
<?cs /if ?>
- </div>
<?cs if:training ?>
- <div class="training-nav-top layout-content-col span-5" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div class="training-nav-top" itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="#" class="prev-page-link hide"
zh-tw-lang="上一堂課"
zh-cn-lang="上一课"
@@ -70,7 +76,7 @@
>Get started</a>
</div>
<?cs elif:!page.trainingcourse ?>
- <div class="paging-links layout-content-col span-4" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div class="paging-links" itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="#" class="prev-page-link hide"
zh-tw-lang="上一堂課"
zh-cn-lang="上一课"
@@ -116,16 +122,18 @@
<?cs if:page.landing ?><?cs # header logic for docs that are landing pages ?>
<div class="landing-banner">
<?cs if:page.landing.image ?><?cs # use two-column layout only if there is an image ?>
- <div class="col-6">
- <img src="<?cs var:toroot ?><?cs var:page.landing.image ?>" alt="" />
- </div>
- <div class="col-6">
+ <div class="cols">
+ <div class="col-6">
+ <img src="<?cs var:toroot ?><?cs var:page.landing.image ?>" alt="" />
+ </div>
+ <div class="col-6">
<?cs /if ?>
<h1 itemprop="name" style="margin-bottom:0;"><?cs var:page.title ?></h1>
<p itemprop="description"><?cs var:page.landing.intro ?></p>
<p><a class="next-page-link topic-start-link"></a></p>
<?cs if:page.landing.image ?>
+ </div>
</div>
<?cs /if ?>
</div>
@@ -153,13 +161,11 @@
<?cs call:tag_list(root.descr) ?>
</div>
+ <?cs if:!fullscreen && (design||training||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
<div class="content-footer <?cs
- if:fullpage ?>wrap<?cs
- else ?>layout-content-row<?cs /if ?>"
+ if:fullpage ?>wrap<?cs /if ?>"
itemscope itemtype="http://schema.org/SiteNavigationElement">
- <?cs if:!fullscreen ?>
- <div class="paging-links layout-content-col col-10">
- <?cs if:(design||training||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
+ <div class="paging-links">
<a href="#" class="next-page-link hide"
zh-tw-lang="下一堂課"
zh-cn-lang="下一课"
@@ -177,15 +183,9 @@
es-lang="Empezar"
>Get started</a>
<a href="#" class="next-class-link hide">Next class</a>
- <?cs /if ?>
- </div>
- <div class="layout-content-col plus-container col-2" >
- <?cs if:!page.noplus ?><?cs if:fullpage ?><style>#___plusone_0 {float:right !important;}</style><?cs /if ?>
- <div class="g-plusone" data-size="medium"></div>
- <?cs /if ?>
- </div>
- <?cs /if ?>
+ </div>
</div>
+ <?cs /if ?>
</div> <!-- end jd-content -->
@@ -194,13 +194,10 @@
<?cs include:"trailer.cs" ?>
<script src="https://developer.android.com/ytblogger_lists_unified.js" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_lists_unified.js?v=8" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_extras.js?v=9" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_collections.js?v=9" type="text/javascript"></script>
- <script src="<?cs var:toroot ?>jd_tag_helpers.js?v=5" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_lists_unified.js?v=15" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_extras.js?v=15" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_collections.js?v=15" type="text/javascript"></script>
+ <script src="<?cs var:toroot ?>jd_tag_helpers.js?v=15" type="text/javascript"></script>
</body>
</html>
-
-
-
diff --git a/tools/droiddoc/templates-sdk/footer.cs b/tools/droiddoc/templates-sdk/footer.cs
index b609d3b..1ffee63 100644
--- a/tools/droiddoc/templates-sdk/footer.cs
+++ b/tools/droiddoc/templates-sdk/footer.cs
@@ -1,20 +1,172 @@
-<div id="footer" class="wrap" <?cs if:fullpage ?>style="width:940px"<?cs /if ?>>
-
-<?cs if:reference ?>
- <div id="copyright">
- <?cs call:custom_copyright() ?>
+<div class="wrap">
+ <div class="dac-footer<?cs if:fullpage ?> dac-landing<?cs /if ?>">
+ <div class="cols dac-footer-main">
+ <div class="col-1of2">
+ <a class="dac-footer-getnews" data-modal-toggle="newsletter" href="javascript:;">Get news & tips <span
+ class="dac-fab dac-primary"><i class="dac-sprite dac-mail"></i></span></a>
+ </div>
+ <div class="col-1of2 dac-footer-reachout">
+ <div class="dac-footer-contact">
+ <a class="dac-footer-contact-link" href="http://android-developers.blogspot.com/">Blog</a>
+ <a class="dac-footer-contact-link" href="/support.html">Support</a>
+ </div>
+ <div class="dac-footer-social">
+ <a class="dac-fab dac-footer-social-link" href="https://www.youtube.com/user/androiddevelopers"><i class="dac-sprite dac-youtube"></i></a>
+ <a class="dac-fab dac-footer-social-link" href="https://plus.google.com/+AndroidDevelopers"><i class="dac-sprite dac-gplus"></i></a>
+ <a class="dac-fab dac-footer-social-link" href="https://twitter.com/AndroidDev"><i class="dac-sprite dac-twitter"></i></a>
+ </div>
+ </div>
+ </div>
+
+ <hr class="dac-footer-separator"/>
+
+ <?cs if:reference ?>
+ <p class="dac-footer-copyright">
+ <?cs call:custom_copyright() ?>
+ </p>
+ <p class="dac-footer-build">
+ <?cs call:custom_buildinfo() ?>
+ </p>
+ <?cs elif:!hide_license_footer ?>
+ <p class="dac-footer-copyright">
+ <?cs call:custom_cc_copyright() ?>
+ </p>
+ <?cs /if ?>
+
+ <p class="dac-footer-links">
+ <a href="/about/index.html">About Android</a>
+ <a href="/auto/index.html">Auto</a>
+ <a href="/tv/index.html">TV</a>
+ <a href="/wear/index.html">Wear</a>
+ <a href="/legal.html">Legal</a>
+
+ <span id="language" class="locales">
+ <select name="language" onchange="changeLangPref(this.value, true)">
+ <option value="en" selected="selected">English</option>
+ <option value="es">Español</option>
+ <option value="ja">日本語</option>
+ <option value="ko">한국어</option>
+ <option value="pt-br">Português Brasileiro</option>
+ <option value="ru">Русский</option>
+ <option value="zh-cn">中文(简体)</option>
+ <option value="zh-tw">中文(繁體)</option>
+ </select>
+ </span>
+ </p>
</div>
- <div id="build_info">
- <?cs call:custom_buildinfo() ?>
+</div> <!-- end footer -->
+
+<div data-modal="newsletter" data-newsletter data-swap class="dac-modal newsletter">
+ <div class="dac-modal-container">
+ <div class="dac-modal-window">
+ <header class="dac-modal-header">
+ <button class="dac-modal-header-close" data-modal-toggle><i class="dac-sprite dac-close"></i></button>
+ <div class="dac-swap" data-swap-container>
+ <section class="dac-swap-section dac-active dac-down">
+ <h2 class="norule dac-modal-header-title">Get the latest Android developer news and tips that will help you find success on Google Play.</h2>
+ <p class="dac-modal-header-subtitle">* Required Fields</p>
+ </section>
+ <section class="dac-swap-section dac-up">
+ <h2 class="norule dac-modal-header-title">Hooray!</h2>
+ </section>
+ </div>
+ </header>
+ <div class="dac-swap" data-swap-container>
+ <section class="dac-swap-section dac-active dac-left">
+ <form action="https://docs.google.com/forms/d/1QgnkzbEJIDu9lMEea0mxqWrXUJu0oBCLD7ar23V0Yys/formResponse" class="dac-form" method="post" target="dac-newsletter-iframe">
+ <section class="dac-modal-content">
+ <fieldset class="dac-form-fieldset">
+ <div class="cols">
+ <div class="col-1of2 newsletter-leftCol">
+ <div class="dac-form-input-group">
+ <label for="newsletter-full-name" class="dac-form-floatlabel">Full name</label>
+ <input type="text" class="dac-form-input" name="entry.1357890476" id="newsletter-full-name" required>
+ <span class="dac-form-required">*</span>
+ </div>
+ <div class="dac-form-input-group">
+ <label for="newsletter-email" class="dac-form-floatlabel">Email address</label>
+ <input type="email" class="dac-form-input" name="entry.472100832" id="newsletter-email" required>
+ <span class="dac-form-required">*</span>
+ </div>
+ </div>
+ <div class="col-1of2 newsletter-rightCol">
+ <div class="dac-form-input-group">
+ <label for="newsletter-company" class="dac-form-floatlabel">Company / developer name</label>
+ <input type="text" class="dac-form-input" name="entry.1664780309" id="newsletter-company">
+ </div>
+ <div class="dac-form-input-group">
+ <label for="newsletter-play-store" class="dac-form-floatlabel">One of your Play Store app URLs</label>
+ <input type="url" class="dac-form-input" name="entry.47013838" id="newsletter-play-store" required>
+ <span class="dac-form-required">*</span>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+ <fieldset class="dac-form-fieldset">
+ <div class="cols">
+ <div class="col-1of2 newsletter-leftCol">
+ <legend class="dac-form-legend">Which best describes your business:<span class="dac-form-required">*</span>
+ </legend>
+ <div class="dac-form-radio-group">
+ <input type="radio" value="Apps" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-app" required>
+ <label for="newsletter-business-type-app" class="dac-form-radio-button"></label>
+ <label for="newsletter-business-type-app" class="dac-form-label">Apps</label>
+ </div>
+ <div class="dac-form-radio-group">
+ <input type="radio" value="Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-games" required>
+ <label for="newsletter-business-type-games" class="dac-form-radio-button"></label>
+ <label for="newsletter-business-type-games" class="dac-form-label">Games</label>
+ </div>
+ <div class="dac-form-radio-group">
+ <input type="radio" value="Apps and Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-appsgames" required>
+ <label for="newsletter-business-type-appsgames" class="dac-form-radio-button"></label>
+ <label for="newsletter-business-type-appsgames" class="dac-form-label">Apps & Games</label>
+ </div>
+ </div>
+ <div class="col-1of2 newsletter-rightCol newsletter-checkboxes">
+ <div class="dac-form-radio-group">
+ <div class="dac-media">
+ <div class="dac-media-figure">
+ <input type="checkbox" class="dac-form-checkbox" name="entry.732309842" id="newsletter-add" required value="Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.">
+ <label for="newsletter-add" class="dac-form-checkbox-button"></label>
+ </div>
+ <div class="dac-media-body">
+ <label for="newsletter-add" class="dac-form-label dac-form-aside">Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.<span class="dac-form-required">*</span></label>
+ </div>
+ </div>
+ </div>
+ <div class="dac-form-radio-group">
+ <div class="dac-media">
+ <div class="dac-media-figure">
+ <input type="checkbox" class="dac-form-checkbox" name="entry.2045036090" id="newsletter-terms" required value="I acknowledge that the information provided in this form will be subject to Google's privacy policy (https://www.google.com/policies/privacy/).">
+ <label for="newsletter-terms" class="dac-form-checkbox-button"></label>
+ </div>
+ <div class="dac-media-body">
+ <label for="newsletter-terms" class="dac-form-label dac-form-aside">I acknowledge that the information provided in this form will be subject to <a href="https://www.google.com/policies/privacy/">Google's privacy policy</a>.<span class="dac-form-required">*</span></label>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+ </section>
+ <footer class="dac-modal-footer">
+ <div class="cols">
+ <div class="col-2of5">
+ </div>
+ </div>
+ <button type="submit" value="Submit" class="dac-fab dac-primary dac-large dac-modal-action"><i class="dac-sprite dac-arrow-right"></i></button>
+ </footer>
+ </form>
+ </section>
+ <section class="dac-swap-section dac-right">
+ <div class="dac-modal-content">
+ <p class="newsletter-success-message">
+ You have successfully signed up for the latest Android developer news and tips.
+ </p>
+ </div>
+ </section>
+ </div>
+ </div>
</div>
-<?cs elif:!hide_license_footer ?>
- <div id="copyright">
- <?cs call:custom_cc_copyright() ?>
- </div>
-<?cs /if ?>
-<?cs if:!no_footer_links ?>
- <div id="footerlinks">
- <?cs call:custom_footerlinks() ?>
- </div>
-<?cs /if ?>
-</div> <!-- end footer -->
\ No newline at end of file
+</div> <!-- end footer -->
diff --git a/tools/droiddoc/templates-sdk/head_tag.cs b/tools/droiddoc/templates-sdk/head_tag.cs
index 9f79f54..babb3c7 100644
--- a/tools/droiddoc/templates-sdk/head_tag.cs
+++ b/tools/droiddoc/templates-sdk/head_tag.cs
@@ -15,10 +15,8 @@
?><?cs
# END if/else devsite ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="viewport" content="width=<?cs
- if:page.viewport_width ?><?cs
- var:page.viewport_width ?><?cs
- else ?>device-width<?cs /if ?>" />
+<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+<meta content="IE=edge" http-equiv="X-UA-Compatible">
<?cs
if:page.metaDescription ?>
<meta name="Description" content="<?cs var:page.metaDescription ?>"><?cs
@@ -38,7 +36,12 @@
if:android.whichdoc != 'online' ?>http:<?cs
/if ?>//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
title="roboto">
-<link href="<?cs var:toroot ?>assets/css/default.css?v=5" rel="stylesheet" type="text/css">
+<?cs
+ if:ndk ?><link rel="stylesheet" href="<?cs
+ if:android.whichdoc != 'online' ?>http:<?cs
+ /if ?>//fonts.googleapis.com/css?family=Roboto+Mono:400,500,700" title="roboto-mono" type="text/css"><?cs
+/if ?>
+<link href="<?cs var:toroot ?>assets/css/default.css?v=7" rel="stylesheet" type="text/css">
<?cs if:reference && !(reference.gms || reference.gcm || preview) ?>
<!-- FULLSCREEN STYLESHEET -->
@@ -62,7 +65,7 @@
var metaTags = [<?cs var:meta.tags ?>];
var devsite = <?cs if:devsite ?>true<?cs else ?>false<?cs /if ?>;
</script>
-<script src="<?cs var:toroot ?>assets/js/docs.js?v=3" type="text/javascript"></script>
+<script src="<?cs var:toroot ?>assets/js/docs.js?v=6" type="text/javascript"></script>
<?cs if:helpoutsWidget ?>
<script type="text/javascript" src="https://helpouts.google.com/ps/res/embed.js" defer async
diff --git a/tools/droiddoc/templates-sdk/nosidenavpage.cs b/tools/droiddoc/templates-sdk/nosidenavpage.cs
index 8e59693..61754f0 100644
--- a/tools/droiddoc/templates-sdk/nosidenavpage.cs
+++ b/tools/droiddoc/templates-sdk/nosidenavpage.cs
@@ -11,6 +11,7 @@
<?cs call:custom_masthead() ?>
<div id="body-content">
+<div>
<div id="doc-content" style="position:relative;">
<?cs call:tag_list(root.descr) ?>
diff --git a/tools/droiddoc/templates-sdk/package.cs b/tools/droiddoc/templates-sdk/package.cs
index 2225565..72d5538 100644
--- a/tools/droiddoc/templates-sdk/package.cs
+++ b/tools/droiddoc/templates-sdk/package.cs
@@ -55,8 +55,9 @@
<?cs call:class_table("Exceptions", package.exceptions) ?>
<?cs call:class_table("Errors", package.errors) ?>
-<?cs include:"footer.cs" ?>
</div><!-- end jd-content -->
+
+<?cs include:"footer.cs" ?>
</div><!-- doc-content -->
<?cs include:"trailer.cs" ?>
diff --git a/tools/droiddoc/templates-sdk/packages.cs b/tools/droiddoc/templates-sdk/packages.cs
index 5056d3a..fe6a5aa 100644
--- a/tools/droiddoc/templates-sdk/packages.cs
+++ b/tools/droiddoc/templates-sdk/packages.cs
@@ -35,8 +35,9 @@
<?cs /each ?>
</table>
-<?cs include:"footer.cs" ?>
</div><!-- end jd-content -->
+
+<?cs include:"footer.cs" ?>
</div> <!-- end doc-content -->
<?cs include:"trailer.cs" ?>
diff --git a/tools/droiddoc/templates-sdk/sample.cs b/tools/droiddoc/templates-sdk/sample.cs
index 32a0788..7b4bf0f 100644
--- a/tools/droiddoc/templates-sdk/sample.cs
+++ b/tools/droiddoc/templates-sdk/sample.cs
@@ -92,9 +92,9 @@
<div class="content-footer <?cs
if:fullpage ?>wrap<?cs
- else ?>layout-content-row<?cs /if ?>"
+ else ?>cols<?cs /if ?>"
itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div class="layout-content-col <?cs
+ <div class="<?cs
if:fullpage ?>col-16<?cs
elif:training||guide ?>col-8<?cs
else ?>col-9<?cs /if ?>" style="padding-top:4px">
@@ -103,7 +103,7 @@
<?cs /if ?>
</div>
<?cs if:!fullscreen ?>
- <div class="paging-links layout-content-col col-4">
+ <div class="paging-links col-4">
<?cs if:(design||training||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
<a href="#" class="prev-page-link hide"
zh-tw-lang="上一堂課"
@@ -128,7 +128,7 @@
<?cs # for training classes, provide a different kind of link when the next page is a different class ?>
<?cs if:training && !page.article ?>
- <div class="layout-content-row content-footer next-class" style="display:none" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div class="content-footer next-class" style="display:none" itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="#" class="next-class-link hide">Next class: </a>
</div>
<?cs /if ?>
diff --git a/tools/droiddoc/templates-sdk/sampleindex.cs b/tools/droiddoc/templates-sdk/sampleindex.cs
index 1bacb53..e62d3fe 100644
--- a/tools/droiddoc/templates-sdk/sampleindex.cs
+++ b/tools/droiddoc/templates-sdk/sampleindex.cs
@@ -82,9 +82,9 @@
<?cs /if ?><?cs # end if/else online docs ?>
<div class="content-footer <?cs
if:fullpage ?>wrap<?cs
- else ?>layout-content-row<?cs /if ?>"
+ else ?>cols<?cs /if ?>"
itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div class="layout-content-col <?cs
+ <div class="<?cs
if:fullpage ?>col-16<?cs
elif:training||guide ?>col-8<?cs
else ?>col-9<?cs /if ?>" style="padding-top:4px">
@@ -93,7 +93,7 @@
<?cs /if ?>
</div>
<?cs if:!fullscreen ?>
- <div class="paging-links layout-content-col col-4">
+ <div class="paging-links col-4">
<?cs if:(design||training||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
<a href="#" class="prev-page-link hide"
zh-tw-lang="上一堂課"
@@ -118,7 +118,7 @@
<?cs # for training classes, provide a different kind of link when the next page is a different class ?>
<?cs if:training && !page.article ?>
- <div class="layout-content-row content-footer next-class" style="display:none" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div class="content-footer next-class" style="display:none" itemscope itemtype="http://schema.org/SiteNavigationElement">
<a href="#" class="next-class-link hide">Next class: </a>
</div>
<?cs /if ?>
diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs
index 817ac47..47c2992 100644
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -116,6 +116,7 @@
<td><?cs var:ndk.win64.legacy_bytes ?></td>
<td><?cs var:ndk.win64.legacy_checksum ?></td>
</tr> -->
+<!-- (this item is deprecated)
<tr>
<td>Mac OS X 32-bit</td>
<td>
@@ -124,8 +125,9 @@
</td>
<td><?cs var:ndk.mac32_bytes ?></td>
<td><?cs var:ndk.mac32_checksum ?></td>
- </tr>
- <!-- <tr>
+ </tr> -->
+ <!-- (this item is deprecated)
+ <tr>
<td>
<a onClick="return onDownload(this)"
href="http://dl.google.com/android/ndk/<?cs var:ndk.mac32.legacy_download ?>"><?cs var:ndk.mac32.legacy_download ?></a>
@@ -340,7 +342,7 @@
<tr>
<td rowspan="3">Windows</td>
<td>
- <a onclick="return onDownload(this)" id="win-bundle"
+ <a onclick="return onDownload(this,false,true)" id="win-bundle"
href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_exe_download ?>"
><?cs var:studio.win_bundle_exe_download ?></a><br>(Recommended)
</td>
@@ -351,7 +353,7 @@
<tr>
<!-- blank TD from Windows rowspan -->
<td>
- <a onclick="return onDownload(this)"
+ <a onclick="return onDownload(this,false,true)" id="win-bundle-notools"
href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.win_notools_exe_download ?>"
><?cs var:studio.win_notools_exe_download ?></a><br>(No SDK tools included)
</td>
@@ -362,7 +364,7 @@
<tr>
<!-- blank TD from Windows rowspan -->
<td>
- <a onclick="return onDownload(this)"
+ <a onclick="return onDownload(this,false,true)" id="win-bundle-zip"
href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_download ?>"
><?cs var:studio.win_bundle_download ?></a>
</td>
@@ -373,7 +375,7 @@
<tr>
<td><nobr>Mac OS X</nobr></td>
<td>
- <a onclick="return onDownload(this)" id="mac-bundle"
+ <a onclick="return onDownload(this,false,true)" id="mac-bundle"
href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.mac_bundle_download ?>"
><?cs var:studio.mac_bundle_download ?></a>
</td>
@@ -384,7 +386,7 @@
<tr>
<td>Linux</td>
<td>
- <a onclick="return onDownload(this)" id="linux-bundle"
+ <a onclick="return onDownload(this,false,true)" id="linux-bundle"
href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.linux_bundle_download ?>"
><?cs var:studio.linux_bundle_download ?></a>
</td>
@@ -399,12 +401,10 @@
-</div><!-- end col-13 for lower-half content -->
-
-
<script>
+
if (location.hash == "#Requirements") {
$('.reqs').show();
} else if (location.hash == "#ExistingIDE") {
@@ -435,7 +435,7 @@
$('#not-supported').hide();
/* set up primary Android Studio download button */
- $('.download-bundle-button').append(" <br/><span class='small'>for " + os + "</span>");
+ $('.download-bundle-button > .small').html(" for " + os);
$('.download-bundle-button').click(function() {return onDownload(this,true,true);}).attr('href', bundlename);
}
@@ -450,7 +450,11 @@
}
$("#downloadForRealz").attr('bundle', bundle);
- $("a#downloadForRealz").attr("name", $(link).attr('href'));
+ if (bundle && !button) {
+ $("a#downloadForRealz").attr("name", "#" + $(link).attr('id'));
+ } else {
+ $("a#downloadForRealz").attr("name", $(link).attr('href'));
+ }
$("#tos").show();
$("#landing").hide();
@@ -502,9 +506,6 @@
ga('send', 'event', 'SDK', 'IDE and Tools', $("#downloadForRealz").html());
return true;
} else {
- $("label#agreeLabel").parent().stop().animate({color: "#258AAF"}, 200,
- function() {$("label#agreeLabel").parent().stop().animate({color: "#222"}, 200)}
- );
return false;
}
}
diff --git a/tools/droiddoc/templates-sdk/trailer.cs b/tools/droiddoc/templates-sdk/trailer.cs
index 337f8d3..225b2c1 100644
--- a/tools/droiddoc/templates-sdk/trailer.cs
+++ b/tools/droiddoc/templates-sdk/trailer.cs
@@ -1,3 +1,4 @@
+</div> <!-- end .cols --> <?cs # normally opened by header.cs ?>
</div> <!-- end body-content --> <?cs # normally opened by header.cs ?>
<?cs if:carousel ?>
diff --git a/tools/fs_config/fs_config.c b/tools/fs_config/fs_config.c
index f594c1e..e797957 100644
--- a/tools/fs_config/fs_config.c
+++ b/tools/fs_config/fs_config.c
@@ -24,7 +24,6 @@
#include <selinux/selinux.h>
#include <selinux/label.h>
-#include <selinux/android.h>
#include "private/android_filesystem_config.h"
@@ -68,16 +67,17 @@
}
static void usage() {
- fprintf(stderr, "Usage: fs_config [-S context_file] [-C]\n");
+ fprintf(stderr, "Usage: fs_config [-D product_out_path] [-S context_file] [-C]\n");
}
int main(int argc, char** argv) {
char buffer[1024];
const char* context_file = NULL;
+ const char* product_out_path = NULL;
struct selabel_handle* sehnd = NULL;
int print_capabilities = 0;
int opt;
- while((opt = getopt(argc, argv, "CS:")) != -1) {
+ while((opt = getopt(argc, argv, "CS:D:")) != -1) {
switch(opt) {
case 'C':
print_capabilities = 1;
@@ -85,6 +85,9 @@
case 'S':
context_file = optarg;
break;
+ case 'D':
+ product_out_path = optarg;
+ break;
default:
usage();
exit(EXIT_FAILURE);
@@ -115,7 +118,7 @@
unsigned uid = 0, gid = 0, mode = 0;
uint64_t capabilities;
- fs_config(buffer, is_dir, &uid, &gid, &mode, &capabilities);
+ fs_config(buffer, is_dir, product_out_path, &uid, &gid, &mode, &capabilities);
printf("%s %d %d %o", buffer, uid, gid, mode);
if (sehnd != NULL) {
diff --git a/tools/fs_get_stats/fs_get_stats.c b/tools/fs_get_stats/fs_get_stats.c
index a9814b9..159e2aa 100644
--- a/tools/fs_get_stats/fs_get_stats.c
+++ b/tools/fs_get_stats/fs_get_stats.c
@@ -25,11 +25,12 @@
{
fprintf(stderr, "fs_get_stats: retrieve the target file stats "
"for the specified file\n");
- fprintf(stderr, "usage: fs_get_stats cur_perms is_dir filename\n");
+ fprintf(stderr, "usage: fs_get_stats cur_perms is_dir filename targetout\n");
fprintf(stderr, "\tcur_perms - The current permissions of "
"the file\n");
fprintf(stderr, "\tis_dir - Is filename is a dir, 1. Otherwise, 0.\n");
fprintf(stderr, "\tfilename - The filename to lookup\n");
+ fprintf(stderr, "\ttargetout - The target out path to query device specific FS configs\n");
fprintf(stderr, "\n");
}
@@ -42,7 +43,7 @@
unsigned uid = (unsigned)-1;
unsigned gid = (unsigned)-1;
- if (argc < 4) {
+ if (argc < 5) {
ERROR("Invalid arguments\n");
print_help();
exit(-1);
@@ -58,7 +59,7 @@
is_dir = 1;
uint64_t capabilities;
- fs_config(argv[3], is_dir, &uid, &gid, &perms, &capabilities);
+ fs_config(argv[3], is_dir, argv[4], &uid, &gid, &perms, &capabilities);
fprintf(stdout, "%d %d 0%o\n", uid, gid, perms);
return 0;
diff --git a/tools/generate-notice-files.py b/tools/generate-notice-files.py
index 4571b70..5b13bf5 100755
--- a/tools/generate-notice-files.py
+++ b/tools/generate-notice-files.py
@@ -99,7 +99,7 @@
# most browsers, but href's to table row ids do)
id_table = {}
id_count = 0
- for value in file_hash.values():
+ for value in file_hash:
for filename in value:
id_table[filename] = id_count
id_count += 1
@@ -116,7 +116,7 @@
print >> output_file, "<ul>"
# Flatten the list of lists into a single list of filenames
- sorted_filenames = sorted(itertools.chain.from_iterable(file_hash.values()))
+ sorted_filenames = sorted(itertools.chain.from_iterable(file_hash))
# Print out a nice table of contents
for filename in sorted_filenames:
@@ -127,11 +127,11 @@
print >> output_file, "</div><!-- table of contents -->"
# Output the individual notice file lists
print >>output_file, '<table cellpadding="0" cellspacing="0" border="0">'
- for value in file_hash.values():
+ for value in file_hash:
print >> output_file, '<tr id="id%d"><td class="same-license">' % id_table.get(value[0])
print >> output_file, '<div class="label">Notices for file(s):</div>'
print >> output_file, '<div class="file-list">'
- for filename in sorted(value):
+ for filename in value:
print >> output_file, "%s <br/>" % (SRC_DIR_STRIP_RE.sub(r"\1", filename))
print >> output_file, "</div><!-- file-list -->"
print >> output_file
@@ -154,10 +154,10 @@
SRC_DIR_STRIP_RE = re.compile(input_dir + "(/.*).txt")
output_file = open(output_filename, "wb")
print >> output_file, file_title
- for value in file_hash.values():
+ for value in file_hash:
print >> output_file, "============================================================"
print >> output_file, "Notices for file(s):"
- for filename in sorted(value):
+ for filename in value:
print >> output_file, SRC_DIR_STRIP_RE.sub(r"\1", filename)
print >> output_file, "------------------------------------------------------------"
print >> output_file, open(value[0]).read()
@@ -178,11 +178,12 @@
file_md5sum = md5sum(filename)
files_with_same_hash[file_md5sum].append(filename)
+ filesets = [sorted(files_with_same_hash[md5]) for md5 in sorted(files_with_same_hash.keys())]
print "Combining NOTICE files into HTML"
- combine_notice_files_html(files_with_same_hash, input_dir, html_output_file)
+ combine_notice_files_html(filesets, input_dir, html_output_file)
print "Combining NOTICE files into text"
- combine_notice_files_text(files_with_same_hash, input_dir, txt_output_file, file_title)
+ combine_notice_files_text(filesets, input_dir, txt_output_file, file_title)
if __name__ == "__main__":
main(args)
diff --git a/tools/ijar/Android.mk b/tools/ijar/Android.mk
new file mode 100644
index 0000000..8b2a02c
--- /dev/null
+++ b/tools/ijar/Android.mk
@@ -0,0 +1,16 @@
+# Copyright 2015 The Android Open Source Project
+#
+# The rest of files in this directory comes from
+# https://github.com/bazelbuild/bazel/tree/master/third_party/ijar
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := classfile.cc ijar.cc zip.cc
+LOCAL_CFLAGS += -Wall -Werror
+LOCAL_SHARED_LIBRARIES := libz-host
+LOCAL_MODULE := ijar
+# libc++ is not supported for TARGET_BUILD_APPS builds
+LOCAL_CXX_STL := libstdc++
+include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/ijar/LICENSE b/tools/ijar/LICENSE
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/tools/ijar/LICENSE
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
diff --git a/tools/ijar/README.txt b/tools/ijar/README.txt
new file mode 100644
index 0000000..d5a6a0f
--- /dev/null
+++ b/tools/ijar/README.txt
@@ -0,0 +1,120 @@
+
+ijar: A tool for generating interface .jars from normal .jars
+=============================================================
+
+Alan Donovan, 26 May 2007.
+
+Rationale:
+
+ In order to improve the speed of compilation of Java programs in
+ Bazel, the output of build steps is cached.
+
+ This works very nicely for C++ compilation: a compilation unit
+ includes a .cc source file and typically dozens of header files.
+ Header files change relatively infrequently, so the need for a
+ rebuild is usually driven by a change in the .cc file. Even after
+ syncing a slightly newer version of the tree and doing a rebuild,
+ many hits in the cache are still observed.
+
+ In Java, by contrast, a compilation unit involves a set of .java
+ source files, plus a set of .jar files containing already-compiled
+ JVM .class files. Class files serve a dual purpose: from the JVM's
+ perspective, they are containers of executable code, but from the
+ compiler's perspective, they are interface definitions. The problem
+ here is that .jar files are very much more sensitive to change than
+ C++ header files, so even a change that is insignificant to the
+ compiler (such as the addition of a print statement to a method in a
+ prerequisite class) will cause the jar to change, and any code that
+ depends on this jar's interface will be recompiled unnecessarily.
+
+ The purpose of ijar is to produce, from a .jar file, a much smaller,
+ simpler .jar file containing only the parts that are significant for
+ the purposes of compilation. In other words, an interface .jar
+ file. By changing ones compilation dependencies to be the interface
+ jar files, unnecessary recompilation is avoided when upstream
+ changes don't affect the interface.
+
+Details:
+
+ ijar is a tool that reads a .jar file and emits a .jar file
+ containing only the parts that are relevant to Java compilation.
+ For example, it throws away:
+
+ - Files whose name does not end in ".class".
+ - All executable method code.
+ - All private methods and fields.
+ - All constants and attributes except the minimal set necessary to
+ describe the class interface.
+ - All debugging information
+ (LineNumberTable, SourceFile, LocalVariableTables attributes).
+
+ It also sets to zero the file modification times in the index of the
+ .jar file.
+
+Implementation:
+
+ ijar is implemented in C++, and runs very quickly. For example
+ (when optimized) it takes only 530ms to process a 42MB
+ .jar file containing 5878 classe, resulting in an interface .jar
+ file of only 11.4MB in size. For more usual .jar sizes of a few
+ megabytes, a runtime of 50ms is typical.
+
+ The implementation strategy is to mmap both the input jar and the
+ newly-created _interface.jar, and to scan through the former and
+ emit the latter in a single pass. There are a couple of locations
+ where some kind of "backpatching" is required:
+
+ - in the .zip file format, for each file, the size field precedes
+ the data. We emit a zero but note its location, generate and emit
+ the stripped classfile, then poke the correct size into the
+ location.
+
+ - for JVM .class files, the header (including the constant table)
+ precedes the body, but cannot be emitted before it because it's
+ not until we emit the body that we know which constants are
+ referenced and which are garbage. So we emit the body into a
+ temporary buffer, then emit the header to the output jar, followed
+ by the contents of the temp buffer.
+
+ Also note that the zip file format has unnecessary duplication of
+ the index metadata: it has header+data for each file, then another
+ set of (similar) headers at the end. Rather than save the metadata
+ explicitly in some datastructure, we just record the addresses of
+ the already-emitted zip metadata entries in the output file, and
+ then read from there as necessary.
+
+Notes:
+
+ This code has no dependency except on the STL and on zlib.
+
+ Almost all of the getX/putX/ReadX/WriteX functions in the code
+ advance their first argument pointer, which is passed by reference.
+
+ It's tempting to discard package-private classes and class members.
+ However, this would be incorrect because they are a necessary part
+ of the package interface, as a Java package is often compiled in
+ multiple stages. For example: in Bazel, both java tests and java
+ code inhabit the same Java package but are compiled separately.
+
+Assumptions:
+
+ We assume that jar files are uncompressed v1.0 zip files (created
+ with 'jar c0f') with a zero general_purpose_bit_flag.
+
+ We assume that javap/javac don't need the correct CRC checksums in
+ the .jar file.
+
+ We assume that it's better simply to abort in the face of unknown
+ input than to risk leaving out something important from the output
+ (although in the case of annotations, it should be safe to ignore
+ ones we don't understand).
+
+TODO:
+ Maybe: ensure a canonical sort order is used for every list (jar
+ entries, class members, attributes, etc.) This isn't essential
+ because we can assume the compiler is deterministic and the order in
+ the source files changes little. Also, it would require two passes. :(
+
+ Maybe: delete dynamically-allocated memory.
+
+ Add (a lot) more tests. Include a test of idempotency.
diff --git a/tools/ijar/classfile.cc b/tools/ijar/classfile.cc
new file mode 100644
index 0000000..e0cf42e
--- /dev/null
+++ b/tools/ijar/classfile.cc
@@ -0,0 +1,1788 @@
+// Copyright 2001,2007 Alan Donovan. All rights reserved.
+//
+// Author: Alan Donovan <adonovan@google.com>
+//
+// 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.
+//
+// classfile.cc -- classfile parsing and stripping.
+//
+
+// TODO(adonovan) don't pass pointers by reference; this is not
+// compatible with Google C++ style.
+
+// See README.txt for details.
+//
+// For definition of JVM class file format, see:
+// Java SE 8 Edition:
+// http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4
+
+#define __STDC_FORMAT_MACROS 1
+#define __STDC_LIMIT_MACROS 1
+#include <inttypes.h> // for PRIx32
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "common.h"
+
+namespace devtools_ijar {
+
+// See Table 4.3 in JVM Spec.
+enum CONSTANT {
+ CONSTANT_Class = 7,
+ CONSTANT_FieldRef = 9,
+ CONSTANT_Methodref = 10,
+ CONSTANT_Interfacemethodref = 11,
+ CONSTANT_String = 8,
+ CONSTANT_Integer = 3,
+ CONSTANT_Float = 4,
+ CONSTANT_Long = 5,
+ CONSTANT_Double = 6,
+ CONSTANT_NameAndType = 12,
+ CONSTANT_Utf8 = 1,
+ CONSTANT_MethodHandle = 15,
+ CONSTANT_MethodType = 16,
+ CONSTANT_InvokeDynamic = 18
+};
+
+// See Tables 4.1, 4.4, 4.5 in JVM Spec.
+enum ACCESS {
+ ACC_PUBLIC = 0x0001,
+ ACC_PRIVATE = 0x0002,
+ ACC_PROTECTED = 0x0004,
+ ACC_STATIC = 0x0008,
+ ACC_FINAL = 0x0010,
+ ACC_SYNCHRONIZED = 0x0020,
+ ACC_VOLATILE = 0x0040,
+ ACC_TRANSIENT = 0x0080,
+ ACC_INTERFACE = 0x0200,
+ ACC_ABSTRACT = 0x0400
+};
+
+// See Table 4.7.20-A in Java 8 JVM Spec.
+enum TARGET_TYPE {
+ // Targets for type parameter declarations (ElementType.TYPE_PARAMETER):
+ CLASS_TYPE_PARAMETER = 0x00,
+ METHOD_TYPE_PARAMETER = 0x01,
+
+ // Targets for type uses that may be externally visible in classes and members
+ // (ElementType.TYPE_USE):
+ CLASS_EXTENDS = 0x10,
+ CLASS_TYPE_PARAMETER_BOUND = 0x11,
+ METHOD_TYPE_PARAMETER_BOUND = 0x12,
+ FIELD = 0x13,
+ METHOD_RETURN = 0x14,
+ METHOD_RECEIVER = 0x15,
+ METHOD_FORMAL_PARAMETER = 0x16,
+ THROWS = 0x17,
+
+ // TARGET_TYPE >= 0x40 is reserved for type uses that occur only within code
+ // blocks. Ijar doesn't need to know about these.
+};
+
+struct Constant;
+
+// TODO(adonovan) these globals are unfortunate
+static std::vector<Constant*> const_pool_in; // input constant pool
+static std::vector<Constant*> const_pool_out; // output constant_pool
+static std::set<std::string> used_class_names;
+static Constant * class_name;
+
+// Returns the Constant object, given an index into the input constant pool.
+// Note: constant(0) == NULL; this invariant is exploited by the
+// InnerClassesAttribute, inter alia.
+inline Constant *constant(int idx) {
+ if (idx < 0 || (unsigned)idx >= const_pool_in.size()) {
+ fprintf(stderr, "Illegal constant pool index: %d\n", idx);
+ abort();
+ }
+ return const_pool_in[idx];
+}
+
+/**********************************************************************
+ * *
+ * Constants *
+ * *
+ **********************************************************************/
+
+// See sec.4.4 of JVM spec.
+struct Constant {
+
+ Constant(u1 tag) :
+ slot_(0),
+ tag_(tag) {}
+
+ virtual ~Constant() {}
+
+ // For UTF-8 string constants, returns the encoded string.
+ // Otherwise, returns an undefined string value suitable for debugging.
+ virtual std::string Display() = 0;
+
+ virtual void Write(u1 *&p) = 0;
+
+ // Called by slot() when a constant has been identified as required
+ // in the output classfile's constant pool. This is a hook allowing
+ // constants to register their dependency on other constants, by
+ // calling slot() on them in turn.
+ virtual void Keep() {}
+
+ bool Kept() {
+ return slot_ != 0;
+ }
+
+ // Returns the index of this constant in the output class's constant
+ // pool, assigning a slot if not already done.
+ u2 slot() {
+ if (slot_ == 0) {
+ Keep();
+ slot_ = const_pool_out.size(); // BugBot's "narrowing" warning
+ // is bogus. The number of
+ // output constants can't exceed
+ // the number of input constants.
+ if (slot_ == 0) {
+ fprintf(stderr, "Constant::slot() called before output phase.\n");
+ abort();
+ }
+ const_pool_out.push_back(this);
+ if (tag_ == CONSTANT_Long || tag_ == CONSTANT_Double) {
+ const_pool_out.push_back(NULL);
+ }
+ }
+ return slot_;
+ }
+
+ u2 slot_; // zero => "this constant is unreachable garbage"
+ u1 tag_;
+};
+
+// Extracts class names from a signature and puts them into the global
+// variable used_class_names.
+//
+// desc: the descriptor class names should be extracted from.
+// p: the position where the extraction should tart.
+void ExtractClassNames(const std::string& desc, size_t* p);
+
+// See sec.4.4.1 of JVM spec.
+struct Constant_Class : Constant
+{
+ Constant_Class(u2 name_index) :
+ Constant(CONSTANT_Class),
+ name_index_(name_index) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, constant(name_index_)->slot());
+ }
+
+ std::string Display() {
+ return constant(name_index_)->Display();
+ }
+
+ void Keep() { constant(name_index_)->slot(); }
+
+ u2 name_index_;
+};
+
+// See sec.4.4.2 of JVM spec.
+struct Constant_FMIref : Constant
+{
+ Constant_FMIref(u1 tag,
+ u2 class_index,
+ u2 name_type_index) :
+ Constant(tag),
+ class_index_(class_index),
+ name_type_index_(name_type_index) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, constant(class_index_)->slot());
+ put_u2be(p, constant(name_type_index_)->slot());
+ }
+
+ std::string Display() {
+ return constant(class_index_)->Display() + "::" +
+ constant(name_type_index_)->Display();
+ }
+
+ void Keep() {
+ constant(class_index_)->slot();
+ constant(name_type_index_)->slot();
+ }
+
+ u2 class_index_;
+ u2 name_type_index_;
+};
+
+// See sec.4.4.3 of JVM spec.
+struct Constant_String : Constant
+{
+ Constant_String(u2 string_index) :
+ Constant(CONSTANT_String),
+ string_index_(string_index) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, constant(string_index_)->slot());
+ }
+
+ std::string Display() {
+ return "\"" + constant(string_index_)->Display() + "\"";
+ }
+
+ void Keep() { constant(string_index_)->slot(); }
+
+ u2 string_index_;
+};
+
+// See sec.4.4.4 of JVM spec.
+struct Constant_IntegerOrFloat : Constant
+{
+ Constant_IntegerOrFloat(u1 tag, u4 bytes) :
+ Constant(tag),
+ bytes_(bytes) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u4be(p, bytes_);
+ }
+
+ std::string Display() { return "int/float"; }
+
+ u4 bytes_;
+};
+
+// See sec.4.4.5 of JVM spec.
+struct Constant_LongOrDouble : Constant_IntegerOrFloat
+{
+ Constant_LongOrDouble(u1 tag, u4 high_bytes, u4 low_bytes) :
+ Constant_IntegerOrFloat(tag, high_bytes),
+ low_bytes_(low_bytes) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u4be(p, bytes_);
+ put_u4be(p, low_bytes_);
+ }
+
+ std::string Display() { return "long/double"; }
+
+ u4 low_bytes_;
+};
+
+// See sec.4.4.6 of JVM spec.
+struct Constant_NameAndType : Constant
+{
+ Constant_NameAndType(u2 name_index, u2 descr_index) :
+ Constant(CONSTANT_NameAndType),
+ name_index_(name_index),
+ descr_index_(descr_index) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, constant(name_index_)->slot());
+ put_u2be(p, constant(descr_index_)->slot());
+ }
+
+ std::string Display() {
+ return constant(name_index_)->Display() + "::" +
+ constant(descr_index_)->Display();
+ }
+
+ void Keep() {
+ constant(name_index_)->slot();
+ constant(descr_index_)->slot();
+ }
+
+ u2 name_index_;
+ u2 descr_index_;
+};
+
+// See sec.4.4.7 of JVM spec.
+struct Constant_Utf8 : Constant
+{
+ Constant_Utf8(u4 length, const u1 *utf8) :
+ Constant(CONSTANT_Utf8),
+ length_(length),
+ utf8_(utf8) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, length_);
+ put_n(p, utf8_, length_);
+ }
+
+ std::string Display() {
+ return std::string((const char*) utf8_, length_);
+ }
+
+ u4 length_;
+ const u1 *utf8_;
+};
+
+// See sec.4.4.8 of JVM spec.
+struct Constant_MethodHandle : Constant
+{
+ Constant_MethodHandle(u1 reference_kind, u2 reference_index) :
+ Constant(CONSTANT_MethodHandle),
+ reference_kind_(reference_kind),
+ reference_index_(reference_index) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u1(p, reference_kind_);
+ put_u2be(p, reference_index_);
+ }
+
+ std::string Display() {
+ return "Constant_MethodHandle::" + std::to_string(reference_kind_) + "::"
+ + constant(reference_index_)->Display();
+ }
+
+ u1 reference_kind_;
+ u2 reference_index_;
+};
+
+// See sec.4.4.9 of JVM spec.
+struct Constant_MethodType : Constant
+{
+ Constant_MethodType(u2 descriptor_index) :
+ Constant(CONSTANT_MethodType),
+ descriptor_index_(descriptor_index) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, descriptor_index_);
+ }
+
+ std::string Display() {
+ return "Constant_MethodType::" + constant(descriptor_index_)->Display();
+ }
+
+ u2 descriptor_index_;
+};
+
+// See sec.4.4.10 of JVM spec.
+struct Constant_InvokeDynamic : Constant
+{
+ Constant_InvokeDynamic(u2 bootstrap_method_attr_index, u2 name_and_type_index) :
+ Constant(CONSTANT_InvokeDynamic),
+ bootstrap_method_attr_index_(bootstrap_method_attr_index),
+ name_and_type_index_(name_and_type_index) {}
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, bootstrap_method_attr_index_);
+ put_u2be(p, name_and_type_index_);
+ }
+
+ std::string Display() {
+ return "Constant_InvokeDynamic::"
+ + std::to_string(bootstrap_method_attr_index_) + "::"
+ + constant(name_and_type_index_)->Display();
+ }
+
+ u2 bootstrap_method_attr_index_;
+ u2 name_and_type_index_;
+};
+
+/**********************************************************************
+ * *
+ * Attributes *
+ * *
+ **********************************************************************/
+
+// See sec.4.7 of JVM spec.
+struct Attribute {
+
+ virtual ~Attribute() {}
+ virtual void Write(u1 *&p) = 0;
+ virtual void ExtractClassNames() {}
+
+ void WriteProlog(u1 *&p, u2 length) {
+ put_u2be(p, attribute_name_->slot());
+ put_u4be(p, length);
+ }
+
+ Constant *attribute_name_;
+};
+
+// See sec.4.7.5 of JVM spec.
+struct ExceptionsAttribute : Attribute {
+
+ static ExceptionsAttribute* Read(const u1 *&p, Constant *attribute_name) {
+ ExceptionsAttribute *attr = new ExceptionsAttribute;
+ attr->attribute_name_ = attribute_name;
+ u2 number_of_exceptions = get_u2be(p);
+ for (int ii = 0; ii < number_of_exceptions; ++ii) {
+ attr->exceptions_.push_back(constant(get_u2be(p)));
+ }
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, exceptions_.size() * 2 + 2);
+ put_u2be(p, exceptions_.size());
+ for (size_t ii = 0; ii < exceptions_.size(); ++ii) {
+ put_u2be(p, exceptions_[ii]->slot());
+ }
+ }
+
+ std::vector<Constant*> exceptions_;
+};
+
+// See sec.4.7.6 of JVM spec.
+struct InnerClassesAttribute : Attribute {
+
+ struct Entry {
+ Constant *inner_class_info;
+ Constant *outer_class_info;
+ Constant *inner_name;
+ u2 inner_class_access_flags;
+ };
+
+ virtual ~InnerClassesAttribute() {
+ for (size_t i = 0; i < entries_.size(); i++) {
+ delete entries_[i];
+ }
+ }
+
+ static InnerClassesAttribute* Read(const u1 *&p, Constant *attribute_name) {
+ InnerClassesAttribute *attr = new InnerClassesAttribute;
+ attr->attribute_name_ = attribute_name;
+
+ u2 number_of_classes = get_u2be(p);
+ for (int ii = 0; ii < number_of_classes; ++ii) {
+ Entry *entry = new Entry;
+ entry->inner_class_info = constant(get_u2be(p));
+ entry->outer_class_info = constant(get_u2be(p));
+ entry->inner_name = constant(get_u2be(p));
+ entry->inner_class_access_flags = get_u2be(p);
+
+ attr->entries_.push_back(entry);
+ }
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ std::set<int> kept_entries;
+ // We keep an entry if the constant referring to the inner class is already
+ // kept. Then we mark its outer class and its class name as kept, too, then
+ // iterate until a fixed point is reached.
+ size_t entry_count;
+ int iteration = 0;
+
+ do {
+ entry_count = kept_entries.size();
+ for (size_t i_entry = 0; i_entry < entries_.size(); ++i_entry) {
+ Entry* entry = entries_[i_entry];
+ if (entry->inner_class_info->Kept() ||
+ used_class_names.find(entry->inner_class_info->Display())
+ != used_class_names.end() ||
+ entry->outer_class_info == class_name ||
+ entry->outer_class_info == NULL ||
+ entry->inner_name == NULL) {
+ kept_entries.insert(i_entry);
+
+ // These are zero for anonymous inner classes
+ if (entry->outer_class_info != NULL) {
+ entry->outer_class_info->slot();
+ }
+
+ if (entry->inner_name != NULL) {
+ entry->inner_name->slot();
+ }
+ }
+ }
+ iteration += 1;
+ } while (entry_count != kept_entries.size());
+
+ if (kept_entries.size() == 0) {
+ return;
+ }
+
+ WriteProlog(p, 2 + kept_entries.size() * 8);
+ put_u2be(p, kept_entries.size());
+
+ for (std::set<int>::iterator it = kept_entries.begin();
+ it != kept_entries.end();
+ ++it) {
+ Entry *entry = entries_[*it];
+ put_u2be(p, entry->inner_class_info == NULL
+ ? 0
+ : entry->inner_class_info->slot());
+ put_u2be(p, entry->outer_class_info == NULL
+ ? 0
+ : entry->outer_class_info->slot());
+ put_u2be(p, entry->inner_name == NULL
+ ? 0
+ : entry->inner_name->slot());
+ put_u2be(p, entry->inner_class_access_flags);
+ }
+ }
+
+ std::vector<Entry*> entries_;
+};
+
+// See sec.4.7.7 of JVM spec.
+// We preserve EnclosingMethod attributes to be able to identify local and
+// anonymous classes. These classes will be stripped of most content, as they
+// represent implementation details that shoudn't leak into the ijars. Omitting
+// EnclosingMethod attributes can lead to type-checking failures in the presence
+// of generics (see b/9070939).
+struct EnclosingMethodAttribute : Attribute {
+
+ static EnclosingMethodAttribute* Read(const u1 *&p,
+ Constant *attribute_name) {
+ EnclosingMethodAttribute *attr = new EnclosingMethodAttribute;
+ attr->attribute_name_ = attribute_name;
+ attr->class_ = constant(get_u2be(p));
+ attr->method_ = constant(get_u2be(p));
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, 4);
+ put_u2be(p, class_->slot());
+ put_u2be(p, method_ == NULL ? 0 : method_->slot());
+ }
+
+ Constant *class_;
+ Constant *method_;
+};
+
+// See sec.4.7.16.1 of JVM spec.
+// Used by AnnotationDefault and other attributes.
+struct ElementValue {
+ virtual ~ElementValue() {}
+ virtual void Write(u1 *&p) = 0;
+ virtual void ExtractClassNames() {}
+ static ElementValue* Read(const u1 *&p);
+ u1 tag_;
+ u4 length_;
+};
+
+struct BaseTypeElementValue : ElementValue {
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, const_value_->slot());
+ }
+ static BaseTypeElementValue *Read(const u1 *&p) {
+ BaseTypeElementValue *value = new BaseTypeElementValue;
+ value->const_value_ = constant(get_u2be(p));
+ return value;
+ }
+ Constant *const_value_;
+};
+
+struct EnumTypeElementValue : ElementValue {
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, type_name_->slot());
+ put_u2be(p, const_name_->slot());
+ }
+ static EnumTypeElementValue *Read(const u1 *&p) {
+ EnumTypeElementValue *value = new EnumTypeElementValue;
+ value->type_name_ = constant(get_u2be(p));
+ value->const_name_ = constant(get_u2be(p));
+ return value;
+ }
+ Constant *type_name_;
+ Constant *const_name_;
+};
+
+struct ClassTypeElementValue : ElementValue {
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, class_info_->slot());
+ }
+
+ virtual void ExtractClassNames() {
+ size_t idx = 0;
+ devtools_ijar::ExtractClassNames(class_info_->Display(), &idx);
+ }
+
+ static ClassTypeElementValue *Read(const u1 *&p) {
+ ClassTypeElementValue *value = new ClassTypeElementValue;
+ value->class_info_ = constant(get_u2be(p));
+ return value;
+ }
+ Constant *class_info_;
+};
+
+struct ArrayTypeElementValue : ElementValue {
+ virtual ~ArrayTypeElementValue() {
+ for (size_t i = 0; i < values_.size(); i++) {
+ delete values_[i];
+ }
+ }
+
+ virtual void ExtractClassNames() {
+ for (size_t i = 0; i < values_.size(); i++) {
+ values_[i]->ExtractClassNames();
+ }
+ }
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ put_u2be(p, values_.size());
+ for (size_t ii = 0; ii < values_.size(); ++ii) {
+ values_[ii]->Write(p);
+ }
+ }
+ static ArrayTypeElementValue *Read(const u1 *&p) {
+ ArrayTypeElementValue *value = new ArrayTypeElementValue;
+ u2 num_values = get_u2be(p);
+ for (int ii = 0; ii < num_values; ++ii) {
+ value->values_.push_back(ElementValue::Read(p));
+ }
+ return value;
+ }
+ std::vector<ElementValue*> values_;
+};
+
+// See sec.4.7.16 of JVM spec.
+struct Annotation {
+ virtual ~Annotation() {
+ for (size_t i = 0; i < element_value_pairs_.size(); i++) {
+ delete element_value_pairs_[i]->element_value_;
+ delete element_value_pairs_[i];
+ }
+ }
+
+ void ExtractClassNames() {
+ for (size_t i = 0; i < element_value_pairs_.size(); i++) {
+ element_value_pairs_[i]->element_value_->ExtractClassNames();
+ }
+ }
+
+ void Write(u1 *&p) {
+ put_u2be(p, type_->slot());
+ put_u2be(p, element_value_pairs_.size());
+ for (size_t ii = 0; ii < element_value_pairs_.size(); ++ii) {
+ put_u2be(p, element_value_pairs_[ii]->element_name_->slot());
+ element_value_pairs_[ii]->element_value_->Write(p);
+ }
+ }
+ static Annotation *Read(const u1 *&p) {
+ Annotation *value = new Annotation;
+ value->type_ = constant(get_u2be(p));
+ u2 num_element_value_pairs = get_u2be(p);
+ for (int ii = 0; ii < num_element_value_pairs; ++ii) {
+ ElementValuePair *pair = new ElementValuePair;
+ pair->element_name_ = constant(get_u2be(p));
+ pair->element_value_ = ElementValue::Read(p);
+ value->element_value_pairs_.push_back(pair);
+ }
+ return value;
+ }
+ Constant *type_;
+ struct ElementValuePair {
+ Constant *element_name_;
+ ElementValue *element_value_;
+ };
+ std::vector<ElementValuePair*> element_value_pairs_;
+};
+
+// See sec 4.7.20 of Java 8 JVM Spec
+//
+// Each entry in the annotations table represents a single run-time visible
+// annotation on a type used in a declaration or expression. The type_annotation
+// structure has the following format:
+//
+// type_annotation {
+// u1 target_type;
+// union {
+// type_parameter_target;
+// supertype_target;
+// type_parameter_bound_target;
+// empty_target;
+// method_formal_parameter_target;
+// throws_target;
+// localvar_target;
+// catch_target;
+// offset_target;
+// type_argument_target;
+// } target_info;
+// type_path target_path;
+// u2 type_index;
+// u2 num_element_value_pairs;
+// {
+// u2 element_name_index;
+// element_value value;
+// }
+// element_value_pairs[num_element_value_pairs];
+// }
+//
+struct TypeAnnotation {
+ virtual ~TypeAnnotation() {
+ delete target_info_;
+ delete type_path_;
+ delete annotation_;
+ }
+
+ void ExtractClassNames() {
+ annotation_->ExtractClassNames();
+ }
+
+ void Write(u1 *&p) {
+ put_u1(p, target_type_);
+ target_info_->Write(p);
+ type_path_->Write(p);
+ annotation_->Write(p);
+ }
+
+ static TypeAnnotation *Read(const u1 *&p) {
+ TypeAnnotation *value = new TypeAnnotation;
+ value->target_type_ = get_u1(p);
+ value->target_info_ = ReadTargetInfo(p, value->target_type_);
+ value->type_path_ = TypePath::Read(p);
+ value->annotation_ = Annotation::Read(p);
+ return value;
+ }
+
+ struct TargetInfo {
+ virtual ~TargetInfo() {}
+ virtual void Write(u1 *&p) = 0;
+ };
+
+ struct TypeParameterTargetInfo : TargetInfo {
+ void Write(u1 *&p) {
+ put_u1(p, type_parameter_index_);
+ }
+ static TypeParameterTargetInfo *Read(const u1 *&p) {
+ TypeParameterTargetInfo *value = new TypeParameterTargetInfo;
+ value->type_parameter_index_ = get_u1(p);
+ return value;
+ }
+ u1 type_parameter_index_;
+ };
+
+ struct ClassExtendsInfo : TargetInfo {
+ void Write(u1 *&p) {
+ put_u2be(p, supertype_index_);
+ }
+ static ClassExtendsInfo *Read(const u1 *&p) {
+ ClassExtendsInfo *value = new ClassExtendsInfo;
+ value->supertype_index_ = get_u2be(p);
+ return value;
+ }
+ u2 supertype_index_;
+ };
+
+ struct TypeParameterBoundInfo : TargetInfo {
+ void Write(u1 *&p) {
+ put_u1(p, type_parameter_index_);
+ put_u1(p, bound_index_);
+ }
+ static TypeParameterBoundInfo *Read(const u1 *&p) {
+ TypeParameterBoundInfo *value = new TypeParameterBoundInfo;
+ value->type_parameter_index_ = get_u1(p);
+ value->bound_index_ = get_u1(p);
+ return value;
+ }
+ u1 type_parameter_index_;
+ u1 bound_index_;
+ };
+
+ struct EmptyInfo : TargetInfo {
+ void Write(u1 *&) {}
+ static EmptyInfo *Read(const u1 *&) {
+ return new EmptyInfo;
+ }
+ };
+
+ struct MethodFormalParameterInfo : TargetInfo {
+ void Write(u1 *&p) {
+ put_u1(p, method_formal_parameter_index_);
+ }
+ static MethodFormalParameterInfo *Read(const u1 *&p) {
+ MethodFormalParameterInfo *value = new MethodFormalParameterInfo;
+ value->method_formal_parameter_index_ = get_u1(p);
+ return value;
+ }
+ u1 method_formal_parameter_index_;
+ };
+
+ struct ThrowsTypeInfo : TargetInfo {
+ void Write(u1 *&p) {
+ put_u2be(p, throws_type_index_);
+ }
+ static ThrowsTypeInfo *Read(const u1 *&p) {
+ ThrowsTypeInfo *value = new ThrowsTypeInfo;
+ value->throws_type_index_ = get_u2be(p);
+ return value;
+ }
+ u2 throws_type_index_;
+ };
+
+ static TargetInfo *ReadTargetInfo(const u1 *&p, u1 target_type) {
+ switch (target_type) {
+ case CLASS_TYPE_PARAMETER:
+ case METHOD_TYPE_PARAMETER:
+ return TypeParameterTargetInfo::Read(p);
+ case CLASS_EXTENDS:
+ return ClassExtendsInfo::Read(p);
+ case CLASS_TYPE_PARAMETER_BOUND:
+ case METHOD_TYPE_PARAMETER_BOUND:
+ return TypeParameterBoundInfo::Read(p);
+ case FIELD:
+ case METHOD_RETURN:
+ case METHOD_RECEIVER:
+ return new EmptyInfo;
+ case METHOD_FORMAL_PARAMETER:
+ return MethodFormalParameterInfo::Read(p);
+ case THROWS:
+ return ThrowsTypeInfo::Read(p);
+ default:
+ fprintf(stderr, "Illegal type annotation target type: %d\n",
+ target_type);
+ abort();
+ }
+ }
+
+ struct TypePath {
+ void Write(u1 *&p) {
+ put_u1(p, path_.size());
+ for (TypePathEntry entry : path_) {
+ put_u1(p, entry.type_path_kind_);
+ put_u1(p, entry.type_argument_index_);
+ }
+ }
+ static TypePath *Read(const u1 *&p) {
+ TypePath *value = new TypePath;
+ u1 path_length = get_u1(p);
+ for (int ii = 0; ii < path_length; ++ii) {
+ TypePathEntry entry;
+ entry.type_path_kind_ = get_u1(p);
+ entry.type_argument_index_ = get_u1(p);
+ value->path_.push_back(entry);
+ }
+ return value;
+ }
+
+ struct TypePathEntry {
+ u1 type_path_kind_;
+ u1 type_argument_index_;
+ };
+ std::vector<TypePathEntry> path_;
+ };
+
+ u1 target_type_;
+ TargetInfo *target_info_;
+ TypePath *type_path_;
+ Annotation *annotation_;
+};
+
+struct AnnotationTypeElementValue : ElementValue {
+ virtual ~AnnotationTypeElementValue() {
+ delete annotation_;
+ }
+
+ void Write(u1 *&p) {
+ put_u1(p, tag_);
+ annotation_->Write(p);
+ }
+ static AnnotationTypeElementValue *Read(const u1 *&p) {
+ AnnotationTypeElementValue *value = new AnnotationTypeElementValue;
+ value->annotation_ = Annotation::Read(p);
+ return value;
+ }
+
+ Annotation *annotation_;
+};
+
+ElementValue* ElementValue::Read(const u1 *&p) {
+ const u1* start = p;
+ ElementValue *result;
+ u1 tag = get_u1(p);
+ if (tag != 0 && strchr("BCDFIJSZs", (char) tag) != NULL) {
+ result = BaseTypeElementValue::Read(p);
+ } else if ((char) tag == 'e') {
+ result = EnumTypeElementValue::Read(p);
+ } else if ((char) tag == 'c') {
+ result = ClassTypeElementValue::Read(p);
+ } else if ((char) tag == '[') {
+ result = ArrayTypeElementValue::Read(p);
+ } else if ((char) tag == '@') {
+ result = AnnotationTypeElementValue::Read(p);
+ } else {
+ fprintf(stderr, "Illegal element_value::tag: %d\n", tag);
+ abort();
+ }
+ result->tag_ = tag;
+ result->length_ = p - start;
+ return result;
+}
+
+// See sec.4.7.20 of JVM spec.
+// We preserve AnnotationDefault attributes because they are required
+// in order to make use of an annotation in new code.
+struct AnnotationDefaultAttribute : Attribute {
+ virtual ~AnnotationDefaultAttribute() {
+ delete default_value_;
+ }
+
+ static AnnotationDefaultAttribute* Read(const u1 *&p,
+ Constant *attribute_name) {
+ AnnotationDefaultAttribute *attr = new AnnotationDefaultAttribute;
+ attr->attribute_name_ = attribute_name;
+ attr->default_value_ = ElementValue::Read(p);
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, default_value_->length_);
+ default_value_->Write(p);
+ }
+
+ virtual void ExtractClassNames() {
+ default_value_->ExtractClassNames();
+ }
+
+ ElementValue *default_value_;
+};
+
+// See sec.4.7.2 of JVM spec.
+// We preserve ConstantValue attributes because they are required for
+// compile-time constant propagation.
+struct ConstantValueAttribute : Attribute {
+
+ static ConstantValueAttribute* Read(const u1 *&p, Constant *attribute_name) {
+ ConstantValueAttribute *attr = new ConstantValueAttribute;
+ attr->attribute_name_ = attribute_name;
+ attr->constantvalue_ = constant(get_u2be(p));
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, 2);
+ put_u2be(p, constantvalue_->slot());
+ }
+
+ Constant *constantvalue_;
+};
+
+// See sec.4.7.9 of JVM spec.
+// We preserve Signature attributes because they are required by the
+// compiler for type-checking of generics.
+struct SignatureAttribute : Attribute {
+
+ static SignatureAttribute* Read(const u1 *&p, Constant *attribute_name) {
+ SignatureAttribute *attr = new SignatureAttribute;
+ attr->attribute_name_ = attribute_name;
+ attr->signature_ = constant(get_u2be(p));
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, 2);
+ put_u2be(p, signature_->slot());
+ }
+
+ virtual void ExtractClassNames() {
+ size_t signature_idx = 0;
+ devtools_ijar::ExtractClassNames(signature_->Display(), &signature_idx);
+ }
+
+ Constant *signature_;
+};
+
+// See sec.4.7.15 of JVM spec.
+// We preserve Deprecated attributes because they are required by the
+// compiler to generate warning messages.
+struct DeprecatedAttribute : Attribute {
+
+ static DeprecatedAttribute* Read(const u1 *&, Constant *attribute_name) {
+ DeprecatedAttribute *attr = new DeprecatedAttribute;
+ attr->attribute_name_ = attribute_name;
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, 0);
+ }
+};
+
+// See sec.4.7.16-17 of JVM spec v3. Includes RuntimeVisible and
+// RuntimeInvisible.
+//
+// We preserve all annotations.
+struct AnnotationsAttribute : Attribute {
+ virtual ~AnnotationsAttribute() {
+ for (size_t i = 0; i < annotations_.size(); i++) {
+ delete annotations_[i];
+ }
+ }
+
+ static AnnotationsAttribute* Read(const u1 *&p, Constant *attribute_name) {
+ AnnotationsAttribute *attr = new AnnotationsAttribute;
+ attr->attribute_name_ = attribute_name;
+ u2 num_annotations = get_u2be(p);
+ for (int ii = 0; ii < num_annotations; ++ii) {
+ Annotation *annotation = Annotation::Read(p);
+ attr->annotations_.push_back(annotation);
+ }
+ return attr;
+ }
+
+ virtual void ExtractClassNames() {
+ for (size_t i = 0; i < annotations_.size(); i++) {
+ annotations_[i]->ExtractClassNames();
+ }
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, -1);
+ u1 *payload_start = p - 4;
+ put_u2be(p, annotations_.size());
+ for (size_t ii = 0; ii < annotations_.size(); ++ii) {
+ annotations_[ii]->Write(p);
+ }
+ put_u4be(payload_start, p - 4 - payload_start); // backpatch length
+ }
+
+ std::vector<Annotation*> annotations_;
+};
+
+// See sec.4.7.18-19 of JVM spec. Includes RuntimeVisible and
+// RuntimeInvisible.
+//
+// We preserve all annotations.
+struct ParameterAnnotationsAttribute : Attribute {
+
+ static ParameterAnnotationsAttribute* Read(const u1 *&p,
+ Constant *attribute_name) {
+ ParameterAnnotationsAttribute *attr = new ParameterAnnotationsAttribute;
+ attr->attribute_name_ = attribute_name;
+ u1 num_parameters = get_u1(p);
+ for (int ii = 0; ii < num_parameters; ++ii) {
+ std::vector<Annotation*> annotations;
+ u2 num_annotations = get_u2be(p);
+ for (int ii = 0; ii < num_annotations; ++ii) {
+ Annotation *annotation = Annotation::Read(p);
+ annotations.push_back(annotation);
+ }
+ attr->parameter_annotations_.push_back(annotations);
+ }
+ return attr;
+ }
+
+ virtual void ExtractClassNames() {
+ for (size_t i = 0; i < parameter_annotations_.size(); i++) {
+ const std::vector<Annotation*>& annotations = parameter_annotations_[i];
+ for (size_t j = 0; j < annotations.size(); j++) {
+ annotations[j]->ExtractClassNames();
+ }
+ }
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, -1);
+ u1 *payload_start = p - 4;
+ put_u1(p, parameter_annotations_.size());
+ for (size_t ii = 0; ii < parameter_annotations_.size(); ++ii) {
+ std::vector<Annotation *> &annotations = parameter_annotations_[ii];
+ put_u2be(p, annotations.size());
+ for (size_t jj = 0; jj < annotations.size(); ++jj) {
+ annotations[jj]->Write(p);
+ }
+ }
+ put_u4be(payload_start, p - 4 - payload_start); // backpatch length
+ }
+
+ std::vector<std::vector<Annotation*> > parameter_annotations_;
+};
+
+// See sec.4.7.20 of Java 8 JVM spec. Includes RuntimeVisibleTypeAnnotations
+// and RuntimeInvisibleTypeAnnotations.
+struct TypeAnnotationsAttribute : Attribute {
+ static TypeAnnotationsAttribute* Read(const u1 *&p, Constant *attribute_name,
+ u4) {
+ auto attr = new TypeAnnotationsAttribute;
+ attr->attribute_name_ = attribute_name;
+ u2 num_annotations = get_u2be(p);
+ for (int ii = 0; ii < num_annotations; ++ii) {
+ TypeAnnotation *annotation = TypeAnnotation::Read(p);
+ attr->type_annotations_.push_back(annotation);
+ }
+ return attr;
+ }
+
+ virtual void ExtractClassNames() {
+ for (size_t i = 0; i < type_annotations_.size(); i++) {
+ type_annotations_[i]->ExtractClassNames();
+ }
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, -1);
+ u1 *payload_start = p - 4;
+ put_u2be(p, type_annotations_.size());
+ for (TypeAnnotation *annotation : type_annotations_) {
+ annotation->Write(p);
+ }
+ put_u4be(payload_start, p - 4 - payload_start); // backpatch length
+ }
+
+ std::vector<TypeAnnotation*> type_annotations_;
+};
+
+struct GeneralAttribute : Attribute {
+ static GeneralAttribute* Read(const u1 *&p, Constant *attribute_name,
+ u4 attribute_length) {
+ auto attr = new GeneralAttribute;
+ attr->attribute_name_ = attribute_name;
+ attr->attribute_length_ = attribute_length;
+ attr->attribute_content_ = p;
+ p += attribute_length;
+ return attr;
+ }
+
+ void Write(u1 *&p) {
+ WriteProlog(p, attribute_length_);
+ put_n(p, attribute_content_, attribute_length_);
+ }
+
+ u4 attribute_length_;
+ const u1 *attribute_content_;
+};
+
+/**********************************************************************
+ * *
+ * ClassFile *
+ * *
+ **********************************************************************/
+
+struct HasAttrs {
+ std::vector<Attribute*> attributes;
+
+ void WriteAttrs(u1 *&p);
+ void ReadAttrs(const u1 *&p);
+
+ virtual ~HasAttrs() {
+ for (size_t i = 0; i < attributes.size(); i++) {
+ delete attributes[i];
+ }
+ }
+
+ void ExtractClassNames() {
+ for (size_t i = 0; i < attributes.size(); i++) {
+ attributes[i]->ExtractClassNames();
+ }
+ }
+};
+
+// A field or method.
+// See sec.4.5 and 4.6 of JVM spec.
+struct Member : HasAttrs {
+ u2 access_flags;
+ Constant *name;
+ Constant *descriptor;
+
+ static Member* Read(const u1 *&p) {
+ Member *m = new Member;
+ m->access_flags = get_u2be(p);
+ m->name = constant(get_u2be(p));
+ m->descriptor = constant(get_u2be(p));
+ m->ReadAttrs(p);
+ return m;
+ }
+
+ void Write(u1 *&p) {
+ put_u2be(p, access_flags);
+ put_u2be(p, name->slot());
+ put_u2be(p, descriptor->slot());
+ WriteAttrs(p);
+ }
+};
+
+// See sec.4.1 of JVM spec.
+struct ClassFile : HasAttrs {
+
+ size_t length;
+
+ // Header:
+ u4 magic;
+ u2 major;
+ u2 minor;
+
+ // Body:
+ u2 access_flags;
+ Constant *this_class;
+ Constant *super_class;
+ std::vector<Constant*> interfaces;
+ std::vector<Member*> fields;
+ std::vector<Member*> methods;
+
+ virtual ~ClassFile() {
+ for (size_t i = 0; i < fields.size(); i++) {
+ delete fields[i];
+ }
+
+ for (size_t i = 0; i < methods.size(); i++) {
+ delete methods[i];
+ }
+
+ // Constants do not need to be deleted; they are owned by the constant pool.
+ }
+
+ void WriteClass(u1 *&p);
+
+ bool ReadConstantPool(const u1 *&p);
+
+ void StripIfAnonymous();
+
+ void WriteHeader(u1 *&p) {
+ put_u4be(p, magic);
+ put_u2be(p, major);
+ put_u2be(p, minor);
+
+ put_u2be(p, const_pool_out.size());
+ for (u2 ii = 1; ii < const_pool_out.size(); ++ii) {
+ if (const_pool_out[ii] != NULL) { // NB: NULLs appear after long/double.
+ const_pool_out[ii]->Write(p);
+ }
+ }
+ }
+
+ void WriteBody(u1 *&p) {
+ put_u2be(p, access_flags);
+ put_u2be(p, this_class->slot());
+ put_u2be(p, super_class == NULL ? 0 : super_class->slot());
+ put_u2be(p, interfaces.size());
+ for (size_t ii = 0; ii < interfaces.size(); ++ii) {
+ put_u2be(p, interfaces[ii]->slot());
+ }
+ put_u2be(p, fields.size());
+ for (size_t ii = 0; ii < fields.size(); ++ii) {
+ fields[ii]->Write(p);
+ }
+ put_u2be(p, methods.size());
+ for (size_t ii = 0; ii < methods.size(); ++ii) {
+ methods[ii]->Write(p);
+ }
+
+ Attribute* inner_classes = NULL;
+
+ // Make the inner classes attribute the last, so that it can know which
+ // constants were needed
+ for (size_t ii = 0; ii < attributes.size(); ii++) {
+ if (attributes[ii]->attribute_name_->Display() == "InnerClasses") {
+ inner_classes = attributes[ii];
+ attributes.erase(attributes.begin() + ii);
+ break;
+ }
+ }
+
+ if (inner_classes != NULL) {
+ attributes.push_back(inner_classes);
+ }
+
+ WriteAttrs(p);
+ }
+
+};
+
+void HasAttrs::ReadAttrs(const u1 *&p) {
+ u2 attributes_count = get_u2be(p);
+ for (int ii = 0; ii < attributes_count; ii++) {
+ Constant *attribute_name = constant(get_u2be(p));
+ u4 attribute_length = get_u4be(p);
+
+ std::string attr_name = attribute_name->Display();
+ if (attr_name == "SourceFile" ||
+ attr_name == "LineNumberTable" ||
+ attr_name == "LocalVariableTable" ||
+ attr_name == "LocalVariableTypeTable" ||
+ attr_name == "Code" ||
+ attr_name == "Synthetic" ||
+ attr_name == "BootstrapMethods") {
+ p += attribute_length; // drop these attributes
+ } else if (attr_name == "Exceptions") {
+ attributes.push_back(ExceptionsAttribute::Read(p, attribute_name));
+ } else if (attr_name == "Signature") {
+ attributes.push_back(SignatureAttribute::Read(p, attribute_name));
+ } else if (attr_name == "Deprecated") {
+ attributes.push_back(DeprecatedAttribute::Read(p, attribute_name));
+ } else if (attr_name == "EnclosingMethod") {
+ attributes.push_back(EnclosingMethodAttribute::Read(p, attribute_name));
+ } else if (attr_name == "InnerClasses") {
+ // TODO(bazel-team): omit private inner classes
+ attributes.push_back(InnerClassesAttribute::Read(p, attribute_name));
+ } else if (attr_name == "AnnotationDefault") {
+ attributes.push_back(AnnotationDefaultAttribute::Read(p, attribute_name));
+ } else if (attr_name == "ConstantValue") {
+ attributes.push_back(ConstantValueAttribute::Read(p, attribute_name));
+ } else if (attr_name == "RuntimeVisibleAnnotations" ||
+ attr_name == "RuntimeInvisibleAnnotations") {
+ attributes.push_back(AnnotationsAttribute::Read(p, attribute_name));
+ } else if (attr_name == "RuntimeVisibleParameterAnnotations" ||
+ attr_name == "RuntimeInvisibleParameterAnnotations") {
+ attributes.push_back(
+ ParameterAnnotationsAttribute::Read(p, attribute_name));
+ } else if (attr_name == "Scala" ||
+ attr_name == "ScalaSig" ||
+ attr_name == "ScalaInlineInfo") {
+ // These are opaque blobs, so can be handled with a general
+ // attribute handler
+ attributes.push_back(GeneralAttribute::Read(p, attribute_name,
+ attribute_length));
+ } else if (attr_name == "RuntimeVisibleTypeAnnotations" ||
+ attr_name == "RuntimeInvisibleTypeAnnotations") {
+ // JSR 308: annotations on types. JDK 7 has no use for these yet, but the
+ // Checkers Framework relies on them.
+ attributes.push_back(TypeAnnotationsAttribute::Read(p, attribute_name,
+ attribute_length));
+ } else {
+ // Skip over unknown attributes with a warning. The JVM spec
+ // says this is ok, so long as we handle the mandatory attributes.
+ fprintf(stderr, "ijar: skipping unknown attribute: \"%s\".\n",
+ attr_name.c_str());
+ p += attribute_length;
+ }
+ }
+}
+
+void HasAttrs::WriteAttrs(u1 *&p) {
+ u1* p_size = p;
+
+ put_u2be(p, 0);
+ int n_written_attrs = 0;
+ for (size_t ii = 0; ii < attributes.size(); ii++) {
+ u1* before = p;
+ attributes[ii]->Write(p);
+ if (p != before) {
+ n_written_attrs++;
+ }
+ }
+
+ put_u2be(p_size, n_written_attrs);
+}
+
+// See sec.4.4 of JVM spec.
+bool ClassFile::ReadConstantPool(const u1 *&p) {
+
+ const_pool_in.clear();
+ const_pool_in.push_back(NULL); // dummy first item
+
+ u2 cp_count = get_u2be(p);
+ for (int ii = 1; ii < cp_count; ++ii) {
+ u1 tag = get_u1(p);
+
+ if (devtools_ijar::verbose) {
+ fprintf(stderr, "cp[%d/%d] = tag %d\n", ii, cp_count, tag);
+ }
+
+ switch(tag) {
+ case CONSTANT_Class: {
+ u2 name_index = get_u2be(p);
+ const_pool_in.push_back(new Constant_Class(name_index));
+ break;
+ }
+ case CONSTANT_FieldRef:
+ case CONSTANT_Methodref:
+ case CONSTANT_Interfacemethodref: {
+ u2 class_index = get_u2be(p);
+ u2 nti = get_u2be(p);
+ const_pool_in.push_back(new Constant_FMIref(tag, class_index, nti));
+ break;
+ }
+ case CONSTANT_String: {
+ u2 string_index = get_u2be(p);
+ const_pool_in.push_back(new Constant_String(string_index));
+ break;
+ }
+ case CONSTANT_NameAndType: {
+ u2 name_index = get_u2be(p);
+ u2 descriptor_index = get_u2be(p);
+ const_pool_in.push_back(
+ new Constant_NameAndType(name_index, descriptor_index));
+ break;
+ }
+ case CONSTANT_Utf8: {
+ u2 length = get_u2be(p);
+ if (devtools_ijar::verbose) {
+ fprintf(stderr, "Utf8: \"%s\" (%d)\n",
+ std::string((const char*) p, length).c_str(), length);
+ }
+
+ const_pool_in.push_back(new Constant_Utf8(length, p));
+ p += length;
+ break;
+ }
+ case CONSTANT_Integer:
+ case CONSTANT_Float: {
+ u4 bytes = get_u4be(p);
+ const_pool_in.push_back(new Constant_IntegerOrFloat(tag, bytes));
+ break;
+ }
+ case CONSTANT_Long:
+ case CONSTANT_Double: {
+ u4 high_bytes = get_u4be(p);
+ u4 low_bytes = get_u4be(p);
+ const_pool_in.push_back(
+ new Constant_LongOrDouble(tag, high_bytes, low_bytes));
+ // Longs and doubles occupy two constant pool slots.
+ // ("In retrospect, making 8-byte constants take two "constant
+ // pool entries was a poor choice." --JVM Spec.)
+ const_pool_in.push_back(NULL);
+ ii++;
+ break;
+ }
+ case CONSTANT_MethodHandle: {
+ u1 reference_kind = get_u1(p);
+ u2 reference_index = get_u2be(p);
+ const_pool_in.push_back(
+ new Constant_MethodHandle(reference_kind, reference_index));
+ break;
+ }
+ case CONSTANT_MethodType: {
+ u2 descriptor_index = get_u2be(p);
+ const_pool_in.push_back(new Constant_MethodType(descriptor_index));
+ break;
+ }
+ case CONSTANT_InvokeDynamic: {
+ u2 bootstrap_method_attr = get_u2be(p);
+ u2 name_name_type_index = get_u2be(p);
+ const_pool_in.push_back(new Constant_InvokeDynamic(
+ bootstrap_method_attr, name_name_type_index));
+ break;
+ }
+ default: {
+ fprintf(stderr, "Unknown constant: %02x. Passing class through.\n",
+ tag);
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+// Anonymous inner classes are stripped to opaque classes that only extend
+// Object. None of their methods or fields are accessible anyway.
+void ClassFile::StripIfAnonymous() {
+ int enclosing_index = -1;
+ int inner_classes_index = -1;
+
+ for (size_t ii = 0; ii < attributes.size(); ++ii) {
+ if (attributes[ii]->attribute_name_->Display() == "EnclosingMethod") {
+ enclosing_index = ii;
+ } else if (attributes[ii]->attribute_name_->Display() == "InnerClasses") {
+ inner_classes_index = ii;
+ }
+ }
+
+ // Presence of an EnclosingMethod attribute indicates a local or anonymous
+ // class, which can be stripped.
+ if (enclosing_index > -1) {
+ // Clear the signature to only extend java.lang.Object.
+ super_class = NULL;
+ interfaces.clear();
+
+ // Clear away all fields (implementation details).
+ for (size_t ii = 0; ii < fields.size(); ++ii) {
+ delete fields[ii];
+ }
+ fields.clear();
+
+ // Clear away all methods (implementation details).
+ for (size_t ii = 0; ii < methods.size(); ++ii) {
+ delete methods[ii];
+ }
+ methods.clear();
+
+ // Only preserve the InnerClasses attribute to comply with the spec.
+ Attribute *attr = NULL;
+ for (size_t ii = 0; ii < attributes.size(); ++ii) {
+ if (static_cast<int>(ii) != inner_classes_index) {
+ delete attributes[ii];
+ } else {
+ attr = attributes[ii];
+ }
+ }
+ attributes.clear();
+ if (attr != NULL) {
+ attributes.push_back(attr);
+ }
+ }
+}
+
+static ClassFile *ReadClass(const void *classdata, size_t length) {
+ const u1 *p = (u1*) classdata;
+
+ ClassFile *clazz = new ClassFile;
+
+ clazz->length = length;
+
+ clazz->magic = get_u4be(p);
+ if (clazz->magic != 0xCAFEBABE) {
+ fprintf(stderr, "Bad magic %" PRIx32 "\n", clazz->magic);
+ abort();
+ }
+ clazz->major = get_u2be(p);
+ clazz->minor = get_u2be(p);
+
+ if (!clazz->ReadConstantPool(p)) {
+ delete clazz;
+ return NULL;
+ }
+
+ clazz->access_flags = get_u2be(p);
+ clazz->this_class = constant(get_u2be(p));
+ class_name = clazz->this_class;
+
+ u2 super_class_id = get_u2be(p);
+ clazz->super_class = super_class_id == 0 ? NULL : constant(super_class_id);
+
+ u2 interfaces_count = get_u2be(p);
+ for (int ii = 0; ii < interfaces_count; ++ii) {
+ clazz->interfaces.push_back(constant(get_u2be(p)));
+ }
+
+ u2 fields_count = get_u2be(p);
+ for (int ii = 0; ii < fields_count; ++ii) {
+ Member *field = Member::Read(p);
+
+ if (!(field->access_flags & ACC_PRIVATE)) { // drop private fields
+ clazz->fields.push_back(field);
+ }
+ }
+
+ u2 methods_count = get_u2be(p);
+ for (int ii = 0; ii < methods_count; ++ii) {
+ Member *method = Member::Read(p);
+
+ // drop class initializers
+ if (method->name->Display() == "<clinit>") continue;
+
+ if (!(method->access_flags & ACC_PRIVATE)) { // drop private methods
+ clazz->methods.push_back(method);
+ }
+ }
+
+ clazz->ReadAttrs(p);
+ clazz->StripIfAnonymous();
+
+ return clazz;
+}
+
+// In theory, '/' is also reserved, but it's okay if we just parse package
+// identifiers as part of the class name. Note that signatures are UTF-8, but
+// this works just as well as in plain ASCII.
+static const char *SIGNATURE_NON_IDENTIFIER_CHARS = ".;[<>:";
+
+void Expect(const std::string& desc, size_t* p, char expected) {
+ if (desc[*p] != expected) {
+ fprintf(stderr, "Expected '%c' in '%s' at %zd in signature\n",
+ expected, desc.substr(*p).c_str(), *p);
+ exit(1);
+ }
+
+ *p += 1;
+}
+
+// These functions form a crude recursive descent parser for descriptors and
+// signatures in class files (see JVM spec 4.3).
+//
+// This parser is a bit more liberal than the spec, but this should be fine,
+// because it accepts all valid class files and croaks only on invalid ones.
+void ParseFromClassTypeSignature(const std::string& desc, size_t* p);
+void ParseSimpleClassTypeSignature(const std::string& desc, size_t* p);
+void ParseClassTypeSignatureSuffix(const std::string& desc, size_t* p);
+void ParseIdentifier(const std::string& desc, size_t* p);
+void ParseTypeArgumentsOpt(const std::string& desc, size_t* p);
+void ParseMethodDescriptor(const std::string& desc, size_t* p);
+
+void ParseClassTypeSignature(const std::string& desc, size_t* p) {
+ Expect(desc, p, 'L');
+ ParseSimpleClassTypeSignature(desc, p);
+ ParseClassTypeSignatureSuffix(desc, p);
+ Expect(desc, p, ';');
+}
+
+void ParseSimpleClassTypeSignature(const std::string& desc, size_t* p) {
+ ParseIdentifier(desc, p);
+ ParseTypeArgumentsOpt(desc, p);
+}
+
+void ParseClassTypeSignatureSuffix(const std::string& desc, size_t* p) {
+ while (desc[*p] == '.') {
+ *p += 1;
+ ParseSimpleClassTypeSignature(desc, p);
+ }
+}
+
+void ParseIdentifier(const std::string& desc, size_t* p) {
+ size_t next = desc.find_first_of(SIGNATURE_NON_IDENTIFIER_CHARS, *p);
+ std::string id = desc.substr(*p, next - *p);
+ used_class_names.insert(id);
+ *p = next;
+}
+
+void ParseTypeArgumentsOpt(const std::string& desc, size_t* p) {
+ if (desc[*p] != '<') {
+ return;
+ }
+
+ *p += 1;
+ while (desc[*p] != '>') {
+ switch (desc[*p]) {
+ case '*':
+ *p += 1;
+ break;
+
+ case '+':
+ case '-':
+ *p += 1;
+ ExtractClassNames(desc, p);
+ break;
+
+ default:
+ ExtractClassNames(desc, p);
+ break;
+ }
+ }
+
+ *p += 1;
+}
+
+void ParseMethodDescriptor(const std::string& desc, size_t* p) {
+ Expect(desc, p, '(');
+ while (desc[*p] != ')') {
+ ExtractClassNames(desc, p);
+ }
+
+ Expect(desc, p, ')');
+ ExtractClassNames(desc, p);
+}
+
+void ParseFormalTypeParameters(const std::string& desc, size_t* p) {
+ Expect(desc, p, '<');
+ while (desc[*p] != '>') {
+ ParseIdentifier(desc, p);
+ Expect(desc, p, ':');
+ if (desc[*p] != ':' && desc[*p] != '>') {
+ ExtractClassNames(desc, p);
+ }
+
+ while (desc[*p] == ':') {
+ Expect(desc, p, ':');
+ ExtractClassNames(desc, p);
+ }
+ }
+
+ Expect(desc, p, '>');
+}
+
+void ExtractClassNames(const std::string& desc, size_t* p) {
+ switch (desc[*p]) {
+ case '<':
+ ParseFormalTypeParameters(desc, p);
+ ExtractClassNames(desc, p);
+ break;
+
+ case 'L':
+ ParseClassTypeSignature(desc, p);
+ break;
+
+ case '[':
+ *p += 1;
+ ExtractClassNames(desc, p);
+ break;
+
+ case 'T':
+ *p += 1;
+ ParseIdentifier(desc, p);
+ Expect(desc, p, ';');
+ break;
+
+ case '(':
+ ParseMethodDescriptor(desc, p);
+ break;
+
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'F':
+ case 'I':
+ case 'J':
+ case 'S':
+ case 'Z':
+ case 'V':
+ *p += 1;
+ break;
+
+ default:
+ fprintf(stderr, "Invalid signature %s\n", desc.substr(*p).c_str());
+ }
+}
+
+void ClassFile::WriteClass(u1 *&p) {
+ used_class_names.clear();
+ std::vector<Member *> members;
+ members.insert(members.end(), fields.begin(), fields.end());
+ members.insert(members.end(), methods.begin(), methods.end());
+ ExtractClassNames();
+ for (size_t i = 0; i < members.size(); i++) {
+ Member *member = members[i];
+ size_t idx = 0;
+ devtools_ijar::ExtractClassNames(member->descriptor->Display(), &idx);
+ member->ExtractClassNames();
+ }
+
+ // We have to write the body out before the header in order to reference
+ // the essential constants and populate the output constant pool:
+ u1 *body = new u1[length];
+ u1 *q = body;
+ WriteBody(q); // advances q
+ u4 body_length = q - body;
+
+ WriteHeader(p); // advances p
+ put_n(p, body, body_length);
+ delete[] body;
+}
+
+
+void StripClass(u1 *&classdata_out, const u1 *classdata_in, size_t in_length) {
+ ClassFile *clazz = ReadClass(classdata_in, in_length);
+ if (clazz == NULL) {
+ // Class is invalid. Simply copy it to the output and call it a day.
+ put_n(classdata_out, classdata_in, in_length);
+ } else {
+
+ // Constant pool item zero is a dummy entry. Setting it marks the
+ // beginning of the output phase; calls to Constant::slot() will
+ // fail if called prior to this.
+ const_pool_out.push_back(NULL);
+ clazz->WriteClass(classdata_out);
+
+ delete clazz;
+ }
+
+ // Now clean up all the mess we left behind.
+
+ for (size_t i = 0; i < const_pool_in.size(); i++) {
+ delete const_pool_in[i];
+ }
+
+ const_pool_in.clear();
+ const_pool_out.clear();
+}
+
+} // namespace devtools_ijar
diff --git a/tools/ijar/common.h b/tools/ijar/common.h
new file mode 100644
index 0000000..118041b
--- /dev/null
+++ b/tools/ijar/common.h
@@ -0,0 +1,102 @@
+// Copyright 2001,2007 Alan Donovan. All rights reserved.
+//
+// Author: Alan Donovan <adonovan@google.com>
+//
+// 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.
+//
+// common.h -- common definitions.
+//
+
+#ifndef INCLUDED_DEVTOOLS_IJAR_COMMON_H
+#define INCLUDED_DEVTOOLS_IJAR_COMMON_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+namespace devtools_ijar {
+
+typedef unsigned long long u8;
+typedef uint32_t u4;
+typedef uint16_t u2;
+typedef uint8_t u1;
+
+// be = big endian, le = little endian
+
+inline u1 get_u1(const u1 *&p) {
+ return *p++;
+}
+
+inline u2 get_u2be(const u1 *&p) {
+ u4 x = (p[0] << 8) | p[1];
+ p += 2;
+ return x;
+}
+
+inline u2 get_u2le(const u1 *&p) {
+ u4 x = (p[1] << 8) | p[0];
+ p += 2;
+ return x;
+}
+
+inline u4 get_u4be(const u1 *&p) {
+ u4 x = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+ p += 4;
+ return x;
+}
+
+inline u4 get_u4le(const u1 *&p) {
+ u4 x = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
+ p += 4;
+ return x;
+}
+
+inline void put_u1(u1 *&p, u1 x) {
+ *p++ = x;
+}
+
+inline void put_u2be(u1 *&p, u2 x) {
+ *p++ = x >> 8;
+ *p++ = x & 0xff;
+}
+
+inline void put_u2le(u1 *&p, u2 x) {
+ *p++ = x & 0xff;
+ *p++ = x >> 8;;
+}
+
+inline void put_u4be(u1 *&p, u4 x) {
+ *p++ = x >> 24;
+ *p++ = (x >> 16) & 0xff;
+ *p++ = (x >> 8) & 0xff;
+ *p++ = x & 0xff;
+}
+
+inline void put_u4le(u1 *&p, u4 x) {
+ *p++ = x & 0xff;
+ *p++ = (x >> 8) & 0xff;
+ *p++ = (x >> 16) & 0xff;
+ *p++ = x >> 24;
+}
+
+// Copy n bytes from src to p, and advance p.
+inline void put_n(u1 *&p, const u1 *src, size_t n) {
+ memcpy(p, src, n);
+ p += n;
+}
+
+extern bool verbose;
+
+} // namespace devtools_ijar
+
+#endif // INCLUDED_DEVTOOLS_IJAR_COMMON_H
diff --git a/tools/ijar/ijar.cc b/tools/ijar/ijar.cc
new file mode 100644
index 0000000..1925b48
--- /dev/null
+++ b/tools/ijar/ijar.cc
@@ -0,0 +1,182 @@
+// Copyright 2001,2007 Alan Donovan. All rights reserved.
+//
+// Author: Alan Donovan <adonovan@google.com>
+//
+// 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.
+//
+// ijar.cpp -- .jar -> _interface.jar tool.
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <errno.h>
+#include <memory>
+
+#include "zip.h"
+
+namespace devtools_ijar {
+
+bool verbose = false;
+
+// Reads a JVM class from classdata_in (of the specified length), and
+// writes out a simplified class to classdata_out, advancing the
+// pointer.
+void StripClass(u1 *&classdata_out, const u1 *classdata_in, size_t in_length);
+
+const char* CLASS_EXTENSION = ".class";
+const size_t CLASS_EXTENSION_LENGTH = strlen(CLASS_EXTENSION);
+
+// ZipExtractorProcessor that select only .class file and use
+// StripClass to generate an interface class, storing as a new file
+// in the specified ZipBuilder.
+class JarStripperProcessor : public ZipExtractorProcessor {
+ public:
+ JarStripperProcessor() {}
+ virtual ~JarStripperProcessor() {}
+
+ virtual void Process(const char* filename, const u4 attr,
+ const u1* data, const size_t size);
+ virtual bool Accept(const char* filename, const u4 attr);
+
+ private:
+ // Not owned by JarStripperProcessor, see SetZipBuilder().
+ ZipBuilder* builder;
+
+ public:
+ // Set the ZipBuilder to add the ijar class to the output zip file.
+ // This pointer should not be deleted while this class is still in use and
+ // it should be set before any call to the Process() method.
+ void SetZipBuilder(ZipBuilder* builder) {
+ this->builder = builder;
+ }
+};
+
+bool JarStripperProcessor::Accept(const char* filename, const u4) {
+ ssize_t offset = strlen(filename) - CLASS_EXTENSION_LENGTH;
+ if (offset >= 0) {
+ return strcmp(filename + offset, CLASS_EXTENSION) == 0;
+ }
+ return false;
+}
+
+void JarStripperProcessor::Process(const char* filename, const u4,
+ const u1* data, const size_t size) {
+ if (verbose) {
+ fprintf(stderr, "INFO: StripClass: %s\n", filename);
+ }
+ u1 *q = builder->NewFile(filename, 0);
+ u1 *classdata_out = q;
+ StripClass(q, data, size); // actually process it
+ size_t out_length = q - classdata_out;
+ builder->FinishFile(out_length);
+}
+
+// Opens "file_in" (a .jar file) for reading, and writes an interface
+// .jar to "file_out".
+void OpenFilesAndProcessJar(const char *file_out, const char *file_in) {
+ JarStripperProcessor processor;
+ std::unique_ptr<ZipExtractor> in(ZipExtractor::Create(file_in, &processor));
+ if (in.get() == NULL) {
+ fprintf(stderr, "Unable to open Zip file %s: %s\n", file_in,
+ strerror(errno));
+ abort();
+ }
+ u8 output_length = in->CalculateOutputLength();
+ std::unique_ptr<ZipBuilder> out(ZipBuilder::Create(file_out, output_length));
+ if (out.get() == NULL) {
+ fprintf(stderr, "Unable to open output file %s: %s\n", file_out,
+ strerror(errno));
+ abort();
+ }
+ processor.SetZipBuilder(out.get());
+
+ // Process all files in the zip
+ if (in->ProcessAll() < 0) {
+ fprintf(stderr, "%s\n", in->GetError());
+ abort();
+ }
+
+ // Add dummy file, since javac doesn't like truly empty jars.
+ if (out->GetNumberFiles() == 0) {
+ out->WriteEmptyFile("dummy");
+ }
+ // Finish writing the output file
+ if (out->Finish() < 0) {
+ fprintf(stderr, "%s\n", out->GetError());
+ abort();
+ }
+ // Get all file size
+ size_t in_length = in->GetSize();
+ size_t out_length = out->GetSize();
+ if (verbose) {
+ fprintf(stderr, "INFO: produced interface jar: %s -> %s (%d%%).\n",
+ file_in, file_out,
+ static_cast<int>(100.0 * out_length / in_length));
+ }
+}
+
+} // namespace devtools_ijar
+
+//
+// main method
+//
+static void usage() {
+ fprintf(stderr, "Usage: ijar [-v] x.jar [x_interface.jar>]\n");
+ fprintf(stderr, "Creates an interface jar from the specified jar file.\n");
+ exit(1);
+}
+
+int main(int argc, char **argv) {
+ const char *filename_in = NULL;
+ const char *filename_out = NULL;
+
+ for (int ii = 1; ii < argc; ++ii) {
+ if (strcmp(argv[ii], "-v") == 0) {
+ devtools_ijar::verbose = true;
+ } else if (filename_in == NULL) {
+ filename_in = argv[ii];
+ } else if (filename_out == NULL) {
+ filename_out = argv[ii];
+ } else {
+ usage();
+ }
+ }
+
+ if (filename_in == NULL) {
+ usage();
+ }
+
+ // Guess output filename from input:
+ char filename_out_buf[PATH_MAX];
+ if (filename_out == NULL) {
+ size_t len = strlen(filename_in);
+ if (len > 4 && strncmp(filename_in + len - 4, ".jar", 4) == 0) {
+ strcpy(filename_out_buf, filename_in);
+ strcpy(filename_out_buf + len - 4, "-interface.jar");
+ filename_out = filename_out_buf;
+ } else {
+ fprintf(stderr, "Can't determine output filename since input filename "
+ "doesn't end with '.jar'.\n");
+ return 1;
+ }
+ }
+
+ if (devtools_ijar::verbose) {
+ fprintf(stderr, "INFO: writing to '%s'.\n", filename_out);
+ }
+
+ devtools_ijar::OpenFilesAndProcessJar(filename_out, filename_in);
+ return 0;
+}
diff --git a/tools/ijar/zip.cc b/tools/ijar/zip.cc
new file mode 100644
index 0000000..ca5f396
--- /dev/null
+++ b/tools/ijar/zip.cc
@@ -0,0 +1,1031 @@
+// Copyright 2007 Alan Donovan. All rights reserved.
+//
+// Author: Alan Donovan <adonovan@google.com>
+//
+// 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.
+//
+// zip.cc -- .zip (.jar) file reading/writing routines.
+//
+
+// See README.txt for details.
+//
+// See http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+// for definition of PKZIP file format.
+
+#define _FILE_OFFSET_BITS 64 // Support zip files larger than 2GB
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <limits.h>
+#include <limits>
+#include <vector>
+
+#include "zip.h"
+#include <zlib.h>
+
+#define LOCAL_FILE_HEADER_SIGNATURE 0x04034b50
+#define CENTRAL_FILE_HEADER_SIGNATURE 0x02014b50
+#define END_OF_CENTRAL_DIR_SIGNATURE 0x06054b50
+#define DATA_DESCRIPTOR_SIGNATURE 0x08074b50
+
+// version to extract: 1.0 - default value from APPNOTE.TXT.
+// Output JAR files contain no extra ZIP features, so this is enough.
+#define ZIP_VERSION_TO_EXTRACT 10
+#define COMPRESSION_METHOD_STORED 0 // no compression
+#define COMPRESSION_METHOD_DEFLATED 8
+
+#define GENERAL_PURPOSE_BIT_FLAG_COMPRESSED (1 << 3)
+#define GENERAL_PURPOSE_BIT_FLAG_UTF8_ENCODED (1 << 11)
+#define GENERAL_PURPOSE_BIT_FLAG_COMPRESSION_SPEED ((1 << 2) | (1 << 1))
+#define GENERAL_PURPOSE_BIT_FLAG_SUPPORTED \
+ (GENERAL_PURPOSE_BIT_FLAG_COMPRESSED \
+ | GENERAL_PURPOSE_BIT_FLAG_UTF8_ENCODED \
+ | GENERAL_PURPOSE_BIT_FLAG_COMPRESSION_SPEED)
+
+namespace devtools_ijar {
+// In the absence of ZIP64 support, zip files are limited to 4GB.
+// http://www.info-zip.org/FAQ.html#limits
+static const u8 kMaximumOutputSize = std::numeric_limits<uint32_t>::max();
+
+static bool ProcessCentralDirEntry(const u1 *&p,
+ size_t *compressed_size,
+ size_t *uncompressed_size,
+ char *filename,
+ size_t filename_size,
+ u4 *attr,
+ u4 *offset);
+
+//
+// A class representing a ZipFile for reading. Its public API is exposed
+// using the ZipExtractor abstract class.
+//
+class InputZipFile : public ZipExtractor {
+ public:
+ InputZipFile(ZipExtractorProcessor *processor, int fd, off_t in_length,
+ off_t in_offset, const u1* zipdata_in, const u1* central_dir);
+ virtual ~InputZipFile();
+
+ virtual const char* GetError() {
+ if (errmsg[0] == 0) {
+ return NULL;
+ }
+ return errmsg;
+ }
+
+ virtual bool ProcessNext();
+ virtual void Reset();
+ virtual size_t GetSize() {
+ return in_length_;
+ }
+
+ virtual u8 CalculateOutputLength();
+
+ private:
+ ZipExtractorProcessor *processor;
+
+ int fd_in; // Input file descripor
+
+ // InputZipFile is responsible for maintaining the following
+ // pointers. They are allocated by the Create() method before
+ // the object is actually created using mmap.
+ const u1 * const zipdata_in_; // start of input file mmap
+ const u1 * zipdata_in_mapped_; // start of still mapped region
+ const u1 * const central_dir_; // central directory in input file
+
+ size_t in_length_; // size of the input file
+ size_t in_offset_; // offset the input file
+
+ const u1 *p; // input cursor
+
+ const u1* central_dir_current_; // central dir input cursor
+
+ // Buffer size is initially INITIAL_BUFFER_SIZE. It doubles in size every
+ // time it is found too small, until it reaches MAX_BUFFER_SIZE. If that is
+ // not enough, we bail out. We only decompress class files, so they should
+ // be smaller than 64K anyway, but we give a little leeway.
+ // MAX_BUFFER_SIZE must be bigger than the size of the biggest file in the
+ // ZIP. It is set to 128M here so we can uncompress the Bazel server with
+ // this library.
+ static const size_t INITIAL_BUFFER_SIZE = 256 * 1024; // 256K
+ static const size_t MAX_BUFFER_SIZE = 128 * 1024 * 1024;
+ static const size_t MAX_MAPPED_REGION = 32 * 1024 * 1024;
+
+ // These metadata fields are the fields of the ZIP header of the file being
+ // processed.
+ u2 extract_version_;
+ u2 general_purpose_bit_flag_;
+ u2 compression_method_;
+ u4 uncompressed_size_;
+ u4 compressed_size_;
+ u2 file_name_length_;
+ u2 extra_field_length_;
+ const u1 *file_name_;
+ const u1 *extra_field_;
+
+ // Administration of memory reserved for decompressed data. We use the same
+ // buffer for each file to avoid some malloc()/free() calls and free the
+ // memory only in the dtor. C-style memory management is used so that we
+ // can call realloc.
+ u1 *uncompressed_data_;
+ size_t uncompressed_data_allocated_;
+
+ // Copy of the last filename entry - Null-terminated.
+ char filename[PATH_MAX];
+ // The external file attribute field
+ u4 attr;
+
+ // last error
+ char errmsg[4*PATH_MAX];
+
+ int error(const char *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(errmsg, 4*PATH_MAX, fmt, ap);
+ va_end(ap);
+ return -1;
+ }
+
+ // Check that at least n bytes remain in the input file, otherwise
+ // abort with an error message. "state" is the name of the field
+ // we're about to read, for diagnostics.
+ int EnsureRemaining(size_t n, const char *state) {
+ size_t in_offset = p - zipdata_in_;
+ size_t remaining = in_length_ - in_offset;
+ if (n > remaining) {
+ return error("Premature end of file (at offset %zd, state=%s); "
+ "expected %zd more bytes but found %zd.\n",
+ in_offset, state, n, remaining);
+ }
+ return 0;
+ }
+
+ // Read one entry from input zip file
+ int ProcessLocalFileEntry(size_t compressed_size, size_t uncompressed_size);
+
+ // Uncompress a file from the archive using zlib. The pointer returned
+ // is owned by InputZipFile, so it must not be freed. Advances the input
+ // cursor to the first byte after the compressed data.
+ u1* UncompressFile();
+
+ // Skip a file
+ int SkipFile(const bool compressed);
+
+ // Process a file
+ int ProcessFile(const bool compressed);
+};
+
+//
+// A class implementing ZipBuilder that represent an open zip file for writing.
+//
+class OutputZipFile : public ZipBuilder {
+ public:
+ OutputZipFile(int fd, u1 * const zipdata_out) :
+ fd_out(fd),
+ zipdata_out_(zipdata_out),
+ q(zipdata_out) {
+ errmsg[0] = 0;
+ }
+
+ virtual const char* GetError() {
+ if (errmsg[0] == 0) {
+ return NULL;
+ }
+ return errmsg;
+ }
+
+ virtual ~OutputZipFile() { Finish(); }
+ virtual u1* NewFile(const char* filename, const u4 attr);
+ virtual int FinishFile(size_t filelength, bool compress = false,
+ bool compute_crc = false);
+ virtual int WriteEmptyFile(const char *filename);
+ virtual size_t GetSize() {
+ return Offset(q);
+ }
+ virtual int GetNumberFiles() {
+ return entries_.size();
+ }
+ virtual int Finish();
+
+ private:
+ struct LocalFileEntry {
+ // Start of the local header (in the output buffer).
+ size_t local_header_offset;
+
+ // Sizes of the file entry
+ size_t uncompressed_length;
+ size_t compressed_length;
+
+ // Compression method
+ u2 compression_method;
+
+ // CRC32
+ u4 crc32;
+
+ // external attributes field
+ u4 external_attr;
+
+ // Start/length of the file_name in the local header.
+ u1 *file_name;
+ u2 file_name_length;
+
+ // Start/length of the extra_field in the local header.
+ const u1 *extra_field;
+ u2 extra_field_length;
+ };
+
+ int fd_out; // file descriptor for the output file
+
+ // OutputZipFile is responsible for maintaining the following
+ // pointers. They are allocated by the Create() method before
+ // the object is actually created using mmap.
+ u1 * const zipdata_out_; // start of output file mmap
+ u1 *q; // output cursor
+
+ u1 *header_ptr; // Current pointer to "compression method" entry.
+
+ // List of entries to write the central directory
+ std::vector<LocalFileEntry*> entries_;
+
+ // last error
+ char errmsg[4*PATH_MAX];
+
+ int error(const char *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(errmsg, 4*PATH_MAX, fmt, ap);
+ va_end(ap);
+ return -1;
+ }
+
+ // Write the ZIP central directory structure for each local file
+ // entry in "entries".
+ void WriteCentralDirectory();
+
+ // Returns the offset of the pointer relative to the start of the
+ // output zip file.
+ size_t Offset(const u1 *const x) {
+ return x - zipdata_out_;
+ }
+
+ // Write ZIP file header in the output. Since the compressed size is not
+ // known in advance, it must be recorded later. This method returns a pointer
+ // to "compressed size" in the file header that should be passed to
+ // WriteFileSizeInLocalFileHeader() later.
+ u1* WriteLocalFileHeader(const char *filename, const u4 attr);
+
+ // Fill in the "compressed size" and "uncompressed size" fields in a local
+ // file header previously written by WriteLocalFileHeader().
+ size_t WriteFileSizeInLocalFileHeader(u1 *header_ptr,
+ size_t out_length,
+ bool compress = false,
+ const u4 crc = 0);
+};
+
+//
+// Implementation of InputZipFile
+//
+bool InputZipFile::ProcessNext() {
+ // Process the next entry in the central directory. Also make sure that the
+ // content pointer is in sync.
+ size_t compressed, uncompressed;
+ u4 offset;
+ if (!ProcessCentralDirEntry(central_dir_current_, &compressed, &uncompressed,
+ filename, PATH_MAX, &attr, &offset)) {
+ return false;
+ }
+
+ // There might be an offset specified in the central directory that does
+ // not match the file offset, if so, correct the pointer.
+ if (offset != 0 && (p != (zipdata_in_ + in_offset_ + offset))) {
+ p = zipdata_in_ + offset;
+ }
+
+ if (EnsureRemaining(4, "signature") < 0) {
+ return false;
+ }
+ u4 signature = get_u4le(p);
+ if (signature == LOCAL_FILE_HEADER_SIGNATURE) {
+ if (ProcessLocalFileEntry(compressed, uncompressed) < 0) {
+ return false;
+ }
+ } else {
+ error("local file header signature for file %s not found\n", filename);
+ return false;
+ }
+
+ return true;
+}
+
+int InputZipFile::ProcessLocalFileEntry(
+ size_t compressed_size, size_t uncompressed_size) {
+ if (EnsureRemaining(26, "extract_version") < 0) {
+ return -1;
+ }
+ extract_version_ = get_u2le(p);
+ general_purpose_bit_flag_ = get_u2le(p);
+
+ if ((general_purpose_bit_flag_ & ~GENERAL_PURPOSE_BIT_FLAG_SUPPORTED) != 0) {
+ return error("Unsupported value (0x%04x) in general purpose bit flag.\n",
+ general_purpose_bit_flag_);
+ }
+
+ compression_method_ = get_u2le(p);
+
+ if (compression_method_ != COMPRESSION_METHOD_DEFLATED &&
+ compression_method_ != COMPRESSION_METHOD_STORED) {
+ return error("Unsupported compression method (%d).\n",
+ compression_method_);
+ }
+
+ // skip over: last_mod_file_time, last_mod_file_date, crc32
+ p += 2 + 2 + 4;
+ compressed_size_ = get_u4le(p);
+ uncompressed_size_ = get_u4le(p);
+ file_name_length_ = get_u2le(p);
+ extra_field_length_ = get_u2le(p);
+
+ if (EnsureRemaining(file_name_length_, "file_name") < 0) {
+ return -1;
+ }
+ file_name_ = p;
+ p += file_name_length_;
+
+ if (EnsureRemaining(extra_field_length_, "extra_field") < 0) {
+ return -1;
+ }
+ extra_field_ = p;
+ p += extra_field_length_;
+
+ bool is_compressed = compression_method_ == COMPRESSION_METHOD_DEFLATED;
+
+ // If the zip is compressed, compressed and uncompressed size members are
+ // zero in the local file header. If not, check that they are the same as the
+ // lengths from the central directory, otherwise, just believe the central
+ // directory
+ if (compressed_size_ == 0) {
+ compressed_size_ = compressed_size;
+ } else {
+ if (compressed_size_ != compressed_size) {
+ return error("central directory and file header inconsistent\n");
+ }
+ }
+
+ if (uncompressed_size_ == 0) {
+ uncompressed_size_ = uncompressed_size;
+ } else {
+ if (uncompressed_size_ != uncompressed_size) {
+ return error("central directory and file header inconsistent\n");
+ }
+ }
+
+ if (processor->Accept(filename, attr)) {
+ if (ProcessFile(is_compressed) < 0) {
+ return -1;
+ }
+ } else {
+ if (SkipFile(is_compressed) < 0) {
+ return -1;
+ }
+ }
+
+ if (general_purpose_bit_flag_ & GENERAL_PURPOSE_BIT_FLAG_COMPRESSED) {
+ // Skip the data descriptor. Some implementations do not put the signature
+ // here, so check if the next 4 bytes are a signature, and if so, skip the
+ // next 12 bytes (for CRC, compressed/uncompressed size), otherwise skip
+ // the next 8 bytes (because the value just read was the CRC).
+ u4 signature = get_u4le(p);
+ if (signature == DATA_DESCRIPTOR_SIGNATURE) {
+ p += 4 * 3;
+ } else {
+ p += 4 * 2;
+ }
+ }
+
+ if (p > zipdata_in_mapped_ + MAX_MAPPED_REGION) {
+ munmap(const_cast<u1 *>(zipdata_in_mapped_), MAX_MAPPED_REGION);
+ zipdata_in_mapped_ += MAX_MAPPED_REGION;
+ }
+
+ return 0;
+}
+
+int InputZipFile::SkipFile(const bool compressed) {
+ if (!compressed) {
+ // In this case, compressed_size_ == uncompressed_size_ (since the file is
+ // uncompressed), so we can use either.
+ if (compressed_size_ != uncompressed_size_) {
+ return error("compressed size != uncompressed size, although the file "
+ "is uncompressed.\n");
+ }
+ }
+
+ if (EnsureRemaining(compressed_size_, "file_data") < 0) {
+ return -1;
+ }
+ p += compressed_size_;
+ return 0;
+}
+
+u1* InputZipFile::UncompressFile() {
+ size_t in_offset = p - zipdata_in_;
+ size_t remaining = in_length_ - in_offset;
+ z_stream stream;
+
+ stream.zalloc = Z_NULL;
+ stream.zfree = Z_NULL;
+ stream.opaque = Z_NULL;
+ stream.avail_in = remaining;
+ stream.next_in = (Bytef *) p;
+
+ int ret = inflateInit2(&stream, -MAX_WBITS);
+ if (ret != Z_OK) {
+ error("inflateInit: %d\n", ret);
+ return NULL;
+ }
+
+ int uncompressed_until_now = 0;
+
+ while (true) {
+ stream.avail_out = uncompressed_data_allocated_ - uncompressed_until_now;
+ stream.next_out = uncompressed_data_ + uncompressed_until_now;
+ int old_avail_out = stream.avail_out;
+
+ ret = inflate(&stream, Z_SYNC_FLUSH);
+ int uncompressed_now = old_avail_out - stream.avail_out;
+ uncompressed_until_now += uncompressed_now;
+
+ switch (ret) {
+ case Z_STREAM_END: {
+ // zlib said that there is no more data to decompress.
+
+ u1 *new_p = reinterpret_cast<u1*>(stream.next_in);
+ compressed_size_ = new_p - p;
+ uncompressed_size_ = uncompressed_until_now;
+ p = new_p;
+ inflateEnd(&stream);
+ return uncompressed_data_;
+ }
+
+ case Z_OK: {
+ // zlib said that there is no more room in the buffer allocated for
+ // the decompressed data. Enlarge that buffer and try again.
+
+ if (uncompressed_data_allocated_ == MAX_BUFFER_SIZE) {
+ error("ijar does not support decompressing files "
+ "larger than %dMB.\n",
+ (int) (MAX_BUFFER_SIZE/(1024*1024)));
+ return NULL;
+ }
+
+ uncompressed_data_allocated_ *= 2;
+ if (uncompressed_data_allocated_ > MAX_BUFFER_SIZE) {
+ uncompressed_data_allocated_ = MAX_BUFFER_SIZE;
+ }
+
+ uncompressed_data_ = reinterpret_cast<u1*>(
+ realloc(uncompressed_data_, uncompressed_data_allocated_));
+ break;
+ }
+
+ case Z_DATA_ERROR:
+ case Z_BUF_ERROR:
+ case Z_STREAM_ERROR:
+ case Z_NEED_DICT:
+ default: {
+ error("zlib returned error code %d during inflate.\n", ret);
+ return NULL;
+ }
+ }
+ }
+}
+
+int InputZipFile::ProcessFile(const bool compressed) {
+ const u1 *file_data;
+ if (compressed) {
+ file_data = UncompressFile();
+ if (file_data == NULL) {
+ return -1;
+ }
+ } else {
+ // In this case, compressed_size_ == uncompressed_size_ (since the file is
+ // uncompressed), so we can use either.
+ if (compressed_size_ != uncompressed_size_) {
+ return error("compressed size != uncompressed size, although the file "
+ "is uncompressed.\n");
+ }
+
+ if (EnsureRemaining(compressed_size_, "file_data") < 0) {
+ return -1;
+ }
+ file_data = p;
+ p += compressed_size_;
+ }
+ processor->Process(filename, attr, file_data, uncompressed_size_);
+ return 0;
+}
+
+
+// Reads and returns some metadata of the next file from the central directory:
+// - compressed size
+// - uncompressed size
+// - whether the entry is a class file (to be included in the output).
+// Precondition: p points to the beginning of an entry in the central dir
+// Postcondition: p points to the beginning of the next entry in the central dir
+// Returns true if the central directory contains another file and false if not.
+// Of course, in the latter case, the size output variables are not changed.
+// Note that the central directory is always followed by another data structure
+// that has a signature, so parsing it this way is safe.
+static bool ProcessCentralDirEntry(
+ const u1 *&p, size_t *compressed_size, size_t *uncompressed_size,
+ char *filename, size_t filename_size, u4 *attr, u4 *offset) {
+ u4 signature = get_u4le(p);
+ if (signature != CENTRAL_FILE_HEADER_SIGNATURE) {
+ return false;
+ }
+
+ p += 16; // skip to 'compressed size' field
+ *compressed_size = get_u4le(p);
+ *uncompressed_size = get_u4le(p);
+ u2 file_name_length = get_u2le(p);
+ u2 extra_field_length = get_u2le(p);
+ u2 file_comment_length = get_u2le(p);
+ p += 4; // skip to external file attributes field
+ *attr = get_u4le(p);
+ *offset = get_u4le(p);
+ {
+ size_t len = (file_name_length < filename_size)
+ ? file_name_length
+ : (filename_size - 1);
+ memcpy(reinterpret_cast<void*>(filename), p, len);
+ filename[len] = 0;
+ }
+ p += file_name_length;
+ p += extra_field_length;
+ p += file_comment_length;
+ return true;
+}
+
+// Gives a maximum bound on the size of the interface JAR. Basically, adds
+// the difference between the compressed and uncompressed sizes to the size
+// of the input file.
+u8 InputZipFile::CalculateOutputLength() {
+ const u1* current = central_dir_;
+
+ u8 compressed_size = 0;
+ u8 uncompressed_size = 0;
+ u8 skipped_compressed_size = 0;
+ u4 attr;
+ u4 offset;
+ char filename[PATH_MAX];
+
+ while (true) {
+ size_t file_compressed, file_uncompressed;
+ if (!ProcessCentralDirEntry(current,
+ &file_compressed, &file_uncompressed,
+ filename, PATH_MAX, &attr, &offset)) {
+ break;
+ }
+
+ if (processor->Accept(filename, attr)) {
+ compressed_size += (u8) file_compressed;
+ uncompressed_size += (u8) file_uncompressed;
+ } else {
+ skipped_compressed_size += file_compressed;
+ }
+ }
+
+ // The worst case is when the output is simply the input uncompressed. The
+ // metadata in the zip file will stay the same, so the file will grow by the
+ // difference between the compressed and uncompressed sizes.
+ return (u8) in_length_ - skipped_compressed_size
+ + (uncompressed_size - compressed_size);
+}
+
+// Given the data in the zip file, returns the offset of the central directory
+// and the number of files contained in it.
+bool FindZipCentralDirectory(const u1* bytes, size_t in_length,
+ u4* offset, const u1** central_dir) {
+ static const int MAX_COMMENT_LENGTH = 0xffff;
+ static const int CENTRAL_DIR_LOCATOR_SIZE = 22;
+ // Maximum distance of start of central dir locator from end of file
+ static const int MAX_DELTA = MAX_COMMENT_LENGTH + CENTRAL_DIR_LOCATOR_SIZE;
+ const u1* last_pos_to_check = in_length < MAX_DELTA
+ ? bytes
+ : bytes + (in_length - MAX_DELTA);
+ const u1* current;
+ bool found = false;
+
+ for (current = bytes + in_length - CENTRAL_DIR_LOCATOR_SIZE;
+ current >= last_pos_to_check;
+ current-- ) {
+ const u1* p = current;
+ if (get_u4le(p) != END_OF_CENTRAL_DIR_SIGNATURE) {
+ continue;
+ }
+
+ p += 16; // skip to comment length field
+ u2 comment_length = get_u2le(p);
+
+ // Does the comment go exactly till the end of the file?
+ if (current + comment_length + CENTRAL_DIR_LOCATOR_SIZE
+ != bytes + in_length) {
+ continue;
+ }
+
+ // Hooray, we found it!
+ found = true;
+ break;
+ }
+
+ if (!found) {
+ fprintf(stderr, "file is invalid or corrupted (missing end of central "
+ "directory record)\n");
+ return false;
+ }
+
+ const u1* end_of_central_dir = current;
+ get_u4le(current); // central directory locator signature, already checked
+ u2 number_of_this_disk = get_u2le(current);
+ u2 disk_with_central_dir = get_u2le(current);
+ u2 central_dir_entries_on_this_disk = get_u2le(current);
+ u2 central_dir_entries = get_u2le(current);
+ u4 central_dir_size = get_u4le(current);
+ u4 central_dir_offset = get_u4le(current);
+ u2 file_comment_length = get_u2le(current);
+ current += file_comment_length; // set current to the end of the central dir
+
+ if (number_of_this_disk != 0
+ || disk_with_central_dir != 0
+ || central_dir_entries_on_this_disk != central_dir_entries) {
+ fprintf(stderr, "multi-disk JAR files are not supported\n");
+ return false;
+ }
+
+ // Do not change output values before determining that they are OK.
+ *offset = central_dir_offset;
+ // Central directory start can then be used to determine the actual
+ // starts of the zip file (which can be different in case of a non-zip
+ // header like for auto-extractable binaries).
+ *central_dir = end_of_central_dir - central_dir_size;
+ return true;
+}
+
+void InputZipFile::Reset() {
+ central_dir_current_ = central_dir_;
+ zipdata_in_mapped_ = zipdata_in_;
+ p = zipdata_in_ + in_offset_;
+}
+
+int ZipExtractor::ProcessAll() {
+ while (ProcessNext()) {}
+ if (GetError() != NULL) {
+ return -1;
+ }
+ return 0;
+}
+
+ZipExtractor* ZipExtractor::Create(const char* filename,
+ ZipExtractorProcessor *processor) {
+ int fd_in = open(filename, O_RDONLY);
+ if (fd_in < 0) {
+ return NULL;
+ }
+
+ off_t length = lseek(fd_in, 0, SEEK_END);
+ if (length < 0) {
+ return NULL;
+ }
+
+ void *zipdata_in = mmap(NULL, length, PROT_READ, MAP_PRIVATE, fd_in, 0);
+ if (zipdata_in == MAP_FAILED) {
+ return NULL;
+ }
+
+ u4 central_dir_offset;
+ const u1 *central_dir = NULL;
+
+ if (!devtools_ijar::FindZipCentralDirectory(
+ static_cast<const u1*>(zipdata_in), length,
+ ¢ral_dir_offset, ¢ral_dir)) {
+ errno = EIO; // we don't really have a good error number
+ return NULL;
+ }
+ const u1 *zipdata_start = static_cast<const u1*>(zipdata_in);
+ off_t offset = - static_cast<off_t>(zipdata_start
+ + central_dir_offset
+ - central_dir);
+
+ return new InputZipFile(processor, fd_in, length, offset,
+ zipdata_start, central_dir);
+}
+
+InputZipFile::InputZipFile(ZipExtractorProcessor *processor, int fd,
+ off_t in_length, off_t in_offset,
+ const u1* zipdata_in, const u1* central_dir)
+ : processor(processor), fd_in(fd),
+ zipdata_in_(zipdata_in), zipdata_in_mapped_(zipdata_in),
+ central_dir_(central_dir), in_length_(in_length), in_offset_(in_offset),
+ p(zipdata_in + in_offset), central_dir_current_(central_dir) {
+ uncompressed_data_allocated_ = INITIAL_BUFFER_SIZE;
+ uncompressed_data_ =
+ reinterpret_cast<u1*>(malloc(uncompressed_data_allocated_));
+ errmsg[0] = 0;
+}
+
+InputZipFile::~InputZipFile() {
+ free(uncompressed_data_);
+ close(fd_in);
+}
+
+
+//
+// Implementation of OutputZipFile
+//
+int OutputZipFile::WriteEmptyFile(const char *filename) {
+ const u1* file_name = (const u1*) filename;
+ size_t file_name_length = strlen(filename);
+
+ LocalFileEntry *entry = new LocalFileEntry;
+ entry->local_header_offset = Offset(q);
+ entry->external_attr = 0;
+ entry->crc32 = 0;
+
+ // Output the ZIP local_file_header:
+ put_u4le(q, LOCAL_FILE_HEADER_SIGNATURE);
+ put_u2le(q, 10); // extract_version
+ put_u2le(q, 0); // general_purpose_bit_flag
+ put_u2le(q, 0); // compression_method
+ put_u2le(q, 0); // last_mod_file_time
+ put_u2le(q, 0); // last_mod_file_date
+ put_u4le(q, entry->crc32); // crc32
+ put_u4le(q, 0); // compressed_size
+ put_u4le(q, 0); // uncompressed_size
+ put_u2le(q, file_name_length);
+ put_u2le(q, 0); // extra_field_length
+ put_n(q, file_name, file_name_length);
+
+ entry->file_name_length = file_name_length;
+ entry->extra_field_length = 0;
+ entry->compressed_length = 0;
+ entry->uncompressed_length = 0;
+ entry->compression_method = 0;
+ entry->extra_field = (const u1 *)"";
+ entry->file_name = (u1*) strdup((const char *) file_name);
+ entries_.push_back(entry);
+
+ return 0;
+}
+
+void OutputZipFile::WriteCentralDirectory() {
+ // central directory:
+ const u1 *central_directory_start = q;
+ for (size_t ii = 0; ii < entries_.size(); ++ii) {
+ LocalFileEntry *entry = entries_[ii];
+ put_u4le(q, CENTRAL_FILE_HEADER_SIGNATURE);
+ put_u2le(q, 0); // version made by
+
+ put_u2le(q, ZIP_VERSION_TO_EXTRACT); // version to extract
+ put_u2le(q, 0); // general purpose bit flag
+ put_u2le(q, entry->compression_method); // compression method:
+ put_u2le(q, 0); // last_mod_file_time
+ put_u2le(q, 0); // last_mod_file_date
+ put_u4le(q, entry->crc32); // crc32
+ put_u4le(q, entry->compressed_length); // compressed_size
+ put_u4le(q, entry->uncompressed_length); // uncompressed_size
+ put_u2le(q, entry->file_name_length);
+ put_u2le(q, entry->extra_field_length);
+
+ put_u2le(q, 0); // file comment length
+ put_u2le(q, 0); // disk number start
+ put_u2le(q, 0); // internal file attributes
+ put_u4le(q, entry->external_attr); // external file attributes
+ // relative offset of local header:
+ put_u4le(q, entry->local_header_offset);
+
+ put_n(q, entry->file_name, entry->file_name_length);
+ put_n(q, entry->extra_field, entry->extra_field_length);
+ }
+ u4 central_directory_size = q - central_directory_start;
+
+ put_u4le(q, END_OF_CENTRAL_DIR_SIGNATURE);
+ put_u2le(q, 0); // number of this disk
+ put_u2le(q, 0); // number of the disk with the start of the central directory
+ put_u2le(q, entries_.size()); // # central dir entries on this disk
+ put_u2le(q, entries_.size()); // total # entries in the central directory
+ put_u4le(q, central_directory_size); // size of the central directory
+ put_u4le(q, Offset(central_directory_start)); // offset of start of central
+ // directory wrt starting disk
+ put_u2le(q, 0); // .ZIP file comment length
+}
+
+u1* OutputZipFile::WriteLocalFileHeader(const char* filename, const u4 attr) {
+ off_t file_name_length_ = strlen(filename);
+ LocalFileEntry *entry = new LocalFileEntry;
+ entry->local_header_offset = Offset(q);
+ entry->file_name_length = file_name_length_;
+ entry->file_name = new u1[file_name_length_];
+ entry->external_attr = attr;
+ memcpy(entry->file_name, filename, file_name_length_);
+ entry->extra_field_length = 0;
+ entry->extra_field = (const u1 *)"";
+
+ // Output the ZIP local_file_header:
+ put_u4le(q, LOCAL_FILE_HEADER_SIGNATURE);
+ put_u2le(q, ZIP_VERSION_TO_EXTRACT); // version to extract
+ put_u2le(q, 0); // general purpose bit flag
+ u1 *header_ptr = q;
+ put_u2le(q, COMPRESSION_METHOD_STORED); // compression method = placeholder
+ put_u2le(q, 0); // last_mod_file_time
+ put_u2le(q, 0); // last_mod_file_date
+ put_u4le(q, entry->crc32); // crc32
+ put_u4le(q, 0); // compressed_size = placeholder
+ put_u4le(q, 0); // uncompressed_size = placeholder
+ put_u2le(q, entry->file_name_length);
+ put_u2le(q, entry->extra_field_length);
+
+ put_n(q, entry->file_name, entry->file_name_length);
+ put_n(q, entry->extra_field, entry->extra_field_length);
+ entries_.push_back(entry);
+
+ return header_ptr;
+}
+
+// Try to compress a file entry in memory using the deflate algorithm.
+// It will compress buf (of size length) unless the compressed size is bigger
+// than the input size. The result will overwrite the content of buf and the
+// final size is returned.
+size_t TryDeflate(u1 *buf, size_t length) {
+ u1 *outbuf = reinterpret_cast<u1 *>(malloc(length));
+ z_stream stream;
+
+ // Initialize the z_stream strcut for reading from buf and wrinting in outbuf.
+ stream.zalloc = Z_NULL;
+ stream.zfree = Z_NULL;
+ stream.opaque = Z_NULL;
+ stream.total_in = length;
+ stream.avail_in = length;
+ stream.total_out = length;
+ stream.avail_out = length;
+ stream.next_in = buf;
+ stream.next_out = outbuf;
+
+ // deflateInit2 negative windows size prevent the zlib wrapper to be used.
+ if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
+ -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
+ // Failure to compress => return the buffer uncompressed
+ free(outbuf);
+ return length;
+ }
+
+ if (deflate(&stream, Z_FINISH) == Z_STREAM_END) {
+ // Compression successful and fits in outbuf, let's copy the result in buf.
+ length = stream.total_out;
+ memcpy(buf, outbuf, length);
+ }
+
+ deflateEnd(&stream);
+ free(outbuf);
+
+ // Return the length of the resulting buffer
+ return length;
+}
+
+size_t OutputZipFile::WriteFileSizeInLocalFileHeader(u1 *header_ptr,
+ size_t out_length,
+ bool compress,
+ const u4 crc) {
+ size_t compressed_size = out_length;
+ if (compress) {
+ compressed_size = TryDeflate(q, out_length);
+ }
+ // compression method
+ if (compressed_size < out_length) {
+ put_u2le(header_ptr, COMPRESSION_METHOD_DEFLATED);
+ } else {
+ put_u2le(header_ptr, COMPRESSION_METHOD_STORED);
+ }
+ header_ptr += 4;
+ put_u4le(header_ptr, crc); // crc32
+ put_u4le(header_ptr, compressed_size); // compressed_size
+ put_u4le(header_ptr, out_length); // uncompressed_size
+ return compressed_size;
+}
+
+int OutputZipFile::Finish() {
+ if (fd_out > 0) {
+ WriteCentralDirectory();
+ if (ftruncate(fd_out, GetSize()) < 0) {
+ return error("ftruncate(fd_out, GetSize()): %s", strerror(errno));
+ }
+ if (close(fd_out) < 0) {
+ return error("close(fd_out): %s", strerror(errno));
+ }
+ fd_out = -1;
+ }
+ return 0;
+}
+
+u1* OutputZipFile::NewFile(const char* filename, const u4 attr) {
+ header_ptr = WriteLocalFileHeader(filename, attr);
+ return q;
+}
+
+int OutputZipFile::FinishFile(size_t filelength, bool compress,
+ bool compute_crc) {
+ u4 crc = 0;
+ if (compute_crc) {
+ crc = crc32(crc, q, filelength);
+ }
+ size_t compressed_size =
+ WriteFileSizeInLocalFileHeader(header_ptr, filelength, compress, crc);
+ entries_.back()->crc32 = crc;
+ entries_.back()->compressed_length = compressed_size;
+ entries_.back()->uncompressed_length = filelength;
+ if (compressed_size < filelength) {
+ entries_.back()->compression_method = COMPRESSION_METHOD_DEFLATED;
+ } else {
+ entries_.back()->compression_method = COMPRESSION_METHOD_STORED;
+ }
+ q += compressed_size;
+ return 0;
+}
+
+ZipBuilder* ZipBuilder::Create(const char* zip_file, u8 estimated_size) {
+ if (estimated_size > kMaximumOutputSize) {
+ fprintf(stderr,
+ "Uncompressed input jar has size %llu, "
+ "which exceeds the maximum supported output size %llu.\n"
+ "Assuming that ijar will be smaller and hoping for the best.\n",
+ estimated_size, kMaximumOutputSize);
+ estimated_size = kMaximumOutputSize;
+ }
+
+ int fd_out = open(zip_file, O_CREAT|O_RDWR|O_TRUNC, 0644);
+ if (fd_out < 0) {
+ return NULL;
+ }
+
+ // Create mmap-able sparse file
+ if (ftruncate(fd_out, estimated_size) < 0) {
+ return NULL;
+ }
+
+ // Ensure that any buffer overflow in JarStripper will result in
+ // SIGSEGV or SIGBUS by over-allocating beyond the end of the file.
+ size_t mmap_length = std::min(estimated_size + sysconf(_SC_PAGESIZE),
+ (u8) std::numeric_limits<size_t>::max());
+
+ void *zipdata_out = mmap(NULL, mmap_length, PROT_WRITE,
+ MAP_SHARED, fd_out, 0);
+ if (zipdata_out == MAP_FAILED) {
+ fprintf(stderr, "output_length=%llu\n", estimated_size);
+ return NULL;
+ }
+
+ return new OutputZipFile(fd_out, (u1*) zipdata_out);
+}
+
+u8 ZipBuilder::EstimateSize(char **files) {
+ struct stat statst;
+ // Digital signature field size = 6, End of central directory = 22, Total = 28
+ u8 size = 28;
+ // Count the size of all the files in the input to estimate the size of the
+ // output.
+ for (int i = 0; files[i] != NULL; i++) {
+ if (stat(files[i], &statst) != 0) {
+ fprintf(stderr, "File %s does not seem to exist.", files[i]);
+ return 0;
+ }
+ size += statst.st_size;
+ // Add sizes of Zip meta data
+ // local file header = 30 bytes
+ // data descriptor = 12 bytes
+ // central directory descriptor = 46 bytes
+ // Total: 88bytes
+ size += 88;
+ // The filename is stored twice (once in the central directory
+ // and once in the local file header).
+ size += strlen(files[i]) * 2;
+ }
+ return size;
+}
+
+} // namespace devtools_ijar
diff --git a/tools/ijar/zip.h b/tools/ijar/zip.h
new file mode 100644
index 0000000..dda2c6e
--- /dev/null
+++ b/tools/ijar/zip.h
@@ -0,0 +1,173 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// 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.
+//
+// zip.h -- .zip (.jar) file reading/writing routines.
+//
+// This file specifies the interface to use the ZIP implementation of ijar.
+//
+
+#ifndef INCLUDED_THIRD_PARTY_IJAR_ZIP_H
+#define INCLUDED_THIRD_PARTY_IJAR_ZIP_H
+
+#include <sys/stat.h>
+
+#include "common.h"
+
+namespace devtools_ijar {
+
+// Tells if this is a directory entry from the mode. This method
+// is safer than zipattr_to_mode(attr) & S_IFDIR because the unix
+// mode might not be set in DOS zip files.
+inline bool zipattr_is_dir(u4 attr) { return (attr & 0x10) != 0; }
+
+// Convert a Unix file mode to a ZIP file attribute
+inline u4 mode_to_zipattr(mode_t m) {
+ return (((u4) m) << 16) + ((m & S_IFDIR) != 0 ? 0x10 : 0);
+}
+
+// Convert a ZIP file attribute to a Unix file mode
+inline mode_t zipattr_to_mode(u4 attr) {
+ return ((mode_t) ((attr >> 16) & 0xffff));
+}
+
+//
+// Class interface for building ZIP files
+//
+class ZipBuilder {
+ public:
+ virtual ~ZipBuilder() {}
+
+ // Returns the text for the last error, or null on no last error.
+ virtual const char* GetError() = 0;
+
+ // Add a new file to the ZIP, the file will have path "filename"
+ // and external attributes "attr". This function returns a pointer
+ // to a memory buffer to write the data of the file into. This buffer
+ // is owned by ZipBuilder and should not be free'd by the caller. The
+ // file length is then specified when the files is finished written
+ // using the FinishFile(size_t) function.
+ // On failure, returns NULL and GetError() will return an non-empty message.
+ virtual u1* NewFile(const char* filename, const u4 attr) = 0;
+
+ // Finish writing a file and specify its length. After calling this method
+ // one should not reuse the pointer given by NewFile. The file can be
+ // compressed using the deflate algorithm by setting `compress` to true.
+ // By default, CRC32 are not computed as java tooling doesn't care, but
+ // computing it can be activated by setting `compute_crc` to true.
+ // On failure, returns -1 and GetError() will return an non-empty message.
+ virtual int FinishFile(size_t filelength,
+ bool compress = false,
+ bool compute_crc = false) = 0;
+
+ // Write an empty file, it is equivalent to:
+ // NewFile(filename, 0);
+ // FinishFile(0);
+ // On failure, returns -1 and GetError() will return an non-empty message.
+ virtual int WriteEmptyFile(const char* filename) = 0;
+
+ // Finish writing the ZIP file. This method can be called only once
+ // (subsequent calls will do nothing) and none of
+ // NewFile/FinishFile/WriteEmptyFile should be called after calling Finish. If
+ // this method was not called when the object is destroyed, it will be called.
+ // It is here as a convenience to get information on the final generated ZIP
+ // file.
+ // On failure, returns -1 and GetError() will return an non-empty message.
+ virtual int Finish() = 0;
+
+ // Get the current size of the ZIP file. This size will not be matching the
+ // final ZIP file until Finish() has been called because Finish() is actually
+ // writing the central directory of the ZIP File.
+ virtual size_t GetSize() = 0;
+
+ // Returns the current number of files stored in the ZIP.
+ virtual int GetNumberFiles() = 0;
+
+ // Create a new ZipBuilder writing the file zip_file and the size of the
+ // output will be at most estimated_size. Use ZipBuilder::EstimateSize() or
+ // ZipExtractor::CalculateOuputLength() to have an estimated_size depending on
+ // a list of file to store.
+ // On failure, returns NULL. Refer to errno for error code.
+ static ZipBuilder* Create(const char* zip_file, u8 estimated_size);
+
+ // Estimate the maximum size of the ZIP files containing files in the "files"
+ // null-terminated array.
+ // Returns 0 on error.
+ static u8 EstimateSize(char **files);
+};
+
+//
+// An abstract class to process data from a ZipExtractor.
+// Derive from this class if you wish to process data from a ZipExtractor.
+//
+class ZipExtractorProcessor {
+ public:
+ virtual ~ZipExtractorProcessor() {}
+
+ // Tells whether to skip or process the file "filename". "attr" is the
+ // external file attributes and can be converted to unix mode using the
+ // zipattr_to_mode() function. This method is suppoed to returns true
+ // if the file should be processed and false if it should be skipped.
+ virtual bool Accept(const char* filename, const u4 attr) = 0;
+
+ // Process a file accepted by Accept. The file "filename" has external
+ // attributes "attr" and length "size". The file content is accessible
+ // in the buffer pointed by "data".
+ virtual void Process(const char* filename, const u4 attr,
+ const u1* data, const size_t size) = 0;
+};
+
+//
+// Class interface for reading ZIP files
+//
+class ZipExtractor {
+ public:
+ virtual ~ZipExtractor() {}
+
+ // Returns the text for the last error, or null on no last error.
+ virtual const char* GetError() = 0;
+
+ // Process the next files, returns false if the end of ZIP file has been
+ // reached. The processor provided by the Create method will be called
+ // if a file is encountered. If false is returned, check the return value
+ // of GetError() for potential errors.
+ virtual bool ProcessNext() = 0;
+
+ // Process the all files, returns -1 on error (GetError() will be populated
+ // on error).
+ virtual int ProcessAll();
+
+ // Reset the file pointer to the beginning.
+ virtual void Reset() = 0;
+
+ // Return the size of the ZIP file.
+ virtual size_t GetSize() = 0;
+
+ // Return the size of the resulting zip file by keeping only file
+ // accepted by the processor and storing them uncompressed. This
+ // method can be used to create a ZipBuilder for storing a subset
+ // of the input files.
+ // On error, 0 is returned and GetError() returns a non-empty message.
+ virtual u8 CalculateOutputLength() = 0;
+
+ // Create a ZipExtractor that extract the zip file "filename" and process
+ // it with "processor".
+ // On error, a null pointer is returned and the value of errno should be
+ // checked.
+ static ZipExtractor* Create(const char* filename,
+ ZipExtractorProcessor *processor);
+};
+
+} // namespace devtools_ijar
+
+#endif // INCLUDED_THIRD_PARTY_IJAR_ZIP_H
diff --git a/tools/ijar/zip_main.cc b/tools/ijar/zip_main.cc
new file mode 100644
index 0000000..3f4a50c
--- /dev/null
+++ b/tools/ijar/zip_main.cc
@@ -0,0 +1,312 @@
+// Copyright 2015 Google Inc. All rights reserved.
+//
+// Author: Alan Donovan <adonovan@google.com>
+//
+// 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.
+
+//
+// Zip / Unzip file using ijar zip implementation.
+//
+// Note that this Zip implementation intentionally don't compute CRC-32
+// because it is useless computation for jar because Java doesn't care.
+// CRC-32 of all files in the zip file will be set to 0.
+//
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <memory>
+
+#include "zip.h"
+
+namespace devtools_ijar {
+
+#define SYSCALL(expr) do { \
+ if ((expr) < 0) { \
+ perror(#expr); \
+ abort(); \
+ } \
+ } while (0)
+
+//
+// A ZipExtractorProcessor that extract all files in the ZIP file.
+//
+class UnzipProcessor : public ZipExtractorProcessor {
+ public:
+ // Create a processor who will extract the files into output_root
+ // if "extract" is set to true and will print the list of files and
+ // their unix modes if "verbose" is set to true.
+ UnzipProcessor(const char *output_root, bool verbose, bool extract)
+ : output_root_(output_root), verbose_(verbose), extract_(extract) {}
+ virtual ~UnzipProcessor() {}
+
+ virtual void Process(const char* filename, const u4 attr,
+ const u1* data, const size_t size);
+ virtual bool Accept(const char* filename, const u4 attr) {
+ return true;
+ }
+
+ private:
+ const char *output_root_;
+ const bool verbose_;
+ const bool extract_;
+};
+
+// Concatene 2 path, path1 and path2, using / as a directory separator and
+// puting the result in "out". "size" specify the size of the output buffer
+void concat_path(char* out, const size_t size,
+ const char *path1, const char *path2) {
+ int len1 = strlen(path1);
+ size_t l = len1;
+ strncpy(out, path1, size - 1);
+ out[size-1] = 0;
+ if (l < size - 1 && path1[len1] != '/' && path2[0] != '/') {
+ out[l] = '/';
+ l++;
+ out[l] = 0;
+ }
+ if (l < size - 1) {
+ strncat(out, path2, size - 1 - l);
+ }
+}
+
+// Do a recursive mkdir of all folders of path except the last path
+// segment (if path ends with a / then the last path segment is empty).
+// All folders are created using "mode" for creation mode.
+void mkdirs(const char *path, mode_t mode) {
+ char path_[PATH_MAX];
+ struct stat statst;
+ strncpy(path_, path, PATH_MAX);
+ path_[PATH_MAX-1] = 0;
+ char *pointer = path_;
+ while ((pointer = strchr(pointer, '/')) != NULL) {
+ if (path_ != pointer) { // skip leading slash
+ *pointer = 0;
+ if (stat(path_, &statst) != 0) {
+ if (mkdir(path_, mode) < 0) {
+ fprintf(stderr, "Cannot create folder %s: %s\n",
+ path_, strerror(errno));
+ abort();
+ }
+ }
+ *pointer = '/';
+ }
+ pointer++;
+ }
+}
+
+void UnzipProcessor::Process(const char* filename, const u4 attr,
+ const u1* data, const size_t size) {
+ mode_t mode = zipattr_to_mode(attr);
+ mode_t perm = mode & 0777;
+ bool isdir = (mode & S_IFDIR) != 0;
+ if (attr == 0) {
+ // Fallback when the external attribute is not set.
+ isdir = filename[strlen(filename)-1] == '/';
+ perm = 0777;
+ }
+ if (verbose_) {
+ printf("%c %o %s\n", isdir ? 'd' : 'f', perm, filename);
+ }
+ if (extract_) {
+ char path[PATH_MAX];
+ int fd;
+ concat_path(path, PATH_MAX, output_root_, filename);
+ mkdirs(path, perm);
+ if (!isdir) {
+ fd = open(path, O_CREAT | O_WRONLY, perm);
+ if (fd < 0) {
+ fprintf(stderr, "Cannot open file %s for writing: %s\n",
+ path, strerror(errno));
+ abort();
+ }
+ SYSCALL(write(fd, data, size));
+ SYSCALL(close(fd));
+ }
+ }
+}
+
+// Get the basename of path and store it in output. output_size
+// is the size of the output buffer.
+void basename(const char *path, char *output, size_t output_size) {
+ const char *pointer = strrchr(path, '/');
+ if (pointer == NULL) {
+ pointer = path;
+ } else {
+ pointer++; // Skip the leading slash.
+ }
+ strncpy(output, pointer, output_size);
+ output[output_size-1] = 0;
+}
+
+
+// Execute the extraction (or just listing if just v is provided)
+int extract(char *zipfile, bool verbose, bool extract) {
+ char output_root[PATH_MAX];
+ getcwd(output_root, PATH_MAX);
+
+ UnzipProcessor processor(output_root, verbose, extract);
+ std::unique_ptr<ZipExtractor> extractor(ZipExtractor::Create(zipfile,
+ &processor));
+ if (extractor.get() == NULL) {
+ fprintf(stderr, "Unable to open zip file %s: %s.\n", zipfile,
+ strerror(errno));
+ return -1;
+ }
+
+ if (extractor->ProcessAll() < 0) {
+ fprintf(stderr, "%s.\n", extractor->GetError());
+ return -1;
+ }
+ return 0;
+}
+
+// Execute the create operation
+int create(char *zipfile, char **files, bool flatten, bool verbose,
+ bool compress) {
+ struct stat statst;
+ u8 size = ZipBuilder::EstimateSize(files);
+ if (size == 0) {
+ return -1;
+ }
+ std::unique_ptr<ZipBuilder> builder(ZipBuilder::Create(zipfile, size));
+ if (builder.get() == NULL) {
+ fprintf(stderr, "Unable to create zip file %s: %s.\n",
+ zipfile, strerror(errno));
+ return -1;
+ }
+ for (int i = 0; files[i] != NULL; i++) {
+ stat(files[i], &statst);
+ char path[PATH_MAX];
+ bool isdir = (statst.st_mode & S_IFDIR) != 0;
+
+ if (flatten && isdir) {
+ continue;
+ }
+
+ // Compute the path, flattening it if requested
+ if (flatten) {
+ basename(files[i], path, PATH_MAX);
+ } else {
+ strncpy(path, files[i], PATH_MAX);
+ path[PATH_MAX-1] = 0;
+ size_t len = strlen(path);
+ if (isdir && len < PATH_MAX - 1) {
+ // Add the trailing slash for folders
+ path[len] = '/';
+ path[len+1] = 0;
+ }
+ }
+
+ if (verbose) {
+ mode_t perm = statst.st_mode & 0777;
+ printf("%c %o %s\n", isdir ? 'd' : 'f', perm, path);
+ }
+
+ u1 *buffer = builder->NewFile(path, mode_to_zipattr(statst.st_mode));
+ if (isdir || statst.st_size == 0) {
+ builder->FinishFile(0);
+ } else {
+ // mmap the input file and memcpy
+ int fd = open(files[i], O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr, "Can't open file %s for reading: %s.\n",
+ files[i], strerror(errno));
+ return -1;
+ }
+ void *data = mmap(NULL, statst.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (data == MAP_FAILED) {
+ fprintf(stderr, "Can't mmap file %s for reading: %s.\n",
+ files[i], strerror(errno));
+ return -1;
+ }
+ memcpy(buffer, data, statst.st_size);
+ munmap(data, statst.st_size);
+ builder->FinishFile(statst.st_size, compress, true);
+ }
+ }
+ if (builder->Finish() < 0) {
+ fprintf(stderr, "%s\n", builder->GetError());
+ return -1;
+ }
+ return 0;
+}
+
+} // namespace devtools_ijar
+
+//
+// main method
+//
+static void usage(char *progname) {
+ fprintf(stderr, "Usage: %s [vxc[fC]] x.zip [file1...filen]\n", progname);
+ fprintf(stderr, " v verbose - list all file in x.zip\n");
+ fprintf(stderr, " x extract - extract file in x.zip in current directory\n");
+ fprintf(stderr, " c create - add files to x.zip\n");
+ fprintf(stderr, " f flatten - flatten files to use with create operation\n");
+ fprintf(stderr,
+ " C compress - compress files when using the create operation\n");
+ fprintf(stderr, "x and c cannot be used in the same command-line.\n");
+ exit(1);
+}
+
+int main(int argc, char **argv) {
+ bool extract = false;
+ bool verbose = false;
+ bool create = false;
+ bool compress = false;
+ bool flatten = false;
+
+ if (argc < 3) {
+ usage(argv[0]);
+ }
+
+ for (int i = 0; argv[1][i] != 0; i++) {
+ switch (argv[1][i]) {
+ case 'x':
+ extract = true;
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case 'c':
+ create = true;
+ break;
+ case 'f':
+ flatten = true;
+ break;
+ case 'C':
+ compress = true;
+ break;
+ default:
+ usage(argv[0]);
+ }
+ }
+ if (create) {
+ if (extract) {
+ usage(argv[0]);
+ }
+ // Create a zip
+ return devtools_ijar::create(argv[2], argv + 3, flatten, verbose, compress);
+ } else {
+ if (flatten) {
+ usage(argv[0]);
+ }
+ // Extraction / list mode
+ return devtools_ijar::extract(argv[2], verbose, extract);
+ }
+}
diff --git a/tools/makeparallel/.gitignore b/tools/makeparallel/.gitignore
new file mode 100644
index 0000000..a7d6181
--- /dev/null
+++ b/tools/makeparallel/.gitignore
@@ -0,0 +1,4 @@
+makeparallel
+*.o
+*.d
+test.out
diff --git a/tools/makeparallel/Android.bp b/tools/makeparallel/Android.bp
new file mode 100644
index 0000000..cb81817
--- /dev/null
+++ b/tools/makeparallel/Android.bp
@@ -0,0 +1,26 @@
+// Copyright 2016 Google Inc. All rights reserved
+//
+// 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.
+
+cc_binary_host {
+ name: "makeparallel",
+ srcs: [
+ "makeparallel.cpp",
+ ],
+ cflags: ["-Wall", "-Werror"],
+ target: {
+ linux: {
+ host_ldlibs: ["-lrt", "-lpthread"],
+ },
+ },
+}
diff --git a/tools/makeparallel/Makefile b/tools/makeparallel/Makefile
new file mode 100644
index 0000000..4e12b10
--- /dev/null
+++ b/tools/makeparallel/Makefile
@@ -0,0 +1,94 @@
+# Copyright 2015 Google Inc. All rights reserved
+#
+# 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.
+
+# Find source file location from path to this Makefile
+MAKEPARALLEL_SRC_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+ifndef MAKEPARALLEL_SRC_PATH
+ MAKEPARALLEL_SRC_PATH := .
+endif
+
+# Set defaults if they weren't set by the including Makefile
+MAKEPARALLEL_CXX ?= $(CXX)
+MAKEPARALLEL_LD ?= $(CXX)
+MAKEPARALLEL_INTERMEDIATES_PATH ?= .
+MAKEPARALLEL_BIN_PATH ?= .
+
+MAKEPARALLEL_CXX_SRCS := \
+ makeparallel.cpp
+
+MAKEPARALLEL_CXXFLAGS := -Wall -Werror -MMD -MP
+
+MAKEPARALLEL_CXX_SRCS := $(addprefix $(MAKEPARALLEL_SRC_PATH)/,\
+ $(MAKEPARALLEL_CXX_SRCS))
+
+MAKEPARALLEL_CXX_OBJS := $(patsubst $(MAKEPARALLEL_SRC_PATH)/%.cpp,$(MAKEPARALLEL_INTERMEDIATES_PATH)/%.o,$(MAKEPARALLEL_CXX_SRCS))
+
+MAKEPARALLEL := $(MAKEPARALLEL_BIN_PATH)/makeparallel
+
+ifeq ($(shell uname),Linux)
+MAKEPARALLEL_LIBS := -lrt -lpthread
+endif
+
+# Rule to build makeparallel into MAKEPARALLEL_BIN_PATH
+$(MAKEPARALLEL): $(MAKEPARALLEL_CXX_OBJS)
+ @mkdir -p $(dir $@)
+ $(MAKEPARALLEL_LD) -std=c++11 $(MAKEPARALLEL_CXXFLAGS) -o $@ $^ $(MAKEPARALLEL_LIBS)
+
+# Rule to build source files into object files in MAKEPARALLEL_INTERMEDIATES_PATH
+$(MAKEPARALLEL_CXX_OBJS): $(MAKEPARALLEL_INTERMEDIATES_PATH)/%.o: $(MAKEPARALLEL_SRC_PATH)/%.cpp
+ @mkdir -p $(dir $@)
+ $(MAKEPARALLEL_CXX) -c -std=c++11 $(MAKEPARALLEL_CXXFLAGS) -o $@ $<
+
+makeparallel_clean:
+ rm -rf $(MAKEPARALLEL)
+ rm -rf $(MAKEPARALLEL_INTERMEDIATES_PATH)/*.o
+ rm -rf $(MAKEPARALLEL_INTERMEDIATES_PATH)/*.d
+
+.PHONY: makeparallel_clean
+
+-include $(MAKEPARALLEL_INTERMEDIATES_PATH)/*.d
+
+.PHONY: makeparallel_test
+MAKEPARALLEL_TEST := MAKEFLAGS= MAKELEVEL= MAKEPARALLEL=$(MAKEPARALLEL) $(MAKE) -f Makefile.test test
+MAKEPARALLEL_NINJA_TEST := MAKEFLAGS= MAKELEVEL= MAKEPARALLEL="$(MAKEPARALLEL) --ninja" $(MAKE) -f Makefile.test test
+makeparallel_test: $(MAKEPARALLEL)
+ @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -j1234
+ @EXPECTED="-j123" $(MAKEPARALLEL_TEST) -j123
+ @EXPECTED="-j1" $(MAKEPARALLEL_TEST) -j1
+ @EXPECTED="-j1" $(MAKEPARALLEL_TEST)
+
+ @EXPECTED="-j1234" $(MAKEPARALLEL_NINJA_TEST) -j1234
+ @EXPECTED="-j123" $(MAKEPARALLEL_NINJA_TEST) -j123
+ @EXPECTED="-j1" $(MAKEPARALLEL_NINJA_TEST) -j1
+ @EXPECTED="-j1" $(MAKEPARALLEL_NINJA_TEST)
+ @EXPECTED="" $(MAKEPARALLEL_NINJA_TEST) -j
+ @EXPECTED="" $(MAKEPARALLEL_NINJA_TEST) -j -l
+
+ @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) --no-print-directory -j1234
+ @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) --no-print-directory -k -j1234
+ @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -k -j1234
+ @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -j1234 -k
+ @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -kt -j1234
+
+ @EXPECTED="-j1234" $(MAKEPARALLEL_NINJA_TEST) --no-print-directory -j1234
+ @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) --no-print-directory -k -j1234
+ @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) -k -j1234
+ @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) -j1234 -k
+ @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) -kt -j1234
+
+ @EXPECTED="-j1" $(MAKEPARALLEL_TEST) A=-j1234
+ @EXPECTED="-j1" $(MAKEPARALLEL_TEST) A\ -j1234=-j1234
+ @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) A\ -j1234=-j1234 -j1234
+
+ @EXPECTED="-j1234 args" ARGS="args" $(MAKEPARALLEL_TEST) -j1234
diff --git a/tools/makeparallel/Makefile.test b/tools/makeparallel/Makefile.test
new file mode 100644
index 0000000..cf53684
--- /dev/null
+++ b/tools/makeparallel/Makefile.test
@@ -0,0 +1,12 @@
+MAKEPARALLEL ?= ./makeparallel
+
+.PHONY: test
+test:
+ @+echo MAKEFLAGS=$${MAKEFLAGS}; \
+ result=$$($(MAKEPARALLEL) echo $(ARGS)); \
+ echo result: $${result}; \
+ if [ "$${result}" = "$(EXPECTED)" ]; then \
+ echo SUCCESS && echo; \
+ else \
+ echo FAILED expected $(EXPECTED) && false; \
+ fi
diff --git a/tools/makeparallel/README.md b/tools/makeparallel/README.md
new file mode 100644
index 0000000..2e5fbf9
--- /dev/null
+++ b/tools/makeparallel/README.md
@@ -0,0 +1,54 @@
+<!---
+Copyright (C) 2015 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.
+-->
+
+makeparallel
+============
+makeparallel communicates with the [GNU make jobserver](http://make.mad-scientist.net/papers/jobserver-implementation/)
+in order claim all available jobs, and then passes the number of jobs
+claimed to a subprocess with `-j<jobs>`.
+
+The number of available jobs is determined by reading tokens from the jobserver
+until a read would block. If the makeparallel rule is the only one running the
+number of jobs will be the total size of the jobserver pool, i.e. the value
+passed to make with `-j`. Any jobs running in parallel with with the
+makeparellel rule will reduce the measured value, and thus reduce the
+parallelism available to the subprocess.
+
+To run a multi-thread or multi-process binary inside GNU make using
+makeparallel, add
+```Makefile
+ +makeparallel subprocess arguments
+```
+to a rule. For example, to wrap ninja in make, use something like:
+```Makefile
+ +makeparallel ninja -f build.ninja
+```
+
+To determine the size of the jobserver pool, add
+```Makefile
+ +makeparallel echo > make.jobs
+```
+to a rule that is guarantee to run alone (i.e. all other rules are either
+dependencies of the makeparallel rule, or the depend on the makeparallel
+rule. The output file will contain the `-j<num>` flag passed to the parent
+make process, or `-j1` if no flag was found. Since GNU make will run
+makeparallel during the execution phase, after all variables have been
+set and evaluated, it is not possible to get the output of makeparallel
+into a make variable. Instead, use a shell substitution to read the output
+file directly in a recipe. For example:
+```Makefile
+ echo Make was started with $$(cat make.jobs)
+```
diff --git a/tools/makeparallel/makeparallel.cpp b/tools/makeparallel/makeparallel.cpp
new file mode 100644
index 0000000..cf125fa
--- /dev/null
+++ b/tools/makeparallel/makeparallel.cpp
@@ -0,0 +1,367 @@
+// Copyright (C) 2015 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.
+
+// makeparallel communicates with the GNU make jobserver
+// (http://make.mad-scientist.net/papers/jobserver-implementation/)
+// in order claim all available jobs, and then passes the number of jobs
+// claimed to a subprocess with -j<jobs>.
+
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <poll.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <string>
+#include <vector>
+
+#ifdef __linux__
+#include <error.h>
+#endif
+
+#ifdef __APPLE__
+#include <err.h>
+#define error(code, eval, fmt, ...) errc(eval, code, fmt, ##__VA_ARGS__)
+// Darwin does not interrupt syscalls by default.
+#define TEMP_FAILURE_RETRY(exp) (exp)
+#endif
+
+// Throw an error if fd is not valid.
+static void CheckFd(int fd) {
+ int ret = fcntl(fd, F_GETFD);
+ if (ret < 0) {
+ if (errno == EBADF) {
+ error(errno, 0, "no jobserver pipe, prefix recipe command with '+'");
+ } else {
+ error(errno, errno, "fnctl failed");
+ }
+ }
+}
+
+// Extract flags from MAKEFLAGS that need to be propagated to subproccess
+static std::vector<std::string> ReadMakeflags() {
+ std::vector<std::string> args;
+
+ const char* makeflags_env = getenv("MAKEFLAGS");
+ if (makeflags_env == nullptr) {
+ return args;
+ }
+
+ // The MAKEFLAGS format is pretty useless. The first argument might be empty
+ // (starts with a leading space), or it might be a set of one-character flags
+ // merged together with no leading space, or it might be a variable
+ // definition.
+
+ std::string makeflags = makeflags_env;
+
+ // Split makeflags into individual args on spaces. Multiple spaces are
+ // elided, but an initial space will result in a blank arg.
+ size_t base = 0;
+ size_t found;
+ do {
+ found = makeflags.find_first_of(" ", base);
+ args.push_back(makeflags.substr(base, found - base));
+ base = found + 1;
+ } while (found != makeflags.npos);
+
+ // Drop the first argument if it is empty
+ while (args.size() > 0 && args[0].size() == 0) {
+ args.erase(args.begin());
+ }
+
+ // Prepend a - to the first argument if it does not have one and is not a
+ // variable definition
+ if (args.size() > 0 && args[0][0] != '-') {
+ if (args[0].find('=') == makeflags.npos) {
+ args[0] = '-' + args[0];
+ }
+ }
+
+ return args;
+}
+
+static bool ParseMakeflags(std::vector<std::string>& args,
+ int* in_fd, int* out_fd, bool* parallel, bool* keep_going) {
+
+ std::vector<char*> getopt_argv;
+ // getopt starts reading at argv[1]
+ getopt_argv.reserve(args.size() + 1);
+ getopt_argv.push_back(strdup(""));
+ for (std::string& v : args) {
+ getopt_argv.push_back(strdup(v.c_str()));
+ }
+
+ opterr = 0;
+ optind = 1;
+ while (1) {
+ const static option longopts[] = {
+ {"jobserver-fds", required_argument, 0, 0},
+ {0, 0, 0, 0},
+ };
+ int longopt_index = 0;
+
+ int c = getopt_long(getopt_argv.size(), getopt_argv.data(), "kj",
+ longopts, &longopt_index);
+
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 0:
+ switch (longopt_index) {
+ case 0:
+ {
+ // jobserver-fds
+ if (sscanf(optarg, "%d,%d", in_fd, out_fd) != 2) {
+ error(EXIT_FAILURE, 0, "incorrect format for --jobserver-fds: %s", optarg);
+ }
+ // TODO: propagate in_fd, out_fd
+ break;
+ }
+ default:
+ abort();
+ }
+ break;
+ case 'j':
+ *parallel = true;
+ break;
+ case 'k':
+ *keep_going = true;
+ break;
+ case '?':
+ // ignore unknown arguments
+ break;
+ default:
+ abort();
+ }
+ }
+
+ for (char *v : getopt_argv) {
+ free(v);
+ }
+
+ return true;
+}
+
+// Read a single byte from fd, with timeout in milliseconds. Returns true if
+// a byte was read, false on timeout. Throws away the read value.
+// Non-reentrant, uses timer and signal handler global state, plus static
+// variable to communicate with signal handler.
+//
+// Uses a SIGALRM timer to fire a signal after timeout_ms that will interrupt
+// the read syscall if it hasn't yet completed. If the timer fires before the
+// read the read could block forever, so read from a dup'd fd and close it from
+// the signal handler, which will cause the read to return EBADF if it occurs
+// after the signal.
+// The dup/read/close combo is very similar to the system described to avoid
+// a deadlock between SIGCHLD and read at
+// http://make.mad-scientist.net/papers/jobserver-implementation/
+static bool ReadByteTimeout(int fd, int timeout_ms) {
+ // global variable to communicate with the signal handler
+ static int dup_fd = -1;
+
+ // dup the fd so the signal handler can close it without losing the real one
+ dup_fd = dup(fd);
+ if (dup_fd < 0) {
+ error(errno, errno, "dup failed");
+ }
+
+ // set up a signal handler that closes dup_fd on SIGALRM
+ struct sigaction action = {};
+ action.sa_flags = SA_SIGINFO,
+ action.sa_sigaction = [](int, siginfo_t*, void*) {
+ close(dup_fd);
+ };
+ struct sigaction oldaction = {};
+ int ret = sigaction(SIGALRM, &action, &oldaction);
+ if (ret < 0) {
+ error(errno, errno, "sigaction failed");
+ }
+
+ // queue a SIGALRM after timeout_ms
+ const struct itimerval timeout = {{}, {0, timeout_ms * 1000}};
+ ret = setitimer(ITIMER_REAL, &timeout, NULL);
+ if (ret < 0) {
+ error(errno, errno, "setitimer failed");
+ }
+
+ // start the blocking read
+ char buf;
+ int read_ret = read(dup_fd, &buf, 1);
+ int read_errno = errno;
+
+ // cancel the alarm in case it hasn't fired yet
+ const struct itimerval cancel = {};
+ ret = setitimer(ITIMER_REAL, &cancel, NULL);
+ if (ret < 0) {
+ error(errno, errno, "reset setitimer failed");
+ }
+
+ // remove the signal handler
+ ret = sigaction(SIGALRM, &oldaction, NULL);
+ if (ret < 0) {
+ error(errno, errno, "reset sigaction failed");
+ }
+
+ // clean up the dup'd fd in case the signal never fired
+ close(dup_fd);
+ dup_fd = -1;
+
+ if (read_ret == 0) {
+ error(EXIT_FAILURE, 0, "EOF on jobserver pipe");
+ } else if (read_ret > 0) {
+ return true;
+ } else if (read_errno == EINTR || read_errno == EBADF) {
+ return false;
+ } else {
+ error(read_errno, read_errno, "read failed");
+ }
+ abort();
+}
+
+// Measure the size of the jobserver pool by reading from in_fd until it blocks
+static int GetJobserverTokens(int in_fd) {
+ int tokens = 0;
+ pollfd pollfds[] = {{in_fd, POLLIN, 0}};
+ int ret;
+ while ((ret = TEMP_FAILURE_RETRY(poll(pollfds, 1, 0))) != 0) {
+ if (ret < 0) {
+ error(errno, errno, "poll failed");
+ } else if (pollfds[0].revents != POLLIN) {
+ error(EXIT_FAILURE, 0, "unexpected event %d\n", pollfds[0].revents);
+ }
+
+ // There is probably a job token in the jobserver pipe. There is a chance
+ // another process reads it first, which would cause a blocking read to
+ // block forever (or until another process put a token back in the pipe).
+ // The file descriptor can't be set to O_NONBLOCK as that would affect
+ // all users of the pipe, including the parent make process.
+ // ReadByteTimeout emulates a non-blocking read on a !O_NONBLOCK socket
+ // using a SIGALRM that fires after a short timeout.
+ bool got_token = ReadByteTimeout(in_fd, 10);
+ if (!got_token) {
+ // No more tokens
+ break;
+ } else {
+ tokens++;
+ }
+ }
+
+ // This process implicitly gets a token, so pool size is measured size + 1
+ return tokens;
+}
+
+// Return tokens to the jobserver pool.
+static void PutJobserverTokens(int out_fd, int tokens) {
+ // Return all the tokens to the pipe
+ char buf = '+';
+ for (int i = 0; i < tokens; i++) {
+ int ret = TEMP_FAILURE_RETRY(write(out_fd, &buf, 1));
+ if (ret < 0) {
+ error(errno, errno, "write failed");
+ } else if (ret == 0) {
+ error(EXIT_FAILURE, 0, "EOF on jobserver pipe");
+ }
+ }
+}
+
+int main(int argc, char* argv[]) {
+ int in_fd = -1;
+ int out_fd = -1;
+ bool parallel = false;
+ bool keep_going = false;
+ bool ninja = false;
+ int tokens = 0;
+
+ if (argc > 1 && strcmp(argv[1], "--ninja") == 0) {
+ ninja = true;
+ argv++;
+ argc--;
+ }
+
+ if (argc < 2) {
+ error(EXIT_FAILURE, 0, "expected command to run");
+ }
+
+ const char* path = argv[1];
+ std::vector<char*> args({argv[1]});
+
+ std::vector<std::string> makeflags = ReadMakeflags();
+ if (ParseMakeflags(makeflags, &in_fd, &out_fd, ¶llel, &keep_going)) {
+ if (in_fd >= 0 && out_fd >= 0) {
+ CheckFd(in_fd);
+ CheckFd(out_fd);
+ fcntl(in_fd, F_SETFD, FD_CLOEXEC);
+ fcntl(out_fd, F_SETFD, FD_CLOEXEC);
+ tokens = GetJobserverTokens(in_fd);
+ }
+ }
+
+ std::string jarg = "-j" + std::to_string(tokens + 1);
+
+ if (ninja) {
+ if (!parallel) {
+ // ninja is parallel by default, pass -j1 to disable parallelism if make wasn't parallel
+ args.push_back(strdup("-j1"));
+ } else if (tokens > 0) {
+ args.push_back(strdup(jarg.c_str()));
+ }
+ if (keep_going) {
+ args.push_back(strdup("-k0"));
+ }
+ } else {
+ args.push_back(strdup(jarg.c_str()));
+ }
+
+ args.insert(args.end(), &argv[2], &argv[argc]);
+
+ args.push_back(nullptr);
+
+ pid_t pid = fork();
+ if (pid < 0) {
+ error(errno, errno, "fork failed");
+ } else if (pid == 0) {
+ // child
+ int ret = execvp(path, args.data());
+ if (ret < 0) {
+ error(errno, errno, "exec %s failed", path);
+ }
+ abort();
+ }
+
+ // parent
+ siginfo_t status = {};
+ int exit_status = 0;
+ int ret = waitid(P_PID, pid, &status, WEXITED);
+ if (ret < 0) {
+ error(errno, errno, "waitpid failed");
+ } else if (status.si_code == CLD_EXITED) {
+ exit_status = status.si_status;
+ } else {
+ exit_status = -(status.si_status);
+ }
+
+ if (tokens > 0) {
+ PutJobserverTokens(out_fd, tokens);
+ }
+ exit(exit_status);
+}
diff --git a/tools/mktarball.sh b/tools/mktarball.sh
index 3e32006..ef0fe86 100755
--- a/tools/mktarball.sh
+++ b/tools/mktarball.sh
@@ -5,8 +5,9 @@
# $3: subdir to tar up (from $2)
# $4: target tar name
# $5: target tarball name (usually $(3).bz2)
+# $6: TARGET_OUT path to query device specific FS configs
-if [ $# -ne 5 ]; then
+if [ $# -ne 6 ]; then
echo "Error: wrong number of arguments in cmd: $0 $* "
exit 1
fi
@@ -16,6 +17,7 @@
dir_to_tar=$3
target_tar=`readlink -f $4`
target_tarball=`readlink -f $5`
+target_out=`readlink -f $6`
cd $2
@@ -28,7 +30,7 @@
for f in ${subdirs} ${files} ; do
curr_perms=`stat -c 0%a $f`
[ -d "$f" ] && is_dir=1 || is_dir=0
- new_info=`${fs_get_stats} ${curr_perms} ${is_dir} ${f}`
+ new_info=`${fs_get_stats} ${curr_perms} ${is_dir} ${f} ${target_out}`
new_uid=`echo ${new_info} | awk '{print $1;}'`
new_gid=`echo ${new_info} | awk '{print $2;}'`
new_perms=`echo ${new_info} | awk '{print $3;}'`
diff --git a/tools/check_prereq/Android.mk b/tools/normalize_path.py
old mode 100644
new mode 100755
similarity index 61%
copy from tools/check_prereq/Android.mk
copy to tools/normalize_path.py
index 4329aff..6c4d548
--- a/tools/check_prereq/Android.mk
+++ b/tools/normalize_path.py
@@ -1,4 +1,6 @@
-# Copyright (C) 2009 The Android Open Source Project
+#!/usr/bin/env python
+#
+# Copyright (C) 2015 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,15 +13,17 @@
# 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.
+"""
+Normalize and output paths from arguments, or stdin if no arguments provided.
+"""
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
+import os.path
+import sys
-LOCAL_SRC_FILES := check_prereq.c
-LOCAL_MODULE := check_prereq
-LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES +=
-LOCAL_STATIC_LIBRARIES += libcutils libc
+if len(sys.argv) > 1:
+ for p in sys.argv[1:]:
+ print os.path.normpath(p)
+ sys.exit(0)
-include $(BUILD_EXECUTABLE)
+for line in sys.stdin:
+ print os.path.normpath(line.strip())
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index fa6106f..9dcaadf 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -37,11 +37,12 @@
# (this is for userdebug builds)
if prop.get("ro.debuggable") == "1":
val = prop.get("persist.sys.usb.config")
- if val == "":
- val = "adb"
- else:
- val = val + ",adb"
- prop.put("persist.sys.usb.config", val)
+ if "adb" not in val:
+ if val == "":
+ val = "adb"
+ else:
+ val = val + ",adb"
+ prop.put("persist.sys.usb.config", val)
# UsbDeviceManager expects a value here. If it doesn't get it, it will
# default to "adb". That might not the right policy there, but it's better
# to be explicit.
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index eab8113..7cb9072 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -28,8 +28,10 @@
print >> sys.stderr, "Python 2.7 or newer is required."
sys.exit(1)
+import datetime
import errno
import os
+import shutil
import tempfile
import zipfile
@@ -40,6 +42,9 @@
OPTIONS.add_missing = False
OPTIONS.rebuild_recovery = False
+OPTIONS.replace_verity_public_key = False
+OPTIONS.replace_verity_private_key = False
+OPTIONS.verity_signer_path = None
def AddSystem(output_zip, prefix="IMAGES/", recovery_img=None, boot_img=None):
"""Turn the contents of SYSTEM into a system image and store it in
@@ -119,6 +124,12 @@
if fstab:
image_props["fs_type"] = fstab["/" + what].fs_type
+ # Use a fixed timestamp (01/01/2009) when packaging the image.
+ # Bug: 24377993
+ epoch = datetime.datetime.fromtimestamp(0)
+ timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
+ image_props["timestamp"] = int(timestamp)
+
if what == "system":
fs_config_prefix = ""
else:
@@ -129,21 +140,11 @@
if not os.path.exists(fs_config):
fs_config = None
- fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts")
- if not os.path.exists(fc_config):
- fc_config = None
-
# Override values loaded from info_dict.
if fs_config:
image_props["fs_config"] = fs_config
- if fc_config:
- image_props["selinux_fc"] = fc_config
if block_list:
image_props["block_list"] = block_list
- if image_props.get("system_root_image") == "true":
- image_props["ramdisk_dir"] = os.path.join(input_dir, "BOOT/RAMDISK")
- image_props["ramdisk_fs_config"] = os.path.join(
- input_dir, "META/boot_filesystem_config.txt")
succ = build_image.BuildImage(os.path.join(input_dir, what),
image_props, img)
@@ -153,15 +154,20 @@
def AddUserdata(output_zip, prefix="IMAGES/"):
- """Create an empty userdata image and store it in output_zip."""
+ """Create a userdata image and store it in output_zip.
+
+ In most case we just create and store an empty userdata.img;
+ But the invoker can also request to create userdata.img with real
+ data from the target files, by setting "userdata_img_with_data=true"
+ in OPTIONS.info_dict.
+ """
prebuilt_path = os.path.join(OPTIONS.input_tmp, prefix, "userdata.img")
if os.path.exists(prebuilt_path):
print "userdata.img already exists in %s, no need to rebuild..." % (prefix,)
return
- image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
- "data")
+ image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "data")
# We only allow yaffs to have a 0/missing partition_size.
# Extfs, f2fs must have a size. Skip userdata.img if no size.
if (not image_props.get("fs_type", "").startswith("yaffs") and
@@ -170,12 +176,27 @@
print "creating userdata.img..."
+ # Use a fixed timestamp (01/01/2009) when packaging the image.
+ # Bug: 24377993
+ epoch = datetime.datetime.fromtimestamp(0)
+ timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
+ image_props["timestamp"] = int(timestamp)
+
# The name of the directory it is making an image out of matters to
# mkyaffs2image. So we create a temp dir, and within it we create an
- # empty dir named "data", and build the image from that.
+ # empty dir named "data", or a symlink to the DATA dir,
+ # and build the image from that.
temp_dir = tempfile.mkdtemp()
user_dir = os.path.join(temp_dir, "data")
- os.mkdir(user_dir)
+ empty = (OPTIONS.info_dict.get("userdata_img_with_data") != "true")
+ if empty:
+ # Create an empty dir.
+ os.mkdir(user_dir)
+ else:
+ # Symlink to the DATA dir.
+ os.symlink(os.path.join(OPTIONS.input_tmp, "DATA"),
+ user_dir)
+
img = tempfile.NamedTemporaryFile()
fstab = OPTIONS.info_dict["fstab"]
@@ -187,8 +208,7 @@
common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
common.ZipWrite(output_zip, img.name, prefix + "userdata.img")
img.close()
- os.rmdir(user_dir)
- os.rmdir(temp_dir)
+ shutil.rmtree(temp_dir)
def AddCache(output_zip, prefix="IMAGES/"):
@@ -199,14 +219,19 @@
print "cache.img already exists in %s, no need to rebuild..." % (prefix,)
return
- image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
- "cache")
+ image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "cache")
# The build system has to explicitly request for cache.img.
if "fs_type" not in image_props:
return
print "creating cache.img..."
+ # Use a fixed timestamp (01/01/2009) when packaging the image.
+ # Bug: 24377993
+ epoch = datetime.datetime.fromtimestamp(0)
+ timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
+ image_props["timestamp"] = int(timestamp)
+
# The name of the directory it is making an image out of matters to
# mkyaffs2image. So we create a temp dir, and within it we create an
# empty dir named "cache", and build the image from that.
@@ -243,15 +268,14 @@
except KeyError:
has_vendor = False
- OPTIONS.info_dict = common.LoadInfoDict(input_zip)
- if "selinux_fc" in OPTIONS.info_dict:
- OPTIONS.info_dict["selinux_fc"] = os.path.join(
- OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts")
+ OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.input_tmp)
common.ZipClose(input_zip)
output_zip = zipfile.ZipFile(filename, "a",
compression=zipfile.ZIP_DEFLATED)
+ has_recovery = (OPTIONS.info_dict.get("no_recovery") != "true")
+
def banner(s):
print "\n\n++++ " + s + " ++++\n\n"
@@ -269,19 +293,21 @@
if boot_image:
boot_image.AddToZip(output_zip)
- banner("recovery")
recovery_image = None
- prebuilt_path = os.path.join(OPTIONS.input_tmp, "IMAGES", "recovery.img")
- if os.path.exists(prebuilt_path):
- print "recovery.img already exists in IMAGES/, no need to rebuild..."
- if OPTIONS.rebuild_recovery:
+ if has_recovery:
+ banner("recovery")
+ prebuilt_path = os.path.join(OPTIONS.input_tmp, "IMAGES", "recovery.img")
+ if os.path.exists(prebuilt_path):
+ print "recovery.img already exists in IMAGES/, no need to rebuild..."
+ if OPTIONS.rebuild_recovery:
+ recovery_image = common.GetBootableImage(
+ "IMAGES/recovery.img", "recovery.img", OPTIONS.input_tmp,
+ "RECOVERY")
+ else:
recovery_image = common.GetBootableImage(
"IMAGES/recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
- else:
- recovery_image = common.GetBootableImage(
- "IMAGES/recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
- if recovery_image:
- recovery_image.AddToZip(output_zip)
+ if recovery_image:
+ recovery_image.AddToZip(output_zip)
banner("system")
AddSystem(output_zip, recovery_img=recovery_image, boot_img=boot_image)
@@ -293,21 +319,47 @@
banner("cache")
AddCache(output_zip)
+ # For devices using A/B update, copy over images from RADIO/ to IMAGES/ and
+ # make sure we have all the needed images ready under IMAGES/.
+ ab_partitions = os.path.join(OPTIONS.input_tmp, "META", "ab_partitions.txt")
+ if os.path.exists(ab_partitions):
+ with open(ab_partitions, 'r') as f:
+ lines = f.readlines()
+ for line in lines:
+ img_name = line.strip() + ".img"
+ img_radio_path = os.path.join(OPTIONS.input_tmp, "RADIO", img_name)
+ if os.path.exists(img_radio_path):
+ common.ZipWrite(output_zip, img_radio_path,
+ os.path.join("IMAGES", img_name))
+
+ # Zip spec says: All slashes MUST be forward slashes.
+ img_path = 'IMAGES/' + img_name
+ assert img_path in output_zip.namelist(), "cannot find " + img_name
+
common.ZipClose(output_zip)
def main(argv):
- def option_handler(o, _):
+ def option_handler(o, a):
if o in ("-a", "--add_missing"):
OPTIONS.add_missing = True
elif o in ("-r", "--rebuild_recovery",):
OPTIONS.rebuild_recovery = True
+ elif o == "--replace_verity_private_key":
+ OPTIONS.replace_verity_private_key = (True, a)
+ elif o == "--replace_verity_public_key":
+ OPTIONS.replace_verity_public_key = (True, a)
+ elif o == "--verity_signer_path":
+ OPTIONS.verity_signer_path = a
else:
return False
return True
args = common.ParseOptions(
argv, __doc__, extra_opts="ar",
- extra_long_opts=["add_missing", "rebuild_recovery"],
+ extra_long_opts=["add_missing", "rebuild_recovery",
+ "replace_verity_public_key=",
+ "replace_verity_private_key=",
+ "verity_signer_path="],
extra_option_handler=option_handler)
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index 8eb249a..1d338ee 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -16,6 +16,7 @@
from collections import deque, OrderedDict
from hashlib import sha1
+import common
import heapq
import itertools
import multiprocessing
@@ -74,7 +75,7 @@
def ReadRangeSet(self, ranges):
raise NotImplementedError
- def TotalSha1(self):
+ def TotalSha1(self, include_clobbered_blocks=False):
raise NotImplementedError
@@ -82,11 +83,16 @@
"""A zero-length image."""
blocksize = 4096
care_map = RangeSet()
+ clobbered_blocks = RangeSet()
+ extended = RangeSet()
total_blocks = 0
file_map = {}
def ReadRangeSet(self, ranges):
return ()
- def TotalSha1(self):
+ def TotalSha1(self, include_clobbered_blocks=False):
+ # EmptyImage always carries empty clobbered_blocks, so
+ # include_clobbered_blocks can be ignored.
+ assert self.clobbered_blocks.size() == 0
return sha1().hexdigest()
@@ -100,11 +106,13 @@
assert not (trim and pad)
partial = len(self.data) % self.blocksize
+ padded = False
if partial > 0:
if trim:
self.data = self.data[:-partial]
elif pad:
self.data += '\0' * (self.blocksize - partial)
+ padded = True
else:
raise ValueError(("data for DataImage must be multiple of %d bytes "
"unless trim or pad is specified") %
@@ -114,12 +122,23 @@
self.total_blocks = len(self.data) / self.blocksize
self.care_map = RangeSet(data=(0, self.total_blocks))
+ # When the last block is padded, we always write the whole block even for
+ # incremental OTAs. Because otherwise the last block may get skipped if
+ # unchanged for an incremental, but would fail the post-install
+ # verification if it has non-zero contents in the padding bytes.
+ # Bug: 23828506
+ if padded:
+ clobbered_blocks = [self.total_blocks-1, self.total_blocks]
+ else:
+ clobbered_blocks = []
+ self.clobbered_blocks = clobbered_blocks
+ self.extended = RangeSet()
zero_blocks = []
nonzero_blocks = []
reference = '\0' * self.blocksize
- for i in range(self.total_blocks):
+ for i in range(self.total_blocks-1 if padded else self.total_blocks):
d = self.data[i*self.blocksize : (i+1)*self.blocksize]
if d == reference:
zero_blocks.append(i)
@@ -128,14 +147,25 @@
nonzero_blocks.append(i)
nonzero_blocks.append(i+1)
- self.file_map = {"__ZERO": RangeSet(zero_blocks),
- "__NONZERO": RangeSet(nonzero_blocks)}
+ assert zero_blocks or nonzero_blocks or clobbered_blocks
+
+ self.file_map = dict()
+ if zero_blocks:
+ self.file_map["__ZERO"] = RangeSet(data=zero_blocks)
+ if nonzero_blocks:
+ self.file_map["__NONZERO"] = RangeSet(data=nonzero_blocks)
+ if clobbered_blocks:
+ self.file_map["__COPY"] = RangeSet(data=clobbered_blocks)
def ReadRangeSet(self, ranges):
return [self.data[s*self.blocksize:e*self.blocksize] for (s, e) in ranges]
- def TotalSha1(self):
- return sha1(self.data).hexdigest()
+ def TotalSha1(self, include_clobbered_blocks=False):
+ if not include_clobbered_blocks:
+ ranges = self.care_map.subtract(self.clobbered_blocks)
+ return sha1(self.ReadRangeSet(ranges)).hexdigest()
+ else:
+ return sha1(self.data).hexdigest()
class Transfer(object):
@@ -163,6 +193,12 @@
return (sum(sr.size() for (_, sr) in self.stash_before) -
sum(sr.size() for (_, sr) in self.use_stash))
+ def ConvertToNew(self):
+ assert self.style != "new"
+ self.use_stash = []
+ self.style = "new"
+ self.src_ranges = RangeSet()
+
def __str__(self):
return (str(self.id) + ": <" + str(self.src_ranges) + " " + self.style +
" to " + str(self.tgt_ranges) + ">")
@@ -184,6 +220,10 @@
# (Typically a domain is a file, and the key in file_map is the
# pathname.)
#
+# clobbered_blocks: a RangeSet containing which blocks contain data
+# but may be altered by the FS. They need to be excluded when
+# verifying the partition integrity.
+#
# ReadRangeSet(): a function that takes a RangeSet and returns the
# data contained in the image blocks of that RangeSet. The data
# is returned as a list or tuple of strings; concatenating the
@@ -193,14 +233,15 @@
#
# TotalSha1(): a function that returns (as a hex string) the SHA-1
# hash of all the data in the image (ie, all the blocks in the
-# care_map)
+# care_map minus clobbered_blocks, or including the clobbered
+# blocks if include_clobbered_blocks is True).
#
# When creating a BlockImageDiff, the src image may be None, in which
# case the list of transfers produced will never read from the
# original image.
class BlockImageDiff(object):
- def __init__(self, tgt, src=None, threads=None, version=3):
+ def __init__(self, tgt, src=None, threads=None, version=4):
if threads is None:
threads = multiprocessing.cpu_count() // 2
if threads == 0:
@@ -211,7 +252,7 @@
self.src_basenames = {}
self.src_numpatterns = {}
- assert version in (1, 2, 3)
+ assert version in (1, 2, 3, 4)
self.tgt = tgt
if src is None:
@@ -252,6 +293,10 @@
self.ReverseBackwardEdges()
self.ImproveVertexSequence()
+ # Ensure the runtime stash size is under the limit.
+ if self.version >= 2 and common.OPTIONS.cache_size is not None:
+ self.ReviseStashSize()
+
# Double-check our work.
self.AssertSequenceGood()
@@ -271,7 +316,6 @@
out = []
total = 0
- performs_read = False
stashes = {}
stashed_blocks = 0
@@ -294,8 +338,8 @@
sid = next_stash_id
next_stash_id += 1
stashes[s] = sid
- stashed_blocks += sr.size()
if self.version == 2:
+ stashed_blocks += sr.size()
out.append("stash %d %s\n" % (sid, sr.to_string_raw()))
else:
sh = self.HashBlocks(self.src, sr)
@@ -303,15 +347,17 @@
stashes[sh] += 1
else:
stashes[sh] = 1
+ stashed_blocks += sr.size()
out.append("stash %s %s\n" % (sh, sr.to_string_raw()))
if stashed_blocks > max_stashed_blocks:
max_stashed_blocks = stashed_blocks
free_string = []
+ free_size = 0
if self.version == 1:
- src_str = xf.src_ranges.to_string_raw()
+ src_str = xf.src_ranges.to_string_raw() if xf.src_ranges else ""
elif self.version >= 2:
# <# blocks> <src ranges>
@@ -327,18 +373,25 @@
mapped_stashes = []
for s, sr in xf.use_stash:
sid = stashes.pop(s)
- stashed_blocks -= sr.size()
unstashed_src_ranges = unstashed_src_ranges.subtract(sr)
sh = self.HashBlocks(self.src, sr)
sr = xf.src_ranges.map_within(sr)
mapped_stashes.append(sr)
if self.version == 2:
src_str.append("%d:%s" % (sid, sr.to_string_raw()))
+ # A stash will be used only once. We need to free the stash
+ # immediately after the use, instead of waiting for the automatic
+ # clean-up at the end. Because otherwise it may take up extra space
+ # and lead to OTA failures.
+ # Bug: 23119955
+ free_string.append("free %d\n" % (sid,))
+ free_size += sr.size()
else:
assert sh in stashes
src_str.append("%s:%s" % (sh, sr.to_string_raw()))
stashes[sh] -= 1
if stashes[sh] == 0:
+ free_size += sr.size()
free_string.append("free %s\n" % (sh))
stashes.pop(sh)
heapq.heappush(free_stash_ids, sid)
@@ -383,7 +436,6 @@
out.append("%s %s\n" % (xf.style, xf.tgt_ranges.to_string_raw()))
total += tgt_size
elif xf.style == "move":
- performs_read = True
assert xf.tgt_ranges
assert xf.src_ranges.size() == tgt_size
if xf.src_ranges != xf.tgt_ranges:
@@ -398,7 +450,7 @@
elif self.version >= 3:
# take into account automatic stashing of overlapping blocks
if xf.src_ranges.overlaps(xf.tgt_ranges):
- temp_stash_usage = stashed_blocks + xf.src_ranges.size();
+ temp_stash_usage = stashed_blocks + xf.src_ranges.size()
if temp_stash_usage > max_stashed_blocks:
max_stashed_blocks = temp_stash_usage
@@ -408,7 +460,6 @@
xf.tgt_ranges.to_string_raw(), src_str))
total += tgt_size
elif xf.style in ("bsdiff", "imgdiff"):
- performs_read = True
assert xf.tgt_ranges
assert xf.src_ranges
if self.version == 1:
@@ -422,7 +473,7 @@
elif self.version >= 3:
# take into account automatic stashing of overlapping blocks
if xf.src_ranges.overlaps(xf.tgt_ranges):
- temp_stash_usage = stashed_blocks + xf.src_ranges.size();
+ temp_stash_usage = stashed_blocks + xf.src_ranges.size()
if temp_stash_usage > max_stashed_blocks:
max_stashed_blocks = temp_stash_usage
@@ -444,27 +495,38 @@
if free_string:
out.append("".join(free_string))
+ stashed_blocks -= free_size
+ if self.version >= 2 and common.OPTIONS.cache_size is not None:
+ # Sanity check: abort if we're going to need more stash space than
+ # the allowed size (cache_size * threshold). There are two purposes
+ # of having a threshold here. a) Part of the cache may have been
+ # occupied by some recovery logs. b) It will buy us some time to deal
+ # with the oversize issue.
+ cache_size = common.OPTIONS.cache_size
+ stash_threshold = common.OPTIONS.stash_threshold
+ max_allowed = cache_size * stash_threshold
+ assert max_stashed_blocks * self.tgt.blocksize < max_allowed, \
+ 'Stash size %d (%d * %d) exceeds the limit %d (%d * %.2f)' % (
+ max_stashed_blocks * self.tgt.blocksize, max_stashed_blocks,
+ self.tgt.blocksize, max_allowed, cache_size,
+ stash_threshold)
- # sanity check: abort if we're going to need more than 512 MB if
- # stash space
- assert max_stashed_blocks * self.tgt.blocksize < (512 << 20)
+ # Zero out extended blocks as a workaround for bug 20881595.
+ if self.tgt.extended:
+ out.append("zero %s\n" % (self.tgt.extended.to_string_raw(),))
+ total += self.tgt.extended.size()
+ # We erase all the blocks on the partition that a) don't contain useful
+ # data in the new image and b) will not be touched by dm-verity.
all_tgt = RangeSet(data=(0, self.tgt.total_blocks))
- if performs_read:
- # if some of the original data is used, then at the end we'll
- # erase all the blocks on the partition that don't contain data
- # in the new image.
- new_dontcare = all_tgt.subtract(self.tgt.care_map)
- if new_dontcare:
- out.append("erase %s\n" % (new_dontcare.to_string_raw(),))
- else:
- # if nothing is read (ie, this is a full OTA), then we can start
- # by erasing the entire partition.
- out.insert(0, "erase %s\n" % (all_tgt.to_string_raw(),))
+ all_tgt_minus_extended = all_tgt.subtract(self.tgt.extended)
+ new_dontcare = all_tgt_minus_extended.subtract(self.tgt.care_map)
+ if new_dontcare:
+ out.append("erase %s\n" % (new_dontcare.to_string_raw(),))
out.insert(0, "%d\n" % (self.version,)) # format version number
- out.insert(1, str(total) + "\n")
+ out.insert(1, "%d\n" % (total,))
if self.version >= 2:
# version 2 only: after the total block count, we give the number
# of stash slots needed, and the maximum size needed (in blocks)
@@ -476,8 +538,90 @@
f.write(i)
if self.version >= 2:
- print("max stashed blocks: %d (%d bytes)\n" % (
- max_stashed_blocks, max_stashed_blocks * self.tgt.blocksize))
+ max_stashed_size = max_stashed_blocks * self.tgt.blocksize
+ OPTIONS = common.OPTIONS
+ if OPTIONS.cache_size is not None:
+ max_allowed = OPTIONS.cache_size * OPTIONS.stash_threshold
+ print("max stashed blocks: %d (%d bytes), "
+ "limit: %d bytes (%.2f%%)\n" % (
+ max_stashed_blocks, max_stashed_size, max_allowed,
+ max_stashed_size * 100.0 / max_allowed))
+ else:
+ print("max stashed blocks: %d (%d bytes), limit: <unknown>\n" % (
+ max_stashed_blocks, max_stashed_size))
+
+ def ReviseStashSize(self):
+ print("Revising stash size...")
+ stashes = {}
+
+ # Create the map between a stash and its def/use points. For example, for a
+ # given stash of (idx, sr), stashes[idx] = (sr, def_cmd, use_cmd).
+ for xf in self.transfers:
+ # Command xf defines (stores) all the stashes in stash_before.
+ for idx, sr in xf.stash_before:
+ stashes[idx] = (sr, xf)
+
+ # Record all the stashes command xf uses.
+ for idx, _ in xf.use_stash:
+ stashes[idx] += (xf,)
+
+ # Compute the maximum blocks available for stash based on /cache size and
+ # the threshold.
+ cache_size = common.OPTIONS.cache_size
+ stash_threshold = common.OPTIONS.stash_threshold
+ max_allowed = cache_size * stash_threshold / self.tgt.blocksize
+
+ stashed_blocks = 0
+ new_blocks = 0
+
+ # Now go through all the commands. Compute the required stash size on the
+ # fly. If a command requires excess stash than available, it deletes the
+ # stash by replacing the command that uses the stash with a "new" command
+ # instead.
+ for xf in self.transfers:
+ replaced_cmds = []
+
+ # xf.stash_before generates explicit stash commands.
+ for idx, sr in xf.stash_before:
+ if stashed_blocks + sr.size() > max_allowed:
+ # We cannot stash this one for a later command. Find out the command
+ # that will use this stash and replace the command with "new".
+ use_cmd = stashes[idx][2]
+ replaced_cmds.append(use_cmd)
+ print("%10d %9s %s" % (sr.size(), "explicit", use_cmd))
+ else:
+ stashed_blocks += sr.size()
+
+ # xf.use_stash generates free commands.
+ for _, sr in xf.use_stash:
+ stashed_blocks -= sr.size()
+
+ # "move" and "diff" may introduce implicit stashes in BBOTA v3. Prior to
+ # ComputePatches(), they both have the style of "diff".
+ if xf.style == "diff" and self.version >= 3:
+ assert xf.tgt_ranges and xf.src_ranges
+ if xf.src_ranges.overlaps(xf.tgt_ranges):
+ if stashed_blocks + xf.src_ranges.size() > max_allowed:
+ replaced_cmds.append(xf)
+ print("%10d %9s %s" % (xf.src_ranges.size(), "implicit", xf))
+
+ # Replace the commands in replaced_cmds with "new"s.
+ for cmd in replaced_cmds:
+ # It no longer uses any commands in "use_stash". Remove the def points
+ # for all those stashes.
+ for idx, sr in cmd.use_stash:
+ def_cmd = stashes[idx][1]
+ assert (idx, sr) in def_cmd.stash_before
+ def_cmd.stash_before.remove((idx, sr))
+
+ # Add up blocks that violates space limit and print total number to
+ # screen later.
+ new_blocks += cmd.tgt_ranges.size()
+ cmd.ConvertToNew()
+
+ num_of_bytes = new_blocks * self.tgt.blocksize
+ print(" Total %d blocks (%d bytes) are packed as new blocks due to "
+ "insufficient cache size." % (new_blocks, num_of_bytes))
def ComputePatches(self, prefix):
print("Reticulating splines...")
@@ -834,6 +978,64 @@
a.goes_after[b] = size
def FindTransfers(self):
+ """Parse the file_map to generate all the transfers."""
+
+ def AddTransfer(tgt_name, src_name, tgt_ranges, src_ranges, style, by_id,
+ split=False):
+ """Wrapper function for adding a Transfer().
+
+ For BBOTA v3, we need to stash source blocks for resumable feature.
+ However, with the growth of file size and the shrink of the cache
+ partition source blocks are too large to be stashed. If a file occupies
+ too many blocks (greater than MAX_BLOCKS_PER_DIFF_TRANSFER), we split it
+ into smaller pieces by getting multiple Transfer()s.
+
+ The downside is that after splitting, we may increase the package size
+ since the split pieces don't align well. According to our experiments,
+ 1/8 of the cache size as the per-piece limit appears to be optimal.
+ Compared to the fixed 1024-block limit, it reduces the overall package
+ size by 30% volantis, and 20% for angler and bullhead."""
+
+ # We care about diff transfers only.
+ if style != "diff" or not split:
+ Transfer(tgt_name, src_name, tgt_ranges, src_ranges, style, by_id)
+ return
+
+ pieces = 0
+ cache_size = common.OPTIONS.cache_size
+ split_threshold = 0.125
+ max_blocks_per_transfer = int(cache_size * split_threshold /
+ self.tgt.blocksize)
+
+ # Change nothing for small files.
+ if (tgt_ranges.size() <= max_blocks_per_transfer and
+ src_ranges.size() <= max_blocks_per_transfer):
+ Transfer(tgt_name, src_name, tgt_ranges, src_ranges, style, by_id)
+ return
+
+ while (tgt_ranges.size() > max_blocks_per_transfer and
+ src_ranges.size() > max_blocks_per_transfer):
+ tgt_split_name = "%s-%d" % (tgt_name, pieces)
+ src_split_name = "%s-%d" % (src_name, pieces)
+ tgt_first = tgt_ranges.first(max_blocks_per_transfer)
+ src_first = src_ranges.first(max_blocks_per_transfer)
+
+ Transfer(tgt_split_name, src_split_name, tgt_first, src_first, style,
+ by_id)
+
+ tgt_ranges = tgt_ranges.subtract(tgt_first)
+ src_ranges = src_ranges.subtract(src_first)
+ pieces += 1
+
+ # Handle remaining blocks.
+ if tgt_ranges.size() or src_ranges.size():
+ # Must be both non-empty.
+ assert tgt_ranges.size() and src_ranges.size()
+ tgt_split_name = "%s-%d" % (tgt_name, pieces)
+ src_split_name = "%s-%d" % (src_name, pieces)
+ Transfer(tgt_split_name, src_split_name, tgt_ranges, src_ranges, style,
+ by_id)
+
empty = RangeSet()
for tgt_fn, tgt_ranges in self.tgt.file_map.items():
if tgt_fn == "__ZERO":
@@ -841,22 +1043,28 @@
# in any file and that are filled with zeros. We have a
# special transfer style for zero blocks.
src_ranges = self.src.file_map.get("__ZERO", empty)
- Transfer(tgt_fn, "__ZERO", tgt_ranges, src_ranges,
- "zero", self.transfers)
+ AddTransfer(tgt_fn, "__ZERO", tgt_ranges, src_ranges,
+ "zero", self.transfers)
+ continue
+
+ elif tgt_fn == "__COPY":
+ # "__COPY" domain includes all the blocks not contained in any
+ # file and that need to be copied unconditionally to the target.
+ AddTransfer(tgt_fn, None, tgt_ranges, empty, "new", self.transfers)
continue
elif tgt_fn in self.src.file_map:
# Look for an exact pathname match in the source.
- Transfer(tgt_fn, tgt_fn, tgt_ranges, self.src.file_map[tgt_fn],
- "diff", self.transfers)
+ AddTransfer(tgt_fn, tgt_fn, tgt_ranges, self.src.file_map[tgt_fn],
+ "diff", self.transfers, self.version >= 3)
continue
b = os.path.basename(tgt_fn)
if b in self.src_basenames:
# Look for an exact basename match in the source.
src_fn = self.src_basenames[b]
- Transfer(tgt_fn, src_fn, tgt_ranges, self.src.file_map[src_fn],
- "diff", self.transfers)
+ AddTransfer(tgt_fn, src_fn, tgt_ranges, self.src.file_map[src_fn],
+ "diff", self.transfers, self.version >= 3)
continue
b = re.sub("[0-9]+", "#", b)
@@ -866,11 +1074,11 @@
# for .so files that contain version numbers in the filename
# that get bumped.)
src_fn = self.src_numpatterns[b]
- Transfer(tgt_fn, src_fn, tgt_ranges, self.src.file_map[src_fn],
- "diff", self.transfers)
+ AddTransfer(tgt_fn, src_fn, tgt_ranges, self.src.file_map[src_fn],
+ "diff", self.transfers, self.version >= 3)
continue
- Transfer(tgt_fn, None, tgt_ranges, empty, "new", self.transfers)
+ AddTransfer(tgt_fn, None, tgt_ranges, empty, "new", self.transfers)
def AbbreviateSourceNames(self):
for k in self.src.file_map.keys():
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 3909b4c..e6ad18b 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -22,26 +22,40 @@
"""
import os
import os.path
+import re
import subprocess
import sys
import commands
+import common
import shutil
import tempfile
+OPTIONS = common.OPTIONS
+
FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
+BLOCK_SIZE = 4096
def RunCommand(cmd):
- """ Echo and run the given command
+ """Echo and run the given command.
Args:
cmd: the command represented as a list of strings.
Returns:
- The exit code.
+ A tuple of the output and the exit code.
"""
print "Running: ", " ".join(cmd)
- p = subprocess.Popen(cmd)
- p.communicate()
- return p.returncode
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ output, _ = p.communicate()
+ print "%s" % (output.rstrip(),)
+ return (output, p.returncode)
+
+def GetVerityFECSize(partition_size):
+ cmd = "fec -s %d" % partition_size
+ status, output = commands.getstatusoutput(cmd)
+ if status:
+ print output
+ return False, 0
+ return True, int(output)
def GetVerityTreeSize(partition_size):
cmd = "build_verity_tree -s %d"
@@ -55,13 +69,29 @@
def GetVerityMetadataSize(partition_size):
cmd = "system/extras/verity/build_verity_metadata.py -s %d"
cmd %= partition_size
+
status, output = commands.getstatusoutput(cmd)
if status:
print output
return False, 0
return True, int(output)
-def AdjustPartitionSizeForVerity(partition_size):
+def GetVeritySize(partition_size, fec_supported):
+ success, verity_tree_size = GetVerityTreeSize(partition_size)
+ if not success:
+ return 0
+ success, verity_metadata_size = GetVerityMetadataSize(partition_size)
+ if not success:
+ return 0
+ verity_size = verity_tree_size + verity_metadata_size
+ if fec_supported:
+ success, fec_size = GetVerityFECSize(partition_size + verity_size)
+ if not success:
+ return 0
+ return verity_size + fec_size
+ return verity_size
+
+def AdjustPartitionSizeForVerity(partition_size, fec_supported):
"""Modifies the provided partition size to account for the verity metadata.
This information is used to size the created image appropriately.
@@ -70,13 +100,43 @@
Returns:
The size of the partition adjusted for verity metadata.
"""
- success, verity_tree_size = GetVerityTreeSize(partition_size)
- if not success:
- return 0
- success, verity_metadata_size = GetVerityMetadataSize(partition_size)
- if not success:
- return 0
- return partition_size - verity_tree_size - verity_metadata_size
+ key = "%d %d" % (partition_size, fec_supported)
+ if key in AdjustPartitionSizeForVerity.results:
+ return AdjustPartitionSizeForVerity.results[key]
+
+ hi = partition_size
+ if hi % BLOCK_SIZE != 0:
+ hi = (hi // BLOCK_SIZE) * BLOCK_SIZE
+
+ # verity tree and fec sizes depend on the partition size, which
+ # means this estimate is always going to be unnecessarily small
+ lo = partition_size - GetVeritySize(hi, fec_supported)
+ result = lo
+
+ # do a binary search for the optimal size
+ while lo < hi:
+ i = ((lo + hi) // (2 * BLOCK_SIZE)) * BLOCK_SIZE
+ size = i + GetVeritySize(i, fec_supported)
+ if size <= partition_size:
+ if result < i:
+ result = i
+ lo = i + BLOCK_SIZE
+ else:
+ hi = i
+
+ AdjustPartitionSizeForVerity.results[key] = result
+ return result
+
+AdjustPartitionSizeForVerity.results = {}
+
+def BuildVerityFEC(sparse_image_path, verity_path, verity_fec_path):
+ cmd = "fec -e %s %s %s" % (sparse_image_path, verity_path, verity_fec_path)
+ print cmd
+ status, output = commands.getstatusoutput(cmd)
+ if status:
+ print "Could not build FEC data! Error: %s" % output
+ return False
+ return True
def BuildVerityTree(sparse_image_path, verity_image_path, prop_dict):
cmd = "build_verity_tree -A %s %s %s" % (
@@ -122,13 +182,33 @@
return False
return True
-def BuildVerifiedImage(data_image_path, verity_image_path,
- verity_metadata_path):
- if not Append2Simg(data_image_path, verity_metadata_path,
- "Could not append verity metadata!"):
+def Append(target, file_to_append, error_message):
+ cmd = 'cat %s >> %s' % (file_to_append, target)
+ print cmd
+ status, output = commands.getstatusoutput(cmd)
+ if status:
+ print "%s: %s" % (error_message, output)
return False
+ return True
+
+def BuildVerifiedImage(data_image_path, verity_image_path,
+ verity_metadata_path, verity_fec_path,
+ fec_supported):
+ if not Append(verity_image_path, verity_metadata_path,
+ "Could not append verity metadata!"):
+ return False
+
+ if fec_supported:
+ # build FEC for the entire partition, including metadata
+ if not BuildVerityFEC(data_image_path, verity_image_path,
+ verity_fec_path):
+ return False
+
+ if not Append(verity_image_path, verity_fec_path, "Could not append FEC!"):
+ return False
+
if not Append2Simg(data_image_path, verity_image_path,
- "Could not append verity tree!"):
+ "Could not append verity data!"):
return False
return True
@@ -142,13 +222,13 @@
else:
return True, unsparse_image_path
inflate_command = ["simg2img", sparse_image_path, unsparse_image_path]
- exit_code = RunCommand(inflate_command)
+ (_, exit_code) = RunCommand(inflate_command)
if exit_code != 0:
os.remove(unsparse_image_path)
return False, None
return True, unsparse_image_path
-def MakeVerityEnabledImage(out_file, prop_dict):
+def MakeVerityEnabledImage(out_file, fec_supported, prop_dict):
"""Creates an image that is verifiable using dm-verity.
Args:
@@ -162,7 +242,11 @@
image_size = prop_dict["partition_size"]
block_dev = prop_dict["verity_block_device"]
signer_key = prop_dict["verity_key"] + ".pk8"
- signer_path = prop_dict["verity_signer_cmd"]
+ if OPTIONS.verity_signer_path is not None:
+ signer_path = OPTIONS.verity_signer_path + ' '
+ signer_path += ' '.join(OPTIONS.verity_signer_args)
+ else:
+ signer_path = prop_dict["verity_signer_cmd"]
# make a tempdir
tempdir_name = tempfile.mkdtemp(suffix="_verity_images")
@@ -170,6 +254,7 @@
# get partial image paths
verity_image_path = os.path.join(tempdir_name, "verity.img")
verity_metadata_path = os.path.join(tempdir_name, "verity_metadata.img")
+ verity_fec_path = os.path.join(tempdir_name, "verity_fec.img")
# build the verity tree and get the root hash and salt
if not BuildVerityTree(out_file, verity_image_path, prop_dict):
@@ -187,20 +272,23 @@
# build the full verified image
if not BuildVerifiedImage(out_file,
verity_image_path,
- verity_metadata_path):
+ verity_metadata_path,
+ verity_fec_path,
+ fec_supported):
shutil.rmtree(tempdir_name, ignore_errors=True)
return False
shutil.rmtree(tempdir_name, ignore_errors=True)
return True
-def BuildImage(in_dir, prop_dict, out_file):
+def BuildImage(in_dir, prop_dict, out_file, target_out=None):
"""Build an image to out_file from in_dir with property prop_dict.
Args:
in_dir: path of input directory.
prop_dict: property dictionary.
out_file: path of the output image file.
+ target_out: path of the product out directory to read device specific FS config files.
Returns:
True iff the image is built successfully.
@@ -233,14 +321,18 @@
fs_spans_partition = True
if fs_type.startswith("squash"):
- fs_spans_partition = False
+ fs_spans_partition = False
is_verity_partition = "verity_block_device" in prop_dict
verity_supported = prop_dict.get("verity") == "true"
- # adjust the partition size to make room for the hashes if this is to be verified
+ verity_fec_supported = prop_dict.get("verity_fec") == "true"
+
+ # Adjust the partition size to make room for the hashes if this is to be
+ # verified.
if verity_supported and is_verity_partition and fs_spans_partition:
partition_size = int(prop_dict.get("partition_size"))
- adjusted_size = AdjustPartitionSizeForVerity(partition_size)
+ adjusted_size = AdjustPartitionSizeForVerity(partition_size,
+ verity_fec_supported)
if not adjusted_size:
return False
prop_dict["partition_size"] = str(adjusted_size)
@@ -260,6 +352,8 @@
build_command.extend(["-T", str(prop_dict["timestamp"])])
if fs_config:
build_command.extend(["-C", fs_config])
+ if target_out:
+ build_command.extend(["-D", target_out])
if "block_list" in prop_dict:
build_command.extend(["-B", prop_dict["block_list"]])
build_command.extend(["-L", prop_dict["mount_point"]])
@@ -268,9 +362,17 @@
elif fs_type.startswith("squash"):
build_command = ["mksquashfsimage.sh"]
build_command.extend([in_dir, out_file])
+ if "squashfs_sparse_flag" in prop_dict:
+ build_command.extend([prop_dict["squashfs_sparse_flag"]])
build_command.extend(["-m", prop_dict["mount_point"]])
+ if target_out:
+ build_command.extend(["-d", target_out])
if "selinux_fc" in prop_dict:
build_command.extend(["-c", prop_dict["selinux_fc"]])
+ if "squashfs_compressor" in prop_dict:
+ build_command.extend(["-z", prop_dict["squashfs_compressor"]])
+ if "squashfs_compressor_opt" in prop_dict:
+ build_command.extend(["-zo", prop_dict["squashfs_compressor_opt"]])
elif fs_type.startswith("f2fs"):
build_command = ["mkf2fsuserimg.sh"]
build_command.extend([out_file, prop_dict["partition_size"]])
@@ -293,8 +395,15 @@
staging_system = os.path.join(in_dir, "system")
shutil.rmtree(staging_system, ignore_errors=True)
shutil.copytree(origin_in, staging_system, symlinks=True)
+
+ reserved_blocks = prop_dict.get("has_ext4_reserved_blocks") == "true"
+ ext4fs_output = None
+
try:
- exit_code = RunCommand(build_command)
+ if reserved_blocks and fs_type.startswith("ext4"):
+ (ext4fs_output, exit_code) = RunCommand(build_command)
+ else:
+ (_, exit_code) = RunCommand(build_command)
finally:
if in_dir != origin_in:
# Clean up temporary directories and files.
@@ -304,23 +413,48 @@
if exit_code != 0:
return False
+ # Bug: 21522719, 22023465
+ # There are some reserved blocks on ext4 FS (lesser of 4096 blocks and 2%).
+ # We need to deduct those blocks from the available space, since they are
+ # not writable even with root privilege. It only affects devices using
+ # file-based OTA and a kernel version of 3.10 or greater (currently just
+ # sprout).
+ if reserved_blocks and fs_type.startswith("ext4"):
+ assert ext4fs_output is not None
+ ext4fs_stats = re.compile(
+ r'Created filesystem with .* (?P<used_blocks>[0-9]+)/'
+ r'(?P<total_blocks>[0-9]+) blocks')
+ m = ext4fs_stats.match(ext4fs_output.strip().split('\n')[-1])
+ used_blocks = int(m.groupdict().get('used_blocks'))
+ total_blocks = int(m.groupdict().get('total_blocks'))
+ reserved_blocks = min(4096, int(total_blocks * 0.02))
+ adjusted_blocks = total_blocks - reserved_blocks
+ if used_blocks > adjusted_blocks:
+ mount_point = prop_dict.get("mount_point")
+ print("Error: Not enough room on %s (total: %d blocks, used: %d blocks, "
+ "reserved: %d blocks, available: %d blocks)" % (
+ mount_point, total_blocks, used_blocks, reserved_blocks,
+ adjusted_blocks))
+ return False
+
if not fs_spans_partition:
mount_point = prop_dict.get("mount_point")
partition_size = int(prop_dict.get("partition_size"))
image_size = os.stat(out_file).st_size
if image_size > partition_size:
- print "Error: %s image size of %d is larger than partition size of %d" % (mount_point, image_size, partition_size)
- return False
+ print("Error: %s image size of %d is larger than partition size of "
+ "%d" % (mount_point, image_size, partition_size))
+ return False
if verity_supported and is_verity_partition:
- if 2 * image_size - AdjustPartitionSizeForVerity(image_size) > partition_size:
- print "Error: No more room on %s to fit verity data" % mount_point
- return False
+ if 2 * image_size - AdjustPartitionSizeForVerity(image_size, verity_fec_supported) > partition_size:
+ print "Error: No more room on %s to fit verity data" % mount_point
+ return False
prop_dict["original_partition_size"] = prop_dict["partition_size"]
prop_dict["partition_size"] = str(image_size)
# create the verified image if this is to be verified
if verity_supported and is_verity_partition:
- if not MakeVerityEnabledImage(out_file, prop_dict):
+ if not MakeVerityEnabledImage(out_file, verity_fec_supported, prop_dict):
return False
if run_fsck and prop_dict.get("skip_fsck") != "true":
@@ -330,7 +464,7 @@
# Run e2fsck on the inflated image file
e2fsck_command = ["e2fsck", "-f", "-n", unsparse_image]
- exit_code = RunCommand(e2fsck_command)
+ (_, exit_code) = RunCommand(e2fsck_command)
os.remove(unsparse_image)
@@ -345,6 +479,7 @@
mount_point: such as "system", "data" etc.
"""
d = {}
+
if "build.prop" in glob_dict:
bp = glob_dict["build.prop"]
if "ro.build.date.utc" in bp:
@@ -356,12 +491,14 @@
common_props = (
"extfs_sparse_flag",
+ "squashfs_sparse_flag",
"mkyaffs2_extra_flags",
"selinux_fc",
"skip_fsck",
"verity",
"verity_key",
- "verity_signer_cmd"
+ "verity_signer_cmd",
+ "verity_fec"
)
for p in common_props:
copy_prop(p, p)
@@ -377,6 +514,10 @@
copy_prop("system_verity_block_device", "verity_block_device")
copy_prop("system_root_image", "system_root_image")
copy_prop("ramdisk_dir", "ramdisk_dir")
+ copy_prop("ramdisk_fs_config", "ramdisk_fs_config")
+ copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
+ copy_prop("system_squashfs_compressor", "squashfs_compressor")
+ copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")
elif mount_point == "data":
# Copy the generic fs type first, override with specific one if available.
copy_prop("fs_type", "fs_type")
@@ -390,10 +531,12 @@
copy_prop("vendor_size", "partition_size")
copy_prop("vendor_journal_size", "journal_size")
copy_prop("vendor_verity_block_device", "verity_block_device")
+ copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
elif mount_point == "oem":
copy_prop("fs_type", "fs_type")
copy_prop("oem_size", "partition_size")
copy_prop("oem_journal_size", "journal_size")
+ copy_prop("has_ext4_reserved_blocks", "has_ext4_reserved_blocks")
return d
@@ -413,33 +556,40 @@
def main(argv):
- if len(argv) != 3:
+ if len(argv) != 4:
print __doc__
sys.exit(1)
in_dir = argv[0]
glob_dict_file = argv[1]
out_file = argv[2]
+ target_out = argv[3]
glob_dict = LoadGlobalDict(glob_dict_file)
- image_filename = os.path.basename(out_file)
- mount_point = ""
- if image_filename == "system.img":
- mount_point = "system"
- elif image_filename == "userdata.img":
- mount_point = "data"
- elif image_filename == "cache.img":
- mount_point = "cache"
- elif image_filename == "vendor.img":
- mount_point = "vendor"
- elif image_filename == "oem.img":
- mount_point = "oem"
+ if "mount_point" in glob_dict:
+ # The caller knows the mount point and provides a dictionay needed by
+ # BuildImage().
+ image_properties = glob_dict
else:
- print >> sys.stderr, "error: unknown image file name ", image_filename
- exit(1)
+ image_filename = os.path.basename(out_file)
+ mount_point = ""
+ if image_filename == "system.img":
+ mount_point = "system"
+ elif image_filename == "userdata.img":
+ mount_point = "data"
+ elif image_filename == "cache.img":
+ mount_point = "cache"
+ elif image_filename == "vendor.img":
+ mount_point = "vendor"
+ elif image_filename == "oem.img":
+ mount_point = "oem"
+ else:
+ print >> sys.stderr, "error: unknown image file name ", image_filename
+ exit(1)
- image_properties = ImagePropFromGlobalDict(glob_dict, mount_point)
- if not BuildImage(in_dir, image_properties, out_file):
+ image_properties = ImagePropFromGlobalDict(glob_dict, mount_point)
+
+ if not BuildImage(in_dir, image_properties, out_file, target_out):
print >> sys.stderr, "error: failed to build %s from %s" % (out_file,
in_dir)
exit(1)
diff --git a/tools/releasetools/check_target_files_signatures.py b/tools/releasetools/check_target_files_signatures.py
index dd57033..5c541ab 100755
--- a/tools/releasetools/check_target_files_signatures.py
+++ b/tools/releasetools/check_target_files_signatures.py
@@ -331,7 +331,7 @@
by_certpair = {}
- for i in all:
+ for i in all_apks:
if i in self.apks:
if i in other.apks:
# in both; should have same set of certs
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 227dcb8..95aeb62 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -44,17 +44,28 @@
self.search_path = platform_search_path.get(sys.platform, None)
self.signapk_path = "framework/signapk.jar" # Relative to search_path
+ self.signapk_shared_library_path = "lib64" # Relative to search_path
self.extra_signapk_args = []
self.java_path = "java" # Use the one on the path by default.
self.java_args = "-Xmx2048m" # JVM Args
self.public_key_suffix = ".x509.pem"
self.private_key_suffix = ".pk8"
+ # use otatools built boot_signer by default
+ self.boot_signer_path = "boot_signer"
+ self.boot_signer_args = []
+ self.verity_signer_path = None
+ self.verity_signer_args = []
self.verbose = False
self.tempfiles = []
self.device_specific = None
self.extras = {}
self.info_dict = None
+ self.source_info_dict = None
+ self.target_info_dict = None
self.worker_threads = None
+ # Stash size cannot exceed cache_size * threshold.
+ self.cache_size = None
+ self.stash_threshold = 0.8
OPTIONS = Options()
@@ -92,7 +103,7 @@
pass
-def LoadInfoDict(input_file):
+def LoadInfoDict(input_file, input_dir=None):
"""Read and parse the META/misc_info.txt key/value pairs from the
input target files and return a dict."""
@@ -143,6 +154,35 @@
if "fstab_version" not in d:
d["fstab_version"] = "1"
+ # A few properties are stored as links to the files in the out/ directory.
+ # It works fine with the build system. However, they are no longer available
+ # when (re)generating from target_files zip. If input_dir is not None, we
+ # are doing repacking. Redirect those properties to the actual files in the
+ # unzipped directory.
+ if input_dir is not None:
+ # We carry a copy of file_contexts.bin under META/. If not available,
+ # search BOOT/RAMDISK/. Note that sometimes we may need a different file
+ # to build images than the one running on device, such as when enabling
+ # system_root_image. In that case, we must have the one for image
+ # generation copied to META/.
+ fc_basename = os.path.basename(d.get("selinux_fc", "file_contexts"))
+ fc_config = os.path.join(input_dir, "META", fc_basename)
+ if d.get("system_root_image") == "true":
+ assert os.path.exists(fc_config)
+ if not os.path.exists(fc_config):
+ fc_config = os.path.join(input_dir, "BOOT", "RAMDISK", fc_basename)
+ if not os.path.exists(fc_config):
+ fc_config = None
+
+ if fc_config:
+ d["selinux_fc"] = fc_config
+
+ # Similarly we need to redirect "ramdisk_dir" and "ramdisk_fs_config".
+ if d.get("system_root_image") == "true":
+ d["ramdisk_dir"] = os.path.join(input_dir, "ROOT")
+ d["ramdisk_fs_config"] = os.path.join(
+ input_dir, "META", "root_filesystem_config.txt")
+
try:
data = read_helper("META/imagesizes.txt")
for line in data.split("\n"):
@@ -172,7 +212,11 @@
makeint("boot_size")
makeint("fstab_version")
- d["fstab"] = LoadRecoveryFSTab(read_helper, d["fstab_version"])
+ if d.get("no_recovery", False) == "true":
+ d["fstab"] = None
+ else:
+ d["fstab"] = LoadRecoveryFSTab(read_helper, d["fstab_version"],
+ d.get("system_root_image", False))
d["build.prop"] = LoadBuildProp(read_helper)
return d
@@ -195,14 +239,15 @@
d[name] = value
return d
-def LoadRecoveryFSTab(read_helper, fstab_version):
+def LoadRecoveryFSTab(read_helper, fstab_version, system_root_image=False):
class Partition(object):
- def __init__(self, mount_point, fs_type, device, length, device2):
+ def __init__(self, mount_point, fs_type, device, length, device2, context):
self.mount_point = mount_point
self.fs_type = fs_type
self.device = device
self.length = length
self.device2 = device2
+ self.context = context
try:
data = read_helper("RECOVERY/RAMDISK/etc/recovery.fstab")
@@ -251,6 +296,7 @@
line = line.strip()
if not line or line.startswith("#"):
continue
+ # <src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
pieces = line.split()
if len(pieces) != 5:
raise ValueError("malformed recovery.fstab line: \"%s\"" % (line,))
@@ -270,13 +316,27 @@
# Ignore all unknown options in the unified fstab
continue
+ mount_flags = pieces[3]
+ # Honor the SELinux context if present.
+ context = None
+ for i in mount_flags.split(","):
+ if i.startswith("context="):
+ context = i
+
mount_point = pieces[1]
d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2],
- device=pieces[0], length=length, device2=None)
+ device=pieces[0], length=length,
+ device2=None, context=context)
else:
raise ValueError("Unknown fstab_version: \"%d\"" % (fstab_version,))
+ # / is used for the system mount point when the root directory is included in
+ # system. Other areas assume system is always at "/system" so point /system
+ # at /.
+ if system_root_image:
+ assert not d.has_key("/system") and d.has_key("/")
+ d["/system"] = d["/"]
return d
@@ -285,34 +345,46 @@
print "%-25s = (%s) %s" % (k, type(v).__name__, v)
-def BuildBootableImage(sourcedir, fs_config_file, info_dict=None):
- """Take a kernel, cmdline, and ramdisk directory from the input (in
- 'sourcedir'), and turn them into a boot image. Return the image
- data, or None if sourcedir does not appear to contains files for
- building the requested image."""
+def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
+ has_ramdisk=False):
+ """Build a bootable image from the specified sourcedir.
- if (not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK) or
- not os.access(os.path.join(sourcedir, "kernel"), os.F_OK)):
+ Take a kernel, cmdline, and optionally a ramdisk directory from the input (in
+ 'sourcedir'), and turn them into a boot image. Return the image data, or
+ None if sourcedir does not appear to contains files for building the
+ requested image."""
+
+ def make_ramdisk():
+ ramdisk_img = tempfile.NamedTemporaryFile()
+
+ if os.access(fs_config_file, os.F_OK):
+ cmd = ["mkbootfs", "-f", fs_config_file,
+ os.path.join(sourcedir, "RAMDISK")]
+ else:
+ cmd = ["mkbootfs", os.path.join(sourcedir, "RAMDISK")]
+ p1 = Run(cmd, stdout=subprocess.PIPE)
+ p2 = Run(["minigzip"], stdin=p1.stdout, stdout=ramdisk_img.file.fileno())
+
+ p2.wait()
+ p1.wait()
+ assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (sourcedir,)
+ assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (sourcedir,)
+
+ return ramdisk_img
+
+ if not os.access(os.path.join(sourcedir, "kernel"), os.F_OK):
+ return None
+
+ if has_ramdisk and not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK):
return None
if info_dict is None:
info_dict = OPTIONS.info_dict
- ramdisk_img = tempfile.NamedTemporaryFile()
img = tempfile.NamedTemporaryFile()
- if os.access(fs_config_file, os.F_OK):
- cmd = ["mkbootfs", "-f", fs_config_file, os.path.join(sourcedir, "RAMDISK")]
- else:
- cmd = ["mkbootfs", os.path.join(sourcedir, "RAMDISK")]
- p1 = Run(cmd, stdout=subprocess.PIPE)
- p2 = Run(["minigzip"],
- stdin=p1.stdout, stdout=ramdisk_img.file.fileno())
-
- p2.wait()
- p1.wait()
- assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (sourcedir,)
- assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (sourcedir,)
+ if has_ramdisk:
+ ramdisk_img = make_ramdisk()
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
@@ -343,24 +415,29 @@
if args and args.strip():
cmd.extend(shlex.split(args))
+ if has_ramdisk:
+ cmd.extend(["--ramdisk", ramdisk_img.name])
+
img_unsigned = None
if info_dict.get("vboot", None):
img_unsigned = tempfile.NamedTemporaryFile()
- cmd.extend(["--ramdisk", ramdisk_img.name,
- "--output", img_unsigned.name])
+ cmd.extend(["--output", img_unsigned.name])
else:
- cmd.extend(["--ramdisk", ramdisk_img.name,
- "--output", img.name])
+ cmd.extend(["--output", img.name])
p = Run(cmd, stdout=subprocess.PIPE)
p.communicate()
assert p.returncode == 0, "mkbootimg of %s image failed" % (
os.path.basename(sourcedir),)
- if info_dict.get("verity_key", None):
+ if (info_dict.get("boot_signer", None) == "true" and
+ info_dict.get("verity_key", None)):
path = "/" + os.path.basename(sourcedir).lower()
- cmd = ["boot_signer", path, img.name, info_dict["verity_key"] + ".pk8",
- info_dict["verity_key"] + ".x509.pem", img.name]
+ cmd = [OPTIONS.boot_signer_path]
+ cmd.extend(OPTIONS.boot_signer_args)
+ cmd.extend([path, img.name,
+ info_dict["verity_key"] + ".pk8",
+ info_dict["verity_key"] + ".x509.pem", img.name])
p = Run(cmd, stdout=subprocess.PIPE)
p.communicate()
assert p.returncode == 0, "boot_signer of %s image failed" % path
@@ -371,7 +448,9 @@
img_keyblock = tempfile.NamedTemporaryFile()
cmd = [info_dict["vboot_signer_cmd"], info_dict["futility"],
img_unsigned.name, info_dict["vboot_key"] + ".vbpubk",
- info_dict["vboot_key"] + ".vbprivk", img_keyblock.name,
+ info_dict["vboot_key"] + ".vbprivk",
+ info_dict["vboot_subkey"] + ".vbprivk",
+ img_keyblock.name,
img.name]
p = Run(cmd, stdout=subprocess.PIPE)
p.communicate()
@@ -384,7 +463,8 @@
img.seek(os.SEEK_SET, 0)
data = img.read()
- ramdisk_img.close()
+ if has_ramdisk:
+ ramdisk_img.close()
img.close()
return data
@@ -392,11 +472,11 @@
def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
info_dict=None):
- """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 look for it under 'unpack_dir'/IMAGES,
- otherwise construct it from the source files in
- 'unpack_dir'/'tree_subdir'."""
+ """Return a File object with the desired bootable image.
+
+ Look for it in 'unpack_dir'/BOOTABLE_IMAGES under the name 'prebuilt_name',
+ otherwise look for it under 'unpack_dir'/IMAGES, otherwise construct it from
+ the source files in 'unpack_dir'/'tree_subdir'."""
prebuilt_path = os.path.join(unpack_dir, "BOOTABLE_IMAGES", prebuilt_name)
if os.path.exists(prebuilt_path):
@@ -409,10 +489,21 @@
return File.FromLocalFile(name, prebuilt_path)
print "building image from target_files %s..." % (tree_subdir,)
+
+ if info_dict is None:
+ info_dict = OPTIONS.info_dict
+
+ # With system_root_image == "true", we don't pack ramdisk into the boot image.
+ # Unless "recovery_as_boot" is specified, in which case we carry the ramdisk
+ # for recovery.
+ has_ramdisk = (info_dict.get("system_root_image") != "true" or
+ prebuilt_name != "boot.img" or
+ info_dict.get("recovery_as_boot") == "true")
+
fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
- data = BuildBootableImage(os.path.join(unpack_dir, tree_subdir),
- os.path.join(unpack_dir, fs_config),
- info_dict)
+ data = _BuildBootableImage(os.path.join(unpack_dir, tree_subdir),
+ os.path.join(unpack_dir, fs_config),
+ info_dict, has_ramdisk)
if data:
return File(name, data)
return None
@@ -501,37 +592,29 @@
return key_passwords
-def SignFile(input_name, output_name, key, password, align=None,
- whole_file=False):
+def SignFile(input_name, output_name, key, password, whole_file=False):
"""Sign the input_name zip/jar/apk, producing output_name. Use the
given key and password (the latter may be None if the key does not
have a password.
- If align is an integer > 1, zipalign is run to align stored files in
- the output zip on 'align'-byte boundaries.
-
If whole_file is true, use the "-w" option to SignApk to embed a
signature that covers the whole file in the archive comment of the
zip file.
"""
- if align == 0 or align == 1:
- align = None
+ java_library_path = os.path.join(
+ OPTIONS.search_path, OPTIONS.signapk_shared_library_path)
- if align:
- temp = tempfile.NamedTemporaryFile()
- sign_name = temp.name
- else:
- sign_name = output_name
-
- cmd = [OPTIONS.java_path, OPTIONS.java_args, "-jar",
+ cmd = [OPTIONS.java_path, OPTIONS.java_args,
+ "-Djava.library.path=" + java_library_path,
+ "-jar",
os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)]
cmd.extend(OPTIONS.extra_signapk_args)
if whole_file:
cmd.append("-w")
cmd.extend([key + OPTIONS.public_key_suffix,
key + OPTIONS.private_key_suffix,
- input_name, sign_name])
+ input_name, output_name])
p = Run(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
if password is not None:
@@ -540,13 +623,6 @@
if p.returncode != 0:
raise ExternalError("signapk.jar failed: return code %s" % (p.returncode,))
- if align:
- p = Run(["zipalign", "-f", str(align), sign_name, output_name])
- p.communicate()
- if p.returncode != 0:
- raise ExternalError("zipalign failed: return code %s" % (p.returncode,))
- temp.close()
-
def CheckSize(data, target, info_dict):
"""Check the data string passed against the max size limit, if
@@ -651,9 +727,12 @@
try:
opts, args = getopt.getopt(
argv, "hvp:s:x:" + extra_opts,
- ["help", "verbose", "path=", "signapk_path=", "extra_signapk_args=",
+ ["help", "verbose", "path=", "signapk_path=",
+ "signapk_shared_library_path=", "extra_signapk_args=",
"java_path=", "java_args=", "public_key_suffix=",
- "private_key_suffix=", "device_specific=", "extra="] +
+ "private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
+ "verity_signer_path=", "verity_signer_args=", "device_specific=",
+ "extra="] +
list(extra_long_opts))
except getopt.GetoptError as err:
Usage(docstring)
@@ -670,6 +749,8 @@
OPTIONS.search_path = a
elif o in ("--signapk_path",):
OPTIONS.signapk_path = a
+ elif o in ("--signapk_shared_library_path",):
+ OPTIONS.signapk_shared_library_path = a
elif o in ("--extra_signapk_args",):
OPTIONS.extra_signapk_args = shlex.split(a)
elif o in ("--java_path",):
@@ -680,6 +761,14 @@
OPTIONS.public_key_suffix = a
elif o in ("--private_key_suffix",):
OPTIONS.private_key_suffix = a
+ elif o in ("--boot_signer_path",):
+ OPTIONS.boot_signer_path = a
+ elif o in ("--boot_signer_args",):
+ OPTIONS.boot_signer_args = shlex.split(a)
+ elif o in ("--verity_signer_path",):
+ OPTIONS.verity_signer_path = a
+ elif o in ("--verity_signer_args",):
+ OPTIONS.verity_signer_args = shlex.split(a)
elif o in ("-s", "--device_specific"):
OPTIONS.device_specific = a
elif o in ("-x", "--extra"):
@@ -855,7 +944,7 @@
zipfile.ZIP64_LIMIT = saved_zip64_limit
-def ZipWriteStr(zip_file, zinfo_or_arcname, data, perms=0o644,
+def ZipWriteStr(zip_file, zinfo_or_arcname, data, perms=None,
compress_type=None):
"""Wrap zipfile.writestr() function to work around the zip64 limit.
@@ -874,6 +963,8 @@
if not isinstance(zinfo_or_arcname, zipfile.ZipInfo):
zinfo = zipfile.ZipInfo(filename=zinfo_or_arcname)
zinfo.compress_type = zip_file.compression
+ if perms is None:
+ perms = 0o100644
else:
zinfo = zinfo_or_arcname
@@ -881,8 +972,14 @@
if compress_type is not None:
zinfo.compress_type = compress_type
+ # If perms is given, it has a priority.
+ if perms is not None:
+ # If perms doesn't set the file type, mark it as a regular file.
+ if perms & 0o770000 == 0:
+ perms |= 0o100000
+ zinfo.external_attr = perms << 16
+
# Use a fixed timestamp so the output is repeatable.
- zinfo.external_attr = perms << 16
zinfo.date_time = (2009, 1, 1, 0, 0, 0)
zip_file.writestr(zinfo, data)
@@ -983,6 +1080,9 @@
processor."""
return self._DoCall("IncrementalOTA_InstallEnd")
+ def VerifyOTA_Assertions(self):
+ return self._DoCall("VerifyOTA_Assertions")
+
class File(object):
def __init__(self, name, data):
self.name = name
@@ -1156,7 +1256,11 @@
self.path = os.path.join(tmpdir, partition)
b.Compute(self.path)
- _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
+ if src is None:
+ _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
+ else:
+ _, self.device = GetTypeAndDevice("/" + partition,
+ OPTIONS.source_info_dict)
def WriteScript(self, script, output_zip, progress=None):
if not self.src:
@@ -1168,43 +1272,115 @@
if progress:
script.ShowProgress(progress, 0)
self._WriteUpdate(script, output_zip)
+ self._WritePostInstallVerifyScript(script)
+
+ def WriteStrictVerifyScript(self, script):
+ """Verify all the blocks in the care_map, including clobbered blocks.
+
+ This differs from the WriteVerifyScript() function: a) it prints different
+ error messages; b) it doesn't allow half-way updated images to pass the
+ verification."""
+
+ partition = self.partition
+ script.Print("Verifying %s..." % (partition,))
+ ranges = self.tgt.care_map
+ ranges_str = ranges.to_string_raw()
+ script.AppendExtra('range_sha1("%s", "%s") == "%s" && '
+ 'ui_print(" Verified.") || '
+ 'ui_print("\\"%s\\" has unexpected contents.");' % (
+ self.device, ranges_str,
+ self.tgt.TotalSha1(include_clobbered_blocks=True),
+ self.device))
+ script.AppendExtra("")
def WriteVerifyScript(self, script):
partition = self.partition
if not self.src:
script.Print("Image %s will be patched unconditionally." % (partition,))
else:
- if self.version >= 3:
+ ranges = self.src.care_map.subtract(self.src.clobbered_blocks)
+ ranges_str = ranges.to_string_raw()
+ if self.version >= 4:
script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '
'block_image_verify("%s", '
'package_extract_file("%s.transfer.list"), '
'"%s.new.dat", "%s.patch.dat")) then') % (
- self.device, self.src.care_map.to_string_raw(),
- self.src.TotalSha1(),
+ self.device, ranges_str, self.src.TotalSha1(),
+ self.device, partition, partition, partition))
+ elif self.version == 3:
+ script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '
+ 'block_image_verify("%s", '
+ 'package_extract_file("%s.transfer.list"), '
+ '"%s.new.dat", "%s.patch.dat")) then') % (
+ self.device, ranges_str, self.src.TotalSha1(),
self.device, partition, partition, partition))
else:
script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' % (
- self.device, self.src.care_map.to_string_raw(),
- self.src.TotalSha1()))
+ self.device, ranges_str, self.src.TotalSha1()))
script.Print('Verified %s image...' % (partition,))
script.AppendExtra('else')
- # When generating incrementals for the system and vendor partitions,
- # explicitly check the first block (which contains the superblock) of
- # the partition to see if it's what we expect. If this check fails,
- # give an explicit log message about the partition having been
- # remounted R/W (the most likely explanation) and the need to flash to
- # get OTAs working again.
- if self.check_first_block:
- self._CheckFirstBlock(script)
+ if self.version >= 4:
+
+ # Bug: 21124327
+ # When generating incrementals for the system and vendor partitions in
+ # version 4 or newer, explicitly check the first block (which contains
+ # the superblock) of the partition to see if it's what we expect. If
+ # this check fails, give an explicit log message about the partition
+ # having been remounted R/W (the most likely explanation).
+ if self.check_first_block:
+ script.AppendExtra('check_first_block("%s");' % (self.device,))
+
+ # If version >= 4, try block recovery before abort update
+ script.AppendExtra((
+ 'ifelse (block_image_recover("{device}", "{ranges}") && '
+ 'block_image_verify("{device}", '
+ 'package_extract_file("{partition}.transfer.list"), '
+ '"{partition}.new.dat", "{partition}.patch.dat"), '
+ 'ui_print("{partition} recovered successfully."), '
+ 'abort("{partition} partition fails to recover"));\n'
+ 'endif;').format(device=self.device, ranges=ranges_str,
+ partition=partition))
# Abort the OTA update. Note that the incremental OTA cannot be applied
# even if it may match the checksum of the target partition.
# a) If version < 3, operations like move and erase will make changes
# unconditionally and damage the partition.
# b) If version >= 3, it won't even reach here.
- script.AppendExtra(('abort("%s partition has unexpected contents");\n'
- 'endif;') % (partition,))
+ else:
+ script.AppendExtra(('abort("%s partition has unexpected contents");\n'
+ 'endif;') % (partition,))
+
+ def _WritePostInstallVerifyScript(self, script):
+ partition = self.partition
+ script.Print('Verifying the updated %s image...' % (partition,))
+ # Unlike pre-install verification, clobbered_blocks should not be ignored.
+ ranges = self.tgt.care_map
+ ranges_str = ranges.to_string_raw()
+ script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' % (
+ self.device, ranges_str,
+ self.tgt.TotalSha1(include_clobbered_blocks=True)))
+
+ # Bug: 20881595
+ # Verify that extended blocks are really zeroed out.
+ if self.tgt.extended:
+ ranges_str = self.tgt.extended.to_string_raw()
+ script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' % (
+ self.device, ranges_str,
+ self._HashZeroBlocks(self.tgt.extended.size())))
+ script.Print('Verified the updated %s image.' % (partition,))
+ script.AppendExtra(
+ 'else\n'
+ ' abort("%s partition has unexpected non-zero contents after OTA '
+ 'update");\n'
+ 'endif;' % (partition,))
+ else:
+ script.Print('Verified the updated %s image.' % (partition,))
+
+ script.AppendExtra(
+ 'else\n'
+ ' abort("%s partition has unexpected contents after OTA update");\n'
+ 'endif;' % (partition,))
def _WriteUpdate(self, script, output_zip):
ZipWrite(output_zip,
@@ -1233,19 +1409,18 @@
return ctx.hexdigest()
- def _CheckFirstBlock(self, script):
- r = rangelib.RangeSet((0, 1))
- srchash = self._HashBlocks(self.src, r)
+ def _HashZeroBlocks(self, num_blocks): # pylint: disable=no-self-use
+ """Return the hash value for all zero blocks."""
+ zero_block = '\x00' * 4096
+ ctx = sha1()
+ for _ in range(num_blocks):
+ ctx.update(zero_block)
- script.AppendExtra(('(range_sha1("%s", "%s") == "%s") || '
- 'abort("%s has been remounted R/W; '
- 'reflash device to reenable OTA updates");')
- % (self.device, r.to_string_raw(), srchash,
- self.device))
+ return ctx.hexdigest()
+
DataImage = blockimgdiff.DataImage
-
# map recovery.fstab's fs_types to mount/format "partition types"
PARTITION_TYPES = {
"yaffs2": "MTD",
@@ -1296,26 +1471,47 @@
if info_dict is None:
info_dict = OPTIONS.info_dict
- diff_program = ["imgdiff"]
- path = os.path.join(input_dir, "SYSTEM", "etc", "recovery-resource.dat")
- if os.path.exists(path):
- diff_program.append("-b")
- diff_program.append(path)
- bonus_args = "-b /system/etc/recovery-resource.dat"
- else:
- bonus_args = ""
+ full_recovery_image = info_dict.get("full_recovery_image", None) == "true"
+ system_root_image = info_dict.get("system_root_image", None) == "true"
- d = Difference(recovery_img, boot_img, diff_program=diff_program)
- _, _, patch = d.ComputePatch()
- output_sink("recovery-from-boot.p", patch)
+ if full_recovery_image:
+ output_sink("etc/recovery.img", recovery_img.data)
+
+ else:
+ diff_program = ["imgdiff"]
+ path = os.path.join(input_dir, "SYSTEM", "etc", "recovery-resource.dat")
+ if os.path.exists(path):
+ diff_program.append("-b")
+ diff_program.append(path)
+ bonus_args = "-b /system/etc/recovery-resource.dat"
+ else:
+ bonus_args = ""
+
+ d = Difference(recovery_img, boot_img, diff_program=diff_program)
+ _, _, patch = d.ComputePatch()
+ output_sink("recovery-from-boot.p", patch)
try:
+ # The following GetTypeAndDevice()s need to use the path in the target
+ # info_dict instead of source_info_dict.
boot_type, boot_device = GetTypeAndDevice("/boot", info_dict)
recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict)
except KeyError:
return
- sh = """#!/system/bin/sh
+ if full_recovery_image:
+ sh = """#!/system/bin/sh
+if ! applypatch -c %(type)s:%(device)s:%(size)d:%(sha1)s; then
+ applypatch /system/etc/recovery.img %(type)s:%(device)s %(sha1)s %(size)d && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed"
+else
+ log -t recovery "Recovery image already installed"
+fi
+""" % {'type': recovery_type,
+ 'device': recovery_device,
+ 'sha1': recovery_img.sha1,
+ 'size': recovery_img.size}
+ else:
+ sh = """#!/system/bin/sh
if ! applypatch -c %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then
applypatch %(bonus_args)s %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s %(recovery_type)s:%(recovery_device)s %(recovery_sha1)s %(recovery_size)d %(boot_sha1)s:/system/recovery-from-boot.p && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed"
else
@@ -1332,18 +1528,31 @@
'bonus_args': bonus_args}
# The install script location moved from /system/etc to /system/bin
- # in the L release. Parse the init.rc file to find out where the
+ # in the L release. Parse init.*.rc files to find out where the
# target-files expects it to be, and put it there.
sh_location = "etc/install-recovery.sh"
- try:
- with open(os.path.join(input_dir, "BOOT", "RAMDISK", "init.rc")) as f:
+ found = False
+ if system_root_image:
+ init_rc_dir = os.path.join(input_dir, "ROOT")
+ else:
+ init_rc_dir = os.path.join(input_dir, "BOOT", "RAMDISK")
+ init_rc_files = os.listdir(init_rc_dir)
+ for init_rc_file in init_rc_files:
+ if (not init_rc_file.startswith('init.') or
+ not init_rc_file.endswith('.rc')):
+ continue
+
+ with open(os.path.join(init_rc_dir, init_rc_file)) as f:
for line in f:
m = re.match(r"^service flash_recovery /system/(\S+)\s*$", line)
if m:
sh_location = m.group(1)
- print "putting script in", sh_location
+ found = True
break
- except (OSError, IOError) as e:
- print "failed to read init.rc: %s" % (e,)
+
+ if found:
+ break
+
+ print "putting script in", sh_location
output_sink(sh_location, sh)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 3d0da88..d923cc8 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -20,11 +20,15 @@
"""Class to generate scripts in the 'edify' recovery script language
used from donut onwards."""
- def __init__(self, version, info):
+ def __init__(self, version, info, fstab=None):
self.script = []
self.mounts = set()
self.version = version
self.info = info
+ if fstab is None:
+ self.fstab = self.info.get("fstab", None)
+ else:
+ self.fstab = fstab
def MakeTemporary(self):
"""Make a temporary script object whose commands can latter be
@@ -148,6 +152,15 @@
"".join([', "%s"' % (i,) for i in sha1]) +
') || abort("\\"%s\\" has unexpected contents.");' % (filename,))
+ def Verify(self, filename):
+ """Check that the given file (or MTD reference) has one of the
+ given hashes (encoded in the filename)."""
+ self.script.append(
+ 'apply_patch_check("{filename}") && '
+ 'ui_print(" Verified.") || '
+ 'ui_print("\\"{filename}\\" has unexpected contents.");'.format(
+ filename=filename))
+
def FileCheck(self, filename, *sha1):
"""Check that the given file (or MTD reference) has one of the
given *sha1 hashes."""
@@ -159,7 +172,7 @@
"""Check that there's at least 'amount' space that can be made
available on /cache."""
self.script.append(('apply_patch_space(%d) || abort("Not enough free space '
- 'on /system to apply patches.");') % (amount,))
+ 'on /cache to apply patches.");') % (amount,))
def Mount(self, mount_point, mount_options_by_format=""):
"""Mount the partition with the given mount_point.
@@ -168,7 +181,7 @@
where option is optname[=optvalue]
E.g. ext4=barrier=1,nodelalloc,errors=panic|f2fs=errors=recover
"""
- fstab = self.info.get("fstab", None)
+ fstab = self.fstab
if fstab:
p = fstab[mount_point]
mount_dict = {}
@@ -177,9 +190,12 @@
if "=" in option:
key, value = option.split("=", 1)
mount_dict[key] = value
+ mount_flags = mount_dict.get(p.fs_type, "")
+ if p.context is not None:
+ mount_flags = p.context + ("," + mount_flags if mount_flags else "")
self.script.append('mount("%s", "%s", "%s", "%s", "%s");' % (
p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device,
- p.mount_point, mount_dict.get(p.fs_type, "")))
+ p.mount_point, mount_flags))
self.mounts.add(p.mount_point)
def UnpackPackageDir(self, src, dst):
@@ -199,7 +215,7 @@
self.script.append('ui_print("%s");' % (message,))
def TunePartition(self, partition, *options):
- fstab = self.info.get("fstab", None)
+ fstab = self.fstab
if fstab:
p = fstab[partition]
if p.fs_type not in ("ext2", "ext3", "ext4"):
@@ -213,7 +229,7 @@
"""Format the given partition, specified by its mount point (eg,
"/system")."""
- fstab = self.info.get("fstab", None)
+ fstab = self.fstab
if fstab:
p = fstab[partition]
self.script.append('format("%s", "%s", "%s", "%s", "%s");' %
@@ -223,7 +239,7 @@
def WipeBlockDevice(self, partition):
if partition not in ("/system", "/vendor"):
raise ValueError(("WipeBlockDevice doesn't work on %s\n") % (partition,))
- fstab = self.info.get("fstab", None)
+ fstab = self.fstab
size = self.info.get(partition.lstrip("/") + "_size", None)
device = fstab[partition].device
@@ -236,6 +252,15 @@
cmd = "delete(" + ",\0".join(['"%s"' % (i,) for i in file_list]) + ");"
self.script.append(self.WordWrap(cmd))
+ def DeleteFilesIfNotMatching(self, file_list):
+ """Delete the file in file_list if not matching the checksum."""
+ if not file_list:
+ return
+ for name, sha1 in file_list:
+ cmd = ('sha1_check(read_file("{name}"), "{sha1}") || '
+ 'delete("{name}");'.format(name=name, sha1=sha1))
+ self.script.append(self.WordWrap(cmd))
+
def RenameFile(self, srcfile, tgtfile):
"""Moves a file from one location to another."""
if self.info.get("update_rename_support", False):
@@ -247,7 +272,7 @@
"""Prepend an action with an apply_patch_check in order to
skip the action if the file exists. Used when a patch
is later renamed."""
- cmd = ('sha1_check(read_file("%s"), %s) || ' % (tgtfile, tgtsha1))
+ cmd = ('sha1_check(read_file("%s"), %s) ||' % (tgtfile, tgtsha1))
self.script.append(self.WordWrap(cmd))
def ApplyPatch(self, srcfile, tgtfile, tgtsize, tgtsha1, *patchpairs):
@@ -259,8 +284,8 @@
cmd = ['apply_patch("%s",\0"%s",\0%s,\0%d'
% (srcfile, tgtfile, tgtsha1, tgtsize)]
for i in range(0, len(patchpairs), 2):
- cmd.append(',\0%s, package_extract_file("%s")' % patchpairs[i:i+2])
- cmd.append(');')
+ cmd.append(',\0%s,\0package_extract_file("%s")' % patchpairs[i:i+2])
+ cmd.append(') ||\n abort("Failed to apply patch to %s");' % (srcfile,))
cmd = "".join(cmd)
self.script.append(self.WordWrap(cmd))
@@ -268,7 +293,7 @@
"""Write the given package file into the partition for the given
mount point."""
- fstab = self.info["fstab"]
+ fstab = self.fstab
if fstab:
p = fstab[mount_point]
partition_type = common.PARTITION_TYPES[p.fs_type]
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index c486992..aa21d7e 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -95,25 +95,18 @@
# images, so build them.
import add_img_to_target_files
- OPTIONS.info_dict = common.LoadInfoDict(input_zip)
-
- # If this image was originally labelled with SELinux contexts,
- # make sure we also apply the labels in our new image. During
- # building, the "file_contexts" is in the out/ directory tree,
- # but for repacking from target-files.zip it's in the root
- # directory of the ramdisk.
- if "selinux_fc" in OPTIONS.info_dict:
- OPTIONS.info_dict["selinux_fc"] = os.path.join(
- OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts")
+ OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.input_tmp)
boot_image = common.GetBootableImage(
"boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
if boot_image:
boot_image.AddToZip(output_zip)
- recovery_image = common.GetBootableImage(
- "recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
- if recovery_image:
- recovery_image.AddToZip(output_zip)
+
+ if OPTIONS.info_dict.get("no_recovery") != "true":
+ recovery_image = common.GetBootableImage(
+ "recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
+ if recovery_image:
+ recovery_image.AddToZip(output_zip)
def banner(s):
print "\n\n++++ " + s + " ++++\n\n"
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 900eaec..a567760 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -42,6 +42,10 @@
radio image. This option is only meaningful when -i is specified,
because a full radio is always included in a full OTA if applicable.
+ --full_bootloader
+ Similar to --full_radio. When generating an incremental OTA, always
+ include a full copy of bootloader image.
+
-v (--verify)
Remount and verify the checksums of the files written to the
system and vendor (if used) partitions. Incremental builds only.
@@ -84,6 +88,17 @@
Specifies the number of worker-threads that will be used when
generating patches for incremental updates (defaults to 3).
+ --stash_threshold <float>
+ Specifies the threshold that will be used to compute the maximum
+ allowed stash size (defaults to 0.8).
+
+ --gen_verify
+ Generate an OTA package that verifies the partitions.
+
+ --log_diff <file>
+ Generate a log file that shows the differences in the source and target
+ builds for an incremental package. This option is only meaningful when
+ -i is specified.
"""
import sys
@@ -94,6 +109,7 @@
import multiprocessing
import os
+import subprocess
import tempfile
import zipfile
@@ -122,6 +138,12 @@
OPTIONS.oem_source = None
OPTIONS.fallback_to_full = True
OPTIONS.full_radio = False
+OPTIONS.full_bootloader = False
+# Stash size cannot exceed cache_size * threshold.
+OPTIONS.cache_size = None
+OPTIONS.stash_threshold = 0.8
+OPTIONS.gen_verify = False
+OPTIONS.log_diff = None
def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest
@@ -136,12 +158,12 @@
def IsSymlink(info):
"""Return true if the zipfile.ZipInfo object passed in represents a
symlink."""
- return (info.external_attr >> 16) == 0o120777
+ return (info.external_attr >> 16) & 0o770000 == 0o120000
def IsRegular(info):
"""Return true if the zipfile.ZipInfo object passed in represents a
- symlink."""
- return (info.external_attr >> 28) == 0o10
+ regular file."""
+ return (info.external_attr >> 16) & 0o770000 == 0o100000
def ClosestFileMatch(src, tgtfiles, existing):
"""Returns the closest file match between a source file and list
@@ -211,7 +233,8 @@
if i.is_dir:
i.children.sort(key=lambda i: i.name)
- # set metadata for the files generated by this script.
+ # Set metadata for the files generated by this script. For full recovery
+ # image at system/etc/recovery.img, it will be taken care by fs_config.
i = self.ITEMS.get("system/recovery-from-boot.p", None)
if i:
i.uid, i.gid, i.mode, i.selabel, i.capabilities = 0, 0, 0o644, None, None
@@ -415,11 +438,9 @@
def HasRecoveryPatch(target_files_zip):
- try:
- target_files_zip.getinfo("SYSTEM/recovery-from-boot.p")
- return True
- except KeyError:
- return False
+ namelist = [name for name in target_files_zip.namelist()]
+ return ("SYSTEM/recovery-from-boot.p" in namelist or
+ "SYSTEM/etc/recovery.img" in namelist)
def HasVendorPartition(target_files_zip):
try:
@@ -475,13 +496,20 @@
path = add_img_to_target_files.BuildVendor(
tmpdir, info_dict, block_list=mappath)
- return sparse_img.SparseImage(path, mappath)
+ # Bug: http://b/20939131
+ # In ext4 filesystems, block 0 might be changed even being mounted
+ # R/O. We add it to clobbered_blocks so that it will be written to the
+ # target unconditionally. Note that they are still part of care_map.
+ clobbered_blocks = "0"
+
+ return sparse_img.SparseImage(path, mappath, clobbered_blocks)
def WriteFullOTAPackage(input_zip, output_zip):
# TODO: how to determine this? We don't know what version it will
- # be installed on top of. For now, we expect the API just won't
- # change very often.
+ # be installed on top of. For now, we expect the API just won't
+ # change very often. Similarly for fstab, it might have changed
+ # in the target build.
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
@@ -575,6 +603,8 @@
if HasVendorPartition(input_zip):
system_progress -= 0.1
+ # Place a copy of file_contexts.bin into the OTA package which will be used
+ # by the recovery program.
if "selinux_fc" in OPTIONS.info_dict:
WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)
@@ -602,8 +632,8 @@
symlinks = CopyPartitionFiles(system_items, input_zip, output_zip)
script.MakeSymlinks(symlinks)
- boot_img = common.GetBootableImage("boot.img", "boot.img",
- OPTIONS.input_tmp, "BOOT")
+ boot_img = common.GetBootableImage(
+ "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
if not block_based:
def output_sink(fn, data):
@@ -715,18 +745,32 @@
def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
+ # TODO(tbao): We should factor out the common parts between
+ # WriteBlockIncrementalOTAPackage() and WriteIncrementalOTAPackage().
source_version = OPTIONS.source_info_dict["recovery_api_version"]
target_version = OPTIONS.target_info_dict["recovery_api_version"]
if source_version == 0:
print ("WARNING: generating edify script for a source that "
"can't install it.")
- script = edify_generator.EdifyGenerator(source_version,
- OPTIONS.target_info_dict)
+ script = edify_generator.EdifyGenerator(
+ source_version, OPTIONS.target_info_dict,
+ fstab=OPTIONS.source_info_dict["fstab"])
+
+ oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
+ recovery_mount_options = OPTIONS.source_info_dict.get(
+ "recovery_mount_options")
+ oem_dict = None
+ if oem_props is not None and len(oem_props) > 0:
+ if OPTIONS.oem_source is None:
+ raise common.ExternalError("OEM source required for this build")
+ script.Mount("/oem", recovery_mount_options)
+ oem_dict = common.LoadDictionaryFromLines(
+ open(OPTIONS.oem_source).readlines())
metadata = {
- "pre-device": GetBuildProp("ro.product.device",
- OPTIONS.source_info_dict),
+ "pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
+ OPTIONS.source_info_dict),
"post-timestamp": GetBuildProp("ro.build.date.utc",
OPTIONS.target_info_dict),
}
@@ -739,16 +783,12 @@
output_zip=output_zip,
script=script,
metadata=metadata,
- info_dict=OPTIONS.info_dict)
+ info_dict=OPTIONS.source_info_dict)
- # TODO: Currently this works differently from WriteIncrementalOTAPackage().
- # This function doesn't consider thumbprints when writing
- # metadata["pre/post-build"]. One possible reason is that the current
- # devices with thumbprints are all using file-based OTAs. Long term we
- # should factor out the common parts into a shared one to avoid further
- # divergence.
- source_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.source_info_dict)
- target_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.target_info_dict)
+ source_fp = CalculateFingerprint(oem_props, oem_dict,
+ OPTIONS.source_info_dict)
+ target_fp = CalculateFingerprint(oem_props, oem_dict,
+ OPTIONS.target_info_dict)
metadata["pre-build"] = source_fp
metadata["post-build"] = target_fp
@@ -772,8 +812,12 @@
int(i) for i in
OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(","))
+ # Check first block of system partition for remount R/W only if
+ # disk type is ext4
+ system_partition = OPTIONS.source_info_dict["fstab"]["/system"]
+ check_first_block = system_partition.fs_type=="ext4"
system_diff = common.BlockDifference("system", system_tgt, system_src,
- check_first_block=True,
+ check_first_block,
version=blockimgdiff_version)
if HasVendorPartition(target_zip):
@@ -783,23 +827,17 @@
OPTIONS.source_info_dict)
vendor_tgt = GetImage("vendor", OPTIONS.target_tmp,
OPTIONS.target_info_dict)
+
+ # Check first block of vendor partition for remount R/W only if
+ # disk type is ext4
+ vendor_partition = OPTIONS.source_info_dict["fstab"]["/vendor"]
+ check_first_block = vendor_partition.fs_type=="ext4"
vendor_diff = common.BlockDifference("vendor", vendor_tgt, vendor_src,
- check_first_block=True,
+ check_first_block,
version=blockimgdiff_version)
else:
vendor_diff = None
- oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
- recovery_mount_options = OPTIONS.target_info_dict.get(
- "recovery_mount_options")
- oem_dict = None
- if oem_props is not None and len(oem_props) > 0:
- if OPTIONS.oem_source is None:
- raise common.ExternalError("OEM source required for this build")
- script.Mount("/oem", recovery_mount_options)
- oem_dict = common.LoadDictionaryFromLines(
- open(OPTIONS.oem_source).readlines())
-
AppendAssertions(script, OPTIONS.target_info_dict, oem_dict)
device_specific.IncrementalOTA_Assertions()
@@ -826,9 +864,9 @@
# (allow recovery to mark itself finished and reboot)
if OPTIONS.two_step:
- if not OPTIONS.info_dict.get("multistage_support", None):
+ if not OPTIONS.source_info_dict.get("multistage_support", None):
assert False, "two-step packages not supported by this build"
- fs = OPTIONS.info_dict["fstab"]["/misc"]
+ fs = OPTIONS.source_info_dict["fstab"]["/misc"]
assert fs.fs_type.upper() == "EMMC", \
"two-step packages only supported on devices with EMMC /misc partitions"
bcb_dev = {"bcb_dev": fs.device}
@@ -873,7 +911,8 @@
GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
if updating_boot:
- boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict)
+ boot_type, boot_device = common.GetTypeAndDevice(
+ "/boot", OPTIONS.source_info_dict)
d = common.Difference(target_boot, source_boot)
_, _, d = d.ComputePatch()
if d is None:
@@ -913,6 +952,7 @@
system_diff.WriteScript(script, output_zip,
progress=0.8 if vendor_diff else 0.9)
+
if vendor_diff:
vendor_diff.WriteScript(script, output_zip, progress=0.1)
@@ -966,6 +1006,197 @@
WriteMetadata(metadata, output_zip)
+def WriteVerifyPackage(input_zip, output_zip):
+ script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
+
+ oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
+ recovery_mount_options = OPTIONS.info_dict.get(
+ "recovery_mount_options")
+ oem_dict = None
+ if oem_props is not None and len(oem_props) > 0:
+ if OPTIONS.oem_source is None:
+ raise common.ExternalError("OEM source required for this build")
+ script.Mount("/oem", recovery_mount_options)
+ oem_dict = common.LoadDictionaryFromLines(
+ open(OPTIONS.oem_source).readlines())
+
+ target_fp = CalculateFingerprint(oem_props, oem_dict, OPTIONS.info_dict)
+ metadata = {
+ "post-build": target_fp,
+ "pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
+ OPTIONS.info_dict),
+ "post-timestamp": GetBuildProp("ro.build.date.utc", OPTIONS.info_dict),
+ }
+
+ device_specific = common.DeviceSpecificParams(
+ input_zip=input_zip,
+ input_version=OPTIONS.info_dict["recovery_api_version"],
+ output_zip=output_zip,
+ script=script,
+ input_tmp=OPTIONS.input_tmp,
+ metadata=metadata,
+ info_dict=OPTIONS.info_dict)
+
+ AppendAssertions(script, OPTIONS.info_dict, oem_dict)
+
+ script.Print("Verifying device images against %s..." % target_fp)
+ script.AppendExtra("")
+
+ script.Print("Verifying boot...")
+ boot_img = common.GetBootableImage(
+ "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
+ boot_type, boot_device = common.GetTypeAndDevice(
+ "/boot", OPTIONS.info_dict)
+ script.Verify("%s:%s:%d:%s" % (
+ boot_type, boot_device, boot_img.size, boot_img.sha1))
+ script.AppendExtra("")
+
+ script.Print("Verifying recovery...")
+ recovery_img = common.GetBootableImage(
+ "recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
+ recovery_type, recovery_device = common.GetTypeAndDevice(
+ "/recovery", OPTIONS.info_dict)
+ script.Verify("%s:%s:%d:%s" % (
+ recovery_type, recovery_device, recovery_img.size, recovery_img.sha1))
+ script.AppendExtra("")
+
+ system_tgt = GetImage("system", OPTIONS.input_tmp, OPTIONS.info_dict)
+ system_tgt.ResetFileMap()
+ system_diff = common.BlockDifference("system", system_tgt, src=None)
+ system_diff.WriteStrictVerifyScript(script)
+
+ if HasVendorPartition(input_zip):
+ vendor_tgt = GetImage("vendor", OPTIONS.input_tmp, OPTIONS.info_dict)
+ vendor_tgt.ResetFileMap()
+ vendor_diff = common.BlockDifference("vendor", vendor_tgt, src=None)
+ vendor_diff.WriteStrictVerifyScript(script)
+
+ # Device specific partitions, such as radio, bootloader and etc.
+ device_specific.VerifyOTA_Assertions()
+
+ script.SetProgress(1.0)
+ script.AddToZip(input_zip, output_zip, input_path=OPTIONS.updater_binary)
+ WriteMetadata(metadata, output_zip)
+
+
+def WriteABOTAPackageWithBrilloScript(target_file, output_file,
+ source_file=None):
+ """Generate an Android OTA package that has A/B update payload."""
+
+ # Setup signing keys.
+ if OPTIONS.package_key is None:
+ OPTIONS.package_key = OPTIONS.info_dict.get(
+ "default_system_dev_certificate",
+ "build/target/product/security/testkey")
+
+ # A/B updater expects key in RSA format.
+ cmd = ["openssl", "pkcs8",
+ "-in", OPTIONS.package_key + OPTIONS.private_key_suffix,
+ "-inform", "DER", "-nocrypt"]
+ rsa_key = common.MakeTempFile(prefix="key-", suffix=".key")
+ cmd.extend(["-out", rsa_key])
+ p1 = common.Run(cmd, stdout=subprocess.PIPE)
+ p1.wait()
+ assert p1.returncode == 0, "openssl pkcs8 failed"
+
+ # Stage the output zip package for signing.
+ temp_zip_file = tempfile.NamedTemporaryFile()
+ output_zip = zipfile.ZipFile(temp_zip_file, "w",
+ compression=zipfile.ZIP_DEFLATED)
+
+ # Metadata to comply with Android OTA package format.
+ oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties", None)
+ oem_dict = None
+ if oem_props:
+ if OPTIONS.oem_source is None:
+ raise common.ExternalError("OEM source required for this build")
+ oem_dict = common.LoadDictionaryFromLines(
+ open(OPTIONS.oem_source).readlines())
+
+ metadata = {
+ "post-build": CalculateFingerprint(oem_props, oem_dict,
+ OPTIONS.info_dict),
+ "pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict,
+ OPTIONS.info_dict),
+ "post-timestamp": GetBuildProp("ro.build.date.utc", OPTIONS.info_dict),
+ }
+
+ if source_file is not None:
+ metadata["pre-build"] = CalculateFingerprint(oem_props, oem_dict,
+ OPTIONS.source_info_dict)
+
+ # 1. Generate payload.
+ payload_file = common.MakeTempFile(prefix="payload-", suffix=".bin")
+ cmd = ["brillo_update_payload", "generate",
+ "--payload", payload_file,
+ "--target_image", target_file]
+ if source_file is not None:
+ cmd.extend(["--source_image", source_file])
+ p1 = common.Run(cmd, stdout=subprocess.PIPE)
+ p1.wait()
+ assert p1.returncode == 0, "brillo_update_payload generate failed"
+
+ # 2. Generate hashes of the payload and metadata files.
+ payload_sig_file = common.MakeTempFile(prefix="sig-", suffix=".bin")
+ metadata_sig_file = common.MakeTempFile(prefix="sig-", suffix=".bin")
+ cmd = ["brillo_update_payload", "hash",
+ "--unsigned_payload", payload_file,
+ "--signature_size", "256",
+ "--metadata_hash_file", metadata_sig_file,
+ "--payload_hash_file", payload_sig_file]
+ p1 = common.Run(cmd, stdout=subprocess.PIPE)
+ p1.wait()
+ assert p1.returncode == 0, "brillo_update_payload hash failed"
+
+ # 3. Sign the hashes and insert them back into the payload file.
+ signed_payload_sig_file = common.MakeTempFile(prefix="signed-sig-",
+ suffix=".bin")
+ signed_metadata_sig_file = common.MakeTempFile(prefix="signed-sig-",
+ suffix=".bin")
+ # 3a. Sign the payload hash.
+ cmd = ["openssl", "pkeyutl", "-sign",
+ "-inkey", rsa_key,
+ "-pkeyopt", "digest:sha256",
+ "-in", payload_sig_file,
+ "-out", signed_payload_sig_file]
+ p1 = common.Run(cmd, stdout=subprocess.PIPE)
+ p1.wait()
+ assert p1.returncode == 0, "openssl sign payload failed"
+
+ # 3b. Sign the metadata hash.
+ cmd = ["openssl", "pkeyutl", "-sign",
+ "-inkey", rsa_key,
+ "-pkeyopt", "digest:sha256",
+ "-in", metadata_sig_file,
+ "-out", signed_metadata_sig_file]
+ p1 = common.Run(cmd, stdout=subprocess.PIPE)
+ p1.wait()
+ assert p1.returncode == 0, "openssl sign metadata failed"
+
+ # 3c. Insert the signatures back into the payload file.
+ signed_payload_file = common.MakeTempFile(prefix="signed-payload-",
+ suffix=".bin")
+ cmd = ["brillo_update_payload", "sign",
+ "--unsigned_payload", payload_file,
+ "--payload", signed_payload_file,
+ "--signature_size", "256",
+ "--metadata_signature_file", signed_metadata_sig_file,
+ "--payload_signature_file", signed_payload_sig_file]
+ p1 = common.Run(cmd, stdout=subprocess.PIPE)
+ p1.wait()
+ assert p1.returncode == 0, "brillo_update_payload sign failed"
+
+ # Add the signed payload file into the zip.
+ common.ZipWrite(output_zip, signed_payload_file, arcname="payload.bin",
+ compress_type=zipfile.ZIP_STORED)
+ WriteMetadata(metadata, output_zip)
+
+ # Sign the whole package to comply with the Android OTA package format.
+ common.ZipClose(output_zip)
+ SignOutput(temp_zip_file.name, output_file)
+ temp_zip_file.close()
+
+
class FileDifference(object):
def __init__(self, partition, source_zip, target_zip, output_zip):
self.deferred_patch_list = None
@@ -1056,11 +1287,13 @@
script.FileCheck(tf.name, tf.sha1)
def RemoveUnneededFiles(self, script, extras=()):
- script.DeleteFiles(
- ["/" + i[0] for i in self.verbatim_targets] +
- ["/" + i for i in sorted(self.source_data)
- if i not in self.target_data and i not in self.renames] +
- list(extras))
+ file_list = ["/" + i[0] for i in self.verbatim_targets]
+ file_list += ["/" + i for i in self.source_data
+ if i not in self.target_data and i not in self.renames]
+ file_list += list(extras)
+ # Sort the list in descending order, which removes all the files first
+ # before attempting to remove the folder. (Bug: 22960996)
+ script.DeleteFiles(sorted(file_list, reverse=True))
def TotalPatchSize(self):
return sum(i[1].size for i in self.patch_list)
@@ -1110,11 +1343,13 @@
if source_version == 0:
print ("WARNING: generating edify script for a source that "
"can't install it.")
- script = edify_generator.EdifyGenerator(source_version,
- OPTIONS.target_info_dict)
+ script = edify_generator.EdifyGenerator(
+ source_version, OPTIONS.target_info_dict,
+ fstab=OPTIONS.source_info_dict["fstab"])
oem_props = OPTIONS.info_dict.get("oem_fingerprint_properties")
- recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
+ recovery_mount_options = OPTIONS.source_info_dict.get(
+ "recovery_mount_options")
oem_dict = None
if oem_props is not None and len(oem_props) > 0:
if OPTIONS.oem_source is None:
@@ -1138,7 +1373,7 @@
output_zip=output_zip,
script=script,
metadata=metadata,
- info_dict=OPTIONS.info_dict)
+ info_dict=OPTIONS.source_info_dict)
system_diff = FileDifference("system", source_zip, target_zip, output_zip)
script.Mount("/system", recovery_mount_options)
@@ -1210,9 +1445,9 @@
# (allow recovery to mark itself finished and reboot)
if OPTIONS.two_step:
- if not OPTIONS.info_dict.get("multistage_support", None):
+ if not OPTIONS.source_info_dict.get("multistage_support", None):
assert False, "two-step packages not supported by this build"
- fs = OPTIONS.info_dict["fstab"]["/misc"]
+ fs = OPTIONS.source_info_dict["fstab"]["/misc"]
assert fs.fs_type.upper() == "EMMC", \
"two-step packages only supported on devices with EMMC /misc partitions"
bcb_dev = {"bcb_dev": fs.device}
@@ -1249,7 +1484,8 @@
common.ZipWriteStr(output_zip, "patch/boot.img.p", d)
- boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict)
+ boot_type, boot_device = common.GetTypeAndDevice(
+ "/boot", OPTIONS.source_info_dict)
script.PatchCheck("%s:%s:%d:%s:%d:%s" %
(boot_type, boot_device,
@@ -1344,6 +1580,7 @@
common.MakeRecoveryPatch(OPTIONS.target_tmp, output_sink,
target_recovery, target_boot)
script.DeleteFiles(["/system/recovery-from-boot.p",
+ "/system/etc/recovery.img",
"/system/etc/install-recovery.sh"])
print "recovery image changed; including as patch from boot."
else:
@@ -1374,11 +1611,36 @@
# Delete all the symlinks in source that aren't in target. This
# needs to happen before verbatim files are unpacked, in case a
# symlink in the source is replaced by a real file in the target.
- to_delete = []
+
+ # If a symlink in the source will be replaced by a regular file, we cannot
+ # delete the symlink/file in case the package gets applied again. For such
+ # a symlink, we prepend a sha1_check() to detect if it has been updated.
+ # (Bug: 23646151)
+ replaced_symlinks = dict()
+ if system_diff:
+ for i in system_diff.verbatim_targets:
+ replaced_symlinks["/%s" % (i[0],)] = i[2]
+ if vendor_diff:
+ for i in vendor_diff.verbatim_targets:
+ replaced_symlinks["/%s" % (i[0],)] = i[2]
+
+ if system_diff:
+ for tf in system_diff.renames.values():
+ replaced_symlinks["/%s" % (tf.name,)] = tf.sha1
+ if vendor_diff:
+ for tf in vendor_diff.renames.values():
+ replaced_symlinks["/%s" % (tf.name,)] = tf.sha1
+
+ always_delete = []
+ may_delete = []
for dest, link in source_symlinks:
if link not in target_symlinks_d:
- to_delete.append(link)
- script.DeleteFiles(to_delete)
+ if link in replaced_symlinks:
+ may_delete.append((link, replaced_symlinks[link]))
+ else:
+ always_delete.append(link)
+ script.DeleteFiles(always_delete)
+ script.DeleteFilesIfNotMatching(may_delete)
if system_diff.verbatim_targets:
script.Print("Unpacking new system files...")
@@ -1440,13 +1702,13 @@
if OPTIONS.verify and system_diff:
script.Print("Remounting and verifying system partition files...")
script.Unmount("/system")
- script.Mount("/system")
+ script.Mount("/system", recovery_mount_options)
system_diff.EmitExplicitTargetVerification(script)
if OPTIONS.verify and vendor_diff:
script.Print("Remounting and verifying vendor partition files...")
script.Unmount("/vendor")
- script.Mount("/vendor")
+ script.Mount("/vendor", recovery_mount_options)
vendor_diff.EmitExplicitTargetVerification(script)
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
@@ -1464,6 +1726,8 @@
OPTIONS.incremental_source = a
elif o == "--full_radio":
OPTIONS.full_radio = True
+ elif o == "--full_bootloader":
+ OPTIONS.full_bootloader = True
elif o in ("-w", "--wipe_user_data"):
OPTIONS.wipe_user_data = True
elif o in ("-n", "--no_prereq"):
@@ -1495,6 +1759,16 @@
OPTIONS.updater_binary = a
elif o in ("--no_fallback_to_full",):
OPTIONS.fallback_to_full = False
+ elif o == "--stash_threshold":
+ try:
+ OPTIONS.stash_threshold = float(a)
+ except ValueError:
+ raise ValueError("Cannot parse value %r for option %r - expecting "
+ "a float" % (a, o))
+ elif o == "--gen_verify":
+ OPTIONS.gen_verify = True
+ elif o == "--log_diff":
+ OPTIONS.log_diff = a
else:
return False
return True
@@ -1506,6 +1780,7 @@
"package_key=",
"incremental_from=",
"full_radio",
+ "full_bootloader",
"wipe_user_data",
"no_prereq",
"extra_script=",
@@ -1518,12 +1793,46 @@
"oem_settings=",
"verify",
"no_fallback_to_full",
+ "stash_threshold=",
+ "gen_verify",
+ "log_diff=",
], extra_option_handler=option_handler)
if len(args) != 2:
common.Usage(__doc__)
sys.exit(1)
+ # Load the dict file from the zip directly to have a peek at the OTA type.
+ # For packages using A/B update, unzipping is not needed.
+ input_zip = zipfile.ZipFile(args[0], "r")
+ OPTIONS.info_dict = common.LoadInfoDict(input_zip)
+ common.ZipClose(input_zip)
+
+ ab_update = OPTIONS.info_dict.get("ab_update") == "true"
+
+ if ab_update:
+ if OPTIONS.incremental_source is not None:
+ OPTIONS.target_info_dict = OPTIONS.info_dict
+ source_zip = zipfile.ZipFile(OPTIONS.incremental_source, "r")
+ OPTIONS.source_info_dict = common.LoadInfoDict(source_zip)
+ common.ZipClose(source_zip)
+
+ if OPTIONS.verbose:
+ print "--- target info ---"
+ common.DumpInfoDict(OPTIONS.info_dict)
+
+ if OPTIONS.incremental_source is not None:
+ print "--- source info ---"
+ common.DumpInfoDict(OPTIONS.source_info_dict)
+
+ WriteABOTAPackageWithBrilloScript(
+ target_file=args[0],
+ output_file=args[1],
+ source_file=OPTIONS.incremental_source)
+
+ print "done."
+ return
+
if OPTIONS.extra_script is not None:
OPTIONS.extra_script = open(OPTIONS.extra_script).read()
@@ -1531,15 +1840,7 @@
OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0])
OPTIONS.target_tmp = OPTIONS.input_tmp
- OPTIONS.info_dict = common.LoadInfoDict(input_zip)
-
- # If this image was originally labelled with SELinux contexts, make sure we
- # also apply the labels in our new image. During building, the "file_contexts"
- # is in the out/ directory tree, but for repacking from target-files.zip it's
- # in the root directory of the ramdisk.
- if "selinux_fc" in OPTIONS.info_dict:
- OPTIONS.info_dict["selinux_fc"] = os.path.join(
- OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts")
+ OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.target_tmp)
if OPTIONS.verbose:
print "--- target info ---"
@@ -1563,54 +1864,74 @@
if OPTIONS.device_specific is not None:
OPTIONS.device_specific = os.path.abspath(OPTIONS.device_specific)
- while True:
+ if OPTIONS.info_dict.get("no_recovery") == "true":
+ raise common.ExternalError(
+ "--- target build has specified no recovery ---")
- if OPTIONS.no_signing:
- if os.path.exists(args[1]):
- os.unlink(args[1])
- output_zip = zipfile.ZipFile(args[1], "w",
- compression=zipfile.ZIP_DEFLATED)
- else:
- temp_zip_file = tempfile.NamedTemporaryFile()
- output_zip = zipfile.ZipFile(temp_zip_file, "w",
- compression=zipfile.ZIP_DEFLATED)
+ # Use the default key to sign the package if not specified with package_key.
+ if not OPTIONS.no_signing:
+ if OPTIONS.package_key is None:
+ OPTIONS.package_key = OPTIONS.info_dict.get(
+ "default_system_dev_certificate",
+ "build/target/product/security/testkey")
- if OPTIONS.incremental_source is None:
+ # Set up the output zip. Create a temporary zip file if signing is needed.
+ if OPTIONS.no_signing:
+ if os.path.exists(args[1]):
+ os.unlink(args[1])
+ output_zip = zipfile.ZipFile(args[1], "w",
+ compression=zipfile.ZIP_DEFLATED)
+ else:
+ temp_zip_file = tempfile.NamedTemporaryFile()
+ output_zip = zipfile.ZipFile(temp_zip_file, "w",
+ compression=zipfile.ZIP_DEFLATED)
+
+ # Non A/B OTAs rely on /cache partition to store temporary files.
+ cache_size = OPTIONS.info_dict.get("cache_size", None)
+ if cache_size is None:
+ print "--- can't determine the cache partition size ---"
+ OPTIONS.cache_size = cache_size
+
+ # Generate a verify package.
+ if OPTIONS.gen_verify:
+ WriteVerifyPackage(input_zip, output_zip)
+
+ # Generate a full OTA.
+ elif OPTIONS.incremental_source is None:
+ WriteFullOTAPackage(input_zip, output_zip)
+
+ # Generate an incremental OTA. It will fall back to generate a full OTA on
+ # failure unless no_fallback_to_full is specified.
+ else:
+ print "unzipping source target-files..."
+ 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,
+ OPTIONS.source_tmp)
+ if OPTIONS.verbose:
+ print "--- source info ---"
+ common.DumpInfoDict(OPTIONS.source_info_dict)
+ try:
+ WriteIncrementalOTAPackage(input_zip, source_zip, output_zip)
+ if OPTIONS.log_diff:
+ out_file = open(OPTIONS.log_diff, 'w')
+ import target_files_diff
+ target_files_diff.recursiveDiff('',
+ OPTIONS.source_tmp,
+ OPTIONS.input_tmp,
+ out_file)
+ out_file.close()
+ except ValueError:
+ if not OPTIONS.fallback_to_full:
+ raise
+ print "--- failed to build incremental; falling back to full ---"
+ OPTIONS.incremental_source = None
WriteFullOTAPackage(input_zip, output_zip)
- if OPTIONS.package_key is None:
- OPTIONS.package_key = OPTIONS.info_dict.get(
- "default_system_dev_certificate",
- "build/target/product/security/testkey")
- common.ZipClose(output_zip)
- break
- else:
- print "unzipping source target-files..."
- 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 "selinux_fc" in OPTIONS.source_info_dict:
- OPTIONS.source_info_dict["selinux_fc"] = os.path.join(
- OPTIONS.source_tmp, "BOOT", "RAMDISK", "file_contexts")
- if OPTIONS.package_key is None:
- OPTIONS.package_key = OPTIONS.source_info_dict.get(
- "default_system_dev_certificate",
- "build/target/product/security/testkey")
- if OPTIONS.verbose:
- print "--- source info ---"
- common.DumpInfoDict(OPTIONS.source_info_dict)
- try:
- WriteIncrementalOTAPackage(input_zip, source_zip, output_zip)
- common.ZipClose(output_zip)
- break
- except ValueError:
- if not OPTIONS.fallback_to_full:
- raise
- print "--- failed to build incremental; falling back to full ---"
- OPTIONS.incremental_source = None
- common.ZipClose(output_zip)
+ common.ZipClose(output_zip)
+ # Sign the generated zip package unless no_signing is specified.
if not OPTIONS.no_signing:
SignOutput(temp_zip_file.name, args[1])
temp_zip_file.close()
diff --git a/tools/releasetools/rangelib.py b/tools/releasetools/rangelib.py
index 8b327fe..975a48a 100644
--- a/tools/releasetools/rangelib.py
+++ b/tools/releasetools/rangelib.py
@@ -28,7 +28,9 @@
if isinstance(data, str):
self._parse_internal(data)
elif data:
+ assert len(data) % 2 == 0
self.data = tuple(self._remove_pairs(data))
+ self.monotonic = all(x < y for x, y in zip(self.data, self.data[1:]))
else:
self.data = ()
@@ -38,8 +40,10 @@
def __eq__(self, other):
return self.data == other.data
+
def __ne__(self, other):
return self.data != other.data
+
def __nonzero__(self):
return bool(self.data)
@@ -73,9 +77,9 @@
monotonic = True
for p in text.split():
if "-" in p:
- s, e = p.split("-")
- data.append(int(s))
- data.append(int(e)+1)
+ s, e = (int(x) for x in p.split("-"))
+ data.append(s)
+ data.append(e+1)
if last <= s <= e:
last = e
else:
@@ -94,6 +98,9 @@
@staticmethod
def _remove_pairs(source):
+ """Remove consecutive duplicate items to simplify the result.
+
+ [1, 2, 2, 5, 5, 10] will become [1, 10]."""
last = None
for i in source:
if i == last:
@@ -116,6 +123,7 @@
return " ".join(out)
def to_string_raw(self):
+ assert self.data
return str(len(self.data)) + "," + ",".join(str(i) for i in self.data)
def union(self, other):
@@ -238,6 +246,60 @@
out.append(offset + p - start)
return RangeSet(data=out)
+ def extend(self, n):
+ """Extend the RangeSet by 'n' blocks.
+
+ The lower bound is guaranteed to be non-negative.
+
+ >>> RangeSet("0-9").extend(1)
+ <RangeSet("0-10")>
+ >>> RangeSet("10-19").extend(15)
+ <RangeSet("0-34")>
+ >>> RangeSet("10-19 30-39").extend(4)
+ <RangeSet("6-23 26-43")>
+ >>> RangeSet("10-19 30-39").extend(10)
+ <RangeSet("0-49")>
+ """
+ out = self
+ for i in range(0, len(self.data), 2):
+ s, e = self.data[i:i+2]
+ s1 = max(0, s - n)
+ e1 = e + n
+ out = out.union(RangeSet(str(s1) + "-" + str(e1-1)))
+ return out
+
+ def first(self, n):
+ """Return the RangeSet that contains at most the first 'n' integers.
+
+ >>> RangeSet("0-9").first(1)
+ <RangeSet("0")>
+ >>> RangeSet("10-19").first(5)
+ <RangeSet("10-14")>
+ >>> RangeSet("10-19").first(15)
+ <RangeSet("10-19")>
+ >>> RangeSet("10-19 30-39").first(3)
+ <RangeSet("10-12")>
+ >>> RangeSet("10-19 30-39").first(15)
+ <RangeSet("10-19 30-34")>
+ >>> RangeSet("10-19 30-39").first(30)
+ <RangeSet("10-19 30-39")>
+ >>> RangeSet("0-9").first(0)
+ <RangeSet("")>
+ """
+
+ if self.size() <= n:
+ return self
+
+ out = []
+ for s, e in self:
+ if e - s >= n:
+ out += (s, s+n)
+ break
+ else:
+ out += (s, e)
+ n -= e - s
+ return RangeSet(data=out)
+
if __name__ == "__main__":
import doctest
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index ec49112..baf60f5 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -134,7 +134,7 @@
signed = tempfile.NamedTemporaryFile()
- common.SignFile(unsigned.name, signed.name, keyname, pw, align=4)
+ common.SignFile(unsigned.name, signed.name, keyname, pw)
data = signed.read()
unsigned.close()
@@ -175,21 +175,26 @@
data = input_tf_zip.read(info.filename)
out_info = copy.copy(info)
+ # Replace keys if requested.
if (info.filename == "META/misc_info.txt" and
OPTIONS.replace_verity_private_key):
ReplaceVerityPrivateKey(input_tf_zip, output_tf_zip, misc_info,
OPTIONS.replace_verity_private_key[1])
- elif (info.filename == "BOOT/RAMDISK/verity_key" and
+ elif (info.filename in ("BOOT/RAMDISK/verity_key",
+ "BOOT/verity_key") and
OPTIONS.replace_verity_public_key):
- new_data = ReplaceVerityPublicKey(output_tf_zip,
+ new_data = ReplaceVerityPublicKey(output_tf_zip, info.filename,
OPTIONS.replace_verity_public_key[1])
write_to_temp(info.filename, info.external_attr, new_data)
+ # Copy BOOT/, RECOVERY/, META/, ROOT/ to rebuild recovery patch.
elif (info.filename.startswith("BOOT/") or
info.filename.startswith("RECOVERY/") or
info.filename.startswith("META/") or
+ info.filename.startswith("ROOT/") or
info.filename == "SYSTEM/etc/recovery-resource.dat"):
write_to_temp(info.filename, info.external_attr, data)
+ # Sign APKs.
if info.filename.endswith(".apk"):
name = os.path.basename(info.filename)
key = apk_key_map[name]
@@ -203,17 +208,20 @@
common.ZipWriteStr(output_tf_zip, out_info, data)
elif info.filename in ("SYSTEM/build.prop",
"VENDOR/build.prop",
+ "BOOT/RAMDISK/default.prop",
"RECOVERY/RAMDISK/default.prop"):
print "rewriting %s:" % (info.filename,)
new_data = RewriteProps(data, misc_info)
common.ZipWriteStr(output_tf_zip, out_info, new_data)
- if info.filename == "RECOVERY/RAMDISK/default.prop":
+ if info.filename in ("BOOT/RAMDISK/default.prop",
+ "RECOVERY/RAMDISK/default.prop"):
write_to_temp(info.filename, info.external_attr, new_data)
elif info.filename.endswith("mac_permissions.xml"):
print "rewriting %s with new keys." % (info.filename,)
new_data = ReplaceCerts(data)
common.ZipWriteStr(output_tf_zip, out_info, new_data)
elif info.filename in ("SYSTEM/recovery-from-boot.p",
+ "SYSTEM/etc/recovery.img",
"SYSTEM/bin/install-recovery.sh"):
rebuild_recovery = True
elif (OPTIONS.replace_ota_keys and
@@ -225,7 +233,8 @@
info.filename == "META/misc_info.txt"):
pass
elif (OPTIONS.replace_verity_public_key and
- info.filename == "BOOT/RAMDISK/verity_key"):
+ info.filename in ("BOOT/RAMDISK/verity_key",
+ "BOOT/verity_key")):
pass
else:
# a non-APK file; copy it verbatim
@@ -310,6 +319,10 @@
pieces = value.split("/")
pieces[-1] = EditTags(pieces[-1])
value = "/".join(pieces)
+ elif key == "ro.bootimage.build.fingerprint":
+ pieces = value.split("/")
+ pieces[-1] = EditTags(pieces[-1])
+ value = "/".join(pieces)
elif key == "ro.build.description":
pieces = value.split(" ")
assert len(pieces) == 5
@@ -393,11 +406,11 @@
return new_recovery_keys
-def ReplaceVerityPublicKey(targetfile_zip, key_path):
+def ReplaceVerityPublicKey(targetfile_zip, filename, key_path):
print "Replacing verity public key with %s" % key_path
with open(key_path) as f:
data = f.read()
- common.ZipWriteStr(targetfile_zip, "BOOT/RAMDISK/verity_key", data)
+ common.ZipWriteStr(targetfile_zip, filename, data)
return data
def ReplaceVerityPrivateKey(targetfile_input_zip, targetfile_output_zip,
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index b97bb84..013044f 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -21,10 +21,17 @@
class SparseImage(object):
- """Wraps a sparse image file (and optional file map) into an image
- object suitable for passing to BlockImageDiff."""
+ """Wraps a sparse image file into an image object.
- def __init__(self, simg_fn, file_map_fn=None):
+ Wraps a sparse image file (and optional file map and clobbered_blocks) into
+ an image object suitable for passing to BlockImageDiff. file_map contains
+ the mapping between files and their blocks. clobbered_blocks contains the set
+ of blocks that should be always written to the target regardless of the old
+ contents (i.e. copying instead of patching). clobbered_blocks should be in
+ the form of a string like "0" or "0 1-5 8".
+ """
+
+ def __init__(self, simg_fn, file_map_fn=None, clobbered_blocks=None):
self.simg_f = f = open(simg_fn, "rb")
header_bin = f.read(28)
@@ -57,6 +64,7 @@
pos = 0 # in blocks
care_data = []
self.offset_map = offset_map = []
+ self.clobbered_blocks = rangelib.RangeSet(data=clobbered_blocks)
for i in range(total_chunks):
header_bin = f.read(12)
@@ -102,18 +110,35 @@
self.care_map = rangelib.RangeSet(care_data)
self.offset_index = [i[0] for i in offset_map]
+ # Bug: 20881595
+ # Introduce extended blocks as a workaround for the bug. dm-verity may
+ # touch blocks that are not in the care_map due to block device
+ # read-ahead. It will fail if such blocks contain non-zeroes. We zero out
+ # the extended blocks explicitly to avoid dm-verity failures. 512 blocks
+ # are the maximum read-ahead we configure for dm-verity block devices.
+ extended = self.care_map.extend(512)
+ all_blocks = rangelib.RangeSet(data=(0, self.total_blocks))
+ extended = extended.intersect(all_blocks).subtract(self.care_map)
+ self.extended = extended
+
if file_map_fn:
- self.LoadFileBlockMap(file_map_fn)
+ self.LoadFileBlockMap(file_map_fn, self.clobbered_blocks)
else:
self.file_map = {"__DATA": self.care_map}
def ReadRangeSet(self, ranges):
return [d for d in self._GetRangeData(ranges)]
- def TotalSha1(self):
- """Return the SHA-1 hash of all data in the 'care' regions of this image."""
+ def TotalSha1(self, include_clobbered_blocks=False):
+ """Return the SHA-1 hash of all data in the 'care' regions.
+
+ If include_clobbered_blocks is True, it returns the hash including the
+ clobbered_blocks."""
+ ranges = self.care_map
+ if not include_clobbered_blocks:
+ ranges = ranges.subtract(self.clobbered_blocks)
h = sha1()
- for d in self._GetRangeData(self.care_map):
+ for d in self._GetRangeData(ranges):
h.update(d)
return h.hexdigest()
@@ -156,7 +181,7 @@
yield fill_data * (this_read * (self.blocksize >> 2))
to_read -= this_read
- def LoadFileBlockMap(self, fn):
+ def LoadFileBlockMap(self, fn, clobbered_blocks):
remaining = self.care_map
self.file_map = out = {}
@@ -166,19 +191,35 @@
ranges = rangelib.RangeSet.parse(ranges)
out[fn] = ranges
assert ranges.size() == ranges.intersect(remaining).size()
+
+ # Currently we assume that blocks in clobbered_blocks are not part of
+ # any file.
+ assert not clobbered_blocks.overlaps(ranges)
remaining = remaining.subtract(ranges)
+ remaining = remaining.subtract(clobbered_blocks)
+
# For all the remaining blocks in the care_map (ie, those that
- # aren't part of the data for any file), divide them into blocks
- # that are all zero and blocks that aren't. (Zero blocks are
- # handled specially because (1) there are usually a lot of them
- # and (2) bsdiff handles files with long sequences of repeated
- # bytes especially poorly.)
+ # aren't part of the data for any file nor part of the clobbered_blocks),
+ # divide them into blocks that are all zero and blocks that aren't.
+ # (Zero blocks are handled specially because (1) there are usually
+ # a lot of them and (2) bsdiff handles files with long sequences of
+ # repeated bytes especially poorly.)
zero_blocks = []
nonzero_blocks = []
reference = '\0' * self.blocksize
+ # Workaround for bug 23227672. For squashfs, we don't have a system.map. So
+ # the whole system image will be treated as a single file. But for some
+ # unknown bug, the updater will be killed due to OOM when writing back the
+ # patched image to flash (observed on lenok-userdebug MEA49). Prior to
+ # getting a real fix, we evenly divide the non-zero blocks into smaller
+ # groups (currently 1024 blocks or 4MB per group).
+ # Bug: 23227672
+ MAX_BLOCKS_PER_GROUP = 1024
+ nonzero_groups = []
+
f = self.simg_f
for s, e in remaining:
for b in range(s, e):
@@ -201,8 +242,24 @@
nonzero_blocks.append(b)
nonzero_blocks.append(b+1)
- out["__ZERO"] = rangelib.RangeSet(data=zero_blocks)
- out["__NONZERO"] = rangelib.RangeSet(data=nonzero_blocks)
+ if len(nonzero_blocks) >= MAX_BLOCKS_PER_GROUP:
+ nonzero_groups.append(nonzero_blocks)
+ # Clear the list.
+ nonzero_blocks = []
+
+ if nonzero_blocks:
+ nonzero_groups.append(nonzero_blocks)
+ nonzero_blocks = []
+
+ assert zero_blocks or nonzero_groups or clobbered_blocks
+
+ if zero_blocks:
+ out["__ZERO"] = rangelib.RangeSet(data=zero_blocks)
+ if nonzero_groups:
+ for i, blocks in enumerate(nonzero_groups):
+ out["__NONZERO-%d" % i] = rangelib.RangeSet(data=blocks)
+ if clobbered_blocks:
+ out["__COPY"] = clobbered_blocks
def ResetFileMap(self):
"""Throw away the file map and treat the entire image as
diff --git a/tools/releasetools/target_files_diff.py b/tools/releasetools/target_files_diff.py
new file mode 100755
index 0000000..405c42b
--- /dev/null
+++ b/tools/releasetools/target_files_diff.py
@@ -0,0 +1,242 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+#
+# Finds differences between two target files packages
+#
+
+from __future__ import print_function
+
+import argparse
+import contextlib
+import os
+import re
+import subprocess
+import sys
+import tempfile
+
+def ignore(name):
+ """
+ Files to ignore when diffing
+
+ These are packages that we're already diffing elsewhere,
+ or files that we expect to be different for every build,
+ or known problems.
+ """
+
+ # We're looking at the files that make the images, so no need to search them
+ if name in ['IMAGES']:
+ return True
+ # These are packages of the recovery partition, which we're already diffing
+ if name in ['SYSTEM/etc/recovery-resource.dat',
+ 'SYSTEM/recovery-from-boot.p']:
+ return True
+
+ # These files are just the BUILD_NUMBER, and will always be different
+ if name in ['BOOT/RAMDISK/selinux_version',
+ 'RECOVERY/RAMDISK/selinux_version']:
+ return True
+
+ # b/24201956 .art/.oat/.odex files are different with every build
+ if name.endswith('.art') or name.endswith('.oat') or name.endswith('.odex'):
+ return True
+ # b/25348136 libpac.so changes with every build
+ if name in ['SYSTEM/lib/libpac.so',
+ 'SYSTEM/lib64/libpac.so']:
+ return True
+
+ return False
+
+
+def rewrite_build_property(original, new):
+ """
+ Rewrite property files to remove values known to change for every build
+ """
+
+ skipped = ['ro.bootimage.build.date=',
+ 'ro.bootimage.build.date.utc=',
+ 'ro.bootimage.build.fingerprint=',
+ 'ro.build.id=',
+ 'ro.build.display.id=',
+ 'ro.build.version.incremental=',
+ 'ro.build.date=',
+ 'ro.build.date.utc=',
+ 'ro.build.host=',
+ 'ro.build.description=',
+ 'ro.build.fingerprint=',
+ 'ro.expect.recovery_id=',
+ 'ro.vendor.build.date=',
+ 'ro.vendor.build.date.utc=',
+ 'ro.vendor.build.fingerprint=']
+
+ for line in original:
+ skip = False
+ for s in skipped:
+ if line.startswith(s):
+ skip = True
+ break
+ if not skip:
+ new.write(line)
+
+
+def trim_install_recovery(original, new):
+ """
+ Rewrite the install-recovery script to remove the hash of the recovery
+ partition.
+ """
+ for line in original:
+ new.write(re.sub(r'[0-9a-f]{40}', '0'*40, line))
+
+def sort_file(original, new):
+ """
+ Sort the file. Some OTA metadata files are not in a deterministic order
+ currently.
+ """
+ lines = original.readlines()
+ lines.sort()
+ for line in lines:
+ new.write(line)
+
+# Map files to the functions that will modify them for diffing
+REWRITE_RULES = {
+ 'BOOT/RAMDISK/default.prop': rewrite_build_property,
+ 'RECOVERY/RAMDISK/default.prop': rewrite_build_property,
+ 'SYSTEM/build.prop': rewrite_build_property,
+ 'VENDOR/build.prop': rewrite_build_property,
+
+ 'SYSTEM/bin/install-recovery.sh': trim_install_recovery,
+
+ 'META/boot_filesystem_config.txt': sort_file,
+ 'META/filesystem_config.txt': sort_file,
+ 'META/recovery_filesystem_config.txt': sort_file,
+ 'META/vendor_filesystem_config.txt': sort_file,
+}
+
+@contextlib.contextmanager
+def preprocess(name, filename):
+ """
+ Optionally rewrite files before diffing them, to remove known-variable
+ information.
+ """
+ if name in REWRITE_RULES:
+ with tempfile.NamedTemporaryFile() as newfp:
+ with open(filename, 'r') as oldfp:
+ REWRITE_RULES[name](oldfp, newfp)
+ newfp.flush()
+ yield newfp.name
+ else:
+ yield filename
+
+def diff(name, file1, file2, out_file):
+ """
+ Diff a file pair with diff, running preprocess() on the arguments first.
+ """
+ with preprocess(name, file1) as f1:
+ with preprocess(name, file2) as f2:
+ proc = subprocess.Popen(['diff', f1, f2], stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ (stdout, _) = proc.communicate()
+ if proc.returncode == 0:
+ return
+ stdout = stdout.strip()
+ if stdout == 'Binary files %s and %s differ' % (f1, f2):
+ print("%s: Binary files differ" % name, file=out_file)
+ else:
+ for line in stdout.strip().split('\n'):
+ print("%s: %s" % (name, line), file=out_file)
+
+def recursiveDiff(prefix, dir1, dir2, out_file):
+ """
+ Recursively diff two directories, checking metadata then calling diff()
+ """
+ list1 = sorted(os.listdir(dir1))
+ list2 = sorted(os.listdir(dir2))
+
+ for entry in list1:
+ name = os.path.join(prefix, entry)
+ name1 = os.path.join(dir1, entry)
+ name2 = os.path.join(dir2, entry)
+
+ if ignore(name):
+ continue
+
+ if entry in list2:
+ if os.path.islink(name1):
+ if os.path.islink(name2):
+ link1 = os.readlink(name1)
+ link2 = os.readlink(name2)
+ if link1 != link2:
+ print("%s: Symlinks differ: %s vs %s" % (name, link1, link2),
+ file=out_file)
+ else:
+ print("%s: File types differ, skipping compare" % name,
+ file=out_file)
+ continue
+
+ stat1 = os.stat(name1)
+ stat2 = os.stat(name2)
+ type1 = stat1.st_mode & ~0o777
+ type2 = stat2.st_mode & ~0o777
+
+ if type1 != type2:
+ print("%s: File types differ, skipping compare" % name, file=out_file)
+ continue
+
+ if stat1.st_mode != stat2.st_mode:
+ print("%s: Modes differ: %o vs %o" %
+ (name, stat1.st_mode, stat2.st_mode), file=out_file)
+
+ if os.path.isdir(name1):
+ recursiveDiff(name, name1, name2, out_file)
+ elif os.path.isfile(name1):
+ diff(name, name1, name2, out_file)
+ else:
+ print("%s: Unknown file type, skipping compare" % name, file=out_file)
+ else:
+ print("%s: Only in base package" % name, file=out_file)
+
+ for entry in list2:
+ name = os.path.join(prefix, entry)
+ name1 = os.path.join(dir1, entry)
+ name2 = os.path.join(dir2, entry)
+
+ if ignore(name):
+ continue
+
+ if entry not in list1:
+ print("%s: Only in new package" % name, file=out_file)
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('dir1', help='The base target files package (extracted)')
+ parser.add_argument('dir2', help='The new target files package (extracted)')
+ parser.add_argument('--output',
+ help='The output file, otherwise it prints to stdout')
+ args = parser.parse_args()
+
+ if args.output:
+ out_file = open(args.output, 'w')
+ else:
+ out_file = sys.stdout
+
+ recursiveDiff('', args.dir1, args.dir2, out_file)
+
+ if args.output:
+ out_file.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index f28934d..a861346 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -121,15 +121,18 @@
time.sleep(5) # Make sure the atime/mtime will change measurably.
if not isinstance(zinfo_or_arcname, zipfile.ZipInfo):
- zinfo = zipfile.ZipInfo(filename=zinfo_or_arcname)
+ arcname = zinfo_or_arcname
+ expected_mode = extra_args.get("perms", 0o644)
else:
- zinfo = zinfo_or_arcname
- arcname = zinfo.filename
+ arcname = zinfo_or_arcname.filename
+ expected_mode = extra_args.get("perms",
+ zinfo_or_arcname.external_attr >> 16)
- common.ZipWriteStr(zip_file, zinfo, contents, **extra_args)
+ common.ZipWriteStr(zip_file, zinfo_or_arcname, contents, **extra_args)
common.ZipClose(zip_file)
self._verify(zip_file, zip_file_name, arcname, contents,
+ expected_mode=expected_mode,
expected_compress_type=expected_compress_type)
finally:
os.remove(zip_file_name)
@@ -228,9 +231,10 @@
random_string = os.urandom(1024)
# Passing arcname
self._test_ZipWriteStr("foo", random_string, {
+ "perms": 0o700,
"compress_type": zipfile.ZIP_DEFLATED,
})
- self._test_ZipWriteStr("foo", random_string, {
+ self._test_ZipWriteStr("bar", random_string, {
"compress_type": zipfile.ZIP_STORED,
})
@@ -240,6 +244,7 @@
"compress_type": zipfile.ZIP_DEFLATED,
})
self._test_ZipWriteStr(zinfo, random_string, {
+ "perms": 0o600,
"compress_type": zipfile.ZIP_STORED,
})
@@ -257,3 +262,36 @@
self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, "foo", "")
zinfo = zipfile.ZipInfo(filename="foo")
self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, zinfo, "")
+
+ def test_bug21309935(self):
+ zip_file = tempfile.NamedTemporaryFile(delete=False)
+ zip_file_name = zip_file.name
+ zip_file.close()
+
+ try:
+ random_string = os.urandom(1024)
+ zip_file = zipfile.ZipFile(zip_file_name, "w")
+ # Default perms should be 0o644 when passing the filename.
+ common.ZipWriteStr(zip_file, "foo", random_string)
+ # Honor the specified perms.
+ common.ZipWriteStr(zip_file, "bar", random_string, perms=0o755)
+ # The perms in zinfo should be untouched.
+ zinfo = zipfile.ZipInfo(filename="baz")
+ zinfo.external_attr = 0o740 << 16
+ common.ZipWriteStr(zip_file, zinfo, random_string)
+ # Explicitly specified perms has the priority.
+ zinfo = zipfile.ZipInfo(filename="qux")
+ zinfo.external_attr = 0o700 << 16
+ common.ZipWriteStr(zip_file, zinfo, random_string, perms=0o400)
+ common.ZipClose(zip_file)
+
+ self._verify(zip_file, zip_file_name, "foo", random_string,
+ expected_mode=0o644)
+ self._verify(zip_file, zip_file_name, "bar", random_string,
+ expected_mode=0o755)
+ self._verify(zip_file, zip_file_name, "baz", random_string,
+ expected_mode=0o740)
+ self._verify(zip_file, zip_file_name, "qux", random_string,
+ expected_mode=0o400)
+ finally:
+ os.remove(zip_file_name)
diff --git a/tools/releasetools/test_rangelib.py b/tools/releasetools/test_rangelib.py
new file mode 100644
index 0000000..7debe66
--- /dev/null
+++ b/tools/releasetools/test_rangelib.py
@@ -0,0 +1,125 @@
+#
+# Copyright (C) 2015 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 unittest
+
+from rangelib import RangeSet
+
+class RangeSetTest(unittest.TestCase):
+
+ def test_union(self):
+ self.assertEqual(RangeSet("10-19 30-34").union(RangeSet("18-29")),
+ RangeSet("10-34"))
+ self.assertEqual(RangeSet("10-19 30-34").union(RangeSet("22 32")),
+ RangeSet("10-19 22 30-34"))
+
+ def test_intersect(self):
+ self.assertEqual(RangeSet("10-19 30-34").intersect(RangeSet("18-32")),
+ RangeSet("18-19 30-32"))
+ self.assertEqual(RangeSet("10-19 30-34").intersect(RangeSet("22-28")),
+ RangeSet(""))
+
+ def test_subtract(self):
+ self.assertEqual(RangeSet("10-19 30-34").subtract(RangeSet("18-32")),
+ RangeSet("10-17 33-34"))
+ self.assertEqual(RangeSet("10-19 30-34").subtract(RangeSet("22-28")),
+ RangeSet("10-19 30-34"))
+
+ def test_overlaps(self):
+ self.assertTrue(RangeSet("10-19 30-34").overlaps(RangeSet("18-32")))
+ self.assertFalse(RangeSet("10-19 30-34").overlaps(RangeSet("22-28")))
+
+ def test_size(self):
+ self.assertEqual(RangeSet("10-19 30-34").size(), 15)
+ self.assertEqual(RangeSet("").size(), 0)
+
+ def test_map_within(self):
+ self.assertEqual(RangeSet("0-9").map_within(RangeSet("3-4")),
+ RangeSet("3-4"))
+ self.assertEqual(RangeSet("10-19").map_within(RangeSet("13-14")),
+ RangeSet("3-4"))
+ self.assertEqual(
+ RangeSet("10-19 30-39").map_within(RangeSet("17-19 30-32")),
+ RangeSet("7-12"))
+ self.assertEqual(
+ RangeSet("10-19 30-39").map_within(RangeSet("12-13 17-19 30-32")),
+ RangeSet("2-3 7-12"))
+
+ def test_first(self):
+ self.assertEqual(RangeSet("0-9").first(1), RangeSet("0"))
+ self.assertEqual(RangeSet("10-19").first(5), RangeSet("10-14"))
+ self.assertEqual(RangeSet("10-19").first(15), RangeSet("10-19"))
+ self.assertEqual(RangeSet("10-19 30-39").first(3), RangeSet("10-12"))
+ self.assertEqual(RangeSet("10-19 30-39").first(15),
+ RangeSet("10-19 30-34"))
+ self.assertEqual(RangeSet("10-19 30-39").first(30),
+ RangeSet("10-19 30-39"))
+ self.assertEqual(RangeSet("0-9").first(0), RangeSet(""))
+
+ def test_extend(self):
+ self.assertEqual(RangeSet("0-9").extend(1), RangeSet("0-10"))
+ self.assertEqual(RangeSet("10-19").extend(15), RangeSet("0-34"))
+ self.assertEqual(RangeSet("10-19 30-39").extend(4), RangeSet("6-23 26-43"))
+ self.assertEqual(RangeSet("10-19 30-39").extend(10), RangeSet("0-49"))
+
+ def test_equality(self):
+ self.assertTrue(RangeSet("") == RangeSet(""))
+ self.assertTrue(RangeSet("3") == RangeSet("3"))
+ self.assertTrue(RangeSet("3 5") == RangeSet("5 3"))
+ self.assertTrue(
+ RangeSet("10-19 30-39") == RangeSet("30-32 10-14 33-39 15-19"))
+ self.assertTrue(RangeSet("") != RangeSet("3"))
+ self.assertTrue(RangeSet("10-19") != RangeSet("10-19 20"))
+
+ self.assertFalse(RangeSet(""))
+ self.assertTrue(RangeSet("3"))
+
+ def test_init(self):
+ self.assertIsNotNone(RangeSet(""))
+ self.assertIsNotNone(RangeSet("3"))
+ self.assertIsNotNone(RangeSet("3 5"))
+ self.assertIsNotNone(RangeSet("10 19 30-39"))
+
+ with self.assertRaises(AssertionError):
+ RangeSet(data=[0])
+
+ def test_str(self):
+ self.assertEqual(str(RangeSet("0-9")), "0-9")
+ self.assertEqual(str(RangeSet("2-10 12")), "2-10 12")
+ self.assertEqual(str(RangeSet("11 2-10 12 1 0")), "0-12")
+ self.assertEqual(str(RangeSet("")), "empty")
+
+ def test_to_string_raw(self):
+ self.assertEqual(RangeSet("0-9").to_string_raw(), "2,0,10")
+ self.assertEqual(RangeSet("2-10 12").to_string_raw(), "4,2,11,12,13")
+ self.assertEqual(RangeSet("11 2-10 12 1 0").to_string_raw(), "2,0,13")
+
+ with self.assertRaises(AssertionError):
+ RangeSet("").to_string_raw()
+
+ def test_monotonic(self):
+ self.assertTrue(RangeSet("0-9").monotonic)
+ self.assertTrue(RangeSet("2-9").monotonic)
+ self.assertTrue(RangeSet("2-9 30 31 35").monotonic)
+ self.assertTrue(RangeSet("").monotonic)
+ self.assertTrue(RangeSet("0-4 5-9").monotonic)
+ self.assertFalse(RangeSet("5-9 0-4").monotonic)
+
+ self.assertTrue(RangeSet(data=[0, 10]).monotonic)
+ self.assertTrue(RangeSet(data=[0, 10, 15, 20]).monotonic)
+ self.assertTrue(RangeSet(data=[2, 9, 30, 31, 31, 32, 35, 36]).monotonic)
+ self.assertTrue(RangeSet(data=[0, 5, 5, 10]).monotonic)
+ self.assertFalse(RangeSet(data=[5, 10, 0, 5]).monotonic)
diff --git a/tools/signapk/Android.mk b/tools/signapk/Android.mk
index 620ccb1..c2cf572 100644
--- a/tools/signapk/Android.mk
+++ b/tools/signapk/Android.mk
@@ -19,13 +19,18 @@
# ============================================================
include $(CLEAR_VARS)
LOCAL_MODULE := signapk
-LOCAL_SRC_FILES := SignApk.java
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_JAR_MANIFEST := SignApk.mf
-LOCAL_STATIC_JAVA_LIBRARIES := bouncycastle-host bouncycastle-bcpkix-host
+LOCAL_STATIC_JAVA_LIBRARIES := bouncycastle-host bouncycastle-bcpkix-host conscrypt-host
+LOCAL_REQUIRED_MODULES := libconscrypt_openjdk_jni
include $(BUILD_HOST_JAVA_LIBRARY)
ifeq ($(TARGET_BUILD_APPS),)
-# The post-build signing tools need signapk.jar, but we don't
-# need this if we're just doing unbundled apps.
-$(call dist-for-goals,droidcore,$(LOCAL_INSTALLED_MODULE))
+# The post-build signing tools need signapk.jar and its shared libraries,
+# but we don't need this if we're just doing unbundled apps.
+my_dist_files := $(LOCAL_INSTALLED_MODULE) \
+ $(HOST_OUT_SHARED_LIBRARIES)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX)
+
+$(call dist-for-goals,droidcore,$(my_dist_files))
+my_dist_files :=
endif
diff --git a/tools/signapk/src/com/android/signapk/ApkSignerV2.java b/tools/signapk/src/com/android/signapk/ApkSignerV2.java
new file mode 100644
index 0000000..ee5e72e
--- /dev/null
+++ b/tools/signapk/src/com/android/signapk/ApkSignerV2.java
@@ -0,0 +1,730 @@
+/*
+ * Copyright (C) 2016 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.signapk;
+
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.security.DigestException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.KeyFactory;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.Signature;
+import java.security.SignatureException;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.X509Certificate;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.MGF1ParameterSpec;
+import java.security.spec.PSSParameterSpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * APK Signature Scheme v2 signer.
+ *
+ * <p>APK Signature Scheme v2 is a whole-file signature scheme which aims to protect every single
+ * bit of the APK, as opposed to the JAR Signature Scheme which protects only the names and
+ * uncompressed contents of ZIP entries.
+ */
+public abstract class ApkSignerV2 {
+ /*
+ * The two main goals of APK Signature Scheme v2 are:
+ * 1. Detect any unauthorized modifications to the APK. This is achieved by making the signature
+ * cover every byte of the APK being signed.
+ * 2. Enable much faster signature and integrity verification. This is achieved by requiring
+ * only a minimal amount of APK parsing before the signature is verified, thus completely
+ * bypassing ZIP entry decompression and by making integrity verification parallelizable by
+ * employing a hash tree.
+ *
+ * The generated signature block is wrapped into an APK Signing Block and inserted into the
+ * original APK immediately before the start of ZIP Central Directory. This is to ensure that
+ * JAR and ZIP parsers continue to work on the signed APK. The APK Signing Block is designed for
+ * extensibility. For example, a future signature scheme could insert its signatures there as
+ * well. The contract of the APK Signing Block is that all contents outside of the block must be
+ * protected by signatures inside the block.
+ */
+
+ public static final int SIGNATURE_RSA_PSS_WITH_SHA256 = 0x0101;
+ public static final int SIGNATURE_RSA_PSS_WITH_SHA512 = 0x0102;
+ public static final int SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA256 = 0x0103;
+ public static final int SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512 = 0x0104;
+ public static final int SIGNATURE_ECDSA_WITH_SHA256 = 0x0201;
+ public static final int SIGNATURE_ECDSA_WITH_SHA512 = 0x0202;
+ public static final int SIGNATURE_DSA_WITH_SHA256 = 0x0301;
+ public static final int SIGNATURE_DSA_WITH_SHA512 = 0x0302;
+
+ /**
+ * {@code .SF} file header section attribute indicating that the APK is signed not just with
+ * JAR signature scheme but also with APK Signature Scheme v2 or newer. This attribute
+ * facilitates v2 signature stripping detection.
+ *
+ * <p>The attribute contains a comma-separated set of signature scheme IDs.
+ */
+ public static final String SF_ATTRIBUTE_ANDROID_APK_SIGNED_NAME = "X-Android-APK-Signed";
+ // TODO: Adjust the value when signing scheme finalized.
+ public static final String SF_ATTRIBUTE_ANDROID_APK_SIGNED_VALUE = "1234567890";
+
+ private static final int CONTENT_DIGEST_CHUNKED_SHA256 = 0;
+ private static final int CONTENT_DIGEST_CHUNKED_SHA512 = 1;
+
+ private static final int CONTENT_DIGESTED_CHUNK_MAX_SIZE_BYTES = 1024 * 1024;
+
+ private static final byte[] APK_SIGNING_BLOCK_MAGIC =
+ new byte[] {
+ 0x41, 0x50, 0x4b, 0x20, 0x53, 0x69, 0x67, 0x20,
+ 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x34, 0x32,
+ };
+ private static final int APK_SIGNATURE_SCHEME_V2_BLOCK_ID = 0x7109871a;
+
+ private ApkSignerV2() {}
+
+ /**
+ * Signer configuration.
+ */
+ public static final class SignerConfig {
+ /** Private key. */
+ public PrivateKey privateKey;
+
+ /**
+ * Certificates, with the first certificate containing the public key corresponding to
+ * {@link #privateKey}.
+ */
+ public List<X509Certificate> certificates;
+
+ /**
+ * List of signature algorithms with which to sign (see {@code SIGNATURE_...} constants).
+ */
+ public List<Integer> signatureAlgorithms;
+ }
+
+ /**
+ * Signs the provided APK using APK Signature Scheme v2 and returns the signed APK as a list of
+ * consecutive chunks.
+ *
+ * <p>NOTE: To enable APK signature verifier to detect v2 signature stripping, header sections
+ * of META-INF/*.SF files of APK being signed must contain the
+ * {@code X-Android-APK-Signed: true} attribute.
+ *
+ * @param inputApk contents of the APK to be signed. The APK starts at the current position
+ * of the buffer and ends at the limit of the buffer.
+ * @param signerConfigs signer configurations, one for each signer.
+ *
+ * @throws ApkParseException if the APK cannot be parsed.
+ * @throws InvalidKeyException if a signing key is not suitable for this signature scheme or
+ * cannot be used in general.
+ * @throws SignatureException if an error occurs when computing digests of generating
+ * signatures.
+ */
+ public static ByteBuffer[] sign(
+ ByteBuffer inputApk,
+ List<SignerConfig> signerConfigs)
+ throws ApkParseException, InvalidKeyException, SignatureException {
+ // Slice/create a view in the inputApk to make sure that:
+ // 1. inputApk is what's between position and limit of the original inputApk, and
+ // 2. changes to position, limit, and byte order are not reflected in the original.
+ ByteBuffer originalInputApk = inputApk;
+ inputApk = originalInputApk.slice();
+ inputApk.order(ByteOrder.LITTLE_ENDIAN);
+
+ // Locate ZIP End of Central Directory (EoCD), Central Directory, and check that Central
+ // Directory is immediately followed by the ZIP End of Central Directory.
+ int eocdOffset = ZipUtils.findZipEndOfCentralDirectoryRecord(inputApk);
+ if (eocdOffset == -1) {
+ throw new ApkParseException("Failed to locate ZIP End of Central Directory");
+ }
+ if (ZipUtils.isZip64EndOfCentralDirectoryLocatorPresent(inputApk, eocdOffset)) {
+ throw new ApkParseException("ZIP64 format not supported");
+ }
+ inputApk.position(eocdOffset);
+ long centralDirSizeLong = ZipUtils.getZipEocdCentralDirectorySizeBytes(inputApk);
+ if (centralDirSizeLong > Integer.MAX_VALUE) {
+ throw new ApkParseException(
+ "ZIP Central Directory size out of range: " + centralDirSizeLong);
+ }
+ int centralDirSize = (int) centralDirSizeLong;
+ long centralDirOffsetLong = ZipUtils.getZipEocdCentralDirectoryOffset(inputApk);
+ if (centralDirOffsetLong > Integer.MAX_VALUE) {
+ throw new ApkParseException(
+ "ZIP Central Directory offset in file out of range: " + centralDirOffsetLong);
+ }
+ int centralDirOffset = (int) centralDirOffsetLong;
+ int expectedEocdOffset = centralDirOffset + centralDirSize;
+ if (expectedEocdOffset < centralDirOffset) {
+ throw new ApkParseException(
+ "ZIP Central Directory extent too large. Offset: " + centralDirOffset
+ + ", size: " + centralDirSize);
+ }
+ if (eocdOffset != expectedEocdOffset) {
+ throw new ApkParseException(
+ "ZIP Central Directory not immeiately followed by ZIP End of"
+ + " Central Directory. CD end: " + expectedEocdOffset
+ + ", EoCD start: " + eocdOffset);
+ }
+
+ // Create ByteBuffers holding the contents of everything before ZIP Central Directory,
+ // ZIP Central Directory, and ZIP End of Central Directory.
+ inputApk.clear();
+ ByteBuffer beforeCentralDir = getByteBuffer(inputApk, centralDirOffset);
+ ByteBuffer centralDir = getByteBuffer(inputApk, eocdOffset - centralDirOffset);
+ // Create a copy of End of Central Directory because we'll need modify its contents later.
+ byte[] eocdBytes = new byte[inputApk.remaining()];
+ inputApk.get(eocdBytes);
+ ByteBuffer eocd = ByteBuffer.wrap(eocdBytes);
+ eocd.order(inputApk.order());
+
+ // Figure which which digests to use for APK contents.
+ Set<Integer> contentDigestAlgorithms = new HashSet<>();
+ for (SignerConfig signerConfig : signerConfigs) {
+ for (int signatureAlgorithm : signerConfig.signatureAlgorithms) {
+ contentDigestAlgorithms.add(
+ getSignatureAlgorithmContentDigestAlgorithm(signatureAlgorithm));
+ }
+ }
+
+ // Compute digests of APK contents.
+ Map<Integer, byte[]> contentDigests; // digest algorithm ID -> digest
+ try {
+ contentDigests =
+ computeContentDigests(
+ contentDigestAlgorithms,
+ new ByteBuffer[] {beforeCentralDir, centralDir, eocd});
+ } catch (DigestException e) {
+ throw new SignatureException("Failed to compute digests of APK", e);
+ }
+
+ // Sign the digests and wrap the signatures and signer info into an APK Signing Block.
+ ByteBuffer apkSigningBlock =
+ ByteBuffer.wrap(generateApkSigningBlock(signerConfigs, contentDigests));
+
+ // Update Central Directory Offset in End of Central Directory Record. Central Directory
+ // follows the APK Signing Block and thus is shifted by the size of the APK Signing Block.
+ centralDirOffset += apkSigningBlock.remaining();
+ eocd.clear();
+ ZipUtils.setZipEocdCentralDirectoryOffset(eocd, centralDirOffset);
+
+ // Follow the Java NIO pattern for ByteBuffer whose contents have been consumed.
+ originalInputApk.position(originalInputApk.limit());
+
+ // Reset positions (to 0) and limits (to capacity) in the ByteBuffers below to follow the
+ // Java NIO pattern for ByteBuffers which are ready for their contents to be read by caller.
+ // Contrary to the name, this does not clear the contents of these ByteBuffer.
+ beforeCentralDir.clear();
+ centralDir.clear();
+ eocd.clear();
+
+ // Insert APK Signing Block immediately before the ZIP Central Directory.
+ return new ByteBuffer[] {
+ beforeCentralDir,
+ apkSigningBlock,
+ centralDir,
+ eocd,
+ };
+ }
+
+ private static Map<Integer, byte[]> computeContentDigests(
+ Set<Integer> digestAlgorithms,
+ ByteBuffer[] contents) throws DigestException {
+ // For each digest algorithm the result is computed as follows:
+ // 1. Each segment of contents is split into consecutive chunks of 1 MB in size.
+ // The final chunk will be shorter iff the length of segment is not a multiple of 1 MB.
+ // No chunks are produced for empty (zero length) segments.
+ // 2. The digest of each chunk is computed over the concatenation of byte 0xa5, the chunk's
+ // length in bytes (uint32 little-endian) and the chunk's contents.
+ // 3. The output digest is computed over the concatenation of the byte 0x5a, the number of
+ // chunks (uint32 little-endian) and the concatenation of digests of chunks of all
+ // segments in-order.
+
+ int chunkCount = 0;
+ for (ByteBuffer input : contents) {
+ chunkCount += getChunkCount(input.remaining(), CONTENT_DIGESTED_CHUNK_MAX_SIZE_BYTES);
+ }
+
+ final Map<Integer, byte[]> digestsOfChunks = new HashMap<>(digestAlgorithms.size());
+ for (int digestAlgorithm : digestAlgorithms) {
+ int digestOutputSizeBytes = getContentDigestAlgorithmOutputSizeBytes(digestAlgorithm);
+ byte[] concatenationOfChunkCountAndChunkDigests =
+ new byte[5 + chunkCount * digestOutputSizeBytes];
+ concatenationOfChunkCountAndChunkDigests[0] = 0x5a;
+ setUnsignedInt32LittleEngian(
+ chunkCount, concatenationOfChunkCountAndChunkDigests, 1);
+ digestsOfChunks.put(digestAlgorithm, concatenationOfChunkCountAndChunkDigests);
+ }
+
+ int chunkIndex = 0;
+ byte[] chunkContentPrefix = new byte[5];
+ chunkContentPrefix[0] = (byte) 0xa5;
+ // Optimization opportunity: digests of chunks can be computed in parallel.
+ for (ByteBuffer input : contents) {
+ while (input.hasRemaining()) {
+ int chunkSize =
+ Math.min(input.remaining(), CONTENT_DIGESTED_CHUNK_MAX_SIZE_BYTES);
+ final ByteBuffer chunk = getByteBuffer(input, chunkSize);
+ for (int digestAlgorithm : digestAlgorithms) {
+ String jcaAlgorithmName =
+ getContentDigestAlgorithmJcaDigestAlgorithm(digestAlgorithm);
+ MessageDigest md;
+ try {
+ md = MessageDigest.getInstance(jcaAlgorithmName);
+ } catch (NoSuchAlgorithmException e) {
+ throw new DigestException(
+ jcaAlgorithmName + " MessageDigest not supported", e);
+ }
+ // Reset position to 0 and limit to capacity. Position would've been modified
+ // by the preceding iteration of this loop. NOTE: Contrary to the method name,
+ // this does not modify the contents of the chunk.
+ chunk.clear();
+ setUnsignedInt32LittleEngian(chunk.remaining(), chunkContentPrefix, 1);
+ md.update(chunkContentPrefix);
+ md.update(chunk);
+ byte[] concatenationOfChunkCountAndChunkDigests =
+ digestsOfChunks.get(digestAlgorithm);
+ int expectedDigestSizeBytes =
+ getContentDigestAlgorithmOutputSizeBytes(digestAlgorithm);
+ int actualDigestSizeBytes =
+ md.digest(
+ concatenationOfChunkCountAndChunkDigests,
+ 5 + chunkIndex * expectedDigestSizeBytes,
+ expectedDigestSizeBytes);
+ if (actualDigestSizeBytes != expectedDigestSizeBytes) {
+ throw new DigestException(
+ "Unexpected output size of " + md.getAlgorithm()
+ + " digest: " + actualDigestSizeBytes);
+ }
+ }
+ chunkIndex++;
+ }
+ }
+
+ Map<Integer, byte[]> result = new HashMap<>(digestAlgorithms.size());
+ for (Map.Entry<Integer, byte[]> entry : digestsOfChunks.entrySet()) {
+ int digestAlgorithm = entry.getKey();
+ byte[] concatenationOfChunkCountAndChunkDigests = entry.getValue();
+ String jcaAlgorithmName = getContentDigestAlgorithmJcaDigestAlgorithm(digestAlgorithm);
+ MessageDigest md;
+ try {
+ md = MessageDigest.getInstance(jcaAlgorithmName);
+ } catch (NoSuchAlgorithmException e) {
+ throw new DigestException(jcaAlgorithmName + " MessageDigest not supported", e);
+ }
+ result.put(digestAlgorithm, md.digest(concatenationOfChunkCountAndChunkDigests));
+ }
+ return result;
+ }
+
+ private static final int getChunkCount(int inputSize, int chunkSize) {
+ return (inputSize + chunkSize - 1) / chunkSize;
+ }
+
+ private static void setUnsignedInt32LittleEngian(int value, byte[] result, int offset) {
+ result[offset] = (byte) (value & 0xff);
+ result[offset + 1] = (byte) ((value >> 8) & 0xff);
+ result[offset + 2] = (byte) ((value >> 16) & 0xff);
+ result[offset + 3] = (byte) ((value >> 24) & 0xff);
+ }
+
+ private static byte[] generateApkSigningBlock(
+ List<SignerConfig> signerConfigs,
+ Map<Integer, byte[]> contentDigests) throws InvalidKeyException, SignatureException {
+ byte[] apkSignatureSchemeV2Block =
+ generateApkSignatureSchemeV2Block(signerConfigs, contentDigests);
+ return generateApkSigningBlock(apkSignatureSchemeV2Block);
+ }
+
+ private static byte[] generateApkSigningBlock(byte[] apkSignatureSchemeV2Block) {
+ // FORMAT:
+ // uint64: size (excluding this field)
+ // repeated ID-value pairs:
+ // uint64: size (excluding this field)
+ // uint32: ID
+ // (size - 4) bytes: value
+ // uint64: size (same as the one above)
+ // uint128: magic
+
+ int resultSize =
+ 8 // size
+ + 8 + 4 + apkSignatureSchemeV2Block.length // v2Block as ID-value pair
+ + 8 // size
+ + 16 // magic
+ ;
+ ByteBuffer result = ByteBuffer.allocate(resultSize);
+ result.order(ByteOrder.LITTLE_ENDIAN);
+ long blockSizeFieldValue = resultSize - 8;
+ result.putLong(blockSizeFieldValue);
+
+ long pairSizeFieldValue = 4 + apkSignatureSchemeV2Block.length;
+ result.putLong(pairSizeFieldValue);
+ result.putInt(APK_SIGNATURE_SCHEME_V2_BLOCK_ID);
+ result.put(apkSignatureSchemeV2Block);
+
+ result.putLong(blockSizeFieldValue);
+ result.put(APK_SIGNING_BLOCK_MAGIC);
+
+ return result.array();
+ }
+
+ private static byte[] generateApkSignatureSchemeV2Block(
+ List<SignerConfig> signerConfigs,
+ Map<Integer, byte[]> contentDigests) throws InvalidKeyException, SignatureException {
+ // FORMAT:
+ // * length-prefixed sequence of length-prefixed signer blocks.
+
+ List<byte[]> signerBlocks = new ArrayList<>(signerConfigs.size());
+ int signerNumber = 0;
+ for (SignerConfig signerConfig : signerConfigs) {
+ signerNumber++;
+ byte[] signerBlock;
+ try {
+ signerBlock = generateSignerBlock(signerConfig, contentDigests);
+ } catch (InvalidKeyException e) {
+ throw new InvalidKeyException("Signer #" + signerNumber + " failed", e);
+ } catch (SignatureException e) {
+ throw new SignatureException("Signer #" + signerNumber + " failed", e);
+ }
+ signerBlocks.add(signerBlock);
+ }
+
+ return encodeAsSequenceOfLengthPrefixedElements(
+ new byte[][] {
+ encodeAsSequenceOfLengthPrefixedElements(signerBlocks),
+ });
+ }
+
+ private static byte[] generateSignerBlock(
+ SignerConfig signerConfig,
+ Map<Integer, byte[]> contentDigests) throws InvalidKeyException, SignatureException {
+ if (signerConfig.certificates.isEmpty()) {
+ throw new SignatureException("No certificates configured for signer");
+ }
+ PublicKey publicKey = signerConfig.certificates.get(0).getPublicKey();
+
+ byte[] encodedPublicKey = encodePublicKey(publicKey);
+
+ V2SignatureSchemeBlock.SignedData signedData = new V2SignatureSchemeBlock.SignedData();
+ try {
+ signedData.certificates = encodeCertificates(signerConfig.certificates);
+ } catch (CertificateEncodingException e) {
+ throw new SignatureException("Failed to encode certificates", e);
+ }
+
+ List<Pair<Integer, byte[]>> digests =
+ new ArrayList<>(signerConfig.signatureAlgorithms.size());
+ for (int signatureAlgorithm : signerConfig.signatureAlgorithms) {
+ int contentDigestAlgorithm =
+ getSignatureAlgorithmContentDigestAlgorithm(signatureAlgorithm);
+ byte[] contentDigest = contentDigests.get(contentDigestAlgorithm);
+ if (contentDigest == null) {
+ throw new RuntimeException(
+ getContentDigestAlgorithmJcaDigestAlgorithm(contentDigestAlgorithm)
+ + " content digest for "
+ + getSignatureAlgorithmJcaSignatureAlgorithm(signatureAlgorithm)
+ + " not computed");
+ }
+ digests.add(Pair.create(signatureAlgorithm, contentDigest));
+ }
+ signedData.digests = digests;
+
+ V2SignatureSchemeBlock.Signer signer = new V2SignatureSchemeBlock.Signer();
+ // FORMAT:
+ // * length-prefixed sequence of length-prefixed digests:
+ // * uint32: signature algorithm ID
+ // * length-prefixed bytes: digest of contents
+ // * length-prefixed sequence of certificates:
+ // * length-prefixed bytes: X.509 certificate (ASN.1 DER encoded).
+ // * length-prefixed sequence of length-prefixed additional attributes:
+ // * uint32: ID
+ // * (length - 4) bytes: value
+ signer.signedData = encodeAsSequenceOfLengthPrefixedElements(new byte[][] {
+ encodeAsSequenceOfLengthPrefixedPairsOfIntAndLengthPrefixedBytes(signedData.digests),
+ encodeAsSequenceOfLengthPrefixedElements(signedData.certificates),
+ // additional attributes
+ new byte[0],
+ });
+ signer.publicKey = encodedPublicKey;
+ signer.signatures = new ArrayList<>();
+ for (int signatureAlgorithm : signerConfig.signatureAlgorithms) {
+ Pair<String, ? extends AlgorithmParameterSpec> signatureParams =
+ getSignatureAlgorithmJcaSignatureAlgorithm(signatureAlgorithm);
+ String jcaSignatureAlgorithm = signatureParams.getFirst();
+ AlgorithmParameterSpec jcaSignatureAlgorithmParams = signatureParams.getSecond();
+ byte[] signatureBytes;
+ try {
+ Signature signature = Signature.getInstance(jcaSignatureAlgorithm);
+ signature.initSign(signerConfig.privateKey);
+ if (jcaSignatureAlgorithmParams != null) {
+ signature.setParameter(jcaSignatureAlgorithmParams);
+ }
+ signature.update(signer.signedData);
+ signatureBytes = signature.sign();
+ } catch (InvalidKeyException e) {
+ throw new InvalidKeyException("Failed sign using " + jcaSignatureAlgorithm, e);
+ } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException
+ | SignatureException e) {
+ throw new SignatureException("Failed sign using " + jcaSignatureAlgorithm, e);
+ }
+
+ try {
+ Signature signature = Signature.getInstance(jcaSignatureAlgorithm);
+ signature.initVerify(publicKey);
+ if (jcaSignatureAlgorithmParams != null) {
+ signature.setParameter(jcaSignatureAlgorithmParams);
+ }
+ signature.update(signer.signedData);
+ if (!signature.verify(signatureBytes)) {
+ throw new SignatureException("Signature did not verify");
+ }
+ } catch (InvalidKeyException e) {
+ throw new InvalidKeyException("Failed to verify generated " + jcaSignatureAlgorithm
+ + " signature using public key from certificate", e);
+ } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException
+ | SignatureException e) {
+ throw new SignatureException("Failed to verify generated " + jcaSignatureAlgorithm
+ + " signature using public key from certificate", e);
+ }
+
+ signer.signatures.add(Pair.create(signatureAlgorithm, signatureBytes));
+ }
+
+ // FORMAT:
+ // * length-prefixed signed data
+ // * length-prefixed sequence of length-prefixed signatures:
+ // * uint32: signature algorithm ID
+ // * length-prefixed bytes: signature of signed data
+ // * length-prefixed bytes: public key (X.509 SubjectPublicKeyInfo, ASN.1 DER encoded)
+ return encodeAsSequenceOfLengthPrefixedElements(
+ new byte[][] {
+ signer.signedData,
+ encodeAsSequenceOfLengthPrefixedPairsOfIntAndLengthPrefixedBytes(
+ signer.signatures),
+ signer.publicKey,
+ });
+ }
+
+ private static final class V2SignatureSchemeBlock {
+ private static final class Signer {
+ public byte[] signedData;
+ public List<Pair<Integer, byte[]>> signatures;
+ public byte[] publicKey;
+ }
+
+ private static final class SignedData {
+ public List<Pair<Integer, byte[]>> digests;
+ public List<byte[]> certificates;
+ }
+ }
+
+ private static byte[] encodePublicKey(PublicKey publicKey) throws InvalidKeyException {
+ byte[] encodedPublicKey = null;
+ if ("X.509".equals(publicKey.getFormat())) {
+ encodedPublicKey = publicKey.getEncoded();
+ }
+ if (encodedPublicKey == null) {
+ try {
+ encodedPublicKey =
+ KeyFactory.getInstance(publicKey.getAlgorithm())
+ .getKeySpec(publicKey, X509EncodedKeySpec.class)
+ .getEncoded();
+ } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
+ throw new InvalidKeyException(
+ "Failed to obtain X.509 encoded form of public key " + publicKey
+ + " of class " + publicKey.getClass().getName(),
+ e);
+ }
+ }
+ if ((encodedPublicKey == null) || (encodedPublicKey.length == 0)) {
+ throw new InvalidKeyException(
+ "Failed to obtain X.509 encoded form of public key " + publicKey
+ + " of class " + publicKey.getClass().getName());
+ }
+ return encodedPublicKey;
+ }
+
+ public static List<byte[]> encodeCertificates(List<X509Certificate> certificates)
+ throws CertificateEncodingException {
+ List<byte[]> result = new ArrayList<>();
+ for (X509Certificate certificate : certificates) {
+ result.add(certificate.getEncoded());
+ }
+ return result;
+ }
+
+ private static byte[] encodeAsSequenceOfLengthPrefixedElements(List<byte[]> sequence) {
+ return encodeAsSequenceOfLengthPrefixedElements(
+ sequence.toArray(new byte[sequence.size()][]));
+ }
+
+ private static byte[] encodeAsSequenceOfLengthPrefixedElements(byte[][] sequence) {
+ int payloadSize = 0;
+ for (byte[] element : sequence) {
+ payloadSize += 4 + element.length;
+ }
+ ByteBuffer result = ByteBuffer.allocate(payloadSize);
+ result.order(ByteOrder.LITTLE_ENDIAN);
+ for (byte[] element : sequence) {
+ result.putInt(element.length);
+ result.put(element);
+ }
+ return result.array();
+ }
+
+ private static byte[] encodeAsSequenceOfLengthPrefixedPairsOfIntAndLengthPrefixedBytes(
+ List<Pair<Integer, byte[]>> sequence) {
+ int resultSize = 0;
+ for (Pair<Integer, byte[]> element : sequence) {
+ resultSize += 12 + element.getSecond().length;
+ }
+ ByteBuffer result = ByteBuffer.allocate(resultSize);
+ result.order(ByteOrder.LITTLE_ENDIAN);
+ for (Pair<Integer, byte[]> element : sequence) {
+ byte[] second = element.getSecond();
+ result.putInt(8 + second.length);
+ result.putInt(element.getFirst());
+ result.putInt(second.length);
+ result.put(second);
+ }
+ return result.array();
+ }
+
+ /**
+ * Relative <em>get</em> method for reading {@code size} number of bytes from the current
+ * position of this buffer.
+ *
+ * <p>This method reads the next {@code size} bytes at this buffer's current position,
+ * returning them as a {@code ByteBuffer} with start set to 0, limit and capacity set to
+ * {@code size}, byte order set to this buffer's byte order; and then increments the position by
+ * {@code size}.
+ */
+ private static ByteBuffer getByteBuffer(ByteBuffer source, int size) {
+ if (size < 0) {
+ throw new IllegalArgumentException("size: " + size);
+ }
+ int originalLimit = source.limit();
+ int position = source.position();
+ int limit = position + size;
+ if ((limit < position) || (limit > originalLimit)) {
+ throw new BufferUnderflowException();
+ }
+ source.limit(limit);
+ try {
+ ByteBuffer result = source.slice();
+ result.order(source.order());
+ source.position(limit);
+ return result;
+ } finally {
+ source.limit(originalLimit);
+ }
+ }
+
+ private static Pair<String, ? extends AlgorithmParameterSpec>
+ getSignatureAlgorithmJcaSignatureAlgorithm(int sigAlgorithm) {
+ switch (sigAlgorithm) {
+ case SIGNATURE_RSA_PSS_WITH_SHA256:
+ return Pair.create(
+ "SHA256withRSA/PSS",
+ new PSSParameterSpec(
+ "SHA-256", "MGF1", MGF1ParameterSpec.SHA256, 256 / 8, 1));
+ case SIGNATURE_RSA_PSS_WITH_SHA512:
+ return Pair.create(
+ "SHA512withRSA/PSS",
+ new PSSParameterSpec(
+ "SHA-512", "MGF1", MGF1ParameterSpec.SHA512, 512 / 8, 1));
+ case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA256:
+ return Pair.create("SHA256withRSA", null);
+ case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512:
+ return Pair.create("SHA512withRSA", null);
+ case SIGNATURE_ECDSA_WITH_SHA256:
+ return Pair.create("SHA256withECDSA", null);
+ case SIGNATURE_ECDSA_WITH_SHA512:
+ return Pair.create("SHA512withECDSA", null);
+ case SIGNATURE_DSA_WITH_SHA256:
+ return Pair.create("SHA256withDSA", null);
+ case SIGNATURE_DSA_WITH_SHA512:
+ return Pair.create("SHA512withDSA", null);
+ default:
+ throw new IllegalArgumentException(
+ "Unknown signature algorithm: 0x"
+ + Long.toHexString(sigAlgorithm & 0xffffffff));
+ }
+ }
+
+ private static int getSignatureAlgorithmContentDigestAlgorithm(int sigAlgorithm) {
+ switch (sigAlgorithm) {
+ case SIGNATURE_RSA_PSS_WITH_SHA256:
+ case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA256:
+ case SIGNATURE_ECDSA_WITH_SHA256:
+ case SIGNATURE_DSA_WITH_SHA256:
+ return CONTENT_DIGEST_CHUNKED_SHA256;
+ case SIGNATURE_RSA_PSS_WITH_SHA512:
+ case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512:
+ case SIGNATURE_ECDSA_WITH_SHA512:
+ case SIGNATURE_DSA_WITH_SHA512:
+ return CONTENT_DIGEST_CHUNKED_SHA512;
+ default:
+ throw new IllegalArgumentException(
+ "Unknown signature algorithm: 0x"
+ + Long.toHexString(sigAlgorithm & 0xffffffff));
+ }
+ }
+
+ private static String getContentDigestAlgorithmJcaDigestAlgorithm(int digestAlgorithm) {
+ switch (digestAlgorithm) {
+ case CONTENT_DIGEST_CHUNKED_SHA256:
+ return "SHA-256";
+ case CONTENT_DIGEST_CHUNKED_SHA512:
+ return "SHA-512";
+ default:
+ throw new IllegalArgumentException(
+ "Unknown content digest algorthm: " + digestAlgorithm);
+ }
+ }
+
+ private static int getContentDigestAlgorithmOutputSizeBytes(int digestAlgorithm) {
+ switch (digestAlgorithm) {
+ case CONTENT_DIGEST_CHUNKED_SHA256:
+ return 256 / 8;
+ case CONTENT_DIGEST_CHUNKED_SHA512:
+ return 512 / 8;
+ default:
+ throw new IllegalArgumentException(
+ "Unknown content digest algorthm: " + digestAlgorithm);
+ }
+ }
+
+ /**
+ * Indicates that APK file could not be parsed.
+ */
+ public static class ApkParseException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ApkParseException(String message) {
+ super(message);
+ }
+
+ public ApkParseException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ }
+}
diff --git a/tools/signapk/src/com/android/signapk/Pair.java b/tools/signapk/src/com/android/signapk/Pair.java
new file mode 100644
index 0000000..e4a6c92
--- /dev/null
+++ b/tools/signapk/src/com/android/signapk/Pair.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2016 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.signapk;
+
+/**
+ * Pair of two elements.
+ */
+public final class Pair<A, B> {
+ private final A mFirst;
+ private final B mSecond;
+
+ private Pair(A first, B second) {
+ mFirst = first;
+ mSecond = second;
+ }
+
+ public static <A, B> Pair<A, B> create(A first, B second) {
+ return new Pair<A, B>(first, second);
+ }
+
+ public A getFirst() {
+ return mFirst;
+ }
+
+ public B getSecond() {
+ return mSecond;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((mFirst == null) ? 0 : mFirst.hashCode());
+ result = prime * result + ((mSecond == null) ? 0 : mSecond.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ @SuppressWarnings("rawtypes")
+ Pair other = (Pair) obj;
+ if (mFirst == null) {
+ if (other.mFirst != null) {
+ return false;
+ }
+ } else if (!mFirst.equals(other.mFirst)) {
+ return false;
+ }
+ if (mSecond == null) {
+ if (other.mSecond != null) {
+ return false;
+ }
+ } else if (!mSecond.equals(other.mSecond)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/tools/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java
similarity index 70%
rename from tools/signapk/SignApk.java
rename to tools/signapk/src/com/android/signapk/SignApk.java
index 88f486a..c6ed2e1 100644
--- a/tools/signapk/SignApk.java
+++ b/tools/signapk/src/com/android/signapk/SignApk.java
@@ -34,6 +34,7 @@
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;
import org.bouncycastle.util.encoders.Base64;
+import org.conscrypt.OpenSSLProvider;
import java.io.Console;
import java.io.BufferedReader;
@@ -50,13 +51,16 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.lang.reflect.Constructor;
+import java.nio.ByteBuffer;
import java.security.DigestOutputStream;
import java.security.GeneralSecurityException;
+import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyFactory;
import java.security.MessageDigest;
import java.security.PrivateKey;
import java.security.Provider;
+import java.security.PublicKey;
import java.security.Security;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateFactory;
@@ -66,6 +70,8 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
@@ -100,7 +106,8 @@
/**
* Command line tool to sign JAR files (including APKs and OTA updates) in a way
* compatible with the mincrypt verifier, using EC or RSA keys and SHA1 or
- * SHA-256 (see historical note).
+ * SHA-256 (see historical note). The tool can additionally sign APKs using
+ * APK Signature Scheme v2.
*/
class SignApk {
private static final String CERT_SF_NAME = "META-INF/CERT.SF";
@@ -110,21 +117,32 @@
private static final String OTACERT_NAME = "META-INF/com/android/otacert";
- private static Provider sBouncyCastleProvider;
-
// bitmasks for which hash algorithms we need the manifest to include.
private static final int USE_SHA1 = 1;
private static final int USE_SHA256 = 2;
+ /** Digest algorithm used when signing the APK using APK Signature Scheme v2. */
+ private static final String APK_SIG_SCHEME_V2_DIGEST_ALGORITHM = "SHA-256";
+
+ /**
+ * Minimum Android SDK API Level which accepts JAR signatures which use SHA-256. Older platform
+ * versions accept only SHA-1 signatures.
+ */
+ private static final int MIN_API_LEVEL_FOR_SHA256_JAR_SIGNATURES = 18;
+
/**
* Return one of USE_SHA1 or USE_SHA256 according to the signature
* algorithm specified in the cert.
*/
- private static int getDigestAlgorithm(X509Certificate cert) {
+ private static int getDigestAlgorithm(X509Certificate cert, int minSdkVersion) {
String sigAlg = cert.getSigAlgName().toUpperCase(Locale.US);
- if ("SHA1WITHRSA".equals(sigAlg) ||
- "MD5WITHRSA".equals(sigAlg)) { // see "HISTORICAL NOTE" above.
- return USE_SHA1;
+ if ("SHA1WITHRSA".equals(sigAlg) || "MD5WITHRSA".equals(sigAlg)) {
+ // see "HISTORICAL NOTE" above.
+ if (minSdkVersion < MIN_API_LEVEL_FOR_SHA256_JAR_SIGNATURES) {
+ return USE_SHA1;
+ } else {
+ return USE_SHA256;
+ }
} else if (sigAlg.startsWith("SHA256WITH")) {
return USE_SHA256;
} else {
@@ -134,11 +152,11 @@
}
/** Returns the expected signature algorithm for this key type. */
- private static String getSignatureAlgorithm(X509Certificate cert) {
- String sigAlg = cert.getSigAlgName().toUpperCase(Locale.US);
+ private static String getSignatureAlgorithm(X509Certificate cert, int minSdkVersion) {
String keyType = cert.getPublicKey().getAlgorithm().toUpperCase(Locale.US);
if ("RSA".equalsIgnoreCase(keyType)) {
- if (getDigestAlgorithm(cert) == USE_SHA256) {
+ if ((minSdkVersion >= MIN_API_LEVEL_FOR_SHA256_JAR_SIGNATURES)
+ || (getDigestAlgorithm(cert, minSdkVersion) == USE_SHA256)) {
return "SHA256withRSA";
} else {
return "SHA1withRSA";
@@ -167,18 +185,29 @@
}
/**
- * Reads the password from console and returns it as a string.
+ * If a console doesn't exist, reads the password from stdin
+ * If a console exists, reads the password from console and returns it as a string.
*
* @param keyFile The file containing the private key. Used to prompt the user.
*/
private static String readPassword(File keyFile) {
Console console;
char[] pwd;
- if((console = System.console()) != null &&
- (pwd = console.readPassword("[%s]", "Enter password for " + keyFile)) != null){
- return String.valueOf(pwd);
+ if ((console = System.console()) == null) {
+ System.out.print("Enter password for " + keyFile + " (password will not be hidden): ");
+ System.out.flush();
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ try {
+ return stdin.readLine();
+ } catch (IOException ex) {
+ return null;
+ }
} else {
- return null;
+ if ((pwd = console.readPassword("[%s]", "Enter password for " + keyFile)) != null) {
+ return String.valueOf(pwd);
+ } else {
+ return null;
+ }
}
}
@@ -235,8 +264,11 @@
* Now it's in a PKCS#8 PrivateKeyInfo structure. Read its Algorithm
* OID and use that to construct a KeyFactory.
*/
- ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded()));
- PrivateKeyInfo pki = PrivateKeyInfo.getInstance(bIn.readObject());
+ PrivateKeyInfo pki;
+ try (ASN1InputStream bIn =
+ new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded()))) {
+ pki = PrivateKeyInfo.getInstance(bIn.readObject());
+ }
String algOid = pki.getPrivateKeyAlgorithm().getAlgorithm().getId();
return KeyFactory.getInstance(algOid).generatePrivate(spec);
@@ -297,10 +329,24 @@
Attributes attr = null;
if (input != null) attr = input.getAttributes(name);
attr = attr != null ? new Attributes(attr) : new Attributes();
+ // Remove any previously computed digests from this entry's attributes.
+ for (Iterator<Object> i = attr.keySet().iterator(); i.hasNext();) {
+ Object key = i.next();
+ if (!(key instanceof Attributes.Name)) {
+ continue;
+ }
+ String attributeNameLowerCase =
+ ((Attributes.Name) key).toString().toLowerCase(Locale.US);
+ if (attributeNameLowerCase.endsWith("-digest")) {
+ i.remove();
+ }
+ }
+ // Add SHA-1 digest if requested
if (md_sha1 != null) {
attr.putValue("SHA1-Digest",
new String(Base64.encode(md_sha1.digest()), "ASCII"));
}
+ // Add SHA-256 digest if requested
if (md_sha256 != null) {
attr.putValue("SHA-256-Digest",
new String(Base64.encode(md_sha256.digest()), "ASCII"));
@@ -376,12 +422,22 @@
/** Write a .SF file with a digest of the specified manifest. */
private static void writeSignatureFile(Manifest manifest, OutputStream out,
- int hash)
+ int hash, boolean additionallySignedUsingAnApkSignatureScheme)
throws IOException, GeneralSecurityException {
Manifest sf = new Manifest();
Attributes main = sf.getMainAttributes();
main.putValue("Signature-Version", "1.0");
main.putValue("Created-By", "1.0 (Android SignApk)");
+ if (additionallySignedUsingAnApkSignatureScheme) {
+ // Add APK Signature Scheme v2 signature stripping protection.
+ // This attribute indicates that this APK is supposed to have been signed using one or
+ // more APK-specific signature schemes in addition to the standard JAR signature scheme
+ // used by this code. APK signature verifier should reject the APK if it does not
+ // contain a signature for the signature scheme the verifier prefers out of this set.
+ main.putValue(
+ ApkSignerV2.SF_ATTRIBUTE_ANDROID_APK_SIGNED_NAME,
+ ApkSignerV2.SF_ATTRIBUTE_ANDROID_APK_SIGNED_VALUE);
+ }
MessageDigest md = MessageDigest.getInstance(
hash == USE_SHA256 ? "SHA256" : "SHA1");
@@ -406,7 +462,7 @@
print.flush();
Attributes sfAttr = new Attributes();
- sfAttr.putValue(hash == USE_SHA256 ? "SHA-256-Digest" : "SHA1-Digest-Manifest",
+ sfAttr.putValue(hash == USE_SHA256 ? "SHA-256-Digest" : "SHA1-Digest",
new String(Base64.encode(md.digest()), "ASCII"));
sf.getEntries().put(entry.getKey(), sfAttr);
}
@@ -426,7 +482,7 @@
/** Sign data and write the digital signature to 'out'. */
private static void writeSignatureBlock(
- CMSTypedData data, X509Certificate publicKey, PrivateKey privateKey,
+ CMSTypedData data, X509Certificate publicKey, PrivateKey privateKey, int minSdkVersion,
OutputStream out)
throws IOException,
CertificateEncodingException,
@@ -437,22 +493,22 @@
JcaCertStore certs = new JcaCertStore(certList);
CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
- ContentSigner signer = new JcaContentSignerBuilder(getSignatureAlgorithm(publicKey))
- .setProvider(sBouncyCastleProvider)
- .build(privateKey);
+ ContentSigner signer =
+ new JcaContentSignerBuilder(getSignatureAlgorithm(publicKey, minSdkVersion))
+ .build(privateKey);
gen.addSignerInfoGenerator(
new JcaSignerInfoGeneratorBuilder(
new JcaDigestCalculatorProviderBuilder()
- .setProvider(sBouncyCastleProvider)
.build())
.setDirectSignature(true)
.build(signer, publicKey));
gen.addCertificates(certs);
CMSSignedData sigData = gen.generate(data, false);
- ASN1InputStream asn1 = new ASN1InputStream(sigData.getEncoded());
- DEROutputStream dos = new DEROutputStream(out);
- dos.writeObject(asn1.readObject());
+ try (ASN1InputStream asn1 = new ASN1InputStream(sigData.getEncoded())) {
+ DEROutputStream dos = new DEROutputStream(out);
+ dos.writeObject(asn1.readObject());
+ }
}
/**
@@ -462,7 +518,7 @@
* more efficient.
*/
private static void copyFiles(Manifest manifest, JarFile in, JarOutputStream out,
- long timestamp, int alignment) throws IOException {
+ long timestamp, int defaultAlignment) throws IOException {
byte[] buffer = new byte[4096];
int num;
@@ -501,6 +557,7 @@
offset += 4;
firstEntry = false;
}
+ int alignment = getStoredEntryDataAlignment(name, defaultAlignment);
if (alignment > 0 && (offset % alignment != 0)) {
// Set the "extra data" of the entry to between 1 and
// alignment-1 bytes, to make the file data begin at
@@ -541,6 +598,24 @@
}
}
+ /**
+ * Returns the multiple (in bytes) at which the provided {@code STORED} entry's data must start
+ * relative to start of file or {@code 0} if alignment of this entry's data is not important.
+ */
+ private static int getStoredEntryDataAlignment(String entryName, int defaultAlignment) {
+ if (defaultAlignment <= 0) {
+ return 0;
+ }
+
+ if (entryName.endsWith(".so")) {
+ // Align .so contents to memory page boundary to enable memory-mapped
+ // execution.
+ return 4096;
+ } else {
+ return defaultAlignment;
+ }
+ }
+
private static class WholeFileSignerOutputStream extends FilterOutputStream {
private boolean closing = false;
private ByteArrayOutputStream footer = new ByteArrayOutputStream();
@@ -601,22 +676,23 @@
}
private static class CMSSigner implements CMSTypedData {
- private JarFile inputJar;
- private File publicKeyFile;
- private X509Certificate publicKey;
- private PrivateKey privateKey;
- private String outputFile;
- private OutputStream outputStream;
+ private final JarFile inputJar;
+ private final File publicKeyFile;
+ private final X509Certificate publicKey;
+ private final PrivateKey privateKey;
+ private final int minSdkVersion;
+ private final OutputStream outputStream;
private final ASN1ObjectIdentifier type;
private WholeFileSignerOutputStream signer;
public CMSSigner(JarFile inputJar, File publicKeyFile,
- X509Certificate publicKey, PrivateKey privateKey,
+ X509Certificate publicKey, PrivateKey privateKey, int minSdkVersion,
OutputStream outputStream) {
this.inputJar = inputJar;
this.publicKeyFile = publicKeyFile;
this.publicKey = publicKey;
this.privateKey = privateKey;
+ this.minSdkVersion = minSdkVersion;
this.outputStream = outputStream;
this.type = new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId());
}
@@ -625,20 +701,23 @@
* This should actually return byte[] or something similar, but nothing
* actually checks it currently.
*/
+ @Override
public Object getContent() {
return this;
}
+ @Override
public ASN1ObjectIdentifier getContentType() {
return type;
}
+ @Override
public void write(OutputStream out) throws IOException {
try {
signer = new WholeFileSignerOutputStream(out, outputStream);
JarOutputStream outputJar = new JarOutputStream(signer);
- int hash = getDigestAlgorithm(publicKey);
+ int hash = getDigestAlgorithm(publicKey, minSdkVersion);
// Assume the certificate is valid for at least an hour.
long timestamp = publicKey.getNotBefore().getTime() + 3600L * 1000;
@@ -647,9 +726,11 @@
copyFiles(manifest, inputJar, outputJar, timestamp, 0);
addOtacert(outputJar, publicKeyFile, timestamp, manifest, hash);
- signFile(manifest, inputJar,
+ signFile(manifest,
new X509Certificate[]{ publicKey },
new PrivateKey[]{ privateKey },
+ minSdkVersion,
+ false, // Don't sign using APK Signature Scheme v2
outputJar);
signer.notifyClosing();
@@ -666,7 +747,7 @@
CertificateEncodingException,
OperatorCreationException,
CMSException {
- SignApk.writeSignatureBlock(this, publicKey, privateKey, temp);
+ SignApk.writeSignatureBlock(this, publicKey, privateKey, minSdkVersion, temp);
}
public WholeFileSignerOutputStream getSigner() {
@@ -676,9 +757,10 @@
private static void signWholeFile(JarFile inputJar, File publicKeyFile,
X509Certificate publicKey, PrivateKey privateKey,
+ int minSdkVersion,
OutputStream outputStream) throws Exception {
CMSSigner cmsOut = new CMSSigner(inputJar, publicKeyFile,
- publicKey, privateKey, outputStream);
+ publicKey, privateKey, minSdkVersion, outputStream);
ByteArrayOutputStream temp = new ByteArrayOutputStream();
@@ -742,8 +824,10 @@
temp.writeTo(outputStream);
}
- private static void signFile(Manifest manifest, JarFile inputJar,
+ private static void signFile(Manifest manifest,
X509Certificate[] publicKey, PrivateKey[] privateKey,
+ int minSdkVersion,
+ boolean additionallySignedUsingAnApkSignatureScheme,
JarOutputStream outputJar)
throws Exception {
// Assume the certificate is valid for at least an hour.
@@ -763,7 +847,11 @@
je.setTime(timestamp);
outputJar.putNextEntry(je);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- writeSignatureFile(manifest, baos, getDigestAlgorithm(publicKey[k]));
+ writeSignatureFile(
+ manifest,
+ baos,
+ getDigestAlgorithm(publicKey[k], minSdkVersion),
+ additionallySignedUsingAnApkSignatureScheme);
byte[] signedData = baos.toByteArray();
outputJar.write(signedData);
@@ -775,7 +863,7 @@
je.setTime(timestamp);
outputJar.putNextEntry(je);
writeSignatureBlock(new CMSProcessableByteArray(signedData),
- publicKey[k], privateKey[k], outputJar);
+ publicKey[k], privateKey[k], minSdkVersion, outputJar);
}
}
@@ -831,10 +919,89 @@
Security.insertProviderAt((Provider) o, 1);
}
+ /**
+ * Converts the provided lists of private keys, their X.509 certificates, and digest algorithms
+ * into a list of APK Signature Scheme v2 {@code SignerConfig} instances.
+ */
+ public static List<ApkSignerV2.SignerConfig> createV2SignerConfigs(
+ PrivateKey[] privateKeys, X509Certificate[] certificates, String[] digestAlgorithms)
+ throws InvalidKeyException {
+ if (privateKeys.length != certificates.length) {
+ throw new IllegalArgumentException(
+ "The number of private keys must match the number of certificates: "
+ + privateKeys.length + " vs" + certificates.length);
+ }
+ List<ApkSignerV2.SignerConfig> result = new ArrayList<>(privateKeys.length);
+ for (int i = 0; i < privateKeys.length; i++) {
+ PrivateKey privateKey = privateKeys[i];
+ X509Certificate certificate = certificates[i];
+ PublicKey publicKey = certificate.getPublicKey();
+ String keyAlgorithm = privateKey.getAlgorithm();
+ if (!keyAlgorithm.equalsIgnoreCase(publicKey.getAlgorithm())) {
+ throw new InvalidKeyException(
+ "Key algorithm of private key #" + (i + 1) + " does not match key"
+ + " algorithm of public key #" + (i + 1) + ": " + keyAlgorithm
+ + " vs " + publicKey.getAlgorithm());
+ }
+ ApkSignerV2.SignerConfig signerConfig = new ApkSignerV2.SignerConfig();
+ signerConfig.privateKey = privateKey;
+ signerConfig.certificates = Collections.singletonList(certificate);
+ List<Integer> signatureAlgorithms = new ArrayList<>(digestAlgorithms.length);
+ for (String digestAlgorithm : digestAlgorithms) {
+ try {
+ signatureAlgorithms.add(
+ getV2SignatureAlgorithm(keyAlgorithm, digestAlgorithm));
+ } catch (IllegalArgumentException e) {
+ throw new InvalidKeyException(
+ "Unsupported key and digest algorithm combination for signer #"
+ + (i + 1),
+ e);
+ }
+ }
+ signerConfig.signatureAlgorithms = signatureAlgorithms;
+ result.add(signerConfig);
+ }
+ return result;
+ }
+
+ private static int getV2SignatureAlgorithm(String keyAlgorithm, String digestAlgorithm) {
+ if ("SHA-256".equalsIgnoreCase(digestAlgorithm)) {
+ if ("RSA".equalsIgnoreCase(keyAlgorithm)) {
+ // Use RSASSA-PKCS1-v1_5 signature scheme instead of RSASSA-PSS to guarantee
+ // deterministic signatures which make life easier for OTA updates (fewer files
+ // changed when deterministic signature schemes are used).
+ return ApkSignerV2.SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA256;
+ } else if ("EC".equalsIgnoreCase(keyAlgorithm)) {
+ return ApkSignerV2.SIGNATURE_ECDSA_WITH_SHA256;
+ } else if ("DSA".equalsIgnoreCase(keyAlgorithm)) {
+ return ApkSignerV2.SIGNATURE_DSA_WITH_SHA256;
+ } else {
+ throw new IllegalArgumentException("Unsupported key algorithm: " + keyAlgorithm);
+ }
+ } else if ("SHA-512".equalsIgnoreCase(digestAlgorithm)) {
+ if ("RSA".equalsIgnoreCase(keyAlgorithm)) {
+ // Use RSASSA-PKCS1-v1_5 signature scheme instead of RSASSA-PSS to guarantee
+ // deterministic signatures which make life easier for OTA updates (fewer files
+ // changed when deterministic signature schemes are used).
+ return ApkSignerV2.SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512;
+ } else if ("EC".equalsIgnoreCase(keyAlgorithm)) {
+ return ApkSignerV2.SIGNATURE_ECDSA_WITH_SHA512;
+ } else if ("DSA".equalsIgnoreCase(keyAlgorithm)) {
+ return ApkSignerV2.SIGNATURE_DSA_WITH_SHA512;
+ } else {
+ throw new IllegalArgumentException("Unsupported key algorithm: " + keyAlgorithm);
+ }
+ } else {
+ throw new IllegalArgumentException("Unsupported digest algorithm: " + digestAlgorithm);
+ }
+ }
+
private static void usage() {
System.err.println("Usage: signapk [-w] " +
"[-a <alignment>] " +
"[-providerClass <className>] " +
+ "[--min-sdk-version <n>] " +
+ "[--disable-v2] " +
"publickey.x509[.pem] privatekey.pk8 " +
"[publickey2.x509[.pem] privatekey2.pk8 ...] " +
"input.jar output.jar");
@@ -844,13 +1011,19 @@
public static void main(String[] args) {
if (args.length < 4) usage();
- sBouncyCastleProvider = new BouncyCastleProvider();
- Security.addProvider(sBouncyCastleProvider);
+ // Install Conscrypt as the highest-priority provider. Its crypto primitives are faster than
+ // the standard or Bouncy Castle ones.
+ Security.insertProviderAt(new OpenSSLProvider(), 1);
+ // Install Bouncy Castle (as the lowest-priority provider) because Conscrypt does not offer
+ // DSA which may still be needed.
+ // TODO: Stop installing Bouncy Castle provider once DSA is no longer needed.
+ Security.addProvider(new BouncyCastleProvider());
boolean signWholeFile = false;
String providerClass = null;
- String providerArg = null;
int alignment = 4;
+ int minSdkVersion = 0;
+ boolean signUsingApkSignatureSchemeV2 = true;
int argstart = 0;
while (argstart < args.length && args[argstart].startsWith("-")) {
@@ -866,6 +1039,18 @@
} else if ("-a".equals(args[argstart])) {
alignment = Integer.parseInt(args[++argstart]);
++argstart;
+ } else if ("--min-sdk-version".equals(args[argstart])) {
+ String minSdkVersionString = args[++argstart];
+ try {
+ minSdkVersion = Integer.parseInt(minSdkVersionString);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException(
+ "--min-sdk-version must be a decimal number: " + minSdkVersionString);
+ }
+ ++argstart;
+ } else if ("--disable-v2".equals(args[argstart])) {
+ signUsingApkSignatureSchemeV2 = false;
+ ++argstart;
} else {
usage();
}
@@ -895,7 +1080,7 @@
for (int i = 0; i < numKeys; ++i) {
int argNum = argstart + i*2;
publicKey[i] = readPublicKey(new File(args[argNum]));
- hashes |= getDigestAlgorithm(publicKey[i]);
+ hashes |= getDigestAlgorithm(publicKey[i], minSdkVersion);
}
} catch (IllegalArgumentException e) {
System.err.println(e);
@@ -916,25 +1101,56 @@
outputFile = new FileOutputStream(outputFilename);
-
+ // NOTE: Signing currently recompresses any compressed entries using Deflate (default
+ // compression level for OTA update files and maximum compession level for APKs).
if (signWholeFile) {
SignApk.signWholeFile(inputJar, firstPublicKeyFile,
- publicKey[0], privateKey[0], outputFile);
+ publicKey[0], privateKey[0], minSdkVersion, outputFile);
} else {
- JarOutputStream outputJar = new JarOutputStream(outputFile);
-
- // For signing .apks, use the maximum compression to make
- // them as small as possible (since they live forever on
- // the system partition). For OTA packages, use the
- // default compression level, which is much much faster
- // and produces output that is only a tiny bit larger
- // (~0.1% on full OTA packages I tested).
+ // Generate, in memory, an APK signed using standard JAR Signature Scheme.
+ ByteArrayOutputStream v1SignedApkBuf = new ByteArrayOutputStream();
+ JarOutputStream outputJar = new JarOutputStream(v1SignedApkBuf);
+ // Use maximum compression for compressed entries because the APK lives forever on
+ // the system partition.
outputJar.setLevel(9);
-
Manifest manifest = addDigestsToManifest(inputJar, hashes);
copyFiles(manifest, inputJar, outputJar, timestamp, alignment);
- signFile(manifest, inputJar, publicKey, privateKey, outputJar);
+ signFile(
+ manifest,
+ publicKey, privateKey, minSdkVersion, signUsingApkSignatureSchemeV2,
+ outputJar);
outputJar.close();
+ ByteBuffer v1SignedApk = ByteBuffer.wrap(v1SignedApkBuf.toByteArray());
+ v1SignedApkBuf.reset();
+
+ ByteBuffer[] outputChunks;
+ if (signUsingApkSignatureSchemeV2) {
+ // Additionally sign the APK using the APK Signature Scheme v2.
+ ByteBuffer apkContents = v1SignedApk;
+ List<ApkSignerV2.SignerConfig> signerConfigs =
+ createV2SignerConfigs(
+ privateKey,
+ publicKey,
+ new String[] {APK_SIG_SCHEME_V2_DIGEST_ALGORITHM});
+ outputChunks = ApkSignerV2.sign(apkContents, signerConfigs);
+ } else {
+ // Output the JAR-signed APK as is.
+ outputChunks = new ByteBuffer[] {v1SignedApk};
+ }
+
+ // This assumes outputChunks are array-backed. To avoid this assumption, the
+ // code could be rewritten to use FileChannel.
+ for (ByteBuffer outputChunk : outputChunks) {
+ outputFile.write(
+ outputChunk.array(),
+ outputChunk.arrayOffset() + outputChunk.position(),
+ outputChunk.remaining());
+ outputChunk.position(outputChunk.limit());
+ }
+
+ outputFile.close();
+ outputFile = null;
+ return;
}
} catch (Exception e) {
e.printStackTrace();
diff --git a/tools/signapk/src/com/android/signapk/ZipUtils.java b/tools/signapk/src/com/android/signapk/ZipUtils.java
new file mode 100644
index 0000000..b9a17ca
--- /dev/null
+++ b/tools/signapk/src/com/android/signapk/ZipUtils.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2016 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.signapk;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Assorted ZIP format helpers.
+ *
+ * <p>NOTE: Most helper methods operating on {@code ByteBuffer} instances expect that the byte
+ * order of these buffers is little-endian.
+ */
+public abstract class ZipUtils {
+ private ZipUtils() {}
+
+ private static final int ZIP_EOCD_REC_MIN_SIZE = 22;
+ private static final int ZIP_EOCD_REC_SIG = 0x06054b50;
+ private static final int ZIP_EOCD_CENTRAL_DIR_SIZE_FIELD_OFFSET = 12;
+ private static final int ZIP_EOCD_CENTRAL_DIR_OFFSET_FIELD_OFFSET = 16;
+ private static final int ZIP_EOCD_COMMENT_LENGTH_FIELD_OFFSET = 20;
+
+ private static final int ZIP64_EOCD_LOCATOR_SIZE = 20;
+ private static final int ZIP64_EOCD_LOCATOR_SIG = 0x07064b50;
+
+ private static final int UINT32_MAX_VALUE = 0xffff;
+
+ /**
+ * Returns the position at which ZIP End of Central Directory record starts in the provided
+ * buffer or {@code -1} if the record is not present.
+ *
+ * <p>NOTE: Byte order of {@code zipContents} must be little-endian.
+ */
+ public static int findZipEndOfCentralDirectoryRecord(ByteBuffer zipContents) {
+ assertByteOrderLittleEndian(zipContents);
+
+ // ZIP End of Central Directory (EOCD) record is located at the very end of the ZIP archive.
+ // The record can be identified by its 4-byte signature/magic which is located at the very
+ // beginning of the record. A complication is that the record is variable-length because of
+ // the comment field.
+ // The algorithm for locating the ZIP EOCD record is as follows. We search backwards from
+ // end of the buffer for the EOCD record signature. Whenever we find a signature, we check
+ // the candidate record's comment length is such that the remainder of the record takes up
+ // exactly the remaining bytes in the buffer. The search is bounded because the maximum
+ // size of the comment field is 65535 bytes because the field is an unsigned 32-bit number.
+
+ int archiveSize = zipContents.capacity();
+ if (archiveSize < ZIP_EOCD_REC_MIN_SIZE) {
+ System.out.println("File size smaller than EOCD min size");
+ return -1;
+ }
+ int maxCommentLength = Math.min(archiveSize - ZIP_EOCD_REC_MIN_SIZE, UINT32_MAX_VALUE);
+ int eocdWithEmptyCommentStartPosition = archiveSize - ZIP_EOCD_REC_MIN_SIZE;
+ for (int expectedCommentLength = 0; expectedCommentLength < maxCommentLength;
+ expectedCommentLength++) {
+ int eocdStartPos = eocdWithEmptyCommentStartPosition - expectedCommentLength;
+ if (zipContents.getInt(eocdStartPos) == ZIP_EOCD_REC_SIG) {
+ int actualCommentLength =
+ getUnsignedInt16(
+ zipContents, eocdStartPos + ZIP_EOCD_COMMENT_LENGTH_FIELD_OFFSET);
+ if (actualCommentLength == expectedCommentLength) {
+ return eocdStartPos;
+ }
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Returns {@code true} if the provided buffer contains a ZIP64 End of Central Directory
+ * Locator.
+ *
+ * <p>NOTE: Byte order of {@code zipContents} must be little-endian.
+ */
+ public static final boolean isZip64EndOfCentralDirectoryLocatorPresent(
+ ByteBuffer zipContents, int zipEndOfCentralDirectoryPosition) {
+ assertByteOrderLittleEndian(zipContents);
+
+ // ZIP64 End of Central Directory Locator immediately precedes the ZIP End of Central
+ // Directory Record.
+
+ int locatorPosition = zipEndOfCentralDirectoryPosition - ZIP64_EOCD_LOCATOR_SIZE;
+ if (locatorPosition < 0) {
+ return false;
+ }
+
+ return zipContents.getInt(locatorPosition) == ZIP64_EOCD_LOCATOR_SIG;
+ }
+
+ /**
+ * Returns the offset of the start of the ZIP Central Directory in the archive.
+ *
+ * <p>NOTE: Byte order of {@code zipEndOfCentralDirectory} must be little-endian.
+ */
+ public static long getZipEocdCentralDirectoryOffset(ByteBuffer zipEndOfCentralDirectory) {
+ assertByteOrderLittleEndian(zipEndOfCentralDirectory);
+ return getUnsignedInt32(
+ zipEndOfCentralDirectory,
+ zipEndOfCentralDirectory.position() + ZIP_EOCD_CENTRAL_DIR_OFFSET_FIELD_OFFSET);
+ }
+
+ /**
+ * Sets the offset of the start of the ZIP Central Directory in the archive.
+ *
+ * <p>NOTE: Byte order of {@code zipEndOfCentralDirectory} must be little-endian.
+ */
+ public static void setZipEocdCentralDirectoryOffset(
+ ByteBuffer zipEndOfCentralDirectory, long offset) {
+ assertByteOrderLittleEndian(zipEndOfCentralDirectory);
+ setUnsignedInt32(
+ zipEndOfCentralDirectory,
+ zipEndOfCentralDirectory.position() + ZIP_EOCD_CENTRAL_DIR_OFFSET_FIELD_OFFSET,
+ offset);
+ }
+
+ /**
+ * Returns the size (in bytes) of the ZIP Central Directory.
+ *
+ * <p>NOTE: Byte order of {@code zipEndOfCentralDirectory} must be little-endian.
+ */
+ public static long getZipEocdCentralDirectorySizeBytes(ByteBuffer zipEndOfCentralDirectory) {
+ assertByteOrderLittleEndian(zipEndOfCentralDirectory);
+ return getUnsignedInt32(
+ zipEndOfCentralDirectory,
+ zipEndOfCentralDirectory.position() + ZIP_EOCD_CENTRAL_DIR_SIZE_FIELD_OFFSET);
+ }
+
+ private static void assertByteOrderLittleEndian(ByteBuffer buffer) {
+ if (buffer.order() != ByteOrder.LITTLE_ENDIAN) {
+ throw new IllegalArgumentException("ByteBuffer byte order must be little endian");
+ }
+ }
+
+ private static int getUnsignedInt16(ByteBuffer buffer, int offset) {
+ return buffer.getShort(offset) & 0xffff;
+ }
+
+ private static long getUnsignedInt32(ByteBuffer buffer, int offset) {
+ return buffer.getInt(offset) & 0xffffffffL;
+ }
+
+ private static void setUnsignedInt32(ByteBuffer buffer, int offset, long value) {
+ if ((value < 0) || (value > 0xffffffffL)) {
+ throw new IllegalArgumentException("uint32 value of out range: " + value);
+ }
+ buffer.putInt(buffer.position() + offset, (int) value);
+ }
+}
diff --git a/tools/zipalign/Android.mk b/tools/zipalign/Android.mk
index 4194f81..8c0240a 100644
--- a/tools/zipalign/Android.mk
+++ b/tools/zipalign/Android.mk
@@ -22,20 +22,17 @@
liblog \
libzopfli
-ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -lrt
-endif
+LOCAL_LDLIBS_linux += -lrt
-ifdef USE_MINGW
-LOCAL_STATIC_LIBRARIES += libz
-else
-LOCAL_LDLIBS += -lz
-endif
+LOCAL_STATIC_LIBRARIES_windows += libz
+LOCAL_LDLIBS_linux += -lz
+LOCAL_LDLIBS_darwin += -lz
ifneq ($(strip $(BUILD_HOST_static)),)
LOCAL_LDLIBS += -lpthread
endif # BUILD_HOST_static
LOCAL_MODULE := zipalign
+LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp
index b2270cb..a13b8d1 100644
--- a/tools/zipalign/ZipEntry.cpp
+++ b/tools/zipalign/ZipEntry.cpp
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
+#include <inttypes.h>
using namespace android;
@@ -56,7 +57,7 @@
/* using the info in the CDE, go load up the LFH */
posn = ftell(fp);
if (fseek(fp, mCDE.mLocalHeaderRelOffset, SEEK_SET) != 0) {
- ALOGD("local header seek failed (%ld)\n",
+ ALOGD("local header seek failed (%" PRIu32 ")\n",
mCDE.mLocalHeaderRelOffset);
return UNKNOWN_ERROR;
}
@@ -123,12 +124,12 @@
mCDE.mExternalAttrs = 0x81b60020; // matches what WinZip does
if (mCDE.mFileNameLength > 0) {
- mCDE.mFileName = new unsigned char[mCDE.mFileNameLength+1];
+ mCDE.mFileName = new uint8_t[mCDE.mFileNameLength+1];
strcpy((char*) mCDE.mFileName, fileName);
}
if (mCDE.mFileCommentLength > 0) {
/* TODO: stop assuming null-terminated ASCII here? */
- mCDE.mFileComment = new unsigned char[mCDE.mFileCommentLength+1];
+ mCDE.mFileComment = new uint8_t[mCDE.mFileCommentLength+1];
strcpy((char*) mCDE.mFileComment, comment);
}
@@ -150,20 +151,20 @@
memcpy(&mCDE, &pEntry->mCDE, sizeof(mCDE));
if (mCDE.mFileNameLength > 0) {
- mCDE.mFileName = new unsigned char[mCDE.mFileNameLength+1];
+ mCDE.mFileName = new uint8_t[mCDE.mFileNameLength+1];
if (mCDE.mFileName == NULL)
return NO_MEMORY;
strcpy((char*) mCDE.mFileName, (char*)pEntry->mCDE.mFileName);
}
if (mCDE.mFileCommentLength > 0) {
- mCDE.mFileComment = new unsigned char[mCDE.mFileCommentLength+1];
+ mCDE.mFileComment = new uint8_t[mCDE.mFileCommentLength+1];
if (mCDE.mFileComment == NULL)
return NO_MEMORY;
strcpy((char*) mCDE.mFileComment, (char*)pEntry->mCDE.mFileComment);
}
if (mCDE.mExtraFieldLength > 0) {
/* we null-terminate this, though it may not be a string */
- mCDE.mExtraField = new unsigned char[mCDE.mExtraFieldLength+1];
+ mCDE.mExtraField = new uint8_t[mCDE.mExtraFieldLength+1];
if (mCDE.mExtraField == NULL)
return NO_MEMORY;
memcpy(mCDE.mExtraField, pEntry->mCDE.mExtraField,
@@ -180,7 +181,7 @@
assert(mLFH.mExtraField == NULL);
mLFH.mExtraFieldLength = pEntry->mLFH.mExtraFieldLength;
if (mLFH.mExtraFieldLength > 0) {
- mLFH.mExtraField = new unsigned char[mLFH.mExtraFieldLength+1];
+ mLFH.mExtraField = new uint8_t[mLFH.mExtraFieldLength+1];
if (mLFH.mExtraField == NULL)
return NO_MEMORY;
memcpy(mLFH.mExtraField, pEntry->mLFH.mExtraField,
@@ -205,9 +206,9 @@
if (mLFH.mExtraFieldLength > 0) {
/* extend existing field */
- unsigned char* newExtra;
+ uint8_t* newExtra;
- newExtra = new unsigned char[mLFH.mExtraFieldLength + padding];
+ newExtra = new uint8_t[mLFH.mExtraFieldLength + padding];
if (newExtra == NULL)
return NO_MEMORY;
memset(newExtra + mLFH.mExtraFieldLength, 0, padding);
@@ -218,7 +219,7 @@
mLFH.mExtraFieldLength += padding;
} else {
/* create new field */
- mLFH.mExtraField = new unsigned char[padding];
+ mLFH.mExtraField = new uint8_t[padding];
memset(mLFH.mExtraField, 0, padding);
mLFH.mExtraFieldLength = padding;
}
@@ -246,7 +247,7 @@
delete[] mLFH.mFileName;
if (mLFH.mFileNameLength > 0) {
- mLFH.mFileName = new unsigned char[mLFH.mFileNameLength+1];
+ mLFH.mFileName = new uint8_t[mLFH.mFileNameLength+1];
strcpy((char*) mLFH.mFileName, (const char*) mCDE.mFileName);
} else {
mLFH.mFileName = NULL;
@@ -256,7 +257,7 @@
/*
* Set some information about a file after we add it.
*/
-void ZipEntry::setDataInfo(long uncompLen, long compLen, unsigned long crc32,
+void ZipEntry::setDataInfo(long uncompLen, long compLen, uint32_t crc32,
int compressionMethod)
{
mCDE.mCompressionMethod = compressionMethod;
@@ -360,7 +361,7 @@
struct tm tmResult;
#endif
time_t even;
- unsigned short zdate, ztime;
+ uint16_t zdate, ztime;
struct tm* ptm;
@@ -402,7 +403,7 @@
status_t ZipEntry::LocalFileHeader::read(FILE* fp)
{
status_t result = NO_ERROR;
- unsigned char buf[kLFHLen];
+ uint8_t buf[kLFHLen];
assert(mFileName == NULL);
assert(mExtraField == NULL);
@@ -433,7 +434,7 @@
/* grab filename */
if (mFileNameLength != 0) {
- mFileName = new unsigned char[mFileNameLength+1];
+ mFileName = new uint8_t[mFileNameLength+1];
if (mFileName == NULL) {
result = NO_MEMORY;
goto bail;
@@ -447,7 +448,7 @@
/* grab extra field */
if (mExtraFieldLength != 0) {
- mExtraField = new unsigned char[mExtraFieldLength+1];
+ mExtraField = new uint8_t[mExtraFieldLength+1];
if (mExtraField == NULL) {
result = NO_MEMORY;
goto bail;
@@ -468,7 +469,7 @@
*/
status_t ZipEntry::LocalFileHeader::write(FILE* fp)
{
- unsigned char buf[kLFHLen];
+ uint8_t buf[kLFHLen];
ZipEntry::putLongLE(&buf[0x00], kSignature);
ZipEntry::putShortLE(&buf[0x04], mVersionToExtract);
@@ -507,13 +508,13 @@
void ZipEntry::LocalFileHeader::dump(void) const
{
ALOGD(" LocalFileHeader contents:\n");
- ALOGD(" versToExt=%u gpBits=0x%04x compression=%u\n",
+ ALOGD(" versToExt=%" PRIu16 " gpBits=0x%04" PRIx16 " compression=%" PRIu16 "\n",
mVersionToExtract, mGPBitFlag, mCompressionMethod);
- ALOGD(" modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n",
+ ALOGD(" modTime=0x%04" PRIx16 " modDate=0x%04" PRIx16 " crc32=0x%08" PRIx32 "\n",
mLastModFileTime, mLastModFileDate, mCRC32);
- ALOGD(" compressedSize=%lu uncompressedSize=%lu\n",
+ ALOGD(" compressedSize=%" PRIu32 " uncompressedSize=%" PRIu32 "\n",
mCompressedSize, mUncompressedSize);
- ALOGD(" filenameLen=%u extraLen=%u\n",
+ ALOGD(" filenameLen=%" PRIu16 " extraLen=%" PRIu16 "\n",
mFileNameLength, mExtraFieldLength);
if (mFileName != NULL)
ALOGD(" filename: '%s'\n", mFileName);
@@ -536,7 +537,7 @@
status_t ZipEntry::CentralDirEntry::read(FILE* fp)
{
status_t result = NO_ERROR;
- unsigned char buf[kCDELen];
+ uint8_t buf[kCDELen];
/* no re-use */
assert(mFileName == NULL);
@@ -575,7 +576,7 @@
/* grab filename */
if (mFileNameLength != 0) {
- mFileName = new unsigned char[mFileNameLength+1];
+ mFileName = new uint8_t[mFileNameLength+1];
if (mFileName == NULL) {
result = NO_MEMORY;
goto bail;
@@ -589,7 +590,7 @@
/* read "extra field" */
if (mExtraFieldLength != 0) {
- mExtraField = new unsigned char[mExtraFieldLength+1];
+ mExtraField = new uint8_t[mExtraFieldLength+1];
if (mExtraField == NULL) {
result = NO_MEMORY;
goto bail;
@@ -604,7 +605,7 @@
/* grab comment, if any */
if (mFileCommentLength != 0) {
- mFileComment = new unsigned char[mFileCommentLength+1];
+ mFileComment = new uint8_t[mFileCommentLength+1];
if (mFileComment == NULL) {
result = NO_MEMORY;
goto bail;
@@ -626,7 +627,7 @@
*/
status_t ZipEntry::CentralDirEntry::write(FILE* fp)
{
- unsigned char buf[kCDELen];
+ uint8_t buf[kCDELen];
ZipEntry::putLongLE(&buf[0x00], kSignature);
ZipEntry::putShortLE(&buf[0x04], mVersionMadeBy);
@@ -676,15 +677,15 @@
void ZipEntry::CentralDirEntry::dump(void) const
{
ALOGD(" CentralDirEntry contents:\n");
- ALOGD(" versMadeBy=%u versToExt=%u gpBits=0x%04x compression=%u\n",
+ ALOGD(" versMadeBy=%" PRIu16 " versToExt=%" PRIu16 " gpBits=0x%04" PRIx16 " compression=%" PRIu16 "\n",
mVersionMadeBy, mVersionToExtract, mGPBitFlag, mCompressionMethod);
- ALOGD(" modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n",
+ ALOGD(" modTime=0x%04" PRIx16 " modDate=0x%04" PRIx16 " crc32=0x%08" PRIx32 "\n",
mLastModFileTime, mLastModFileDate, mCRC32);
- ALOGD(" compressedSize=%lu uncompressedSize=%lu\n",
+ ALOGD(" compressedSize=%" PRIu32 " uncompressedSize=%" PRIu32 "\n",
mCompressedSize, mUncompressedSize);
- ALOGD(" filenameLen=%u extraLen=%u commentLen=%u\n",
+ ALOGD(" filenameLen=%" PRIu16 " extraLen=%" PRIu16 " commentLen=%" PRIu16 "\n",
mFileNameLength, mExtraFieldLength, mFileCommentLength);
- ALOGD(" diskNumStart=%u intAttr=0x%04x extAttr=0x%08lx relOffset=%lu\n",
+ ALOGD(" diskNumStart=%" PRIu16 " intAttr=0x%04" PRIx16 " extAttr=0x%08" PRIx32 " relOffset=%" PRIu32 "\n",
mDiskNumberStart, mInternalAttrs, mExternalAttrs,
mLocalHeaderRelOffset);
diff --git a/tools/zipalign/ZipEntry.h b/tools/zipalign/ZipEntry.h
index 7f721b4..129a759 100644
--- a/tools/zipalign/ZipEntry.h
+++ b/tools/zipalign/ZipEntry.h
@@ -25,6 +25,7 @@
#include <utils/Errors.h>
#include <stdlib.h>
+#include <stdint.h>
#include <stdio.h>
namespace android {
@@ -85,7 +86,7 @@
/*
* Return the data CRC.
*/
- unsigned long getCRC32(void) const { return mCDE.mCRC32; }
+ uint32_t getCRC32(void) const { return mCDE.mCRC32; }
/*
* Return file modification time in UNIX seconds-since-epoch.
@@ -108,21 +109,21 @@
* Some basic functions for raw data manipulation. "LE" means
* Little Endian.
*/
- static inline unsigned short getShortLE(const unsigned char* buf) {
+ static inline uint16_t getShortLE(const uint8_t* buf) {
return buf[0] | (buf[1] << 8);
}
- static inline unsigned long getLongLE(const unsigned char* buf) {
+ static inline uint32_t getLongLE(const uint8_t* buf) {
return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
}
- static inline void putShortLE(unsigned char* buf, short val) {
- buf[0] = (unsigned char) val;
- buf[1] = (unsigned char) (val >> 8);
+ static inline void putShortLE(uint8_t* buf, uint16_t val) {
+ buf[0] = (uint8_t) val;
+ buf[1] = (uint8_t) (val >> 8);
}
- static inline void putLongLE(unsigned char* buf, long val) {
- buf[0] = (unsigned char) val;
- buf[1] = (unsigned char) (val >> 8);
- buf[2] = (unsigned char) (val >> 16);
- buf[3] = (unsigned char) (val >> 24);
+ static inline void putLongLE(uint8_t* buf, uint32_t val) {
+ buf[0] = (uint8_t) val;
+ buf[1] = (uint8_t) (val >> 8);
+ buf[2] = (uint8_t) (val >> 16);
+ buf[3] = (uint8_t) (val >> 24);
}
/* defined for Zip archives */
@@ -177,7 +178,7 @@
/*
* Set information about the data for this entry.
*/
- void setDataInfo(long uncompLen, long compLen, unsigned long crc32,
+ void setDataInfo(long uncompLen, long compLen, uint32_t crc32,
int compressionMethod);
/*
@@ -195,7 +196,7 @@
* the current file.
*/
void setLFHOffset(off_t offset) {
- mCDE.mLocalHeaderRelOffset = (long) offset;
+ mCDE.mLocalHeaderRelOffset = (uint32_t) offset;
}
/* mark for deletion; used by ZipFile::remove() */
@@ -240,19 +241,19 @@
status_t read(FILE* fp);
status_t write(FILE* fp);
- // unsigned long mSignature;
- unsigned short mVersionToExtract;
- unsigned short mGPBitFlag;
- unsigned short mCompressionMethod;
- unsigned short mLastModFileTime;
- unsigned short mLastModFileDate;
- unsigned long mCRC32;
- unsigned long mCompressedSize;
- unsigned long mUncompressedSize;
- unsigned short mFileNameLength;
- unsigned short mExtraFieldLength;
- unsigned char* mFileName;
- unsigned char* mExtraField;
+ // uint32_t mSignature;
+ uint16_t mVersionToExtract;
+ uint16_t mGPBitFlag;
+ uint16_t mCompressionMethod;
+ uint16_t mLastModFileTime;
+ uint16_t mLastModFileDate;
+ uint32_t mCRC32;
+ uint32_t mCompressedSize;
+ uint32_t mUncompressedSize;
+ uint16_t mFileNameLength;
+ uint16_t mExtraFieldLength;
+ uint8_t* mFileName;
+ uint8_t* mExtraField;
enum {
kSignature = 0x04034b50,
@@ -298,26 +299,26 @@
status_t read(FILE* fp);
status_t write(FILE* fp);
- // unsigned long mSignature;
- unsigned short mVersionMadeBy;
- unsigned short mVersionToExtract;
- unsigned short mGPBitFlag;
- unsigned short mCompressionMethod;
- unsigned short mLastModFileTime;
- unsigned short mLastModFileDate;
- unsigned long mCRC32;
- unsigned long mCompressedSize;
- unsigned long mUncompressedSize;
- unsigned short mFileNameLength;
- unsigned short mExtraFieldLength;
- unsigned short mFileCommentLength;
- unsigned short mDiskNumberStart;
- unsigned short mInternalAttrs;
- unsigned long mExternalAttrs;
- unsigned long mLocalHeaderRelOffset;
- unsigned char* mFileName;
- unsigned char* mExtraField;
- unsigned char* mFileComment;
+ // uint32_t mSignature;
+ uint16_t mVersionMadeBy;
+ uint16_t mVersionToExtract;
+ uint16_t mGPBitFlag;
+ uint16_t mCompressionMethod;
+ uint16_t mLastModFileTime;
+ uint16_t mLastModFileDate;
+ uint32_t mCRC32;
+ uint32_t mCompressedSize;
+ uint32_t mUncompressedSize;
+ uint16_t mFileNameLength;
+ uint16_t mExtraFieldLength;
+ uint16_t mFileCommentLength;
+ uint16_t mDiskNumberStart;
+ uint16_t mInternalAttrs;
+ uint32_t mExternalAttrs;
+ uint32_t mLocalHeaderRelOffset;
+ uint8_t* mFileName;
+ uint8_t* mExtraField;
+ uint8_t* mFileComment;
void dump(void) const;
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 3c5ec15..7c3ff37 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -34,6 +34,7 @@
#include <sys/stat.h>
#include <errno.h>
#include <assert.h>
+#include <inttypes.h>
using namespace android;
@@ -206,7 +207,7 @@
status_t ZipFile::readCentralDir(void)
{
status_t result = NO_ERROR;
- unsigned char* buf = NULL;
+ uint8_t* buf = NULL;
off_t fileLength, seekStart;
long readAmount;
int i;
@@ -222,7 +223,7 @@
goto bail;
}
- buf = new unsigned char[EndOfCentralDir::kMaxEOCDSearch];
+ buf = new uint8_t[EndOfCentralDir::kMaxEOCDSearch];
if (buf == NULL) {
ALOGD("Failure allocating %d bytes for EOCD search",
EndOfCentralDir::kMaxEOCDSearch);
@@ -296,7 +297,7 @@
* we're hoping to preserve.
*/
if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
- ALOGD("Failure seeking to central dir offset %ld\n",
+ ALOGD("Failure seeking to central dir offset %" PRIu32 "\n",
mEOCD.mCentralDirOffset);
result = UNKNOWN_ERROR;
goto bail;
@@ -305,7 +306,7 @@
/*
* Loop through and read the central dir entries.
*/
- ALOGV("Scanning %d entries...\n", mEOCD.mTotalNumEntries);
+ ALOGV("Scanning %" PRIu16 " entries...\n", mEOCD.mTotalNumEntries);
int entry;
for (entry = 0; entry < mEOCD.mTotalNumEntries; entry++) {
ZipEntry* pEntry = new ZipEntry;
@@ -325,7 +326,7 @@
* If all went well, we should now be back at the EOCD.
*/
{
- unsigned char checkBuf[4];
+ uint8_t checkBuf[4];
if (fread(checkBuf, 1, 4, mZipFp) != 4) {
ALOGD("EOCD check read failed\n");
result = INVALID_OPERATION;
@@ -365,7 +366,7 @@
status_t result = NO_ERROR;
long lfhPosn, startPosn, endPosn, uncompressedLen;
FILE* inputFp = NULL;
- unsigned long crc;
+ uint32_t crc;
time_t modWhen;
if (mReadOnly)
@@ -466,14 +467,16 @@
bool scanResult;
int method;
long compressedLen;
+ unsigned long longcrc;
scanResult = ZipUtils::examineGzip(inputFp, &method, &uncompressedLen,
- &compressedLen, &crc);
+ &compressedLen, &longcrc);
if (!scanResult || method != ZipEntry::kCompressDeflated) {
ALOGD("this isn't a deflated gzip file?");
result = UNKNOWN_ERROR;
goto bail;
}
+ crc = longcrc;
result = copyPartialFpToFp(mZipFp, inputFp, compressedLen, NULL);
if (result != NO_ERROR) {
@@ -710,7 +713,7 @@
goto bail;
}
long startPosn = ftell(mZipFp);
- unsigned long crc;
+ uint32_t crc;
if (compressFpToFp(mZipFp, NULL, buf, uncompressedLen, &crc) != NO_ERROR) {
ALOGW("recompress of '%s' failed\n", pEntry->mCDE.mFileName);
result = UNKNOWN_ERROR;
@@ -780,9 +783,9 @@
* On exit, "srcFp" will be seeked to the end of the file, and "dstFp"
* will be seeked immediately past the data.
*/
-status_t ZipFile::copyFpToFp(FILE* dstFp, FILE* srcFp, unsigned long* pCRC32)
+status_t ZipFile::copyFpToFp(FILE* dstFp, FILE* srcFp, uint32_t* pCRC32)
{
- unsigned char tmpBuf[32768];
+ uint8_t tmpBuf[32768];
size_t count;
*pCRC32 = crc32(0L, Z_NULL, 0);
@@ -811,7 +814,7 @@
* On exit, "dstFp" will be seeked immediately past the data.
*/
status_t ZipFile::copyDataToFp(FILE* dstFp,
- const void* data, size_t size, unsigned long* pCRC32)
+ const void* data, size_t size, uint32_t* pCRC32)
{
size_t count;
@@ -836,9 +839,9 @@
* will be seeked immediately past the data just written.
*/
status_t ZipFile::copyPartialFpToFp(FILE* dstFp, FILE* srcFp, long length,
- unsigned long* pCRC32)
+ uint32_t* pCRC32)
{
- unsigned char tmpBuf[32768];
+ uint8_t tmpBuf[32768];
size_t count;
if (pCRC32 != NULL)
@@ -846,7 +849,7 @@
while (length) {
long readSize;
-
+
readSize = sizeof(tmpBuf);
if (readSize > length)
readSize = length;
@@ -878,15 +881,15 @@
* will be seeked immediately past the compressed data.
*/
status_t ZipFile::compressFpToFp(FILE* dstFp, FILE* srcFp,
- const void* data, size_t size, unsigned long* pCRC32)
+ const void* data, size_t size, uint32_t* pCRC32)
{
status_t result = NO_ERROR;
const size_t kBufSize = 1024 * 1024;
- unsigned char* inBuf = NULL;
- unsigned char* outBuf = NULL;
+ uint8_t* inBuf = NULL;
+ uint8_t* outBuf = NULL;
size_t outSize = 0;
bool atEof = false; // no feof() aviailable yet
- unsigned long crc;
+ uint32_t crc;
ZopfliOptions options;
unsigned char bp = 0;
@@ -902,7 +905,7 @@
/*
* Create an input buffer and an output buffer.
*/
- inBuf = new unsigned char[kBufSize];
+ inBuf = new uint8_t[kBufSize];
if (inBuf == NULL) {
result = NO_MEMORY;
goto bail;
@@ -1128,7 +1131,7 @@
if (dst == src || n <= 0)
return NO_ERROR;
- unsigned char readBuf[32768];
+ uint8_t readBuf[32768];
if (dst < src) {
/* shift stuff toward start of file; must read from start */
@@ -1294,7 +1297,7 @@
* "buf" should be positioned at the EOCD signature, and should contain
* the entire EOCD area including the comment.
*/
-status_t ZipFile::EndOfCentralDir::readBuf(const unsigned char* buf, int len)
+status_t ZipFile::EndOfCentralDir::readBuf(const uint8_t* buf, int len)
{
/* don't allow re-use */
assert(mComment == NULL);
@@ -1322,11 +1325,11 @@
if (mCommentLen > 0) {
if (kEOCDLen + mCommentLen > len) {
- ALOGD("EOCD(%d) + comment(%d) exceeds len (%d)\n",
+ ALOGD("EOCD(%d) + comment(%" PRIu16 ") exceeds len (%d)\n",
kEOCDLen, mCommentLen, len);
return UNKNOWN_ERROR;
}
- mComment = new unsigned char[mCommentLen];
+ mComment = new uint8_t[mCommentLen];
memcpy(mComment, buf + kEOCDLen, mCommentLen);
}
@@ -1338,7 +1341,7 @@
*/
status_t ZipFile::EndOfCentralDir::write(FILE* fp)
{
- unsigned char buf[kEOCDLen];
+ uint8_t buf[kEOCDLen];
ZipEntry::putLongLE(&buf[0x00], kSignature);
ZipEntry::putShortLE(&buf[0x04], mDiskNumber);
@@ -1366,9 +1369,9 @@
void ZipFile::EndOfCentralDir::dump(void) const
{
ALOGD(" EndOfCentralDir contents:\n");
- ALOGD(" diskNum=%u diskWCD=%u numEnt=%u totalNumEnt=%u\n",
+ ALOGD(" diskNum=%" PRIu16 " diskWCD=%" PRIu16 " numEnt=%" PRIu16 " totalNumEnt=%" PRIu16 "\n",
mDiskNumber, mDiskWithCentralDir, mNumEntries, mTotalNumEntries);
- ALOGD(" centDirSize=%lu centDirOff=%lu commentLen=%u\n",
+ ALOGD(" centDirSize=%" PRIu32 " centDirOff=%" PRIu32 " commentLen=%" PRIu32 "\n",
mCentralDirSize, mCentralDirOffset, mCommentLen);
}
diff --git a/tools/zipalign/ZipFile.h b/tools/zipalign/ZipFile.h
index b99cda5..b0bafe9 100644
--- a/tools/zipalign/ZipFile.h
+++ b/tools/zipalign/ZipFile.h
@@ -194,18 +194,18 @@
delete[] mComment;
}
- status_t readBuf(const unsigned char* buf, int len);
+ status_t readBuf(const uint8_t* buf, int len);
status_t write(FILE* fp);
- //unsigned long mSignature;
- unsigned short mDiskNumber;
- unsigned short mDiskWithCentralDir;
- unsigned short mNumEntries;
- unsigned short mTotalNumEntries;
- unsigned long mCentralDirSize;
- unsigned long mCentralDirOffset; // offset from first disk
- unsigned short mCommentLen;
- unsigned char* mComment;
+ //uint32_t mSignature;
+ uint16_t mDiskNumber;
+ uint16_t mDiskWithCentralDir;
+ uint16_t mNumEntries;
+ uint16_t mTotalNumEntries;
+ uint32_t mCentralDirSize;
+ uint32_t mCentralDirOffset; // offset from first disk
+ uint16_t mCommentLen;
+ uint8_t* mComment;
enum {
kSignature = 0x06054b50,
@@ -235,18 +235,18 @@
ZipEntry** ppEntry);
/* copy all of "srcFp" into "dstFp" */
- status_t copyFpToFp(FILE* dstFp, FILE* srcFp, unsigned long* pCRC32);
+ status_t copyFpToFp(FILE* dstFp, FILE* srcFp, uint32_t* pCRC32);
/* copy all of "data" into "dstFp" */
status_t copyDataToFp(FILE* dstFp,
- const void* data, size_t size, unsigned long* pCRC32);
+ const void* data, size_t size, uint32_t* pCRC32);
/* copy some of "srcFp" into "dstFp" */
status_t copyPartialFpToFp(FILE* dstFp, FILE* srcFp, long length,
- unsigned long* pCRC32);
+ uint32_t* pCRC32);
/* like memmove(), but on parts of a single file */
status_t filemove(FILE* fp, off_t dest, off_t src, size_t n);
/* compress all of "srcFp" into "dstFp", using Deflate */
status_t compressFpToFp(FILE* dstFp, FILE* srcFp,
- const void* data, size_t size, unsigned long* pCRC32);
+ const void* data, size_t size, uint32_t* pCRC32);
/* get modification date from a file descriptor */
time_t getModTime(int fd);
diff --git a/tools/check_prereq/Android.mk b/tools/ziptime/Android.mk
similarity index 65%
rename from tools/check_prereq/Android.mk
rename to tools/ziptime/Android.mk
index 4329aff..3575229 100644
--- a/tools/check_prereq/Android.mk
+++ b/tools/ziptime/Android.mk
@@ -1,4 +1,5 @@
-# Copyright (C) 2009 The Android Open Source Project
+#
+# Copyright 2015 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,15 +12,21 @@
# 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)
+#
+# Zip timestamp removal tool
+#
+
+LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := check_prereq.c
-LOCAL_MODULE := check_prereq
-LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES +=
-LOCAL_STATIC_LIBRARIES += libcutils libc
+LOCAL_SRC_FILES := \
+ ZipTime.cpp \
+ ZipEntry.cpp \
+ ZipFile.cpp
-include $(BUILD_EXECUTABLE)
+LOCAL_MODULE := ziptime
+LOCAL_MODULE_HOST_OS := darwin linux windows
+
+include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/ziptime/README.txt b/tools/ziptime/README.txt
new file mode 100644
index 0000000..8a101e9
--- /dev/null
+++ b/tools/ziptime/README.txt
@@ -0,0 +1,10 @@
+ziptime -- zip timestamp tool
+
+usage: ziptime file.zip
+
+ file.zip is an existing Zip archive to rewrite
+
+
+This tools replaces the timestamps in the zip headers with a static time
+(Jan 1 2008). The extra fields are not changed, so you'll need to use the
+-X option to zip so that it doesn't create the 'universal time' extra.
diff --git a/tools/ziptime/ZipEntry.cpp b/tools/ziptime/ZipEntry.cpp
new file mode 100644
index 0000000..51ce09f
--- /dev/null
+++ b/tools/ziptime/ZipEntry.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2006 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.
+ */
+
+//
+// Access to entries in a Zip archive.
+//
+
+#include "ZipEntry.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <inttypes.h>
+
+using namespace android;
+
+#define LOG(...) fprintf(stderr, __VA_ARGS__)
+
+/* Jan 01 2008 */
+#define STATIC_DATE (28 << 9 | 1 << 5 | 1)
+#define STATIC_TIME 0
+
+/*
+ * Initialize a new ZipEntry structure from a FILE* positioned at a
+ * CentralDirectoryEntry. Rewrites the headers to remove the dynamic
+ * timestamps.
+ *
+ * On exit, the file pointer will be at the start of the next CDE or
+ * at the EOCD.
+ */
+status_t ZipEntry::initAndRewriteFromCDE(FILE* fp)
+{
+ status_t result;
+ long posn;
+
+ /* read the CDE */
+ result = mCDE.rewrite(fp);
+ if (result != 0) {
+ LOG("mCDE.rewrite failed\n");
+ return result;
+ }
+
+ /* using the info in the CDE, go load up the LFH */
+ posn = ftell(fp);
+ if (fseek(fp, mCDE.mLocalHeaderRelOffset, SEEK_SET) != 0) {
+ LOG("local header seek failed (%" PRIu32 ")\n",
+ mCDE.mLocalHeaderRelOffset);
+ return -1;
+ }
+
+ result = mLFH.rewrite(fp);
+ if (result != 0) {
+ LOG("mLFH.rewrite failed\n");
+ return result;
+ }
+
+ if (fseek(fp, posn, SEEK_SET) != 0)
+ return -1;
+
+ return 0;
+}
+
+/*
+ * ===========================================================================
+ * ZipEntry::LocalFileHeader
+ * ===========================================================================
+ */
+
+/*
+ * Rewrite a local file header.
+ *
+ * On entry, "fp" points to the signature at the start of the header.
+ */
+status_t ZipEntry::LocalFileHeader::rewrite(FILE* fp)
+{
+ status_t result = 0;
+ uint8_t buf[kLFHLen];
+
+ if (fread(buf, 1, kLFHLen, fp) != kLFHLen)
+ return -1;
+
+ if (ZipEntry::getLongLE(&buf[0x00]) != kSignature) {
+ LOG("whoops: didn't find expected signature\n");
+ return -1;
+ }
+
+ ZipEntry::putShortLE(&buf[0x0a], STATIC_TIME);
+ ZipEntry::putShortLE(&buf[0x0c], STATIC_DATE);
+
+ if (fseek(fp, -kLFHLen, SEEK_CUR) != 0)
+ return -1;
+
+ if (fwrite(buf, 1, kLFHLen, fp) != kLFHLen)
+ return -1;
+
+ return 0;
+}
+
+/*
+ * ===========================================================================
+ * ZipEntry::CentralDirEntry
+ * ===========================================================================
+ */
+
+/*
+ * Read and rewrite the central dir entry that appears next in the file.
+ *
+ * On entry, "fp" should be positioned on the signature bytes for the
+ * entry. On exit, "fp" will point at the signature word for the next
+ * entry or for the EOCD.
+ */
+status_t ZipEntry::CentralDirEntry::rewrite(FILE* fp)
+{
+ status_t result = 0;
+ uint8_t buf[kCDELen];
+ uint16_t fileNameLength, extraFieldLength, fileCommentLength;
+
+ if (fread(buf, 1, kCDELen, fp) != kCDELen)
+ return -1;
+
+ if (ZipEntry::getLongLE(&buf[0x00]) != kSignature) {
+ LOG("Whoops: didn't find expected signature\n");
+ return -1;
+ }
+
+ ZipEntry::putShortLE(&buf[0x0c], STATIC_TIME);
+ ZipEntry::putShortLE(&buf[0x0e], STATIC_DATE);
+
+ fileNameLength = ZipEntry::getShortLE(&buf[0x1c]);
+ extraFieldLength = ZipEntry::getShortLE(&buf[0x1e]);
+ fileCommentLength = ZipEntry::getShortLE(&buf[0x20]);
+ mLocalHeaderRelOffset = ZipEntry::getLongLE(&buf[0x2a]);
+
+ if (fseek(fp, -kCDELen, SEEK_CUR) != 0)
+ return -1;
+
+ if (fwrite(buf, 1, kCDELen, fp) != kCDELen)
+ return -1;
+
+ if (fseek(fp, fileNameLength + extraFieldLength + fileCommentLength, SEEK_CUR) != 0)
+ return -1;
+
+ return 0;
+}
diff --git a/tools/ziptime/ZipEntry.h b/tools/ziptime/ZipEntry.h
new file mode 100644
index 0000000..26bf596
--- /dev/null
+++ b/tools/ziptime/ZipEntry.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2006 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.
+ */
+
+//
+// Zip archive entries.
+//
+// The ZipEntry class is tightly meshed with the ZipFile class.
+//
+#ifndef __LIBS_ZIPENTRY_H
+#define __LIBS_ZIPENTRY_H
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+
+typedef int status_t;
+
+namespace android {
+
+class ZipFile;
+
+/*
+ * ZipEntry objects represent a single entry in a Zip archive.
+ *
+ * File information is stored in two places: next to the file data (the Local
+ * File Header, and possibly a Data Descriptor), and at the end of the file
+ * (the Central Directory Entry). The two must be kept in sync.
+ */
+class ZipEntry {
+public:
+ friend class ZipFile;
+
+ ZipEntry(void) {}
+ ~ZipEntry(void) {}
+
+ /*
+ * Some basic functions for raw data manipulation. "LE" means
+ * Little Endian.
+ */
+ static inline uint16_t getShortLE(const uint8_t* buf) {
+ return buf[0] | (buf[1] << 8);
+ }
+ static inline uint32_t getLongLE(const uint8_t* buf) {
+ return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
+ }
+ static inline void putShortLE(uint8_t* buf, uint16_t val) {
+ buf[0] = (uint8_t) val;
+ buf[1] = (uint8_t) (val >> 8);
+ }
+
+protected:
+ /*
+ * Initialize the structure from the file, which is pointing at
+ * our Central Directory entry. And rewrite it.
+ */
+ status_t initAndRewriteFromCDE(FILE* fp);
+
+private:
+ /* these are private and not defined */
+ ZipEntry(const ZipEntry& src);
+ ZipEntry& operator=(const ZipEntry& src);
+
+ /*
+ * Every entry in the Zip archive starts off with one of these.
+ */
+ class LocalFileHeader {
+ public:
+ LocalFileHeader(void) {}
+
+ status_t rewrite(FILE* fp);
+
+ enum {
+ kSignature = 0x04034b50,
+ kLFHLen = 30, // LocalFileHdr len, excl. var fields
+ };
+ };
+
+ /*
+ * Every entry in the Zip archive has one of these in the "central
+ * directory" at the end of the file.
+ */
+ class CentralDirEntry {
+ public:
+ CentralDirEntry(void) :
+ mLocalHeaderRelOffset(0)
+ {}
+
+ status_t rewrite(FILE* fp);
+
+ uint32_t mLocalHeaderRelOffset;
+
+ enum {
+ kSignature = 0x02014b50,
+ kCDELen = 46, // CentralDirEnt len, excl. var fields
+ };
+ };
+
+ LocalFileHeader mLFH;
+ CentralDirEntry mCDE;
+};
+
+}; // namespace android
+
+#endif // __LIBS_ZIPENTRY_H
diff --git a/tools/ziptime/ZipFile.cpp b/tools/ziptime/ZipFile.cpp
new file mode 100644
index 0000000..1d111af
--- /dev/null
+++ b/tools/ziptime/ZipFile.cpp
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2006 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.
+ */
+
+//
+// Access to Zip archives.
+//
+
+#include "ZipFile.h"
+
+#include <memory.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <assert.h>
+#include <inttypes.h>
+
+using namespace android;
+
+#define LOG(...) fprintf(stderr, __VA_ARGS__)
+
+/*
+ * Open a file and rewrite the headers
+ */
+status_t ZipFile::rewrite(const char* zipFileName)
+{
+ assert(mZipFp == NULL); // no reopen
+
+ /* open the file */
+ mZipFp = fopen(zipFileName, "r+b");
+ if (mZipFp == NULL) {
+ int err = errno;
+ LOG("fopen failed: %d\n", err);
+ return -1;
+ }
+
+ /*
+ * Load the central directory. If that fails, then this probably
+ * isn't a Zip archive.
+ */
+ return rewriteCentralDir();
+}
+
+/*
+ * Find the central directory, read and rewrite the contents.
+ *
+ * The fun thing about ZIP archives is that they may or may not be
+ * readable from start to end. In some cases, notably for archives
+ * that were written to stdout, the only length information is in the
+ * central directory at the end of the file.
+ *
+ * Of course, the central directory can be followed by a variable-length
+ * comment field, so we have to scan through it backwards. The comment
+ * is at most 64K, plus we have 18 bytes for the end-of-central-dir stuff
+ * itself, plus apparently sometimes people throw random junk on the end
+ * just for the fun of it.
+ *
+ * This is all a little wobbly. If the wrong value ends up in the EOCD
+ * area, we're hosed. This appears to be the way that everbody handles
+ * it though, so we're in pretty good company if this fails.
+ */
+status_t ZipFile::rewriteCentralDir(void)
+{
+ status_t result = 0;
+ uint8_t* buf = NULL;
+ off_t fileLength, seekStart;
+ long readAmount;
+ int i;
+
+ fseek(mZipFp, 0, SEEK_END);
+ fileLength = ftell(mZipFp);
+ rewind(mZipFp);
+
+ /* too small to be a ZIP archive? */
+ if (fileLength < EndOfCentralDir::kEOCDLen) {
+ LOG("Length is %ld -- too small\n", (long)fileLength);
+ result = -1;
+ goto bail;
+ }
+
+ buf = new uint8_t[EndOfCentralDir::kMaxEOCDSearch];
+ if (buf == NULL) {
+ LOG("Failure allocating %d bytes for EOCD search",
+ EndOfCentralDir::kMaxEOCDSearch);
+ result = -1;
+ goto bail;
+ }
+
+ if (fileLength > EndOfCentralDir::kMaxEOCDSearch) {
+ seekStart = fileLength - EndOfCentralDir::kMaxEOCDSearch;
+ readAmount = EndOfCentralDir::kMaxEOCDSearch;
+ } else {
+ seekStart = 0;
+ readAmount = (long) fileLength;
+ }
+ if (fseek(mZipFp, seekStart, SEEK_SET) != 0) {
+ LOG("Failure seeking to end of zip at %ld", (long) seekStart);
+ result = -1;
+ goto bail;
+ }
+
+ /* read the last part of the file into the buffer */
+ if (fread(buf, 1, readAmount, mZipFp) != (size_t) readAmount) {
+ LOG("short file? wanted %ld\n", readAmount);
+ result = -1;
+ goto bail;
+ }
+
+ /* find the end-of-central-dir magic */
+ for (i = readAmount - 4; i >= 0; i--) {
+ if (buf[i] == 0x50 &&
+ ZipEntry::getLongLE(&buf[i]) == EndOfCentralDir::kSignature)
+ {
+ break;
+ }
+ }
+ if (i < 0) {
+ LOG("EOCD not found, not Zip\n");
+ result = -1;
+ goto bail;
+ }
+
+ /* extract eocd values */
+ result = mEOCD.readBuf(buf + i, readAmount - i);
+ if (result != 0) {
+ LOG("Failure reading %ld bytes of EOCD values", readAmount - i);
+ goto bail;
+ }
+
+ /*
+ * So far so good. "mCentralDirSize" is the size in bytes of the
+ * central directory, so we can just seek back that far to find it.
+ * We can also seek forward mCentralDirOffset bytes from the
+ * start of the file.
+ *
+ * We're not guaranteed to have the rest of the central dir in the
+ * buffer, nor are we guaranteed that the central dir will have any
+ * sort of convenient size. We need to skip to the start of it and
+ * read the header, then the other goodies.
+ *
+ * The only thing we really need right now is the file comment, which
+ * we're hoping to preserve.
+ */
+ if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
+ LOG("Failure seeking to central dir offset %" PRIu32 "\n",
+ mEOCD.mCentralDirOffset);
+ result = -1;
+ goto bail;
+ }
+
+ /*
+ * Loop through and read the central dir entries.
+ */
+ int entry;
+ for (entry = 0; entry < mEOCD.mTotalNumEntries; entry++) {
+ ZipEntry* pEntry = new ZipEntry;
+
+ result = pEntry->initAndRewriteFromCDE(mZipFp);
+ if (result != 0) {
+ LOG("initFromCDE failed\n");
+ delete pEntry;
+ goto bail;
+ }
+
+ delete pEntry;
+ }
+
+
+ /*
+ * If all went well, we should now be back at the EOCD.
+ */
+ uint8_t checkBuf[4];
+ if (fread(checkBuf, 1, 4, mZipFp) != 4) {
+ LOG("EOCD check read failed\n");
+ result = -1;
+ goto bail;
+ }
+ if (ZipEntry::getLongLE(checkBuf) != EndOfCentralDir::kSignature) {
+ LOG("EOCD read check failed\n");
+ result = -1;
+ goto bail;
+ }
+
+bail:
+ delete[] buf;
+ return result;
+}
+
+/*
+ * ===========================================================================
+ * ZipFile::EndOfCentralDir
+ * ===========================================================================
+ */
+
+/*
+ * Read the end-of-central-dir fields.
+ *
+ * "buf" should be positioned at the EOCD signature, and should contain
+ * the entire EOCD area including the comment.
+ */
+status_t ZipFile::EndOfCentralDir::readBuf(const uint8_t* buf, int len)
+{
+ uint16_t diskNumber, diskWithCentralDir, numEntries;
+
+ if (len < kEOCDLen) {
+ /* looks like ZIP file got truncated */
+ LOG(" Zip EOCD: expected >= %d bytes, found %d\n",
+ kEOCDLen, len);
+ return -1;
+ }
+
+ /* this should probably be an assert() */
+ if (ZipEntry::getLongLE(&buf[0x00]) != kSignature)
+ return -1;
+
+ diskNumber = ZipEntry::getShortLE(&buf[0x04]);
+ diskWithCentralDir = ZipEntry::getShortLE(&buf[0x06]);
+ numEntries = ZipEntry::getShortLE(&buf[0x08]);
+ mTotalNumEntries = ZipEntry::getShortLE(&buf[0x0a]);
+ mCentralDirOffset = ZipEntry::getLongLE(&buf[0x10]);
+
+ if (diskNumber != 0 || diskWithCentralDir != 0 ||
+ numEntries != mTotalNumEntries)
+ {
+ LOG("Archive spanning not supported\n");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/tools/ziptime/ZipFile.h b/tools/ziptime/ZipFile.h
new file mode 100644
index 0000000..b049e05
--- /dev/null
+++ b/tools/ziptime/ZipFile.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2006 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 to rewrite zip file headers to remove dynamic timestamps.
+//
+#ifndef __LIBS_ZIPFILE_H
+#define __LIBS_ZIPFILE_H
+
+#include <stdio.h>
+
+#include "ZipEntry.h"
+
+namespace android {
+
+/*
+ * Manipulate a Zip archive.
+ */
+class ZipFile {
+public:
+ ZipFile(void) : mZipFp(NULL) {}
+ ~ZipFile(void) {
+ if (mZipFp != NULL)
+ fclose(mZipFp);
+ }
+
+ /*
+ * Rewrite an archive's headers to remove dynamic timestamps.
+ */
+ status_t rewrite(const char* zipFileName);
+
+private:
+ /* these are private and not defined */
+ ZipFile(const ZipFile& src);
+ ZipFile& operator=(const ZipFile& src);
+
+ class EndOfCentralDir {
+ public:
+ EndOfCentralDir(void) : mTotalNumEntries(0), mCentralDirOffset(0) {}
+
+ status_t readBuf(const uint8_t* buf, int len);
+
+ uint16_t mTotalNumEntries;
+ uint32_t mCentralDirOffset; // offset from first disk
+
+ enum {
+ kSignature = 0x06054b50,
+ kEOCDLen = 22, // EndOfCentralDir len, excl. comment
+
+ kMaxCommentLen = 65535, // longest possible in ushort
+ kMaxEOCDSearch = kMaxCommentLen + EndOfCentralDir::kEOCDLen,
+
+ };
+ };
+
+ /* read all entries in the central dir */
+ status_t rewriteCentralDir(void);
+
+ /*
+ * We use stdio FILE*, which gives us buffering but makes dealing
+ * with files >2GB awkward. Until we support Zip64, we're fine.
+ */
+ FILE* mZipFp; // Zip file pointer
+
+ /* one of these per file */
+ EndOfCentralDir mEOCD;
+};
+
+}; // namespace android
+
+#endif // __LIBS_ZIPFILE_H
diff --git a/tools/ziptime/ZipTime.cpp b/tools/ziptime/ZipTime.cpp
new file mode 100644
index 0000000..99d3231
--- /dev/null
+++ b/tools/ziptime/ZipTime.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+/*
+ * Zip tool to remove dynamic timestamps
+ */
+#include "ZipFile.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+using namespace android;
+
+static void usage(void)
+{
+ fprintf(stderr, "Zip timestamp utility\n");
+ fprintf(stderr, "Copyright (C) 2015 The Android Open Source Project\n\n");
+ fprintf(stderr, "Usage: ziptime file.zip\n");
+}
+
+int main(int argc, char* const argv[])
+{
+ if (argc != 2) {
+ usage();
+ return 2;
+ }
+
+ ZipFile zip;
+ if (zip.rewrite(argv[1]) != 0) {
+ fprintf(stderr, "Unable to rewrite '%s' as zip archive\n", argv[1]);
+ return 1;
+ }
+
+ return 0;
+}