blob: d112a1265c8a544b12968217a297d275cc130afc [file] [log] [blame]
Mathias Agopian589ce852010-07-13 22:21:56 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Mathias Agopiana7352c92010-07-14 23:41:37 -070017#define LOG_TAG "Sensors"
18
Mathias Agopian801ea092017-03-06 15:05:04 -080019#include <sensor/SensorManager.h>
20
Mathias Agopian589ce852010-07-13 22:21:56 -070021#include <stdint.h>
22#include <sys/types.h>
23
Peng Xue36e3472016-11-03 11:57:10 -070024#include <cutils/native_handle.h>
Mathias Agopian589ce852010-07-13 22:21:56 -070025#include <utils/Errors.h>
26#include <utils/RefBase.h>
27#include <utils/Singleton.h>
28
Vladimir Komsiyskif1d48af2023-10-06 10:11:44 +020029#include <android/companion/virtualnative/IVirtualDeviceManagerNative.h>
30
Mathias Agopian1a2b83a2011-10-16 22:15:23 -070031#include <binder/IBinder.h>
Jiyong Park47f876b2018-04-17 13:56:46 +090032#include <binder/IPermissionController.h>
Mathias Agopiana7352c92010-07-14 23:41:37 -070033#include <binder/IServiceManager.h>
34
Mathias Agopian801ea092017-03-06 15:05:04 -080035#include <sensor/ISensorServer.h>
36#include <sensor/ISensorEventConnection.h>
37#include <sensor/Sensor.h>
38#include <sensor/SensorEventQueue.h>
Mathias Agopian589ce852010-07-13 22:21:56 -070039
40// ----------------------------------------------------------------------------
41namespace android {
42// ----------------------------------------------------------------------------
43
Vladimir Komsiyskif1d48af2023-10-06 10:11:44 +020044namespace {
45
46using ::android::companion::virtualnative::IVirtualDeviceManagerNative;
47
48static constexpr int DEVICE_ID_DEFAULT = 0;
49
50// Returns the deviceId of the device where this uid is observed. If the uid is present on more than
51// one devices, return the default deviceId.
52int getDeviceIdForUid(uid_t uid) {
53 sp<IBinder> binder =
54 defaultServiceManager()->checkService(String16("virtualdevice_native"));
55 if (binder != nullptr) {
56 auto vdm = interface_cast<IVirtualDeviceManagerNative>(binder);
57 std::vector<int> deviceIds;
58 vdm->getDeviceIdsForUid(uid, &deviceIds);
59 // If the UID is associated with multiple virtual devices, use the default device's
60 // sensors as we cannot disambiguate here. This effectively means that the app has
61 // activities on different devices at the same time, so it must handle the device
62 // awareness by itself.
63 if (deviceIds.size() == 1) {
64 const int deviceId = deviceIds.at(0);
65 int devicePolicy = IVirtualDeviceManagerNative::DEVICE_POLICY_DEFAULT;
66 vdm->getDevicePolicy(deviceId,
67 IVirtualDeviceManagerNative::POLICY_TYPE_SENSORS,
68 &devicePolicy);
69 if (devicePolicy == IVirtualDeviceManagerNative::DEVICE_POLICY_CUSTOM) {
70 return deviceId;
71 }
72 }
73 } else {
74 ALOGW("Cannot get virtualdevice_native service");
75 }
76 return DEVICE_ID_DEFAULT;
77}
78
79} // namespace
80
Peng Xufe5476a2017-03-17 17:27:42 -070081Mutex SensorManager::sLock;
82std::map<String16, SensorManager*> SensorManager::sPackageInstances;
Aravind Akellae2806cb2015-07-29 18:03:48 -070083
84SensorManager& SensorManager::getInstanceForPackage(const String16& packageName) {
Peng Xufe5476a2017-03-17 17:27:42 -070085 waitForSensorService(nullptr);
86
Aravind Akellae2806cb2015-07-29 18:03:48 -070087 Mutex::Autolock _l(sLock);
88 SensorManager* sensorManager;
Peng Xufe5476a2017-03-17 17:27:42 -070089 auto iterator = sPackageInstances.find(packageName);
Aravind Akellae2806cb2015-07-29 18:03:48 -070090
91 if (iterator != sPackageInstances.end()) {
92 sensorManager = iterator->second;
93 } else {
94 String16 opPackageName = packageName;
Vladimir Komsiyskif1d48af2023-10-06 10:11:44 +020095 const uid_t uid = IPCThreadState::self()->getCallingUid();
Aravind Akellae2806cb2015-07-29 18:03:48 -070096
97 // It is possible that the calling code has no access to the package name.
98 // In this case we will get the packages for the calling UID and pick the
99 // first one for attributing the app op. This will work correctly for
100 // runtime permissions as for legacy apps we will toggle the app op for
101 // all packages in the UID. The caveat is that the operation may be attributed
102 // to the wrong package and stats based on app ops may be slightly off.
103 if (opPackageName.size() <= 0) {
104 sp<IBinder> binder = defaultServiceManager()->getService(String16("permission"));
Yi Kongd5e079f2018-07-17 16:08:27 -0700105 if (binder != nullptr) {
Aravind Akellae2806cb2015-07-29 18:03:48 -0700106 Vector<String16> packages;
107 interface_cast<IPermissionController>(binder)->getPackagesForUid(uid, packages);
108 if (!packages.isEmpty()) {
109 opPackageName = packages[0];
110 } else {
111 ALOGE("No packages for calling UID");
112 }
113 } else {
114 ALOGE("Cannot get permission service");
115 }
116 }
117
Vladimir Komsiyskif1d48af2023-10-06 10:11:44 +0200118 // Check if the calling UID is observed on a virtual device. If so, provide that device's
119 // sensors by default instead of the default device's sensors.
120 const int deviceId = getDeviceIdForUid(uid);
121 sensorManager = new SensorManager(opPackageName, deviceId);
Aravind Akellae2806cb2015-07-29 18:03:48 -0700122
123 // If we had no package name, we looked it up from the UID and the sensor
124 // manager instance we created should also be mapped to the empty package
125 // name, to avoid looking up the packages for a UID and get the same result.
126 if (packageName.size() <= 0) {
127 sPackageInstances.insert(std::make_pair(String16(), sensorManager));
128 }
129
130 // Stash the per package sensor manager.
131 sPackageInstances.insert(std::make_pair(opPackageName, sensorManager));
132 }
133
134 return *sensorManager;
135}
136
Anthony Stange9352ab12023-02-21 17:57:38 +0000137void SensorManager::removeInstanceForPackage(const String16& packageName) {
138 Mutex::Autolock _l(sLock);
139 auto iterator = sPackageInstances.find(packageName);
140 if (iterator != sPackageInstances.end()) {
141 SensorManager* sensorManager = iterator->second;
142 delete sensorManager;
143 sPackageInstances.erase(iterator);
144 }
145}
146
Vladimir Komsiyskif1d48af2023-10-06 10:11:44 +0200147SensorManager::SensorManager(const String16& opPackageName, int deviceId)
148 : mSensorList(nullptr), mOpPackageName(opPackageName), mDeviceId(deviceId),
149 mDirectConnectionHandle(1) {
Brian Duddie8bbd6f42019-06-06 16:43:41 -0700150 Mutex::Autolock _l(mLock);
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700151 assertStateLocked();
Mathias Agopian589ce852010-07-13 22:21:56 -0700152}
153
Peng Xu2576cb62016-01-20 00:22:09 -0800154SensorManager::~SensorManager() {
Mathias Agopiana7352c92010-07-14 23:41:37 -0700155 free(mSensorList);
Erik Staatsd35a5742022-02-04 06:37:58 -0800156 free(mDynamicSensorList);
Mathias Agopian589ce852010-07-13 22:21:56 -0700157}
158
Peng Xufe5476a2017-03-17 17:27:42 -0700159status_t SensorManager::waitForSensorService(sp<ISensorServer> *server) {
160 // try for 300 seconds (60*5(getService() tries for 5 seconds)) before giving up ...
161 sp<ISensorServer> s;
162 const String16 name("sensorservice");
163 for (int i = 0; i < 60; i++) {
164 status_t err = getService(name, &s);
165 switch (err) {
166 case NAME_NOT_FOUND:
167 sleep(1);
168 continue;
169 case NO_ERROR:
170 if (server != nullptr) {
171 *server = s;
172 }
173 return NO_ERROR;
174 default:
175 return err;
176 }
177 }
178 return TIMED_OUT;
179}
180
Peng Xu2576cb62016-01-20 00:22:09 -0800181void SensorManager::sensorManagerDied() {
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700182 Mutex::Autolock _l(mLock);
183 mSensorServer.clear();
184 free(mSensorList);
Yi Kongd5e079f2018-07-17 16:08:27 -0700185 mSensorList = nullptr;
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700186 mSensors.clear();
Erik Staatsd35a5742022-02-04 06:37:58 -0800187 free(mDynamicSensorList);
188 mDynamicSensorList = nullptr;
189 mDynamicSensors.clear();
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700190}
191
Peng Xu2576cb62016-01-20 00:22:09 -0800192status_t SensorManager::assertStateLocked() {
Aravind Akella8f35ca92015-08-17 15:22:12 -0700193 bool initSensorManager = false;
Yi Kongd5e079f2018-07-17 16:08:27 -0700194 if (mSensorServer == nullptr) {
Aravind Akella8f35ca92015-08-17 15:22:12 -0700195 initSensorManager = true;
196 } else {
197 // Ping binder to check if sensorservice is alive.
198 status_t err = IInterface::asBinder(mSensorServer)->pingBinder();
199 if (err != NO_ERROR) {
200 initSensorManager = true;
201 }
202 }
203 if (initSensorManager) {
Peng Xufe5476a2017-03-17 17:27:42 -0700204 waitForSensorService(&mSensorServer);
205 LOG_ALWAYS_FATAL_IF(mSensorServer == nullptr, "getService(SensorService) NULL");
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700206
207 class DeathObserver : public IBinder::DeathRecipient {
Peng Xu2576cb62016-01-20 00:22:09 -0800208 SensorManager& mSensorManager;
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700209 virtual void binderDied(const wp<IBinder>& who) {
Yi Kong82d7c632019-09-20 12:10:47 -0700210 ALOGW("sensorservice died [%p]", static_cast<void*>(who.unsafe_get()));
Peng Xu2576cb62016-01-20 00:22:09 -0800211 mSensorManager.sensorManagerDied();
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700212 }
213 public:
Chih-Hung Hsieh68a593e2016-04-28 09:14:32 -0700214 explicit DeathObserver(SensorManager& mgr) : mSensorManager(mgr) { }
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700215 };
216
217 mDeathObserver = new DeathObserver(*const_cast<SensorManager *>(this));
Marco Nelissen2ea926b2014-11-14 08:01:01 -0800218 IInterface::asBinder(mSensorServer)->linkToDeath(mDeathObserver);
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700219
Vladimir Komsiyskif1d48af2023-10-06 10:11:44 +0200220 if (mDeviceId == DEVICE_ID_DEFAULT) {
221 mSensors = mSensorServer->getSensorList(mOpPackageName);
222 } else {
223 mSensors = mSensorServer->getRuntimeSensorList(mOpPackageName, mDeviceId);
224 }
225
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700226 size_t count = mSensors.size();
Devin Moore49600b12023-04-25 00:17:13 +0000227 // If count is 0, mSensorList will be non-null. This is old
228 // existing behavior and callers expect this.
Dan Stozad723bd72014-11-18 10:24:03 -0800229 mSensorList =
230 static_cast<Sensor const**>(malloc(count * sizeof(Sensor*)));
Yi Kongd5e079f2018-07-17 16:08:27 -0700231 LOG_ALWAYS_FATAL_IF(mSensorList == nullptr, "mSensorList NULL");
Aravind Akella8f35ca92015-08-17 15:22:12 -0700232
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700233 for (size_t i=0 ; i<count ; i++) {
234 mSensorList[i] = mSensors.array() + i;
235 }
236 }
237
238 return NO_ERROR;
239}
240
Peng Xu2576cb62016-01-20 00:22:09 -0800241ssize_t SensorManager::getSensorList(Sensor const* const** list) {
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700242 Mutex::Autolock _l(mLock);
243 status_t err = assertStateLocked();
244 if (err < 0) {
Dan Stozad723bd72014-11-18 10:24:03 -0800245 return static_cast<ssize_t>(err);
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700246 }
Mathias Agopian589ce852010-07-13 22:21:56 -0700247 *list = mSensorList;
Dan Stozad723bd72014-11-18 10:24:03 -0800248 return static_cast<ssize_t>(mSensors.size());
Mathias Agopian589ce852010-07-13 22:21:56 -0700249}
250
Peng Xu2576cb62016-01-20 00:22:09 -0800251ssize_t SensorManager::getDynamicSensorList(Vector<Sensor> & dynamicSensors) {
252 Mutex::Autolock _l(mLock);
253 status_t err = assertStateLocked();
254 if (err < 0) {
255 return static_cast<ssize_t>(err);
256 }
257
258 dynamicSensors = mSensorServer->getDynamicSensorList(mOpPackageName);
259 size_t count = dynamicSensors.size();
260
261 return static_cast<ssize_t>(count);
262}
263
Vladimir Komsiyskif76bba52022-10-23 10:56:06 +0200264ssize_t SensorManager::getRuntimeSensorList(int deviceId, Vector<Sensor>& runtimeSensors) {
265 Mutex::Autolock _l(mLock);
266 status_t err = assertStateLocked();
267 if (err < 0) {
268 return static_cast<ssize_t>(err);
269 }
270
271 runtimeSensors = mSensorServer->getRuntimeSensorList(mOpPackageName, deviceId);
272 size_t count = runtimeSensors.size();
273
274 return static_cast<ssize_t>(count);
275}
276
Erik Staatsd35a5742022-02-04 06:37:58 -0800277ssize_t SensorManager::getDynamicSensorList(Sensor const* const** list) {
278 Mutex::Autolock _l(mLock);
279 status_t err = assertStateLocked();
280 if (err < 0) {
281 return static_cast<ssize_t>(err);
282 }
283
284 free(mDynamicSensorList);
285 mDynamicSensorList = nullptr;
286 mDynamicSensors = mSensorServer->getDynamicSensorList(mOpPackageName);
287 size_t dynamicCount = mDynamicSensors.size();
288 if (dynamicCount > 0) {
289 mDynamicSensorList = static_cast<Sensor const**>(
290 malloc(dynamicCount * sizeof(Sensor*)));
291 if (mDynamicSensorList == nullptr) {
292 ALOGE("Failed to allocate dynamic sensor list for %zu sensors.",
293 dynamicCount);
294 return static_cast<ssize_t>(NO_MEMORY);
295 }
296
297 for (size_t i = 0; i < dynamicCount; i++) {
298 mDynamicSensorList[i] = mDynamicSensors.array() + i;
299 }
300 }
301
302 *list = mDynamicSensorList;
303 return static_cast<ssize_t>(mDynamicSensors.size());
304}
305
Mathias Agopiana7352c92010-07-14 23:41:37 -0700306Sensor const* SensorManager::getDefaultSensor(int type)
Mathias Agopian589ce852010-07-13 22:21:56 -0700307{
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700308 Mutex::Autolock _l(mLock);
309 if (assertStateLocked() == NO_ERROR) {
Aravind Akellab37ba392014-08-05 14:53:07 -0700310 bool wakeUpSensor = false;
311 // For the following sensor types, return a wake-up sensor. These types are by default
312 // defined as wake-up sensors. For the rest of the sensor types defined in sensors.h return
313 // a non_wake-up version.
314 if (type == SENSOR_TYPE_PROXIMITY || type == SENSOR_TYPE_SIGNIFICANT_MOTION ||
315 type == SENSOR_TYPE_TILT_DETECTOR || type == SENSOR_TYPE_WAKE_GESTURE ||
Nick Vaccaro5e7f79b2016-10-17 15:40:51 -0700316 type == SENSOR_TYPE_GLANCE_GESTURE || type == SENSOR_TYPE_PICK_UP_GESTURE ||
Nick Vaccaro2e990eb2017-01-12 21:13:58 -0800317 type == SENSOR_TYPE_WRIST_TILT_GESTURE ||
Anthony Stangefdb1fc82020-01-16 15:02:48 -0500318 type == SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT || type == SENSOR_TYPE_HINGE_ANGLE) {
Aravind Akellab37ba392014-08-05 14:53:07 -0700319 wakeUpSensor = true;
320 }
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700321 // For now we just return the first sensor of that type we find.
322 // in the future it will make sense to let the SensorService make
323 // that decision.
324 for (size_t i=0 ; i<mSensors.size() ; i++) {
Aravind Akellab37ba392014-08-05 14:53:07 -0700325 if (mSensorList[i]->getType() == type &&
326 mSensorList[i]->isWakeUpSensor() == wakeUpSensor) {
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700327 return mSensorList[i];
Aravind Akellab37ba392014-08-05 14:53:07 -0700328 }
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700329 }
Mathias Agopiana7352c92010-07-14 23:41:37 -0700330 }
Yi Kongd5e079f2018-07-17 16:08:27 -0700331 return nullptr;
Mathias Agopian589ce852010-07-13 22:21:56 -0700332}
333
Arthur Ishiguro340882c2021-02-18 15:17:44 -0800334sp<SensorEventQueue> SensorManager::createEventQueue(
335 String8 packageName, int mode, String16 attributionTag) {
Mathias Agopianbe58de02011-10-16 00:38:30 -0700336 sp<SensorEventQueue> queue;
337
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700338 Mutex::Autolock _l(mLock);
339 while (assertStateLocked() == NO_ERROR) {
Arthur Ishiguro340882c2021-02-18 15:17:44 -0800340 sp<ISensorEventConnection> connection = mSensorServer->createSensorEventConnection(
341 packageName, mode, mOpPackageName, attributionTag);
Yi Kongd5e079f2018-07-17 16:08:27 -0700342 if (connection == nullptr) {
Aravind Akellaa9e6cc32015-04-16 18:57:31 -0700343 // SensorService just died or the app doesn't have required permissions.
344 ALOGE("createEventQueue: connection is NULL.");
Yi Kongd5e079f2018-07-17 16:08:27 -0700345 return nullptr;
Mathias Agopian1a2b83a2011-10-16 22:15:23 -0700346 }
347 queue = new SensorEventQueue(connection);
348 break;
Mathias Agopianbe58de02011-10-16 00:38:30 -0700349 }
Mathias Agopianbe58de02011-10-16 00:38:30 -0700350 return queue;
Mathias Agopian589ce852010-07-13 22:21:56 -0700351}
352
Aravind Akella841a5922015-06-29 12:37:48 -0700353bool SensorManager::isDataInjectionEnabled() {
Aravind Akellaa9e6cc32015-04-16 18:57:31 -0700354 Mutex::Autolock _l(mLock);
355 if (assertStateLocked() == NO_ERROR) {
Aravind Akella841a5922015-06-29 12:37:48 -0700356 return mSensorServer->isDataInjectionEnabled();
Aravind Akellaa9e6cc32015-04-16 18:57:31 -0700357 }
Aravind Akella841a5922015-06-29 12:37:48 -0700358 return false;
Aravind Akellaa9e6cc32015-04-16 18:57:31 -0700359}
360
Mark Wheatley8f285d92023-07-07 20:07:18 +0000361bool SensorManager::isReplayDataInjectionEnabled() {
362 Mutex::Autolock _l(mLock);
363 if (assertStateLocked() == NO_ERROR) {
364 return mSensorServer->isReplayDataInjectionEnabled();
365 }
366 return false;
367}
368
369bool SensorManager::isHalBypassReplayDataInjectionEnabled() {
370 Mutex::Autolock _l(mLock);
371 if (assertStateLocked() == NO_ERROR) {
372 return mSensorServer->isHalBypassReplayDataInjectionEnabled();
373 }
374 return false;
375}
376
Peng Xue36e3472016-11-03 11:57:10 -0700377int SensorManager::createDirectChannel(
378 size_t size, int channelType, const native_handle_t *resourceHandle) {
Vladimir Komsiyski4871f092023-01-19 18:25:43 +0100379 static constexpr int DEFAULT_DEVICE_ID = 0;
380 return createDirectChannel(DEFAULT_DEVICE_ID, size, channelType, resourceHandle);
381}
382
383int SensorManager::createDirectChannel(
384 int deviceId, size_t size, int channelType, const native_handle_t *resourceHandle) {
Peng Xue36e3472016-11-03 11:57:10 -0700385 Mutex::Autolock _l(mLock);
386 if (assertStateLocked() != NO_ERROR) {
387 return NO_INIT;
388 }
389
Peng Xud9c8a862017-03-05 01:48:11 -0800390 if (channelType != SENSOR_DIRECT_MEM_TYPE_ASHMEM
391 && channelType != SENSOR_DIRECT_MEM_TYPE_GRALLOC) {
392 ALOGE("Bad channel shared memory type %d", channelType);
393 return BAD_VALUE;
Peng Xue36e3472016-11-03 11:57:10 -0700394 }
Peng Xud9c8a862017-03-05 01:48:11 -0800395
396 sp<ISensorEventConnection> conn =
Vladimir Komsiyski4871f092023-01-19 18:25:43 +0100397 mSensorServer->createSensorDirectConnection(mOpPackageName, deviceId,
Peng Xud9c8a862017-03-05 01:48:11 -0800398 static_cast<uint32_t>(size),
399 static_cast<int32_t>(channelType),
400 SENSOR_DIRECT_FMT_SENSORS_EVENT, resourceHandle);
401 if (conn == nullptr) {
402 return NO_MEMORY;
403 }
404
405 int nativeHandle = mDirectConnectionHandle++;
406 mDirectConnection.emplace(nativeHandle, conn);
407 return nativeHandle;
Peng Xue36e3472016-11-03 11:57:10 -0700408}
409
410void SensorManager::destroyDirectChannel(int channelNativeHandle) {
411 Mutex::Autolock _l(mLock);
412 if (assertStateLocked() == NO_ERROR) {
413 mDirectConnection.erase(channelNativeHandle);
414 }
415}
416
417int SensorManager::configureDirectChannel(int channelNativeHandle, int sensorHandle, int rateLevel) {
418 Mutex::Autolock _l(mLock);
419 if (assertStateLocked() != NO_ERROR) {
420 return NO_INIT;
421 }
422
423 auto i = mDirectConnection.find(channelNativeHandle);
424 if (i == mDirectConnection.end()) {
425 ALOGE("Cannot find the handle in client direct connection table");
426 return BAD_VALUE;
427 }
428
429 int ret;
430 ret = i->second->configureChannel(sensorHandle, rateLevel);
431 ALOGE_IF(ret < 0, "SensorManager::configureChannel (%d, %d) returns %d",
432 static_cast<int>(sensorHandle), static_cast<int>(rateLevel),
433 static_cast<int>(ret));
434 return ret;
435}
436
Peng Xudd5c5cb2017-03-16 17:39:43 -0700437int SensorManager::setOperationParameter(
Alexey Polyudov88711e82017-05-23 19:54:04 -0700438 int handle, int type,
439 const Vector<float> &floats, const Vector<int32_t> &ints) {
Peng Xudd5c5cb2017-03-16 17:39:43 -0700440 Mutex::Autolock _l(mLock);
441 if (assertStateLocked() != NO_ERROR) {
442 return NO_INIT;
443 }
Alexey Polyudov88711e82017-05-23 19:54:04 -0700444 return mSensorServer->setOperationParameter(handle, type, floats, ints);
Peng Xudd5c5cb2017-03-16 17:39:43 -0700445}
446
Mathias Agopian589ce852010-07-13 22:21:56 -0700447// ----------------------------------------------------------------------------
448}; // namespace android