Fix recreate crash on Enroll v2.
Replay sensorType once to avoid |contentLayoutId| to be null when Education is recreated. Bug: 295206773 Test: manual test - proceed Enroll page and rotate, no crash happens Change-Id: I0ec49d138ebe74044ba3554b38722984e78ed5d7
This commit is contained in:
@@ -255,6 +255,9 @@ class FingerprintEnrollmentV2Activity : FragmentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (theClass != null) {
|
if (theClass != null) {
|
||||||
|
supportFragmentManager.fragments.onEach { fragment ->
|
||||||
|
supportFragmentManager.beginTransaction().remove(fragment).commit()
|
||||||
|
}
|
||||||
supportFragmentManager
|
supportFragmentManager
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.setReorderingAllowed(true)
|
.setReorderingAllowed(true)
|
||||||
|
@@ -25,11 +25,13 @@ import com.android.settings.biometrics.fingerprint2.shared.model.FingerEnrollSta
|
|||||||
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
|
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.flow.combine
|
import kotlinx.coroutines.flow.combine
|
||||||
import kotlinx.coroutines.flow.combineTransform
|
import kotlinx.coroutines.flow.combineTransform
|
||||||
import kotlinx.coroutines.flow.filterNotNull
|
import kotlinx.coroutines.flow.filterNotNull
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
import kotlinx.coroutines.flow.shareIn
|
||||||
import kotlinx.coroutines.flow.transform
|
import kotlinx.coroutines.flow.transform
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -45,7 +47,9 @@ class FingerprintEnrollFindSensorViewModel(
|
|||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
/** Represents the stream of sensor type. */
|
/** Represents the stream of sensor type. */
|
||||||
val sensorType: Flow<FingerprintSensorType> =
|
val sensorType: Flow<FingerprintSensorType> =
|
||||||
fingerprintEnrollViewModel.sensorType.filterWhenEducationIsShown()
|
fingerprintEnrollViewModel.sensorType
|
||||||
|
.filterWhenEducationIsShown()
|
||||||
|
.shareIn(viewModelScope, SharingStarted.WhileSubscribed(), 1)
|
||||||
private val _isUdfps: Flow<Boolean> =
|
private val _isUdfps: Flow<Boolean> =
|
||||||
sensorType.map {
|
sensorType.map {
|
||||||
it == FingerprintSensorType.UDFPS_OPTICAL || it == FingerprintSensorType.UDFPS_ULTRASONIC
|
it == FingerprintSensorType.UDFPS_OPTICAL || it == FingerprintSensorType.UDFPS_ULTRASONIC
|
||||||
|
Reference in New Issue
Block a user