Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d7bc8b7 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4464948 from 3d04ada8 to pi-release

Change-Id: I8671a983ff4edffb0488702ea268d8d1eb27d52b
parents 86a6b664 3d04ada8
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ public:
            aerr << "Open attempt after active for: " << fullPath << endl;
            return -EPERM;
        }
#if DEBUG
        ALOGD("openFile: %s, full=%s", path8.string(), fullPath.string());
#endif
        int flags = 0;
        bool checkRead = false;
        bool checkWrite = false;
@@ -92,6 +95,9 @@ public:
            return -EINVAL;
        }
        int fd = open(fullPath.string(), flags, S_IRWXU|S_IRWXG);
#if DEBUG
        ALOGD("openFile: fd=%d", fd);
#endif
        if (fd < 0) {
            return fd;
        }
@@ -104,6 +110,9 @@ public:
                int accessGranted = selinux_check_access(seLinuxContext8.string(), context.get(),
                        "file", "write", NULL);
                if (accessGranted != 0) {
#if DEBUG
                    ALOGD("openFile: failed selinux write check!");
#endif
                    close(fd);
                    aerr << "System server has no access to write file context " << context.get()
                            << " (from path " << fullPath.string() << ", context "
@@ -115,6 +124,9 @@ public:
                int accessGranted = selinux_check_access(seLinuxContext8.string(), context.get(),
                        "file", "read", NULL);
                if (accessGranted != 0) {
#if DEBUG
                    ALOGD("openFile: failed selinux read check!");
#endif
                    close(fd);
                    aerr << "System server has no access to read file context " << context.get()
                            << " (from path " << fullPath.string() << ", context "
@@ -164,6 +176,9 @@ int main(int argc, char* const argv[])
    proc->setThreadPoolMaxThreadCount(0);
    proc->startThreadPool();

#if DEBUG
    ALOGD("cmd: starting");
#endif
    sp<IServiceManager> sm = defaultServiceManager();
    fflush(stdout);
    if (sm == NULL) {
+20 −3
Original line number Diff line number Diff line
@@ -254,19 +254,36 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_EndToEnd) {
    ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent());
}

TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenSequenceNumberIsZero_ReturnsError) {
    status_t status;
    const size_t pointerCount = 1;
    PointerProperties pointerProperties[pointerCount];
    PointerCoords pointerCoords[pointerCount];
    for (size_t i = 0; i < pointerCount; i++) {
        pointerProperties[i].clear();
        pointerCoords[i].clear();
    }

    status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            pointerCount, pointerProperties, pointerCoords);
    ASSERT_EQ(BAD_VALUE, status)
            << "publisher publishMotionEvent should return BAD_VALUE";
}

TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessThan1_ReturnsError) {
    status_t status;
    const size_t pointerCount = 0;
    PointerProperties pointerProperties[pointerCount];
    PointerCoords pointerCoords[pointerCount];

    status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    status = mPublisher->publishMotionEvent(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            pointerCount, pointerProperties, pointerCoords);
    ASSERT_EQ(BAD_VALUE, status)
            << "publisher publishMotionEvent should return BAD_VALUE";
}

TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountGreaterThanMax_ReturnsError) {
TEST_F(InputPublisherAndConsumerTest,
        PublishMotionEvent_WhenPointerCountGreaterThanMax_ReturnsError) {
    status_t status;
    const size_t pointerCount = MAX_POINTERS + 1;
    PointerProperties pointerProperties[pointerCount];
@@ -276,7 +293,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountGreater
        pointerCoords[i].clear();
    }

    status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    status = mPublisher->publishMotionEvent(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            pointerCount, pointerProperties, pointerCoords);
    ASSERT_EQ(BAD_VALUE, status)
            << "publisher publishMotionEvent should return BAD_VALUE";
+0 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@

sourceFiles = [
    "pose_client.cpp",
    "sensor_client.cpp",
    "latency_model.cpp",
]

+0 −17
Original line number Diff line number Diff line
#ifndef ANDROID_DVR_SENSOR_IPC_H_
#define ANDROID_DVR_SENSOR_IPC_H_

#define DVR_SENSOR_SERVICE_BASE "system/vr/sensors"

#define DVR_SENSOR_SERVICE_CLIENT (DVR_SENSOR_SERVICE_BASE "/client")

/*
 * Endpoint ops
 */
enum {
  DVR_SENSOR_START = 0,
  DVR_SENSOR_STOP,
  DVR_SENSOR_POLL,
};

#endif  // ANDROID_DVR_SENSOR_IPC_H_
+0 −37
Original line number Diff line number Diff line
#ifndef ANDROID_DVR_SENSOR_CLIENT_H_
#define ANDROID_DVR_SENSOR_CLIENT_H_

#include <hardware/sensors.h>
#include <pdx/client.h>
#include <poll.h>

namespace android {
namespace dvr {

// SensorClient is a remote interface to the sensor service in sensord.
class SensorClient : public pdx::ClientBase<SensorClient> {
 public:
  ~SensorClient();

  int StartSensor();
  int StopSensor();
  int Poll(sensors_event_t* events, int max_count);

 private:
  friend BASE;

  // Set up a channel associated with the sensor of the indicated type.
  // NOTE(segal): If our hardware ends up with multiple sensors of the same
  // type, we'll have to change this.
  explicit SensorClient(int sensor_type);

  int sensor_type_;

  SensorClient(const SensorClient&);
  SensorClient& operator=(const SensorClient&);
};

}  // namespace dvr
}  // namespace android

#endif  // ANDROID_DVR_SENSOR_CLIENT_H_
Loading