merge from donut

This commit is contained in:
Jean-Baptiste Queru
2009-08-03 07:50:30 -07:00
52 changed files with 1195 additions and 421 deletions

View File

@@ -83,7 +83,9 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew
$(call add-clean-step, rm -rf $(OUT_DIR)/product/*/obj/SHARED_LIBRARIES/lib?camera_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/product/*/obj/SHARED_LIBRARIES/lib?camera_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/product/*/obj/STATIC_LIBRARIES/lib?camera_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/product/*/obj/STATIC_LIBRARIES/lib?camera_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/obj/SHARED_LIBRARIES/libwebcore_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/obj/SHARED_LIBRARIES/libwebcore_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/ringtones/Silence.ogg)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/ringtones/notifications/Silence.ogg)
# ************************************************ # ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************ # ************************************************

View File

@@ -641,10 +641,28 @@ else
SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
endif endif
$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ACP) # The system partition needs room for the recovery image as well. We
# now store the recovery image as a binary patch using the boot image
# as the source (since they are very similar). Generate the patch so
# we can see how big it's going to be, and include that in the system
# image size check calculation.
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(HOST_OUT_EXECUTABLES)/imgdiff \
$(HOST_OUT_EXECUTABLES)/bsdiff
@echo "Construct recovery from boot"
mkdir -p $(dir $@)
PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
endif
$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
@echo "Install system fs image: $@" @echo "Install system fs image: $@"
$(copy-file-to-target) $(copy-file-to-target)
$(hide) $(call assert-max-file-size,$@ $(INSTALLED_RECOVERYIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_MAX_SIZE)) $(hide) $(call assert-max-file-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_MAX_SIZE))
systemimage: $(INSTALLED_SYSTEMIMAGE) systemimage: $(INSTALLED_SYSTEMIMAGE)
@@ -788,6 +806,7 @@ endef
built_ota_tools := \ built_ota_tools := \
$(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \ $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
$(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \
$(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \ $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \
$(call intermediates-dir-for,EXECUTABLES,updater)/updater $(call intermediates-dir-for,EXECUTABLES,updater)/updater
$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
@@ -873,6 +892,7 @@ target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
ifneq ($(TARGET_SIMULATOR),true) ifneq ($(TARGET_SIMULATOR),true)
ifneq ($(TARGET_PRODUCT),sdk) ifneq ($(TARGET_PRODUCT),sdk)
ifneq ($(TARGET_PRODUCT),generic)
name := $(TARGET_PRODUCT) name := $(TARGET_PRODUCT)
ifeq ($(TARGET_BUILD_TYPE),debug) ifeq ($(TARGET_BUILD_TYPE),debug)
@@ -894,6 +914,7 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools
.PHONY: otapackage .PHONY: otapackage
otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
endif # TARGET_PRODUCT != generic
endif # TARGET_PRODUCT != sdk endif # TARGET_PRODUCT != sdk
endif # TARGET_SIMULATOR != true endif # TARGET_SIMULATOR != true

View File

@@ -127,7 +127,7 @@ droiddoc := \
$(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \ $(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
$(HOST_OUT_SHARED_LIBRARIES)/libclearsilver-jni$(HOST_JNILIB_SUFFIX) $(HOST_OUT_SHARED_LIBRARIES)/libclearsilver-jni$(HOST_JNILIB_SUFFIX)
$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX) $(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/apicheck$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER) $(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_TIME := -hdf page.now "$(shell date "+%d %b %Y %k:%M")"
$(full_target): PRIVATE_TEMPLATE_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR) $(full_target): PRIVATE_TEMPLATE_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR)

View File

@@ -61,10 +61,13 @@ CTS_CASE_LIST := \
CtsMediaTestCases \ CtsMediaTestCases \
CtsOsTestCases \ CtsOsTestCases \
CtsPermissionTestCases \ CtsPermissionTestCases \
CtsPermission2TestCases \
CtsProviderTestCases \ CtsProviderTestCases \
CtsTelephonyTestCases \
CtsTextTestCases \ CtsTextTestCases \
CtsUtilTestCases \ CtsUtilTestCases \
CtsViewTestCases \ CtsViewTestCases \
CtsWebkitTestCases \
CtsWidgetTestCases \ CtsWidgetTestCases \
CtsNetTestCases \ CtsNetTestCases \
SignatureTest \ SignatureTest \

View File

@@ -22,7 +22,6 @@ PRODUCT_PACKAGES := \
OpenWnn \ OpenWnn \
libWnnEngDic \ libWnnEngDic \
libWnnJpnDic \ libWnnJpnDic \
libWnnZHCNDic \
libwnndict \ libwnndict \
ApiDemos \ ApiDemos \
GestureBuilder \ GestureBuilder \

View File

@@ -20,7 +20,6 @@ import org.xml.sax.*;
import org.xml.sax.helpers.*; import org.xml.sax.helpers.*;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Stack; import java.util.Stack;
public class ApiCheck { public class ApiCheck {
@@ -83,62 +82,62 @@ public class ApiCheck {
} }
} }
String xmlFileName = args.get(0); ApiCheck acheck = new ApiCheck();
String xmlFileNameNew = args.get(1);
XMLReader xmlreader = null;
try {
// parse the XML files into our data structures
xmlreader = XMLReaderFactory.createXMLReader();
ApiCheck acheck = new ApiCheck();
MakeHandler handler = acheck.new MakeHandler();
xmlreader.setContentHandler(handler);
xmlreader.setErrorHandler(handler);
FileReader filereader = new FileReader(xmlFileName);
xmlreader.parse(new InputSource(filereader));
FileReader filereaderNew = new FileReader(xmlFileNameNew);
xmlreader.parse(new InputSource(filereaderNew));
// establish the superclass relationships ApiInfo oldApi = acheck.parseApi(args.get(0));
handler.getOldApi().resolveSuperclasses(); ApiInfo newApi = acheck.parseApi(args.get(1));
handler.getNewApi().resolveSuperclasses();
// finally, run the consistency check
handler.getOldApi().isConsistent(handler.getNewApi());
} catch (SAXParseException e) { // only run the consistency check if we haven't had XML parse errors
Errors.error(Errors.PARSE_ERROR, if (!Errors.hadError) {
new SourcePositionInfo(xmlFileName, e.getLineNumber(), 0), oldApi.isConsistent(newApi);
e.getMessage()); }
} catch (Exception e) {
e.printStackTrace();
Errors.error(Errors.PARSE_ERROR,
new SourcePositionInfo(xmlFileName, 0, 0),
e.getMessage());
}
Errors.printErrors(); Errors.printErrors();
System.exit(Errors.hadError ? 1 : 0); System.exit(Errors.hadError ? 1 : 0);
} }
private class MakeHandler extends DefaultHandler { public ApiInfo parseApi(String xmlFile) {
FileReader fileReader = null;
try {
XMLReader xmlreader = XMLReaderFactory.createXMLReader();
MakeHandler handler = new MakeHandler();
xmlreader.setContentHandler(handler);
xmlreader.setErrorHandler(handler);
fileReader = new FileReader(xmlFile);
xmlreader.parse(new InputSource(fileReader));
ApiInfo apiInfo = handler.getApi();
apiInfo.resolveSuperclasses();
return apiInfo;
} catch (SAXParseException e) {
Errors.error(Errors.PARSE_ERROR,
new SourcePositionInfo(xmlFile, e.getLineNumber(), 0),
e.getMessage());
} catch (Exception e) {
e.printStackTrace();
Errors.error(Errors.PARSE_ERROR,
new SourcePositionInfo(xmlFile, 0, 0), e.getMessage());
} finally {
if (fileReader != null) {
try {
fileReader.close();
} catch (IOException ignored) {}
}
}
return null;
}
private static class MakeHandler extends DefaultHandler {
private Integer mWarningCount; private ApiInfo mApi;
private ApiInfo mOriginalApi;
private ApiInfo mNewApi;
private boolean mOldApi;
private PackageInfo mCurrentPackage; private PackageInfo mCurrentPackage;
private ClassInfo mCurrentClass; private ClassInfo mCurrentClass;
private AbstractMethodInfo mCurrentMethod; private AbstractMethodInfo mCurrentMethod;
private ConstructorInfo mCurrentConstructor;
private Stack<ClassInfo> mClassScope = new Stack<ClassInfo>(); private Stack<ClassInfo> mClassScope = new Stack<ClassInfo>();
public MakeHandler() { public MakeHandler() {
super(); super();
mOriginalApi = new ApiInfo(); mApi = new ApiInfo();
mNewApi = new ApiInfo();
mOldApi = true;
} }
public void startElement(String uri, String localName, String qName, public void startElement(String uri, String localName, String qName,
@@ -229,25 +228,11 @@ public class ApiCheck {
mCurrentPackage.addClass(mCurrentClass); mCurrentPackage.addClass(mCurrentClass);
mCurrentClass = mClassScope.pop(); mCurrentClass = mClassScope.pop();
} else if (qName.equals("package")){ } else if (qName.equals("package")){
if (mOldApi) { mApi.addPackage(mCurrentPackage);
mOriginalApi.addPackage(mCurrentPackage);
} else {
mNewApi.addPackage(mCurrentPackage);
}
} }
} }
public void endDocument() { public ApiInfo getApi() {
mOldApi = !mOldApi; return mApi;
}
public ApiInfo getOldApi() {
return mOriginalApi;
}
public ApiInfo getNewApi() {
return mNewApi;
}
} }
}
} }

View File

@@ -187,8 +187,8 @@ public class ClassInfo {
} }
for (FieldInfo mInfo : mFields.values()) { for (FieldInfo mInfo : mFields.values()) {
if (cl.mFields.containsKey(mInfo.qualifiedName())) { if (cl.mFields.containsKey(mInfo.name())) {
if (!mInfo.isConsistent(cl.mFields.get(mInfo.qualifiedName()))) { if (!mInfo.isConsistent(cl.mFields.get(mInfo.name()))) {
consistent = false; consistent = false;
} }
} else { } else {
@@ -267,7 +267,7 @@ public class ClassInfo {
} }
public void addField(FieldInfo fInfo) { public void addField(FieldInfo fInfo) {
mFields.put(fInfo.qualifiedName(), fInfo); mFields.put(fInfo.name(), fInfo);
} }
@@ -279,4 +279,26 @@ public class ClassInfo {
return mExistsInBoth; return mExistsInBoth;
} }
public Map<String, ConstructorInfo> allConstructors() {
return mConstructors;
}
public Map<String, FieldInfo> allFields() {
return mFields;
}
public Map<String, MethodInfo> allMethods() {
return mMethods;
}
/**
* Returns the class hierarchy for this class, starting with this class.
*/
public Iterable<ClassInfo> hierarchy() {
List<ClassInfo> result = new ArrayList<ClassInfo>(4);
for (ClassInfo c = this; c != null; c = c.mSuperClass) {
result.add(c);
}
return result;
}
} }

View File

