diff options
24 files changed, 50 insertions, 56 deletions
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index ecb8b528a6dd..b2de31b064b0 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -410,6 +410,7 @@ android_library { "mockito-target-extended-minus-junit4", "androidx.test.ext.junit", "androidx.test.ext.truth", + "kotlin-test", ], libs: [ "android.test.runner", diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java index 73b4c5f47cde..757022dd153b 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java @@ -543,7 +543,8 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV @Nullable @Override - public Animator createAnimator(ViewGroup sceneRoot, @Nullable TransitionValues startValues, + public Animator createAnimator(@NonNull ViewGroup sceneRoot, + @Nullable TransitionValues startValues, @Nullable TransitionValues endValues) { if (startValues == null || endValues == null) { return null; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt index cb182297eae1..9f7ab7b30d19 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt @@ -150,7 +150,7 @@ class KeyguardPatternViewControllerTest : SysuiTestCase() { private fun getPatternTopGuideline(): Float { val cs = ConstraintSet() val container = - mKeyguardPatternView.findViewById(R.id.pattern_container) as ConstraintLayout + mKeyguardPatternView.requireViewById(R.id.pattern_container) as ConstraintLayout cs.clone(container) return cs.getConstraint(R.id.pattern_top_guideline).layout.guidePercent } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt index 4dc7652f83cf..309d9e084ac8 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt @@ -114,7 +114,7 @@ class KeyguardPinViewControllerTest : SysuiTestCase() { objectKeyguardPINView = View.inflate(mContext, R.layout.keyguard_pin_view, null) - .findViewById(R.id.keyguard_pin_view) as KeyguardPINView + .requireViewById(R.id.keyguard_pin_view) as KeyguardPINView } private fun constructPinViewController( @@ -175,7 +175,7 @@ class KeyguardPinViewControllerTest : SysuiTestCase() { private fun getPinTopGuideline(): Float { val cs = ConstraintSet() - val container = objectKeyguardPINView.findViewById(R.id.pin_container) as ConstraintLayout + val container = objectKeyguardPINView.requireViewById(R.id.pin_container) as ConstraintLayout cs.clone(container) return cs.getConstraint(R.id.pin_pad_top_guideline).layout.guidePercent } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt index f8262d43cdbb..210f3cb65ac0 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.kt @@ -21,9 +21,9 @@ class KeyguardStatusViewTest : SysuiTestCase() { private lateinit var keyguardStatusView: KeyguardStatusView private val mediaView: View - get() = keyguardStatusView.findViewById(R.id.status_view_media_container) + get() = keyguardStatusView.requireViewById(R.id.status_view_media_container) private val statusViewContainer: ViewGroup - get() = keyguardStatusView.findViewById(R.id.status_view_container) + get() = keyguardStatusView.requireViewById(R.id.status_view_container) private val childrenExcludingMedia get() = statusViewContainer.children.filter { it != mediaView } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/SplitShadeTransitionAdapterTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/SplitShadeTransitionAdapterTest.kt index 6fe889270d65..9f9b9a478561 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/SplitShadeTransitionAdapterTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/SplitShadeTransitionAdapterTest.kt @@ -19,9 +19,11 @@ import android.animation.Animator import android.testing.AndroidTestingRunner import android.transition.TransitionValues import android.view.View +import android.view.ViewGroup import androidx.test.filters.SmallTest import com.android.keyguard.KeyguardStatusViewController.SplitShadeTransitionAdapter import com.android.systemui.SysuiTestCase +import com.android.systemui.util.mockito.mock import com.google.common.truth.Truth.assertThat import org.junit.Before import org.junit.Test @@ -84,5 +86,5 @@ private fun SplitShadeTransitionAdapter.createAnimator( startValues: TransitionValues?, endValues: TransitionValues? ): Animator? { - return createAnimator(/* sceneRoot= */ null, startValues, endValues) + return createAnimator(/* sceneRoot= */ mock(), startValues, endValues) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/animation/DialogLaunchAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/animation/DialogLaunchAnimatorTest.kt index 316de59692f9..2233e3226fd6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/animation/DialogLaunchAnimatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/animation/DialogLaunchAnimatorTest.kt @@ -70,7 +70,7 @@ class DialogLaunchAnimatorTest : SysuiTestCase() { assertTrue(dialog.isShowing) // The dialog is now fullscreen. - val window = dialog.window + val window = checkNotNull(dialog.window) val decorView = window.decorView as DecorView assertEquals(MATCH_PARENT, window.attributes.width) assertEquals(MATCH_PARENT, window.attributes.height) @@ -172,14 +172,15 @@ class DialogLaunchAnimatorTest : SysuiTestCase() { // Important: the power menu animation relies on this behavior to know when to animate (see // http://ag/16774605). val dialog = runOnMainThreadAndWaitForIdleSync { TestDialog(context) } - dialog.window.setWindowAnimations(0) - assertEquals(0, dialog.window.attributes.windowAnimations) + val window = checkNotNull(dialog.window) + window.setWindowAnimations(0) + assertEquals(0, window.attributes.windowAnimations) val touchSurface = createTouchSurface() runOnMainThreadAndWaitForIdleSync { dialogLaunchAnimator.showFromView(dialog, touchSurface) } - assertNotEquals(0, dialog.window.attributes.windowAnimations) + assertNotEquals(0, window.attributes.windowAnimations) } @Test @@ -351,13 +352,14 @@ class DialogLaunchAnimatorTest : SysuiTestCase() { init { // We need to set the window type for dialogs shown by SysUI, otherwise WM will throw. - window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL) + checkNotNull(window).setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(contentView) + val window = checkNotNull(window) window.setLayout(DIALOG_WIDTH, DIALOG_HEIGHT) window.setBackgroundDrawable(windowBackground) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/charging/WiredChargingRippleControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/charging/WiredChargingRippleControllerTest.kt index d6cafcb6b5ae..5a5c058793b2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/charging/WiredChargingRippleControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/charging/WiredChargingRippleControllerTest.kt @@ -211,7 +211,7 @@ class WiredChargingRippleControllerTest : SysuiTestCase() { context.resources.getFloat(R.dimen.physical_charger_port_location_normalized_y) val expectedCenterX: Float val expectedCenterY: Float - when (context.display.rotation) { + when (checkNotNull(context.display).rotation) { Surface.ROTATION_90 -> { expectedCenterX = width * normalizedPortPosY expectedCenterY = height * (1 - normalizedPortPosX) diff --git a/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlViewHolderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlViewHolderTest.kt index 42f28c8c6043..2ae342a5cfa5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlViewHolderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlViewHolderTest.kt @@ -125,7 +125,7 @@ class ControlViewHolderTest : SysuiTestCase() { control ) cvh.bindData(cws, false) - val chevronIcon = baseLayout.findViewById<View>(R.id.chevron_icon) + val chevronIcon = baseLayout.requireViewById<View>(R.id.chevron_icon) assertThat(chevronIcon.visibility).isEqualTo(View.VISIBLE) } @@ -138,4 +138,4 @@ private const val TINT_COLOR = 0x00ff00 // Should be different from [COLOR] private val DRAWABLE = GradientDrawable() private val COLOR = ColorStateList.valueOf(0xffff00) private val DEFAULT_CONTROL = Control.StatelessBuilder( - CONTROL_ID, mock(PendingIntent::class.java)).build()
\ No newline at end of file + CONTROL_ID, mock(PendingIntent::class.java)).build() diff --git a/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlsUiControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlsUiControllerImplTest.kt index fcd6568de9f3..a400ff963026 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlsUiControllerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlsUiControllerImplTest.kt @@ -365,7 +365,8 @@ class ControlsUiControllerImplTest : SysuiTestCase() { val selectedItems = listOf( SelectedItem.StructureItem( - StructureInfo(ComponentName.unflattenFromString("pkg/.cls1"), "a", ArrayList()) + StructureInfo(checkNotNull(ComponentName.unflattenFromString("pkg/.cls1")), + "a", ArrayList()) ), ) preferredPanelRepository.setSelectedComponent( diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt index 85ee0e4d6ec3..a3e264ad7874 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt @@ -332,9 +332,6 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() { ) .isFalse() - whenever(faceManager.sensorPropertiesInternal).thenReturn(null) - assertThat(createDeviceEntryFaceAuthRepositoryImpl().isDetectionSupported).isFalse() - whenever(faceManager.sensorPropertiesInternal).thenReturn(listOf()) assertThat(createDeviceEntryFaceAuthRepositoryImpl().isDetectionSupported).isFalse() diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt index 5b8272b04bfb..064bebd0df01 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaCarouselControllerTest.kt @@ -132,7 +132,7 @@ class MediaCarouselControllerTest : SysuiTestCase() { @Before fun setup() { MockitoAnnotations.initMocks(this) - context.resources.configuration.locales = LocaleList(Locale.US, Locale.UK) + context.resources.configuration.setLocales(LocaleList(Locale.US, Locale.UK)) transitionRepository = FakeKeyguardTransitionRepository() mediaCarouselController = MediaCarouselController( @@ -730,13 +730,13 @@ class MediaCarouselControllerTest : SysuiTestCase() { @Test fun testOnLocaleListChanged_playersAreAddedBack() { - context.resources.configuration.locales = LocaleList(Locale.US, Locale.UK, Locale.CANADA) + context.resources.configuration.setLocales(LocaleList(Locale.US, Locale.UK, Locale.CANADA)) testConfigurationChange(configListener.value::onLocaleListChanged) verify(pageIndicator, never()).tintList = ColorStateList.valueOf(context.getColor(R.color.media_paging_indicator)) - context.resources.configuration.locales = LocaleList(Locale.UK, Locale.US, Locale.CANADA) + context.resources.configuration.setLocales(LocaleList(Locale.UK, Locale.US, Locale.CANADA)) testConfigurationChange(configListener.value::onLocaleListChanged) verify(pageIndicator).tintList = diff --git a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProviderTest.kt index ee3b80ac932e..906420d03bed 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProviderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProviderTest.kt @@ -123,7 +123,7 @@ class TaskPreviewSizeProviderTest : SysuiTestCase() { private fun givenDisplay(width: Int, height: Int, isTablet: Boolean = false) { val bounds = Rect(0, 0, width, height) - val windowMetrics = WindowMetrics(bounds, null) + val windowMetrics = WindowMetrics(bounds, { null }, 1.0f) whenever(windowManager.maximumWindowMetrics).thenReturn(windowMetrics) whenever(windowManager.currentWindowMetrics).thenReturn(windowMetrics) diff --git a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/taskswitcher/data/repository/MediaProjectionManagerRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/taskswitcher/data/repository/MediaProjectionManagerRepositoryTest.kt index 3a74c7255cbb..7bd97ce2670c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/taskswitcher/data/repository/MediaProjectionManagerRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/taskswitcher/data/repository/MediaProjectionManagerRepositoryTest.kt @@ -108,20 +108,6 @@ class MediaProjectionManagerRepositoryTest : SysuiTestCase() { } @Test - fun mediaProjectionState_onSessionSet_tokenNull_emitsEntireScreen() = - testScope.runTest { - val state by collectLastValue(repo.mediaProjectionState) - runCurrent() - - fakeMediaProjectionManager.dispatchOnSessionSet( - session = - ContentRecordingSession.createTaskSession(/* taskWindowContainerToken= */ null) - ) - - assertThat(state).isEqualTo(MediaProjectionState.EntireScreen) - } - - @Test fun mediaProjectionState_sessionSet_taskWithToken_noMatchingRunningTask_emitsEntireScreen() = testScope.runTest { val state by collectLastValue(repo.mediaProjectionState) diff --git a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/gestural/BackPanelControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/gestural/BackPanelControllerTest.kt index fab1de00dcbc..2d3dc585ac70 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/gestural/BackPanelControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/gestural/BackPanelControllerTest.kt @@ -73,7 +73,7 @@ class BackPanelControllerTest : SysuiTestCase() { context, windowManager, ViewConfiguration.get(context), - Handler.createAsync(Looper.myLooper()), + Handler.createAsync(checkNotNull(Looper.myLooper())), vibratorHelper, configurationController, latencyTracker, diff --git a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt index d933b57e8e15..1536c1737de6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt @@ -69,6 +69,7 @@ import com.android.wm.shell.bubbles.Bubble import com.android.wm.shell.bubbles.Bubbles import com.google.common.truth.Truth.assertThat import java.util.Optional +import kotlin.test.assertNotNull import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher @@ -672,7 +673,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { extras().bool(EXTRA_USE_STYLUS_MODE).isTrue() } iconCaptor.value?.let { icon -> - assertThat(icon).isNotNull() + assertNotNull(icon) assertThat(icon.resId).isEqualTo(R.drawable.ic_note_task_shortcut_widget) } } @@ -755,7 +756,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() { assertThat(shortLabel).isEqualTo(NOTE_TASK_SHORT_LABEL) assertThat(longLabel).isEqualTo(NOTE_TASK_LONG_LABEL) assertThat(isLongLived).isEqualTo(true) - assertThat(icon.resId).isEqualTo(R.drawable.ic_note_task_shortcut_widget) + assertThat(icon?.resId).isEqualTo(R.drawable.ic_note_task_shortcut_widget) assertThat(extras?.getString(EXTRA_SHORTCUT_BADGE_OVERRIDE_PACKAGE)) .isEqualTo(NOTE_TASK_PACKAGE_NAME) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogTest.kt index 07feedf1d654..ad6909d71ddd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogTest.kt @@ -126,6 +126,7 @@ class ScreenRecordPermissionDialogTest : SysuiTestCase() { private fun onSpinnerItemSelected(position: Int) { val spinner = dialog.requireViewById<Spinner>(R.id.screen_share_mode_spinner) - spinner.onItemSelectedListener.onItemSelected(spinner, mock(), position, /* id= */ 0) + checkNotNull(spinner.onItemSelectedListener) + .onItemSelected(spinner, mock(), position, /* id= */ 0) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt index 112a09bcfe62..577b6e0bc58a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt @@ -584,7 +584,7 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() { private fun emptyInsets() = mock(WindowInsets::class.java) private fun WindowInsets.withCutout(): WindowInsets { - whenever(displayCutout.safeInsetBottom).thenReturn(CUTOUT_HEIGHT) + whenever(checkNotNull(displayCutout).safeInsetBottom).thenReturn(CUTOUT_HEIGHT) return this } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt index 8d3c4b21aa26..405199ed4ecb 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt @@ -567,7 +567,7 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() { private fun emptyInsets() = mock(WindowInsets::class.java) private fun WindowInsets.withCutout(): WindowInsets { - whenever(displayCutout.safeInsetBottom).thenReturn(CUTOUT_HEIGHT) + whenever(checkNotNull(displayCutout).safeInsetBottom).thenReturn(CUTOUT_HEIGHT) return this } diff --git a/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt index 58b44ae5bcbd..19dc72d6c2e3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt @@ -236,7 +236,8 @@ class DreamSmartspaceControllerTest : SysuiTestCase() { `when`(precondition.conditionsMet()).thenReturn(true) // Given a session is created - val weatherView = controller.buildAndConnectWeatherView(fakeParent, customView) + val weatherView = + checkNotNull(controller.buildAndConnectWeatherView(fakeParent, customView)) controller.stateChangeListener.onViewAttachedToWindow(weatherView) verify(smartspaceManager).createSmartspaceSession(any()) @@ -258,7 +259,8 @@ class DreamSmartspaceControllerTest : SysuiTestCase() { // Given a session is created val customView = Mockito.mock(TestView::class.java) - val weatherView = controller.buildAndConnectWeatherView(fakeParent, customView) + val weatherView = + checkNotNull(controller.buildAndConnectWeatherView(fakeParent, customView)) controller.stateChangeListener.onViewAttachedToWindow(weatherView) verify(smartspaceManager).createSmartspaceSession(any()) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt index 724ea023f2bd..e4da53a1a0a4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt @@ -47,7 +47,7 @@ class MediaArtworkProcessorTest : SysuiTestCase() { processor = MediaArtworkProcessor() val point = Point() - context.display.getSize(point) + checkNotNull(context.display).getSize(point) screenWidth = point.x screenHeight = point.y } @@ -106,4 +106,4 @@ class MediaArtworkProcessorTest : SysuiTestCase() { // THEN the processed bitmap is null assertThat(background).isNull() } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt index 2de57051d4f2..9036f22a792a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt @@ -278,7 +278,7 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() { `when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(false) // WHEN a connection attempt is made and view is attached - val view = controller.buildAndConnectView(fakeParent) + val view = controller.buildAndConnectView(fakeParent)!! controller.stateChangeListener.onViewAttachedToWindow(view) // THEN no session is created diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt index 03d38542d2ee..56d23978a5c7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ConfigurationControllerImplTest.kt @@ -212,13 +212,13 @@ class ConfigurationControllerImplTest : SysuiTestCase() { @Test fun localeListChanged_listenerNotified() { val config = mContext.resources.configuration - config.locales = LocaleList(Locale.CANADA, Locale.GERMANY) + config.setLocales(LocaleList(Locale.CANADA, Locale.GERMANY)) mConfigurationController.onConfigurationChanged(config) val listener = createAndAddListener() // WHEN the locales are updated - config.locales = LocaleList(Locale.FRANCE, Locale.JAPAN, Locale.CHINESE) + config.setLocales(LocaleList(Locale.FRANCE, Locale.JAPAN, Locale.CHINESE)) mConfigurationController.onConfigurationChanged(config) // THEN the listener is notified diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt index 1759fb794bd6..210c5ab28c42 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt @@ -463,10 +463,10 @@ class StatusBarContentInsetsProviderTest : SysuiTestCase() { val provider = StatusBarContentInsetsProvider(contextMock, configurationController, mock(DumpManager::class.java)) - configuration.windowConfiguration.maxBounds = Rect(0, 0, 1080, 2160) + configuration.windowConfiguration.setMaxBounds(Rect(0, 0, 1080, 2160)) val firstDisplayInsets = provider.getStatusBarContentAreaForRotation(ROTATION_NONE) - configuration.windowConfiguration.maxBounds = Rect(0, 0, 800, 600) + configuration.windowConfiguration.setMaxBounds(Rect(0, 0, 800, 600)) // WHEN: get insets on the second display val secondDisplayInsets = provider.getStatusBarContentAreaForRotation(ROTATION_NONE) @@ -482,14 +482,14 @@ class StatusBarContentInsetsProviderTest : SysuiTestCase() { val provider = StatusBarContentInsetsProvider(contextMock, configurationController, mock(DumpManager::class.java)) - configuration.windowConfiguration.maxBounds = Rect(0, 0, 1080, 2160) + configuration.windowConfiguration.setMaxBounds(Rect(0, 0, 1080, 2160)) val firstDisplayInsetsFirstCall = provider .getStatusBarContentAreaForRotation(ROTATION_NONE) - configuration.windowConfiguration.maxBounds = Rect(0, 0, 800, 600) + configuration.windowConfiguration.setMaxBounds(Rect(0, 0, 800, 600)) provider.getStatusBarContentAreaForRotation(ROTATION_NONE) - configuration.windowConfiguration.maxBounds = Rect(0, 0, 1080, 2160) + configuration.windowConfiguration.setMaxBounds(Rect(0, 0, 1080, 2160)) // WHEN: get insets on the first display again val firstDisplayInsetsSecondCall = provider @@ -577,4 +577,4 @@ class StatusBarContentInsetsProviderTest : SysuiTestCase() { " expected=$expected actual=$actual", expected.equals(actual)) } -}
\ No newline at end of file +} |