Sensor: expose sensor UUID to privileged clients

Allow privileged clients (system server and audio server)
to access the UUID of dynamic sensors.
For other clients, the UUID is replaced by the existing
obfuscated sensor ID.

Bug: 210803914
Test: make
Change-Id: I496ac59504da4e8d98310663c047cb3c0a2abad6
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 9bc7b8e..517d383 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -1254,6 +1254,11 @@
     for (auto &sensor : sensorList) {
         int32_t id = getIdFromUuid(sensor.getUuid());
         sensor.setId(id);
+        // The sensor UUID must always be anonymized here for non privileged clients.
+        // There is no other checks after this point before returning to client process.
+        if (!isAudioServerOrSystemServerUid(IPCThreadState::self()->getCallingUid())) {
+            sensor.anonymizeUuid();
+        }
     }
 }