Merge "vulkan: remove patches for other projects" into nyc-dev
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index e54407c..2c5bb1c 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -941,7 +941,7 @@
static int open_code_cache_for_user(userid_t user, const char* volume_uuid, const char* pkgname) {
std::string code_cache_path =
- create_data_user_package_path(volume_uuid, user, pkgname) + CODE_CACHE_DIR_POSTFIX;
+ create_data_user_de_package_path(volume_uuid, user, pkgname) + CODE_CACHE_DIR_POSTFIX;
struct stat buffer;
// Check that the code cache exists. If not, return and don't log an error.
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index 27f7939..dd1d9af 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -235,10 +235,48 @@
}
}
- // Prepare and run dex2oat.
+ // Prepare to create.
// TODO: Delete files, just for a blank slate.
const std::string& boot_cp = *system_properties_.GetProperty(kBootClassPathPropertyName);
+ std::string preopted_boot_art_path = StringPrintf("%s/system/framework/%s/boot.art",
+ b_mount_path_.c_str(),
+ isa);
+ if (access(preopted_boot_art_path.c_str(), F_OK) == 0) {
+ return PatchoatBootImage(art_path, isa);
+ } else {
+ // No preopted boot image. Try to compile.
+ return Dex2oatBootImage(boot_cp, art_path, oat_path, isa);
+ }
+ }
+
+ bool PatchoatBootImage(const std::string& art_path, const char* isa) {
+ // This needs to be kept in sync with ART, see art/runtime/gc/space/image_space.cc.
+
+ std::vector<std::string> cmd;
+ cmd.push_back(b_mount_path_ + "/system/bin/patchoat");
+
+ cmd.push_back("--input-image-location=/system/framework/boot.art");
+ cmd.push_back(StringPrintf("--output-image-file=%s", art_path.c_str()));
+
+ cmd.push_back(StringPrintf("--instruction-set=%s", isa));
+
+ int32_t base_offset = ChooseRelocationOffsetDelta(ART_BASE_ADDRESS_MIN_DELTA,
+ ART_BASE_ADDRESS_MAX_DELTA);
+ cmd.push_back(StringPrintf("--base-offset-delta=0x%x", ART_BASE_ADDRESS + base_offset));
+
+ std::string error_msg;
+ bool result = Exec(cmd, &error_msg);
+ if (!result) {
+ LOG(ERROR) << "Could not generate boot image: " << error_msg;
+ }
+ return result;
+ }
+
+ bool Dex2oatBootImage(const std::string& boot_cp,
+ const std::string& art_path,
+ const std::string& oat_path,
+ const char* isa) {
// This needs to be kept in sync with ART, see art/runtime/gc/space/image_space.cc.
std::vector<std::string> cmd;
cmd.push_back(b_mount_path_ + "/system/bin/dex2oat");
diff --git a/include/media/hardware/HardwareAPI.h b/include/media/hardware/HardwareAPI.h
index 9ba5f7f..752b004 100644
--- a/include/media/hardware/HardwareAPI.h
+++ b/include/media/hardware/HardwareAPI.h
@@ -27,6 +27,11 @@
namespace android {
+// This structure is used to enable Android native buffer use for either
+// graphic buffers or secure buffers.
+//
+// TO CONTROL ANDROID GRAPHIC BUFFER USAGE:
+//
// A pointer to this struct is passed to the OMX_SetParameter when the extension
// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension
// is given.
@@ -45,6 +50,25 @@
// 'OMX.google.android.index.useAndroidNativeBuffer2' extension, it should
// expect to receive UseAndroidNativeBuffer calls (via OMX_SetParameter) rather
// than UseBuffer calls for that port.
+//
+// TO CONTROL ANDROID SECURE BUFFER USAGE:
+//
+// A pointer to this struct is passed to the OMX_SetParameter when the extension
+// index for the 'OMX.google.android.index.allocateNativeHandle' extension
+// is given.
+//
+// When native handle use is disabled for a port (the default state),
+// the OMX node should operate as normal, and expect AllocateBuffer calls to
+// return buffer pointers. This is the mode that will be used for non-secure
+// buffers if component requires allocate buffers instead of use buffers.
+//
+// When native handle use has been enabled for a given port, the component
+// shall allocate native_buffer_t objects containing that can be passed between
+// processes using binder. This is the mode that will be used for secure buffers.
+// When an OMX component allocates native handle for buffers, it must close and
+// delete that handle when it frees those buffers. Even though pBuffer will point
+// to a native handle, nFilledLength, nAllocLength and nOffset will correspond
+// to the data inside the opaque buffer.
struct EnableAndroidNativeBuffersParams {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
@@ -52,6 +76,8 @@
OMX_BOOL enable;
};
+typedef struct EnableAndroidNativeBuffersParams AllocateNativeHandleParams;
+
// A pointer to this struct is passed to OMX_SetParameter() when the extension index
// "OMX.google.android.index.storeMetaDataInBuffers" or
// "OMX.google.android.index.storeANWBufferInMetadata" is given.
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index e9891a8..fb8d620 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -26,6 +26,7 @@
#include <sys/mman.h>
#include <binder/IMemory.h>
+#include <cutils/log.h>
#include <utils/KeyedVector.h>
#include <utils/threads.h>
#include <utils/Atomic.h>
@@ -187,15 +188,26 @@
if (heap != 0) {
mHeap = interface_cast<IMemoryHeap>(heap);
if (mHeap != 0) {
- mOffset = o;
- mSize = s;
+ size_t heapSize = mHeap->getSize();
+ if (s <= heapSize
+ && o >= 0
+ && (static_cast<size_t>(o) <= heapSize - s)) {
+ mOffset = o;
+ mSize = s;
+ } else {
+ // Hm.
+ android_errorWriteWithInfoLog(0x534e4554,
+ "26877992", -1, NULL, 0);
+ mOffset = 0;
+ mSize = 0;
+ }
}
}
}
}
if (offset) *offset = mOffset;
if (size) *size = mSize;
- return mHeap;
+ return (mSize > 0) ? mHeap : 0;
}
// ---------------------------------------------------------------------------