Cookie state is not always synced
STR:
- Login to any page such as Facebook, then swipe Zerda away from task bar.
- Open Zerda again.
Expected result: Login session is still valid.
Actual result: Login session is (mostly) invalid.
--
Cookies are stored in the memory and is stored into the persistent store every five minutes. (Source: https://developer.android.com/reference/android/webkit/CookieSyncManager.html) (Note that the class is deprecated so we may want to verify if the condition still holds. My current observation aligns to this claim.)
So we might want to do something like public void onPageFinished(WebView view, final String url) { ... CookieManager.getInstance().flush(); } to flush cookie after each request. like proposed here, but using the not-deprecated api: https://stackoverflow.com/a/8390280/3591480
We may want to make sure this does not have a performance regression before committing this. We may find a way to flush only the request is cookie related too.
oops. we missed it. put it back to triage.
Verified: Fixed
Device: Redmi 4A Rocket: 2.0.0(4045).nightly Android: 7.1.2 Android Webview: 66.0.3359.126
I'm not sure if this is fixed. Selfassign to take a look later.
Hi, the video is as below: https://drive.google.com/open?id=1EfcVf-_9oQDWRmT5BJz8yoUN5eNXgrrf
Thanks Nash, I should have stated this clearer. This is not a 100% reproduce rate problem and per I know we haven't landed any code to fix this so I'd like to double check before closing this.
Video of fail (when Rocket is closed right after login) https://drive.google.com/file/d/1hkW_aoOzAZk7V58fO6Mab9JP1dvhEhjh/view?usp=sharing Video of success (when user waited long enough): https://drive.google.com/file/d/106oooAu2HdpR7ijrd1d86z3_VcufYArJ/view?usp=sharing