DO NOT MERGE ANYWHERE Add new interface for sensor physical data
This is special solution only for emerald branch.
Changes including new const char* value/interface for sensor physical data. Sensor service and manager does not take care of content, structure or other
details of string. Sensor HAL is taking care of parsing data from string and setting values to Sensor HW.
Change-Id: I3abc3ddc7c6adc4b32a40b9a43f2a94c5af7b2b0
Signed-off-by: Ben Fennema <fennema@google.com>
diff --git a/libs/gui/ISensorServer.cpp b/libs/gui/ISensorServer.cpp
index f581b5c..8cd1725 100644
--- a/libs/gui/ISensorServer.cpp
+++ b/libs/gui/ISensorServer.cpp
@@ -35,7 +35,8 @@
 enum {
     GET_SENSOR_LIST = IBinder::FIRST_CALL_TRANSACTION,
     CREATE_SENSOR_EVENT_CONNECTION,
-    ENABLE_DATA_INJECTION
+    ENABLE_DATA_INJECTION,
+    SET_SENSOR_PHYSICAL_DATA,
 };
 
 class BpSensorServer : public BpInterface<ISensorServer>
@@ -83,6 +84,16 @@
         remote()->transact(ENABLE_DATA_INJECTION, data, &reply);
         return reply.readInt32();
     }
+
+    virtual status_t setSensorPhysicalData(const char* physicaldata)
+    {
+        Parcel data, reply;
+        //ALOGD("ISensorManager::SetSensorPhysicalData(%s)",physicaldata);
+        data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor());
+        data.writeCString(physicaldata);
+        remote()->transact(SET_SENSOR_PHYSICAL_DATA, data, &reply);
+        return reply.readInt32();
+     }
 };
 
 // Out-of-line virtual method definition to trigger vtable emission in this
@@ -124,6 +135,14 @@
             reply->writeInt32(static_cast<int32_t>(ret));
             return NO_ERROR;
         }
+        case SET_SENSOR_PHYSICAL_DATA: {
+            CHECK_INTERFACE(ISensorServer, data, reply);
+            const char* physicaldata = data.readCString();
+            //ALOGD("ISensorManager, BnSensorServer::onTransact, physicaldata is: (%s)",physicaldata);
+            status_t result = setSensorPhysicalData(physicaldata);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        }
     }
     return BBinder::onTransact(code, data, reply, flags);
 }