Loading packages/SystemUI/AndroidManifest.xml +2 −1 Original line number Diff line number Diff line Loading @@ -817,7 +817,8 @@ <service android:name=".dreams.DreamOverlayService" android:enabled="false" android:exported="true" /> android:exported="true" android:singleUser="true" /> <activity android:name=".keyguard.WorkLockActivity" android:label="@string/accessibility_desc_work_lock" Loading packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java +1 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ mWindow.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); mWindow.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); mWindow.addPrivateFlags(WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS); mWindow.requestFeature(Window.FEATURE_NO_TITLE); // Hide all insets when the dream is showing mWindow.getDecorView().getWindowInsetsController().hide(WindowInsets.Type.systemBars()); Loading packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.dreams; import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; Loading Loading @@ -512,4 +514,23 @@ public class DreamOverlayServiceTest extends SysuiTestCase { mMainExecutor.runAllReady(); verify(mDreamOverlayContainerViewController, never()).wakeUp(callback, mMainExecutor); } @Test public void testSystemFlagShowForAllUsersSetOnWindow() throws RemoteException { final IDreamOverlayClient client = getClient(); // Inform the overlay service of dream starting. Do not show dream complications. client.startDream(mWindowParams, mDreamOverlayCallback, DREAM_COMPONENT, false /*shouldShowComplication*/); mMainExecutor.runAllReady(); final ArgumentCaptor<WindowManager.LayoutParams> paramsCaptor = ArgumentCaptor.forClass(WindowManager.LayoutParams.class); // Verify that a new window is added. verify(mWindowManager).addView(any(), paramsCaptor.capture()); assertThat((paramsCaptor.getValue().privateFlags & SYSTEM_FLAG_SHOW_FOR_ALL_USERS) == SYSTEM_FLAG_SHOW_FOR_ALL_USERS).isTrue(); } } Loading
packages/SystemUI/AndroidManifest.xml +2 −1 Original line number Diff line number Diff line Loading @@ -817,7 +817,8 @@ <service android:name=".dreams.DreamOverlayService" android:enabled="false" android:exported="true" /> android:exported="true" android:singleUser="true" /> <activity android:name=".keyguard.WorkLockActivity" android:label="@string/accessibility_desc_work_lock" Loading
packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java +1 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ mWindow.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); mWindow.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); mWindow.addPrivateFlags(WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS); mWindow.requestFeature(Window.FEATURE_NO_TITLE); // Hide all insets when the dream is showing mWindow.getDecorView().getWindowInsetsController().hide(WindowInsets.Type.systemBars()); Loading
packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayServiceTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.dreams; import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; Loading Loading @@ -512,4 +514,23 @@ public class DreamOverlayServiceTest extends SysuiTestCase { mMainExecutor.runAllReady(); verify(mDreamOverlayContainerViewController, never()).wakeUp(callback, mMainExecutor); } @Test public void testSystemFlagShowForAllUsersSetOnWindow() throws RemoteException { final IDreamOverlayClient client = getClient(); // Inform the overlay service of dream starting. Do not show dream complications. client.startDream(mWindowParams, mDreamOverlayCallback, DREAM_COMPONENT, false /*shouldShowComplication*/); mMainExecutor.runAllReady(); final ArgumentCaptor<WindowManager.LayoutParams> paramsCaptor = ArgumentCaptor.forClass(WindowManager.LayoutParams.class); // Verify that a new window is added. verify(mWindowManager).addView(any(), paramsCaptor.capture()); assertThat((paramsCaptor.getValue().privateFlags & SYSTEM_FLAG_SHOW_FOR_ALL_USERS) == SYSTEM_FLAG_SHOW_FOR_ALL_USERS).isTrue(); } }