@@ -55,11 +55,12 @@ public class ConstructorInfo implements AbstractMethodInfo {
} }
public String getHashableName() { public String getHashableName() {
String returnString = qualifiedName(); StringBuilder result = new StringBuilder();
result.append(name());
for (ParameterInfo pInfo : mParameters) { for (ParameterInfo pInfo : mParameters) {
returnString += ":" + pInfo.getType(); result.append(":").append(pInfo.getType());
} }
return returnString; return result.toString();
} }
public boolean isInBoth() { public boolean isInBoth() {

View File

@@ -195,7 +195,7 @@ public class MethodInfo implements AbstractMethodInfo {
} }
public String getHashableName() { public String getHashableName() {
return qualifiedName() + getParameterHash(); return name() + getParameterHash();
} }
public String getSignature() { public String getSignature() {

View File

@@ -29,11 +29,19 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := main.c LOCAL_SRC_FILES := main.c
LOCAL_MODULE := applypatch LOCAL_MODULE := applypatch
LOCAL_STATIC_LIBRARIES += libapplypatch libmtdutils libmincrypt libbz
LOCAL_SHARED_LIBRARIES += libz libcutils libstdc++ libc
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := main.c
LOCAL_MODULE := applypatch_static
LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_TAGS := eng LOCAL_MODULE_TAGS := eng
LOCAL_STATIC_LIBRARIES += libapplypatch LOCAL_STATIC_LIBRARIES += libapplypatch libmtdutils libmincrypt libbz
LOCAL_STATIC_LIBRARIES += libmtdutils libmincrypt libbz libz LOCAL_STATIC_LIBRARIES += libz libcutils libstdc++ libc
LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View File

@@ -282,9 +282,10 @@ int SaveFileContents(const char* filename, FileContents file) {
return 0; return 0;
} }
// Copy the contents of source_file to target_mtd partition, a string // Write a memory buffer to target_mtd partition, a string of the form
// of the form "MTD:<partition>[:...]". Return 0 on success. // "MTD:<partition>[:...]". Return 0 on success.
int CopyToMTDPartition(const char* source_file, const char* target_mtd) { int WriteToMTDPartition(unsigned char* data, size_t len,
const char* target_mtd) {
char* partition = strchr(target_mtd, ':'); char* partition = strchr(target_mtd, ':');
if (partition == NULL) { if (partition == NULL) {
fprintf(stderr, "bad MTD target name \"%s\"\n", target_mtd); fprintf(stderr, "bad MTD target name \"%s\"\n", target_mtd);
@@ -298,13 +299,6 @@ int CopyToMTDPartition(const char* source_file, const char* target_mtd) {
if (end != NULL) if (end != NULL)
*end = '\0'; *end = '\0';
FILE* f = fopen(source_file, "rb");
if (f == NULL) {
fprintf(stderr, "failed to open %s for reading: %s\n",
source_file, strerror(errno));
return -1;
}
if (!mtd_partitions_scanned) { if (!mtd_partitions_scanned) {
mtd_scan_partitions(); mtd_scan_partitions();
mtd_partitions_scanned = 1; mtd_partitions_scanned = 1;
@@ -323,20 +317,14 @@ int CopyToMTDPartition(const char* source_file, const char* target_mtd) {
return -1; return -1;
} }
const int buffer_size = 4096; size_t written = mtd_write_data(ctx, (char*)data, len);
char buffer[buffer_size]; if (written != len) {
size_t read; fprintf(stderr, "only wrote %d of %d bytes to MTD %s\n",
while ((read = fread(buffer, 1, buffer_size, f)) > 0) { written, len, partition);
size_t written = mtd_write_data(ctx, buffer, read); mtd_write_close(ctx);
if (written != read) { return -1;
fprintf(stderr, "only wrote %d of %d bytes to MTD %s\n",
written, read, partition);
mtd_write_close(ctx);
return -1;
}
} }
fclose(f);
if (mtd_erase_blocks(ctx, -1) < 0) { if (mtd_erase_blocks(ctx, -1) < 0) {
fprintf(stderr, "error finishing mtd write of %s\n", partition); fprintf(stderr, "error finishing mtd write of %s\n", partition);
mtd_write_close(ctx); mtd_write_close(ctx);
@@ -476,6 +464,26 @@ int ShowLicenses() {
return 0; return 0;
} }
size_t FileSink(unsigned char* data, size_t len, void* token) {
return fwrite(data, 1, len, (FILE*)token);
}
typedef struct {
unsigned char* buffer;
size_t size;
size_t pos;
} MemorySinkInfo;
size_t MemorySink(unsigned char* data, size_t len, void* token) {
MemorySinkInfo* msi = (MemorySinkInfo*)token;
if (msi->size - msi->pos < len) {
return -1;
}
memcpy(msi->buffer + msi->pos, data, len);
msi->pos += len;
return len;
}
// Return the amount of free space (in bytes) on the filesystem // Return the amount of free space (in bytes) on the filesystem
// containing filename. filename must exist. Return -1 on error. // containing filename. filename must exist. Return -1 on error.
size_t FreeSpaceForFile(const char* filename) { size_t FreeSpaceForFile(const char* filename) {
@@ -720,19 +728,36 @@ int applypatch(int argc, char** argv) {
} }
char* outname = NULL; char* outname = NULL;
FILE* output = NULL;
MemorySinkInfo msi;
SinkFn sink = NULL;
void* token = NULL;
if (strncmp(target_filename, "MTD:", 4) == 0) { if (strncmp(target_filename, "MTD:", 4) == 0) {
outname = MTD_TARGET_TEMP_FILE; // We store the decoded output in memory.
msi.buffer = malloc(target_size);
if (msi.buffer == NULL) {
fprintf(stderr, "failed to alloc %ld bytes for output\n",
(long)target_size);
return 1;
}
msi.pos = 0;
msi.size = target_size;
sink = MemorySink;
token = &msi;
} else { } else {
// We write the decoded output to "<tgt-file>.patch". // We write the decoded output to "<tgt-file>.patch".
outname = (char*)malloc(strlen(target_filename) + 10); outname = (char*)malloc(strlen(target_filename) + 10);
strcpy(outname, target_filename); strcpy(outname, target_filename);
strcat(outname, ".patch"); strcat(outname, ".patch");
}
FILE* output = fopen(outname, "wb"); output = fopen(outname, "wb");
if (output == NULL) { if (output == NULL) {
fprintf(stderr, "failed to open output file %s: %s\n", fprintf(stderr, "failed to open output file %s: %s\n",
outname, strerror(errno)); outname, strerror(errno));
return 1; return 1;
}
sink = FileSink;
token = output;
} }
#define MAX_HEADER_LENGTH 8 #define MAX_HEADER_LENGTH 8
@@ -759,7 +784,7 @@ int applypatch(int argc, char** argv) {
} else if (header_bytes_read >= 8 && } else if (header_bytes_read >= 8 &&
memcmp(header, "BSDIFF40", 8) == 0) { memcmp(header, "BSDIFF40", 8) == 0) {
int result = ApplyBSDiffPatch(source_to_use->data, source_to_use->size, int result = ApplyBSDiffPatch(source_to_use->data, source_to_use->size,
patch_filename, 0, output, &ctx); patch_filename, 0, sink, token, &ctx);
if (result != 0) { if (result != 0) {
fprintf(stderr, "ApplyBSDiffPatch failed\n"); fprintf(stderr, "ApplyBSDiffPatch failed\n");
return result; return result;
@@ -768,7 +793,7 @@ int applypatch(int argc, char** argv) {
memcmp(header, "IMGDIFF", 7) == 0 && memcmp(header, "IMGDIFF", 7) == 0 &&
(header[7] == '1' || header[7] == '2')) { (header[7] == '1' || header[7] == '2')) {
int result = ApplyImagePatch(source_to_use->data, source_to_use->size, int result = ApplyImagePatch(source_to_use->data, source_to_use->size,
patch_filename, output, &ctx); patch_filename, sink, token, &ctx);
if (result != 0) { if (result != 0) {
fprintf(stderr, "ApplyImagePatch failed\n"); fprintf(stderr, "ApplyImagePatch failed\n");
return result; return result;
@@ -778,9 +803,11 @@ int applypatch(int argc, char** argv) {
return 1; return 1;
} }
fflush(output); if (output != NULL) {
fsync(fileno(output)); fflush(output);
fclose(output); fsync(fileno(output));
fclose(output);
}
const uint8_t* current_target_sha1 = SHA_final(&ctx); const uint8_t* current_target_sha1 = SHA_final(&ctx);
if (memcmp(current_target_sha1, target_sha1, SHA_DIGEST_SIZE) != 0) { if (memcmp(current_target_sha1, target_sha1, SHA_DIGEST_SIZE) != 0) {
@@ -788,13 +815,13 @@ int applypatch(int argc, char** argv) {
return 1; return 1;
} }
if (strcmp(outname, MTD_TARGET_TEMP_FILE) == 0) { if (output == NULL) {
// Copy the temp file to the MTD partition. // Copy the temp file to the MTD partition.
if (CopyToMTDPartition(outname, target_filename) != 0) { if (WriteToMTDPartition(msi.buffer, msi.pos, target_filename) != 0) {
fprintf(stderr, "copy of %s to %s failed\n", outname, target_filename); fprintf(stderr, "write of patched data to %s failed\n", target_filename);
return 1; return 1;
} }
unlink(outname); free(msi.buffer);
} else { } else {
// Give the .patch file the same owner, group, and mode of the // Give the .patch file the same owner, group, and mode of the
// original source file. // original source file.

View File

@@ -39,10 +39,7 @@ typedef struct _FileContents {
// and use it as the source instead. // and use it as the source instead.
#define CACHE_TEMP_SOURCE "/cache/saved.file" #define CACHE_TEMP_SOURCE "/cache/saved.file"
// When writing to an MTD partition, we first put the output in this typedef size_t (*SinkFn)(unsigned char*, size_t, void*);
// temp file, then copy it to the partition once the patching is
// finished (and the target sha1 verified).
#define MTD_TARGET_TEMP_FILE "/tmp/mtd-temp"
// applypatch.c // applypatch.c
size_t FreeSpaceForFile(const char* filename); size_t FreeSpaceForFile(const char* filename);
@@ -52,15 +49,15 @@ int applypatch(int argc, char** argv);
void ShowBSDiffLicense(); void ShowBSDiffLicense();
int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size, int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size,
const char* patch_filename, ssize_t offset, const char* patch_filename, ssize_t offset,
FILE* output, SHA_CTX* ctx); SinkFn sink, void* token, SHA_CTX* ctx);
int ApplyBSDiffPatchMem(const unsigned char* old_data, ssize_t old_size, int ApplyBSDiffPatchMem(const unsigned char* old_data, ssize_t old_size,
const char* patch_filename, ssize_t patch_offset, const char* patch_filename, ssize_t patch_offset,
unsigned char** new_data, ssize_t* new_size); unsigned char** new_data, ssize_t* new_size);
// imgpatch.c // imgpatch.c
int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size, int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
const char* patch_filename, const char* patch_filename,
FILE* output, SHA_CTX* ctx); SinkFn sink, void* token, SHA_CTX* ctx);
// freecache.c // freecache.c
int MakeFreeSpaceOnCache(size_t bytes_needed); int MakeFreeSpaceOnCache(size_t bytes_needed);

View File

@@ -84,7 +84,7 @@ static off_t offtin(u_char *buf)
int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size, int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size,
const char* patch_filename, ssize_t patch_offset, const char* patch_filename, ssize_t patch_offset,
FILE* output, SHA_CTX* ctx) { SinkFn sink, void* token, SHA_CTX* ctx) {
unsigned char* new_data; unsigned char* new_data;
ssize_t new_size; ssize_t new_size;
@@ -93,7 +93,7 @@ int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size,
return -1; return -1;
} }
if (fwrite(new_data, 1, new_size, output) < new_size) { if (sink(new_data, new_size, token) < new_size) {
fprintf(stderr, "short write of output: %d (%s)\n", errno, strerror(errno)); fprintf(stderr, "short write of output: %d (%s)\n", errno, strerror(errno));
return 1; return 1;
} }

View File

@@ -37,7 +37,7 @@
*/ */
int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size, int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
const char* patch_filename, const char* patch_filename,
FILE* output, SHA_CTX* ctx) { SinkFn sink, void* token, SHA_CTX* ctx) {
FILE* f; FILE* f;
if ((f = fopen(patch_filename, "rb")) == NULL) { if ((f = fopen(patch_filename, "rb")) == NULL) {
fprintf(stderr, "failed to open patch file\n"); fprintf(stderr, "failed to open patch file\n");
@@ -86,7 +86,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
ApplyBSDiffPatch(old_data + src_start, src_len, ApplyBSDiffPatch(old_data + src_start, src_len,
patch_filename, patch_offset, patch_filename, patch_offset,
output, ctx); sink, token, ctx);
} else if (type == CHUNK_GZIP) { } else if (type == CHUNK_GZIP) {
// This branch is basically a duplicate of the CHUNK_DEFLATE // This branch is basically a duplicate of the CHUNK_DEFLATE
// branch, with a bit of extra processing for the gzip header // branch, with a bit of extra processing for the gzip header
@@ -178,7 +178,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
// Now compress the target data and append it to the output. // Now compress the target data and append it to the output.
// start with the gzip header. // start with the gzip header.
fwrite(gzip+64, 1, gzip_header_len, output); sink(gzip+64, gzip_header_len, token);
SHA_update(ctx, gzip+64, gzip_header_len); SHA_update(ctx, gzip+64, gzip_header_len);
// we're done with the expanded_source data buffer, so we'll // we're done with the expanded_source data buffer, so we'll
@@ -207,7 +207,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
ret = deflate(&strm, Z_FINISH); ret = deflate(&strm, Z_FINISH);
size_t have = temp_size - strm.avail_out; size_t have = temp_size - strm.avail_out;
if (fwrite(temp_data, 1, have, output) != have) { if (sink(temp_data, have, token) != have) {
fprintf(stderr, "failed to write %d compressed bytes to output\n", fprintf(stderr, "failed to write %d compressed bytes to output\n",
have); have);
return -1; return -1;
@@ -217,7 +217,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
deflateEnd(&strm); deflateEnd(&strm);
// lastly, the gzip footer. // lastly, the gzip footer.
fwrite(gzip+64+gzip_header_len, 1, 8, output); sink(gzip+64+gzip_header_len, 8, token);
SHA_update(ctx, gzip+64+gzip_header_len, 8); SHA_update(ctx, gzip+64+gzip_header_len, 8);
free(temp_data); free(temp_data);
@@ -240,7 +240,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
return -1; return -1;
} }
SHA_update(ctx, temp, data_len); SHA_update(ctx, temp, data_len);
if (fwrite(temp, 1, data_len, output) != data_len) { if (sink(temp, data_len, token) != data_len) {
fprintf(stderr, "failed to write chunk %d raw data\n", i); fprintf(stderr, "failed to write chunk %d raw data\n", i);
return -1; return -1;
} }
@@ -343,7 +343,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
ret = deflate(&strm, Z_FINISH); ret = deflate(&strm, Z_FINISH);
size_t have = temp_size - strm.avail_out; size_t have = temp_size - strm.avail_out;
if (fwrite(temp_data, 1, have, output) != have) { if (sink(temp_data, have, token) != have) {
fprintf(stderr, "failed to write %d compressed bytes to output\n", fprintf(stderr, "failed to write %d compressed bytes to output\n",
have); have);
return -1; return -1;

View File

@@ -47,6 +47,7 @@ LOCAL_SRC_FILES := \
SampleTagInfo.java \ SampleTagInfo.java \
Scoped.java \ Scoped.java \
SeeTagInfo.java \ SeeTagInfo.java \
SinceTagger.java \
Sorter.java \ Sorter.java \
SourcePositionInfo.java \ SourcePositionInfo.java \
Stubs.java \ Stubs.java \
@@ -57,6 +58,7 @@ LOCAL_SRC_FILES := \
TypeInfo.java TypeInfo.java
LOCAL_JAVA_LIBRARIES := \ LOCAL_JAVA_LIBRARIES := \
apicheck \
clearsilver clearsilver
LOCAL_CLASSPATH := \ LOCAL_CLASSPATH := \

View File

@@ -907,6 +907,7 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
if (kind != null) { if (kind != null) {
data.setValue("class.kind", kind); data.setValue("class.kind", kind);
} }
data.setValue("class.since", getSince());
// the containing package -- note that this can be passed to type_link, // the containing package -- note that this can be passed to type_link,
// but it also contains the list of all of the packages // but it also contains the list of all of the packages

View File

@@ -126,7 +126,7 @@ public class ClearPage
OutputStreamWriter stream = null; OutputStreamWriter stream = null;
try { try {
stream = new OutputStreamWriter( stream = new OutputStreamWriter(
new FileOutputStream(file)); new FileOutputStream(file), "UTF-8");
String rendered = cs.render(); String rendered = cs.render();
stream.write(rendered, 0, rendered.length()); stream.write(rendered, 0, rendered.length());
} }

View File

@@ -33,7 +33,8 @@ public class DocFile
try { try {
File f = new File(filename); File f = new File(filename);
int length = (int)f.length(); int length = (int)f.length();
FileReader reader = new FileReader(f); FileInputStream is = new FileInputStream(f);
InputStreamReader reader = new InputStreamReader(is, "UTF-8");
char[] buf = new char[length]; char[] buf = new char[length];
int index = 0; int index = 0;
int amt; int amt;
@@ -128,7 +129,7 @@ public class DocFile
} else { } else {
if (outfile.indexOf("sdk/") != -1) { if (outfile.indexOf("sdk/") != -1) {
hdf.setValue("sdk", "true"); hdf.setValue("sdk", "true");
if (outfile.indexOf("index.html") != -1) { if ((outfile.indexOf("index.html") != -1) || (outfile.indexOf("features.html") != -1)) {
ClearPage.write(hdf, "sdkpage.cs", outfile); ClearPage.write(hdf, "sdkpage.cs", outfile);
} else { } else {
ClearPage.write(hdf, "docpage.cs", outfile); ClearPage.write(hdf, "docpage.cs", outfile);

View File

@@ -51,8 +51,17 @@ public abstract class DocInfo
public abstract ContainerInfo parent(); public abstract ContainerInfo parent();
public void setSince(String since) {
mSince = since;
}
public String getSince() {
return mSince;
}
private String mRawCommentText; private String mRawCommentText;
Comment mComment; Comment mComment;
SourcePositionInfo mPosition; SourcePositionInfo mPosition;
private String mSince;
} }

View File

@@ -97,6 +97,7 @@ public class DroidDoc
String apiFile = null; String apiFile = null;
String debugStubsFile = ""; String debugStubsFile = "";
HashSet<String> stubPackages = null; HashSet<String> stubPackages = null;
SinceTagger sinceTagger = new SinceTagger();
root = r; root = r;
@@ -186,6 +187,9 @@ public class DroidDoc
apiXML = true; apiXML = true;
apiFile = a[1]; apiFile = a[1];
} }
else if (a[0].equals("-since")) {
sinceTagger.addVersion(a[1], a[2]);
}
} }
// read some prefs from the template // read some prefs from the template
@@ -204,6 +208,9 @@ public class DroidDoc
TodoFile.writeTodoFile(todoFile); TodoFile.writeTodoFile(todoFile);
} }
// Apply @since tags from the XML file
sinceTagger.tagAll(Converter.rootClasses());
// HTML Pages // HTML Pages
if (ClearPage.htmlDir != null) { if (ClearPage.htmlDir != null) {
writeHTMLPages(); writeHTMLPages();
@@ -244,7 +251,7 @@ public class DroidDoc
if (stubsDir != null) { if (stubsDir != null) {
Stubs.writeStubs(stubsDir, apiXML, apiFile, stubPackages); Stubs.writeStubs(stubsDir, apiXML, apiFile, stubPackages);
} }
if (sdkValuePath != null) { if (sdkValuePath != null) {
writeSdkValues(sdkValuePath); writeSdkValues(sdkValuePath);
} }
@@ -394,9 +401,12 @@ public class DroidDoc
if (option.equals("-apixml")) { if (option.equals("-apixml")) {
return 2; return 2;
} }
if (option.equals("-since")) {
return 3;
}
return 0; return 0;
} }
public static boolean validOptions(String[][] options, DocErrorReporter r) public static boolean validOptions(String[][] options, DocErrorReporter r)
{ {
for (String[] a: options) { for (String[] a: options) {
@@ -502,6 +512,7 @@ public class DroidDoc
data.setValue("reference", "true"); data.setValue("reference", "true");
data.setValue("docs.packages." + i + ".name", s); data.setValue("docs.packages." + i + ".name", s);
data.setValue("docs.packages." + i + ".link", pkg.htmlPage()); data.setValue("docs.packages." + i + ".link", pkg.htmlPage());
data.setValue("docs.packages." + i + ".since", pkg.getSince());
TagInfo.makeHDF(data, "docs.packages." + i + ".shortDescr", TagInfo.makeHDF(data, "docs.packages." + i + ".shortDescr",
pkg.firstSentenceTags()); pkg.firstSentenceTags());
i++; i++;
@@ -762,6 +773,7 @@ public class DroidDoc
String name = pkg.name(); String name = pkg.name();
data.setValue("package.name", name); data.setValue("package.name", name);
data.setValue("package.since", pkg.getSince());
data.setValue("package.descr", "...description..."); data.setValue("package.descr", "...description...");
makeClassListHDF(data, "package.interfaces", makeClassListHDF(data, "package.interfaces",

View File

@@ -114,6 +114,7 @@ public class Errors
public static Error DEPRECATION_MISMATCH = new Error(13, WARNING); public static Error DEPRECATION_MISMATCH = new Error(13, WARNING);
public static Error MISSING_COMMENT = new Error(14, WARNING); public static Error MISSING_COMMENT = new Error(14, WARNING);
public static Error IO_ERROR = new Error(15, HIDDEN); public static Error IO_ERROR = new Error(15, HIDDEN);
public static Error NO_SINCE_DATA = new Error(16, WARNING);
public static Error[] ERRORS = { public static Error[] ERRORS = {
UNRESOLVED_LINK, UNRESOLVED_LINK,
@@ -129,6 +130,7 @@ public class Errors
HIDDEN_SUPERCLASS, HIDDEN_SUPERCLASS,
DEPRECATED, DEPRECATED,
IO_ERROR, IO_ERROR,
NO_SINCE_DATA,
}; };
public static boolean setErrorLevel(int code, int level) { public static boolean setErrorLevel(int code, int level) {

View File

@@ -223,6 +223,7 @@ public class FieldInfo extends MemberInfo
TagInfo.makeHDF(data, base + ".descr", inlineTags()); TagInfo.makeHDF(data, base + ".descr", inlineTags());
TagInfo.makeHDF(data, base + ".deprecated", comment().deprecatedTags()); TagInfo.makeHDF(data, base + ".deprecated", comment().deprecatedTags());
TagInfo.makeHDF(data, base + ".seeAlso", comment().seeTags()); TagInfo.makeHDF(data, base + ".seeAlso", comment().seeTags());
data.setValue(base + ".since", getSince());
data.setValue(base + ".final", isFinal() ? "final" : ""); data.setValue(base + ".final", isFinal() ? "final" : "");
data.setValue(base + ".static", isStatic() ? "static" : ""); data.setValue(base + ".static", isStatic() ? "static" : "");
if (isPublic()) { if (isPublic()) {

View File

@@ -15,9 +15,8 @@
*/ */
import org.clearsilver.HDF; import org.clearsilver.HDF;
import org.clearsilver.CS;
import java.util.*; import java.util.*;
import java.io.*;
public class MethodInfo extends MemberInfo public class MethodInfo extends MemberInfo
{ {
@@ -357,6 +356,19 @@ public class MethodInfo extends MemberInfo
return s; return s;
} }
/**
* Returns a name consistent with the {@link
* com.android.apicheck.MethodInfo#getHashableName()}.
*/
public String getHashableName() {
StringBuilder result = new StringBuilder();
result.append(name());
for (ParameterInfo pInfo : mParameters) {
result.append(":").append(pInfo.type().fullName());
}
return result.toString();
}
private boolean inList(ClassInfo item, ThrowsTagInfo[] list) private boolean inList(ClassInfo item, ThrowsTagInfo[] list)
{ {
int len = list.length; int len = list.length;
@@ -545,6 +557,7 @@ public class MethodInfo extends MemberInfo
TagInfo.makeHDF(data, base + ".descr", inlineTags()); TagInfo.makeHDF(data, base + ".descr", inlineTags());
TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags()); TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags());
TagInfo.makeHDF(data, base + ".seeAlso", seeTags()); TagInfo.makeHDF(data, base + ".seeAlso", seeTags());
data.setValue(base + ".since", getSince());
ParamTagInfo.makeHDF(data, base + ".paramTags", paramTags()); ParamTagInfo.makeHDF(data, base + ".paramTags", paramTags());
AttrTagInfo.makeReferenceHDF(data, base + ".attrRefs", comment().attrTags()); AttrTagInfo.makeReferenceHDF(data, base + ".attrRefs", comment().attrTags());
ThrowsTagInfo.makeHDF(data, base + ".throws", throwsTags()); ThrowsTagInfo.makeHDF(data, base + ".throws", throwsTags());

View File

@@ -112,6 +112,7 @@ public class PackageInfo extends DocInfo implements ContainerInfo
data.setValue(base + ".link", htmlPage()); data.setValue(base + ".link", htmlPage());
} }
data.setValue(base + ".name", name()); data.setValue(base + ".name", name());
data.setValue(base + ".since", getSince());
} }
public void makeClassLinkListHDF(HDF data, String base) public void makeClassLinkListHDF(HDF data, String base)

View File

@@ -0,0 +1,182 @@
// Copyright 2009 Google Inc. All Rights Reserved.
import com.android.apicheck.*;
import java.util.*;
/**
* Applies version information to the DroidDoc class model from apicheck XML
* files. Sample usage:
* <pre>
* ClassInfo[] classInfos = ...
*
* SinceTagger sinceTagger = new SinceTagger()
* sinceTagger.addVersion("frameworks/base/api/1.xml", "Android 1.0")
* sinceTagger.addVersion("frameworks/base/api/2.xml", "Android 1.5")
* sinceTagger.tagAll(...);
* </pre>
*/
public class SinceTagger {
private final Map<String, String> xmlToName
= new LinkedHashMap<String, String>();
/**
* Specifies the apicheck XML file and the API version it holds. Calls to
* this method should be called in order from oldest version to newest.
*/
public void addVersion(String file, String name) {
xmlToName.put(file, name);
}
public void tagAll(ClassInfo[] classDocs) {
// read through the XML files in order, applying their since information
// to the Javadoc models
for (Map.Entry<String, String> versionSpec : xmlToName.entrySet()) {
String xmlFile = versionSpec.getKey();
String versionName = versionSpec.getValue();
ApiInfo specApi = new ApiCheck().parseApi(xmlFile);
applyVersionsFromSpec(versionName, specApi, classDocs);
}
if (!xmlToName.isEmpty()) {
warnForMissingVersions(classDocs);
}
}
/**
* Applies the version information to {@code classDocs} where not already
* present.
*
* @param versionName the version name
* @param specApi the spec for this version. If a symbol is in this spec, it
* was present in the named version
* @param classDocs the doc model to update
*/
private void applyVersionsFromSpec(String versionName,
ApiInfo specApi, ClassInfo[] classDocs) {
for (ClassInfo classDoc : classDocs) {
com.android.apicheck.PackageInfo packageSpec
= specApi.getPackages().get(classDoc.containingPackage().name());
if (packageSpec == null) {
continue;
}
com.android.apicheck.ClassInfo classSpec
= packageSpec.allClasses().get(classDoc.name());
if (classSpec == null) {
continue;
}
versionPackage(versionName, classDoc.containingPackage());
versionClass(versionName, classDoc);
versionConstructors(versionName, classSpec, classDoc);
versionFields(versionName, classSpec, classDoc);
versionMethods(versionName, classSpec, classDoc);
}
}
/**
* Applies version information to {@code doc} where not already present.
*/
private void versionPackage(String versionName, PackageInfo doc) {
if (doc.getSince() == null) {
doc.setSince(versionName);
}
}
/**
* Applies version information to {@code doc} where not already present.
*/
private void versionClass(String versionName, ClassInfo doc) {
if (doc.getSince() == null) {
doc.setSince(versionName);
}
}
/**
* Applies version information from {@code spec} to {@code doc} where not
* already present.
*/
private void versionConstructors(String versionName,
com.android.apicheck.ClassInfo spec, ClassInfo doc) {
for (MethodInfo constructor : doc.constructors()) {
if (constructor.getSince() == null
&& spec.allConstructors().containsKey(constructor.getHashableName())) {
constructor.setSince(versionName);
}
}
}
/**
* Applies version information from {@code spec} to {@code doc} where not
* already present.
*/
private void versionFields(String versionName,
com.android.apicheck.ClassInfo spec, ClassInfo doc) {
for (FieldInfo field : doc.fields()) {
if (field.getSince() == null
&& spec.allFields().containsKey(field.name())) {
field.setSince(versionName);
}
}
}
/**
* Applies version information from {@code spec} to {@code doc} where not
* already present.
*/
private void versionMethods(String versionName,
com.android.apicheck.ClassInfo spec, ClassInfo doc) {
for (MethodInfo method : doc.methods()) {
if (method.getSince() != null) {
continue;
}
for (com.android.apicheck.ClassInfo superclass : spec.hierarchy()) {
if (superclass.allMethods().containsKey(method.getHashableName())) {
method.setSince(versionName);
break;
}
}
}
}
/**
* Warns if any symbols are missing version information. When configured
* properly, this will yield zero warnings because {@code apicheck}
* guarantees that all symbols are present in the most recent API.
*/
private void warnForMissingVersions(ClassInfo[] classDocs) {
for (ClassInfo claz : classDocs) {
if (claz.getSince() == null) {
Errors.error(Errors.NO_SINCE_DATA, claz.position(),
"XML missing class " + claz.qualifiedName());
}
for (FieldInfo field : claz.fields()) {
if (field.getSince() == null) {
Errors.error(Errors.NO_SINCE_DATA, field.position(),
"XML missing field "
+ claz.qualifiedName() + "#" + field .name());
}
}
for (MethodInfo constructor : claz.constructors()) {
if (constructor.getSince() == null) {
Errors.error(Errors.NO_SINCE_DATA, constructor.position(),
"XML missing constructor "
+ claz.qualifiedName() + "#" + constructor.getHashableName());
}
}
for (MethodInfo method : claz.methods()) {
if (method.getSince() == null) {
Errors.error(Errors.NO_SINCE_DATA, method.position(),
"XML missing method "
+ claz.qualifiedName() + "#" + method .getHashableName());
}
}
}
}
}

View File

@@ -159,6 +159,7 @@ public class TypeInfo
} }
else if (!isPrimitive() && cl != null && cl.isIncluded()) { else if (!isPrimitive() && cl != null && cl.isIncluded()) {
data.setValue(base + ".link", cl.htmlPage()); data.setValue(base + ".link", cl.htmlPage());
data.setValue(base + ".since", cl.getSince());
} }
if (mIsTypeVariable) { if (mIsTypeVariable) {

View File

@@ -59,7 +59,7 @@ 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/"> licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="<?cs var:toroot ?>license.html">Content restrictions, see the <a href="http://developer.android.com/license.html">Content
License</a>.<?cs License</a>.<?cs
/def ?> /def ?>
@@ -67,7 +67,7 @@ def:custom_cc_copyright() ?>
def:custom_copyright() ?> def:custom_copyright() ?>
Except as noted, this content is licensed under <a 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"> For details and restrictions, see the <a href="http://developer.android.com/license.html">
Content License</a>.<?cs Content License</a>.<?cs
/def ?> /def ?>

View File

@@ -11,12 +11,12 @@ def:default_search_box() ?>
<table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody> <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
<tr> <tr>
<td class="gsc-input"> <td class="gsc-input">
<input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off" <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
title="search developer docs" name="q" title="search developer docs" name="q"
value="search developer docs" value="search developer docs"
onFocus="search_focus_changed(this, true)" onFocus="search_focus_changed(this, true)"
onBlur="search_focus_changed(this, false)" onBlur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '<?cs var:toroot?>')" 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?>')" />
<div id="search_filtered_div" class="no-display"> <div id="search_filtered_div" class="no-display">
<table id="search_filtered" cellspacing=0> <table id="search_filtered" cellspacing=0>
@@ -46,19 +46,29 @@ def:custom_masthead() ?>
</div> </div>
<div id="headerRight"> <div id="headerRight">
<div id="headerLinks"> <div id="headerLinks">
<!-- <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" /> --> <?cs if:template.showLanguageMenu ?>
<img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" />
<span id="language"> <span id="language">
<select name="language" onChange="changeLangPref(this.value)"> <select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option> <option value="en">English&nbsp;&nbsp;&nbsp;</option>
<!-- <option value="ja"></option> --> <option value="ja"></option>
</select> <?cs #
<script type="text/javascript"> <option value="de">Deutsch</option>
<!-- <option value="es">Español</option>
loadLangPref(); <option value="fr">Français</option>
//--> <option value="it">Italiano</option>
</script> <option value="zh-CN"> ()</option>
</span> <option value="zh-TW"> ()</option>
<a href="http://www.android.com">Android.com</a> ?>
</select>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
</span>
<?cs /if ?>
<a href="http://www.android.com">Android.com</a>
</div><?cs </div><?cs
call:default_search_box() ?> call:default_search_box() ?>
</div><!-- headerRight --> </div><!-- headerRight -->
@@ -107,10 +117,8 @@ def:default_left_nav() ?>
<a href="<?cs var:toroot ?>reference/packages.html" <?cs if:(page.title == "Package Index") ?>class="selected"<?cs /if ?> >Package Index</a> | <a href="<?cs var:toroot ?>reference/packages.html" <?cs if:(page.title == "Package Index") ?>class="selected"<?cs /if ?> >Package Index</a> |
<a href="<?cs var:toroot ?>reference/classes.html" <?cs if:(page.title == "Class Index") ?>class="selected"<?cs /if ?>>Class Index</a></nobr> <a href="<?cs var:toroot ?>reference/classes.html" <?cs if:(page.title == "Class Index") ?>class="selected"<?cs /if ?>>Class Index</a></nobr>
</div> </div>
<ul><?cs <ul>
each:pkg=docs.packages ?> <?cs call:package_link_list(docs.packages) ?>
<li <?cs if:(class.package.name == pkg.name) || (package.name == pkg.name)?>class="selected"<?cs /if ?>><?cs call:package_link(pkg) ?></li><?cs
/each ?>
</ul><br/> </ul><br/>
</div> <!-- end packages --> </div> <!-- end packages -->
</div> <!-- end resize-packages --> </div> <!-- end resize-packages -->
@@ -151,8 +159,9 @@ def:default_left_nav() ?>
if (!isMobile) { if (!isMobile) {
$("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav"); $("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
chooseDefaultNav(); chooseDefaultNav();
if ($("#nav-tree").is(':visible')) init_navtree("nav-tree", "<?cs var:toroot ?>", NAVTREE_DATA); if ($("#nav-tree").is(':visible')) {
else { init_default_navtree("<?cs var:toroot ?>");
} else {
addLoadEvent(function() { addLoadEvent(function() {
scrollIntoView("packages-nav"); scrollIntoView("packages-nav");
scrollIntoView("classes-nav"); scrollIntoView("classes-nav");

View File

@@ -4,32 +4,74 @@
elif:sdk ?>sdk<?cs elif:sdk ?>sdk<?cs
elif:home ?>home<?cs elif:home ?>home<?cs
elif:community ?>community<?cs elif:community ?>community<?cs
elif:publish ?>publish<?cs elif:videos ?>videos<?cs /if ?>">
elif:about ?>about<?cs /if ?>">
<li id="home-link"><a href="<?cs var:toroot ?><?cs if:android.whichdoc != "online" ?>offline.html<?cs else ?>index.html<?cs /if ?>"> <li id="home-link"><a href="<?cs var:toroot ?><?cs if:android.whichdoc != "online" ?>offline.html<?cs else ?>index.html<?cs /if ?>">
<?cs if:!sdk.redirect ?>
<span class="en">Home</span> <span class="en">Home</span>
<span class="ja"></span> <span class="de">Startseite</span>
<span class="es"></span>
<span class="fr"></span>
<span class="it"></span>
<span class="ja"></span>
<span class="zh-CN"></span>
<span class="zh-TW"></span>
<?cs /if ?>
</a></li> </a></li>
<li id="sdk-link"><a href="<?cs var:toroot ?>sdk/<?cs var:sdk.current ?>/index.html"> <li id="sdk-link"><a href="<?cs var:toroot ?>sdk/<?cs var:sdk.current ?>/index.html">
<span class="en">SDK</span> <span class="en">SDK</span>
<span class="ja"></span>
</a></li> </a></li>
<li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html" onClick="return loadLast('guide')"> <li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html" onClick="return loadLast('guide')">
<?cs if:!sdk.redirect ?>
<span class="en">Dev Guide</span> <span class="en">Dev Guide</span>
<span class="ja"></span> <span class="de">Handbuch</span>
<span class="es">Guía</span>
<span class="fr">Guide</span>
<span class="it">Guida</span>
<span class="ja"></span>
<span class="zh-CN"></span>
<span class="zh-TW"></span>
<?cs /if ?>
</a></li> </a></li>
<li id="reference-link"><a href="<?cs var:toroot ?>reference/packages.html" onClick="return loadLast('reference')"> <li id="reference-link"><a href="<?cs var:toroot ?>reference/packages.html" onClick="return loadLast('reference')">
<?cs if:!sdk.redirect ?>
<span class="en">Reference</span> <span class="en">Reference</span>
<span class="ja"></span> <span class="de">Referenz</span>
<span class="es">Referencia</span>
<span class="fr">Référence</span>
<span class="it">Riferimento</span>
<span class="ja"></span>
<span class="zh-CN"></span>
<span class="zh-TW"></span>
<?cs /if ?>
</a></li> </a></li>
<li><a href="http://android-developers.blogspot.com"> <li><a href="http://android-developers.blogspot.com" onClick="return requestAppendHL(this.href)">
<?cs if:!sdk.redirect ?>
<span class="en">Blog</span> <span class="en">Blog</span>
<span class="ja"></span> <span class="de"></span>
<span class="es"></span>
<span class="fr"></span>
<span class="it"></span>
<span class="ja"></span>
<span class="zh-CN"></span>
<span class="zh-TW"></span>
<?cs /if ?>
</a></li>
<li id="videos-link"><a href="<?cs var:toroot ?>videos/index.html" onClick="return loadLast('videos')">
<span class="en">Videos</span>
<span class="ja"></span>
</a></li> </a></li>
<li id="community-link"><a href="<?cs var:toroot ?>community/index.html"> <li id="community-link"><a href="<?cs var:toroot ?>community/index.html">
<?cs if:!sdk.redirect ?>
<span class="en">Community</span> <span class="en">Community</span>
<span class="ja"></span> <span class="de"></span>
<span class="es">Comunidad</span>
<span class="fr">Communauté</span>
<span class="it"></span>
<span class="ja"></span>
<span class="zh-CN"></span>
<span class="zh-TW"></span>
<?cs /if ?>
</a></li> </a></li>
</ul> </ul>

View File

@@ -4,7 +4,9 @@
<?cs if:sdk.redirect ?> <?cs if:sdk.redirect ?>
<head> <head>
<title>Redirecting...</title> <title>Redirecting...</title>
<meta http-equiv="refresh" content="0;url=<?cs var:toroot ?>sdk/<?cs var:sdk.current ?>/index.html"> <meta http-equiv="refresh" content="0;url=<?cs var:toroot ?>sdk/<?cs
if:sdk.redirect.path ?><?cs var:sdk.redirect.path ?>"<?cs
else ?><?cs var:sdk.current ?>/index.html<?cs /if ?>"
<link href="<?cs var:toroot ?>assets/android-developer-docs.css" rel="stylesheet" type="text/css" /> <link href="<?cs var:toroot ?>assets/android-developer-docs.css" rel="stylesheet" type="text/css" />
</head> </head>
<?cs else ?> <?cs else ?>
@@ -17,12 +19,14 @@
<?cs call:sdk_nav() ?> <?cs call:sdk_nav() ?>
<?cs if:sdk.redirect ?> <?cs if:sdk.redirect ?>
<div class="g-unit"> <div class="g-unit">
<div id="jd-content"> <div id="jd-content">
<p>Redirecting to <p>Redirecting to
<a href="/sdk/<?cs var:sdk.current ?>/index.html"> <a href="<?cs var:toroot ?>sdk/<?cs
/sdk/<?cs var:sdk.current ?>/index.html if:sdk.redirect.path ?><?cs var:sdk.redirect.path ?>">/sdk/<?cs var:sdk.redirect.path ?><?cs
</a></p> else ?><?cs var:sdk.current ?>/index.html">/sdk/<?cs var:sdk.current ?>/index.html<?cs /if ?>
</a> ...</p>
<?cs else ?> <?cs else ?>
<div class="g-unit" id="doc-content" > <div class="g-unit" id="doc-content" >
<div id="jd-header" class="guide-header" > <div id="jd-header" class="guide-header" >
@@ -45,8 +49,7 @@
<p><a href="/sdk/<?cs var:sdk.current ?>/index.html">Download the current Android SDK</a></p> <p><a href="/sdk/<?cs var:sdk.current ?>/index.html">Download the current Android SDK</a></p>
</div> </div>
<?cs /if ?> <?cs /if ?>
<?cs if:android.whichdoc != "online" ?> <?cs if:android.whichdoc != "online" ?>
<p>The sections below provide an overview of the SDK package. </p> <p>The sections below provide an overview of the SDK package. </p>
@@ -58,14 +61,13 @@
application developers build performance-critical portions of their apps in application developers build performance-critical portions of their apps in
native code. It is designed for use <em>only</em> in conjunction with the native code. It is designed for use <em>only</em> in conjunction with the
Android SDK, so if you have not already installed the Android 1.5 SDK, please do Android SDK, so if you have not already installed the Android 1.5 SDK, please do
so before downloading the NDK. Also, please read <a href="">What is the Android so before downloading the NDK. Also, please read <a href="#overview">What is the
NDK?</a> to get an understanding of what the NDK offers and whether it will be Android NDK?</a> to get an understanding of what the NDK offers and whether it
useful to you.</p> will be useful to you.</p>
<p>Select the download package that is appropriate for your development <p>Select the download package that is appropriate for your development
computer. Note that separate download packages are provided for 32- and 64-bit computer. </p>
Linux platforms.</p>
<table class="download"> <table class="download">
<tr> <tr>
<th>Platform</th> <th>Platform</th>
@@ -76,7 +78,7 @@ Linux platforms.</p>
<tr> <tr>
<td>Windows</td> <td>Windows</td>
<td> <td>
<a href="http://dl.google.com/android/<?cs var:ndk.win_download ?>"><?cs var:ndk.win_download ?></a> <a href="http://dl.google.com/android/ndk/<?cs var:ndk.win_download ?>"><?cs var:ndk.win_download ?></a>
</td> </td>
<td><?cs var:ndk.win_bytes ?> bytes</td> <td><?cs var:ndk.win_bytes ?> bytes</td>
<td><?cs var:ndk.win_checksum ?></td> <td><?cs var:ndk.win_checksum ?></td>
@@ -84,27 +86,19 @@ Linux platforms.</p>
<tr class="alt-color"> <tr class="alt-color">
<td>Mac OS X (intel)</td> <td>Mac OS X (intel)</td>
<td> <td>
<a href="http://dl.google.com/android/<?cs var:ndk.mac_download ?>"><?cs var:ndk.mac_download ?></a> <a href="http://dl.google.com/android/ndk/<?cs var:ndk.mac_download ?>"><?cs var:ndk.mac_download ?></a>
</td> </td>
<td><?cs var:ndk.mac_bytes ?> bytes</td> <td><?cs var:ndk.mac_bytes ?> bytes</td>
<td><?cs var:ndk.mac_checksum ?></td> <td><?cs var:ndk.mac_checksum ?></td>
</tr> </tr>
<tr> <tr>
<td>Linux 32-bit (i386)</td> <td>Linux 32/64-bit (x86)</td>
<td> <td>
<a href="http://dl.google.com/android/<?cs var:ndk.linux_download ?>"><?cs var:ndk.linux_download ?></a> <a href="http://dl.google.com/android/ndk/<?cs var:ndk.linux_download ?>"><?cs var:ndk.linux_download ?></a>
</td> </td>
<td><?cs var:ndk.linux_bytes ?> bytes</td> <td><?cs var:ndk.linux_bytes ?> bytes</td>
<td><?cs var:ndk.linux_checksum ?></td> <td><?cs var:ndk.linux_checksum ?></td>
</tr> </tr>
<tr class="alt-color">
<td>Linux 64-bit (x86_64)</td>
<td>
<a href="http://dl.google.com/android/<?cs var:ndk.linux_64_download ?>"><?cs var:ndk.linux_64_download ?></a>
</td>
<td><?cs var:ndk.linux_64_bytes ?> bytes</td>
<td><?cs var:ndk.linux_64_checksum ?></td>
</tr>
</table> </table>
<?cs else ?> <?cs else ?>

View File

@@ -49,8 +49,12 @@ a:visited code {
input, select, input, select,
textarea, option { textarea, option {
font-family:inherit; padding:0;
font-size:inherit; margin:0;
}
option {
padding:0 4px;
} }
p { p {
@@ -191,6 +195,11 @@ hr.blue {
padding: 25px 0 0; padding: 25px 0 0;
} }
#headerLeft img{
height:50px;
width:180px;
}
#headerRight { #headerRight {
position:absolute; position:absolute;
right:0; right:0;
@@ -238,14 +247,17 @@ hr.blue {
top:7px; top:7px;
} }
#header li a span+span {
display:none;
}
/* TAB HIGHLIGHTING */ /* TAB HIGHLIGHTING */
.home #home-link a, .home #home-link a,
.publish #publish-link a,
.guide #guide-link a, .guide #guide-link a,
.reference #reference-link a, .reference #reference-link a,
.sdk #sdk-link a, .sdk #sdk-link a,
.community #community-link a, .community #community-link a,
.about #about-link a { .videos #videos-link a {
background-image: url(images/bg_images_sprite.png); background-image: url(images/bg_images_sprite.png);
background-position: 0 0; background-position: 0 0;
background-repeat: no-repeat; background-repeat: no-repeat;
@@ -255,12 +267,11 @@ hr.blue {
} }
.home #home-link a:hover, .home #home-link a:hover,
.publish #publish-link a:hover,
.guide #guide-link a:hover, .guide #guide-link a:hover,
.reference #reference-link a:hover, .reference #reference-link a:hover,
.sdk #sdk-link a:hover, .sdk #sdk-link a:hover,
.community #community-link a:hover, .community #community-link a:hover,
.about #about-link a:hover { .videos #videos-link a:hover {
background-image: url(images/bg_images_sprite.png); background-image: url(images/bg_images_sprite.png);
background-position: 0 0; background-position: 0 0;
} }
@@ -276,8 +287,12 @@ hr.blue {
color: #7FA9B5; color: #7FA9B5;
} }
#headerLinks img {
vertical-align:middle;
}
#language { #language {
margin:0 10px; margin:0 10px 0 4px;
} }
#search { #search {
@@ -681,7 +696,6 @@ td.gsc-search-button {
#search-button { #search-button {
margin:0 0 0 2px; margin:0 0 0 2px;
font-size:11px; font-size:11px;
height:1.8em;
} }
/* search result tabs */ /* search result tabs */
@@ -763,65 +777,76 @@ td.gsc-search-button {
} }
#carouselMain { #carouselMain {
background: url('/assets/images/home/bg_home_carousel_board.png') 0 0 no-repeat;
height:auto;
padding: 25px 21px 0; padding: 25px 21px 0;
height:185px;
background-position:top;
overflow:hidden; overflow:hidden;
position:relative; position:relative;
zoom:1; /*IE6*/
} }
#carouselMain img { #carouselMain img {
margin:0; margin:0;
} }
#homeMiddle p { #carouselMain .bulletinDesc h3 {
margin:0; margin:0;
padding-bottom: 1em; padding:0;
}
#carouselMain .bulletinDesc p {
margin:0;
padding:0.7em 0 0;
}
#carouselWheel {
background: url('/assets/images/home/bg_home_carousel_wheel.png') 0 0 no-repeat;
padding-top:40px;
height:150px;
} }
.clearer { clear:both; } .clearer { clear:both; }
#arrow-left, #arrow-right { a#arrow-left, a#arrow-right {
float:left; float:left;
width:42px; width:42px;
height:42px; height:42px;
background-image:url(images/home/carousel_buttons_sprite.png); background-image:url(images/home/carousel_buttons_sprite.png);
background-repeat:no-repeat; background-repeat:no-repeat;
} }
#arrow-left { a#arrow-left {
margin:35px 3px 0 10px; margin:35px 3px 0 10px;
} }
#arrow-right { a#arrow-right {
margin:35px 10px 0 0; margin:35px 10px 0 0;
} }
.arrow-left-off, a.arrow-left-off,
#arrow-left.arrow-left-off:hover { a#arrow-left.arrow-left-off:hover {
background-position:0 0; background-position:0 0;
} }
.arrow-right-off, a.arrow-right-off,
#arrow-right.arrow-right-off:hover { a#arrow-right.arrow-right-off:hover {
background-position:-42px 0; background-position:-42px 0;
} }
#arrow-left:hover { a#arrow-left:hover {
background-position:0 -42px; background-position:0 -42px;
} }
#arrow-right:hover { a#arrow-right:hover {
background-position:-42px -42px; background-position:-42px -42px;
} }
.arrow-left-on { a.arrow-left-on {
background-position:0 0; background-position:0 0;
} }
.arrow-right-on { a.arrow-right-on {
background-position:-42px 0; background-position:-42px 0;
} }
.arrow-right-off, a.arrow-right-off,
.arrow-left-off { a.arrow-left-off {
cursor:default; cursor:default;
} }
.app-list-container { .app-list-container {
margin:37px 20px 0; margin:0 20px;
_margin-top:33px;
position:relative; position:relative;
width:100%; width:100%;
} }
@@ -896,13 +921,19 @@ div#app-list {
padding-bottom:.25em; padding-bottom:.25em;
} }
/*IE6*/
* html #app-list a { zoom: 1; margin:0 24px 0 15px;}
* html #list-clip {
width:430px !important;
}
/*carousel bulletin layouts*/ /*carousel bulletin layouts*/
/*460px width*/ /*460px width*/
/*185px height*/ /*185px height*/
.img-left { .img-left {
float:left; float:left;
width:230px; width:230px;
height:165px;
overflow:hidden; overflow:hidden;
padding:8px 0 8px 8px; padding:8px 0 8px 8px;
} }
@@ -914,7 +945,6 @@ div#app-list {
.img-right { .img-right {
float:right; float:right;
width:220px; width:220px;
height:165px;
overflow:hidden; overflow:hidden;
padding:8px 8px 8px 0; padding:8px 8px 8px 0;
} }
@@ -925,13 +955,275 @@ div#app-list {
text-align:right; text-align:right;
} }
.img-top { .img-top {
height:80px; padding:20px 20px 0;
text-align:center;
} }
.desc-bottom { .desc-bottom {
height:100px; padding:10px;
margin:10px;
} }
/* VIDEO PAGE */
#mainBodyLeft.videoPlayer {
width:570px;
}
#mainBodyRight.videoPlayer {
width:330px;
}
/* player */
#videoPlayerBox {
background-color: #DAF3FC;
border-radius:7px;
-moz-border-radius:7px;
-webkit-border-radius:7px;
width:530px;
padding:20px;
border:1px solid #d3ecf5;
box-shadow:2px 3px 1px #eee;
-moz-box-shadow:2px 3px 1px #eee;
-webkit-box-shadow:2px 3px 1px #eee;
}
#videoBorder {
background-color: #FFF;
min-height:399px;
height:auto !important;
border:1px solid #ccdada;
border-radius:7px 7px 0 0;
-moz-border-radius:7px 7px 0 0;
-webkit-border-top-left-radius:7px;
-webkit-border-top-right-radius:7px;
}
#videoPlayerTitle {
width:500px;
padding:15px 15px 0;
}
#videoPlayerTitle h2 {
font-weight:bold;
font-size:1.2em;
color:#336666;
margin:0;
padding:0;
}
#objectWrapper {
padding:15px 15px;
height:334px;
width:500px;
}
/* playlist tabs */
ul#videoTabs {
list-style-type:none;
padding:0;
clear:both;
margin:0;
padding: 20px 0 0 15px;
zoom:1; /* IE7/8, otherwise top-padding is double */
}
ul#videoTabs li {
display:inline;
padding:0;
margin:0 3px 0 0;
line-height:2em;
}
ul#videoTabs li a {
border-radius:7px 7px 0 0;
-moz-border-radius:7px 7px 0 0;
-webkit-border-top-left-radius:7px;
-webkit-border-top-right-radius:7px;
background:#95c0d0;
color:#fff;
text-decoration:none;
padding:.45em 1.5em;
font-weight:bold;
}
ul#videoTabs li.selected a {
font-weight:bold;
text-decoration:none;
color:#555;
background:#daf3fc;
border-bottom:1px solid #daf3fc;
}
ul#videoTabs li:hover a {
background:#85acba;
}
ul#videoTabs li.selected:hover a {
background:#daf3fc;
}
/* playlists */
#videos {
background:#daf3fc;
margin-bottom:1.5em;
padding:15px;
border-radius:5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
box-shadow:2px 3px 1px #eee;
-moz-box-shadow:2px 3px 1px #eee;
-webkit-box-shadow:2px 3px 1px #eee;
}
#videos div {
display:none;
}
#videos div.selected {
display:block;
}
ul.videoPreviews {
list-style:none;
padding:0;
margin:0;
zoom:1; /* IE, otherwise, layout doesn't update when showing 'more' */
}
ul.videoPreviews li {
margin:0 0 5px;
padding:0;
overflow:hidden;
position:relative;
}
#mainBodyFixed ul.videoPreviews h3 {
font-size: 12px;
margin:0 0 1em 130px;
padding:0;
font-weight:bold;
color:inherit;
}
ul.videoPreviews a {
margin:1px;
padding:10px;
text-decoration:none;
height:90px;
display:block;
border-radius:5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
background-color:transparent;
}
ul.videoPreviews a:hover {
background-color:#FFF;
border:none; /* IE8, otherwise, bg doesn't work */
}
ul.videoPreviews a.selected {
background-color: #FF9900;
}
ul.videoPreviews img {
float:left;
clear:left;
margin:0;
}
ul.videoPreviews h3 {
font-size:12px;
font-weight:bold;
text-decoration:none;
margin:0 0 1em 130px;
padding:0;
}
ul.videoPreviews p {
font-size: 12px;
text-decoration:none;
margin:0 0 1.2em 130px;
}
ul.videoPreviews p.full {
display:none;
}
ul.videoPreviews span.more {
padding:0 0 0 12px;
background:url('/assets/images/arrow_bluelink_down.png') 0 2px no-repeat;
}
ul.videoPreviews span.less {
padding:0 0 0 12px;
background:url('/assets/images/arrow_bluelink_up.png') 0 2px no-repeat;
display:none;
}
ul.videoPreviews p.toggle {
position:absolute;
margin:0;
margin-top:-23px; /* instead of bottom:23px, because IE won't do it correctly */
left:140px;
}
ul.videoPreviews p.toggle a {
height:auto;
margin:0;
padding:0;
zoom:1; /* IE6, otherwise the margin considers the img on redraws */
}
ul.videoPreviews p.toggle a:hover {
text-decoration:underline;
background:transparent; /* IE6, otherwise it inherits white */
}
/* featured videos */
#mainBodyRight h2 {
padding:0 0 5px;
}
#mainBodyRight ul.videoPreviews {
margin:10px 0 0;
}
#mainBodyRight ul.videoPreviews li {
font-size:11px;
line-height:13px;
margin:0 0 5px;
padding:0;
}
#mainBodyRight ul.videoPreviews h3 {
padding:0;
margin:0;
}
#mainBodyRight ul.videoPreviews a {
text-decoration:none;
height:108px;
border:1px solid #FFF;
}
#mainBodyRight ul.videoPreviews a:hover {
border:1px solid #CCDADA;
}
#mainBodyRight ul.videoPreviews a.selected {
border:1px solid #FFF;
}
#mainBodyRight ul.videoPreviews p {
line-height:1.2em;
padding:0;
margin:4px 0 0 130px;
}
#mainBodyRight ul.videoPreviews img {
margin-top:5px;
}

