1 /*
2  * Copyright 2020 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 #undef LOG_TAG
18 #define LOG_TAG "LibSurfaceFlingerUnittests"
19 
20 #include "DisplayTransactionTestHelpers.h"
21 
22 #include <gmock/gmock.h>
23 #include <gtest/gtest.h>
24 
25 namespace android {
26 namespace {
27 
28 // Used when we simulate a display that supports doze.
29 template <typename Display>
30 struct DozeIsSupportedVariant {
31     static constexpr bool DOZE_SUPPORTED = true;
32     static constexpr IComposerClient::PowerMode ACTUAL_POWER_MODE_FOR_DOZE =
33             IComposerClient::PowerMode::DOZE;
34     static constexpr IComposerClient::PowerMode ACTUAL_POWER_MODE_FOR_DOZE_SUSPEND =
35             IComposerClient::PowerMode::DOZE_SUSPEND;
36 
setupComposerCallExpectationsandroid::__anon8c4ff8e20110::DozeIsSupportedVariant37     static void setupComposerCallExpectations(DisplayTransactionTest* test) {
38         EXPECT_CALL(*test->mComposer, getDisplayCapabilities(Display::HWC_DISPLAY_ID, _))
39                 .WillOnce(DoAll(SetArgPointee<1>(
40                                         std::vector<DisplayCapability>({DisplayCapability::DOZE})),
41                                 Return(Error::NONE)));
42     }
43 };
44 
45 template <typename Display>
46 // Used when we simulate a display that does not support doze.
47 struct DozeNotSupportedVariant {
48     static constexpr bool DOZE_SUPPORTED = false;
49     static constexpr IComposerClient::PowerMode ACTUAL_POWER_MODE_FOR_DOZE =
50             IComposerClient::PowerMode::ON;
51     static constexpr IComposerClient::PowerMode ACTUAL_POWER_MODE_FOR_DOZE_SUSPEND =
52             IComposerClient::PowerMode::ON;
53 
setupComposerCallExpectationsandroid::__anon8c4ff8e20110::DozeNotSupportedVariant54     static void setupComposerCallExpectations(DisplayTransactionTest* test) {
55         EXPECT_CALL(*test->mComposer, getDisplayCapabilities(Display::HWC_DISPLAY_ID, _))
56                 .WillOnce(DoAll(SetArgPointee<1>(std::vector<DisplayCapability>({})),
57                                 Return(Error::NONE)));
58     }
59 };
60 
61 struct EventThreadBaseSupportedVariant {
setupVsyncAndEventThreadNoCallExpectationsandroid::__anon8c4ff8e20110::EventThreadBaseSupportedVariant62     static void setupVsyncAndEventThreadNoCallExpectations(DisplayTransactionTest* test) {
63         // The callback should not be notified to toggle VSYNC.
64         EXPECT_CALL(test->mSchedulerCallback, setVsyncEnabled(_)).Times(0);
65 
66         // The event thread should not be notified.
67         EXPECT_CALL(*test->mEventThread, onScreenReleased()).Times(0);
68         EXPECT_CALL(*test->mEventThread, onScreenAcquired()).Times(0);
69     }
70 };
71 
72 struct EventThreadNotSupportedVariant : public EventThreadBaseSupportedVariant {
setupAcquireAndEnableVsyncCallExpectationsandroid::__anon8c4ff8e20110::EventThreadNotSupportedVariant73     static void setupAcquireAndEnableVsyncCallExpectations(DisplayTransactionTest* test) {
74         // These calls are only expected for the primary display.
75 
76         // Instead expect no calls.
77         setupVsyncAndEventThreadNoCallExpectations(test);
78     }
79 
setupReleaseAndDisableVsyncCallExpectationsandroid::__anon8c4ff8e20110::EventThreadNotSupportedVariant80     static void setupReleaseAndDisableVsyncCallExpectations(DisplayTransactionTest* test) {
81         // These calls are only expected for the primary display.
82 
83         // Instead expect no calls.
84         setupVsyncAndEventThreadNoCallExpectations(test);
85     }
86 };
87 
88 struct EventThreadIsSupportedVariant : public EventThreadBaseSupportedVariant {
setupAcquireAndEnableVsyncCallExpectationsandroid::__anon8c4ff8e20110::EventThreadIsSupportedVariant89     static void setupAcquireAndEnableVsyncCallExpectations(DisplayTransactionTest* test) {
90         // The callback should be notified to enable VSYNC.
91         EXPECT_CALL(test->mSchedulerCallback, setVsyncEnabled(true)).Times(1);
92 
93         // The event thread should be notified that the screen was acquired.
94         EXPECT_CALL(*test->mEventThread, onScreenAcquired()).Times(1);
95     }
96 
setupReleaseAndDisableVsyncCallExpectationsandroid::__anon8c4ff8e20110::EventThreadIsSupportedVariant97     static void setupReleaseAndDisableVsyncCallExpectations(DisplayTransactionTest* test) {
98         // The callback should be notified to disable VSYNC.
99         EXPECT_CALL(test->mSchedulerCallback, setVsyncEnabled(false)).Times(1);
100 
101         // The event thread should not be notified that the screen was released.
102         EXPECT_CALL(*test->mEventThread, onScreenReleased()).Times(1);
103     }
104 };
105 
106 struct DispSyncIsSupportedVariant {
setupResetModelCallExpectationsandroid::__anon8c4ff8e20110::DispSyncIsSupportedVariant107     static void setupResetModelCallExpectations(DisplayTransactionTest* test) {
108         EXPECT_CALL(*test->mVsyncController, startPeriodTransition(DEFAULT_VSYNC_PERIOD)).Times(1);
109         EXPECT_CALL(*test->mVSyncTracker, resetModel()).Times(1);
110     }
111 };
112 
113 struct DispSyncNotSupportedVariant {
setupResetModelCallExpectationsandroid::__anon8c4ff8e20110::DispSyncNotSupportedVariant114     static void setupResetModelCallExpectations(DisplayTransactionTest* /* test */) {}
115 };
116 
117 // --------------------------------------------------------------------
118 // Note:
119 //
120 // There are a large number of transitions we could test, however we only test a
121 // selected subset which provides complete test coverage of the implementation.
122 // --------------------------------------------------------------------
123 
124 template <PowerMode initialPowerMode, PowerMode targetPowerMode>
125 struct TransitionVariantCommon {
126     static constexpr auto INITIAL_POWER_MODE = initialPowerMode;
127     static constexpr auto TARGET_POWER_MODE = targetPowerMode;
128 
verifyPostconditionsandroid::__anon8c4ff8e20110::TransitionVariantCommon129     static void verifyPostconditions(DisplayTransactionTest*) {}
130 };
131 
132 struct TransitionOffToOnVariant : public TransitionVariantCommon<PowerMode::OFF, PowerMode::ON> {
133     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionOffToOnVariant134     static void setupCallExpectations(DisplayTransactionTest* test) {
135         Case::setupComposerCallExpectations(test, IComposerClient::PowerMode::ON);
136         Case::EventThread::setupAcquireAndEnableVsyncCallExpectations(test);
137         Case::DispSync::setupResetModelCallExpectations(test);
138         Case::setupRepaintEverythingCallExpectations(test);
139     }
140 
verifyPostconditionsandroid::__anon8c4ff8e20110::TransitionOffToOnVariant141     static void verifyPostconditions(DisplayTransactionTest* test) {
142         EXPECT_TRUE(test->mFlinger.getVisibleRegionsDirty());
143         EXPECT_TRUE(test->mFlinger.getHasPoweredOff());
144     }
145 };
146 
147 struct TransitionOffToDozeSuspendVariant
148       : public TransitionVariantCommon<PowerMode::OFF, PowerMode::DOZE_SUSPEND> {
149     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionOffToDozeSuspendVariant150     static void setupCallExpectations(DisplayTransactionTest* test) {
151         Case::setupComposerCallExpectations(test, Case::Doze::ACTUAL_POWER_MODE_FOR_DOZE_SUSPEND);
152         Case::EventThread::setupVsyncAndEventThreadNoCallExpectations(test);
153         Case::setupRepaintEverythingCallExpectations(test);
154     }
155 
verifyPostconditionsandroid::__anon8c4ff8e20110::TransitionOffToDozeSuspendVariant156     static void verifyPostconditions(DisplayTransactionTest* test) {
157         EXPECT_TRUE(test->mFlinger.getVisibleRegionsDirty());
158         EXPECT_TRUE(test->mFlinger.getHasPoweredOff());
159     }
160 };
161 
162 struct TransitionOnToOffVariant : public TransitionVariantCommon<PowerMode::ON, PowerMode::OFF> {
163     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionOnToOffVariant164     static void setupCallExpectations(DisplayTransactionTest* test) {
165         Case::EventThread::setupReleaseAndDisableVsyncCallExpectations(test);
166         Case::setupComposerCallExpectations(test, IComposerClient::PowerMode::OFF);
167     }
168 
verifyPostconditionsandroid::__anon8c4ff8e20110::TransitionOnToOffVariant169     static void verifyPostconditions(DisplayTransactionTest* test) {
170         EXPECT_TRUE(test->mFlinger.getVisibleRegionsDirty());
171     }
172 };
173 
174 struct TransitionDozeSuspendToOffVariant
175       : public TransitionVariantCommon<PowerMode::DOZE_SUSPEND, PowerMode::OFF> {
176     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionDozeSuspendToOffVariant177     static void setupCallExpectations(DisplayTransactionTest* test) {
178         Case::EventThread::setupVsyncAndEventThreadNoCallExpectations(test);
179         Case::setupComposerCallExpectations(test, IComposerClient::PowerMode::OFF);
180     }
181 
verifyPostconditionsandroid::__anon8c4ff8e20110::TransitionDozeSuspendToOffVariant182     static void verifyPostconditions(DisplayTransactionTest* test) {
183         EXPECT_TRUE(test->mFlinger.getVisibleRegionsDirty());
184     }
185 };
186 
187 struct TransitionOnToDozeVariant : public TransitionVariantCommon<PowerMode::ON, PowerMode::DOZE> {
188     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionOnToDozeVariant189     static void setupCallExpectations(DisplayTransactionTest* test) {
190         Case::EventThread::setupVsyncAndEventThreadNoCallExpectations(test);
191         Case::setupComposerCallExpectations(test, Case::Doze::ACTUAL_POWER_MODE_FOR_DOZE);
192     }
193 };
194 
195 struct TransitionDozeSuspendToDozeVariant
196       : public TransitionVariantCommon<PowerMode::DOZE_SUSPEND, PowerMode::DOZE> {
197     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionDozeSuspendToDozeVariant198     static void setupCallExpectations(DisplayTransactionTest* test) {
199         Case::EventThread::setupAcquireAndEnableVsyncCallExpectations(test);
200         Case::DispSync::setupResetModelCallExpectations(test);
201         Case::setupComposerCallExpectations(test, Case::Doze::ACTUAL_POWER_MODE_FOR_DOZE);
202     }
203 };
204 
205 struct TransitionDozeToOnVariant : public TransitionVariantCommon<PowerMode::DOZE, PowerMode::ON> {
206     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionDozeToOnVariant207     static void setupCallExpectations(DisplayTransactionTest* test) {
208         Case::EventThread::setupVsyncAndEventThreadNoCallExpectations(test);
209         Case::setupComposerCallExpectations(test, IComposerClient::PowerMode::ON);
210     }
211 };
212 
213 struct TransitionDozeSuspendToOnVariant
214       : public TransitionVariantCommon<PowerMode::DOZE_SUSPEND, PowerMode::ON> {
215     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionDozeSuspendToOnVariant216     static void setupCallExpectations(DisplayTransactionTest* test) {
217         Case::EventThread::setupAcquireAndEnableVsyncCallExpectations(test);
218         Case::DispSync::setupResetModelCallExpectations(test);
219         Case::setupComposerCallExpectations(test, IComposerClient::PowerMode::ON);
220     }
221 };
222 
223 struct TransitionOnToDozeSuspendVariant
224       : public TransitionVariantCommon<PowerMode::ON, PowerMode::DOZE_SUSPEND> {
225     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionOnToDozeSuspendVariant226     static void setupCallExpectations(DisplayTransactionTest* test) {
227         Case::EventThread::setupReleaseAndDisableVsyncCallExpectations(test);
228         Case::setupComposerCallExpectations(test, Case::Doze::ACTUAL_POWER_MODE_FOR_DOZE_SUSPEND);
229     }
230 };
231 
232 struct TransitionOnToUnknownVariant
233       : public TransitionVariantCommon<PowerMode::ON, static_cast<PowerMode>(POWER_MODE_LEET)> {
234     template <typename Case>
setupCallExpectationsandroid::__anon8c4ff8e20110::TransitionOnToUnknownVariant235     static void setupCallExpectations(DisplayTransactionTest* test) {
236         Case::EventThread::setupVsyncAndEventThreadNoCallExpectations(test);
237         Case::setupNoComposerPowerModeCallExpectations(test);
238     }
239 };
240 
241 // --------------------------------------------------------------------
242 // Note:
243 //
244 // Rather than testing the cartesian product of
245 // DozeIsSupported/DozeNotSupported with all other options, we use one for one
246 // display type, and the other for another display type.
247 // --------------------------------------------------------------------
248 
249 template <typename DisplayVariant, typename DozeVariant, typename EventThreadVariant,
250           typename DispSyncVariant, typename TransitionVariant>
251 struct DisplayPowerCase {
252     using Display = DisplayVariant;
253     using Doze = DozeVariant;
254     using EventThread = EventThreadVariant;
255     using DispSync = DispSyncVariant;
256     using Transition = TransitionVariant;
257 
injectDisplayWithInitialPowerModeandroid::__anon8c4ff8e20110::DisplayPowerCase258     static auto injectDisplayWithInitialPowerMode(DisplayTransactionTest* test, PowerMode mode) {
259         Display::injectHwcDisplayWithNoDefaultCapabilities(test);
260         auto display = Display::makeFakeExistingDisplayInjector(test);
261         display.inject();
262         display.mutableDisplayDevice()->setPowerMode(mode);
263         if (display.mutableDisplayDevice()->isInternal()) {
264             test->mFlinger.mutableActiveDisplayToken() =
265                     display.mutableDisplayDevice()->getDisplayToken();
266         }
267 
268         return display;
269     }
270 
setInitialPrimaryHWVsyncEnabledandroid::__anon8c4ff8e20110::DisplayPowerCase271     static void setInitialPrimaryHWVsyncEnabled(DisplayTransactionTest* test, bool enabled) {
272         test->mFlinger.scheduler()->mutablePrimaryHWVsyncEnabled() = enabled;
273     }
274 
setupRepaintEverythingCallExpectationsandroid::__anon8c4ff8e20110::DisplayPowerCase275     static void setupRepaintEverythingCallExpectations(DisplayTransactionTest* test) {
276         EXPECT_CALL(*test->mMessageQueue, invalidate()).Times(1);
277     }
278 
setupSurfaceInterceptorCallExpectationsandroid::__anon8c4ff8e20110::DisplayPowerCase279     static void setupSurfaceInterceptorCallExpectations(DisplayTransactionTest* test,
280                                                         PowerMode mode) {
281         EXPECT_CALL(*test->mSurfaceInterceptor, isEnabled()).WillOnce(Return(true));
282         EXPECT_CALL(*test->mSurfaceInterceptor, savePowerModeUpdate(_, static_cast<int32_t>(mode)))
283                 .Times(1);
284     }
285 
setupComposerCallExpectationsandroid::__anon8c4ff8e20110::DisplayPowerCase286     static void setupComposerCallExpectations(DisplayTransactionTest* test, PowerMode mode) {
287         // Any calls to get the active config will return a default value.
288         EXPECT_CALL(*test->mComposer, getActiveConfig(Display::HWC_DISPLAY_ID, _))
289                 .WillRepeatedly(DoAll(SetArgPointee<1>(Display::HWC_ACTIVE_CONFIG_ID),
290                                       Return(Error::NONE)));
291 
292         // Any calls to get whether the display supports dozing will return the value set by the
293         // policy variant.
294         EXPECT_CALL(*test->mComposer, getDozeSupport(Display::HWC_DISPLAY_ID, _))
295                 .WillRepeatedly(DoAll(SetArgPointee<1>(Doze::DOZE_SUPPORTED), Return(Error::NONE)));
296 
297         EXPECT_CALL(*test->mComposer, setPowerMode(Display::HWC_DISPLAY_ID, mode)).Times(1);
298     }
299 
setupNoComposerPowerModeCallExpectationsandroid::__anon8c4ff8e20110::DisplayPowerCase300     static void setupNoComposerPowerModeCallExpectations(DisplayTransactionTest* test) {
301         EXPECT_CALL(*test->mComposer, setPowerMode(Display::HWC_DISPLAY_ID, _)).Times(0);
302     }
303 };
304 
305 // A sample configuration for the primary display.
306 // In addition to having event thread support, we emulate doze support.
307 template <typename TransitionVariant>
308 using PrimaryDisplayPowerCase =
309         DisplayPowerCase<PrimaryDisplayVariant, DozeIsSupportedVariant<PrimaryDisplayVariant>,
310                          EventThreadIsSupportedVariant, DispSyncIsSupportedVariant,
311                          TransitionVariant>;
312 
313 // A sample configuration for the external display.
314 // In addition to not having event thread support, we emulate not having doze
315 // support.
316 template <typename TransitionVariant>
317 using ExternalDisplayPowerCase =
318         DisplayPowerCase<ExternalDisplayVariant, DozeNotSupportedVariant<ExternalDisplayVariant>,
319                          EventThreadNotSupportedVariant, DispSyncNotSupportedVariant,
320                          TransitionVariant>;
321 
322 class SetPowerModeInternalTest : public DisplayTransactionTest {
323 public:
324     template <typename Case>
325     void transitionDisplayCommon();
326 };
327 
328 template <PowerMode PowerMode>
329 struct PowerModeInitialVSyncEnabled : public std::false_type {};
330 
331 template <>
332 struct PowerModeInitialVSyncEnabled<PowerMode::ON> : public std::true_type {};
333 
334 template <>
335 struct PowerModeInitialVSyncEnabled<PowerMode::DOZE> : public std::true_type {};
336 
337 template <typename Case>
transitionDisplayCommon()338 void SetPowerModeInternalTest::transitionDisplayCommon() {
339     // --------------------------------------------------------------------
340     // Preconditions
341 
342     Case::Doze::setupComposerCallExpectations(this);
343     auto display =
344             Case::injectDisplayWithInitialPowerMode(this, Case::Transition::INITIAL_POWER_MODE);
345     Case::setInitialPrimaryHWVsyncEnabled(this,
346                                           PowerModeInitialVSyncEnabled<
347                                                   Case::Transition::INITIAL_POWER_MODE>::value);
348 
349     // --------------------------------------------------------------------
350     // Call Expectations
351 
352     Case::setupSurfaceInterceptorCallExpectations(this, Case::Transition::TARGET_POWER_MODE);
353     Case::Transition::template setupCallExpectations<Case>(this);
354 
355     // --------------------------------------------------------------------
356     // Invocation
357 
358     mFlinger.setPowerModeInternal(display.mutableDisplayDevice(),
359                                   Case::Transition::TARGET_POWER_MODE);
360 
361     // --------------------------------------------------------------------
362     // Postconditions
363 
364     Case::Transition::verifyPostconditions(this);
365 }
366 
TEST_F(SetPowerModeInternalTest,setPowerModeInternalDoesNothingIfNoChange)367 TEST_F(SetPowerModeInternalTest, setPowerModeInternalDoesNothingIfNoChange) {
368     using Case = SimplePrimaryDisplayCase;
369 
370     // --------------------------------------------------------------------
371     // Preconditions
372 
373     // A primary display device is set up
374     Case::Display::injectHwcDisplay(this);
375     auto display = Case::Display::makeFakeExistingDisplayInjector(this);
376     display.inject();
377 
378     // The display is already set to PowerMode::ON
379     display.mutableDisplayDevice()->setPowerMode(PowerMode::ON);
380 
381     // --------------------------------------------------------------------
382     // Invocation
383 
384     mFlinger.setPowerModeInternal(display.mutableDisplayDevice(), PowerMode::ON);
385 
386     // --------------------------------------------------------------------
387     // Postconditions
388 
389     EXPECT_EQ(PowerMode::ON, display.mutableDisplayDevice()->getPowerMode());
390 }
391 
TEST_F(SetPowerModeInternalTest,setPowerModeInternalDoesNothingIfVirtualDisplay)392 TEST_F(SetPowerModeInternalTest, setPowerModeInternalDoesNothingIfVirtualDisplay) {
393     using Case = HwcVirtualDisplayCase;
394 
395     // --------------------------------------------------------------------
396     // Preconditions
397 
398     // Insert display data so that the HWC thinks it created the virtual display.
399     const auto displayId = Case::Display::DISPLAY_ID::get();
400     ASSERT_TRUE(HalVirtualDisplayId::tryCast(displayId));
401     mFlinger.mutableHwcDisplayData().try_emplace(displayId);
402 
403     // A virtual display device is set up
404     Case::Display::injectHwcDisplay(this);
405     auto display = Case::Display::makeFakeExistingDisplayInjector(this);
406     display.inject();
407 
408     // The display is set to PowerMode::ON
409     getDisplayDevice(display.token())->setPowerMode(PowerMode::ON);
410 
411     // --------------------------------------------------------------------
412     // Invocation
413 
414     mFlinger.setPowerModeInternal(display.mutableDisplayDevice(), PowerMode::OFF);
415 
416     // --------------------------------------------------------------------
417     // Postconditions
418 
419     EXPECT_EQ(PowerMode::ON, display.mutableDisplayDevice()->getPowerMode());
420 }
421 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOffToOnPrimaryDisplay)422 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToOnPrimaryDisplay) {
423     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOffToOnVariant>>();
424 }
425 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOffToDozeSuspendPrimaryDisplay)426 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToDozeSuspendPrimaryDisplay) {
427     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOffToDozeSuspendVariant>>();
428 }
429 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToOffPrimaryDisplay)430 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToOffPrimaryDisplay) {
431     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOnToOffVariant>>();
432 }
433 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeSuspendToOffPrimaryDisplay)434 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToOffPrimaryDisplay) {
435     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionDozeSuspendToOffVariant>>();
436 }
437 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToDozePrimaryDisplay)438 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozePrimaryDisplay) {
439     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOnToDozeVariant>>();
440 }
441 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeSuspendToDozePrimaryDisplay)442 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToDozePrimaryDisplay) {
443     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionDozeSuspendToDozeVariant>>();
444 }
445 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeToOnPrimaryDisplay)446 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeToOnPrimaryDisplay) {
447     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionDozeToOnVariant>>();
448 }
449 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeSuspendToOnPrimaryDisplay)450 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToOnPrimaryDisplay) {
451     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionDozeSuspendToOnVariant>>();
452 }
453 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToDozeSuspendPrimaryDisplay)454 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozeSuspendPrimaryDisplay) {
455     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOnToDozeSuspendVariant>>();
456 }
457 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToUnknownPrimaryDisplay)458 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToUnknownPrimaryDisplay) {
459     transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOnToUnknownVariant>>();
460 }
461 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOffToOnExternalDisplay)462 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToOnExternalDisplay) {
463     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToOnVariant>>();
464 }
465 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOffToDozeSuspendExternalDisplay)466 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToDozeSuspendExternalDisplay) {
467     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToDozeSuspendVariant>>();
468 }
469 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToOffExternalDisplay)470 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToOffExternalDisplay) {
471     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToOffVariant>>();
472 }
473 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeSuspendToOffExternalDisplay)474 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToOffExternalDisplay) {
475     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeSuspendToOffVariant>>();
476 }
477 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToDozeExternalDisplay)478 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozeExternalDisplay) {
479     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToDozeVariant>>();
480 }
481 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeSuspendToDozeExternalDisplay)482 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToDozeExternalDisplay) {
483     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeSuspendToDozeVariant>>();
484 }
485 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeToOnExternalDisplay)486 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeToOnExternalDisplay) {
487     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeToOnVariant>>();
488 }
489 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromDozeSuspendToOnExternalDisplay)490 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromDozeSuspendToOnExternalDisplay) {
491     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionDozeSuspendToOnVariant>>();
492 }
493 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToDozeSuspendExternalDisplay)494 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToDozeSuspendExternalDisplay) {
495     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToDozeSuspendVariant>>();
496 }
497 
TEST_F(SetPowerModeInternalTest,transitionsDisplayFromOnToUnknownExternalDisplay)498 TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToUnknownExternalDisplay) {
499     transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOnToUnknownVariant>>();
500 }
501 
502 } // namespace
503 } // namespace android
504