Follow config overlay's order of aspect ratio options
Fix flaky UserAspectRatioAppsPageProviderTest by using advanceUntilIdle to make sure all coroutines are finished before asserting. Bug: 325911424 Test: atest UserAspectRatioDetailsTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:32815ad699448c5c5b1f38df6d2d2a881d4251c1) Merged-In: I83e9a7f31536c1a006789722b0310f3364d14337 Change-Id: I83e9a7f31536c1a006789722b0310f3364d14337
This commit is contained in:
committed by
Cherrypicker Worker
parent
a6f283382a
commit
a0f573a35e
@@ -62,6 +62,7 @@ import com.android.settingslib.spaprivileged.template.app.AppListItem
|
||||
import com.android.settingslib.spaprivileged.template.app.AppListItemModel
|
||||
import com.android.settingslib.spaprivileged.template.app.AppListPage
|
||||
import com.google.common.annotations.VisibleForTesting
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
@@ -130,8 +131,10 @@ data class UserAspectRatioAppListItemModel(
|
||||
val canDisplay: Boolean,
|
||||
) : AppRecord
|
||||
|
||||
class UserAspectRatioAppListModel(private val context: Context)
|
||||
: AppListModel<UserAspectRatioAppListItemModel> {
|
||||
class UserAspectRatioAppListModel(
|
||||
private val context: Context,
|
||||
private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
|
||||
) : AppListModel<UserAspectRatioAppListItemModel> {
|
||||
|
||||
private val packageManager = context.packageManager
|
||||
private val userAspectRatioManager = UserAspectRatioManager(context)
|
||||
@@ -203,7 +206,7 @@ class UserAspectRatioAppListModel(private val context: Context)
|
||||
flow {
|
||||
emit(userAspectRatioManager.getUserMinAspectRatioEntry(record.userOverride,
|
||||
record.app.packageName, record.app.userId))
|
||||
}.flowOn(Dispatchers.IO)
|
||||
}.flowOn(ioDispatcher)
|
||||
}.collectAsStateWithLifecycle(initialValue = stringResource(R.string.summary_placeholder))
|
||||
return { summary }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user