View File

@@ -89,6 +89,10 @@
zoom:1; zoom:1;
} }
#side-nav li a span+span {
display:none;
}
#side-nav li a:hover { #side-nav li a:hover {
text-decoration:underline; text-decoration:underline;
} }
@@ -317,7 +321,6 @@ font-size:.9em;
/* a div that holds a short description */ /* a div that holds a short description */
.jd-descrdiv { .jd-descrdiv {
width:100%;
padding:3px 1em 0 1em; padding:3px 1em 0 1em;
margin:0; margin:0;
border:0; border:0;
@@ -336,6 +339,50 @@ links to summary tables) */
max-width:70%; max-width:70%;
} }
#api-level-toggle {
float:right;
padding:0 10px;
font-size:11px;
color:#999;
}
h4.jd-details-title .api-level,
div#jd-header .api-level {
font-size:12px;
font-weight:normal;
color:#999;
position:absolute;
top:5px;
right:5px;
}
div#jd-header .api-level {
position:relative;
float:right;
margin-top:-1.7em;
}
.absent,
.absent a:link,
.absent a:visited,
.absent a:hover,
.absent * {
color:#aaa !important;
background-color:#f6f6f6 !important;
cursor:default !important;
text-decoration:none !important;
}
#side-nav li.absent,
#side-nav li.absent * {
background-color:#fff !important;
}
#side-nav li.absent.selected,
#side-nav li.absent.selected * {
background-color:#eee !important;
}
/* applies to a div containing links to summary tables */ /* applies to a div containing links to summary tables */
.sum-details-links { .sum-details-links {
margin:0 .5em; margin:0 .5em;
@@ -467,6 +514,10 @@ seealso list, etc */
margin:.5em 1em; margin:.5em 1em;
} }
.jd-tagdata p {
margin:0 0 1em 1em;
}
/* API reference: adjustments to /* API reference: adjustments to
the detailed description block */ the detailed description block */
.jd-tagdescr { .jd-tagdescr {
@@ -504,6 +555,7 @@ h4.jd-details-title {
background-color: #E2E2E2; background-color: #E2E2E2;
margin:1.5em 0 .6em; margin:1.5em 0 .6em;
padding:3px; padding:3px;
position:relative; /* so the api level can be absolute */
} }
h4.jd-tagtitle { h4.jd-tagtitle {
@@ -1130,9 +1182,9 @@ body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body
page-break-inside: avoid; page-break-inside: avoid;
} }
#qv, /* #qv,
#qv-wrapper { #qv-wrapper {
display:none; display:none;
} }
*/
} }

