Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 17 | #include "SensorDirectConnection.h" |
Mike Ma | 2474386 | 2020-01-29 00:36:55 -0800 | [diff] [blame] | 18 | #include <android/util/ProtoOutputStream.h> |
| 19 | #include <frameworks/base/core/proto/android/service/sensor_service.proto.h> |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 20 | #include <hardware/sensors.h> |
Brian Duddie | 0a4cebb | 2022-08-25 19:20:18 +0000 | [diff] [blame] | 21 | #include "SensorDevice.h" |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 22 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 23 | #define UNUSED(x) (void)(x) |
| 24 | |
| 25 | namespace android { |
| 26 | |
Mike Ma | 2474386 | 2020-01-29 00:36:55 -0800 | [diff] [blame] | 27 | using util::ProtoOutputStream; |
| 28 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 29 | SensorService::SensorDirectConnection::SensorDirectConnection(const sp<SensorService>& service, |
| 30 | uid_t uid, const sensors_direct_mem_t *mem, int32_t halChannelHandle, |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 31 | const String16& opPackageName, int deviceId) |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 32 | : mService(service), mUid(uid), mMem(*mem), |
| 33 | mHalChannelHandle(halChannelHandle), |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 34 | mOpPackageName(opPackageName), mDeviceId(deviceId), mDestroyed(false) { |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 35 | mUserId = multiuser_get_user_id(mUid); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 36 | ALOGD_IF(DEBUG_CONNECTIONS, "Created SensorDirectConnection"); |
| 37 | } |
| 38 | |
| 39 | SensorService::SensorDirectConnection::~SensorDirectConnection() { |
| 40 | ALOGD_IF(DEBUG_CONNECTIONS, "~SensorDirectConnection %p", this); |
Peng Xu | 8cbefd7 | 2017-07-10 16:41:08 -0700 | [diff] [blame] | 41 | destroy(); |
| 42 | } |
| 43 | |
| 44 | void SensorService::SensorDirectConnection::destroy() { |
| 45 | Mutex::Autolock _l(mDestroyLock); |
| 46 | // destroy once only |
| 47 | if (mDestroyed) { |
| 48 | return; |
| 49 | } |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 50 | |
| 51 | stopAll(); |
| 52 | mService->cleanupConnection(this); |
| 53 | if (mMem.handle != nullptr) { |
Brian Duddie | 0a4cebb | 2022-08-25 19:20:18 +0000 | [diff] [blame] | 54 | native_handle_close_with_tag(mMem.handle); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 55 | native_handle_delete(const_cast<struct native_handle*>(mMem.handle)); |
| 56 | } |
Peng Xu | 8cbefd7 | 2017-07-10 16:41:08 -0700 | [diff] [blame] | 57 | mDestroyed = true; |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | void SensorService::SensorDirectConnection::onFirstRef() { |
| 61 | } |
| 62 | |
| 63 | void SensorService::SensorDirectConnection::dump(String8& result) const { |
| 64 | Mutex::Autolock _l(mConnectionLock); |
| 65 | result.appendFormat("\tPackage %s, HAL channel handle %d, total sensor activated %zu\n", |
| 66 | String8(mOpPackageName).string(), getHalChannelHandle(), mActivated.size()); |
| 67 | for (auto &i : mActivated) { |
| 68 | result.appendFormat("\t\tSensor %#08x, rate %d\n", i.first, i.second); |
| 69 | } |
| 70 | } |
| 71 | |
Mike Ma | 2474386 | 2020-01-29 00:36:55 -0800 | [diff] [blame] | 72 | /** |
| 73 | * Dump debugging information as android.service.SensorDirectConnectionProto protobuf message using |
| 74 | * ProtoOutputStream. |
| 75 | * |
| 76 | * See proto definition and some notes about ProtoOutputStream in |
| 77 | * frameworks/base/core/proto/android/service/sensor_service.proto |
| 78 | */ |
| 79 | void SensorService::SensorDirectConnection::dump(ProtoOutputStream* proto) const { |
| 80 | using namespace service::SensorDirectConnectionProto; |
| 81 | Mutex::Autolock _l(mConnectionLock); |
| 82 | proto->write(PACKAGE_NAME, std::string(String8(mOpPackageName).string())); |
| 83 | proto->write(HAL_CHANNEL_HANDLE, getHalChannelHandle()); |
| 84 | proto->write(NUM_SENSOR_ACTIVATED, int(mActivated.size())); |
| 85 | for (auto &i : mActivated) { |
| 86 | uint64_t token = proto->start(SENSORS); |
| 87 | proto->write(SensorProto::SENSOR, i.first); |
| 88 | proto->write(SensorProto::RATE, i.second); |
| 89 | proto->end(token); |
| 90 | } |
| 91 | } |
| 92 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 93 | sp<BitTube> SensorService::SensorDirectConnection::getSensorChannel() const { |
| 94 | return nullptr; |
| 95 | } |
| 96 | |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 97 | void SensorService::SensorDirectConnection::onSensorAccessChanged(bool hasAccess) { |
| 98 | if (!hasAccess) { |
| 99 | stopAll(true /* backupRecord */); |
| 100 | } else { |
| 101 | recoverAll(); |
| 102 | } |
| 103 | } |
| 104 | |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 105 | void SensorService::SensorDirectConnection::onMicSensorAccessChanged(bool isMicToggleOn) { |
| 106 | if (isMicToggleOn) { |
| 107 | capRates(); |
| 108 | } else { |
| 109 | uncapRates(); |
| 110 | } |
| 111 | } |
| 112 | |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 113 | bool SensorService::SensorDirectConnection::hasSensorAccess() const { |
| 114 | return mService->hasSensorAccess(mUid, mOpPackageName); |
| 115 | } |
| 116 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 117 | status_t SensorService::SensorDirectConnection::enableDisable( |
| 118 | int handle, bool enabled, nsecs_t samplingPeriodNs, nsecs_t maxBatchReportLatencyNs, |
| 119 | int reservedFlags) { |
| 120 | // SensorDirectConnection does not support enableDisable, parameters not used |
| 121 | UNUSED(handle); |
| 122 | UNUSED(enabled); |
| 123 | UNUSED(samplingPeriodNs); |
| 124 | UNUSED(maxBatchReportLatencyNs); |
| 125 | UNUSED(reservedFlags); |
| 126 | return INVALID_OPERATION; |
| 127 | } |
| 128 | |
| 129 | status_t SensorService::SensorDirectConnection::setEventRate( |
| 130 | int handle, nsecs_t samplingPeriodNs) { |
| 131 | // SensorDirectConnection does not support setEventRate, parameters not used |
| 132 | UNUSED(handle); |
| 133 | UNUSED(samplingPeriodNs); |
| 134 | return INVALID_OPERATION; |
| 135 | } |
| 136 | |
| 137 | status_t SensorService::SensorDirectConnection::flush() { |
| 138 | // SensorDirectConnection does not support flush |
| 139 | return INVALID_OPERATION; |
| 140 | } |
| 141 | |
| 142 | int32_t SensorService::SensorDirectConnection::configureChannel(int handle, int rateLevel) { |
| 143 | |
| 144 | if (handle == -1 && rateLevel == SENSOR_DIRECT_RATE_STOP) { |
| 145 | stopAll(); |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 146 | mMicRateBackup.clear(); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 147 | return NO_ERROR; |
| 148 | } |
| 149 | |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 150 | if (!hasSensorAccess()) { |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 151 | return PERMISSION_DENIED; |
| 152 | } |
| 153 | |
Vladimir Komsiyski | 705e5ab | 2022-12-08 17:29:14 +0100 | [diff] [blame] | 154 | std::shared_ptr<SensorInterface> si = mService->getSensorInterfaceFromHandle(handle); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 155 | if (si == nullptr) { |
| 156 | return NAME_NOT_FOUND; |
| 157 | } |
| 158 | |
| 159 | const Sensor& s = si->getSensor(); |
Brian Duddie | 4a4d046 | 2022-05-09 16:49:49 -0700 | [diff] [blame] | 160 | if (!mService->canAccessSensor(s, "config direct channel", mOpPackageName)) { |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 161 | return PERMISSION_DENIED; |
| 162 | } |
| 163 | |
| 164 | if (s.getHighestDirectReportRateLevel() == 0 |
| 165 | || rateLevel > s.getHighestDirectReportRateLevel() |
| 166 | || !s.isDirectChannelTypeSupported(mMem.type)) { |
| 167 | return INVALID_OPERATION; |
| 168 | } |
| 169 | |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 170 | int requestedRateLevel = rateLevel; |
Anh Pham | af91a91 | 2021-02-10 14:10:53 +0100 | [diff] [blame] | 171 | if (mService->isSensorInCappedSet(s.getType()) && rateLevel != SENSOR_DIRECT_RATE_STOP) { |
| 172 | status_t err = mService->adjustRateLevelBasedOnMicAndPermission(&rateLevel, mOpPackageName); |
| 173 | if (err != OK) { |
| 174 | return err; |
| 175 | } |
| 176 | } |
| 177 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 178 | struct sensors_direct_cfg_t config = { |
| 179 | .rate_level = rateLevel |
| 180 | }; |
| 181 | |
| 182 | Mutex::Autolock _l(mConnectionLock); |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 183 | int ret = configure(handle, &config); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 184 | |
| 185 | if (rateLevel == SENSOR_DIRECT_RATE_STOP) { |
| 186 | if (ret == NO_ERROR) { |
| 187 | mActivated.erase(handle); |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 188 | mMicRateBackup.erase(handle); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 189 | } else if (ret > 0) { |
| 190 | ret = UNKNOWN_ERROR; |
| 191 | } |
| 192 | } else { |
| 193 | if (ret > 0) { |
| 194 | mActivated[handle] = rateLevel; |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 195 | if (mService->isSensorInCappedSet(s.getType())) { |
| 196 | // Back up the rates that the app is allowed to have if the mic toggle is off |
| 197 | // This is used in the uncapRates() function. |
Arthur Ishiguro | 8a62852 | 2021-09-22 14:10:16 -0700 | [diff] [blame] | 198 | if ((requestedRateLevel <= SENSOR_SERVICE_CAPPED_SAMPLING_RATE_LEVEL) || |
| 199 | !isRateCappedBasedOnPermission()) { |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 200 | mMicRateBackup[handle] = requestedRateLevel; |
| 201 | } else { |
| 202 | mMicRateBackup[handle] = SENSOR_SERVICE_CAPPED_SAMPLING_RATE_LEVEL; |
| 203 | } |
| 204 | } |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 205 | } |
| 206 | } |
| 207 | |
| 208 | return ret; |
| 209 | } |
| 210 | |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 211 | void SensorService::SensorDirectConnection::capRates() { |
| 212 | Mutex::Autolock _l(mConnectionLock); |
| 213 | const struct sensors_direct_cfg_t capConfig = { |
| 214 | .rate_level = SENSOR_SERVICE_CAPPED_SAMPLING_RATE_LEVEL |
| 215 | }; |
| 216 | |
| 217 | const struct sensors_direct_cfg_t stopConfig = { |
| 218 | .rate_level = SENSOR_DIRECT_RATE_STOP |
| 219 | }; |
| 220 | |
| 221 | // If our requests are in the backup, then we shouldn't activate sensors from here |
| 222 | bool temporarilyStopped = mActivated.empty() && !mActivatedBackup.empty(); |
| 223 | std::unordered_map<int, int>& existingConnections = |
| 224 | (!temporarilyStopped) ? mActivated : mActivatedBackup; |
| 225 | |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 226 | for (auto &i : existingConnections) { |
| 227 | int handle = i.first; |
| 228 | int rateLevel = i.second; |
Vladimir Komsiyski | 705e5ab | 2022-12-08 17:29:14 +0100 | [diff] [blame] | 229 | std::shared_ptr<SensorInterface> si = mService->getSensorInterfaceFromHandle(handle); |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 230 | if (si != nullptr) { |
| 231 | const Sensor& s = si->getSensor(); |
| 232 | if (mService->isSensorInCappedSet(s.getType()) && |
| 233 | rateLevel > SENSOR_SERVICE_CAPPED_SAMPLING_RATE_LEVEL) { |
| 234 | mMicRateBackup[handle] = rateLevel; |
| 235 | // Modify the rate kept by the existing map |
| 236 | existingConnections[handle] = SENSOR_SERVICE_CAPPED_SAMPLING_RATE_LEVEL; |
| 237 | // Only reconfigure the channel if it's ongoing |
| 238 | if (!temporarilyStopped) { |
| 239 | // Stopping before reconfiguring is the well-tested path in CTS |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 240 | configure(handle, &stopConfig); |
| 241 | configure(handle, &capConfig); |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 242 | } |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | void SensorService::SensorDirectConnection::uncapRates() { |
| 249 | Mutex::Autolock _l(mConnectionLock); |
| 250 | |
| 251 | // If our requests are in the backup, then we shouldn't activate sensors from here |
| 252 | bool temporarilyStopped = mActivated.empty() && !mActivatedBackup.empty(); |
| 253 | std::unordered_map<int, int>& existingConnections = |
| 254 | (!temporarilyStopped) ? mActivated : mActivatedBackup; |
| 255 | |
| 256 | const struct sensors_direct_cfg_t stopConfig = { |
| 257 | .rate_level = SENSOR_DIRECT_RATE_STOP |
| 258 | }; |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 259 | for (auto &i : mMicRateBackup) { |
| 260 | int handle = i.first; |
| 261 | int rateLevel = i.second; |
| 262 | |
| 263 | const struct sensors_direct_cfg_t config = { |
| 264 | .rate_level = rateLevel |
| 265 | }; |
| 266 | |
| 267 | // Modify the rate kept by the existing map |
| 268 | existingConnections[handle] = rateLevel; |
| 269 | |
| 270 | // Only reconfigure the channel if it's ongoing |
| 271 | if (!temporarilyStopped) { |
| 272 | // Stopping before reconfiguring is the well-tested path in CTS |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 273 | configure(handle, &stopConfig); |
| 274 | configure(handle, &config); |
Anh Pham | 5198c99 | 2021-02-10 14:15:30 +0100 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | mMicRateBackup.clear(); |
| 278 | } |
| 279 | |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 280 | int SensorService::SensorDirectConnection::configure( |
| 281 | int handle, const sensors_direct_cfg_t* config) { |
| 282 | if (mDeviceId == RuntimeSensor::DEFAULT_DEVICE_ID) { |
| 283 | SensorDevice& dev(SensorDevice::getInstance()); |
| 284 | return dev.configureDirectChannel(handle, getHalChannelHandle(), config); |
| 285 | } else { |
| 286 | return mService->configureRuntimeSensorDirectChannel(handle, this, config); |
| 287 | } |
| 288 | } |
| 289 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 290 | void SensorService::SensorDirectConnection::stopAll(bool backupRecord) { |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 291 | Mutex::Autolock _l(mConnectionLock); |
| 292 | stopAllLocked(backupRecord); |
| 293 | } |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 294 | |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 295 | void SensorService::SensorDirectConnection::stopAllLocked(bool backupRecord) { |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 296 | struct sensors_direct_cfg_t config = { |
| 297 | .rate_level = SENSOR_DIRECT_RATE_STOP |
| 298 | }; |
| 299 | |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 300 | for (auto &i : mActivated) { |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 301 | configure(i.first, &config); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | if (backupRecord && mActivatedBackup.empty()) { |
| 305 | mActivatedBackup = mActivated; |
| 306 | } |
| 307 | mActivated.clear(); |
| 308 | } |
| 309 | |
| 310 | void SensorService::SensorDirectConnection::recoverAll() { |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 311 | Mutex::Autolock _l(mConnectionLock); |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 312 | if (!mActivatedBackup.empty()) { |
| 313 | stopAllLocked(false); |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 314 | |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 315 | // recover list of report from backup |
| 316 | ALOG_ASSERT(mActivated.empty(), |
| 317 | "mActivated must be empty if mActivatedBackup was non-empty"); |
| 318 | mActivated = mActivatedBackup; |
| 319 | mActivatedBackup.clear(); |
| 320 | |
| 321 | // re-enable them |
| 322 | for (auto &i : mActivated) { |
| 323 | struct sensors_direct_cfg_t config = { |
| 324 | .rate_level = i.second |
| 325 | }; |
Vladimir Komsiyski | 4871f09 | 2023-01-19 18:25:43 +0100 | [diff] [blame^] | 326 | configure(i.first, &config); |
Arthur Ishiguro | e3ed3d2 | 2020-04-13 10:29:44 -0700 | [diff] [blame] | 327 | } |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 328 | } |
| 329 | } |
| 330 | |
| 331 | int32_t SensorService::SensorDirectConnection::getHalChannelHandle() const { |
| 332 | return mHalChannelHandle; |
| 333 | } |
| 334 | |
| 335 | bool SensorService::SensorDirectConnection::isEquivalent(const sensors_direct_mem_t *mem) const { |
| 336 | bool ret = false; |
| 337 | |
| 338 | if (mMem.type == mem->type) { |
| 339 | switch (mMem.type) { |
| 340 | case SENSOR_DIRECT_MEM_TYPE_ASHMEM: { |
Peng Xu | 3640773 | 2017-05-16 15:12:22 -0700 | [diff] [blame] | 341 | // there is no known method to test if two ashmem fds are equivalent besides |
| 342 | // trivially comparing the fd values (ino number from fstat() are always the |
| 343 | // same, pointing to "/dev/ashmem"). |
| 344 | int fd1 = mMem.handle->data[0]; |
| 345 | int fd2 = mem->handle->data[0]; |
| 346 | ret = (fd1 == fd2); |
Peng Xu | f149b40 | 2017-02-09 12:24:25 -0800 | [diff] [blame] | 347 | break; |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 348 | } |
| 349 | case SENSOR_DIRECT_MEM_TYPE_GRALLOC: |
Peng Xu | f88e2b9 | 2017-04-10 15:52:58 -0700 | [diff] [blame] | 350 | // there is no known method to test if two gralloc handle are equivalent |
| 351 | ret = false; |
Peng Xu | f149b40 | 2017-02-09 12:24:25 -0800 | [diff] [blame] | 352 | break; |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 353 | default: |
Peng Xu | f88e2b9 | 2017-04-10 15:52:58 -0700 | [diff] [blame] | 354 | // should never happen |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 355 | ALOGE("Unexpected mem type %d", mMem.type); |
| 356 | ret = true; |
Peng Xu | f149b40 | 2017-02-09 12:24:25 -0800 | [diff] [blame] | 357 | break; |
Peng Xu | e36e347 | 2016-11-03 11:57:10 -0700 | [diff] [blame] | 358 | } |
| 359 | } |
| 360 | return ret; |
| 361 | } |
| 362 | |
| 363 | } // namespace android |
| 364 | |