Merge "Floor height API changes." into oc-dr1-dev am: 2717eaba05
am: 65b2b5dcfb
Change-Id: Ic99fee0ca1cd279aaff882eb1e414dc27a758987
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 745361c..3c583b0 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -1161,8 +1161,6 @@
RunCommand("ARP CACHE", {"ip", "-4", "neigh", "show"});
RunCommand("IPv6 ND CACHE", {"ip", "-6", "neigh", "show"});
RunCommand("MULTICAST ADDRESSES", {"ip", "maddr"});
- RunCommand("WIFI NETWORKS", {"wpa_cli", "IFNAME=wlan0", "list_networks"},
- CommandOptions::WithTimeout(20).Build());
RunDumpsys("NETWORK DIAGNOSTICS", {"connectivity", "--diag"},
CommandOptions::WithTimeout(10).Build());
diff --git a/libs/vr/libdisplay/include/private/dvr/shared_buffer_helpers.h b/libs/vr/libdisplay/include/private/dvr/shared_buffer_helpers.h
index ed06515..20541a6 100644
--- a/libs/vr/libdisplay/include/private/dvr/shared_buffer_helpers.h
+++ b/libs/vr/libdisplay/include/private/dvr/shared_buffer_helpers.h
@@ -103,9 +103,14 @@
// Try obtaining the ring. If the named buffer has not been created yet, it
// will return nullptr.
RingType* Ring() {
- if (IsMapped() == false) {
- TryMapping();
+ // No ring created yet?
+ if (ring_ == nullptr) {
+ // Not mapped the memory yet?
+ if (IsMapped() == false) {
+ TryMapping();
+ }
+ // If have the memory mapped, allocate the ring.
if (IsMapped()) {
switch (usage_mode_) {
case CPUUsageMode::READ_OFTEN:
diff --git a/libs/vr/libvrsensor/pose_client.cpp b/libs/vr/libvrsensor/pose_client.cpp
index b21c7cf..4ddf1f3 100644
--- a/libs/vr/libvrsensor/pose_client.cpp
+++ b/libs/vr/libvrsensor/pose_client.cpp
@@ -22,6 +22,11 @@
namespace android {
namespace dvr {
+namespace {
+
+typedef CPUMappedBroadcastRing<DvrPoseRing> SensorPoseRing;
+
+} // namespace
// PoseClient is a remote interface to the pose service in sensord.
class PoseClient : public pdx::ClientBase<PoseClient> {
@@ -36,16 +41,21 @@
// Polls the pose service for the current state and stores it in *state.
// Returns zero on success, a negative error code otherwise.
int Poll(DvrPose* state) {
- const auto vsync_buffer = GetVsyncBuffer();
- if (vsync_buffer) {
- if (state) {
- // Fill the state
- *state = vsync_buffer->current_pose;
- }
- return -EINVAL;
+ // Allocate the helper class to access the sensor pose buffer.
+ if (sensor_pose_buffer_ == nullptr) {
+ sensor_pose_buffer_ = std::make_unique<SensorPoseRing>(
+ DvrGlobalBuffers::kSensorPoseBuffer, CPUUsageMode::READ_RARELY);
}
- return -EAGAIN;
+ if (state) {
+ if (sensor_pose_buffer_->GetNewest(state)) {
+ return 0;
+ } else {
+ return -EAGAIN;
+ }
+ }
+
+ return -EINVAL;
}
int GetPose(uint32_t vsync_count, DvrPoseAsync* out_pose) {
@@ -235,6 +245,9 @@
// The vsync pose buffer if already mapped.
std::unique_ptr<CPUMappedBuffer> vsync_pose_buffer_;
+ // The direct sensor pose buffer.
+ std::unique_ptr<SensorPoseRing> sensor_pose_buffer_;
+
const DvrVsyncPoseBuffer* mapped_vsync_pose_buffer_ = nullptr;
struct ControllerClientState {
diff --git a/services/surfaceflinger/MessageQueue.h b/services/surfaceflinger/MessageQueue.h
index 85a33c8..14f50bb 100644
--- a/services/surfaceflinger/MessageQueue.h
+++ b/services/surfaceflinger/MessageQueue.h
@@ -30,6 +30,8 @@
#include "Barrier.h"
+#include <functional>
+
namespace android {
class IDisplayEventConnection;
@@ -58,6 +60,21 @@
mutable Barrier barrier;
};
+class LambdaMessage : public MessageBase {
+public:
+ explicit LambdaMessage(std::function<void()> handler)
+ : MessageBase(), mHandler(std::move(handler)) {}
+
+ bool handler() override {
+ mHandler();
+ // This return value is no longer checked, so it's always safe to return true
+ return true;
+ }
+
+private:
+ const std::function<void()> mHandler;
+};
+
// ---------------------------------------------------------------------------
class MessageQueue {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 627bf77..a6b34c2 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1323,11 +1323,21 @@
// parts of this class rely on the primary display always being available.
createDefaultDisplayDevice();
- // Reset the timing values to account for the period of the swapped in HWC
- const auto& activeConfig = mHwc->getActiveConfig(HWC_DISPLAY_PRIMARY);
- const nsecs_t period = activeConfig->getVsyncPeriod();
- mAnimFrameTracker.setDisplayRefreshPeriod(period);
- setCompositorTimingSnapped(0, period, 0);
+ // Re-enable default display.
+ sp<LambdaMessage> requestMessage = new LambdaMessage([&]() {
+ sp<DisplayDevice> hw(getDisplayDevice(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]));
+ setPowerModeInternal(hw, HWC_POWER_MODE_NORMAL);
+
+ // Reset the timing values to account for the period of the swapped in HWC
+ const auto& activeConfig = mHwc->getActiveConfig(HWC_DISPLAY_PRIMARY);
+ const nsecs_t period = activeConfig->getVsyncPeriod();
+ mAnimFrameTracker.setDisplayRefreshPeriod(period);
+
+ // Use phase of 0 since phase is not known.
+ // Use latency of 0, which will snap to the ideal latency.
+ setCompositorTimingSnapped(0, period, 0);
+ });
+ postMessageAsync(requestMessage);
android_atomic_or(1, &mRepaintEverything);
setTransactionFlags(eDisplayTransactionNeeded);