summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dave Mankoff <mankoff@google.com> 2025-03-04 21:27:16 +0000
committer Dave Mankoff <mankoff@google.com> 2025-03-05 12:14:46 -0800
commit9aae943b89d8f2f6787936c34039e739336340fc (patch)
treeeb186edc0ebd1f9b5f6130b48a77f6fa3e9e803d
parente053b373e4185baaf166a77102109d8e8ef153c3 (diff)
Fix various nullability issues for Kotlin 2.1
Bug: 399463072 Flag: EXEMPT minor refactor Test: m out/soong/.intermediates/packages/apps/TvSystemUI/tests/TvSystemUITests/android_common/kotlin/TvSystemUITests.jar Change-Id: I6e491e1463c67ad93ced13e3f0e7a050b9207ad0 (cherry picked from commit 3908ed02f4ee6f98910ddf07998b42748ee14697)
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/util/KeyguardTransitionRepositorySpySubject.kt4
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/base/actions/QSTileIntentUserInputHandlerSubject.kt4
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/TileSubject.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/FakeUiEvent.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/LogMaker.kt2
6 files changed, 8 insertions, 8 deletions
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/util/KeyguardTransitionRepositorySpySubject.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/util/KeyguardTransitionRepositorySpySubject.kt
index 11f0c19ffa67..7093a941485a 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/util/KeyguardTransitionRepositorySpySubject.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/util/KeyguardTransitionRepositorySpySubject.kt
@@ -115,14 +115,14 @@ private constructor(
fun assertThat(
repository: KeyguardTransitionRepository
): KeyguardTransitionRepositorySpySubject =
- assertAbout { failureMetadata, repository: KeyguardTransitionRepository ->
+ assertAbout { failureMetadata, repository: KeyguardTransitionRepository? ->
if (!Mockito.mockingDetails(repository).isSpy) {
fail(
"Cannot assert on a non-spy KeyguardTransitionRepository. " +
"Use Mockito.spy(keyguardTransitionRepository)."
)
}
- KeyguardTransitionRepositorySpySubject(failureMetadata, repository)
+ KeyguardTransitionRepositorySpySubject(failureMetadata, repository!!)
}
.that(repository)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/base/actions/QSTileIntentUserInputHandlerSubject.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/base/actions/QSTileIntentUserInputHandlerSubject.kt
index e09f2806ce5c..c1e689c0165c 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/base/actions/QSTileIntentUserInputHandlerSubject.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/base/actions/QSTileIntentUserInputHandlerSubject.kt
@@ -68,8 +68,8 @@ private constructor(
): QSTileIntentUserInputHandlerSubject =
Truth.assertAbout {
failureMetadata: FailureMetadata,
- subject: FakeQSTileIntentUserInputHandler ->
- QSTileIntentUserInputHandlerSubject(failureMetadata, subject)
+ subject: FakeQSTileIntentUserInputHandler? ->
+ QSTileIntentUserInputHandlerSubject(failureMetadata, subject!!)
}
.that(handler)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt
index ab1c1818bf80..92fdf644e365 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt
@@ -64,7 +64,7 @@ private constructor(failureMetadata: FailureMetadata, subject: QSTileState?) :
companion object {
/** Returns a factory to be used with [Truth.assertAbout]. */
- fun states(): Factory<QSTileStateSubject, QSTileState?> {
+ fun states(): Factory<QSTileStateSubject, QSTileState> {
return Factory { failureMetadata: FailureMetadata, subject: QSTileState? ->
QSTileStateSubject(failureMetadata, subject)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/TileSubject.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/TileSubject.kt
index d2351dc8ae18..cc8b44b0dade 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/TileSubject.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/TileSubject.kt
@@ -59,7 +59,7 @@ class TileSubject private constructor(failureMetadata: FailureMetadata, subject:
companion object {
/** Returns a factory to be used with [Truth.assertAbout]. */
- fun tiles(): Factory<TileSubject, Tile?> {
+ fun tiles(): Factory<TileSubject, Tile> {
return Factory { failureMetadata: FailureMetadata, subject: Tile? ->
TileSubject(failureMetadata, subject)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/FakeUiEvent.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/FakeUiEvent.kt
index 48cd345b1f68..6c10526a17fe 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/FakeUiEvent.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/FakeUiEvent.kt
@@ -24,7 +24,7 @@ import com.google.common.truth.Correspondence
object FakeUiEvent {
val EVENT_ID =
Correspondence.transforming<FakeUiEvent, Int>(
- { it?.eventId },
+ { it.eventId },
"has a eventId of",
)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/LogMaker.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/LogMaker.kt
index 3f0a95248d9c..9664bf3d6cc9 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/LogMaker.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/truth/correspondence/LogMaker.kt
@@ -23,7 +23,7 @@ import com.google.common.truth.Correspondence
object LogMaker {
val CATEGORY =
Correspondence.transforming<LogMaker, Int>(
- { it?.category },
+ { it.category },
"has a category of",
)
}