Merge "Migrate keychain directories to /data/misc/user/0"
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 34a5353..8911570 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -625,6 +625,10 @@
property_get("dalvik.vm.dex2oat-flags", dex2oat_flags, "");
ALOGV("dalvik.vm.dex2oat-flags=%s\n", dex2oat_flags);
+ char profiler_prop[PROPERTY_VALUE_MAX];
+ bool profiler = property_get("dalvik.vm.profiler", profiler_prop, "0")
+ && (profiler_prop[0] == '1');
+
static const char* DEX2OAT_BIN = "/system/bin/dex2oat";
static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig
static const unsigned int MAX_INSTRUCTION_SET_LEN = 32;
@@ -647,9 +651,17 @@
sprintf(oat_fd_arg, "--oat-fd=%d", oat_fd);
sprintf(oat_location_arg, "--oat-location=%s", output_file_name);
sprintf(instruction_set_arg, "--instruction-set=%s", instruction_set);
- if (strcmp(pkgname, "*") != 0) {
- snprintf(profile_file_arg, sizeof(profile_file_arg), "--profile-file=%s/%s",
+
+ if (profiler && (strcmp(pkgname, "*") != 0)) {
+ char profile_file[PKG_PATH_MAX];
+ snprintf(profile_file, sizeof(profile_file), "%s/%s",
DALVIK_CACHE_PREFIX "profiles", pkgname);
+ struct stat st;
+ if (stat(profile_file, &st) == -1) {
+ strcpy(profile_file_arg, "--no-profile-file");
+ } else {
+ sprintf(profile_file_arg, "--profile-file=%s", profile_file);
+ }
} else {
strcpy(profile_file_arg, "--no-profile-file");
}
diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp
index da6b0f9..e8948bb 100644
--- a/libs/gui/Sensor.cpp
+++ b/libs/gui/Sensor.cpp
@@ -134,11 +134,11 @@
return NO_MEMORY;
}
- FlattenableUtils::write(buffer, size, mName.length());
+ FlattenableUtils::write(buffer, size, static_cast<uint32_t>(mName.length()));
memcpy(static_cast<char*>(buffer), mName.string(), mName.length());
FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(mName.length()));
- FlattenableUtils::write(buffer, size, mVendor.length());
+ FlattenableUtils::write(buffer, size, static_cast<uint32_t>(mVendor.length()));
memcpy(static_cast<char*>(buffer), mVendor.string(), mVendor.length());
FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(mVendor.length()));
@@ -156,9 +156,9 @@
}
status_t Sensor::unflatten(void const* buffer, size_t size) {
- size_t len;
+ uint32_t len;
- if (size < sizeof(size_t)) {
+ if (size < sizeof(uint32_t)) {
return NO_MEMORY;
}
FlattenableUtils::read(buffer, size, len);
@@ -169,7 +169,7 @@
FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(len));
- if (size < sizeof(size_t)) {
+ if (size < sizeof(uint32_t)) {
return NO_MEMORY;
}
FlattenableUtils::read(buffer, size, len);
@@ -179,7 +179,7 @@
mVendor.setTo(static_cast<char const*>(buffer), len);
FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(len));
- size_t fixedSize =
+ const size_t fixedSize =
sizeof(int32_t) * 3 +
sizeof(float) * 4 +
sizeof(int32_t) * 3;
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index 5470d81..fc61134 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -53,9 +53,29 @@
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
[api] "J"(__builtin_offsetof(gl_hooks_t, \
ext.extensions[_api])) \
- : \
+ : "r12" \
);
+#elif defined(__aarch64__)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_EXTENSION_API(_api) \
+ asm volatile( \
+ "mrs x16, tpidr_el0\n" \
+ "ldr x16, [x16, %[tls]]\n" \
+ "cbz x16, 1f\n" \
+ "ldr x16, [x16, %[api]]\n" \
+ "cbz x16, 1f\n" \
+ "br x16\n" \
+ "1:\n" \
+ : \
+ : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \
+ [api] "i" (__builtin_offsetof(gl_hooks_t, \
+ ext.extensions[_api])) \
+ : "x16" \
+ );
+
#elif defined(__i386__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index ab6fb51..e112fec 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -40,7 +40,15 @@
#undef CALL_GL_API
#undef CALL_GL_API_RETURN
-#if defined(__arm__) && !USE_SLOW_BINDING
+#if USE_SLOW_BINDING
+
+ #define API_ENTRY(_api) _api
+
+ #define CALL_GL_API(_api, ...) \
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
+ if (_c) return _c->_api(__VA_ARGS__);
+
+#elif defined(__arm__)
#define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
@@ -55,10 +63,28 @@
: \
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
[api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
- : \
+ : "r12" \
);
-#elif defined(__i386__) && !USE_SLOW_BINDING
+#elif defined(__aarch64__)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_API(_api, ...) \
+ asm volatile( \
+ "mrs x16, tpidr_el0\n" \
+ "ldr x16, [x16, %[tls]]\n" \
+ "cbz x16, 1f\n" \
+ "ldr x16, [x16, %[api]]\n" \
+ "br x16\n" \
+ "1:\n" \
+ : \
+ : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \
+ [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : "x16" \
+ );
+
+#elif defined(__i386__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -77,7 +103,7 @@
: "cc" \
);
-#elif defined(__x86_64__) && !USE_SLOW_BINDING
+#elif defined(__x86_64__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -96,7 +122,7 @@
: "cc" \
);
-#elif defined(__mips__) && !USE_SLOW_BINDING
+#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -128,14 +154,6 @@
: \
);
-#else
-
- #define API_ENTRY(_api) _api
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- if (_c) return _c->_api(__VA_ARGS__);
-
#endif
#define CALL_GL_API_RETURN(_api, ...) \
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 5873391..71fbed1 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -92,7 +92,15 @@
#undef CALL_GL_API
#undef CALL_GL_API_RETURN
-#if defined(__arm__) && !USE_SLOW_BINDING
+#if USE_SLOW_BINDING
+
+ #define API_ENTRY(_api) _api
+
+ #define CALL_GL_API(_api, ...) \
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
+ if (_c) return _c->_api(__VA_ARGS__);
+
+#elif defined(__arm__)
#define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
@@ -107,10 +115,28 @@
: \
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
[api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
- : \
+ : "r12" \
);
-#elif defined(__i386__) && !USE_SLOW_BINDING
+#elif defined(__aarch64__)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_API(_api, ...) \
+ asm volatile( \
+ "mrs x16, tpidr_el0\n" \
+ "ldr x16, [x16, %[tls]]\n" \
+ "cbz x16, 1f\n" \
+ "ldr x16, [x16, %[api]]\n" \
+ "br x16\n" \
+ "1:\n" \
+ : \
+ : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \
+ [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : "x16" \
+ );
+
+#elif defined(__i386__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -129,7 +155,7 @@
: "cc" \
);
-#elif defined(__x86_64__) && !USE_SLOW_BINDING
+#elif defined(__x86_64__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -148,7 +174,7 @@
: "cc" \
);
-#elif defined(__mips__) && !USE_SLOW_BINDING
+#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -180,14 +206,6 @@
: \
);
-#else
-
- #define API_ENTRY(_api) _api
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- if (_c) return _c->_api(__VA_ARGS__);
-
#endif
#define CALL_GL_API_RETURN(_api, ...) \