[#776] Fix hang on launch

Combining multiple flows will hang if the group of flows is empty

- Updated profile installer lib
- Removed benchmark operations receiver fix
- Added new benchmark results

---------

Co-authored-by: Honza <rychnovsky.honza@gmail.com>
This commit is contained in:
Carter Jernigan 2023-02-27 11:28:41 -05:00 committed by GitHub
parent a806d2defa
commit 9b966b4087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 21 deletions

View File

@ -26,18 +26,6 @@
android:shell="true"
tools:targetApi="29" />
<!-- To bypass "The DROP_SHADER_CACHE broadcast was not received." error while benchmarking the app. See
https://issuetracker.google.com/issues/258619948 -->
<receiver
android:name="androidx.profileinstaller.ProfileInstallReceiver"
android:permission="android.permission.DUMP"
android:exported="true">
<intent-filter>
<action
android:name="androidx.profileinstaller.action.BENCHMARK_OPERATION" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@ -1,4 +0,0 @@
<resources>
<!-- Important; this is the resource overlay that sets the Zcash network -->
<string name="network_name">Testnet</string>
</resources>

View File

@ -6,6 +6,7 @@ import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOf
import kotlinx.datetime.Instant
class MergingConfigurationProvider(private val configurationProviders: PersistentList<ConfigurationProvider>) : ConfigurationProvider {
@ -14,8 +15,12 @@ class MergingConfigurationProvider(private val configurationProviders: Persisten
}
override fun getConfigurationFlow(): Flow<Configuration> {
return combine(configurationProviders.map { it.getConfigurationFlow() }) { configurations ->
MergingConfiguration(configurations.toList().toPersistentList())
return if (configurationProviders.isEmpty()) {
flowOf(MergingConfiguration(emptyList<Configuration>().toPersistentList()))
} else {
combine(configurationProviders.map { it.getConfigurationFlow() }) { configurations ->
MergingConfiguration(configurations.toList().toPersistentList())
}
}
}

View File

@ -5,6 +5,7 @@ import co.electriccoin.zcash.configuration.model.map.StringConfiguration
import co.electriccoin.zcash.configuration.test.fixture.BooleanDefaultEntryFixture
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.persistentMapOf
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
@ -41,6 +42,18 @@ class MergingConfigurationProviderTest {
assertTrue(BooleanDefaultEntryFixture.newTrueEntry().getValue(configurationProvider.getConfigurationFlow().first()))
}
@Test
@OptIn(ExperimentalCoroutinesApi::class)
fun getFlow_empty() = runTest {
val configurationProvider = MergingConfigurationProvider(
emptyList<ConfigurationProvider>().toPersistentList()
)
val firstMergedConfiguration = configurationProvider.getConfigurationFlow().first()
assertTrue(BooleanDefaultEntryFixture.newTrueEntry().getValue(firstMergedConfiguration))
}
@Test
@OptIn(ExperimentalCoroutinesApi::class)
fun getUpdatedAt_newest() = runTest {

View File

@ -62,8 +62,8 @@ commits of that date. Generate tests results with the Android Studio run configu
Starting 1 tests on Pixel 6 - 13
BasicStartupBenchmark_startup
timeToFullDisplayMs min 288,1, median 305,6, max 339,1
timeToInitialDisplayMs min 288,1, median 305,6, max 339,1
timeToFullDisplayMs min 288.1, median 305.6, max 339.1
timeToInitialDisplayMs min 288.1, median 305.6, max 339.1
Traces: Iteration 0 1 2 3 4
BUILD SUCCESSFUL in 32s
@ -78,4 +78,33 @@ commits of that date. Generate tests results with the Android Studio run configu
Traces: Iteration 0 1 2 3 4
BUILD SUCCESSFUL in 41s
```
#### Feb 27, 2023:
- APP version: `0.1 (1)`
- SDK version: `1.14.0-beta01-SNAPSHOT`
- Git branch: `main`
- Device:
- Pixel 6 - Android 13:
```
Starting 1 tests on Pixel 6 - 13
BasicStartupBenchmark_startup
timeToFullDisplayMs min 259.2, median 265.3, max 302.4
timeToInitialDisplayMs min 259.2, median 265.3, max 302.4
Traces: Iteration 0 1 2 3 4
BUILD SUCCESSFUL in 1m 59s
```
- Pixel 3a - Android 12:
```
Starting 1 tests on Pixel 3a - 12
BasicStartupBenchmark_startup
timeToFullDisplayMs min 632.2, median 730.8, max 785.6
timeToInitialDisplayMs min 632.2, median 730.8, max 785.6
Traces: Iteration 0 1 2 3 4
BUILD SUCCESSFUL in 43s
```

View File

@ -126,7 +126,7 @@ ANDROIDX_CORE_VERSION=1.9.0
ANDROIDX_ESPRESSO_VERSION=3.5.1
ANDROIDX_LIFECYCLE_VERSION=2.6.0-alpha04
ANDROIDX_NAVIGATION_COMPOSE_VERSION=2.5.3
ANDROIDX_PROFILE_INSTALLER_VERSION=1.3.0-alpha03
ANDROIDX_PROFILE_INSTALLER_VERSION=1.3.0-beta01
ANDROIDX_SECURITY_CRYPTO_VERSION=1.1.0-alpha04
ANDROIDX_SPLASH_SCREEN_VERSION=1.0.0
ANDROIDX_TEST_JUNIT_VERSION=1.1.5