DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) into stage-aosp-master
Bug: 124234733
Change-Id: Ia1b3bc2b62b1840fe0448614327b69db44530c63
diff --git a/Android.mk b/Android.mk
index 39feee1..3d23f54 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,9 +15,7 @@
LOCAL_PATH := $(call my-dir)
subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
- dexgen \
dx \
- tools \
))
include $(subdirs)
diff --git a/dexdump/DexDump.cpp b/dexdump/DexDump.cpp
index 4971c21..9b1ac3a 100644
--- a/dexdump/DexDump.cpp
+++ b/dexdump/DexDump.cpp
@@ -128,8 +128,7 @@
/*
* Converts a type descriptor to human-readable "dotted" form. For
* example, "Ljava/lang/String;" becomes "java.lang.String", and
- * "[I" becomes "int[]". Also converts '$' to '.', which means this
- * form can't be converted back to a descriptor.
+ * "[I" becomes "int[]".
*/
static char* descriptorToDot(const char* str)
{
@@ -166,7 +165,7 @@
int i;
for (i = 0; i < targetLen; i++) {
char ch = str[offset + i];
- newStr[i] = (ch == '/' || ch == '$') ? '.' : ch;
+ newStr[i] = (ch == '/') ? '.' : ch;
}
/* add the appropriate number of brackets for arrays */
@@ -181,16 +180,14 @@
}
/*
- * Converts the class name portion of a type descriptor to human-readable
- * "dotted" form.
+ * Retrieves the class name portion of a type descriptor.
*
* Returns a newly-allocated string.
*/
-static char* descriptorClassToDot(const char* str)
+static char* descriptorClassToName(const char* str)
{
const char* lastSlash;
char* newStr;
- char* cp;
/* reduce to just the class name, trimming trailing ';' */
lastSlash = strrchr(str, '/');
@@ -201,10 +198,6 @@
newStr = strdup(lastSlash);
newStr[strlen(lastSlash)-1] = '\0';
- for (cp = newStr; *cp != '\0'; cp++) {
- if (*cp == '$')
- *cp = '.';
- }
return newStr;
}
@@ -1325,7 +1318,7 @@
if (constructor) {
char* tmp;
- tmp = descriptorClassToDot(backDescriptor);
+ tmp = descriptorClassToName(backDescriptor);
printf("<constructor name=\"%s\"\n", tmp);
free(tmp);
@@ -1590,7 +1583,7 @@
} else {
char* tmp;
- tmp = descriptorClassToDot(classDescriptor);
+ tmp = descriptorClassToName(classDescriptor);
printf("<class name=\"%s\"\n", tmp);
free(tmp);
diff --git a/dexgen/Android.bp b/dexgen/Android.bp
new file mode 100644
index 0000000..fc98bc3
--- /dev/null
+++ b/dexgen/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+ name: "dexgen",
+ sdk_version: "4",
+ srcs: ["src/**/*.java"],
+}
diff --git a/dexgen/Android.mk b/dexgen/Android.mk
deleted file mode 100644
index 59d623a..0000000
--- a/dexgen/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SDK_VERSION := 4
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := dexgen
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/dx/Android.mk b/dx/Android.mk
index c0e10a1..c6aa01d 100644
--- a/dx/Android.mk
+++ b/dx/Android.mk
@@ -61,7 +61,7 @@
$(LOCAL_BUILT_MODULE): PRIVATE_PROGUARD_FLAGS:= \
-include $(addprefix $(LOCAL_PATH)/, shrinkedAndroid.proguard.flags)
-$(LOCAL_BUILT_MODULE): $(call java-lib-files,sdk_v20) \
+$(LOCAL_BUILT_MODULE): $(call java-lib-files,$(call resolve-prebuilt-sdk-module,20)) \
$(addprefix $(LOCAL_PATH)/, shrinkedAndroid.proguard.flags)| $(PROGUARD)
@echo Proguard: $@
$(hide) $(PROGUARD) -injars "$<(**/*.class)" -outjars $@ $(PRIVATE_PROGUARD_FLAGS)
@@ -92,24 +92,6 @@
endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
-# the dexmerger script
-# ============================================================
-include $(CLEAR_VARS)
-LOCAL_IS_HOST_MODULE := true
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := dexmerger
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/dx$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/dexmerger | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
-
-INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
-
# the jasmin script
# ============================================================
include $(CLEAR_VARS)
@@ -145,11 +127,4 @@
INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
-# the other stuff
-# ============================================================
-subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
- junit-tests \
- src \
- ))
-include $(subdirs)
diff --git a/dx/etc/dexmerger b/dx/etc/dexmerger
deleted file mode 100644
index 58fd9ab..0000000
--- a/dx/etc/dexmerger
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Set up prog to be the path of this script, including following symlinks,
-# and set up progdir to be the fully-qualified pathname of its directory.
-prog="$0"
-while [ -h "${prog}" ]; do
- newProg=`/bin/ls -ld "${prog}"`
- newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
- if expr "x${newProg}" : 'x/' >/dev/null; then
- prog="${newProg}"
- else
- progdir=`dirname "${prog}"`
- prog="${progdir}/${newProg}"
- fi
-done
-oldwd=`pwd`
-progdir=`dirname "${prog}"`
-cd "${progdir}"
-progdir=`pwd`
-prog="${progdir}"/`basename "${prog}"`
-cd "${oldwd}"
-
-jarfile=dx.jar
-libdir="$progdir"
-
-if [ ! -r "$libdir/$jarfile" ]; then
- # set dx.jar location for the SDK case
- libdir=`dirname "$progdir"`/platform-tools/lib
-fi
-
-
-if [ ! -r "$libdir/$jarfile" ]; then
- # set dx.jar location for the Android tree case
- libdir=`dirname "$progdir"`/framework
-fi
-
-if [ ! -r "$libdir/$jarfile" ]; then
- echo `basename "$prog"`": can't find $jarfile"
- exit 1
-fi
-
-# By default, give dexmerger a max heap size of 1 gig. This can be overridden
-# by using a "-J" option (see below).
-defaultMx="-Xmx1024M"
-
-# The following will extract any initial parameters of the form
-# "-J<stuff>" from the command line and pass them to the Java
-# invocation (instead of to dexmerger). This makes it possible for you to add
-# a command-line parameter such as "-JXmx256M" in your scripts, for
-# example. "java" (with no args) and "java -X" give a summary of
-# available options.
-
-javaOpts=""
-
-while expr "x$1" : 'x-J' >/dev/null; do
- opt=`expr "x$1" : 'x-J\(.*\)'`
- javaOpts="${javaOpts} -${opt}"
- if expr "x${opt}" : "xXmx[0-9]" >/dev/null; then
- defaultMx="no"
- fi
- shift
-done
-
-if [ "${defaultMx}" != "no" ]; then
- javaOpts="${javaOpts} ${defaultMx}"
-fi
-
-if [ "$OSTYPE" = "cygwin" ]; then
- # For Cygwin, convert the jarfile path into native Windows style.
- jarpath=`cygpath -w "$libdir/$jarfile"`
-else
- jarpath="$libdir/$jarfile"
-fi
-
-exec java $javaOpts -cp "$jarpath" com.android.dx.merge.DexMerger "$@"
diff --git a/dx/junit-tests/Android.bp b/dx/junit-tests/Android.bp
new file mode 100644
index 0000000..9caeb96
--- /dev/null
+++ b/dx/junit-tests/Android.bp
@@ -0,0 +1,10 @@
+// Copyright 2011 The Android Open Source Project
+
+java_test_host {
+ name: "dx-tests",
+ srcs: ["**/*.java"],
+ libs: [
+ "dx",
+ "junit-host",
+ ],
+}
diff --git a/dx/junit-tests/Android.mk b/dx/junit-tests/Android.mk
deleted file mode 100644
index b6dc00f..0000000
--- a/dx/junit-tests/Android.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright 2011 The Android Open Source Project
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_JAVA_LIBRARIES := dx junit-host
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE:= dx-tests
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/dx/src/Android.bp b/dx/src/Android.bp
new file mode 100644
index 0000000..9459e27
--- /dev/null
+++ b/dx/src/Android.bp
@@ -0,0 +1,47 @@
+// Copyright (C) 2006 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+droidstubs_host {
+ name: "dx-doc-stubs",
+ srcs: [
+ "com/**/*.java",
+ ],
+ args: "--hidden",
+ create_doc_stubs: true,
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ unbundled_build: {
+ enabled: false,
+ },
+ },
+}
+
+droiddoc_host {
+ name: "dx-docs",
+ srcs: [
+ ":dx-doc-stubs",
+ ],
+ custom_template: "droiddoc-templates-sdk",
+ create_stubs: false,
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ unbundled_build: {
+ enabled: false,
+ },
+ },
+}
diff --git a/dx/src/Android.mk b/dx/src/Android.mk
deleted file mode 100644
index 9bded44..0000000
--- a/dx/src/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2006 The Android Open Source Project
-#
-LOCAL_PATH := $(call my-dir)
-
-# This tool is prebuilt if we're doing an app-only build.
-ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
-
-dx_src_files := $(call all-subdir-java-files)
-
-# the documentation
-# ============================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(dx_src_files) $(call all-subdir-html-files)
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= dx
-LOCAL_DROIDDOC_OPTIONS := -hidden
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_IS_HOST_MODULE := true
-
-include $(BUILD_DROIDDOC)
-
-dx_src_files :=
-
-endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
diff --git a/dx/src/com/android/dx/dex/code/OutputCollector.java b/dx/src/com/android/dx/dex/code/OutputCollector.java
index 833c0f2..8c8867a 100644
--- a/dx/src/com/android/dx/dex/code/OutputCollector.java
+++ b/dx/src/com/android/dx/dex/code/OutputCollector.java
@@ -65,6 +65,18 @@
finisher.add(insn);
}
+ public DalvInsn get(int at) {
+ if (at >= finisher.size() || at < 0) {
+ return null;
+ } else {
+ return finisher.get(at);
+ }
+ }
+
+ public int size() {
+ return finisher.size();
+ }
+
/**
* Reverses a branch which is buried a given number of instructions
* backward in the output. It is illegal to call this unless the
diff --git a/dx/src/com/android/dx/dex/code/OutputFinisher.java b/dx/src/com/android/dx/dex/code/OutputFinisher.java
index 3b711fb..82a4725 100644
--- a/dx/src/com/android/dx/dex/code/OutputFinisher.java
+++ b/dx/src/com/android/dx/dex/code/OutputFinisher.java
@@ -256,6 +256,14 @@
updateInfo(insn);
}
+ public DalvInsn get(int at) {
+ return insns.get(at);
+ }
+
+ public int size() {
+ return insns.size();
+ }
+
/**
* Helper for {@link #add} and {@link #insert},
* which updates the position and local info flags.
diff --git a/dx/src/com/android/dx/dex/code/RopTranslator.java b/dx/src/com/android/dx/dex/code/RopTranslator.java
index 8375f9e..517b4f8 100644
--- a/dx/src/com/android/dx/dex/code/RopTranslator.java
+++ b/dx/src/com/android/dx/dex/code/RopTranslator.java
@@ -762,7 +762,27 @@
*/
di = new CstInsn(opcode, pos, regs, cst);
}
-
+ // (b/120985556) update the following code
+ // move-object vX, vY
+ // instance-of vY, vX, LMyClass;
+ // into
+ // move-object vX, vY
+ // nop
+ // instance-of vY, vX, LMyClass;
+ DalvInsn previousDi = getPrevNonSpecialInsn();
+ if (opcode.getOpcode() == Opcodes.INSTANCE_OF && previousDi != null) {
+ int prevOpcode = previousDi.getOpcode().getOpcode();
+ if (prevOpcode == Opcodes.MOVE_OBJECT
+ || prevOpcode == Opcodes.MOVE_OBJECT_FROM16
+ || prevOpcode == Opcodes.MOVE_OBJECT_16) {
+ if (di.getRegisters().size() > 0 && previousDi.getRegisters().size() > 1
+ && (di.getRegisters().get(0).getReg()
+ == previousDi.getRegisters().get(1).getReg())) {
+ DalvInsn nopDi = new SimpleInsn(Dops.NOP, pos, RegisterSpecList.EMPTY);
+ addOutput(nopDi);
+ }
+ }
+ }
addOutput(di);
}
}
@@ -830,6 +850,16 @@
output.add(insn);
}
+ protected DalvInsn getPrevNonSpecialInsn() {
+ for (int i = output.size() - 1; i >= 0; --i) {
+ DalvInsn insn = output.get(i);
+ if (insn.getOpcode().getOpcode() != Opcodes.SPECIAL_FORMAT) {
+ return insn;
+ }
+ }
+ return null;
+ }
+
/**
* Adds to the output suffix.
*
diff --git a/dx/src/com/android/dx/dex/file/MethodHandlesSection.java b/dx/src/com/android/dx/dex/file/MethodHandlesSection.java
index f293d05..5aca47e 100644
--- a/dx/src/com/android/dx/dex/file/MethodHandlesSection.java
+++ b/dx/src/com/android/dx/dex/file/MethodHandlesSection.java
@@ -55,7 +55,7 @@
return methodHandles.values();
}
- public void intern(CstMethodHandle methodHandle) {
+ public synchronized void intern(CstMethodHandle methodHandle) {
if (methodHandle == null) {
throw new NullPointerException("methodHandle == null");
}
diff --git a/libdex/Android.bp b/libdex/Android.bp
index 63600c6..ad0128b 100644
--- a/libdex/Android.bp
+++ b/libdex/Android.bp
@@ -38,7 +38,6 @@
include_dirs: [
"dalvik",
"external/zlib",
- "external/safe-iop/include",
],
static_libs: ["liblog"],
whole_static_libs: ["libziparchive"],
@@ -46,6 +45,7 @@
cflags: [
"-Wall",
"-Werror",
+ "-Wimplicit-fallthrough",
],
target: {
android: {
diff --git a/libdex/DexDataMap.cpp b/libdex/DexDataMap.cpp
index 65da14c..18e4a45 100644
--- a/libdex/DexDataMap.cpp
+++ b/libdex/DexDataMap.cpp
@@ -19,7 +19,6 @@
*/
#include "DexDataMap.h"
-#include <safe_iop.h>
#include <stdlib.h>
/*
@@ -27,18 +26,15 @@
*/
DexDataMap* dexDataMapAlloc(u4 maxCount) {
/*
- * Allocate a single chunk for the DexDataMap per se as well as the
+ * Allocate a single chunk for the DexDataMap itself as well as the
* two arrays.
*/
size_t size = 0;
DexDataMap* map = NULL;
- /*
- * Avoiding pulling in safe_iop for safe_iopf.
- */
const u4 sizeOfItems = (u4) (sizeof(u4) + sizeof(u2));
- if (!safe_mul(&size, maxCount, sizeOfItems) ||
- !safe_add(&size, size, sizeof(DexDataMap))) {
+ if (__builtin_mul_overflow(maxCount, sizeOfItems, &size) ||
+ __builtin_add_overflow(size, sizeof(DexDataMap), &size)) {
return NULL;
}
diff --git a/libdex/DexFile.h b/libdex/DexFile.h
index a12f025..7fc7d05 100644
--- a/libdex/DexFile.h
+++ b/libdex/DexFile.h
@@ -33,15 +33,21 @@
#ifndef LIBDEX_DEXFILE_H_
#define LIBDEX_DEXFILE_H_
+/*
+ * Annotation to tell clang that we intend to fall through from one case to
+ * another in a switch. Sourced from android-base/macros.h.
+ */
+#define FALLTHROUGH_INTENDED [[clang::fallthrough]]
+
#ifndef LOG_TAG
# define LOG_TAG "libdex"
#endif
+#include <log/log.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
-#include "cutils/log.h"
/*
* If "very verbose" logging is enabled, make it equivalent to ALOGV.
diff --git a/libdex/DexSwapVerify.cpp b/libdex/DexSwapVerify.cpp
index 1f8eed8..8ffc743 100644
--- a/libdex/DexSwapVerify.cpp
+++ b/libdex/DexSwapVerify.cpp
@@ -25,7 +25,6 @@
#include "DexUtf.h"
#include "Leb128.h"
-#include <safe_iop.h>
#include <zlib.h>
#include <stdlib.h>
@@ -140,7 +139,8 @@
#define CHECK_LIST_SIZE(_ptr, _count, _elemSize) { \
const u1* _start = (const u1*) (_ptr); \
const u1* _end = _start + ((_count) * (_elemSize)); \
- if (!safe_mul(nullptr, (_count), (_elemSize)) || \
+ u4 _dummy; \
+ if (__builtin_mul_overflow((_count), (_elemSize), &_dummy) || \
!checkPtrRange(state, _start, _end, #_ptr)) { \
return 0; \
} \
@@ -617,7 +617,7 @@
ALOGE("Invalid use of void");
return false;
}
- // Fall through.
+ FALLTHROUGH_INTENDED;
}
case 'B':
case 'C':
diff --git a/libdex/InstrUtils.cpp b/libdex/InstrUtils.cpp
index 9039f59..56f5dd8 100644
--- a/libdex/InstrUtils.cpp
+++ b/libdex/InstrUtils.cpp
@@ -619,10 +619,11 @@
* instruction, but it's labeled G in the spec.
*/
pDec->arg[4] = INST_A(inst);
+ FALLTHROUGH_INTENDED;
}
- case 4: pDec->arg[3] = (regList >> 12) & 0x0f;
- case 3: pDec->arg[2] = (regList >> 8) & 0x0f;
- case 2: pDec->arg[1] = (regList >> 4) & 0x0f;
+ case 4: pDec->arg[3] = (regList >> 12) & 0x0f; FALLTHROUGH_INTENDED;
+ case 3: pDec->arg[2] = (regList >> 8) & 0x0f; FALLTHROUGH_INTENDED;
+ case 2: pDec->arg[1] = (regList >> 4) & 0x0f; FALLTHROUGH_INTENDED;
case 1: pDec->vC = pDec->arg[0] = regList & 0x0f; break;
case 0: break; // Valid, but no need to do anything.
default:
diff --git a/libdex/SysUtil.cpp b/libdex/SysUtil.cpp
index 13d11ff..3a1cba3 100644
--- a/libdex/SysUtil.cpp
+++ b/libdex/SysUtil.cpp
@@ -30,8 +30,20 @@
#include <limits.h>
#include <errno.h>
-#include <nativehelper/JNIHelp.h> // TEMP_FAILURE_RETRY may or may not be in unistd
-
+/*
+ * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
+ * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
+ * not already defined, then define it here.
+ */
+#ifndef TEMP_FAILURE_RETRY
+/* Used to retry syscalls that can return EINTR. */
+#define TEMP_FAILURE_RETRY(exp) ({ \
+ typeof (exp) _rc; \
+ do { \
+ _rc = (exp); \
+ } while (_rc == -1 && errno == EINTR); \
+ _rc; })
+#endif
/*
* Create an anonymous shared memory segment large enough to hold "length"
diff --git a/tools/Android.mk b/tools/Android.mk
deleted file mode 100644
index 6571161..0000000
--- a/tools/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(all-subdir-makefiles)
diff --git a/tools/dexdeps/Android.bp b/tools/dexdeps/Android.bp
new file mode 100644
index 0000000..98b3aba
--- /dev/null
+++ b/tools/dexdeps/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_binary_host {
+ name: "dexdeps",
+ manifest: "etc/manifest.txt",
+ srcs: [
+ "src/**/*.java",
+ ],
+ wrapper: "etc/dexdeps",
+}
diff --git a/tools/dexdeps/Android.mk b/tools/dexdeps/Android.mk
deleted file mode 100644
index e1b7e73..0000000
--- a/tools/dexdeps/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-# We use copy-file-to-new-target so that the installed
-# script files' timestamps are at least as new as the
-# .jar files they wrap.
-
-# the dexdeps script
-# ============================================================
-include $(CLEAR_VARS)
-LOCAL_IS_HOST_MODULE := true
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE := dexdeps
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/dexdeps$(COMMON_JAVA_PACKAGE_SUFFIX)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/dexdeps | $(ACP)
- @echo "Copy: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-new-target)
- $(hide) chmod 755 $@
-
-INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
-
-# the other stuff
-# ============================================================
-subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
- src \
- ))
-
-include $(subdirs)
diff --git a/tools/dexdeps/src/Android.bp b/tools/dexdeps/src/Android.bp
new file mode 100644
index 0000000..ad76e4d
--- /dev/null
+++ b/tools/dexdeps/src/Android.bp
@@ -0,0 +1,30 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+droidstubs {
+ name: "dexdeps-doc-stubs",
+ srcs: [
+ "com/**/*.java",
+ ],
+ create_doc_stubs: true,
+}
+
+droiddoc {
+ name: "dexdeps-docs",
+ srcs: [
+ ":dexdeps-doc-stubs",
+ ],
+ custom_template: "droiddoc-templates-sdk",
+ create_stubs: false,
+}
diff --git a/tools/dexdeps/src/Android.mk b/tools/dexdeps/src/Android.mk
deleted file mode 100644
index 8e4abaf..0000000
--- a/tools/dexdeps/src/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-
-# dexdeps java library
-# ============================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_JAR_MANIFEST := ../etc/manifest.txt
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE:= dexdeps
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
-
-include $(BUILD_DROIDDOC)
diff --git a/tools/hprof-conv/HprofConv.c b/tools/hprof-conv/HprofConv.c
index a69440c..cc90176 100644
--- a/tools/hprof-conv/HprofConv.c
+++ b/tools/hprof-conv/HprofConv.c
@@ -764,9 +764,9 @@
res = 2;
finish:
- if (in != stdin)
+ if (in != stdin && in != NULL)
fclose(in);
- if (out != stdout)
+ if (out != stdout && out != NULL)
fclose(out);
return res;
}