Merge "VR: fix libvr_hwc-hal build" into oc-dev
diff --git a/cmds/atrace/Android.bp b/cmds/atrace/Android.bp
index 6c5869a..4f1065f 100644
--- a/cmds/atrace/Android.bp
+++ b/cmds/atrace/Android.bp
@@ -16,6 +16,9 @@
"libz",
"libbase",
],
+ static_libs: [
+ "libpdx_default_transport",
+ ],
init_rc: ["atrace.rc"],
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 6cfbed9..f8e0ad5 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -41,6 +41,7 @@
#include <hidl/ServiceManagement.h>
#include <cutils/properties.h>
+#include <pdx/default_transport/service_utility.h>
#include <utils/String8.h>
#include <utils/Timers.h>
#include <utils/Tokenizer.h>
@@ -48,6 +49,7 @@
#include <android-base/file.h>
using namespace android;
+using pdx::default_transport::ServiceUtility;
using std::string;
#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
@@ -814,6 +816,7 @@
ok &= setAppCmdlineProperty(&packageList[0]);
ok &= pokeBinderServices();
pokeHalServices();
+ ok &= ServiceUtility::PokeServices();
// Disable all the sysfs enables. This is done as a separate loop from
// the enables to allow the same enable to exist in multiple categories.
@@ -851,6 +854,7 @@
setTagsProperty(0);
clearAppProperties();
pokeBinderServices();
+ ServiceUtility::PokeServices();
// Set the options back to their defaults.
setTraceOverwriteEnable(true);
diff --git a/libs/vr/libpdx_default_transport/private/pdx/default_transport/service_utility.h b/libs/vr/libpdx_default_transport/private/pdx/default_transport/service_utility.h
index 22c6b3f..81bb17b 100644
--- a/libs/vr/libpdx_default_transport/private/pdx/default_transport/service_utility.h
+++ b/libs/vr/libpdx_default_transport/private/pdx/default_transport/service_utility.h
@@ -1,6 +1,8 @@
#ifndef ANDROID_PDX_DEFAULT_TRANSPORT_SERVICE_UTILITY_H_
#define ANDROID_PDX_DEFAULT_TRANSPORT_SERVICE_UTILITY_H_
+#include <ftw.h>
+
#include <pdx/client.h>
#include <pdx/default_transport/client_channel_factory.h>
#include <pdx/service.h>
@@ -25,15 +27,59 @@
return ClientChannelFactory::GetEndpointPath(endpoint_path);
}
+ // Traverses the PDX service path space and sends a message to reload system
+ // properties to each service endpoint it finds along the way.
+ // NOTE: This method is used by atrace to poke PDX services. Please avoid
+ // unnecessary changes to this mechanism to minimize impact on atrace.
+ static bool PokeServices() {
+ const int kMaxDepth = 16;
+ const int result =
+ nftw(GetRootEndpointPath().c_str(), PokeService, kMaxDepth, FTW_PHYS);
+ return result == 0 ? true : false;
+ }
+
private:
friend BASE;
ServiceUtility(const std::string& endpoint_path, int* error = nullptr)
- : BASE(ClientChannelFactory::Create(endpoint_path)) {
+ : BASE(ClientChannelFactory::Create(endpoint_path), 0) {
if (error)
*error = Client::error();
}
+ // Sends the sysprop_change message to the service at fpath, so it re-reads
+ // its system properties. Returns 0 on success or a negated errno code on
+ // failure.
+ // NOTE: This method is used by atrace to poke PDX services. Please avoid
+ // unnecessary changes to this mechanism to minimize impact on atrace.
+ static int PokeService(const char* fpath, const struct stat* /*sb*/,
+ int typeflag, struct FTW* /*ftwbuf*/) {
+ const bool kIgnoreErrors = true;
+
+ if (typeflag == FTW_F) {
+ int error;
+ auto utility = ServiceUtility::Create(fpath, &error);
+ if (!utility) {
+ if (error != -ECONNREFUSED) {
+ ALOGE("ServiceUtility::PokeService: Failed to open %s: %s.", fpath,
+ strerror(-error));
+ }
+ return kIgnoreErrors ? 0 : error;
+ }
+
+ auto status = utility->ReloadSystemProperties();
+ if (!status) {
+ ALOGE(
+ "ServiceUtility::PokeService: Failed to send sysprop change to %s: "
+ "%s",
+ fpath, status.GetErrorMessage().c_str());
+ return kIgnoreErrors ? 0 : -status.error();
+ }
+ }
+
+ return 0;
+ }
+
ServiceUtility(const ServiceUtility&) = delete;
void operator=(const ServiceUtility&) = delete;
};
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/Layer.cpp b/services/surfaceflinger/Layer.cpp
index d044f37..0e7c214 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -287,6 +287,14 @@
// the layer has been remove from the current state list (and just before
// it's removed from the drawing state list)
void Layer::onRemoved() {
+ if (mCurrentState.zOrderRelativeOf != nullptr) {
+ sp<Layer> strongRelative = mCurrentState.zOrderRelativeOf.promote();
+ if (strongRelative != nullptr) {
+ strongRelative->removeZOrderRelative(this);
+ }
+ mCurrentState.zOrderRelativeOf = nullptr;
+ }
+
mSurfaceFlingerConsumer->abandon();
for (const auto& child : mCurrentChildren) {
child->onRemoved();
@@ -2555,11 +2563,6 @@
sp<Layer> strongRelative = weakRelative.promote();
if (strongRelative != nullptr) {
traverse.add(strongRelative);
- } else {
- // We need to erase from current state instead of drawing
- // state so we don't overwrite when copying
- // the current state to the drawing state.
- mCurrentState.zOrderRelatives.remove(weakRelative);
}
}
diff --git a/services/surfaceflinger/surfaceflinger.rc b/services/surfaceflinger/surfaceflinger.rc
index 41b6225..1c0427d 100644
--- a/services/surfaceflinger/surfaceflinger.rc
+++ b/services/surfaceflinger/surfaceflinger.rc
@@ -5,6 +5,6 @@
onrestart restart zygote
writepid /dev/stune/foreground/tasks
socket pdx/system/vr/display/client stream 0666 system graphics
- socket pdx/system/vr/display/manager stream 0660 system graphics
+ socket pdx/system/vr/display/manager stream 0666 system graphics
socket pdx/system/vr/display/screenshot stream 0660 system graphics
socket pdx/system/vr/display/vsync stream 0666 system graphics