Merge "Add a 10s timeout to DumpstateBoard" into pi-dev
diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc
index 3ec0163..cb6d0c6 100644
--- a/cmds/atrace/atrace.rc
+++ b/cmds/atrace/atrace.rc
@@ -82,6 +82,28 @@
chmod 0666 /sys/kernel/debug/tracing/events/lowmemorykiller/enable
chmod 0666 /sys/kernel/tracing/events/lowmemorykiller/enable
+ # disk
+ chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_enter/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_enter/enable
+ chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_exit/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_exit/enable
+ chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_begin/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_begin/enable
+ chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_end/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_end/enable
+ chmod 0666 /sys/kernel/tracing/events/ext4/ext4_da_write_begin/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_begin/enable
+ chmod 0666 /sys/kernel/tracing/events/ext4/ext4_da_write_end/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_end/enable
+ chmod 0666 /sys/kernel/tracing/events/ext4/ext4_sync_file_enter/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable
+ chmod 0666 /sys/kernel/tracing/events/ext4/ext4_sync_file_exit/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable
+ chmod 0666 /sys/kernel/tracing/events/block/block_rq_issue/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_issue/enable
+ chmod 0666 /sys/kernel/tracing/events/block/block_rq_complete/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_complete/enable
+
# Tracing disabled by default
write /sys/kernel/debug/tracing/tracing_on 0
write /sys/kernel/tracing/tracing_on 0
diff --git a/cmds/atrace/atrace_userdebug.rc b/cmds/atrace/atrace_userdebug.rc
index 9d632cc..93a29ba 100644
--- a/cmds/atrace/atrace_userdebug.rc
+++ b/cmds/atrace/atrace_userdebug.rc
@@ -19,25 +19,3 @@
chmod 0666 /sys/kernel/debug/tracing/events/irq/enable
chmod 0666 /sys/kernel/tracing/events/ipi/enable
chmod 0666 /sys/kernel/debug/tracing/events/ipi/enable
-
- # disk
- chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_enter/enable
- chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_enter/enable
- chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_exit/enable
- chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_exit/enable
- chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_begin/enable
- chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_begin/enable
- chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_end/enable
- chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_end/enable
- chmod 0666 /sys/kernel/tracing/events/ext4/ext4_da_write_begin/enable
- chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_begin/enable
- chmod 0666 /sys/kernel/tracing/events/ext4/ext4_da_write_end/enable
- chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_end/enable
- chmod 0666 /sys/kernel/tracing/events/ext4/ext4_sync_file_enter/enable
- chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable
- chmod 0666 /sys/kernel/tracing/events/ext4/ext4_sync_file_exit/enable
- chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable
- chmod 0666 /sys/kernel/tracing/events/block/block_rq_issue/enable
- chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_issue/enable
- chmod 0666 /sys/kernel/tracing/events/block/block_rq_complete/enable
- chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_complete/enable
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index e53a223..833ffbf 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -22,6 +22,7 @@
#include <errno.h>
#include <fstream>
#include <fts.h>
+#include <functional>
#include <inttypes.h>
#include <regex>
#include <stdlib.h>
@@ -2412,27 +2413,25 @@
// This kernel feature is experimental.
// TODO: remove local definition once upstreamed
-#ifndef FS_IOC_SET_FSVERITY
-struct fsverity_set {
- __u64 offset;
- __u64 flags;
+#ifndef FS_IOC_ENABLE_VERITY
+
+#define FS_IOC_ENABLE_VERITY _IO('f', 133)
+#define FS_IOC_SET_VERITY_MEASUREMENT _IOW('f', 134, struct fsverity_measurement)
+
+#define FS_VERITY_ALG_SHA256 1
+
+struct fsverity_measurement {
+ __u16 digest_algorithm;
+ __u16 digest_size;
+ __u32 reserved1;
+ __u64 reserved2[3];
+ __u8 digest[];
};
-struct fsverity_root_hash {
- short root_hash_algorithm;
- short flags;
- __u8 reserved[4];
- __u8 root_hash[64];
-};
-
-#define FS_IOC_MEASURE_FSVERITY _IOW('f', 133, struct fsverity_root_hash)
-#define FS_IOC_SET_FSVERITY _IOW('f', 134, struct fsverity_set)
-
-#define FSVERITY_FLAG_ENABLED 0x0001
#endif
binder::Status InstalldNativeService::installApkVerity(const std::string& filePath,
- const ::android::base::unique_fd& verityInputAshmem) {
+ const ::android::base::unique_fd& verityInputAshmem, int32_t contentSize) {
ENFORCE_UID(AID_SYSTEM);
CHECK_ARGUMENT_PATH(filePath);
std::lock_guard<std::recursive_mutex> lock(mLock);
@@ -2440,7 +2439,7 @@
if (!android::base::GetBoolProperty(kPropApkVerityMode, false)) {
return ok();
}
-#if DEBUG
+#ifndef NDEBUG
ASSERT_PAGE_SIZE_4K();
#endif
// TODO: also check fsverity support in the current file system if compiled with DEBUG.
@@ -2449,15 +2448,14 @@
return error("FD is not an ashmem");
}
- // TODO(71871109): Validate filePath.
// 1. Seek to the next page boundary beyond the end of the file.
::android::base::unique_fd wfd(open(filePath.c_str(), O_WRONLY));
if (wfd.get() < 0) {
- return error("Failed to open " + filePath + ": " + strerror(errno));
+ return error("Failed to open " + filePath);
}
struct stat st;
if (fstat(wfd.get(), &st) < 0) {
- return error("Failed to stat " + filePath + ": " + strerror(errno));
+ return error("Failed to stat " + filePath);
}
// fsverity starts from the block boundary.
off_t padding = kVerityPageSize - st.st_size % kVerityPageSize;
@@ -2465,38 +2463,51 @@
padding = 0;
}
if (lseek(wfd.get(), st.st_size + padding, SEEK_SET) < 0) {
- return error("Failed to lseek " + filePath + ": " + strerror(errno));
+ return error("Failed to lseek " + filePath);
}
- // 2. Write everything in the ashmem to the file.
- int size = ashmem_get_size_region(verityInputAshmem.get());
- if (size < 0) {
- return error("Failed to get ashmem size: " + std::to_string(size));
+ // 2. Write everything in the ashmem to the file. Note that allocated
+ // ashmem size is multiple of page size, which is different from the
+ // actual content size.
+ int shmSize = ashmem_get_size_region(verityInputAshmem.get());
+ if (shmSize < 0) {
+ return error("Failed to get ashmem size: " + std::to_string(shmSize));
}
- void* data = mmap(NULL, size, PROT_READ, MAP_SHARED, verityInputAshmem.get(), 0);
- if (data == MAP_FAILED) {
- return error("Failed to mmap the ashmem: " + std::string(strerror(errno)));
+ if (contentSize < 0) {
+ return error("Invalid content size: " + std::to_string(contentSize));
}
- char* cursor = reinterpret_cast<char*>(data);
- int remaining = size;
+ if (contentSize > shmSize) {
+ return error("Content size overflow: " + std::to_string(contentSize) + " > " +
+ std::to_string(shmSize));
+ }
+ auto data = std::unique_ptr<void, std::function<void (void *)>>(
+ mmap(NULL, contentSize, PROT_READ, MAP_SHARED, verityInputAshmem.get(), 0),
+ [contentSize] (void* ptr) {
+ if (ptr != MAP_FAILED) {
+ munmap(ptr, contentSize);
+ }
+ });
+
+ if (data.get() == MAP_FAILED) {
+ return error("Failed to mmap the ashmem");
+ }
+ char* cursor = reinterpret_cast<char*>(data.get());
+ int remaining = contentSize;
while (remaining > 0) {
int ret = TEMP_FAILURE_RETRY(write(wfd.get(), cursor, remaining));
if (ret < 0) {
- munmap(data, size);
return error("Failed to write to " + filePath + " (" + std::to_string(remaining) +
- + "/" + std::to_string(size) + "): " + strerror(errno));
+ + "/" + std::to_string(contentSize) + ")");
}
cursor += ret;
remaining -= ret;
}
- munmap(data, size);
+ wfd.reset();
- // 3. Enable fsverity. Once it's done, the file becomes immutable.
- struct fsverity_set config;
- config.offset = st.st_size;
- config.flags = FSVERITY_FLAG_ENABLED;
- if (ioctl(wfd.get(), FS_IOC_SET_FSVERITY, &config) < 0) {
- return error("Failed to enable fsverity on " + filePath + ": " + strerror(errno));
+ // 3. Enable fsverity (needs readonly fd. Once it's done, the file becomes immutable.
+ ::android::base::unique_fd rfd(open(filePath.c_str(), O_RDONLY));
+ if (ioctl(rfd.get(), FS_IOC_ENABLE_VERITY, nullptr) < 0) {
+ return error("Failed to enable fsverity on " + filePath);
}
return ok();
}
@@ -2516,17 +2527,19 @@
std::to_string(expectedHash.size()));
}
- // TODO(71871109): Validate filePath.
::android::base::unique_fd fd(open(filePath.c_str(), O_RDONLY));
if (fd.get() < 0) {
return error("Failed to open " + filePath + ": " + strerror(errno));
}
- struct fsverity_root_hash config;
- memset(&config, 0, sizeof(config));
- config.root_hash_algorithm = 0; // SHA256
- memcpy(config.root_hash, expectedHash.data(), std::min(sizeof(config.root_hash), kSha256Size));
- if (ioctl(fd.get(), FS_IOC_MEASURE_FSVERITY, &config) < 0) {
+ unsigned int buffer_size = sizeof(fsverity_measurement) + kSha256Size;
+ std::vector<char> buffer(buffer_size, 0);
+
+ fsverity_measurement* config = reinterpret_cast<fsverity_measurement*>(buffer.data());
+ config->digest_algorithm = FS_VERITY_ALG_SHA256;
+ config->digest_size = kSha256Size;
+ memcpy(config->digest, expectedHash.data(), kSha256Size);
+ if (ioctl(fd.get(), FS_IOC_SET_VERITY_MEASUREMENT, config) < 0) {
// This includes an expected failure case with no FSVerity setup. It normally happens when
// the apk does not contains the Merkle tree root hash.
return error("Failed to measure fsverity on " + filePath + ": " + strerror(errno));
diff --git a/cmds/installd/InstalldNativeService.h b/cmds/installd/InstalldNativeService.h
index 2a31967..cebd3f9 100644
--- a/cmds/installd/InstalldNativeService.h
+++ b/cmds/installd/InstalldNativeService.h
@@ -123,7 +123,7 @@
binder::Status deleteOdex(const std::string& apkPath, const std::string& instructionSet,
const std::unique_ptr<std::string>& outputPath);
binder::Status installApkVerity(const std::string& filePath,
- const ::android::base::unique_fd& verityInput);
+ const ::android::base::unique_fd& verityInput, int32_t contentSize);
binder::Status assertFsverityRootHashMatches(const std::string& filePath,
const std::vector<uint8_t>& expectedHash);
binder::Status reconcileSecondaryDexFile(const std::string& dexPath,
diff --git a/cmds/installd/binder/android/os/IInstalld.aidl b/cmds/installd/binder/android/os/IInstalld.aidl
index 0c364bd..91e20b7 100644
--- a/cmds/installd/binder/android/os/IInstalld.aidl
+++ b/cmds/installd/binder/android/os/IInstalld.aidl
@@ -85,7 +85,8 @@
@utf8InCpp String outputPath);
void deleteOdex(@utf8InCpp String apkPath, @utf8InCpp String instructionSet,
@nullable @utf8InCpp String outputPath);
- void installApkVerity(@utf8InCpp String filePath, in FileDescriptor verityInput);
+ void installApkVerity(@utf8InCpp String filePath, in FileDescriptor verityInput,
+ int contentSize);
void assertFsverityRootHashMatches(@utf8InCpp String filePath, in byte[] expectedHash);
boolean reconcileSecondaryDexFile(@utf8InCpp String dexPath, @utf8InCpp String pkgName,
diff --git a/libs/arect/include/android/rect.h b/libs/arect/include/android/rect.h
index 80741c0..b36728e 100644
--- a/libs/arect/include/android/rect.h
+++ b/libs/arect/include/android/rect.h
@@ -33,23 +33,26 @@
#endif
/**
- * {@link ARect} is a struct that represents a rectangular window area.
+ * Rectangular window area.
*
- * It is used with {@link
- * ANativeActivityCallbacks::onContentRectChanged} event callback and
- * ANativeWindow_lock() function.
+ * This is the NDK equivalent of the android.graphics.Rect class in Java. It is
+ * used with {@link ANativeActivityCallbacks::onContentRectChanged} event
+ * callback and the ANativeWindow_lock() function.
+ *
+ * In a valid ARect, left <= right and top <= bottom. ARect with left=0, top=10,
+ * right=1, bottom=11 contains only one pixel at x=0, y=10.
*/
typedef struct ARect {
#ifdef __cplusplus
typedef int32_t value_type;
#endif
- /** left position */
+ /// Minimum X coordinate of the rectangle.
int32_t left;
- /** top position */
+ /// Minimum Y coordinate of the rectangle.
int32_t top;
- /** left position */
+ /// Maximum X coordinate of the rectangle.
int32_t right;
- /** bottom position */
+ /// Maximum Y coordinate of the rectangle.
int32_t bottom;
} ARect;
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 0244bb5..e22bc70 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -43,6 +43,8 @@
namespace android {
+using ui::ColorMode;
+
class BpSurfaceComposer : public BpInterface<ISurfaceComposer>
{
public:
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 2e1c24b..6a1aebd 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -44,6 +44,8 @@
namespace android {
+using ui::ColorMode;
+
Surface::Surface(const sp<IGraphicBufferProducer>& bufferProducer, bool controlledByApp)
: mGraphicBufferProducer(bufferProducer),
mCrop(Rect::EMPTY_RECT),
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 4c041bc..bbf681e 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -43,6 +43,8 @@
#include <private/gui/ComposerService.h>
namespace android {
+
+using ui::ColorMode;
// ---------------------------------------------------------------------------
ANDROID_SINGLETON_STATIC_INSTANCE(ComposerService);
diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h
index afe9358..3591090 100644
--- a/libs/gui/include/gui/ISurfaceComposer.h
+++ b/libs/gui/include/gui/ISurfaceComposer.h
@@ -30,7 +30,7 @@
#include <ui/FrameStats.h>
#include <ui/PixelFormat.h>
#include <ui/GraphicBuffer.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include <vector>
@@ -161,10 +161,10 @@
virtual status_t setActiveConfig(const sp<IBinder>& display, int id) = 0;
virtual status_t getDisplayColorModes(const sp<IBinder>& display,
- Vector<ColorMode>* outColorModes) = 0;
- virtual ColorMode getActiveColorMode(const sp<IBinder>& display) = 0;
+ Vector<ui::ColorMode>* outColorModes) = 0;
+ virtual ui::ColorMode getActiveColorMode(const sp<IBinder>& display) = 0;
virtual status_t setActiveColorMode(const sp<IBinder>& display,
- ColorMode colorMode) = 0;
+ ui::ColorMode colorMode) = 0;
/* Capture the specified screen. requires READ_FRAME_BUFFER permission
* This function will fail if there is a secure window on screen.
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index b45ce4f..ffc22f6 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -29,7 +29,7 @@
#include <utils/threads.h>
#include <ui/FrameStats.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include <ui/PixelFormat.h>
#include <gui/CpuConsumer.h>
@@ -89,13 +89,14 @@
// Gets the list of supported color modes for the given display
static status_t getDisplayColorModes(const sp<IBinder>& display,
- Vector<ColorMode>* outColorModes);
+ Vector<ui::ColorMode>* outColorModes);
// Gets the active color mode for the given display
- static ColorMode getActiveColorMode(const sp<IBinder>& display);
+ static ui::ColorMode getActiveColorMode(const sp<IBinder>& display);
// Sets the active color mode for the given display
- static status_t setActiveColorMode(const sp<IBinder>& display, ColorMode colorMode);
+ static status_t setActiveColorMode(const sp<IBinder>& display,
+ ui::ColorMode colorMode);
/* Triggers screen on/off or low power mode and waits for it to complete */
static void setDisplayPowerMode(const sp<IBinder>& display, int mode);
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index df391ed..2c02ba6 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -42,6 +42,7 @@
// retrieve wide-color and hdr settings from configstore
using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;
+using ui::ColorMode;
using Transaction = SurfaceComposerClient::Transaction;
diff --git a/libs/nativewindow/include/android/hardware_buffer.h b/libs/nativewindow/include/android/hardware_buffer.h
index a477bf2..cc67aca 100644
--- a/libs/nativewindow/include/android/hardware_buffer.h
+++ b/libs/nativewindow/include/android/hardware_buffer.h
@@ -41,9 +41,11 @@
AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1,
/**
+ * 32 bits per pixel, 8 bits per channel format where alpha values are
+ * ignored (always opaque).
* Corresponding formats:
* Vulkan: VK_FORMAT_R8G8B8A8_UNORM
- * OpenGL ES: GL_RGBA8
+ * OpenGL ES: GL_RGB8
*/
AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2,
@@ -124,40 +126,49 @@
AHARDWAREBUFFER_FORMAT_S8_UINT = 0x35,
};
+/**
+ * Buffer usage flags, specifying how the buffer will be accessed.
+ */
enum {
- /* The buffer will never be read by the CPU */
+ /// The buffer will never be read by the CPU.
AHARDWAREBUFFER_USAGE_CPU_READ_NEVER = 0UL,
- /* The buffer will sometimes be read by the CPU */
+ /// The buffer will sometimes be read by the CPU.
AHARDWAREBUFFER_USAGE_CPU_READ_RARELY = 2UL,
- /* The buffer will often be read by the CPU */
+ /// The buffer will often be read by the CPU.
AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN = 3UL,
- /* CPU read value mask */
+ /// CPU read value mask.
AHARDWAREBUFFER_USAGE_CPU_READ_MASK = 0xFUL,
- /* The buffer will never be written by the CPU */
+ /// The buffer will never be written by the CPU.
AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER = 0UL << 4,
- /* The buffer will sometimes be written to by the CPU */
+ /// The buffer will sometimes be written to by the CPU.
AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY = 2UL << 4,
- /* The buffer will often be written to by the CPU */
+ /// The buffer will often be written to by the CPU.
AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN = 3UL << 4,
- /* CPU write value mask */
+ /// CPU write value mask.
AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK = 0xFUL << 4,
- /* The buffer will be read from by the GPU */
+ /// The buffer will be read from by the GPU as a texture.
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE = 1UL << 8,
- /* The buffer will be written to by the GPU */
+ /**
+ * The buffer will be written to by the GPU as a framebuffer attachment.
+ * Note that the name of this flag is somewhat misleading: it does not imply
+ * that the buffer contains a color format. A buffer with depth or stencil
+ * format that will be used as a framebuffer attachment should also have
+ * this flag.
+ */
AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT = 1UL << 9,
- /* The buffer must not be used outside of a protected hardware path */
+ /// The buffer must not be used outside of a protected hardware path.
AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT = 1UL << 14,
- /* The buffer will be read by a hardware video encoder */
+ /// The buffer will be read by a hardware video encoder.
AHARDWAREBUFFER_USAGE_VIDEO_ENCODE = 1UL << 16,
- /* The buffer will be used for sensor direct data */
+ /// The buffer will be used for direct writes from sensors.
AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA = 1UL << 23,
- /* The buffer will be used as a shader storage or uniform buffer object */
+ /// The buffer will be used as a shader storage or uniform buffer object.
AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER = 1UL << 24,
- /* The buffer will be used as a cube map texture */
+ /// The buffer will be used as a cube map texture.
AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP = 1UL << 25,
- /* The buffer contains a complete mipmap hierarchy */
+ /// The buffer contains a complete mipmap hierarchy.
AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE = 1UL << 26,
AHARDWAREBUFFER_USAGE_VENDOR_0 = 1ULL << 28,
@@ -182,15 +193,19 @@
AHARDWAREBUFFER_USAGE_VENDOR_19 = 1ULL << 63,
};
+/**
+ * Buffer description. Used for allocating new buffers and querying parameters
+ * of existing ones.
+ */
typedef struct AHardwareBuffer_Desc {
- uint32_t width; // width in pixels
- uint32_t height; // height in pixels
- uint32_t layers; // number of images
- uint32_t format; // One of AHARDWAREBUFFER_FORMAT_*
- uint64_t usage; // Combination of AHARDWAREBUFFER_USAGE_*
- uint32_t stride; // Stride in pixels, ignored for AHardwareBuffer_allocate()
- uint32_t rfu0; // Initialize to zero, reserved for future use
- uint64_t rfu1; // Initialize to zero, reserved for future use
+ uint32_t width; ///< Width in pixels.
+ uint32_t height; ///< Height in pixels.
+ uint32_t layers; ///< Number of images in an image array.
+ uint32_t format; ///< One of AHARDWAREBUFFER_FORMAT_*
+ uint64_t usage; ///< Combination of AHARDWAREBUFFER_USAGE_*
+ uint32_t stride; ///< Row stride in pixels, ignored for AHardwareBuffer_allocate()
+ uint32_t rfu0; ///< Initialize to zero, reserved for future use.
+ uint64_t rfu1; ///< Initialize to zero, reserved for future use.
} AHardwareBuffer_Desc;
typedef struct AHardwareBuffer AHardwareBuffer;
@@ -199,8 +214,8 @@
* Allocates a buffer that backs an AHardwareBuffer using the passed
* AHardwareBuffer_Desc.
*
- * Returns NO_ERROR on success, or an error number of the allocation fails for
- * any reason.
+ * \return NO_ERROR on success, or an error number of the allocation fails for
+ * any reason. The returned buffer has a reference count of 1.
*/
int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc,
AHardwareBuffer** outBuffer);
@@ -223,7 +238,7 @@
void AHardwareBuffer_describe(const AHardwareBuffer* buffer,
AHardwareBuffer_Desc* outDesc);
-/*
+/**
* Lock the AHardwareBuffer for reading or writing, depending on the usage flags
* passed. This call may block if the hardware needs to finish rendering or if
* CPU caches need to be synchronized, or possibly for other implementation-
@@ -231,16 +246,16 @@
* descriptor that will be signaled when the buffer is locked, otherwise the
* caller will block until the buffer is available.
*
- * If rect is not NULL, the caller promises to modify only data in the area
+ * If \a rect is not NULL, the caller promises to modify only data in the area
* specified by rect. If rect is NULL, the caller may modify the contents of the
* entire buffer.
*
* The content of the buffer outside of the specified rect is NOT modified
* by this call.
*
- * The buffer usage may only specify AHARDWAREBUFFER_USAGE_CPU_*. If set, then
- * outVirtualAddress is filled with the address of the buffer in virtual memory,
- * otherwise this function will fail.
+ * The \a usage parameter may only specify AHARDWAREBUFFER_USAGE_CPU_*. If set,
+ * then outVirtualAddress is filled with the address of the buffer in virtual
+ * memory.
*
* THREADING CONSIDERATIONS:
*
@@ -252,38 +267,38 @@
* may return an error or leave the buffer's content into an indeterminate
* state.
*
- * Returns NO_ERROR on success, BAD_VALUE if the buffer is NULL or if the usage
+ * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL or if the usage
* flags are not a combination of AHARDWAREBUFFER_USAGE_CPU_*, or an error
* number of the lock fails for any reason.
*/
int AHardwareBuffer_lock(AHardwareBuffer* buffer, uint64_t usage,
int32_t fence, const ARect* rect, void** outVirtualAddress);
-/*
+/**
* Unlock the AHardwareBuffer; must be called after all changes to the buffer
* are completed by the caller. If fence is not NULL then it will be set to a
* file descriptor that is signaled when all pending work on the buffer is
* completed. The caller is responsible for closing the fence when it is no
* longer needed.
*
- * Returns NO_ERROR on success, BAD_VALUE if the buffer is NULL, or an error
- * number of the lock fails for any reason.
+ * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL, or an error
+ * number if the unlock fails for any reason.
*/
int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence);
-/*
+/**
* Send the AHardwareBuffer to an AF_UNIX socket.
*
- * Returns NO_ERROR on success, BAD_VALUE if the buffer is NULL, or an error
- * number of the lock fails for any reason.
+ * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL, or an error
+ * number if the operation fails for any reason.
*/
int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int socketFd);
-/*
+/**
* Receive the AHardwareBuffer from an AF_UNIX socket.
*
- * Returns NO_ERROR on success, BAD_VALUE if the buffer is NULL, or an error
- * number of the lock fails for any reason.
+ * \return NO_ERROR on success, BAD_VALUE if \a outBuffer is NULL, or an error
+ * number if the operation fails for any reason.
*/
int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer);
diff --git a/libs/nativewindow/include/android/native_window.h b/libs/nativewindow/include/android/native_window.h
index f2d6f7a..d5e5e9d 100644
--- a/libs/nativewindow/include/android/native_window.h
+++ b/libs/nativewindow/include/android/native_window.h
@@ -85,23 +85,23 @@
* A pointer can be obtained using {@link ANativeWindow_lock()}.
*/
typedef struct ANativeWindow_Buffer {
- // The number of pixels that are show horizontally.
+ /// The number of pixels that are shown horizontally.
int32_t width;
- // The number of pixels that are shown vertically.
+ /// The number of pixels that are shown vertically.
int32_t height;
- // The number of *pixels* that a line in the buffer takes in
- // memory. This may be >= width.
+ /// The number of *pixels* that a line in the buffer takes in
+ /// memory. This may be >= width.
int32_t stride;
- // The format of the buffer. One of AHARDWAREBUFFER_FORMAT_*
+ /// The format of the buffer. One of AHARDWAREBUFFER_FORMAT_*
int32_t format;
- // The actual bits.
+ /// The actual bits.
void* bits;
- // Do not touch.
+ /// Do not touch.
uint32_t reserved[6];
} ANativeWindow_Buffer;
diff --git a/libs/ui/DebugUtils.cpp b/libs/ui/DebugUtils.cpp
index d7e191d..d7d8618 100644
--- a/libs/ui/DebugUtils.cpp
+++ b/libs/ui/DebugUtils.cpp
@@ -22,7 +22,7 @@
#include <string>
using android::base::StringPrintf;
-using android::ColorMode;
+using android::ui::ColorMode;
std::string decodeStandard(android_dataspace dataspace) {
const uint32_t dataspaceSelect = (dataspace & HAL_DATASPACE_STANDARD_MASK);
diff --git a/libs/ui/include/ui/DebugUtils.h b/libs/ui/include/ui/DebugUtils.h
index 3370107..6350d0c 100644
--- a/libs/ui/include/ui/DebugUtils.h
+++ b/libs/ui/include/ui/DebugUtils.h
@@ -16,7 +16,7 @@
#pragma once
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include <ui/PixelFormat.h>
#include <string>
@@ -29,6 +29,6 @@
std::string decodeTransfer(android_dataspace dataspace);
std::string decodeRange(android_dataspace dataspace);
std::string dataspaceDetails(android_dataspace dataspace);
-std::string decodeColorMode(android::ColorMode colormode);
+std::string decodeColorMode(android::ui::ColorMode colormode);
std::string decodePixelFormat(android::PixelFormat format);
std::string to_string(const android::Rect& rect);
diff --git a/libs/ui/include/ui/GraphicsTypes.h b/libs/ui/include/ui/GraphicTypes.h
similarity index 85%
rename from libs/ui/include/ui/GraphicsTypes.h
rename to libs/ui/include/ui/GraphicTypes.h
index fa9a812..39893b2 100644
--- a/libs/ui/include/ui/GraphicsTypes.h
+++ b/libs/ui/include/ui/GraphicTypes.h
@@ -19,8 +19,12 @@
#include <android/hardware/graphics/common/1.1/types.h>
#include <system/graphics.h>
+// android::ui::* in this header file will alias different types as
+// the HIDL interface is updated.
namespace android {
+namespace ui {
using android::hardware::graphics::common::V1_0::ColorMode;
+} // namespace ui
} // namespace android
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp
index c3f4f58..9a449fa 100644
--- a/services/inputflinger/InputDispatcher.cpp
+++ b/services/inputflinger/InputDispatcher.cpp
@@ -105,6 +105,36 @@
return value ? "true" : "false";
}
+static std::string motionActionToString(int32_t action) {
+ // Convert MotionEvent action to string
+ switch(action & AMOTION_EVENT_ACTION_MASK) {
+ case AMOTION_EVENT_ACTION_DOWN:
+ return "DOWN";
+ case AMOTION_EVENT_ACTION_MOVE:
+ return "MOVE";
+ case AMOTION_EVENT_ACTION_UP:
+ return "UP";
+ case AMOTION_EVENT_ACTION_POINTER_DOWN:
+ return "POINTER_DOWN";
+ case AMOTION_EVENT_ACTION_POINTER_UP:
+ return "POINTER_UP";
+ }
+ return StringPrintf("%" PRId32, action);
+}
+
+static std::string keyActionToString(int32_t action) {
+ // Convert KeyEvent action to string
+ switch(action) {
+ case AKEY_EVENT_ACTION_DOWN:
+ return "DOWN";
+ case AKEY_EVENT_ACTION_UP:
+ return "UP";
+ case AKEY_EVENT_ACTION_MULTIPLE:
+ return "MULTIPLE";
+ }
+ return StringPrintf("%" PRId32, action);
+}
+
static inline int32_t getMotionEventActionPointerIndex(int32_t action) {
return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)
>> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
@@ -3976,11 +4006,11 @@
}
void InputDispatcher::KeyEntry::appendDescription(std::string& msg) const {
- msg += StringPrintf("KeyEvent(deviceId=%d, source=0x%08x, action=%d, "
+ msg += StringPrintf("KeyEvent(deviceId=%d, source=0x%08x, action=%s, "
"flags=0x%08x, keyCode=%d, scanCode=%d, metaState=0x%08x, "
"repeatCount=%d), policyFlags=0x%08x",
- deviceId, source, action, flags, keyCode, scanCode, metaState,
- repeatCount, policyFlags);
+ deviceId, source, keyActionToString(action).c_str(), flags, keyCode,
+ scanCode, metaState, repeatCount, policyFlags);
}
void InputDispatcher::KeyEntry::recycle() {
@@ -4021,11 +4051,11 @@
}
void InputDispatcher::MotionEntry::appendDescription(std::string& msg) const {
- msg += StringPrintf("MotionEvent(deviceId=%d, source=0x%08x, action=%d, actionButton=0x%08x, "
+ msg += StringPrintf("MotionEvent(deviceId=%d, source=0x%08x, action=%s, actionButton=0x%08x, "
"flags=0x%08x, metaState=0x%08x, buttonState=0x%08x, "
"edgeFlags=0x%08x, xPrecision=%.1f, yPrecision=%.1f, displayId=%d, pointers=[",
- deviceId, source, action, actionButton, flags, metaState, buttonState, edgeFlags,
- xPrecision, yPrecision, displayId);
+ deviceId, source, motionActionToString(action).c_str(), actionButton, flags, metaState,
+ buttonState, edgeFlags, xPrecision, yPrecision, displayId);
for (uint32_t i = 0; i < pointerCount; i++) {
if (i) {
msg += ", ";
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 2bd0a19..8e9e7fd 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -86,6 +86,7 @@
SensorService::SensorService()
: mInitCheck(NO_INIT), mSocketBufferSize(SOCKET_BUFFER_SIZE_NON_BATCHED),
mWakeLockAcquired(false) {
+ mUidPolicy = new UidPolicy(this);
}
bool SensorService::initializeHmacKey() {
@@ -283,7 +284,6 @@
enableSchedFifoMode();
// Start watching UID changes to apply policy.
- mUidPolicy = new UidPolicy(this);
mUidPolicy->registerSelf();
}
}
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index fe0b30b..93cb849 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -49,13 +49,12 @@
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <configstore/Utils.h>
-// ----------------------------------------------------------------------------
-using namespace android;
-// ----------------------------------------------------------------------------
+namespace android {
// retrieve triple buffer setting from configstore
using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;
+using android::ui::ColorMode;
/*
* Initialize the display to the specified values.
@@ -454,7 +453,11 @@
tr[0][1], tr[1][1], tr[2][1], tr[0][2], tr[1][2], tr[2][2]);
auto const surface = static_cast<Surface*>(window);
android_dataspace dataspace = surface->getBuffersDataSpace();
- result.appendFormat(" dataspace: %s (%d)\n", dataspaceDetails(dataspace).c_str(), dataspace);
+ result.appendFormat(" wideColor=%d, hdr=%d, colorMode=%s, dataspace: %s (%d)\n",
+ mDisplayHasWideColor, mDisplayHasHdr,
+ decodeColorMode(mActiveColorMode).c_str(),
+ dataspaceDetails(dataspace).c_str(), dataspace);
+
String8 surfaceDump;
mDisplaySurface->dumpAsString(surfaceDump);
@@ -474,3 +477,5 @@
viewport.makeInvalid();
frame.makeInvalid();
}
+
+} // namespace android
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index fbb0d46..df729f5 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -31,7 +31,7 @@
#include <gui/ISurfaceComposer.h>
#include <hardware/hwcomposer_defs.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include "RenderArea.h"
#include "RenderEngine/Surface.h"
@@ -161,8 +161,8 @@
void setPowerMode(int mode);
bool isDisplayOn() const;
- ColorMode getActiveColorMode() const;
- void setActiveColorMode(ColorMode mode);
+ ui::ColorMode getActiveColorMode() const;
+ void setActiveColorMode(ui::ColorMode mode);
void setCompositionDataSpace(android_dataspace dataspace);
/* ------------------------------------------------------------------------
@@ -236,7 +236,7 @@
// Current active config
int mActiveConfig;
// current active color mode
- ColorMode mActiveColorMode;
+ ui::ColorMode mActiveColorMode;
// Need to know if display is wide-color capable or not.
// Initialized by SurfaceFlinger when the DisplayDevice is created.
@@ -285,7 +285,7 @@
bool needsFiltering() const override { return mDevice->needsFiltering(); }
Rect getSourceCrop() const override { return mSourceCrop; }
bool getWideColorSupport() const override { return mDevice->getWideColorSupport(); }
- ColorMode getActiveColorMode() const override {
+ ui::ColorMode getActiveColorMode() const override {
return mDevice->getActiveColorMode();
}
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
index 4faba3b..9398bde 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
@@ -177,9 +177,9 @@
void FramebufferSurface::dumpAsString(String8& result) const {
Mutex::Autolock lock(mMutex);
- result.appendFormat("FramebufferSurface: dataspace: %s(%d)\n",
+ result.appendFormat(" FramebufferSurface: dataspace: %s(%d)\n",
dataspaceDetails(mDataSpace).c_str(), mDataSpace);
- ConsumerBase::dumpLocked(result, "");
+ ConsumerBase::dumpLocked(result, " ");
}
void FramebufferSurface::dumpLocked(String8& result, const char* prefix) const
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index 0c77aba..98daec3 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -362,20 +362,10 @@
return Error::None;
}
-Error Display::getColorModes(std::vector<android::ColorMode>* outModes) const
+Error Display::getColorModes(std::vector<android::ui::ColorMode>* outModes) const
{
- std::vector<android::ColorMode> modes;
- auto intError = mComposer.getColorModes(mId, &modes);
- uint32_t numModes = modes.size();
- auto error = static_cast<Error>(intError);
- if (error != Error::None) {
- return error;
- }
-
- outModes->resize(numModes);
- for (size_t i = 0; i < numModes; i++) {
- (*outModes)[i] = modes[i];
- }
+ auto intError = mComposer.getColorModes(mId, outModes);
+ return static_cast<Error>(intError);
return Error::None;
}
@@ -537,7 +527,7 @@
return static_cast<Error>(intError);
}
-Error Display::setColorMode(android::ColorMode mode)
+Error Display::setColorMode(android::ui::ColorMode mode)
{
auto intError = mComposer.setColorMode(mId, mode);
return static_cast<Error>(intError);
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index 5b53b54..71c094a 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -25,7 +25,7 @@
#include <gui/HdrMetadata.h>
#include <math/mat4.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include <ui/HdrCapabilities.h>
#include <utils/Log.h>
@@ -211,7 +211,7 @@
[[clang::warn_unused_result]] Error getChangedCompositionTypes(
std::unordered_map<Layer*, Composition>* outTypes);
[[clang::warn_unused_result]] Error getColorModes(
- std::vector<android::ColorMode>* outModes) const;
+ std::vector<android::ui::ColorMode>* outModes) const;
// Doesn't call into the HWC2 device, so no errors are possible
std::vector<std::shared_ptr<const Config>> getConfigs() const;
@@ -235,7 +235,8 @@
uint32_t slot, const android::sp<android::GraphicBuffer>& target,
const android::sp<android::Fence>& acquireFence,
android_dataspace_t dataspace);
- [[clang::warn_unused_result]] Error setColorMode(android::ColorMode mode);
+ [[clang::warn_unused_result]] Error setColorMode(
+ android::ui::ColorMode mode);
[[clang::warn_unused_result]] Error setColorTransform(
const android::mat4& matrix, android_color_transform_t hint);
[[clang::warn_unused_result]] Error setOutputBuffer(
@@ -246,8 +247,8 @@
[[clang::warn_unused_result]] Error validate(uint32_t* outNumTypes,
uint32_t* outNumRequests);
[[clang::warn_unused_result]] Error presentOrValidate(uint32_t* outNumTypes,
- uint32_t* outNumRequests,
- android::sp<android::Fence>* outPresentFence, uint32_t* state);
+ uint32_t* outNumRequests,
+ android::sp<android::Fence>* outPresentFence, uint32_t* state);
// Other Display methods
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 6d5917d..6bf2ee9 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -311,8 +311,8 @@
return config;
}
-std::vector<ColorMode> HWComposer::getColorModes(int32_t displayId) const {
- std::vector<ColorMode> modes;
+std::vector<ui::ColorMode> HWComposer::getColorModes(int32_t displayId) const {
+ std::vector<ui::ColorMode> modes;
if (!isValidDisplay(displayId)) {
ALOGE("getColorModes: Attempted to access invalid display %d",
@@ -324,13 +324,13 @@
if (error != HWC2::Error::None) {
ALOGE("getColorModes failed for display %d: %s (%d)", displayId,
to_string(error).c_str(), static_cast<int32_t>(error));
- return std::vector<ColorMode>();
+ return std::vector<ui::ColorMode>();
}
return modes;
}
-status_t HWComposer::setActiveColorMode(int32_t displayId, ColorMode mode) {
+status_t HWComposer::setActiveColorMode(int32_t displayId, ui::ColorMode mode) {
if (!isValidDisplay(displayId)) {
ALOGE("setActiveColorMode: Display %d is not valid", displayId);
return BAD_INDEX;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index c442b2f..0366a0d 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -23,7 +23,7 @@
#include <sys/types.h>
#include <ui/Fence.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include <utils/BitSet.h>
#include <utils/Condition.h>
@@ -159,9 +159,9 @@
std::shared_ptr<const HWC2::Display::Config>
getActiveConfig(int32_t displayId) const;
- std::vector<ColorMode> getColorModes(int32_t displayId) const;
+ std::vector<ui::ColorMode> getColorModes(int32_t displayId) const;
- status_t setActiveColorMode(int32_t displayId, ColorMode mode);
+ status_t setActiveColorMode(int32_t displayId, ui::ColorMode mode);
bool isUsingVrComposer() const;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 73e7b05..166ac22 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1488,7 +1488,11 @@
const Layer::State& layerState(getDrawingState());
const LayerBE::HWCInfo& hwcInfo = getBE().mHwcLayers.at(hwcId);
- result.appendFormat(" %10d | ", layerState.z);
+ if (layerState.zOrderRelativeOf != nullptr || mDrawingParent != nullptr) {
+ result.appendFormat(" rel %6d | ", layerState.z);
+ } else {
+ result.appendFormat(" %10d | ", layerState.z);
+ }
result.appendFormat("%10s | ", to_string(getCompositionType(hwcId)).c_str());
const Rect& frame = hwcInfo.displayFrame;
result.appendFormat("%4d %4d %4d %4d | ", frame.left, frame.top, frame.right, frame.bottom);
diff --git a/services/surfaceflinger/RenderArea.h b/services/surfaceflinger/RenderArea.h
index b9c4909..bf0707f 100644
--- a/services/surfaceflinger/RenderArea.h
+++ b/services/surfaceflinger/RenderArea.h
@@ -1,6 +1,6 @@
#pragma once
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include "Transform.h"
@@ -32,7 +32,7 @@
int getReqWidth() const { return mReqWidth; };
Transform::orientation_flags getRotationFlags() const { return mRotationFlags; };
virtual bool getWideColorSupport() const = 0;
- virtual ColorMode getActiveColorMode() const = 0;
+ virtual ui::ColorMode getActiveColorMode() const = 0;
status_t updateDimensions();
diff --git a/services/surfaceflinger/RenderEngine/Surface.cpp b/services/surfaceflinger/RenderEngine/Surface.cpp
index 3c29e4b..0d20f1f 100644
--- a/services/surfaceflinger/RenderEngine/Surface.cpp
+++ b/services/surfaceflinger/RenderEngine/Surface.cpp
@@ -66,7 +66,7 @@
EGLint Surface::queryConfig(EGLint attrib) const {
EGLint value;
- if (!eglGetConfigAttrib(mEGLConfig, mEGLConfig, attrib, &value)) {
+ if (!eglGetConfigAttrib(mEGLDisplay, mEGLConfig, attrib, &value)) {
value = 0;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5c69b98..f180a3b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -104,6 +104,7 @@
using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;
+using ui::ColorMode;
namespace {
class ConditionalLock {
@@ -4048,6 +4049,7 @@
LayersProto layersProto = dumpProtoInfo(LayerVector::StateSet::Current);
auto layerTree = LayerProtoParser::generateLayerTree(layersProto);
result.append(LayerProtoParser::layersToString(std::move(layerTree)).c_str());
+ result.append("\n");
/*
* Dump Display state
@@ -4060,6 +4062,7 @@
const sp<const DisplayDevice>& hw(mDisplays[dpy]);
hw->dump(result);
}
+ result.append("\n");
/*
* Dump SurfaceFlinger global state
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 42d8112..448509b 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -410,9 +410,9 @@
Vector<DisplayInfo>* configs);
virtual int getActiveConfig(const sp<IBinder>& display);
virtual status_t getDisplayColorModes(const sp<IBinder>& display,
- Vector<ColorMode>* configs);
- virtual ColorMode getActiveColorMode(const sp<IBinder>& display);
- virtual status_t setActiveColorMode(const sp<IBinder>& display, ColorMode colorMode);
+ Vector<ui::ColorMode>* configs);
+ virtual ui::ColorMode getActiveColorMode(const sp<IBinder>& display);
+ virtual status_t setActiveColorMode(const sp<IBinder>& display, ui::ColorMode colorMode);
virtual void setPowerMode(const sp<IBinder>& display, int mode);
virtual status_t setActiveConfig(const sp<IBinder>& display, int id);
virtual status_t clearAnimationFrameStats();
@@ -462,7 +462,7 @@
bool stateLockHeld);
// Called on the main thread in response to setActiveColorMode()
- void setActiveColorModeInternal(const sp<DisplayDevice>& hw, ColorMode colorMode);
+ void setActiveColorModeInternal(const sp<DisplayDevice>& hw, ui::ColorMode colorMode);
// Returns whether the transaction actually modified any state
bool handleMessageTransaction();
@@ -635,7 +635,7 @@
// Given a dataSpace, returns the appropriate color_mode to use
// to display that dataSpace.
- ColorMode pickColorMode(android_dataspace dataSpace) const;
+ ui::ColorMode pickColorMode(android_dataspace dataSpace) const;
android_dataspace bestTargetDataSpace(android_dataspace a, android_dataspace b,
bool hasHdr) const;
diff --git a/services/surfaceflinger/layerproto/LayerProtoParser.cpp b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
index 47e5d1f..1383d28 100644
--- a/services/surfaceflinger/layerproto/LayerProtoParser.cpp
+++ b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
@@ -273,7 +273,7 @@
finalCrop.to_string().c_str());
StringAppendF(&result, "isOpaque=%1d, invalidate=%1d, ", isOpaque, invalidate);
StringAppendF(&result, "dataspace=%s, ", dataspace.c_str());
- StringAppendF(&result, "pixelformat=%s, ", pixelFormat.c_str());
+ StringAppendF(&result, "defaultPixelFormat=%s, ", pixelFormat.c_str());
StringAppendF(&result, "color=(%.3f,%.3f,%.3f,%.3f), flags=0x%08x, ",
static_cast<double>(color.r), static_cast<double>(color.g),
static_cast<double>(color.b), static_cast<double>(color.a), flags);
diff --git a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
index 86e2e1e..b3f1b69 100644
--- a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
+++ b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
@@ -22,7 +22,7 @@
#include <android-base/unique_fd.h>
#include <hardware/hardware.h>
#include <sync/sync.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#define HWC2_INCLUDE_STRINGIFICATION
#define HWC2_USE_CPP11
@@ -35,7 +35,7 @@
#include "Hwc2TestClientTarget.h"
#include "Hwc2TestVirtualDisplay.h"
-using android::ColorMode;
+using android::ui::ColorMode;
void hwc2TestHotplugCallback(hwc2_callback_data_t callbackData,
hwc2_display_t display, int32_t connected);
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index dec39e0..741fbb8 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -500,13 +500,36 @@
// both we and HAL can take part in
hook_extensions_.set(ext_bit);
break;
- case ProcHook::EXTENSION_UNKNOWN:
case ProcHook::KHR_get_physical_device_properties2:
- // HAL's extensions
+ case ProcHook::EXTENSION_UNKNOWN:
+ // Extensions we don't need to do anything about at this level
break;
- default:
- ALOGW("Ignored invalid instance extension %s", name);
+
+ case ProcHook::KHR_incremental_present:
+ case ProcHook::KHR_shared_presentable_image:
+ case ProcHook::KHR_swapchain:
+ case ProcHook::EXT_hdr_metadata:
+ case ProcHook::ANDROID_external_memory_android_hardware_buffer:
+ case ProcHook::ANDROID_native_buffer:
+ case ProcHook::GOOGLE_display_timing:
+ case ProcHook::EXTENSION_CORE:
+ case ProcHook::EXTENSION_COUNT:
+ // Device and meta extensions. If we ever get here it's a bug in
+ // our code. But enumerating them lets us avoid having a default
+ // case, and default hides other bugs.
+ ALOGE(
+ "CreateInfoWrapper::FilterExtension: invalid instance "
+ "extension '%s'. FIX ME",
+ name);
return;
+
+ // Don't use a default case. Without it, -Wswitch will tell us
+ // at compile time if someone adds a new ProcHook extension but
+ // doesn't handle it above. That's a real bug that has
+ // not-immediately-obvious effects.
+ //
+ // default:
+ // break;
}
} else {
switch (ext_bit) {
@@ -524,12 +547,36 @@
case ProcHook::EXT_hdr_metadata:
hook_extensions_.set(ext_bit);
break;
+ case ProcHook::ANDROID_external_memory_android_hardware_buffer:
case ProcHook::EXTENSION_UNKNOWN:
- // HAL's extensions
+ // Extensions we don't need to do anything about at this level
break;
- default:
- ALOGW("Ignored invalid device extension %s", name);
+
+ case ProcHook::KHR_android_surface:
+ case ProcHook::KHR_get_physical_device_properties2:
+ case ProcHook::KHR_get_surface_capabilities2:
+ case ProcHook::KHR_surface:
+ case ProcHook::EXT_debug_report:
+ case ProcHook::EXT_swapchain_colorspace:
+ case ProcHook::ANDROID_native_buffer:
+ case ProcHook::EXTENSION_CORE:
+ case ProcHook::EXTENSION_COUNT:
+ // Instance and meta extensions. If we ever get here it's a bug
+ // in our code. But enumerating them lets us avoid having a
+ // default case, and default hides other bugs.
+ ALOGE(
+ "CreateInfoWrapper::FilterExtension: invalid device "
+ "extension '%s'. FIX ME",
+ name);
return;
+
+ // Don't use a default case. Without it, -Wswitch will tell us
+ // at compile time if someone adds a new ProcHook extension but
+ // doesn't handle it above. That's a real bug that has
+ // not-immediately-obvious effects.
+ //
+ // default:
+ // break;
}
}