blob: 7fa33f597c90601235ce441ae480059671e90712 [file] [log] [blame]
Dan Stozaec460082018-12-17 15:35:09 -08001/*
2 * Copyright 2019 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
17//#define LOG_NDEBUG 0
18#define ATRACE_TAG ATRACE_TAG_GRAPHICS
19#undef LOG_TAG
20#define LOG_TAG "RegionSamplingThread"
21
22#include "RegionSamplingThread.h"
23
Kevin DuBois413287f2019-02-25 08:46:47 -080024#include <cutils/properties.h>
Dan Stozaec460082018-12-17 15:35:09 -080025#include <gui/IRegionSamplingListener.h>
26#include <utils/Trace.h>
Kevin DuBois413287f2019-02-25 08:46:47 -080027#include <string>
Dan Stozaec460082018-12-17 15:35:09 -080028
Kevin DuBoisb325c932019-05-21 08:34:09 -070029#include <compositionengine/Display.h>
30#include <compositionengine/impl/OutputCompositionState.h>
Dan Stozaec460082018-12-17 15:35:09 -080031#include "DisplayDevice.h"
32#include "Layer.h"
33#include "SurfaceFlinger.h"
34
35namespace android {
Kevin DuBois413287f2019-02-25 08:46:47 -080036using namespace std::chrono_literals;
Dan Stozaec460082018-12-17 15:35:09 -080037
38template <typename T>
39struct SpHash {
40 size_t operator()(const sp<T>& p) const { return std::hash<T*>()(p.get()); }
41};
42
Kevin DuBois413287f2019-02-25 08:46:47 -080043constexpr auto lumaSamplingStepTag = "LumaSamplingStep";
44enum class samplingStep {
45 noWorkNeeded,
46 idleTimerWaiting,
47 waitForZeroPhase,
48 waitForSamplePhase,
49 sample
50};
51
52constexpr auto defaultRegionSamplingOffset = -3ms;
53constexpr auto defaultRegionSamplingPeriod = 100ms;
54constexpr auto defaultRegionSamplingTimerTimeout = 100ms;
55// TODO: (b/127403193) duration to string conversion could probably be constexpr
56template <typename Rep, typename Per>
57inline std::string toNsString(std::chrono::duration<Rep, Per> t) {
58 return std::to_string(std::chrono::duration_cast<std::chrono::nanoseconds>(t).count());
Dan Stozaec460082018-12-17 15:35:09 -080059}
60
Kevin DuBois413287f2019-02-25 08:46:47 -080061RegionSamplingThread::EnvironmentTimingTunables::EnvironmentTimingTunables() {
62 char value[PROPERTY_VALUE_MAX] = {};
63
64 property_get("debug.sf.region_sampling_offset_ns", value,
65 toNsString(defaultRegionSamplingOffset).c_str());
66 int const samplingOffsetNsRaw = atoi(value);
67
68 property_get("debug.sf.region_sampling_period_ns", value,
69 toNsString(defaultRegionSamplingPeriod).c_str());
70 int const samplingPeriodNsRaw = atoi(value);
71
72 property_get("debug.sf.region_sampling_timer_timeout_ns", value,
73 toNsString(defaultRegionSamplingTimerTimeout).c_str());
74 int const samplingTimerTimeoutNsRaw = atoi(value);
75
76 if ((samplingPeriodNsRaw < 0) || (samplingTimerTimeoutNsRaw < 0)) {
77 ALOGW("User-specified sampling tuning options nonsensical. Using defaults");
78 mSamplingOffset = defaultRegionSamplingOffset;
79 mSamplingPeriod = defaultRegionSamplingPeriod;
80 mSamplingTimerTimeout = defaultRegionSamplingTimerTimeout;
81 } else {
82 mSamplingOffset = std::chrono::nanoseconds(samplingOffsetNsRaw);
83 mSamplingPeriod = std::chrono::nanoseconds(samplingPeriodNsRaw);
84 mSamplingTimerTimeout = std::chrono::nanoseconds(samplingTimerTimeoutNsRaw);
85 }
86}
87
88struct SamplingOffsetCallback : DispSync::Callback {
89 SamplingOffsetCallback(RegionSamplingThread& samplingThread, Scheduler& scheduler,
90 std::chrono::nanoseconds targetSamplingOffset)
91 : mRegionSamplingThread(samplingThread),
92 mScheduler(scheduler),
93 mTargetSamplingOffset(targetSamplingOffset) {}
94
95 ~SamplingOffsetCallback() { stopVsyncListener(); }
96
97 SamplingOffsetCallback(const SamplingOffsetCallback&) = delete;
98 SamplingOffsetCallback& operator=(const SamplingOffsetCallback&) = delete;
99
100 void startVsyncListener() {
101 std::lock_guard lock(mMutex);
102 if (mVsyncListening) return;
103
104 mPhaseIntervalSetting = Phase::ZERO;
105 mScheduler.withPrimaryDispSync([this](android::DispSync& sync) {
Alec Mouri7355eb22019-03-05 14:19:10 -0800106 sync.addEventListener("SamplingThreadDispSyncListener", 0, this, mLastCallbackTime);
Kevin DuBois413287f2019-02-25 08:46:47 -0800107 });
108 mVsyncListening = true;
109 }
110
111 void stopVsyncListener() {
112 std::lock_guard lock(mMutex);
113 stopVsyncListenerLocked();
114 }
115
116private:
117 void stopVsyncListenerLocked() /*REQUIRES(mMutex)*/ {
118 if (!mVsyncListening) return;
119
Alec Mouri7355eb22019-03-05 14:19:10 -0800120 mScheduler.withPrimaryDispSync([this](android::DispSync& sync) {
121 sync.removeEventListener(this, &mLastCallbackTime);
122 });
Kevin DuBois413287f2019-02-25 08:46:47 -0800123 mVsyncListening = false;
124 }
125
126 void onDispSyncEvent(nsecs_t /* when */) final {
127 std::unique_lock<decltype(mMutex)> lock(mMutex);
128
129 if (mPhaseIntervalSetting == Phase::ZERO) {
130 ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::waitForSamplePhase));
131 mPhaseIntervalSetting = Phase::SAMPLING;
132 mScheduler.withPrimaryDispSync([this](android::DispSync& sync) {
133 sync.changePhaseOffset(this, mTargetSamplingOffset.count());
134 });
135 return;
136 }
137
138 if (mPhaseIntervalSetting == Phase::SAMPLING) {
139 mPhaseIntervalSetting = Phase::ZERO;
140 mScheduler.withPrimaryDispSync(
141 [this](android::DispSync& sync) { sync.changePhaseOffset(this, 0); });
142 stopVsyncListenerLocked();
143 lock.unlock();
144 mRegionSamplingThread.notifySamplingOffset();
145 return;
146 }
147 }
148
149 RegionSamplingThread& mRegionSamplingThread;
150 Scheduler& mScheduler;
151 const std::chrono::nanoseconds mTargetSamplingOffset;
152 mutable std::mutex mMutex;
Alec Mouri7355eb22019-03-05 14:19:10 -0800153 nsecs_t mLastCallbackTime = 0;
Kevin DuBois413287f2019-02-25 08:46:47 -0800154 enum class Phase {
155 ZERO,
156 SAMPLING
157 } mPhaseIntervalSetting /*GUARDED_BY(mMutex) macro doesnt work with unique_lock?*/
158 = Phase::ZERO;
159 bool mVsyncListening /*GUARDED_BY(mMutex)*/ = false;
160};
161
162RegionSamplingThread::RegionSamplingThread(SurfaceFlinger& flinger, Scheduler& scheduler,
163 const TimingTunables& tunables)
164 : mFlinger(flinger),
165 mScheduler(scheduler),
166 mTunables(tunables),
167 mIdleTimer(std::chrono::duration_cast<std::chrono::milliseconds>(
168 mTunables.mSamplingTimerTimeout),
169 [] {}, [this] { checkForStaleLuma(); }),
170 mPhaseCallback(std::make_unique<SamplingOffsetCallback>(*this, mScheduler,
171 tunables.mSamplingOffset)),
172 lastSampleTime(0ns) {
Kevin DuBois26afc782019-05-06 16:46:45 -0700173 mThread = std::thread([this]() { threadMain(); });
174 pthread_setname_np(mThread.native_handle(), "RegionSamplingThread");
Kevin DuBois413287f2019-02-25 08:46:47 -0800175 mIdleTimer.start();
176}
177
178RegionSamplingThread::RegionSamplingThread(SurfaceFlinger& flinger, Scheduler& scheduler)
179 : RegionSamplingThread(flinger, scheduler,
180 TimingTunables{defaultRegionSamplingOffset,
181 defaultRegionSamplingPeriod,
182 defaultRegionSamplingTimerTimeout}) {}
183
Dan Stozaec460082018-12-17 15:35:09 -0800184RegionSamplingThread::~RegionSamplingThread() {
Kevin DuBois413287f2019-02-25 08:46:47 -0800185 mIdleTimer.stop();
186
Dan Stozaec460082018-12-17 15:35:09 -0800187 {
Kevin DuBois26afc782019-05-06 16:46:45 -0700188 std::lock_guard lock(mThreadControlMutex);
Dan Stozaec460082018-12-17 15:35:09 -0800189 mRunning = false;
190 mCondition.notify_one();
191 }
192
Dan Stozaec460082018-12-17 15:35:09 -0800193 if (mThread.joinable()) {
194 mThread.join();
195 }
196}
197
198void RegionSamplingThread::addListener(const Rect& samplingArea, const sp<IBinder>& stopLayerHandle,
199 const sp<IRegionSamplingListener>& listener) {
200 wp<Layer> stopLayer = stopLayerHandle != nullptr
201 ? static_cast<Layer::Handle*>(stopLayerHandle.get())->owner
202 : nullptr;
203
204 sp<IBinder> asBinder = IInterface::asBinder(listener);
205 asBinder->linkToDeath(this);
Kevin DuBois26afc782019-05-06 16:46:45 -0700206 std::lock_guard lock(mSamplingMutex);
Dan Stozaec460082018-12-17 15:35:09 -0800207 mDescriptors.emplace(wp<IBinder>(asBinder), Descriptor{samplingArea, stopLayer, listener});
208}
209
210void RegionSamplingThread::removeListener(const sp<IRegionSamplingListener>& listener) {
Kevin DuBois26afc782019-05-06 16:46:45 -0700211 std::lock_guard lock(mSamplingMutex);
Dan Stozaec460082018-12-17 15:35:09 -0800212 mDescriptors.erase(wp<IBinder>(IInterface::asBinder(listener)));
213}
214
Kevin DuBois413287f2019-02-25 08:46:47 -0800215void RegionSamplingThread::checkForStaleLuma() {
Kevin DuBois26afc782019-05-06 16:46:45 -0700216 std::lock_guard lock(mThreadControlMutex);
Kevin DuBois413287f2019-02-25 08:46:47 -0800217
218 if (mDiscardedFrames) {
219 ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::waitForZeroPhase));
220 mDiscardedFrames = false;
221 mPhaseCallback->startVsyncListener();
222 }
223}
224
225void RegionSamplingThread::notifyNewContent() {
226 doSample();
227}
228
229void RegionSamplingThread::notifySamplingOffset() {
230 doSample();
231}
232
233void RegionSamplingThread::doSample() {
Kevin DuBois26afc782019-05-06 16:46:45 -0700234 std::lock_guard lock(mThreadControlMutex);
Kevin DuBois413287f2019-02-25 08:46:47 -0800235 auto now = std::chrono::nanoseconds(systemTime(SYSTEM_TIME_MONOTONIC));
236 if (lastSampleTime + mTunables.mSamplingPeriod > now) {
237 ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::idleTimerWaiting));
238 mDiscardedFrames = true;
239 return;
240 }
241
242 ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::sample));
243
244 mDiscardedFrames = false;
245 lastSampleTime = now;
246
247 mIdleTimer.reset();
248 mPhaseCallback->stopVsyncListener();
249
Dan Stozaec460082018-12-17 15:35:09 -0800250 mSampleRequested = true;
251 mCondition.notify_one();
252}
253
254void RegionSamplingThread::binderDied(const wp<IBinder>& who) {
Kevin DuBois26afc782019-05-06 16:46:45 -0700255 std::lock_guard lock(mSamplingMutex);
Dan Stozaec460082018-12-17 15:35:09 -0800256 mDescriptors.erase(who);
257}
258
259namespace {
260// Using Rec. 709 primaries
261float getLuma(float r, float g, float b) {
262 constexpr auto rec709_red_primary = 0.2126f;
263 constexpr auto rec709_green_primary = 0.7152f;
264 constexpr auto rec709_blue_primary = 0.0722f;
265 return rec709_red_primary * r + rec709_green_primary * g + rec709_blue_primary * b;
266}
Kevin DuBoisbb27bcd2019-04-02 14:34:35 -0700267} // anonymous namespace
Dan Stozaec460082018-12-17 15:35:09 -0800268
Kevin DuBoisb325c932019-05-21 08:34:09 -0700269float sampleArea(const uint32_t* data, int32_t width, int32_t height, int32_t stride,
270 uint32_t orientation, const Rect& sample_area) {
271 if (!sample_area.isValid() || (sample_area.getWidth() > width) ||
272 (sample_area.getHeight() > height)) {
273 ALOGE("invalid sampling region requested");
274 return 0.0f;
275 }
276
277 // (b/133849373) ROT_90 screencap images produced upside down
278 auto area = sample_area;
279 if (orientation & ui::Transform::ROT_90) {
280 area.top = height - area.top;
281 area.bottom = height - area.bottom;
282 std::swap(area.top, area.bottom);
283 }
284
Dan Stozaec460082018-12-17 15:35:09 -0800285 std::array<int32_t, 256> brightnessBuckets = {};
286 const int32_t majoritySampleNum = area.getWidth() * area.getHeight() / 2;
287
288 for (int32_t row = area.top; row < area.bottom; ++row) {
289 const uint32_t* rowBase = data + row * stride;
290 for (int32_t column = area.left; column < area.right; ++column) {
291 uint32_t pixel = rowBase[column];
292 const float r = (pixel & 0xFF) / 255.0f;
293 const float g = ((pixel >> 8) & 0xFF) / 255.0f;
294 const float b = ((pixel >> 16) & 0xFF) / 255.0f;
295 const uint8_t luma = std::round(getLuma(r, g, b) * 255.0f);
296 ++brightnessBuckets[luma];
297 if (brightnessBuckets[luma] > majoritySampleNum) return luma / 255.0f;
298 }
299 }
300
301 int32_t accumulated = 0;
302 size_t bucket = 0;
Kevin DuBoisbb27bcd2019-04-02 14:34:35 -0700303 for (; bucket < brightnessBuckets.size(); bucket++) {
Dan Stozaec460082018-12-17 15:35:09 -0800304 accumulated += brightnessBuckets[bucket];
305 if (accumulated > majoritySampleNum) break;
306 }
307
308 return bucket / 255.0f;
309}
Dan Stozaec460082018-12-17 15:35:09 -0800310
Kevin DuBois7cbcc372019-02-25 14:53:28 -0800311std::vector<float> RegionSamplingThread::sampleBuffer(
312 const sp<GraphicBuffer>& buffer, const Point& leftTop,
Kevin DuBoisb325c932019-05-21 08:34:09 -0700313 const std::vector<RegionSamplingThread::Descriptor>& descriptors, uint32_t orientation) {
Dan Stozaec460082018-12-17 15:35:09 -0800314 void* data_raw = nullptr;
315 buffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, &data_raw);
316 std::shared_ptr<uint32_t> data(reinterpret_cast<uint32_t*>(data_raw),
317 [&buffer](auto) { buffer->unlock(); });
318 if (!data) return {};
319
Kevin DuBoisb325c932019-05-21 08:34:09 -0700320 const int32_t width = buffer->getWidth();
321 const int32_t height = buffer->getHeight();
Dan Stozaec460082018-12-17 15:35:09 -0800322 const int32_t stride = buffer->getStride();
323 std::vector<float> lumas(descriptors.size());
324 std::transform(descriptors.begin(), descriptors.end(), lumas.begin(),
325 [&](auto const& descriptor) {
Kevin DuBoisb325c932019-05-21 08:34:09 -0700326 return sampleArea(data.get(), width, height, stride, orientation,
327 descriptor.area - leftTop);
Dan Stozaec460082018-12-17 15:35:09 -0800328 });
329 return lumas;
330}
331
332void RegionSamplingThread::captureSample() {
333 ATRACE_CALL();
Kevin DuBois26afc782019-05-06 16:46:45 -0700334 std::lock_guard lock(mSamplingMutex);
Dan Stozaec460082018-12-17 15:35:09 -0800335
336 if (mDescriptors.empty()) {
337 return;
338 }
339
Kevin DuBoisb325c932019-05-21 08:34:09 -0700340 const auto device = mFlinger.getDefaultDisplayDevice();
341 const auto display = device->getCompositionDisplay();
342 const auto state = display->getState();
343 const auto orientation = static_cast<ui::Transform::orientation_flags>(state.orientation);
344
Dan Stozaec460082018-12-17 15:35:09 -0800345 std::vector<RegionSamplingThread::Descriptor> descriptors;
346 Region sampleRegion;
347 for (const auto& [listener, descriptor] : mDescriptors) {
348 sampleRegion.orSelf(descriptor.area);
349 descriptors.emplace_back(descriptor);
350 }
351
Kevin DuBois7cbcc372019-02-25 14:53:28 -0800352 const Rect sampledArea = sampleRegion.bounds();
Dan Stozaec460082018-12-17 15:35:09 -0800353
Kevin DuBoisb325c932019-05-21 08:34:09 -0700354 auto dx = 0;
355 auto dy = 0;
356 switch (orientation) {
357 case ui::Transform::ROT_90:
358 dx = device->getWidth();
359 break;
360 case ui::Transform::ROT_180:
361 dx = device->getWidth();
362 dy = device->getHeight();
363 break;
364 case ui::Transform::ROT_270:
365 dy = device->getHeight();
366 break;
367 default:
368 break;
369 }
370
371 ui::Transform t(orientation);
372 auto screencapRegion = t.transform(sampleRegion);
373 screencapRegion = screencapRegion.translate(dx, dy);
374 DisplayRenderArea renderArea(device, screencapRegion.bounds(), sampledArea.getWidth(),
375 sampledArea.getHeight(), ui::Dataspace::V0_SRGB, orientation);
Dan Stozaec460082018-12-17 15:35:09 -0800376
377 std::unordered_set<sp<IRegionSamplingListener>, SpHash<IRegionSamplingListener>> listeners;
378
379 auto traverseLayers = [&](const LayerVector::Visitor& visitor) {
380 bool stopLayerFound = false;
381 auto filterVisitor = [&](Layer* layer) {
382 // We don't want to capture any layers beyond the stop layer
383 if (stopLayerFound) return;
384
385 // Likewise if we just found a stop layer, set the flag and abort
386 for (const auto& [area, stopLayer, listener] : descriptors) {
387 if (layer == stopLayer.promote().get()) {
388 stopLayerFound = true;
389 return;
390 }
391 }
392
393 // Compute the layer's position on the screen
Kevin DuBois7cbcc372019-02-25 14:53:28 -0800394 const Rect bounds = Rect(layer->getBounds());
395 const ui::Transform transform = layer->getTransform();
Dan Stozaec460082018-12-17 15:35:09 -0800396 constexpr bool roundOutwards = true;
397 Rect transformed = transform.transform(bounds, roundOutwards);
398
399 // If this layer doesn't intersect with the larger sampledArea, skip capturing it
400 Rect ignore;
401 if (!transformed.intersect(sampledArea, &ignore)) return;
402
403 // If the layer doesn't intersect a sampling area, skip capturing it
404 bool intersectsAnyArea = false;
405 for (const auto& [area, stopLayer, listener] : descriptors) {
406 if (transformed.intersect(area, &ignore)) {
407 intersectsAnyArea = true;
408 listeners.insert(listener);
409 }
410 }
411 if (!intersectsAnyArea) return;
412
413 ALOGV("Traversing [%s] [%d, %d, %d, %d]", layer->getName().string(), bounds.left,
414 bounds.top, bounds.right, bounds.bottom);
415 visitor(layer);
416 };
417 mFlinger.traverseLayersInDisplay(device, filterVisitor);
418 };
419
Kevin DuBois4efd1f52019-04-29 10:09:43 -0700420 sp<GraphicBuffer> buffer = nullptr;
421 if (mCachedBuffer && mCachedBuffer->getWidth() == sampledArea.getWidth() &&
422 mCachedBuffer->getHeight() == sampledArea.getHeight()) {
423 buffer = mCachedBuffer;
424 } else {
425 const uint32_t usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_HW_RENDER;
426 buffer = new GraphicBuffer(sampledArea.getWidth(), sampledArea.getHeight(),
427 PIXEL_FORMAT_RGBA_8888, 1, usage, "RegionSamplingThread");
428 }
Dan Stozaec460082018-12-17 15:35:09 -0800429
Robert Carr108b2c72019-04-02 16:32:58 -0700430 bool ignored;
431 mFlinger.captureScreenCommon(renderArea, traverseLayers, buffer, false, ignored);
Dan Stozaec460082018-12-17 15:35:09 -0800432
433 std::vector<Descriptor> activeDescriptors;
434 for (const auto& descriptor : descriptors) {
435 if (listeners.count(descriptor.listener) != 0) {
436 activeDescriptors.emplace_back(descriptor);
437 }
438 }
439
440 ALOGV("Sampling %zu descriptors", activeDescriptors.size());
Kevin DuBoisb325c932019-05-21 08:34:09 -0700441 std::vector<float> lumas =
442 sampleBuffer(buffer, sampledArea.leftTop(), activeDescriptors, orientation);
Dan Stozaec460082018-12-17 15:35:09 -0800443 if (lumas.size() != activeDescriptors.size()) {
Kevin DuBois7cbcc372019-02-25 14:53:28 -0800444 ALOGW("collected %zu median luma values for %zu descriptors", lumas.size(),
445 activeDescriptors.size());
Dan Stozaec460082018-12-17 15:35:09 -0800446 return;
447 }
448
449 for (size_t d = 0; d < activeDescriptors.size(); ++d) {
450 activeDescriptors[d].listener->onSampleCollected(lumas[d]);
451 }
Kevin DuBois4efd1f52019-04-29 10:09:43 -0700452
453 // Extend the lifetime of mCachedBuffer from the previous frame to here to ensure that:
454 // 1) The region sampling thread is the last owner of the buffer, and the freeing of the buffer
455 // happens in this thread, as opposed to the main thread.
456 // 2) The listener(s) receive their notifications prior to freeing the buffer.
457 mCachedBuffer = buffer;
Kevin DuBois413287f2019-02-25 08:46:47 -0800458 ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::noWorkNeeded));
Dan Stozaec460082018-12-17 15:35:09 -0800459}
460
Kevin DuBois26afc782019-05-06 16:46:45 -0700461// NO_THREAD_SAFETY_ANALYSIS is because std::unique_lock presently lacks thread safety annotations.
462void RegionSamplingThread::threadMain() NO_THREAD_SAFETY_ANALYSIS {
463 std::unique_lock<std::mutex> lock(mThreadControlMutex);
Dan Stozaec460082018-12-17 15:35:09 -0800464 while (mRunning) {
465 if (mSampleRequested) {
466 mSampleRequested = false;
Kevin DuBois26afc782019-05-06 16:46:45 -0700467 lock.unlock();
Dan Stozaec460082018-12-17 15:35:09 -0800468 captureSample();
Kevin DuBois26afc782019-05-06 16:46:45 -0700469 lock.lock();
Dan Stozaec460082018-12-17 15:35:09 -0800470 }
Kevin DuBois26afc782019-05-06 16:46:45 -0700471 mCondition.wait(lock, [this]() REQUIRES(mThreadControlMutex) {
472 return mSampleRequested || !mRunning;
473 });
Dan Stozaec460082018-12-17 15:35:09 -0800474 }
475}
476
477} // namespace android