Merge "Add Roboto fonts"
diff --git a/core/Makefile b/core/Makefile
index cdf54bb..8901cff 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1589,10 +1589,10 @@
unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
zip -q $@ $$dict_files $$unobfuscated_jars; \
else \
- touch $(dir $@)/dummy; \
- (cd $(dir $@) && zip -q $(notdir $@) dummy); \
- zip -qd $@ dummy; \
- rm $(dir $@)/dummy; \
+ touch $(dir $@)/zipdummy; \
+ (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
+ zip -qd $@ zipdummy; \
+ rm $(dir $@)/zipdummy; \
fi
endif # TARGET_BUILD_APPS
diff --git a/core/binary.mk b/core/binary.mk
index 56f8da8..a9b9e65 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -483,6 +483,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)
@@ -535,6 +536,7 @@
# 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
@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
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index d6441bb..1fe5455 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -20,6 +20,7 @@
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:=
@@ -96,6 +97,7 @@
LOCAL_STRIP_MODULE:=
LOCAL_JNI_SHARED_LIBRARIES:=
LOCAL_JNI_SHARED_LIBRARIES_ABI:=
+LOCAL_JNI_SHARED_LIBRARIES_ZIP_OPTIONS:=
LOCAL_PREBUILT_JNI_LIBS:=
LOCAL_JAR_MANIFEST:=
LOCAL_INSTRUMENTATION_FOR:=
diff --git a/core/definitions.mk b/core/definitions.mk
index 068c9ca..4a504bd 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1959,10 +1959,10 @@
# $(1) package to create
define create-empty-package-at
@mkdir -p $(dir $(1))
-$(hide) touch $(dir $(1))dummy
-$(hide) (cd $(dir $(1)) && jar cf $(notdir $(1)) dummy)
-$(hide) zip -qd $(1) dummy
-$(hide) rm $(dir $(1))dummy
+$(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.
@@ -2024,7 +2024,7 @@
$(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 $(notdir $@) lib)
+$(hide) (cd $(dir $@) && zip -r $(PRIVATE_JNI_SHARED_LIBRARIES_ZIP_OPTIONS) $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib
endef
@@ -2065,12 +2065,15 @@
$(hide) mv $@.signed $@
endef
-# Align STORED entries of a package on 4-byte boundaries
-# to make them easier to mmap.
+# Align STORED entries of a package on 4-byte boundaries to make them easier to mmap.
#
define align-package
$(hide) mv $@ $@.unaligned
-$(hide) $(ZIPALIGN) -f 4 $@.unaligned $@.aligned
+$(hide) $(ZIPALIGN) \
+ -f \
+ $(if $(findstring true, $(PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES)),-p ,) \
+ 4 \
+ $@.unaligned $@.aligned
$(hide) mv $@.aligned $@
endef
diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk
index 2326e83..fc97ad3 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)
@echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)"
@mkdir -p $(dir $@)
@rm -rf $@
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 502016b..9ee1183 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -133,11 +133,11 @@
@echo Building with Jack: $@
$(jack-java-to-dex)
-# The empty command was added because, without it, make misses the fact the $(built_dex) also
-# change $(full_classes_jack). Looks like it would test the date before running $(built_dex)
-# command.
+# $(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)
- @echo
+ $(hide) touch $@
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
diff --git a/core/java.mk b/core/java.mk
index 6eb2247..1494c4b 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -611,13 +611,12 @@
@echo Building with Jack: $@
$(jack-java-to-dex)
-# The empty command was added because, without it, make misses the fact the $(built_dex) also
-# change $(full_classes_jack). Looks like it would test the date before running $(built_dex)
-# command.
+# $(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)
- @echo
+ $(hide) touch $@
-# nothing to do it's built as a side effect of $(built_dex_intermediate)
endif #LOCAL_IS_STATIC_JAVA_LIBRARY
$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 40669a0..134445b 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -392,6 +392,8 @@
$(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_JNI_SHARED_LIBRARIES_ZIP_OPTIONS := $(LOCAL_JNI_SHARED_LIBRARIES_ZIP_OPTIONS)
+$(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
@@ -521,7 +523,7 @@
@rm -rf $(dir $@) && mkdir -p $(dir $@)
$(hide) cp $< $@
$(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f))
- $(call align-package)
+ $(align-package)
$(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 2a28da3..e8af1d9 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -190,6 +190,7 @@
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)
$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
$(transform-prebuilt-to-target)
ifdef extracted_jni_libs
diff --git a/envsetup.sh b/envsetup.sh
index a38f20a..ec20bc1 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1102,6 +1102,11 @@
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 "$@"
}
+function rcgrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.rc*" -print0 | xargs -0 grep --color -n "$@"
+}
+
case `uname -s` in
Darwin)
function mgrep()
diff --git a/tools/droiddoc/templates-sdk/docpage.cs b/tools/droiddoc/templates-sdk/docpage.cs
index d064222..09d48c8 100644
--- a/tools/droiddoc/templates-sdk/docpage.cs
+++ b/tools/droiddoc/templates-sdk/docpage.cs
@@ -195,8 +195,8 @@
<?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_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>
diff --git a/tools/zipalign/README.txt b/tools/zipalign/README.txt
index 9c7d07e..0b80b35 100644
--- a/tools/zipalign/README.txt
+++ b/tools/zipalign/README.txt
@@ -5,6 +5,7 @@
-c : check alignment only (does not modify file)
-f : overwrite existing outfile.zip
+ -p : page align stored shared object files
-v : verbose output
<align> is in bytes, e.g. "4" provides 32-bit alignment
infile.zip is an existing Zip archive
@@ -33,3 +34,7 @@
You can use the "-c" flag to test whether a zip archive is properly aligned.
+The "-p" flag aligns any file with a ".so" extension, and which is stored
+uncompressed in the zip archive, to a 4096-byte page boundary. This
+facilitates directly loading shared libraries from inside a zip archive.
+
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp
index dc2826b..a2dfd02 100644
--- a/tools/zipalign/ZipAlign.cpp
+++ b/tools/zipalign/ZipAlign.cpp
@@ -32,20 +32,39 @@
fprintf(stderr, "Zip alignment utility\n");
fprintf(stderr, "Copyright (C) 2009 The Android Open Source Project\n\n");
fprintf(stderr,
- "Usage: zipalign [-f] [-v] [-z] <align> infile.zip outfile.zip\n"
+ "Usage: zipalign [-f] [-p] [-v] [-z] <align> infile.zip outfile.zip\n"
" zipalign -c [-v] <align> infile.zip\n\n" );
fprintf(stderr,
" <align>: alignment in bytes, e.g. '4' provides 32-bit alignment\n");
fprintf(stderr, " -c: check alignment only (does not modify file)\n");
fprintf(stderr, " -f: overwrite existing outfile.zip\n");
+ fprintf(stderr, " -p: page align stored shared object files\n");
fprintf(stderr, " -v: verbose output\n");
fprintf(stderr, " -z: recompress using Zopfli\n");
}
+static int getAlignment(bool pageAlignSharedLibs, int defaultAlignment,
+ ZipEntry* pEntry) {
+
+ static const int kPageAlignment = 4096;
+
+ if (!pageAlignSharedLibs) {
+ return defaultAlignment;
+ }
+
+ const char* ext = strrchr(pEntry->getFileName(), '.');
+ if (ext && strcmp(ext, ".so") == 0) {
+ return kPageAlignment;
+ }
+
+ return defaultAlignment;
+}
+
/*
* Copy all entries from "pZin" to "pZout", aligning as needed.
*/
-static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfli)
+static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfli,
+ bool pageAlignSharedLibs)
{
int numEntries = pZin->getNumEntries();
ZipEntry* pEntry;
@@ -75,13 +94,15 @@
status = pZout->add(pZin, pEntry, padding, &pNewEntry);
}
} else {
+ const int alignTo = getAlignment(pageAlignSharedLibs, alignment, pEntry);
+
/*
* Copy the entry, adjusting as required. We assume that the
* file position in the new file will be equal to the file
* position in the original.
*/
long newOffset = pEntry->getFileOffset() + bias;
- padding = (alignment - (newOffset % alignment)) % alignment;
+ padding = (alignTo - (newOffset % alignTo)) % alignTo;
//printf("--- %s: orig at %ld(+%d) len=%ld, adding pad=%d\n",
// pEntry->getFileName(), (long) pEntry->getFileOffset(),
@@ -105,7 +126,7 @@
* output file exists and "force" wasn't specified.
*/
static int process(const char* inFileName, const char* outFileName,
- int alignment, bool force, bool zopfli)
+ int alignment, bool force, bool zopfli, bool pageAlignSharedLibs)
{
ZipFile zin, zout;
@@ -136,7 +157,7 @@
return 1;
}
- int result = copyAndAlign(&zin, &zout, alignment, zopfli);
+ int result = copyAndAlign(&zin, &zout, alignment, zopfli, pageAlignSharedLibs);
if (result != 0) {
printf("zipalign: failed rewriting '%s' to '%s'\n",
inFileName, outFileName);
@@ -147,7 +168,8 @@
/*
* Verify the alignment of a zip archive.
*/
-static int verify(const char* fileName, int alignment, bool verbose)
+static int verify(const char* fileName, int alignment, bool verbose,
+ bool pageAlignSharedLibs)
{
ZipFile zipFile;
bool foundBad = false;
@@ -172,11 +194,12 @@
}
} else {
long offset = pEntry->getFileOffset();
- if ((offset % alignment) != 0) {
+ const int alignTo = getAlignment(pageAlignSharedLibs, alignment, pEntry);
+ if ((offset % alignTo) != 0) {
if (verbose) {
printf("%8ld %s (BAD - %ld)\n",
(long) offset, pEntry->getFileName(),
- offset % alignment);
+ offset % alignTo);
}
foundBad = true;
} else {
@@ -204,6 +227,7 @@
bool force = false;
bool verbose = false;
bool zopfli = false;
+ bool pageAlignSharedLibs = false;
int result = 1;
int alignment;
char* endp;
@@ -233,6 +257,9 @@
case 'z':
zopfli = true;
break;
+ case 'p':
+ pageAlignSharedLibs = true;
+ break;
default:
fprintf(stderr, "ERROR: unknown flag -%c\n", *cp);
wantUsage = true;
@@ -260,14 +287,15 @@
if (check) {
/* check existing archive for correct alignment */
- result = verify(argv[1], alignment, verbose);
+ result = verify(argv[1], alignment, verbose, pageAlignSharedLibs);
} else {
/* create the new archive */
- result = process(argv[1], argv[2], alignment, force, zopfli);
+ result = process(argv[1], argv[2], alignment, force, zopfli, pageAlignSharedLibs);
/* trust, but verify */
- if (result == 0)
- result = verify(argv[2], alignment, verbose);
+ if (result == 0) {
+ result = verify(argv[2], alignment, verbose, pageAlignSharedLibs);
+ }
}
bail: