1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the
10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11  * KIND, either express or implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */
14 
15 package com.android.systemui.statusbar;
16 
17 import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
18 import static android.inputmethodservice.InputMethodService.BACK_DISPOSITION_DEFAULT;
19 import static android.inputmethodservice.InputMethodService.IME_INVISIBLE;
20 import static android.view.Display.DEFAULT_DISPLAY;
21 import static android.view.WindowInsetsController.BEHAVIOR_DEFAULT;
22 
23 import static org.mockito.ArgumentMatchers.anyInt;
24 import static org.mockito.Matchers.eq;
25 import static org.mockito.Mockito.mock;
26 import static org.mockito.Mockito.verify;
27 import static org.mockito.Mockito.verifyNoMoreInteractions;
28 import static org.mockito.Mockito.verifyZeroInteractions;
29 
30 import android.content.ComponentName;
31 import android.graphics.Rect;
32 import android.hardware.biometrics.IBiometricSysuiReceiver;
33 import android.hardware.biometrics.PromptInfo;
34 import android.hardware.fingerprint.IUdfpsRefreshRateRequestCallback;
35 import android.os.Bundle;
36 import android.platform.test.annotations.DisableFlags;
37 import android.platform.test.annotations.EnableFlags;
38 import android.view.KeyEvent;
39 import android.view.WindowInsets;
40 import android.view.WindowInsets.Type.InsetsType;
41 import android.view.WindowInsetsController.Appearance;
42 import android.view.WindowInsetsController.Behavior;
43 import android.view.accessibility.Flags;
44 
45 import androidx.test.filters.SmallTest;
46 
47 import com.android.internal.statusbar.LetterboxDetails;
48 import com.android.internal.statusbar.StatusBarIcon;
49 import com.android.internal.view.AppearanceRegion;
50 import com.android.systemui.SysuiTestCase;
51 import com.android.systemui.settings.FakeDisplayTracker;
52 import com.android.systemui.statusbar.CommandQueue.Callbacks;
53 
54 import org.junit.After;
55 import org.junit.Before;
56 import org.junit.Test;
57 
58 @SmallTest
59 public class CommandQueueTest extends SysuiTestCase {
60 
61     private static final LetterboxDetails[] TEST_LETTERBOX_DETAILS = new LetterboxDetails[] {
62             new LetterboxDetails(
63                     /* letterboxInnerBounds= */ new Rect(100, 0, 200, 500),
64                     /* letterboxFullBounds= */ new Rect(0, 0, 500, 100),
65                     /* appAppearance= */ 123)
66     };
67 
68     private CommandQueue mCommandQueue;
69     private FakeDisplayTracker mDisplayTracker = new FakeDisplayTracker(mContext);
70     private Callbacks mCallbacks;
71     private static final int SECONDARY_DISPLAY = 1;
72 
73     @Before
setup()74     public void setup() {
75         mCommandQueue = new CommandQueue(mContext, mDisplayTracker);
76         mCallbacks = mock(Callbacks.class);
77         mCommandQueue.addCallback(mCallbacks);
78         verify(mCallbacks).disable(anyInt(), eq(0), eq(0), eq(false));
79     }
80 
81     @After
tearDown()82     public void tearDown() {
83         verifyNoMoreInteractions(mCallbacks);
84     }
85 
86     @Test
testIcon()87     public void testIcon() {
88         String slot = "testSlot";
89         StatusBarIcon icon = mock(StatusBarIcon.class);
90         mCommandQueue.setIcon(slot, icon);
91         waitForIdleSync();
92         verify(mCallbacks).setIcon(eq(slot), eq(icon));
93 
94         mCommandQueue.removeIcon(slot);
95         waitForIdleSync();
96         verify(mCallbacks).removeIcon(eq(slot));
97     }
98 
99     @Test
testDisable()100     public void testDisable() {
101         int state1 = 14;
102         int state2 = 42;
103         mCommandQueue.disable(DEFAULT_DISPLAY, state1, state2);
104         waitForIdleSync();
105         verify(mCallbacks).disable(eq(DEFAULT_DISPLAY), eq(state1), eq(state2), eq(true));
106     }
107 
108     @Test
testDisableForSecondaryDisplay()109     public void testDisableForSecondaryDisplay() {
110         int state1 = 14;
111         int state2 = 42;
112         mCommandQueue.disable(SECONDARY_DISPLAY, state1, state2);
113         waitForIdleSync();
114         verify(mCallbacks).disable(eq(SECONDARY_DISPLAY), eq(state1), eq(state2), eq(true));
115     }
116 
117     @Test
testExpandNotifications()118     public void testExpandNotifications() {
119         mCommandQueue.animateExpandNotificationsPanel();
120         waitForIdleSync();
121         verify(mCallbacks).animateExpandNotificationsPanel();
122     }
123 
124     @Test
testExpandSettings()125     public void testExpandSettings() {
126         String panel = "some_panel";
127         mCommandQueue.animateExpandSettingsPanel(panel);
128         waitForIdleSync();
129         verify(mCallbacks).animateExpandSettingsPanel(eq(panel));
130     }
131 
132     @Test
testOnSystemBarAttributesChanged()133     public void testOnSystemBarAttributesChanged() {
134         doTestOnSystemBarAttributesChanged(DEFAULT_DISPLAY, 1,
135                 new AppearanceRegion[]{new AppearanceRegion(2, new Rect())}, false,
136                 BEHAVIOR_DEFAULT, WindowInsets.Type.defaultVisible(), "test",
137                 TEST_LETTERBOX_DETAILS);
138     }
139 
140     @Test
testOnSystemBarAttributesChangedForSecondaryDisplay()141     public void testOnSystemBarAttributesChangedForSecondaryDisplay() {
142         doTestOnSystemBarAttributesChanged(SECONDARY_DISPLAY, 1,
143                 new AppearanceRegion[]{new AppearanceRegion(2, new Rect())}, false,
144                 BEHAVIOR_DEFAULT, WindowInsets.Type.defaultVisible(), "test",
145                 TEST_LETTERBOX_DETAILS);
146     }
147 
doTestOnSystemBarAttributesChanged(int displayId, @Appearance int appearance, AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme, @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName, LetterboxDetails[] letterboxDetails)148     private void doTestOnSystemBarAttributesChanged(int displayId, @Appearance int appearance,
149             AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme,
150             @Behavior int behavior, @InsetsType int requestedVisibleTypes, String packageName,
151             LetterboxDetails[] letterboxDetails) {
152         mCommandQueue.onSystemBarAttributesChanged(displayId, appearance, appearanceRegions,
153                 navbarColorManagedByIme, behavior, requestedVisibleTypes, packageName,
154                 letterboxDetails);
155         waitForIdleSync();
156         verify(mCallbacks).onSystemBarAttributesChanged(eq(displayId), eq(appearance),
157                 eq(appearanceRegions), eq(navbarColorManagedByIme), eq(behavior),
158                 eq(requestedVisibleTypes), eq(packageName), eq(letterboxDetails));
159     }
160 
161     @Test
testShowTransient()162     public void testShowTransient() {
163         int types = WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars();
164         mCommandQueue.showTransient(DEFAULT_DISPLAY, types, true /* isGestureOnSystemBar */);
165         waitForIdleSync();
166         verify(mCallbacks).showTransient(eq(DEFAULT_DISPLAY), eq(types), eq(true));
167     }
168 
169     @Test
testShowTransientForSecondaryDisplay()170     public void testShowTransientForSecondaryDisplay() {
171         int types = WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars();
172         mCommandQueue.showTransient(SECONDARY_DISPLAY, types, true /* isGestureOnSystemBar */);
173         waitForIdleSync();
174         verify(mCallbacks).showTransient(eq(SECONDARY_DISPLAY), eq(types), eq(true));
175     }
176 
177     @Test
testAbortTransient()178     public void testAbortTransient() {
179         int types = WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars();
180         mCommandQueue.abortTransient(DEFAULT_DISPLAY, types);
181         waitForIdleSync();
182         verify(mCallbacks).abortTransient(eq(DEFAULT_DISPLAY), eq(types));
183     }
184 
185     @Test
testAbortTransientForSecondaryDisplay()186     public void testAbortTransientForSecondaryDisplay() {
187         int types = WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars();
188         mCommandQueue.abortTransient(SECONDARY_DISPLAY, types);
189         waitForIdleSync();
190         verify(mCallbacks).abortTransient(eq(SECONDARY_DISPLAY), eq(types));
191     }
192 
193     @Test
testShowImeButton()194     public void testShowImeButton() {
195         mCommandQueue.setImeWindowStatus(DEFAULT_DISPLAY, null, 1, 2, true);
196         waitForIdleSync();
197         verify(mCallbacks).setImeWindowStatus(
198                 eq(DEFAULT_DISPLAY), eq(null), eq(1), eq(2), eq(true));
199     }
200 
201     @Test
testShowImeButtonForSecondaryDisplay()202     public void testShowImeButtonForSecondaryDisplay() {
203         // First show in default display to update the "last updated ime display"
204         testShowImeButton();
205 
206         mCommandQueue.setImeWindowStatus(SECONDARY_DISPLAY, null, 1, 2, true);
207         waitForIdleSync();
208         verify(mCallbacks).setImeWindowStatus(eq(DEFAULT_DISPLAY), eq(null), eq(IME_INVISIBLE),
209                 eq(BACK_DISPOSITION_DEFAULT), eq(false));
210         verify(mCallbacks).setImeWindowStatus(
211                 eq(SECONDARY_DISPLAY), eq(null), eq(1), eq(2), eq(true));
212     }
213 
214     @Test
testShowRecentApps()215     public void testShowRecentApps() {
216         mCommandQueue.showRecentApps(true);
217         waitForIdleSync();
218         verify(mCallbacks).showRecentApps(eq(true));
219     }
220 
221     @Test
testHideRecentApps()222     public void testHideRecentApps() {
223         mCommandQueue.hideRecentApps(true, false);
224         waitForIdleSync();
225         verify(mCallbacks).hideRecentApps(eq(true), eq(false));
226     }
227 
228     @Test
testToggleRecentApps()229     public void testToggleRecentApps() {
230         mCommandQueue.toggleRecentApps();
231         waitForIdleSync();
232         verify(mCallbacks).toggleRecentApps();
233     }
234 
235     @Test
testPreloadRecentApps()236     public void testPreloadRecentApps() {
237         mCommandQueue.preloadRecentApps();
238         waitForIdleSync();
239         verify(mCallbacks).preloadRecentApps();
240     }
241 
242     @Test
testCancelPreloadRecentApps()243     public void testCancelPreloadRecentApps() {
244         mCommandQueue.cancelPreloadRecentApps();
245         waitForIdleSync();
246         verify(mCallbacks).cancelPreloadRecentApps();
247     }
248 
249     @Test
testDismissKeyboardShortcuts()250     public void testDismissKeyboardShortcuts() {
251         mCommandQueue.dismissKeyboardShortcutsMenu();
252         waitForIdleSync();
253         verify(mCallbacks).dismissKeyboardShortcutsMenu();
254     }
255 
256     @Test
testToggleKeyboardShortcuts()257     public void testToggleKeyboardShortcuts() {
258         mCommandQueue.toggleKeyboardShortcutsMenu(1);
259         waitForIdleSync();
260         verify(mCallbacks).toggleKeyboardShortcutsMenu(eq(1));
261     }
262 
263     @Test
testSetWindowState()264     public void testSetWindowState() {
265         mCommandQueue.setWindowState(DEFAULT_DISPLAY, 1, 2);
266         waitForIdleSync();
267         verify(mCallbacks).setWindowState(eq(DEFAULT_DISPLAY), eq(1), eq(2));
268     }
269 
270     @Test
testSetWindowStateForSecondaryDisplay()271     public void testSetWindowStateForSecondaryDisplay() {
272         mCommandQueue.setWindowState(SECONDARY_DISPLAY, 1, 2);
273         waitForIdleSync();
274         verify(mCallbacks).setWindowState(eq(SECONDARY_DISPLAY), eq(1), eq(2));
275     }
276 
277     @Test
testScreenPinRequest()278     public void testScreenPinRequest() {
279         mCommandQueue.showScreenPinningRequest(1);
280         waitForIdleSync();
281         verify(mCallbacks).showScreenPinningRequest(eq(1));
282     }
283 
284     @Test
testAppTransitionPending()285     public void testAppTransitionPending() {
286         mCommandQueue.appTransitionPending(DEFAULT_DISPLAY);
287         waitForIdleSync();
288         verify(mCallbacks).appTransitionPending(eq(DEFAULT_DISPLAY), eq(false));
289     }
290 
291     @Test
testAppTransitionPendingForSecondaryDisplay()292     public void testAppTransitionPendingForSecondaryDisplay() {
293         mCommandQueue.appTransitionPending(SECONDARY_DISPLAY);
294         waitForIdleSync();
295         verify(mCallbacks).appTransitionPending(eq(SECONDARY_DISPLAY), eq(false));
296     }
297 
298     @Test
testAppTransitionCancelled()299     public void testAppTransitionCancelled() {
300         mCommandQueue.appTransitionCancelled(DEFAULT_DISPLAY);
301         waitForIdleSync();
302         verify(mCallbacks).appTransitionCancelled(eq(DEFAULT_DISPLAY));
303     }
304 
305     @Test
testAppTransitionCancelledForSecondaryDisplay()306     public void testAppTransitionCancelledForSecondaryDisplay() {
307         mCommandQueue.appTransitionCancelled(SECONDARY_DISPLAY);
308         waitForIdleSync();
309         verify(mCallbacks).appTransitionCancelled(eq(SECONDARY_DISPLAY));
310     }
311 
312     @Test
testAppTransitionStarting()313     public void testAppTransitionStarting() {
314         mCommandQueue.appTransitionStarting(DEFAULT_DISPLAY, 1, 2);
315         waitForIdleSync();
316         verify(mCallbacks).appTransitionStarting(
317                 eq(DEFAULT_DISPLAY), eq(1L), eq(2L), eq(false));
318     }
319 
320     @Test
testAppTransitionStartingForSecondaryDisplay()321     public void testAppTransitionStartingForSecondaryDisplay() {
322         mCommandQueue.appTransitionStarting(SECONDARY_DISPLAY, 1, 2);
323         waitForIdleSync();
324         verify(mCallbacks).appTransitionStarting(
325                 eq(SECONDARY_DISPLAY), eq(1L), eq(2L), eq(false));
326     }
327 
328     @Test
testAppTransitionFinished()329     public void testAppTransitionFinished() {
330         mCommandQueue.appTransitionFinished(DEFAULT_DISPLAY);
331         waitForIdleSync();
332         verify(mCallbacks).appTransitionFinished(eq(DEFAULT_DISPLAY));
333     }
334 
335     @Test
testAppTransitionFinishedForSecondaryDisplay()336     public void testAppTransitionFinishedForSecondaryDisplay() {
337         mCommandQueue.appTransitionFinished(SECONDARY_DISPLAY);
338         waitForIdleSync();
339         verify(mCallbacks).appTransitionFinished(eq(SECONDARY_DISPLAY));
340     }
341 
342     @Test
testAssistDisclosure()343     public void testAssistDisclosure() {
344         mCommandQueue.showAssistDisclosure();
345         waitForIdleSync();
346         verify(mCallbacks).showAssistDisclosure();
347     }
348 
349     @Test
testStartAssist()350     public void testStartAssist() {
351         Bundle b = new Bundle();
352         mCommandQueue.startAssist(b);
353         waitForIdleSync();
354         verify(mCallbacks).startAssist(eq(b));
355     }
356 
357     @Test
testCameraLaunchGesture()358     public void testCameraLaunchGesture() {
359         mCommandQueue.onCameraLaunchGestureDetected(1);
360         waitForIdleSync();
361         verify(mCallbacks).onCameraLaunchGestureDetected(eq(1));
362     }
363 
364     @Test
testShowPipMenu()365     public void testShowPipMenu() {
366         mCommandQueue.showPictureInPictureMenu();
367         waitForIdleSync();
368         verify(mCallbacks).showPictureInPictureMenu();
369     }
370 
371     @Test
372     @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
addQsTile_withA11yQsShortcutFlagOff()373     public void addQsTile_withA11yQsShortcutFlagOff() {
374         ComponentName c = new ComponentName("testpkg", "testcls");
375 
376         mCommandQueue.addQsTile(c);
377         waitForIdleSync();
378 
379         verify(mCallbacks).addQsTile(eq(c));
380     }
381 
382     @Test
383     @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
addQsTileToFrontOrEnd_withA11yQsShortcutFlagOff_doNothing()384     public void addQsTileToFrontOrEnd_withA11yQsShortcutFlagOff_doNothing() {
385         ComponentName c = new ComponentName("testpkg", "testcls");
386 
387         mCommandQueue.addQsTileToFrontOrEnd(c, true);
388         waitForIdleSync();
389 
390         verifyZeroInteractions(mCallbacks);
391     }
392 
393     @Test
394     @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
addQsTile_withA11yQsShortcutFlagOn()395     public void addQsTile_withA11yQsShortcutFlagOn() {
396         ComponentName c = new ComponentName("testpkg", "testcls");
397 
398         mCommandQueue.addQsTile(c);
399         waitForIdleSync();
400 
401         verify(mCallbacks).addQsTileToFrontOrEnd(eq(c), eq(false));
402     }
403 
404     @Test
405     @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
addQsTileAtTheEnd_withA11yQsShortcutFlagOn()406     public void addQsTileAtTheEnd_withA11yQsShortcutFlagOn() {
407         ComponentName c = new ComponentName("testpkg", "testcls");
408 
409         mCommandQueue.addQsTileToFrontOrEnd(c, true);
410         waitForIdleSync();
411 
412         verify(mCallbacks).addQsTileToFrontOrEnd(eq(c), eq(true));
413     }
414 
415     @Test
testRemoveQsTile()416     public void testRemoveQsTile() {
417         ComponentName c = new ComponentName("testpkg", "testcls");
418         mCommandQueue.remQsTile(c);
419         waitForIdleSync();
420         verify(mCallbacks).remQsTile(eq(c));
421     }
422 
423     @Test
testClickQsTile()424     public void testClickQsTile() {
425         ComponentName c = new ComponentName("testpkg", "testcls");
426         mCommandQueue.clickQsTile(c);
427         waitForIdleSync();
428         verify(mCallbacks).clickTile(eq(c));
429     }
430 
431     @Test
testToggleAppSplitScreen()432     public void testToggleAppSplitScreen() {
433         mCommandQueue.toggleSplitScreen();
434         waitForIdleSync();
435         verify(mCallbacks).toggleSplitScreen();
436     }
437 
438     @Test
testHandleSysKey()439     public void testHandleSysKey() {
440         KeyEvent testEvent = new KeyEvent(1, 1);
441         mCommandQueue.handleSystemKey(testEvent);
442         waitForIdleSync();
443         verify(mCallbacks).handleSystemKey(eq(testEvent));
444     }
445 
446     @Test
testOnDisplayReady()447     public void testOnDisplayReady() {
448         mCommandQueue.onDisplayReady(DEFAULT_DISPLAY);
449         waitForIdleSync();
450         verify(mCallbacks).onDisplayReady(eq(DEFAULT_DISPLAY));
451     }
452 
453     @Test
testOnDisplayReadyForSecondaryDisplay()454     public void testOnDisplayReadyForSecondaryDisplay() {
455         mCommandQueue.onDisplayReady(SECONDARY_DISPLAY);
456         waitForIdleSync();
457         verify(mCallbacks).onDisplayReady(eq(SECONDARY_DISPLAY));
458     }
459 
460     @Test
testOnDisplayRemoved()461     public void testOnDisplayRemoved() {
462         mDisplayTracker.triggerOnDisplayRemoved(SECONDARY_DISPLAY);
463         waitForIdleSync();
464         verify(mCallbacks).onDisplayRemoved(eq(SECONDARY_DISPLAY));
465     }
466 
467     @Test
testOnRecentsAnimationStateChanged()468     public void testOnRecentsAnimationStateChanged() {
469         mCommandQueue.onRecentsAnimationStateChanged(true);
470         waitForIdleSync();
471         verify(mCallbacks).onRecentsAnimationStateChanged(eq(true));
472     }
473 
474     @Test
testShowAuthenticationDialog()475     public void testShowAuthenticationDialog() {
476         PromptInfo promptInfo = new PromptInfo();
477         final IBiometricSysuiReceiver receiver = mock(IBiometricSysuiReceiver.class);
478         final int[] sensorIds = {1, 2};
479         final boolean credentialAllowed = true;
480         final boolean requireConfirmation = true;
481         final int userId = 10;
482         final long operationId = 1;
483         final String packageName = "test";
484         final long requestId = 10;
485 
486         mCommandQueue.showAuthenticationDialog(promptInfo, receiver, sensorIds,
487                 credentialAllowed, requireConfirmation, userId, operationId, packageName, requestId);
488         waitForIdleSync();
489         verify(mCallbacks).showAuthenticationDialog(eq(promptInfo), eq(receiver), eq(sensorIds),
490                 eq(credentialAllowed), eq(requireConfirmation), eq(userId), eq(operationId),
491                 eq(packageName), eq(requestId));
492     }
493 
494     @Test
testOnBiometricAuthenticated()495     public void testOnBiometricAuthenticated() {
496         final int id = 12;
497         mCommandQueue.onBiometricAuthenticated(id);
498         waitForIdleSync();
499         verify(mCallbacks).onBiometricAuthenticated(eq(id));
500     }
501 
502     @Test
testOnBiometricHelp()503     public void testOnBiometricHelp() {
504         final int modality = TYPE_FACE;
505         final String helpMessage = "test_help_message";
506         mCommandQueue.onBiometricHelp(modality, helpMessage);
507         waitForIdleSync();
508         verify(mCallbacks).onBiometricHelp(eq(modality), eq(helpMessage));
509     }
510 
511     @Test
testOnBiometricError()512     public void testOnBiometricError() {
513         final int modality = 1;
514         final int error = 2;
515         final int vendorCode = 3;
516         mCommandQueue.onBiometricError(modality, error, vendorCode);
517         waitForIdleSync();
518         verify(mCallbacks).onBiometricError(eq(modality), eq(error), eq(vendorCode));
519     }
520 
521     @Test
testHideAuthenticationDialog()522     public void testHideAuthenticationDialog() {
523         final long id = 4;
524         mCommandQueue.hideAuthenticationDialog(id);
525         waitForIdleSync();
526         verify(mCallbacks).hideAuthenticationDialog(eq(id));
527     }
528 
529     @Test
testSetUdfpsRefreshRateCallback()530     public void testSetUdfpsRefreshRateCallback() {
531         final IUdfpsRefreshRateRequestCallback callback =
532                 mock(IUdfpsRefreshRateRequestCallback.class);
533         mCommandQueue.setUdfpsRefreshRateCallback(callback);
534         waitForIdleSync();
535         verify(mCallbacks).setUdfpsRefreshRateCallback(eq(callback));
536     }
537 
538     @Test
testSuppressAmbientDisplay()539     public void testSuppressAmbientDisplay() {
540         mCommandQueue.suppressAmbientDisplay(true);
541         waitForIdleSync();
542         verify(mCallbacks).suppressAmbientDisplay(true);
543     }
544 
545     @Test
testRequestMagnificationConnection()546     public void testRequestMagnificationConnection() {
547         mCommandQueue.requestMagnificationConnection(true);
548         waitForIdleSync();
549         verify(mCallbacks).requestMagnificationConnection(true);
550     }
551 
552     @Test
testSetEnableNavigationBarLumaSampling()553     public void testSetEnableNavigationBarLumaSampling() {
554         mCommandQueue.setNavigationBarLumaSamplingEnabled(1, true);
555         waitForIdleSync();
556         verify(mCallbacks).setNavigationBarLumaSamplingEnabled(eq(1), eq(true));
557     }
558 
559     @Test
testConfirmImmersivePrompt()560     public void testConfirmImmersivePrompt() {
561         mCommandQueue.confirmImmersivePrompt();
562         waitForIdleSync();
563         verify(mCallbacks).confirmImmersivePrompt();
564     }
565 
566     @Test
testImmersiveModeChanged()567     public void testImmersiveModeChanged() {
568         final int displayAreaId = 10;
569         mCommandQueue.immersiveModeChanged(displayAreaId, true);
570         waitForIdleSync();
571         verify(mCallbacks).immersiveModeChanged(displayAreaId, true);
572     }
573 
574     @Test
testShowRearDisplayDialog()575     public void testShowRearDisplayDialog() {
576         final int currentBaseState = 1;
577         mCommandQueue.showRearDisplayDialog(currentBaseState);
578         waitForIdleSync();
579         verify(mCallbacks).showRearDisplayDialog(eq(currentBaseState));
580     }
581 }
582