commit | 6c07cbf0988666401707d89a017d379f4a4ffc2a | [log] [tgz] |
---|---|---|
author | Evan Laird <evanlaird@google.com> | Wed Jun 28 15:54:05 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Jun 28 15:54:05 2023 +0000 |
tree | 6cc2c46cb924951a5dfbc6d03b37befadd202010 | |
parent | 50d1046f0988193a72fb46052256520fc09b4194 [diff] | |
parent | c4b3d0193ea15a5c83c2ba614186309cb438c9fc [diff] |
Merge "[Sb refactor] Remove throwing condition when requesting a repo" into udc-qpr-dev am: 43d8d44eb7 am: c4b3d0193e Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23750225 Change-Id: Icc4782bb62f937d15c5bb747e37e57f09f701eaf Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt index 74352d29..54948a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryImpl.kt
@@ -250,15 +250,8 @@ .distinctUntilChanged() .onEach { logger.logDefaultMobileIconGroup(it) } - override fun getRepoForSubId(subId: Int): FullMobileConnectionRepository { - if (!isValidSubId(subId)) { - throw IllegalArgumentException( - "subscriptionId $subId is not in the list of valid subscriptions" - ) - } - - return getOrCreateRepoForSubId(subId) - } + override fun getRepoForSubId(subId: Int): FullMobileConnectionRepository = + getOrCreateRepoForSubId(subId) private fun getOrCreateRepoForSubId(subId: Int) = subIdRepositoryCache[subId]
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt index 74bcdee..862eb00 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt
@@ -73,7 +73,6 @@ import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest -import org.junit.Assert.assertThrows import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test @@ -588,11 +587,10 @@ } @Test - fun testConnectionRepository_invalidSubId_throws() = + fun testConnectionRepository_invalidSubId_doesNotThrow() = testScope.runTest { - assertThrows(IllegalArgumentException::class.java) { - underTest.getRepoForSubId(SUB_1_ID) - } + underTest.getRepoForSubId(SUB_1_ID) + // No exception } @Test