View File

@@ -31,6 +31,15 @@ if ((agent.indexOf("Mobile") != -1) ||
addLoadEvent(mobileSetup); addLoadEvent(mobileSetup);
} }
/* loads the lists.js file to the page.
Loading this in the head was slowing page load time */
addLoadEvent( function() {
var lists = document.createElement("script");
lists.setAttribute("type","text/javascript");
lists.setAttribute("src", toRoot+"reference/lists.js");
$("head").append($(lists));
} );
window.onresize = resizeAll; window.onresize = resizeAll;
function mobileSetup() { function mobileSetup() {
@@ -175,7 +184,8 @@ function resizeHeight() {
devdocNav.css({height:sidenav.css("height")}); devdocNav.css({height:sidenav.css("height")});
$("#nav-tree").css({height:swapperHeight + "px"}); $("#nav-tree").css({height:swapperHeight + "px"});
var section = location.pathname.substring(1,location.pathname.indexOf("/",1)); 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, null);
} }
@@ -192,7 +202,8 @@ function resizeWidth() {
classesNav.css({width:sidenavWidth}); classesNav.css({width:sidenavWidth});
$("#packages-nav").css({width:sidenavWidth}); $("#packages-nav").css({width:sidenavWidth});
var section = location.pathname.substring(1,location.pathname.indexOf("/",1)); var basePath = getBaseUri(location.pathname);
var section = basePath.substring(1,basePath.indexOf("/",1));
writeCookie("width", sidenavWidth, section, null); writeCookie("width", sidenavWidth, section, null);
} }
@@ -205,6 +216,32 @@ function resizeAll() {
} }
} }
function getBaseUri(uri) {
var intlUrl = (uri.substring(0,6) == "/intl/");
if (intlUrl) {
base = uri.substring(uri.indexOf('intl/')+5,uri.length);
base = base.substring(base.indexOf('/')+1, base.length);
//alert("intl, returning base url: /" + base);
return ("/" + base);
} else {
//alert("not intl, returning uri as found.");
return uri;
}
}
function requestAppendHL(uri) {
//append "?hl=<lang> to an outgoing request (such as to blog)
var lang = getLangPref();
if (lang) {
var q = 'hl=' + lang;
uri += '?' + q;
window.location = uri;
return false;
} else {
return true;
}
}
function loadLast(cookiePath) { function loadLast(cookiePath) {
var location = window.location.href; var location = window.location.href;
if (location.indexOf("/"+cookiePath+"/") != -1) { if (location.indexOf("/"+cookiePath+"/") != -1) {
@@ -219,7 +256,7 @@ function loadLast(cookiePath) {
} }
$(window).unload(function(){ $(window).unload(function(){
var path = location.pathname; var path = getBaseUri(location.pathname);
if (path.indexOf("/reference/") != -1) { if (path.indexOf("/reference/") != -1) {
writeCookie("lastpage", path, "reference", null); writeCookie("lastpage", path, "reference", null);
} else if (path.indexOf("/guide/") != -1) { } else if (path.indexOf("/guide/") != -1) {
@@ -227,8 +264,6 @@ $(window).unload(function(){
} }
}); });
function toggle(obj, slide) { function toggle(obj, slide) {
var ul = $("ul", obj); var ul = $("ul", obj);
var li = ul.parent(); var li = ul.parent();
@@ -249,8 +284,6 @@ function toggle(obj, slide) {
} }
} }
function buildToggleLists() { function buildToggleLists() {
$(".toggle-list").each( $(".toggle-list").each(
function(i) { function(i) {
@@ -282,11 +315,11 @@ function swapNav() {
nav_pref = NAV_PREF_PANELS; nav_pref = NAV_PREF_PANELS;
} else { } else {
nav_pref = NAV_PREF_TREE; nav_pref = NAV_PREF_TREE;
init_navtree("nav-tree", toRoot, NAVTREE_DATA); init_default_navtree(toRoot);
} }
var date = new Date(); var date = new Date();
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
writeCookie("nav", nav_pref, null, date.toGMTString()); writeCookie("nav", nav_pref, "reference", date.toGMTString());
$("#nav-panels").toggle(); $("#nav-panels").toggle();
$("#panel-link").toggle(); $("#panel-link").toggle();
@@ -387,12 +420,16 @@ function changeDocLang(lang) {
changeNavLang(lang); changeNavLang(lang);
} }
function changeLangPref(lang) { function changeLangPref(lang, refresh) {
var date = new Date(); var date = new Date();
date.setTime(date.getTime()+(50*365*24*60*60*1000)); // keep this for 50 years expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000))); // keep this for 50 years
writeCookie("pref_lang", lang, null, date); //alert("expires: " + expires)
writeCookie("pref_lang", lang, null, expires);
changeDocLang(lang); //changeDocLang(lang);
if (refresh) {
l = getBaseUri(location.pathname);
window.location = l;
}
} }
function loadLangPref() { function loadLangPref() {
@@ -403,6 +440,9 @@ function loadLangPref() {
} }
function getLangPref() { function getLangPref() {
return $("#language").find(":selected").attr("value"); var lang = $("#language").find(":selected").attr("value");
if (!lang) {
lang = readCookie("pref_lang");
}
return (lang != 0) ? lang : 'en';
} }

View File

@@ -45,23 +45,8 @@ function droid(appName){
currentDroid = appName; currentDroid = appName;
var droid = droidList[appName]; var droid = droidList[appName];
var layout = droid.layout;
var imgDiv = document.getElementById("bulletinImg"); $("#"+appName).show().siblings().hide();
var descDiv = document.getElementById("bulletinDesc");
if (layout == "imgLeft") {
imgDiv.className = "img-left";
descDiv.className = "desc-right";
} else if (layout == "imgTop") {
imgDiv.className = "img-top";
descDiv.className = "desc-bottom";
} else if (layout == "imgRight") {
imgDiv.className = "img-right";
descDiv.className = "desc-left";
}
imgDiv.innerHTML = "<img src='" + toRoot + assetsRoot + "images/home/" + droid.img + "'>";
descDiv.innerHTML = (droid.title != "") ? "<h3>" + droid.title + "</h3>" + droid.desc : droid.desc;
if(oldDroid) if(oldDroid)
oldDroid.removeClass("selected"); oldDroid.removeClass("selected");
@@ -95,7 +80,41 @@ function buildCarousel() {
a.appendChild(br); a.appendChild(br);
a.appendChild(span); a.appendChild(span);
appList.appendChild(a); appList.appendChild(a);
/* add the bulletins */
var layout = droid.layout;
var div = document.createElement("div");
var imgDiv = document.createElement("div");
var descDiv = document.createElement("div");
div.setAttribute("id", x);
div.setAttribute("style", "display:none");
imgDiv.setAttribute("class", "bulletinImg");
descDiv.setAttribute("class", "bulletinDesc");
if (layout == "imgLeft") {
$(imgDiv).addClass("img-left");
$(descDiv).addClass("desc-right");
} else if (layout == "imgTop") {
$(imgDiv).addClass("img-top");
$(descDiv).addClass("desc-bottom");
} else if (layout == "imgRight") {
$(imgDiv).addClass("img-right");
$(descDiv).addClass("desc-left");
}
imgDiv.innerHTML = "<img src='" + toRoot + assetsRoot + "images/home/" + droid.img + "'>";
descDiv.innerHTML = (droid.title != "") ? "<h3>" + droid.title + "</h3>" + droid.desc : droid.desc;
$(div).append(imgDiv);
$(div).append(descDiv);
$("#carouselMain").append(div);
} }
} }
// -- * slider * -- // // -- * slider * -- //

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

View File

@@ -104,7 +104,8 @@ function this_page_relative(toroot)
var file = ""; var file = "";
if (toroot.substr(0, 1) == "/") { if (toroot.substr(0, 1) == "/") {
if (full.substr(0, toroot.length) == toroot) { if (full.substr(0, toroot.length) == toroot) {
return full.substr(toroot.length); var basePath = getBaseUri(full);
return basePath.substring(toroot.length);
} else { } else {
// the file isn't under toroot. Fail. // the file isn't under toroot. Fail.
return null; return null;
@@ -144,8 +145,20 @@ function find_page(url, data)
return null; return null;
} }
function load_navtree_data(toroot) {
var navtreeData = document.createElement("script");
navtreeData.setAttribute("type","text/javascript");
navtreeData.setAttribute("src", toroot+"navtree_data.js");
$("head").append($(navtreeData));
}
function init_default_navtree(toroot) {
load_navtree_data(toroot);
init_navtree("nav-tree", toroot, NAVTREE_DATA);
}
function init_navtree(navtree_id, toroot, root_nodes) function init_navtree(navtree_id, toroot, root_nodes)
{ {
var me = new Object(); var me = new Object();
me.toroot = toroot; me.toroot = toroot;
me.node = new Object(); me.node = new Object();

View File

@@ -102,12 +102,12 @@ Summary:
<?cs if:inhmethods ?> <?cs if:inhmethods ?>
<?cs if:linkcount ?>&#124; <?cs /if ?><a href="#inhmethods">Inherited Methods</a> <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#inhmethods">Inherited Methods</a>
<?cs /if ?> <?cs /if ?>
</nobr>
<?cs if:inhattrs || inhconstants || inhfields || inhmethods || subcount(class.subclasses.direct) || subcount(class.subclasses.indirect) ?> <?cs if:inhattrs || inhconstants || inhfields || inhmethods || subcount(class.subclasses.direct) || subcount(class.subclasses.indirect) ?>
&#124; <a href="#" onclick="return toggleAllSummaryInherited(this)">[Expand All]</a> &#124; <a href="#" onclick="return toggleAllSummaryInherited(this)">[Expand All]</a>
<?cs /if ?> <?cs /if ?>
</div> </div><!-- end sum-details-links -->
</div>
</div><!-- end api-info-block -->
<?cs # this next line must be exactly like this to be parsed by eclipse ?> <?cs # this next line must be exactly like this to be parsed by eclipse ?>
<!-- ======== START OF CLASS DATA ======== --> <!-- ======== START OF CLASS DATA ======== -->
@@ -134,10 +134,12 @@ Summary:
<?cs set:colspan = colspan-1 ?> <?cs set:colspan = colspan-1 ?>
<?cs /each ?> <?cs /each ?>
<div class="api-level"><?cs call:since_tags(class) ?></div>
</div><!-- end header --> </div><!-- end header -->
<div id="jd-content"> <div id="jd-content" class="apilevel-<?cs var:class.since ?>">
<table class="jd-inheritance-table"> <table class="jd-inheritance-table">
<?cs set:colspan = subcount(class.inheritance) ?> <?cs set:colspan = subcount(class.inheritance) ?>
<?cs each:supr = class.inheritance ?> <?cs each:supr = class.inheritance ?>
@@ -189,7 +191,8 @@ Summary:
<?cs def:write_method_summary(methods) ?> <?cs def:write_method_summary(methods) ?>
<?cs set:count = #1 ?> <?cs set:count = #1 ?>
<?cs each:method = methods ?> <?cs each:method = methods ?>
<tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> > <?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
<tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:method.since ?>" >
<td class="jd-typecol"><nobr> <td class="jd-typecol"><nobr>
<?cs var:method.abstract ?> <?cs var:method.abstract ?>
<?cs var:method.synchronized ?> <?cs var:method.synchronized ?>
@@ -472,7 +475,8 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
<?cs # this next line must be exactly like this to be parsed by eclipse ?> <?cs # this next line must be exactly like this to be parsed by eclipse ?>
<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?> <?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
<A NAME="<?cs var:field.anchor ?>"></A> <A NAME="<?cs var:field.anchor ?>"></A>
<div class="jd-details"> <?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
<div class="jd-details api apilevel-<?cs var:field.since ?>">
<h4 class="jd-details-title"> <h4 class="jd-details-title">
<span class="normal"> <span class="normal">
<?cs var:field.scope ?> <?cs var:field.scope ?>
@@ -481,6 +485,9 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
<?cs call:type_link(field.type) ?> <?cs call:type_link(field.type) ?>
</span> </span>
<?cs var:field.name ?> <?cs var:field.name ?>
<span class="api-level">
<?cs call:since_tags(field) ?>
</span>
</h4> </h4>
<div class="jd-details-descr"><?cs call:description(field) ?> <div class="jd-details-descr"><?cs call:description(field) ?>
<?cs if:subcount(field.constantValue) ?> <?cs if:subcount(field.constantValue) ?>
@@ -505,7 +512,8 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
<?cs each:method=methods ?> <?cs each:method=methods ?>
<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?> <?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
<A NAME="<?cs var:method.anchor ?>"></A> <A NAME="<?cs var:method.anchor ?>"></A>
<div class="jd-details"> <?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
<div class="jd-details api apilevel-<?cs var:method.since ?>">
<h4 class="jd-details-title"> <h4 class="jd-details-title">
<span class="normal"> <span class="normal">
<?cs var:method.scope ?> <?cs var:method.scope ?>
@@ -517,6 +525,9 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
</span> </span>
<span class="sympad"><?cs var:method.name ?></span> <span class="sympad"><?cs var:method.name ?></span>
<span class="normal">(<?cs call:parameter_list(method.params) ?>)</span> <span class="normal">(<?cs call:parameter_list(method.params) ?>)</span>
<span class="api-level">
<?cs call:since_tags(method) ?>
</span>
</h4> </h4>
<div class="jd-details-descr"><?cs call:description(method) ?></div> <div class="jd-details-descr"><?cs call:description(method) ?></div>
</div> </div>
@@ -527,8 +538,13 @@ From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs va
<?cs each:attr=attrs ?> <?cs each:attr=attrs ?>
<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?> <?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
<A NAME="<?cs var:attr.anchor ?>"></A> <A NAME="<?cs var:attr.anchor ?>"></A>
<div class="jd-details"> <?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
<h4 class="jd-details-title"><?cs var:attr.name ?></h4> <div class="jd-details api apilevel-<?cs var:attr.since ?>">
<h4 class="jd-details-title"><?cs var:attr.name ?>
<span class="api-level">
<?cs call:since_tags(attr) ?>
</span>
</h4>
<div class="jd-details-descr"> <div class="jd-details-descr">
<?cs call:description(attr) ?> <?cs call:description(attr) ?>

View File

@@ -11,14 +11,12 @@ else ?>
<link href="<?cs var:toroot ?>assets/android-developer-docs.css" rel="stylesheet" type="text/css" /><?cs <link href="<?cs var:toroot ?>assets/android-developer-docs.css" rel="stylesheet" type="text/css" /><?cs
/if ?> /if ?>
<script src="<?cs var:toroot ?>assets/search_autocomplete.js" type="text/javascript"></script> <script src="<?cs var:toroot ?>assets/search_autocomplete.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>reference/lists.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/jquery-resizable.min.js" type="text/javascript"></script> <script src="<?cs var:toroot ?>assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/android-developer-docs.js" type="text/javascript"></script> <script src="<?cs var:toroot ?>assets/android-developer-docs.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
setToRoot("<?cs var:toroot ?>"); setToRoot("<?cs var:toroot ?>");
</script><?cs </script><?cs
if:reference ?> if:reference ?>
<script src="<?cs var:toroot ?>navtree_data.js" type="text/javascript"></script>
<script src="<?cs var:toroot ?>assets/navtree.js" type="text/javascript"></script><?cs <script src="<?cs var:toroot ?>assets/navtree.js" type="text/javascript"></script><?cs
/if ?> /if ?>
<noscript> <noscript>

View File

@@ -115,9 +115,13 @@ def:see_also_tags(also) ?><?cs
/if ?> /if ?>
<?cs /def ?> <?cs /def ?>
<?cs # print the API Level ?><?cs
def:since_tags(obj) ?>
Since: API Level <?cs var:obj.since ?>
<?cs /def ?>
<?cs # Print the long-form description for something. <?cs # Print the long-form description for something.
Uses the following fields: deprecated descr seeAlso ?><?cs Uses the following fields: deprecated descr seeAlso since ?><?cs
def:description(obj) ?><?cs def:description(obj) ?><?cs
call:deprecated_warning(obj) ?> call:deprecated_warning(obj) ?>
<div class="jd-tagdata jd-tagdescr"><p><?cs call:tag_list(obj.descr) ?></p></div><?cs <div class="jd-tagdata jd-tagdescr"><p><?cs call:tag_list(obj.descr) ?></p></div><?cs
@@ -164,7 +168,7 @@ def:description(obj) ?><?cs
</table> </table>
</div><?cs </div><?cs
/if ?><?cs /if ?><?cs
call:see_also_tags(obj.seeAlso) ?><?cs call:see_also_tags(obj.seeAlso) ?><?cs
/def ?> /def ?>
<?cs # A table of links to classes with descriptions, as in a package file or the nested classes ?><?cs <?cs # A table of links to classes with descriptions, as in a package file or the nested classes ?><?cs
@@ -172,7 +176,7 @@ def:class_link_table(classes) ?><?cs
set:count = #1 ?> set:count = #1 ?>
<table class="jd-sumtable-expando"><?cs <table class="jd-sumtable-expando"><?cs
each:cl=classes ?> each:cl=classes ?>
<tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> > <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-linkcol"><?cs call:type_link(cl.type) ?></td>
<td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?>&nbsp;</td> <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?>&nbsp;</td>
</tr><?cs set:count = count + #1 ?><?cs </tr><?cs set:count = count + #1 ?><?cs
@@ -180,32 +184,39 @@ def:class_link_table(classes) ?><?cs
</table><?cs </table><?cs
/def ?> /def ?>
<?cs # A list of links to classes, for use in the side navigation of packages ?><?cs <?cs # A list of links to classes, for use in the side navigation of classes when viewing a package (panel nav) ?><?cs
def:class_link_list(label, classes) ?><?cs def:class_link_list(label, classes) ?><?cs
if:subcount(classes) ?> if:subcount(classes) ?>
<li><h2><?cs var:label ?></h2> <li><h2><?cs var:label ?></h2>
<ul><?cs <ul><?cs
each:cl=classes ?> each:cl=classes ?>
<li><?cs call:type_link(cl.type) ?></li><?cs <li class="api apilevel-<?cs var:cl.type.since ?>"><?cs call:type_link(cl.type) ?></li><?cs
/each ?> /each ?>
</ul> </ul>
</li><?cs </li><?cs
/if ?><?cs /if ?><?cs
/def ?> /def ?>
<?cs # A list of links to classes, for use in the side navigation of classes ?><?cs <?cs # A list of links to classes, for use in the side navigation of classes when viewing a class (panel nav) ?><?cs
def:list(label, classes) ?><?cs def:list(label, classes) ?><?cs
if:subcount(classes) ?> if:subcount(classes) ?>
<li><h2><?cs var:label ?></h2> <li><h2><?cs var:label ?></h2>
<ul><?cs <ul><?cs
each:cl=classes ?> each:cl=classes ?>
<li <?cs if:class.name == cl.label?>class="selected"<?cs /if ?>><?cs call:type_link(cl) ?></li><?cs <li class="<?cs if:class.name == cl.label?>selected<?cs /if ?> api apilevel-<?cs var:cl.since ?>"><?cs call:type_link(cl) ?></li><?cs
/each ?> /each ?>
</ul> </ul>
</li><?cs </li><?cs
/if ?><?cs /if ?><?cs
/def ?> /def ?>
<?cs # A list of links to packages, for use in the side navigation of packages (panel nav) ?><?cs
def:package_link_list(packages) ?><?cs
each:pkg=packages ?>
<li class="<?cs if:(class.package.name == pkg.name) || (package.name == pkg.name)?>selected<?cs /if ?> api apilevel-<?cs var:pkg.since ?>"><?cs call:package_link(pkg) ?></li><?cs
/each ?><?cs
/def ?>
<?cs # An expando trigger ?><?cs <?cs # An expando trigger ?><?cs
def:expando_trigger(id, default) ?> def:expando_trigger(id, default) ?>
<a href="#" onclick="return toggleInherited(this, null)" id="<?cs var:id ?>" class="jd-expando-trigger closed" <a href="#" onclick="return toggleInherited(this, null)" id="<?cs var:id ?>" class="jd-expando-trigger closed"

View File

@@ -21,6 +21,7 @@
<div class="jd-descr"> <div class="jd-descr">
<p><?cs call:tag_list(package.descr) ?></p> <p><?cs call:tag_list(package.descr) ?></p>
</div> </div>
<?cs call:since_tags(package) ?>
<?cs include:"footer.cs" ?> <?cs include:"footer.cs" ?>
</div><!-- end jd-content --> </div><!-- end jd-content -->

View File

@@ -9,21 +9,23 @@
<div id="jd-header"> <div id="jd-header">
package package
<h1><?cs var:package.name ?></h1> <h1><?cs var:package.name ?></h1>
<div class="jd-nav"> <div class="jd-nav">
<?cs if:subcount(package.shortDescr) ?> <?cs if:subcount(package.shortDescr) ?>
Classes | Classes |
<a class="jd-navlink" href="package-descr.html">Description</a> <a class="jd-navlink" href="package-descr.html">Description</a>
<?cs /if ?> <?cs /if ?>
</div> </div>
<span class="api-level">
<?cs call:since_tags(package) ?>
</span>
</div> </div>
<div id="jd-content"> <div id="jd-content">
<?cs if:subcount(package.shortDescr) ?> <?cs if:subcount(package.shortDescr) ?>
<div class="jd-descr"> <div class="jd-descr">
<p><?cs call:tag_list(package.shortDescr) ?> <p><?cs call:tag_list(package.shortDescr) ?></p>
<span class="jd-more"><a href="package-descr.html">more...</a></span></p> <p><span class="jd-more"><a href="package-descr.html">more...</a></span></p>
</div> </div>
<?cs /if ?> <?cs /if ?>

View File

@@ -26,21 +26,22 @@ function build_stubs()
STUBS_DIR=$3 STUBS_DIR=$3
OBJ_DIR=out/stubs/$ID OBJ_DIR=out/stubs/$ID
PLATFORM=${HOST_OS}-${HOST_ARCH}
rm -rf $OBJ_DIR &> /dev/null rm -rf $OBJ_DIR &> /dev/null
mkdir -p $OBJ_DIR mkdir -p $OBJ_DIR
find $SRC_DIR -name '*.java' > $OBJ_DIR/javadoc-src-list find $SRC_DIR -name '*.java' > $OBJ_DIR/javadoc-src-list
( \ ( \
LD_LIBRARY_PATH=out/host/darwin-x86/lib \ LD_LIBRARY_PATH=out/host/$PLATFORM/lib \
javadoc \ javadoc \
\@$OBJ_DIR/javadoc-src-list \ \@$OBJ_DIR/javadoc-src-list \
-J-Xmx512m \ -J-Xmx512m \
-J-Djava.library.path=out/host/darwin-x86/lib \ -J-Djava.library.path=out/host/$PLATFORM/lib \
\ \
-quiet \ -quiet \
-doclet DroidDoc \ -doclet DroidDoc \
-docletpath out/host/darwin-x86/framework/clearsilver.jar:out/host/darwin-x86/framework/droiddoc.jar \ -docletpath out/host/$PLATFORM/framework/clearsilver.jar:out/host/$PLATFORM/framework/droiddoc.jar:out/host/$PLATFORM/framework/apicheck.jar \
-templatedir tools/droiddoc/templates \ -templatedir tools/droiddoc/templates \
-classpath out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar \ -classpath out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar \
-sourcepath $SRC_DIR:out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar \ -sourcepath $SRC_DIR:out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar \

View File

@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
DIR=tools/droiddoc/test/stubs DIR=build/tools/droiddoc/test/stubs
pushd $TOP pushd $TOP

View File

@@ -94,13 +94,13 @@ class AmendGenerator(object):
for i in sha1: for i in sha1:
out.append(" " + i) out.append(" " + i)
self.script.append("".join(out)) self.script.append("".join(out))
self.included_files.add("applypatch") self.included_files.add(("applypatch_static", "applypatch"))
def CacheFreeSpaceCheck(self, amount): def CacheFreeSpaceCheck(self, amount):
"""Check that there's at least 'amount' space that can be made """Check that there's at least 'amount' space that can be made
available on /cache.""" available on /cache."""
self.script.append("run_program PACKAGE:applypatch -s %d" % (amount,)) self.script.append("run_program PACKAGE:applypatch -s %d" % (amount,))
self.included_files.add("applypatch") self.included_files.add(("applypatch_static", "applypatch"))
def Mount(self, kind, what, path): def Mount(self, kind, what, path):
# no-op; amend uses it's 'roots' system to automatically mount # no-op; amend uses it's 'roots' system to automatically mount
@@ -155,7 +155,7 @@ class AmendGenerator(object):
(srcfile, tgtfile, tgtsha1, tgtsize)) + (srcfile, tgtfile, tgtsha1, tgtsize)) +
" ".join(["%s:%s" % patchpairs[i:i+2] " ".join(["%s:%s" % patchpairs[i:i+2]
for i in range(0, len(patchpairs), 2)])) for i in range(0, len(patchpairs), 2)]))
self.included_files.add("applypatch") self.included_files.add(("applypatch_static", "applypatch"))
def WriteFirmwareImage(self, kind, fn): def WriteFirmwareImage(self, kind, fn):
"""Arrange to update the given firmware image (kind must be """Arrange to update the given firmware image (kind must be
@@ -195,11 +195,16 @@ class AmendGenerator(object):
common.ZipWriteStr(output_zip, "META-INF/com/google/android/update-script", common.ZipWriteStr(output_zip, "META-INF/com/google/android/update-script",
"\n".join(self.script) + "\n") "\n".join(self.script) + "\n")
for i in self.included_files: for i in self.included_files:
if isinstance(i, tuple):
sourcefn, targetfn = i
else:
sourcefn = i
targetfn = i
try: try:
if input_path is None: if input_path is None:
data = input_zip.read(os.path.join("OTA/bin", i)) data = input_zip.read(os.path.join("OTA/bin", sourcefn))
else: else:
data = open(os.path.join(input_path, i)).read() data = open(os.path.join(input_path, sourcefn)).read()
common.ZipWriteStr(output_zip, i, data, perms=0755) common.ZipWriteStr(output_zip, targetfn, data, perms=0755)
except (IOError, KeyError), e: except (IOError, KeyError), e:
raise ExternalError("unable to include binary %s: %s" % (i, e)) raise ExternalError("unable to include binary %s: %s" % (i, e))

View File

@@ -277,12 +277,6 @@ def SignOutput(temp_zip_name, output_zip_name):
common.SignFile(temp_zip_name, output_zip_name, OPTIONS.package_key, pw) common.SignFile(temp_zip_name, output_zip_name, OPTIONS.package_key, pw)
def FixPermissions(script):
Item.GetMetadata()
root = Item.Get("system")
root.SetPermissions(script)
def AppendAssertions(script, input_zip): def AppendAssertions(script, input_zip):
device = GetBuildProp("ro.product.device", input_zip) device = GetBuildProp("ro.product.device", input_zip)
script.AssertDevice(device) script.AssertDevice(device)
@@ -294,6 +288,47 @@ def AppendAssertions(script, input_zip):
script.AssertSomeBootloader(*bootloaders) script.AssertSomeBootloader(*bootloaders)
def MakeRecoveryPatch(output_zip, recovery_img, boot_img):
"""Generate a binary patch that creates the recovery image starting
with the boot image. (Most of the space in these images is just the
kernel, which is identical for the two, so the resulting patch
should be efficient.) Add it to the output zip, along with a shell
script that is run from init.rc on first boot to actually do the
patching and install the new recovery image.
recovery_img and boot_img should be File objects for the
corresponding images.
Returns an Item for the shell script, which must be made
executable.
"""
patch = Difference(recovery_img, boot_img, "imgdiff")
common.ZipWriteStr(output_zip, "system/recovery-from-boot.p", patch)
Item.Get("system/recovery-from-boot.p", dir=False)
# Images with different content will have a different first page, so
# we check to see if this recovery has already been installed by
# testing just the first 2k.
HEADER_SIZE = 2048
header_sha1 = sha.sha(recovery_img.data[:HEADER_SIZE]).hexdigest()
sh = """#!/system/bin/sh
if ! applypatch -c MTD:recovery:%(header_size)d:%(header_sha1)s; then
log -t recovery "Installing new recovery image"
applypatch MTD:boot:%(boot_size)d:%(boot_sha1)s MTD:recovery %(recovery_sha1)s %(recovery_size)d %(boot_sha1)s:/system/recovery-from-boot.p
else
log -t recovery "Recovery image already installed"
fi
""" % { 'boot_size': boot_img.size,
'boot_sha1': boot_img.sha1,
'header_size': HEADER_SIZE,
'header_sha1': header_sha1,
'recovery_size': recovery_img.size,
'recovery_sha1': recovery_img.sha1 }
common.ZipWriteStr(output_zip, "system/etc/install-recovery.sh", sh)
return Item.Get("system/etc/install-recovery.sh", dir=False)
def WriteFullOTAPackage(input_zip, output_zip): def WriteFullOTAPackage(input_zip, output_zip):
if OPTIONS.script_mode == "auto": if OPTIONS.script_mode == "auto":
script = both_generator.BothGenerator(2) script = both_generator.BothGenerator(2)
@@ -331,14 +366,24 @@ def WriteFullOTAPackage(input_zip, output_zip):
symlinks = CopySystemFiles(input_zip, output_zip) symlinks = CopySystemFiles(input_zip, output_zip)
script.MakeSymlinks(symlinks) script.MakeSymlinks(symlinks)
if common.BuildAndAddBootableImage( boot_img = File("boot.img", common.BuildBootableImage(
os.path.join(OPTIONS.input_tmp, "RECOVERY"), os.path.join(OPTIONS.input_tmp, "BOOT")))
"system/recovery.img", output_zip): recovery_img = File("recovery.img", common.BuildBootableImage(
Item.Get("system/recovery.img", dir=False) os.path.join(OPTIONS.input_tmp, "RECOVERY")))
i = MakeRecoveryPatch(output_zip, recovery_img, boot_img)
FixPermissions(script) Item.GetMetadata()
common.AddBoot(output_zip) # GetMetadata uses the data in android_filesystem_config.h to assign
# the uid/gid/mode of all files. We want to override that for the
# recovery patching shell script to make it executable.
i.uid = 0
i.gid = 0
i.mode = 0544
Item.Get("system").SetPermissions(script)
common.CheckSize(boot_img.data, "boot.img")
common.ZipWriteStr(output_zip, "boot.img", boot_img.data)
script.ShowProgress(0.2, 0) script.ShowProgress(0.2, 0)
script.WriteRawImage("boot", "boot.img") script.WriteRawImage("boot", "boot.img")
@@ -549,17 +594,6 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
script.PatchCheck("/"+fn, tf.sha1, sf.sha1) script.PatchCheck("/"+fn, tf.sha1, sf.sha1)
if updating_recovery:
d = Difference(target_recovery, source_recovery, "imgdiff")
print "recovery target: %d source: %d diff: %d" % (
target_recovery.size, source_recovery.size, len(d))
common.ZipWriteStr(output_zip, "patch/recovery.img.p", d)
script.PatchCheck("MTD:recovery:%d:%s:%d:%s" %
(source_recovery.size, source_recovery.sha1,
target_recovery.size, target_recovery.sha1))
if updating_boot: if updating_boot:
d = Difference(target_boot, source_boot, "imgdiff") d = Difference(target_boot, source_boot, "imgdiff")
print "boot target: %d source: %d diff: %d" % ( print "boot target: %d source: %d diff: %d" % (
@@ -603,16 +637,20 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
print "boot image unchanged; skipping." print "boot image unchanged; skipping."
if updating_recovery: if updating_recovery:
# Produce /system/recovery.img by applying a patch to the current # Is it better to generate recovery as a patch from the current
# contents of the recovery partition. # boot image, or from the previous recovery image? For large
script.Print("Patching recovery image...") # updates with significant kernel changes, probably the former.
script.ApplyPatch("MTD:recovery:%d:%s:%d:%s" # For small updates where the kernel hasn't changed, almost
% (source_recovery.size, source_recovery.sha1, # certainly the latter. We pick the first option. Future
target_recovery.size, target_recovery.sha1), # complicated schemes may let us effectively use both.
"/system/recovery.img", #
target_recovery.size, target_recovery.sha1, # A wacky possibility: as long as there is room in the boot
source_recovery.sha1, "/tmp/patchtmp/recovery.img.p") # partition, include the binaries and image files from recovery in
print "recovery image changed; including." # the boot image (though not in the ramdisk) so they can be used
# as fodder for constructing the recovery image.
recovery_sh_item = MakeRecoveryPatch(output_zip,
target_recovery, target_boot)
print "recovery image changed; including as patch from boot."
else: else:
print "recovery image unchanged; skipping." print "recovery image unchanged; skipping."
@@ -640,7 +678,12 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
target_symlinks_d = dict([(i[1], i[0]) for i in target_symlinks]) target_symlinks_d = dict([(i[1], i[0]) for i in target_symlinks])
temp_script = script.MakeTemporary() temp_script = script.MakeTemporary()
FixPermissions(temp_script) Item.GetMetadata()
if updating_recovery:
recovery_sh_item.uid = 0
recovery_sh_item.gid = 0
recovery_sh_item.mode = 0544
Item.Get("system").SetPermissions(temp_script)
# Note that this call will mess up the tree of Items, so make sure # Note that this call will mess up the tree of Items, so make sure
# we're done with it. # we're done with it.