Fixed
Status Update
Comments
yb...@google.com <yb...@google.com> #2
+1, this is a severe bug if I've ever seen one. If it is on par with the #74139250 (https://issuetracker.google.com/issues/74139250 ), this should be at least P1
yb...@google.com <yb...@google.com> #3
1) Thank you for reporting this issue.We were not able to reproduce the issue with the information provided here.
Logs after follow mentioned steps in comment #1
===============================================
V/TAG: ViewModelFirst Created
2) Can you please provide the below requested information to better understand the issue:
Android build
Which Android build are you using? (e.g. KVT49L)
Device used
Which device did you use to reproduce this issue?
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
Logs after follow mentioned steps in
===============================================
V/TAG: ViewModelFirst Created
2) Can you please provide the below requested information to better understand the issue:
Android build
Which Android build are you using? (e.g. KVT49L)
Device used
Which device did you use to reproduce this issue?
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
p....@radio.net <p....@radio.net> #4
yb...@google.com <yb...@google.com> #5
@3
I have this problem on all my devices. Here are some of them:
1. Samsung Galaxy S9 (SM-G960F)
Android: 8.0.0 build: R16NW.G960FXXU1BRE5
2. Pixel2
Android: 9 build: PPP3.180510.008
3. Galaxy A3 (SM-A320FL)
Android: 7.0 build: NRD90M.A320FLXXS2BRAA
The three attachments included are: The built apk, the source code and a video displaying the issue.
The video showcases the app running on Galaxy S9 (Phone 1) with the following order:
1. Set "Don't keep activities" to enabled.
2. Happy case when everything is correct and onCleared() is called.
3. Fault case when the home button is pushed and onCleared() __is not called__.
I have this problem on all my devices. Here are some of them:
1. Samsung Galaxy S9 (SM-G960F)
Android: 8.0.0 build: R16NW.G960FXXU1BRE5
2. Pixel2
Android: 9 build: PPP3.180510.008
3. Galaxy A3 (SM-A320FL)
Android: 7.0 build: NRD90M.A320FLXXS2BRAA
The three attachments included are: The built apk, the source code and a video displaying the issue.
The video showcases the app running on Galaxy S9 (Phone 1) with the following order:
1. Set "Don't keep activities" to enabled.
2. Happy case when everything is correct and onCleared() is called.
3. Fault case when the home button is pushed and onCleared() __is not called__.
da...@google.com <da...@google.com>
ap...@google.com <ap...@google.com> #6
I was able to reproduce this with "Don't keep activities" on.
Fragments currently use the fact that the system called onSaveInstanceState() as a marker on whether the Activity could be recreated. "Don't keep activities" specifically breaks that assumption by saving the instance state, then immediately throwing it away.
In a typical system, the only time that saved instance state would be thrown away would be if your process is being destroyed, of which there is no callback (either to your app or to ViewModels). Therefore this bug is limited to only devices using "Don't keep activities".
Saved state is an imperfect signal here, so we'll switch to the correct signal - Activity.isChangingConfigurations().
Fragments currently use the fact that the system called onSaveInstanceState() as a marker on whether the Activity could be recreated. "Don't keep activities" specifically breaks that assumption by saving the instance state, then immediately throwing it away.
In a typical system, the only time that saved instance state would be thrown away would be if your process is being destroyed, of which there is no callback (either to your app or to ViewModels). Therefore this bug is limited to only devices using "Don't keep activities".
Saved state is an imperfect signal here, so we'll switch to the correct signal - Activity.isChangingConfigurations().
da...@google.com <da...@google.com>
pr...@google.com <pr...@google.com> #7
@6 Please also try my sample. on my sample I didn't enable "don't keep activities".
Description
Version used: 1.0
Devices/Android versions reproduced on:
Sometimes in query parameter we need to pass null where usually we use `IN` Clause.
For example, consider below query
SELECT * FROM Products WHERE BrandId IN (:brandId) OR COALESCE(:brandId, 0) = 0
Here we expect :brandId parameter can be null and prepared our query accordingly to return some result.
When we create a query method. In Dao, we expect to write something like this
@Query("SELECT * FROM Products WHERE BrandId IN (:brandId) OR COALESCE(:brandId, 0) = 0)
protected abstract fun getProductsByBrands(brandId:IntArray?)
This method compiles fine but generated code has following problems.
It doesn't understand nullable, kotlin ? doesn't translated to null. I tried @Nullable annotation, but dao_impl expects this collection to be non null and behaves like that. Means it throws nullpointer exception when generated code is calling size() method. And this method throws nullpointer on runtime.
Dao impl can check nullability for strings and object, and it doesn't even require any explicit nullability annotation. So why it can't be done with collections and bind NULL when null or empty collection is being passed?