1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
|
/*
* Copyright 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#undef LOG_TAG
#define LOG_TAG "PowerAdvisor"
#include <unistd.h>
#include <cinttypes>
#include <cstdint>
#include <optional>
#include <android-base/properties.h>
#include <utils/Log.h>
#include <utils/Mutex.h>
#include <utils/Trace.h>
#include <android/hardware/power/1.3/IPower.h>
#include <android/hardware/power/IPowerHintSession.h>
#include <android/hardware/power/WorkDuration.h>
#include <binder/IServiceManager.h>
#include "../SurfaceFlingerProperties.h"
#include "PowerAdvisor.h"
#include "SurfaceFlinger.h"
namespace android {
namespace Hwc2 {
PowerAdvisor::~PowerAdvisor() = default;
namespace impl {
namespace V1_0 = android::hardware::power::V1_0;
namespace V1_3 = android::hardware::power::V1_3;
using V1_3::PowerHint;
using android::hardware::power::Boost;
using android::hardware::power::IPower;
using android::hardware::power::IPowerHintSession;
using android::hardware::power::Mode;
using android::hardware::power::WorkDuration;
using scheduler::OneShotTimer;
PowerAdvisor::~PowerAdvisor() = default;
namespace {
std::chrono::milliseconds getUpdateTimeout() {
// Default to a timeout of 80ms if nothing else is specified
static std::chrono::milliseconds timeout =
std::chrono::milliseconds(sysprop::display_update_imminent_timeout_ms(80));
return timeout;
}
void traceExpensiveRendering(bool enabled) {
if (enabled) {
ATRACE_ASYNC_BEGIN("ExpensiveRendering", 0);
} else {
ATRACE_ASYNC_END("ExpensiveRendering", 0);
}
}
} // namespace
PowerAdvisor::PowerAdvisor(SurfaceFlinger& flinger) : mFlinger(flinger) {
if (getUpdateTimeout() > 0ms) {
mScreenUpdateTimer.emplace("UpdateImminentTimer", getUpdateTimeout(),
/* resetCallback */
[this] { mSendUpdateImminent.store(false); },
/* timeoutCallback */
[this] {
while (true) {
auto timeSinceLastUpdate = std::chrono::nanoseconds(
systemTime() - mLastScreenUpdatedTime.load());
if (timeSinceLastUpdate >= getUpdateTimeout()) {
break;
}
// We may try to disable expensive rendering and allow
// for sending DISPLAY_UPDATE_IMMINENT hints too early if
// we idled very shortly after updating the screen, so
// make sure we wait enough time.
std::this_thread::sleep_for(getUpdateTimeout() -
timeSinceLastUpdate);
}
mSendUpdateImminent.store(true);
mFlinger.disableExpensiveRendering();
});
}
}
void PowerAdvisor::init() {
// Defer starting the screen update timer until SurfaceFlinger finishes construction.
if (mScreenUpdateTimer) {
mScreenUpdateTimer->start();
}
}
void PowerAdvisor::onBootFinished() {
mBootFinished.store(true);
}
void PowerAdvisor::setExpensiveRenderingExpected(DisplayId displayId, bool expected) {
if (expected) {
mExpensiveDisplays.insert(displayId);
} else {
mExpensiveDisplays.erase(displayId);
}
const bool expectsExpensiveRendering = !mExpensiveDisplays.empty();
if (mNotifiedExpensiveRendering != expectsExpensiveRendering) {
std::lock_guard lock(mPowerHalMutex);
HalWrapper* const halWrapper = getPowerHal();
if (halWrapper == nullptr) {
return;
}
if (!halWrapper->setExpensiveRendering(expectsExpensiveRendering)) {
// The HAL has become unavailable; attempt to reconnect later
mReconnectPowerHal = true;
return;
}
mNotifiedExpensiveRendering = expectsExpensiveRendering;
}
}
void PowerAdvisor::notifyDisplayUpdateImminent() {
// Only start sending this notification once the system has booted so we don't introduce an
// early-boot dependency on Power HAL
if (!mBootFinished.load()) {
return;
}
if (mSendUpdateImminent.exchange(false)) {
std::lock_guard lock(mPowerHalMutex);
HalWrapper* const halWrapper = getPowerHal();
if (halWrapper == nullptr) {
return;
}
if (!halWrapper->notifyDisplayUpdateImminent()) {
// The HAL has become unavailable; attempt to reconnect later
mReconnectPowerHal = true;
return;
}
if (mScreenUpdateTimer) {
mScreenUpdateTimer->reset();
} else {
// If we don't have a screen update timer, then we don't throttle power hal calls so
// flip this bit back to allow for calling into power hal again.
mSendUpdateImminent.store(true);
}
}
if (mScreenUpdateTimer) {
mLastScreenUpdatedTime.store(systemTime());
}
}
bool PowerAdvisor::canNotifyDisplayUpdateImminent() {
bool canNotify = mSendUpdateImminent.load();
if (mScreenUpdateTimer) {
mScreenUpdateTimer->reset();
}
return canNotify;
}
// checks both if it supports and if it's enabled
bool PowerAdvisor::usePowerHintSession() {
// uses cached value since the underlying support and flag are unlikely to change at runtime
return mPowerHintEnabled.value_or(false) && supportsPowerHintSession();
}
bool PowerAdvisor::supportsPowerHintSession() {
// cache to avoid needing lock every time
if (!mSupportsPowerHint.has_value()) {
std::lock_guard lock(mPowerHalMutex);
HalWrapper* const halWrapper = getPowerHal();
mSupportsPowerHint = halWrapper->supportsPowerHintSession();
}
return *mSupportsPowerHint;
}
bool PowerAdvisor::isPowerHintSessionRunning() {
return mPowerHintSessionRunning;
}
void PowerAdvisor::setTargetWorkDuration(int64_t targetDurationNanos) {
if (!usePowerHintSession()) {
ALOGV("Power hint session target duration cannot be set, skipping");
return;
}
{
std::lock_guard lock(mPowerHalMutex);
HalWrapper* const halWrapper = getPowerHal();
if (halWrapper != nullptr) {
halWrapper->setTargetWorkDuration(targetDurationNanos - kTargetSafetyMargin.count());
}
}
}
void PowerAdvisor::sendActualWorkDuration(int64_t actualDurationNanos, nsecs_t timeStampNanos) {
if (!mBootFinished || !usePowerHintSession()) {
ALOGV("Actual work duration power hint cannot be sent, skipping");
return;
}
{
std::lock_guard lock(mPowerHalMutex);
HalWrapper* const halWrapper = getPowerHal();
if (halWrapper != nullptr) {
halWrapper->sendActualWorkDuration(actualDurationNanos, timeStampNanos);
}
}
}
// needs to be set after the flag is known but before PowerAdvisor enters onBootFinished
void PowerAdvisor::enablePowerHint(bool enabled) {
mPowerHintEnabled = enabled;
}
bool PowerAdvisor::startPowerHintSession(const std::vector<int32_t>& threadIds) {
if (!usePowerHintSession()) {
ALOGI("Power hint session cannot be started, skipping");
}
{
std::lock_guard lock(mPowerHalMutex);
HalWrapper* halWrapper = getPowerHal();
if (halWrapper != nullptr && usePowerHintSession()) {
halWrapper->setPowerHintSessionThreadIds(threadIds);
mPowerHintSessionRunning = halWrapper->startPowerHintSession();
}
}
return mPowerHintSessionRunning;
}
class HidlPowerHalWrapper : public PowerAdvisor::HalWrapper {
public:
HidlPowerHalWrapper(sp<V1_3::IPower> powerHal) : mPowerHal(std::move(powerHal)) {}
~HidlPowerHalWrapper() override = default;
static std::unique_ptr<HalWrapper> connect() {
// Power HAL 1.3 is not guaranteed to be available, thus we need to query
// Power HAL 1.0 first and try to cast it to Power HAL 1.3.
sp<V1_3::IPower> powerHal = nullptr;
sp<V1_0::IPower> powerHal_1_0 = V1_0::IPower::getService();
if (powerHal_1_0 != nullptr) {
// Try to cast to Power HAL 1.3
powerHal = V1_3::IPower::castFrom(powerHal_1_0);
if (powerHal == nullptr) {
ALOGW("No Power HAL 1.3 service in system, disabling PowerAdvisor");
} else {
ALOGI("Loaded Power HAL 1.3 service");
}
} else {
ALOGW("No Power HAL found, disabling PowerAdvisor");
}
if (powerHal == nullptr) {
return nullptr;
}
return std::make_unique<HidlPowerHalWrapper>(std::move(powerHal));
}
bool setExpensiveRendering(bool enabled) override {
ALOGV("HIDL setExpensiveRendering %s", enabled ? "T" : "F");
auto ret = mPowerHal->powerHintAsync_1_3(PowerHint::EXPENSIVE_RENDERING, enabled);
if (ret.isOk()) {
traceExpensiveRendering(enabled);
}
return ret.isOk();
}
bool notifyDisplayUpdateImminent() override {
// Power HAL 1.x doesn't have a notification for this
ALOGV("HIDL notifyUpdateImminent received but can't send");
return true;
}
bool supportsPowerHintSession() override { return false; }
bool isPowerHintSessionRunning() override { return false; }
void restartPowerHintSession() override {}
void setPowerHintSessionThreadIds(const std::vector<int32_t>&) override {}
bool startPowerHintSession() override { return false; }
void setTargetWorkDuration(int64_t) override {}
void sendActualWorkDuration(int64_t, nsecs_t) override {}
bool shouldReconnectHAL() override { return false; }
std::vector<int32_t> getPowerHintSessionThreadIds() override { return std::vector<int32_t>{}; }
std::optional<int64_t> getTargetWorkDuration() override { return std::nullopt; }
private:
const sp<V1_3::IPower> mPowerHal = nullptr;
};
AidlPowerHalWrapper::AidlPowerHalWrapper(sp<IPower> powerHal) : mPowerHal(std::move(powerHal)) {
auto ret = mPowerHal->isModeSupported(Mode::EXPENSIVE_RENDERING, &mHasExpensiveRendering);
if (!ret.isOk()) {
mHasExpensiveRendering = false;
}
ret = mPowerHal->isBoostSupported(Boost::DISPLAY_UPDATE_IMMINENT, &mHasDisplayUpdateImminent);
if (!ret.isOk()) {
mHasDisplayUpdateImminent = false;
}
mSupportsPowerHint = checkPowerHintSessionSupported();
}
AidlPowerHalWrapper::~AidlPowerHalWrapper() {
if (mPowerHintSession != nullptr) {
mPowerHintSession->close();
mPowerHintSession = nullptr;
}
};
std::unique_ptr<PowerAdvisor::HalWrapper> AidlPowerHalWrapper::connect() {
// This only waits if the service is actually declared
sp<IPower> powerHal = waitForVintfService<IPower>();
if (powerHal == nullptr) {
return nullptr;
}
ALOGI("Loaded AIDL Power HAL service");
return std::make_unique<AidlPowerHalWrapper>(std::move(powerHal));
}
bool AidlPowerHalWrapper::setExpensiveRendering(bool enabled) {
ALOGV("AIDL setExpensiveRendering %s", enabled ? "T" : "F");
if (!mHasExpensiveRendering) {
ALOGV("Skipped sending EXPENSIVE_RENDERING because HAL doesn't support it");
return true;
}
auto ret = mPowerHal->setMode(Mode::EXPENSIVE_RENDERING, enabled);
if (ret.isOk()) {
traceExpensiveRendering(enabled);
}
return ret.isOk();
}
bool AidlPowerHalWrapper::notifyDisplayUpdateImminent() {
ALOGV("AIDL notifyDisplayUpdateImminent");
if (!mHasDisplayUpdateImminent) {
ALOGV("Skipped sending DISPLAY_UPDATE_IMMINENT because HAL doesn't support it");
return true;
}
auto ret = mPowerHal->setBoost(Boost::DISPLAY_UPDATE_IMMINENT, 0);
return ret.isOk();
}
// only version 2+ of the aidl supports power hint sessions, hidl has no support
bool AidlPowerHalWrapper::supportsPowerHintSession() {
return mSupportsPowerHint;
}
bool AidlPowerHalWrapper::checkPowerHintSessionSupported() {
int64_t unused;
// Try to get preferred rate to determine if hint sessions are supported
// We check for isOk not EX_UNSUPPORTED_OPERATION to lump together errors
return mPowerHal->getHintSessionPreferredRate(&unused).isOk();
}
bool AidlPowerHalWrapper::isPowerHintSessionRunning() {
return mPowerHintSession != nullptr;
}
void AidlPowerHalWrapper::closePowerHintSession() {
if (mPowerHintSession != nullptr) {
mPowerHintSession->close();
mPowerHintSession = nullptr;
}
}
void AidlPowerHalWrapper::restartPowerHintSession() {
closePowerHintSession();
startPowerHintSession();
}
void AidlPowerHalWrapper::setPowerHintSessionThreadIds(const std::vector<int32_t>& threadIds) {
if (threadIds != mPowerHintThreadIds) {
mPowerHintThreadIds = threadIds;
if (isPowerHintSessionRunning()) {
restartPowerHintSession();
}
}
}
bool AidlPowerHalWrapper::startPowerHintSession() {
if (mPowerHintSession != nullptr || mPowerHintThreadIds.empty()) {
ALOGV("Cannot start power hint session, skipping");
return false;
}
auto ret =
mPowerHal->createHintSession(getpid(), static_cast<int32_t>(getuid()),
mPowerHintThreadIds, mTargetDuration, &mPowerHintSession);
if (!ret.isOk()) {
ALOGW("Failed to start power hint session with error: %s",
ret.exceptionToString(ret.exceptionCode()).c_str());
} else {
mLastTargetDurationSent = mTargetDuration;
}
return isPowerHintSessionRunning();
}
bool AidlPowerHalWrapper::shouldSetTargetDuration(int64_t targetDurationNanos) {
if (targetDurationNanos <= 0) {
return false;
}
// report if the change in target from our last submission to now exceeds the threshold
return abs(1.0 -
static_cast<double>(mLastTargetDurationSent) /
static_cast<double>(targetDurationNanos)) >= kAllowedTargetDeviationPercent;
}
void AidlPowerHalWrapper::setTargetWorkDuration(int64_t targetDurationNanos) {
ATRACE_CALL();
mTargetDuration = targetDurationNanos;
if (sTraceHintSessionData) ATRACE_INT64("Time target", targetDurationNanos);
if (!sNormalizeTarget && isPowerHintSessionRunning() &&
shouldSetTargetDuration(targetDurationNanos)) {
if (mLastActualDurationSent.has_value()) {
// update the error term here since we are actually sending an update to powerhal
if (sTraceHintSessionData)
ATRACE_INT64("Target error term", targetDurationNanos - *mLastActualDurationSent);
}
ALOGV("Sending target time: %" PRId64 "ns", targetDurationNanos);
mLastTargetDurationSent = targetDurationNanos;
auto ret = mPowerHintSession->updateTargetWorkDuration(targetDurationNanos);
if (!ret.isOk()) {
ALOGW("Failed to set power hint target work duration with error: %s",
ret.exceptionMessage().c_str());
mShouldReconnectHal = true;
}
}
}
bool AidlPowerHalWrapper::shouldReportActualDurationsNow() {
// report if we have never reported before or are approaching a stale session
if (!mLastActualDurationSent.has_value() ||
(systemTime() - mLastActualReportTimestamp) > kStaleTimeout.count()) {
return true;
}
if (!mActualDuration.has_value()) {
return false;
}
// duration of most recent timing
const double mostRecentActualDuration = static_cast<double>(*mActualDuration);
// duration of the last timing actually reported to the powerhal
const double lastReportedActualDuration = static_cast<double>(*mLastActualDurationSent);
// report if the change in duration from then to now exceeds the threshold
return abs(1.0 - mostRecentActualDuration / lastReportedActualDuration) >=
kAllowedActualDeviationPercent;
}
void AidlPowerHalWrapper::sendActualWorkDuration(int64_t actualDurationNanos,
nsecs_t timeStampNanos) {
ATRACE_CALL();
if (actualDurationNanos < 0 || !isPowerHintSessionRunning()) {
ALOGV("Failed to send actual work duration, skipping");
return;
}
nsecs_t reportedDuration = actualDurationNanos;
// normalize the sent values to a pre-set target
if (sNormalizeTarget) {
reportedDuration += mLastTargetDurationSent - mTargetDuration;
} else {
// when target duration change is within deviation and not updated, adjust the actual
// duration proportionally based on the difference, e.g. if new target is 5ms longer than
// last reported but actual duration is the same as last target, we want to report a smaller
// actual work duration now to indicate that we are overshooting
if (mLastTargetDurationSent != kDefaultTarget.count() && mTargetDuration != 0) {
reportedDuration =
static_cast<int64_t>(static_cast<long double>(mLastTargetDurationSent) /
mTargetDuration * actualDurationNanos);
mActualDuration = reportedDuration;
}
}
mActualDuration = reportedDuration;
WorkDuration duration;
duration.durationNanos = reportedDuration;
duration.timeStampNanos = timeStampNanos;
mPowerHintQueue.push_back(duration);
if (sTraceHintSessionData) {
ATRACE_INT64("Measured duration", actualDurationNanos);
ATRACE_INT64("Target error term", mTargetDuration - actualDurationNanos);
ATRACE_INT64("Reported duration", reportedDuration);
ATRACE_INT64("Reported target", mLastTargetDurationSent);
ATRACE_INT64("Reported target error term", mLastTargetDurationSent - reportedDuration);
}
ALOGV("Sending actual work duration of: %" PRId64 " on reported target: %" PRId64
" with error: %" PRId64,
reportedDuration, mLastTargetDurationSent, mLastTargetDurationSent - reportedDuration);
// This rate limiter queues similar duration reports to the powerhal into
// batches to avoid excessive binder calls. The criteria to send a given batch
// are outlined in shouldReportActualDurationsNow()
if (shouldReportActualDurationsNow()) {
ALOGV("Sending hint update batch");
mLastActualReportTimestamp = systemTime();
auto ret = mPowerHintSession->reportActualWorkDuration(mPowerHintQueue);
if (!ret.isOk()) {
ALOGW("Failed to report actual work durations with error: %s",
ret.exceptionMessage().c_str());
mShouldReconnectHal = true;
}
mPowerHintQueue.clear();
// we save the non-normalized value here to detect % changes
mLastActualDurationSent = reportedDuration;
}
}
bool AidlPowerHalWrapper::shouldReconnectHAL() {
return mShouldReconnectHal;
}
std::vector<int32_t> AidlPowerHalWrapper::getPowerHintSessionThreadIds() {
return mPowerHintThreadIds;
}
std::optional<int64_t> AidlPowerHalWrapper::getTargetWorkDuration() {
return mTargetDuration;
}
const bool AidlPowerHalWrapper::sTraceHintSessionData =
base::GetBoolProperty(std::string("debug.sf.trace_hint_sessions"), false);
const bool AidlPowerHalWrapper::sNormalizeTarget =
base::GetBoolProperty(std::string("debug.sf.normalize_hint_session_durations"), false);
PowerAdvisor::HalWrapper* PowerAdvisor::getPowerHal() {
static std::unique_ptr<HalWrapper> sHalWrapper = nullptr;
static bool sHasHal = true;
if (!sHasHal) {
return nullptr;
}
// grab old hint session values before we destroy any existing wrapper
std::vector<int32_t> oldPowerHintSessionThreadIds;
std::optional<int64_t> oldTargetWorkDuration;
if (sHalWrapper != nullptr) {
oldPowerHintSessionThreadIds = sHalWrapper->getPowerHintSessionThreadIds();
oldTargetWorkDuration = sHalWrapper->getTargetWorkDuration();
}
// If we used to have a HAL, but it stopped responding, attempt to reconnect
if (mReconnectPowerHal) {
sHalWrapper = nullptr;
mReconnectPowerHal = false;
}
if (sHalWrapper != nullptr) {
auto wrapper = sHalWrapper.get();
// if the wrapper is fine, return it, but if it indicates a reconnect, remake it
if (!wrapper->shouldReconnectHAL()) {
return wrapper;
}
ALOGD("Reconnecting Power HAL");
sHalWrapper = nullptr;
}
// at this point, we know for sure there is no running session
mPowerHintSessionRunning = false;
// First attempt to connect to the AIDL Power HAL
sHalWrapper = AidlPowerHalWrapper::connect();
// If that didn't succeed, attempt to connect to the HIDL Power HAL
if (sHalWrapper == nullptr) {
sHalWrapper = HidlPowerHalWrapper::connect();
} else {
ALOGD("Successfully connecting AIDL Power HAL");
// if AIDL, pass on any existing hint session values
// thread ids always safe to set
sHalWrapper->setPowerHintSessionThreadIds(oldPowerHintSessionThreadIds);
// only set duration and start if duration is defined
if (oldTargetWorkDuration.has_value()) {
sHalWrapper->setTargetWorkDuration(*oldTargetWorkDuration);
// only start if possible to run and both threadids and duration are defined
if (usePowerHintSession() && !oldPowerHintSessionThreadIds.empty()) {
mPowerHintSessionRunning = sHalWrapper->startPowerHintSession();
}
}
}
// If we make it to this point and still don't have a HAL, it's unlikely we
// will, so stop trying
if (sHalWrapper == nullptr) {
sHasHal = false;
}
return sHalWrapper.get();
}
} // namespace impl
} // namespace Hwc2
} // namespace android
|