Merge "Remove usage of SharedBuffer"
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index 48efb28..adff72e 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -695,7 +695,7 @@
static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set,
- bool vm_safe_mode, bool debuggable)
+ bool vm_safe_mode, bool debuggable, bool post_bootcomplete)
{
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
@@ -719,8 +719,24 @@
dex2oat_compiler_filter_flag, NULL) > 0;
char dex2oat_threads_buf[PROPERTY_VALUE_MAX];
- bool have_dex2oat_threads_flag = property_get("dalvik.vm.dex2oat-threads", dex2oat_threads_buf,
- NULL) > 0;
+ bool have_dex2oat_threads_flag = false;
+ if (!post_bootcomplete) {
+ have_dex2oat_threads_flag = property_get("dalvik.vm.boot-dex2oat-threads",
+ dex2oat_threads_buf,
+ NULL) > 0;
+ // If there's no boot property, fall back to the image property.
+ if (!have_dex2oat_threads_flag) {
+ have_dex2oat_threads_flag = property_get("dalvik.vm.image-dex2oat-threads",
+ dex2oat_threads_buf,
+ NULL) > 0;
+ }
+ // If there's neither, fall back to the default property.
+ }
+ if (!have_dex2oat_threads_flag) {
+ have_dex2oat_threads_flag = property_get("dalvik.vm.dex2oat-threads",
+ dex2oat_threads_buf,
+ NULL) > 0;
+ }
char dex2oat_threads_arg[PROPERTY_VALUE_MAX + 2];
if (have_dex2oat_threads_flag) {
sprintf(dex2oat_threads_arg, "-j%s", dex2oat_threads_buf);
@@ -1014,6 +1030,27 @@
return true;
}
+static bool IsPostBootComplete() {
+ char dev_bootcomplete_prop_buf[PROPERTY_VALUE_MAX];
+ if (property_get("dev.bootcomplete", dev_bootcomplete_prop_buf, "0") > 0) {
+ return (strcmp(dev_bootcomplete_prop_buf, "1") == 0);
+ }
+ return false;
+}
+
+static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) {
+ if (set_to_bg) {
+ if (set_sched_policy(0, SP_BACKGROUND) < 0) {
+ ALOGE("set_sched_policy failed: %s\n", strerror(errno));
+ exit(70);
+ }
+ if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
+ ALOGE("setpriority failed: %s\n", strerror(errno));
+ exit(71);
+ }
+ }
+}
+
int dexopt(const char *apk_path, uid_t uid, bool is_public,
const char *pkgname, const char *instruction_set, int dexopt_needed,
bool vm_safe_mode, bool debuggable, const char* oat_dir)
@@ -1025,6 +1062,7 @@
const char *input_file;
char in_odex_path[PKG_PATH_MAX];
int res, input_fd=-1, out_fd=-1, swap_fd=-1;
+ bool post_bootcomplete = IsPostBootComplete();
// Early best-effort check whether we can fit the the path into our buffers.
// Note: the cache path will require an additional 5 bytes for ".swap", but we'll try to run
@@ -1147,14 +1185,7 @@
ALOGE("capset failed: %s\n", strerror(errno));
exit(66);
}
- if (set_sched_policy(0, SP_BACKGROUND) < 0) {
- ALOGE("set_sched_policy failed: %s\n", strerror(errno));
- exit(70);
- }
- if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
- ALOGE("setpriority failed: %s\n", strerror(errno));
- exit(71);
- }
+ SetDex2OatAndPatchOatScheduling(post_bootcomplete);
if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) {
ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
exit(67);
@@ -1171,7 +1202,7 @@
input_file_name++;
}
run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname,
- instruction_set, vm_safe_mode, debuggable);
+ instruction_set, vm_safe_mode, debuggable, post_bootcomplete);
} else {
ALOGE("Invalid dexopt needed: %d\n", dexopt_needed);
exit(73);
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 69a6432..ecd2d90 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -452,7 +452,8 @@
properties.toolType = parcel->readInt32();
}
- while (sampleCount-- > 0) {
+ while (sampleCount > 0) {
+ sampleCount--;
mSampleEventTimes.push(parcel->readInt64());
for (size_t i = 0; i < pointerCount; i++) {
mSamplePointerCoords.push();
diff --git a/libs/input/VelocityTracker.cpp b/libs/input/VelocityTracker.cpp
index 6c70c3c..7f6b157 100644
--- a/libs/input/VelocityTracker.cpp
+++ b/libs/input/VelocityTracker.cpp
@@ -46,7 +46,8 @@
static float vectorDot(const float* a, const float* b, uint32_t m) {
float r = 0;
- while (m--) {
+ while (m) {
+ m--;
r += *(a++) * *(b++);
}
return r;
@@ -54,7 +55,8 @@
static float vectorNorm(const float* a, uint32_t m) {
float r = 0;
- while (m--) {
+ while (m) {
+ m--;
float t = *(a++);
r += t * t;
}
@@ -511,7 +513,8 @@
for (uint32_t h = 0; h < m; h++) {
wy[h] = y[h] * w[h];
}
- for (uint32_t i = n; i-- != 0; ) {
+ for (uint32_t i = n; i != 0; ) {
+ i--;
outB[i] = vectorDot(&q[i][0], wy, m);
for (uint32_t j = n - 1; j > i; j--) {
outB[i] -= r[i][j] * outB[j];
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 0b64844..4e8e404 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -59,7 +59,7 @@
LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
endif
-ifeq (address, $(strip $(SANITIZE_TARGET)))
+ifneq ($(filter address,$(SANITIZE_TARGET)),)
LOCAL_CFLAGS_32 += -DEGL_WRAPPER_DIR=\"/$(TARGET_COPY_OUT_DATA)/lib\"
LOCAL_CFLAGS_64 += -DEGL_WRAPPER_DIR=\"/$(TARGET_COPY_OUT_DATA)/lib64\"
endif
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 1bed05b..5a412bf 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -673,7 +673,7 @@
"\";");
cStream.println();
- cStream.println("static JNINativeMethod methods[] = {");
+ cStream.println("static const JNINativeMethod methods[] = {");
cStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");