Loading packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java +22 −6 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.Rect; import android.platform.test.flag.junit.FlagsParameterization; import android.platform.test.flag.junit.FlagsParameterization; import android.provider.Settings; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestableLooper.RunWithLooper; import android.view.View; import android.view.View; import android.view.WindowManager; import android.view.WindowManager; Loading Loading @@ -70,6 +71,7 @@ import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.util.settings.FakeSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors; Loading Loading @@ -111,6 +113,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { @Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters; @Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters; @Captor private ArgumentCaptor<StatusBarStateController.StateListener> mStateListener; @Captor private ArgumentCaptor<StatusBarStateController.StateListener> mStateListener; private FakeSettings mSecureSettings; private final Executor mMainExecutor = MoreExecutors.directExecutor(); private final Executor mMainExecutor = MoreExecutors.directExecutor(); private final Executor mBackgroundExecutor = MoreExecutors.directExecutor(); private final Executor mBackgroundExecutor = MoreExecutors.directExecutor(); private final KosmosJavaAdapter mKosmos = new KosmosJavaAdapter(this); private final KosmosJavaAdapter mKosmos = new KosmosJavaAdapter(this); Loading @@ -131,6 +134,10 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { @Before @Before public void setUp() { public void setUp() { MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this); mSecureSettings = new FakeSettings(); mSecureSettings.putInt(Settings.Secure.DISABLE_SECURE_WINDOWS, 0); // Preferred refresh rate is equal to the first displayMode's refresh rate // Preferred refresh rate is equal to the first displayMode's refresh rate mPreferredRefreshRate = mContext.getDisplay().getSystemSupportedModes()[0].getRefreshRate(); mPreferredRefreshRate = mContext.getDisplay().getSystemSupportedModes()[0].getRefreshRate(); overrideResource( overrideResource( Loading Loading @@ -164,12 +171,8 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { () -> mSelectedUserInteractor, () -> mSelectedUserInteractor, mUserTracker, mUserTracker, mKosmos.getNotificationShadeWindowModel(), mKosmos.getNotificationShadeWindowModel(), mKosmos::getCommunalInteractor) { mSecureSettings, @Override mKosmos::getCommunalInteractor); protected boolean isDebuggable() { return false; } }; mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {}); mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {}); mNotificationShadeWindowController.fetchWindowRootView(); mNotificationShadeWindowController.fetchWindowRootView(); Loading Loading @@ -350,6 +353,19 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { .isTrue(); .isTrue(); } } @Test public void setKeyguardShowingWithSecureWindowsDisabled_disablesSecureFlag() { mSecureSettings.putInt(Settings.Secure.DISABLE_SECURE_WINDOWS, 1); mNotificationShadeWindowController.setBouncerShowing(true); verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture()); assertThat((mLayoutParameters.getValue().flags & FLAG_SECURE) == 0).isTrue(); assertThat( (mLayoutParameters.getValue().inputFeatures & INPUT_FEATURE_SENSITIVE_FOR_PRIVACY) != 0) .isTrue(); } @Test @Test public void setKeyguardNotShowing_disablesSecureFlag() { public void setKeyguardNotShowing_disablesSecureFlag() { mNotificationShadeWindowController.setBouncerShowing(false); mNotificationShadeWindowController.setBouncerShowing(false); Loading packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -27,9 +27,10 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region; import android.os.Build; import android.os.RemoteException; import android.os.RemoteException; import android.os.Trace; import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import android.util.Log; import android.view.Display; import android.view.Display; import android.view.IWindow; import android.view.IWindow; Loading Loading @@ -73,6 +74,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.util.settings.SecureSettings; import dagger.Lazy; import dagger.Lazy; Loading Loading @@ -130,6 +132,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW private final SysuiColorExtractor mColorExtractor; private final SysuiColorExtractor mColorExtractor; private final NotificationShadeWindowModel mNotificationShadeWindowModel; private final NotificationShadeWindowModel mNotificationShadeWindowModel; private final SecureSettings mSecureSettings; /** /** * Layout params would be aggregated and dispatched all at once if this is > 0. * Layout params would be aggregated and dispatched all at once if this is > 0. * * Loading Loading @@ -163,6 +166,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW Lazy<SelectedUserInteractor> userInteractor, Lazy<SelectedUserInteractor> userInteractor, UserTracker userTracker, UserTracker userTracker, NotificationShadeWindowModel notificationShadeWindowModel, NotificationShadeWindowModel notificationShadeWindowModel, SecureSettings secureSettings, Lazy<CommunalInteractor> communalInteractor) { Lazy<CommunalInteractor> communalInteractor) { mContext = context; mContext = context; mWindowRootViewComponentFactory = windowRootViewComponentFactory; mWindowRootViewComponentFactory = windowRootViewComponentFactory; Loading @@ -178,6 +182,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW mBackgroundExecutor = backgroundExecutor; mBackgroundExecutor = backgroundExecutor; mColorExtractor = colorExtractor; mColorExtractor = colorExtractor; mNotificationShadeWindowModel = notificationShadeWindowModel; mNotificationShadeWindowModel = notificationShadeWindowModel; mSecureSettings = secureSettings; // prefix with {slow} to make sure this dumps at the END of the critical section. // prefix with {slow} to make sure this dumps at the END of the critical section. dumpManager.registerCriticalDumpable("{slow}NotificationShadeWindowControllerImpl", this); dumpManager.registerCriticalDumpable("{slow}NotificationShadeWindowControllerImpl", this); mAuthController = authController; mAuthController = authController; Loading Loading @@ -400,7 +405,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW (long) mLpChanged.preferredMaxDisplayRefreshRate); (long) mLpChanged.preferredMaxDisplayRefreshRate); } } if (state.bouncerShowing && !isDebuggable()) { if (state.bouncerShowing && !isSecureWindowsDisabled()) { mLpChanged.flags |= LayoutParams.FLAG_SECURE; mLpChanged.flags |= LayoutParams.FLAG_SECURE; } else { } else { mLpChanged.flags &= ~LayoutParams.FLAG_SECURE; mLpChanged.flags &= ~LayoutParams.FLAG_SECURE; Loading @@ -413,8 +418,11 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW } } } } protected boolean isDebuggable() { private boolean isSecureWindowsDisabled() { return Build.IS_DEBUGGABLE; return mSecureSettings.getIntForUser( Settings.Secure.DISABLE_SECURE_WINDOWS, 0, UserHandle.USER_CURRENT) == 1; } } private void adjustScreenOrientation(NotificationShadeWindowState state) { private void adjustScreenOrientation(NotificationShadeWindowState state) { Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -277,6 +277,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { () -> mSelectedUserInteractor, () -> mSelectedUserInteractor, mUserTracker, mUserTracker, mKosmos.getNotificationShadeWindowModel(), mKosmos.getNotificationShadeWindowModel(), mSecureSettings, mKosmos::getCommunalInteractor); mKosmos::getCommunalInteractor); mFeatureFlags = new FakeFeatureFlags(); mFeatureFlags = new FakeFeatureFlags(); mSetFlagsRule.disableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR); mSetFlagsRule.disableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR); Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -162,6 +162,7 @@ import com.android.systemui.statusbar.policy.data.repository.FakeDeviceProvision import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.util.FakeEventLog; import com.android.systemui.util.FakeEventLog; import com.android.systemui.util.settings.FakeGlobalSettings; import com.android.systemui.util.settings.FakeGlobalSettings; import com.android.systemui.util.settings.FakeSettings; import com.android.systemui.util.settings.SystemSettings; import com.android.systemui.util.settings.SystemSettings; import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClock; import com.android.wm.shell.Flags; import com.android.wm.shell.Flags; Loading Loading @@ -442,6 +443,7 @@ public class BubblesTest extends SysuiTestCase { () -> mSelectedUserInteractor, () -> mSelectedUserInteractor, mUserTracker, mUserTracker, mNotificationShadeWindowModel, mNotificationShadeWindowModel, new FakeSettings(), mKosmos::getCommunalInteractor mKosmos::getCommunalInteractor ); ); mNotificationShadeWindowController.fetchWindowRootView(); mNotificationShadeWindowController.fetchWindowRootView(); Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowControllerImplTest.java +22 −6 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.Rect; import android.platform.test.flag.junit.FlagsParameterization; import android.platform.test.flag.junit.FlagsParameterization; import android.provider.Settings; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestableLooper.RunWithLooper; import android.view.View; import android.view.View; import android.view.WindowManager; import android.view.WindowManager; Loading Loading @@ -70,6 +71,7 @@ import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.util.settings.FakeSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors; Loading Loading @@ -111,6 +113,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { @Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters; @Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters; @Captor private ArgumentCaptor<StatusBarStateController.StateListener> mStateListener; @Captor private ArgumentCaptor<StatusBarStateController.StateListener> mStateListener; private FakeSettings mSecureSettings; private final Executor mMainExecutor = MoreExecutors.directExecutor(); private final Executor mMainExecutor = MoreExecutors.directExecutor(); private final Executor mBackgroundExecutor = MoreExecutors.directExecutor(); private final Executor mBackgroundExecutor = MoreExecutors.directExecutor(); private final KosmosJavaAdapter mKosmos = new KosmosJavaAdapter(this); private final KosmosJavaAdapter mKosmos = new KosmosJavaAdapter(this); Loading @@ -131,6 +134,10 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { @Before @Before public void setUp() { public void setUp() { MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this); mSecureSettings = new FakeSettings(); mSecureSettings.putInt(Settings.Secure.DISABLE_SECURE_WINDOWS, 0); // Preferred refresh rate is equal to the first displayMode's refresh rate // Preferred refresh rate is equal to the first displayMode's refresh rate mPreferredRefreshRate = mContext.getDisplay().getSystemSupportedModes()[0].getRefreshRate(); mPreferredRefreshRate = mContext.getDisplay().getSystemSupportedModes()[0].getRefreshRate(); overrideResource( overrideResource( Loading Loading @@ -164,12 +171,8 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { () -> mSelectedUserInteractor, () -> mSelectedUserInteractor, mUserTracker, mUserTracker, mKosmos.getNotificationShadeWindowModel(), mKosmos.getNotificationShadeWindowModel(), mKosmos::getCommunalInteractor) { mSecureSettings, @Override mKosmos::getCommunalInteractor); protected boolean isDebuggable() { return false; } }; mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {}); mNotificationShadeWindowController.setScrimsVisibilityListener((visibility) -> {}); mNotificationShadeWindowController.fetchWindowRootView(); mNotificationShadeWindowController.fetchWindowRootView(); Loading Loading @@ -350,6 +353,19 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase { .isTrue(); .isTrue(); } } @Test public void setKeyguardShowingWithSecureWindowsDisabled_disablesSecureFlag() { mSecureSettings.putInt(Settings.Secure.DISABLE_SECURE_WINDOWS, 1); mNotificationShadeWindowController.setBouncerShowing(true); verify(mWindowManager).updateViewLayout(any(), mLayoutParameters.capture()); assertThat((mLayoutParameters.getValue().flags & FLAG_SECURE) == 0).isTrue(); assertThat( (mLayoutParameters.getValue().inputFeatures & INPUT_FEATURE_SENSITIVE_FOR_PRIVACY) != 0) .isTrue(); } @Test @Test public void setKeyguardNotShowing_disablesSecureFlag() { public void setKeyguardNotShowing_disablesSecureFlag() { mNotificationShadeWindowController.setBouncerShowing(false); mNotificationShadeWindowController.setBouncerShowing(false); Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -27,9 +27,10 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region; import android.os.Build; import android.os.RemoteException; import android.os.RemoteException; import android.os.Trace; import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import android.util.Log; import android.view.Display; import android.view.Display; import android.view.IWindow; import android.view.IWindow; Loading Loading @@ -73,6 +74,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.util.settings.SecureSettings; import dagger.Lazy; import dagger.Lazy; Loading Loading @@ -130,6 +132,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW private final SysuiColorExtractor mColorExtractor; private final SysuiColorExtractor mColorExtractor; private final NotificationShadeWindowModel mNotificationShadeWindowModel; private final NotificationShadeWindowModel mNotificationShadeWindowModel; private final SecureSettings mSecureSettings; /** /** * Layout params would be aggregated and dispatched all at once if this is > 0. * Layout params would be aggregated and dispatched all at once if this is > 0. * * Loading Loading @@ -163,6 +166,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW Lazy<SelectedUserInteractor> userInteractor, Lazy<SelectedUserInteractor> userInteractor, UserTracker userTracker, UserTracker userTracker, NotificationShadeWindowModel notificationShadeWindowModel, NotificationShadeWindowModel notificationShadeWindowModel, SecureSettings secureSettings, Lazy<CommunalInteractor> communalInteractor) { Lazy<CommunalInteractor> communalInteractor) { mContext = context; mContext = context; mWindowRootViewComponentFactory = windowRootViewComponentFactory; mWindowRootViewComponentFactory = windowRootViewComponentFactory; Loading @@ -178,6 +182,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW mBackgroundExecutor = backgroundExecutor; mBackgroundExecutor = backgroundExecutor; mColorExtractor = colorExtractor; mColorExtractor = colorExtractor; mNotificationShadeWindowModel = notificationShadeWindowModel; mNotificationShadeWindowModel = notificationShadeWindowModel; mSecureSettings = secureSettings; // prefix with {slow} to make sure this dumps at the END of the critical section. // prefix with {slow} to make sure this dumps at the END of the critical section. dumpManager.registerCriticalDumpable("{slow}NotificationShadeWindowControllerImpl", this); dumpManager.registerCriticalDumpable("{slow}NotificationShadeWindowControllerImpl", this); mAuthController = authController; mAuthController = authController; Loading Loading @@ -400,7 +405,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW (long) mLpChanged.preferredMaxDisplayRefreshRate); (long) mLpChanged.preferredMaxDisplayRefreshRate); } } if (state.bouncerShowing && !isDebuggable()) { if (state.bouncerShowing && !isSecureWindowsDisabled()) { mLpChanged.flags |= LayoutParams.FLAG_SECURE; mLpChanged.flags |= LayoutParams.FLAG_SECURE; } else { } else { mLpChanged.flags &= ~LayoutParams.FLAG_SECURE; mLpChanged.flags &= ~LayoutParams.FLAG_SECURE; Loading @@ -413,8 +418,11 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW } } } } protected boolean isDebuggable() { private boolean isSecureWindowsDisabled() { return Build.IS_DEBUGGABLE; return mSecureSettings.getIntForUser( Settings.Secure.DISABLE_SECURE_WINDOWS, 0, UserHandle.USER_CURRENT) == 1; } } private void adjustScreenOrientation(NotificationShadeWindowState state) { private void adjustScreenOrientation(NotificationShadeWindowState state) { Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -277,6 +277,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { () -> mSelectedUserInteractor, () -> mSelectedUserInteractor, mUserTracker, mUserTracker, mKosmos.getNotificationShadeWindowModel(), mKosmos.getNotificationShadeWindowModel(), mSecureSettings, mKosmos::getCommunalInteractor); mKosmos::getCommunalInteractor); mFeatureFlags = new FakeFeatureFlags(); mFeatureFlags = new FakeFeatureFlags(); mSetFlagsRule.disableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR); mSetFlagsRule.disableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR); Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -162,6 +162,7 @@ import com.android.systemui.statusbar.policy.data.repository.FakeDeviceProvision import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.user.domain.interactor.SelectedUserInteractor; import com.android.systemui.util.FakeEventLog; import com.android.systemui.util.FakeEventLog; import com.android.systemui.util.settings.FakeGlobalSettings; import com.android.systemui.util.settings.FakeGlobalSettings; import com.android.systemui.util.settings.FakeSettings; import com.android.systemui.util.settings.SystemSettings; import com.android.systemui.util.settings.SystemSettings; import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClock; import com.android.wm.shell.Flags; import com.android.wm.shell.Flags; Loading Loading @@ -442,6 +443,7 @@ public class BubblesTest extends SysuiTestCase { () -> mSelectedUserInteractor, () -> mSelectedUserInteractor, mUserTracker, mUserTracker, mNotificationShadeWindowModel, mNotificationShadeWindowModel, new FakeSettings(), mKosmos::getCommunalInteractor mKosmos::getCommunalInteractor ); ); mNotificationShadeWindowController.fetchWindowRootView(); mNotificationShadeWindowController.fetchWindowRootView(); Loading