Merge "Enable access to display/manager socket in surfaceflinger" into oc-dev
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index f5dca47..f649a5e 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -94,6 +94,7 @@
"android.hardware.audio@2.0::IDevicesFactory",
"android.hardware.bluetooth@1.0::IBluetoothHci",
"android.hardware.camera.provider@2.4::ICameraProvider",
+ "android.hardware.graphics.composer@2.1::IComposer",
"android.hardware.vr@1.0::IVr",
"android.hardware.media.omx@1.0::IOmx",
NULL,
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 989fcda..70acb07 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -1122,65 +1122,81 @@
struct dqblk dq;
- uid_t uid = multiuser_get_uid(userId, appId);
- if (quotactl(QCMD(Q_GETQUOTA, USRQUOTA), device.c_str(), uid,
- reinterpret_cast<char*>(&dq)) != 0) {
- if (errno != ESRCH) {
- PLOG(ERROR) << "Failed to quotactl " << device << " for UID " << uid;
- }
- } else {
-#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for UID " << uid << " " << dq.dqb_curspace;
-#endif
- stats->dataSize += dq.dqb_curspace;
- }
-
- int cacheGid = multiuser_get_cache_gid(userId, appId);
- if (cacheGid != -1) {
- if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), cacheGid,
+ if (stats != nullptr) {
+ uid_t uid = multiuser_get_uid(userId, appId);
+ if (quotactl(QCMD(Q_GETQUOTA, USRQUOTA), device.c_str(), uid,
reinterpret_cast<char*>(&dq)) != 0) {
if (errno != ESRCH) {
- PLOG(ERROR) << "Failed to quotactl " << device << " for GID " << cacheGid;
+ PLOG(ERROR) << "Failed to quotactl " << device << " for UID " << uid;
}
} else {
#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for GID " << cacheGid << " " << dq.dqb_curspace;
+ LOG(DEBUG) << "quotactl() for UID " << uid << " " << dq.dqb_curspace;
#endif
- stats->cacheSize += dq.dqb_curspace;
+ stats->dataSize += dq.dqb_curspace;
+ }
+
+ int cacheGid = multiuser_get_cache_gid(userId, appId);
+ if (cacheGid != -1) {
+ if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), cacheGid,
+ reinterpret_cast<char*>(&dq)) != 0) {
+ if (errno != ESRCH) {
+ PLOG(ERROR) << "Failed to quotactl " << device << " for GID " << cacheGid;
+ }
+ } else {
+#if MEASURE_DEBUG
+ LOG(DEBUG) << "quotactl() for GID " << cacheGid << " " << dq.dqb_curspace;
+#endif
+ stats->cacheSize += dq.dqb_curspace;
+ }
+ }
+
+ int sharedGid = multiuser_get_shared_gid(0, appId);
+ if (sharedGid != -1) {
+ if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), sharedGid,
+ reinterpret_cast<char*>(&dq)) != 0) {
+ if (errno != ESRCH) {
+ PLOG(ERROR) << "Failed to quotactl " << device << " for GID " << sharedGid;
+ }
+ } else {
+#if MEASURE_DEBUG
+ LOG(DEBUG) << "quotactl() for GID " << sharedGid << " " << dq.dqb_curspace;
+#endif
+ stats->codeSize += dq.dqb_curspace;
+ }
}
}
-#if HACK_FOR_37193650
- extStats->dataSize = extStats->dataSize;
-#else
- int extGid = multiuser_get_ext_gid(userId, appId);
- if (extGid != -1) {
- if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), extGid,
- reinterpret_cast<char*>(&dq)) != 0) {
- if (errno != ESRCH) {
- PLOG(ERROR) << "Failed to quotactl " << device << " for GID " << extGid;
- }
- } else {
+ if (extStats != nullptr) {
+ int extGid = multiuser_get_ext_gid(userId, appId);
+ if (extGid != -1) {
+ if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), extGid,
+ reinterpret_cast<char*>(&dq)) != 0) {
+ if (errno != ESRCH) {
+ PLOG(ERROR) << "Failed to quotactl " << device << " for GID " << extGid;
+ }
+ } else {
#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for GID " << extGid << " " << dq.dqb_curspace;
+ LOG(DEBUG) << "quotactl() for GID " << extGid << " " << dq.dqb_curspace;
#endif
- extStats->dataSize += dq.dqb_curspace;
+ extStats->dataSize += dq.dqb_curspace;
+ }
}
- }
-#endif
- int sharedGid = multiuser_get_shared_gid(userId, appId);
- if (sharedGid != -1) {
- if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), sharedGid,
- reinterpret_cast<char*>(&dq)) != 0) {
- if (errno != ESRCH) {
- PLOG(ERROR) << "Failed to quotactl " << device << " for GID " << sharedGid;
- }
- } else {
+ int extCacheGid = multiuser_get_ext_cache_gid(userId, appId);
+ if (extCacheGid != -1) {
+ if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), extCacheGid,
+ reinterpret_cast<char*>(&dq)) != 0) {
+ if (errno != ESRCH) {
+ PLOG(ERROR) << "Failed to quotactl " << device << " for GID " << extCacheGid;
+ }
+ } else {
#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for GID " << sharedGid << " " << dq.dqb_curspace;
+ LOG(DEBUG) << "quotactl() for GID " << extCacheGid << " " << dq.dqb_curspace;
#endif
- stats->codeSize += dq.dqb_curspace;
+ extStats->dataSize += dq.dqb_curspace;
+ extStats->cacheSize += dq.dqb_curspace;
+ }
}
}
}
@@ -1256,9 +1272,10 @@
if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) != 0) {
continue;
}
+ int32_t user_uid = multiuser_get_app_id(s.st_uid);
if (!strcmp(name, ".") || !strcmp(name, "..")) {
continue;
- } else if (exclude_apps && (s.st_uid >= AID_APP_START && s.st_uid <= AID_APP_END)) {
+ } else if (exclude_apps && (user_uid >= AID_APP_START && user_uid <= AID_APP_END)) {
continue;
} else {
collectManualStats(StringPrintf("%s/%s", path.c_str(), name), stats);
@@ -1357,25 +1374,13 @@
ATRACE_BEGIN("code");
for (auto codePath : codePaths) {
calculate_tree_size(codePath, &stats.codeSize, -1,
- multiuser_get_shared_gid(userId, appId));
+ multiuser_get_shared_gid(0, appId));
}
ATRACE_END();
ATRACE_BEGIN("quota");
collectQuotaStats(device, userId, appId, &stats, &extStats);
ATRACE_END();
-
-#if HACK_FOR_37193650
- ATRACE_BEGIN("external");
- for (size_t i = 0; i < packageNames.size(); i++) {
- const char* pkgname = packageNames[i].c_str();
- auto extPath = create_data_media_package_path(uuid_, userId, "data", pkgname);
- calculate_tree_size(extPath, &extStats.dataSize);
- auto mediaPath = create_data_media_package_path(uuid_, userId, "media", pkgname);
- calculate_tree_size(mediaPath, &extStats.dataSize);
- }
- ATRACE_END();
-#endif
} else {
ATRACE_BEGIN("code");
for (auto codePath : codePaths) {
@@ -1414,7 +1419,7 @@
if (!uuid) {
ATRACE_BEGIN("dalvik");
- int32_t sharedGid = multiuser_get_shared_gid(userId, appId);
+ int32_t sharedGid = multiuser_get_shared_gid(0, appId);
if (sharedGid != -1) {
calculate_tree_size(create_data_dalvik_cache_path(), &stats.codeSize,
sharedGid, -1);
@@ -1464,12 +1469,6 @@
flags &= ~FLAG_USE_QUOTA;
}
-#if HACK_FOR_37193650
- if (userId != 0) {
- flags &= ~FLAG_USE_QUOTA;
- }
-#endif
-
if (flags & FLAG_USE_QUOTA) {
struct dqblk dq;
@@ -1532,6 +1531,7 @@
}
ATRACE_BEGIN("quota");
+ int64_t dataSize = extStats.dataSize;
for (auto appId : appIds) {
if (appId >= AID_APP_START) {
collectQuotaStats(device, userId, appId, &stats, &extStats);
@@ -1542,6 +1542,7 @@
#endif
}
}
+ extStats.dataSize = dataSize;
ATRACE_END();
} else {
ATRACE_BEGIN("obb");
@@ -1601,7 +1602,8 @@
}
binder::Status InstalldNativeService::getExternalSize(const std::unique_ptr<std::string>& uuid,
- int32_t userId, int32_t flags, std::vector<int64_t>* _aidl_return) {
+ int32_t userId, int32_t flags, const std::vector<int32_t>& appIds,
+ std::vector<int64_t>* _aidl_return) {
ENFORCE_UID(AID_SYSTEM);
CHECK_ARGUMENT_UUID(uuid);
// NOTE: Locking is relaxed on this method, since it's limited to
@@ -1620,6 +1622,7 @@
int64_t audioSize = 0;
int64_t videoSize = 0;
int64_t imageSize = 0;
+ int64_t appSize = 0;
auto device = findQuotaDeviceForUuid(uuid);
if (device.empty()) {
@@ -1629,6 +1632,7 @@
if (flags & FLAG_USE_QUOTA) {
struct dqblk dq;
+ ATRACE_BEGIN("quota");
uid_t uid = multiuser_get_uid(userId, AID_MEDIA_RW);
if (quotactl(QCMD(Q_GETQUOTA, USRQUOTA), device.c_str(), uid,
reinterpret_cast<char*>(&dq)) != 0) {
@@ -1637,7 +1641,7 @@
}
} else {
#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for UID " << uid << " " << dq.dqb_curspace;
+ LOG(DEBUG) << "quotactl() for UID " << uid << " " << dq.dqb_curspace;
#endif
totalSize = dq.dqb_curspace;
}
@@ -1646,7 +1650,7 @@
if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), audioGid,
reinterpret_cast<char*>(&dq)) == 0) {
#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for GID " << audioGid << " " << dq.dqb_curspace;
+ LOG(DEBUG) << "quotactl() for GID " << audioGid << " " << dq.dqb_curspace;
#endif
audioSize = dq.dqb_curspace;
}
@@ -1654,7 +1658,7 @@
if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), videoGid,
reinterpret_cast<char*>(&dq)) == 0) {
#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for GID " << videoGid << " " << dq.dqb_curspace;
+ LOG(DEBUG) << "quotactl() for GID " << videoGid << " " << dq.dqb_curspace;
#endif
videoSize = dq.dqb_curspace;
}
@@ -1662,11 +1666,24 @@
if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), imageGid,
reinterpret_cast<char*>(&dq)) == 0) {
#if MEASURE_DEBUG
- LOG(DEBUG) << "quotactl() for GID " << imageGid << " " << dq.dqb_curspace;
+ LOG(DEBUG) << "quotactl() for GID " << imageGid << " " << dq.dqb_curspace;
#endif
imageSize = dq.dqb_curspace;
}
+ ATRACE_END();
+
+ ATRACE_BEGIN("apps");
+ struct stats extStats;
+ memset(&extStats, 0, sizeof(extStats));
+ for (auto appId : appIds) {
+ if (appId >= AID_APP_START) {
+ collectQuotaStats(device, userId, appId, nullptr, &extStats);
+ }
+ }
+ appSize = extStats.dataSize + extStats.cacheSize;
+ ATRACE_END();
} else {
+ ATRACE_BEGIN("manual");
FTS *fts;
FTSENT *p;
auto path = create_data_media_path(uuid_, userId);
@@ -1700,11 +1717,15 @@
case FTS_DEFAULT:
case FTS_SL:
case FTS_SLNONE:
+ if (p->fts_parent->fts_number == 1) {
+ appSize += size;
+ }
totalSize += size;
break;
}
}
fts_close(fts);
+ ATRACE_END();
}
std::vector<int64_t> ret;
@@ -1712,6 +1733,7 @@
ret.push_back(audioSize);
ret.push_back(videoSize);
ret.push_back(imageSize);
+ ret.push_back(appSize);
#if MEASURE_DEBUG
LOG(DEBUG) << "Final result " << toString(ret);
#endif
diff --git a/cmds/installd/InstalldNativeService.h b/cmds/installd/InstalldNativeService.h
index fe8aa14..7f73c2a 100644
--- a/cmds/installd/InstalldNativeService.h
+++ b/cmds/installd/InstalldNativeService.h
@@ -68,7 +68,8 @@
int32_t userId, int32_t flags, const std::vector<int32_t>& appIds,
std::vector<int64_t>* _aidl_return);
binder::Status getExternalSize(const std::unique_ptr<std::string>& uuid,
- int32_t userId, int32_t flags, std::vector<int64_t>* _aidl_return);
+ int32_t userId, int32_t flags, const std::vector<int32_t>& appIds,
+ std::vector<int64_t>* _aidl_return);
binder::Status setAppQuota(const std::unique_ptr<std::string>& uuid,
int32_t userId, int32_t appId, int64_t cacheQuota);
diff --git a/cmds/installd/binder/android/os/IInstalld.aidl b/cmds/installd/binder/android/os/IInstalld.aidl
index e738b81..6b99c1d 100644
--- a/cmds/installd/binder/android/os/IInstalld.aidl
+++ b/cmds/installd/binder/android/os/IInstalld.aidl
@@ -38,7 +38,7 @@
int userId, int flags, int appId, in long[] ceDataInodes,
in @utf8InCpp String[] codePaths);
long[] getUserSize(@nullable @utf8InCpp String uuid, int userId, int flags, in int[] appIds);
- long[] getExternalSize(@nullable @utf8InCpp String uuid, int userId, int flags);
+ long[] getExternalSize(@nullable @utf8InCpp String uuid, int userId, int flags, in int[] appIds);
void setAppQuota(@nullable @utf8InCpp String uuid, int userId, int appId, long cacheQuota);
diff --git a/cmds/installd/utils.h b/cmds/installd/utils.h
index 5db547e..dd94da9 100644
--- a/cmds/installd/utils.h
+++ b/cmds/installd/utils.h
@@ -32,7 +32,6 @@
#define MEASURE_DEBUG 0
#define FIXUP_DEBUG 0
-#define HACK_FOR_37193650 1
namespace android {
namespace installd {
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
index af1d8be..4b82cff 100644
--- a/include/ui/GraphicBuffer.h
+++ b/include/ui/GraphicBuffer.h
@@ -81,8 +81,8 @@
// Create a GraphicBuffer by allocating and managing a buffer internally.
// This function is privileged. See reallocate for details.
GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat,
- uint32_t inLayerCount, uint64_t inProducerUsage,
- uint64_t inConsumerUsage, std::string requestorName = "<Unknown>");
+ uint32_t inLayerCount, uint64_t inUsage,
+ std::string requestorName = "<Unknown>");
// Create a GraphicBuffer from an existing handle.
enum HandleWrapMethod : uint8_t {
@@ -120,16 +120,15 @@
GraphicBuffer(const native_handle_t* handle, HandleWrapMethod method,
uint32_t width, uint32_t height,
PixelFormat format, uint32_t layerCount,
- uint64_t producerUsage, uint64_t consumerUsage, uint32_t stride);
+ uint64_t usage, uint32_t stride);
- // These functions are deprecated because they do not distinguish producer
- // and consumer usages.
+ // These functions are deprecated because they only take 32 bits of usage
GraphicBuffer(const native_handle_t* handle, HandleWrapMethod method,
uint32_t width, uint32_t height,
PixelFormat format, uint32_t layerCount,
uint32_t usage, uint32_t stride)
: GraphicBuffer(handle, method, width, height, format, layerCount,
- usage, usage, stride) {}
+ static_cast<uint64_t>(usage), stride) {}
GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat,
uint32_t inLayerCount, uint32_t inUsage, uint32_t inStride,
native_handle_t* inHandle, bool keepOwnership);
@@ -157,10 +156,10 @@
// device or service, which usually involves adding suitable selinux
// rules.
status_t reallocate(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint32_t inUsage);
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t inUsage);
bool needsReallocation(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint32_t inUsage);
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t inUsage);
status_t lock(uint32_t inUsage, void** vaddr);
status_t lock(uint32_t inUsage, const Rect& rect, void** vaddr);
@@ -219,13 +218,12 @@
status_t initWithSize(uint32_t inWidth, uint32_t inHeight,
PixelFormat inFormat, uint32_t inLayerCount,
- uint64_t inProducerUsage, uint64_t inConsumerUsage,
- std::string requestorName);
+ uint64_t inUsage, std::string requestorName);
status_t initWithHandle(const native_handle_t* handle,
HandleWrapMethod method, uint32_t width, uint32_t height,
PixelFormat format, uint32_t layerCount,
- uint64_t producerUsage, uint64_t consumerUsage, uint32_t stride);
+ uint64_t usage, uint32_t stride);
void free_handle();
diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
index c4cbfc4..fe99de1 100644
--- a/include/ui/GraphicBufferAllocator.h
+++ b/include/ui/GraphicBufferAllocator.h
@@ -49,7 +49,7 @@
static inline GraphicBufferAllocator& get() { return getInstance(); }
status_t allocate(uint32_t w, uint32_t h, PixelFormat format,
- uint32_t layerCount, uint64_t producerUsage, uint64_t consumerUsage,
+ uint32_t layerCount, uint64_t usage,
buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId,
std::string requestorName);
@@ -65,8 +65,7 @@
uint32_t stride;
PixelFormat format;
uint32_t layerCount;
- uint64_t producerUsage;
- uint64_t consumerUsage;
+ uint64_t usage;
size_t size;
std::string requestorName;
};
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 49552dc..cddb1fd 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -503,7 +503,7 @@
if (returnFlags & BUFFER_NEEDS_REALLOCATION) {
BQ_LOGV("dequeueBuffer: allocating a new buffer for slot %d", *outSlot);
sp<GraphicBuffer> graphicBuffer = new GraphicBuffer(
- width, height, format, BQ_LAYER_COUNT, usage, usage,
+ width, height, format, BQ_LAYER_COUNT, usage,
{mConsumerName.string(), mConsumerName.size()});
status_t error = graphicBuffer->initCheck();
@@ -1342,7 +1342,7 @@
for (size_t i = 0; i < newBufferCount; ++i) {
sp<GraphicBuffer> graphicBuffer = new GraphicBuffer(
allocWidth, allocHeight, allocFormat, BQ_LAYER_COUNT,
- allocUsage, allocUsage, {mConsumerName.string(), mConsumerName.size()});
+ allocUsage, {mConsumerName.string(), mConsumerName.size()});
status_t result = graphicBuffer->initCheck();
diff --git a/libs/nativewindow/AHardwareBuffer.cpp b/libs/nativewindow/AHardwareBuffer.cpp
index 35b76c7..e2647be 100644
--- a/libs/nativewindow/AHardwareBuffer.cpp
+++ b/libs/nativewindow/AHardwareBuffer.cpp
@@ -60,9 +60,10 @@
uint64_t consumerUsage = 0;
AHardwareBuffer_convertToGrallocUsageBits(&producerUsage, &consumerUsage, desc->usage0,
desc->usage1);
+ uint32_t usage = android_convertGralloc1To0Usage(producerUsage, consumerUsage);
sp<GraphicBuffer> gbuffer(new GraphicBuffer(
- desc->width, desc->height, format, desc->layers, producerUsage, consumerUsage,
+ desc->width, desc->height, format, desc->layers, usage,
std::string("AHardwareBuffer pid [") + std::to_string(getpid()) + "]"));
status_t err = gbuffer->initCheck();
@@ -358,8 +359,8 @@
case HAL_PIXEL_FORMAT_RGBX_8888: return AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM;
case HAL_PIXEL_FORMAT_RGB_565: return AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM;
case HAL_PIXEL_FORMAT_RGB_888: return AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM;
- case HAL_PIXEL_FORMAT_RGBA_FP16: return AHARDWAREBUFFER_FORMAT_R16G16B16A16_SFLOAT;
- case HAL_PIXEL_FORMAT_RGBA_1010102: return AHARDWAREBUFFER_FORMAT_A2R10G10B10_UNORM_PACK32;
+ case HAL_PIXEL_FORMAT_RGBA_FP16: return AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT;
+ case HAL_PIXEL_FORMAT_RGBA_1010102: return AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM;
case HAL_PIXEL_FORMAT_BLOB: return AHARDWAREBUFFER_FORMAT_BLOB;
default:ALOGE("Unknown pixel format %u", format);
return 0;
@@ -372,8 +373,8 @@
case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: return HAL_PIXEL_FORMAT_RGBX_8888;
case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: return HAL_PIXEL_FORMAT_RGB_565;
case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: return HAL_PIXEL_FORMAT_RGB_888;
- case AHARDWAREBUFFER_FORMAT_R16G16B16A16_SFLOAT: return HAL_PIXEL_FORMAT_RGBA_FP16;
- case AHARDWAREBUFFER_FORMAT_A2R10G10B10_UNORM_PACK32: return HAL_PIXEL_FORMAT_RGBA_1010102;
+ case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: return HAL_PIXEL_FORMAT_RGBA_FP16;
+ case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: return HAL_PIXEL_FORMAT_RGBA_1010102;
case AHARDWAREBUFFER_FORMAT_BLOB: return HAL_PIXEL_FORMAT_BLOB;
default:ALOGE("Unknown AHardwareBuffer format %u", format);
return 0;
diff --git a/libs/nativewindow/include/android/hardware_buffer.h b/libs/nativewindow/include/android/hardware_buffer.h
index 02838d4..f5657ff 100644
--- a/libs/nativewindow/include/android/hardware_buffer.h
+++ b/libs/nativewindow/include/android/hardware_buffer.h
@@ -66,14 +66,14 @@
* Vulkan: VK_FORMAT_R16G16B16A16_SFLOAT
* OpenGL ES: GL_RGBA16F
*/
- AHARDWAREBUFFER_FORMAT_R16G16B16A16_SFLOAT = 0x16,
+ AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 0x16,
/**
* Corresponding formats:
- * Vulkan: VK_FORMAT_A2R10G10B10_UNORM_PACK32
+ * Vulkan: VK_FORMAT_A2B10G10R10_UNORM_PACK32
* OpenGL ES: GL_RGB10_A2
*/
- AHARDWAREBUFFER_FORMAT_A2R10G10B10_UNORM_PACK32 = 0x2b,
+ AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 0x2b,
/**
* An opaque binary blob format that must have height 1, with width equal to
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index b0cb012..ee85c9b 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -59,18 +59,18 @@
// deprecated
GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight,
PixelFormat inFormat, uint32_t inUsage, std::string requestorName)
- : GraphicBuffer(inWidth, inHeight, inFormat, 1, inUsage, inUsage,
+ : GraphicBuffer(inWidth, inHeight, inFormat, 1, static_cast<uint64_t>(inUsage),
requestorName)
{
}
GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint64_t producerUsage,
- uint64_t consumerUsage, std::string requestorName)
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t usage,
+ std::string requestorName)
: GraphicBuffer()
{
mInitCheck = initWithSize(inWidth, inHeight, inFormat, inLayerCount,
- producerUsage, consumerUsage, std::move(requestorName));
+ usage, std::move(requestorName));
}
// deprecated
@@ -78,7 +78,7 @@
PixelFormat inFormat, uint32_t inLayerCount, uint32_t inUsage,
uint32_t inStride, native_handle_t* inHandle, bool keepOwnership)
: GraphicBuffer(inHandle, keepOwnership ? TAKE_HANDLE : WRAP_HANDLE,
- inWidth, inHeight, inFormat, inLayerCount, inUsage, inUsage,
+ inWidth, inHeight, inFormat, inLayerCount, static_cast<uint64_t>(inUsage),
inStride)
{
}
@@ -86,12 +86,12 @@
GraphicBuffer::GraphicBuffer(const native_handle_t* handle,
HandleWrapMethod method, uint32_t width, uint32_t height,
PixelFormat format, uint32_t layerCount,
- uint64_t producerUsage, uint64_t consumerUsage,
+ uint64_t usage,
uint32_t stride)
: GraphicBuffer()
{
mInitCheck = initWithHandle(handle, method, width, height, format,
- layerCount, producerUsage, consumerUsage, stride);
+ layerCount, usage, stride);
}
GraphicBuffer::~GraphicBuffer()
@@ -129,7 +129,7 @@
}
status_t GraphicBuffer::reallocate(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint32_t inUsage)
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t inUsage)
{
if (mOwner != ownData)
return INVALID_OPERATION;
@@ -148,11 +148,11 @@
handle = 0;
}
return initWithSize(inWidth, inHeight, inFormat, inLayerCount,
- inUsage, inUsage, "[Reallocation]");
+ inUsage, "[Reallocation]");
}
bool GraphicBuffer::needsReallocation(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint32_t inUsage)
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t inUsage)
{
if (static_cast<int>(inWidth) != width) return true;
if (static_cast<int>(inHeight) != height) return true;
@@ -163,20 +163,20 @@
}
status_t GraphicBuffer::initWithSize(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint64_t inProducerUsage,
- uint64_t inConsumerUsage, std::string requestorName)
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t inUsage,
+ std::string requestorName)
{
GraphicBufferAllocator& allocator = GraphicBufferAllocator::get();
uint32_t outStride = 0;
status_t err = allocator.allocate(inWidth, inHeight, inFormat, inLayerCount,
- inProducerUsage, inConsumerUsage, &handle, &outStride, mId,
+ inUsage, &handle, &outStride, mId,
std::move(requestorName));
if (err == NO_ERROR) {
width = static_cast<int>(inWidth);
height = static_cast<int>(inHeight);
format = inFormat;
layerCount = inLayerCount;
- usage = android_convertGralloc1To0Usage(inProducerUsage, inConsumerUsage);
+ usage = static_cast<int>(inUsage);
stride = static_cast<int>(outStride);
}
return err;
@@ -184,16 +184,14 @@
status_t GraphicBuffer::initWithHandle(const native_handle_t* handle,
HandleWrapMethod method, uint32_t width, uint32_t height,
- PixelFormat format, uint32_t layerCount,
- uint64_t producerUsage, uint64_t consumerUsage,
+ PixelFormat format, uint32_t layerCount, uint64_t usage,
uint32_t stride)
{
ANativeWindowBuffer::width = static_cast<int>(width);
ANativeWindowBuffer::height = static_cast<int>(height);
ANativeWindowBuffer::stride = static_cast<int>(stride);
ANativeWindowBuffer::format = format;
- ANativeWindowBuffer::usage =
- android_convertGralloc1To0Usage(producerUsage, consumerUsage);
+ ANativeWindowBuffer::usage = static_cast<int>(usage);
ANativeWindowBuffer::layerCount = layerCount;
@@ -203,7 +201,7 @@
buffer_handle_t importedHandle;
status_t err = mBufferMapper.importBuffer(handle, &importedHandle);
if (err != NO_ERROR) {
- initWithHandle(nullptr, WRAP_HANDLE, 0, 0, 0, 0, 0, 0, 0);
+ initWithHandle(nullptr, WRAP_HANDLE, 0, 0, 0, 0, 0, 0);
return err;
}
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index 11f0250..eaba1ed 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -64,18 +64,16 @@
const alloc_rec_t& rec(list.valueAt(i));
if (rec.size) {
snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %4u | %8X | 0x%" PRIx64
- ", 0x%" PRIx64 " | %s\n",
+ " | %s\n",
list.keyAt(i), rec.size/1024.0,
rec.width, rec.stride, rec.height, rec.layerCount, rec.format,
- rec.producerUsage, rec.consumerUsage,
- rec.requestorName.c_str());
+ rec.usage, rec.requestorName.c_str());
} else {
snprintf(buffer, SIZE, "%10p: unknown | %4u (%4u) x %4u | %4u | %8X | 0x%" PRIx64
- ", 0x%" PRIx64 " | %s\n",
+ " | %s\n",
list.keyAt(i),
rec.width, rec.stride, rec.height, rec.layerCount, rec.format,
- rec.producerUsage, rec.consumerUsage,
- rec.requestorName.c_str());
+ rec.usage, rec.requestorName.c_str());
}
result.append(buffer);
total += rec.size;
@@ -95,8 +93,8 @@
}
status_t GraphicBufferAllocator::allocate(uint32_t width, uint32_t height,
- PixelFormat format, uint32_t layerCount, uint64_t producerUsage,
- uint64_t consumerUsage, buffer_handle_t* handle, uint32_t* stride,
+ PixelFormat format, uint32_t layerCount, uint64_t usage,
+ buffer_handle_t* handle, uint32_t* stride,
uint64_t /*graphicBufferId*/, std::string requestorName)
{
ATRACE_CALL();
@@ -115,8 +113,7 @@
info.height = height;
info.layerCount = layerCount;
info.format = static_cast<Gralloc2::PixelFormat>(format);
- info.usage = static_cast<uint64_t>(android_convertGralloc1To0Usage(
- producerUsage, consumerUsage));
+ info.usage = usage;
Gralloc2::Error error = mAllocator->allocate(info, stride, handle);
if (error == Gralloc2::Error::NONE) {
@@ -129,8 +126,7 @@
rec.stride = *stride;
rec.format = format;
rec.layerCount = layerCount;
- rec.producerUsage = producerUsage;
- rec.consumerUsage = consumerUsage;
+ rec.usage = usage;
rec.size = static_cast<size_t>(height * (*stride) * bpp);
rec.requestorName = std::move(requestorName);
list.add(*handle, rec);
@@ -138,9 +134,9 @@
return NO_ERROR;
} else {
ALOGE("Failed to allocate (%u x %u) layerCount %u format %d "
- "producerUsage %" PRIx64 " consumerUsage %" PRIx64 ": %d",
- width, height, layerCount, format, producerUsage,
- consumerUsage, error);
+ "usage %" PRIx64 ": %d",
+ width, height, layerCount, format, usage,
+ error);
return NO_MEMORY;
}
}
diff --git a/libs/vr/libbufferhub/Android.bp b/libs/vr/libbufferhub/Android.bp
index 452bad0..68b9c81 100644
--- a/libs/vr/libbufferhub/Android.bp
+++ b/libs/vr/libbufferhub/Android.bp
@@ -25,6 +25,7 @@
staticLibraries = [
"libdvrcommon",
"libpdx_default_transport",
+ "libgrallocusage",
]
sharedLibraries = [
diff --git a/libs/vr/libbufferhub/ion_buffer.cpp b/libs/vr/libbufferhub/ion_buffer.cpp
index df9ae81..0a6996e 100644
--- a/libs/vr/libbufferhub/ion_buffer.cpp
+++ b/libs/vr/libbufferhub/ion_buffer.cpp
@@ -2,6 +2,7 @@
#include <log/log.h>
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <grallocusage/GrallocUsageConversion.h>
#include <utils/Trace.h>
#include <mutex>
@@ -99,9 +100,10 @@
" consumer_usage=%" PRIx64,
width, height, format, producer_usage, consumer_usage);
- sp<GraphicBuffer> buffer =
- new GraphicBuffer(width, height, format, kDefaultGraphicBufferLayerCount,
- producer_usage, consumer_usage);
+ // TODO: forget about split producer/consumer usage
+ sp<GraphicBuffer> buffer = new GraphicBuffer(
+ width, height, format, kDefaultGraphicBufferLayerCount,
+ android_convertGralloc1To0Usage(producer_usage, consumer_usage));
if (buffer->initCheck() != OK) {
ALOGE("IonBuffer::Aloc: Failed to allocate buffer");
return -EINVAL;
@@ -144,9 +146,12 @@
"producer_usage=%" PRIx64 " consumer_usage=%" PRIx64,
handle, width, height, stride, format, producer_usage, consumer_usage);
FreeHandle();
- sp<GraphicBuffer> buffer = new GraphicBuffer(
- handle, GraphicBuffer::TAKE_UNREGISTERED_HANDLE, width, height, format,
- kDefaultGraphicBufferLayerCount, producer_usage, consumer_usage, stride);
+ sp<GraphicBuffer> buffer =
+ new GraphicBuffer(handle, GraphicBuffer::TAKE_UNREGISTERED_HANDLE, width,
+ height, format, kDefaultGraphicBufferLayerCount,
+ static_cast<uint64_t>(android_convertGralloc1To0Usage(
+ producer_usage, consumer_usage)),
+ stride);
if (buffer->initCheck() != OK) {
ALOGE("IonBuffer::Import: Failed to import buffer");
return -EINVAL;
diff --git a/libs/vr/libdvrcommon/include/private/dvr/benchmark.h b/libs/vr/libdvrcommon/include/private/dvr/benchmark.h
index 2dbb5f2..7eeab16 100644
--- a/libs/vr/libdvrcommon/include/private/dvr/benchmark.h
+++ b/libs/vr/libdvrcommon/include/private/dvr/benchmark.h
@@ -19,7 +19,7 @@
// ... code to benchmark ...
// Btrace("End execution");
//
-// Use compute_benchmarks.py (currently in dreamos/system/core/applications),
+// Use compute_benchmarks.py
// with the trace path "Start execution,End execution",
// to report the elapsed time between the two calls.
//
diff --git a/libs/vr/libimageio/include/private/dvr/image_io_base.h b/libs/vr/libimageio/include/private/dvr/image_io_base.h
index 009cad4..5f29de7 100644
--- a/libs/vr/libimageio/include/private/dvr/image_io_base.h
+++ b/libs/vr/libimageio/include/private/dvr/image_io_base.h
@@ -1,5 +1,5 @@
-#ifndef LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_BASE_H_
-#define LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_BASE_H_
+#ifndef LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_BASE_H_
+#define LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_BASE_H_
#include <memory>
#include <string>
@@ -53,4 +53,4 @@
ImageIoWriter() = delete;
};
-#endif // LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_BASE_H_
+#endif // LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_BASE_H_
diff --git a/libs/vr/libimageio/include/private/dvr/image_io_logging.h b/libs/vr/libimageio/include/private/dvr/image_io_logging.h
index ac78179..a2629f3 100644
--- a/libs/vr/libimageio/include/private/dvr/image_io_logging.h
+++ b/libs/vr/libimageio/include/private/dvr/image_io_logging.h
@@ -1,5 +1,5 @@
-#ifndef LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_LOGGING_H_
-#define LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_LOGGING_H_
+#ifndef LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_LOGGING_H_
+#define LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_LOGGING_H_
// This header acts as log/log.h if LOG_TO_STDERR is not defined.
// If LOG_TO_STDERR is defined, then android logging macros (such as ALOGE)
@@ -36,4 +36,4 @@
#include <log/log.h>
#endif // LOG_TO_STDERR
-#endif // LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_LOGGING_H_
+#endif // LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_LOGGING_H_
diff --git a/libs/vr/libimageio/include/private/dvr/image_io_png.h b/libs/vr/libimageio/include/private/dvr/image_io_png.h
index e3b19db..e06a17a 100644
--- a/libs/vr/libimageio/include/private/dvr/image_io_png.h
+++ b/libs/vr/libimageio/include/private/dvr/image_io_png.h
@@ -1,5 +1,5 @@
-#ifndef LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_PNG_H_
-#define LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_PNG_H_
+#ifndef LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_PNG_H_
+#define LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_PNG_H_
#include <fstream>
@@ -21,4 +21,4 @@
friend class ImageIoWriter;
};
-#endif // LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_PNG_H_
+#endif // LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_PNG_H_
diff --git a/libs/vr/libimageio/include/private/dvr/image_io_ppm.h b/libs/vr/libimageio/include/private/dvr/image_io_ppm.h
index 00264bd..8a1a96c 100644
--- a/libs/vr/libimageio/include/private/dvr/image_io_ppm.h
+++ b/libs/vr/libimageio/include/private/dvr/image_io_ppm.h
@@ -1,5 +1,5 @@
-#ifndef LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_PPM_H_
-#define LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_PPM_H_
+#ifndef LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_PPM_H_
+#define LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_PPM_H_
#include <private/dvr/image_io_base.h>
@@ -25,4 +25,4 @@
friend class ImageIoWriter;
};
-#endif // LIB_LIBIMAGEIO_PRIVATE_DREAMOS_IMAGE_IO_PPM_H_
+#endif // LIB_LIBIMAGEIO_PRIVATE_DVR_IMAGE_IO_PPM_H_
diff --git a/libs/vr/libvrflinger/acquired_buffer.h b/libs/vr/libvrflinger/acquired_buffer.h
index 050cd5f..1d14a38 100644
--- a/libs/vr/libvrflinger/acquired_buffer.h
+++ b/libs/vr/libvrflinger/acquired_buffer.h
@@ -43,7 +43,7 @@
// Accessors for the underlying BufferConsumer, the acquire fence, and the
// use-case specific sequence value from the acquisition (see
- // dreamos/buffer_hub_client.h).
+ // private/dvr/buffer_hub_client.h).
std::shared_ptr<BufferConsumer> buffer() const { return buffer_; }
int acquire_fence() const { return acquire_fence_.Get(); }
diff --git a/libs/vr/libvrflinger/compositor.cpp b/libs/vr/libvrflinger/compositor.cpp
index 239ef75..d1d4f45 100644
--- a/libs/vr/libvrflinger/compositor.cpp
+++ b/libs/vr/libvrflinger/compositor.cpp
@@ -48,10 +48,10 @@
std::make_shared<int64_t>(0);
static constexpr char kDisableLensDistortionProp[] =
- "persist.dreamos.disable_distort";
+ "persist.dvr.disable_distort";
static constexpr char kEnableEdsPoseSaveProp[] =
- "persist.dreamos.save_eds_pose";
+ "persist.dvr.save_eds_pose";
namespace android {
namespace dvr {
diff --git a/libs/vr/libvrflinger/hardware_composer.cpp b/libs/vr/libvrflinger/hardware_composer.cpp
index 6602d78..18ff4f5 100644
--- a/libs/vr/libvrflinger/hardware_composer.cpp
+++ b/libs/vr/libvrflinger/hardware_composer.cpp
@@ -64,7 +64,7 @@
const char kDvrPerformanceProperty[] = "sys.dvr.performance";
-const char kRightEyeOffsetProperty[] = "dreamos.right_eye_offset_ns";
+const char kRightEyeOffsetProperty[] = "dvr.right_eye_offset_ns";
// Returns our best guess for the time the compositor will spend rendering the
// next frame.
diff --git a/opengl/tests/gl2_basic/gl2_basic.cpp b/opengl/tests/gl2_basic/gl2_basic.cpp
index cdbf1cf..9f8d166 100644
--- a/opengl/tests/gl2_basic/gl2_basic.cpp
+++ b/opengl/tests/gl2_basic/gl2_basic.cpp
@@ -44,6 +44,11 @@
fprintf(stderr, "GL %s = %s\n", name, v);
}
+static void printEGLString(EGLDisplay dpy, const char *name, GLenum s) {
+ const char *v = (const char *) eglQueryString(dpy, s);
+ fprintf(stderr, "GL %s = %s\n", name, v);
+}
+
static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
if (returnVal != EGL_TRUE) {
fprintf(stderr, "%s() returned %d\n", op, returnVal);
@@ -341,6 +346,7 @@
printGLString("Vendor", GL_VENDOR);
printGLString("Renderer", GL_RENDERER);
printGLString("Extensions", GL_EXTENSIONS);
+ printEGLString(dpy, "EGL Extensions", EGL_EXTENSIONS);
if(!setupGraphics(w, h)) {
fprintf(stderr, "Could not set up graphics.\n");
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index 986c268..7d9b0b7 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -56,6 +56,9 @@
if (!connectHidlService()) {
return;
}
+
+ float minPowerMa = 0.001; // 1 microAmp
+
checkReturn(mSensors->getSensorsList(
[&](const auto &list) {
const size_t count = list.size();
@@ -65,6 +68,12 @@
for (size_t i=0 ; i < count; i++) {
sensor_t sensor;
convertToSensor(list[i], &sensor);
+ // Sanity check and clamp power if it is 0 (or close)
+ if (sensor.power < minPowerMa) {
+ ALOGE("Reported power %f not deemed sane, clamping to %f",
+ sensor.power, minPowerMa);
+ sensor.power = minPowerMa;
+ }
mSensorList.push_back(sensor);
mActivationCount.add(list[i].sensorHandle, model);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 746d3d9..9cd1214 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2371,6 +2371,7 @@
bool visibleRegions = false;
bool frameQueued = false;
+ bool newDataLatched = false;
// Store the set of layers that need updates. This set must not change as
// buffers are being latched, as this could result in a deadlock.
@@ -2398,6 +2399,9 @@
const Region dirty(layer->latchBuffer(visibleRegions, latchTime));
layer->useSurfaceDamage();
invalidateLayerStack(layer->getLayerStack(), dirty);
+ if (!dirty.isEmpty()) {
+ newDataLatched = true;
+ }
}
mVisibleRegionsDirty |= visibleRegions;
@@ -2410,7 +2414,7 @@
}
// Only continue with the refresh if there is actually new work to do
- return !mLayersWithQueuedFrames.empty();
+ return !mLayersWithQueuedFrames.empty() && newDataLatched;
}
void SurfaceFlinger::invalidateHwcGeometry()
diff --git a/services/vr/hardware_composer/impl/vr_hwc.cpp b/services/vr/hardware_composer/impl/vr_hwc.cpp
index 29983a7..504b26f 100644
--- a/services/vr/hardware_composer/impl/vr_hwc.cpp
+++ b/services/vr/hardware_composer/impl/vr_hwc.cpp
@@ -46,7 +46,7 @@
sp<GraphicBuffer> buffer = new GraphicBuffer(
handle, GraphicBuffer::CLONE_HANDLE, metadata.width, metadata.height,
static_cast<int32_t>(metadata.format), metadata.layerCount,
- metadata.usage, metadata.usage, metadata.stride);
+ metadata.usage, metadata.stride);
if (buffer->initCheck() != OK) {
ALOGE("Failed to create graphic buffer");
return nullptr;
diff --git a/services/vr/sensord/pose_service.cpp b/services/vr/sensord/pose_service.cpp
index e3f8171..75423bb 100644
--- a/services/vr/sensord/pose_service.cpp
+++ b/services/vr/sensord/pose_service.cpp
@@ -48,7 +48,7 @@
static constexpr float kDefaultNeckVerticalOffset = 0.075f; // meters
static constexpr char kDisablePosePredictionProp[] =
- "persist.dreamos.disable_predict";
+ "persist.dvr.disable_predict";
// Device type property for controlling classes of behavior that differ
// between devices. If unset, defaults to kOrientationTypeSmartphone.
@@ -182,7 +182,7 @@
KickSensorWatchDogThread();
}
- // Read the persistent dreamos flags before using them in SetPoseMode.
+ // Read the persistent dvr flags before using them in SetPoseMode.
enable_pose_prediction_ =
property_get_bool(kDisablePosePredictionProp, 0) == 0;
@@ -467,7 +467,10 @@
-kDefaultNeckHorizontalOffset);
// Update the current latency model.
- sensor_latency_.AddLatency(GetSystemClockNs() - pose_state.timestamp_ns);
+ if (pose_state.timestamp_ns != 0) {
+ sensor_latency_.AddLatency(GetSystemClockNs() -
+ pose_state.timestamp_ns);
+ }
// Update the timestamp with the expected latency.
WriteAsyncPoses(