Status Update
Comments
yb...@google.com <yb...@google.com> #2
Information redacted by Android Beta Feedback.
se...@google.com <se...@google.com> #3
sc...@javadude.com <sc...@javadude.com> #4
What
Feature request
Update- This is affecting ability to add attachments to Gmail. Attempted to attach a photo to a new email (Compose, select 'attach') and it disappears and am getting an error saying Gmail isn't responding this time.
Where
Build and device data
- Build Number: google/cheetah_beta/cheetah:VanillaIceCream/AP31.240426.022/11822335:user/release-keys
(Note: It is the build when sending this report. For exact build reference, please see the attached bugreport.)
Debugging information
Google Play services
com.google.android.gms
Version 242013038 (24.20.13 (190400-633713831))
System App (Updated)
Android System WebView
com.google.android.webview
Version 647800842 (126.0.6478.8)
System App (Updated)
Network operator: T-Mobile
SIM operator: T-Mobile
Filed by Android Beta Feedback. Version (Updated): 2.42-betterbug.external_20240410_RC03 (DOGFOOD)
To learn more about our feedback process, please visit
il...@google.com <il...@google.com>
ja...@gmail.com <ja...@gmail.com> #5
What
Feature request
Still after update cannot attach any photos or file from the device from ANY app, also from Google photos itself, and cannot attach video file here
Where
Build and device data
- Build Number: google/bluejay_beta/bluejay:VanillaIceCream/AP31.240426.023/11830707:user/release-keys
(Note: It is the build when sending this report. For exact build reference, please see the attached bugreport.)
Debugging information
Usługi Google Play
com.google.android.gms
Version 242112038 (24.21.12 (190400-635706698))
System App (Updated)
Android System WebView
com.google.android.webview
Version 636758231 (124.0.6367.82)
System App (Updated)
Network operator: PLAY
SIM operator: Play
Filed by Android Beta Feedback. Version (Updated): 2.42-betterbug.external_20240410_RC03 (DOGFOOD)
To learn more about our feedback process, please visit
Description
Version used: android.arch.lifecycle:extensions:1.1.1
Devices/Android versions reproduced on: emulators, API 8.1
LiveData created by Transformations.switchMap() retain "old" data when provided function returns null. Per the documentation, when the function returns null, there is no "backing" live data. If there is no backing live data, one would assume that there is no "data" in the live data created by switchMap.
For example:
class Sample1 : ViewModel() {
val personIdLiveData = MutableLiveData<String?>()
val personLiveData =
Transformations.switchMap(personIdLiveData) {
it?.let { db.getPersonDao().getById(it) }
}
}
If the personIdLiveData is set to null (no selection, perhaps), the previous value in personLiveData remains.
I recommend changing switchMap to something like the following (and perhaps an overload that allows a non-null default value to be passed if the caller desires)
// COPIED AND TWEAKED FROM Transformations.switchMap() IN android.arch.lifecycle:extensions:1.1.1
// NEW LINES ARE PRECEDED BY /*NEW*/
@MainThread
fun <X, Y> switchMap2(trigger: LiveData<X?>,
func: (X?) -> LiveData<Y?>?): LiveData<Y?> {
val result = MediatorLiveData<Y?>()
result.addSource(trigger, object : Observer<X?> {
private var mSource: LiveData<Y?>? = null
override fun onChanged(x: X?) {
val newLiveData = func(x)
if (mSource === newLiveData) {
return
}
if (mSource != null) {
result.removeSource(mSource!!)
}
mSource = newLiveData
if (mSource != null) {
result.addSource(mSource!!) { y -> result.value = y }
/*NEW*/ } else {
/*NEW*/ result.value = null
}
}
})
return result
}
The attached example project demonstrates the behavior before and after the fix.