i imagine what you have described is all clear in your head, but - reading it - it isn't very clear in mine. i have some questions/comments:
setAppCacheEnabled() is, essentially, a noop. why you would want it in any case is not clear, since you seem not to want caching. why are you enabling it?
setCacheMode( ... LOAD_DEFAULT) = use cache, which is - apparently - what you do not want. i would think you would want LOAD_NO_CACHE
setDOMStorageEnabled(true) = turn on DOM storage. if you turn it on, you might just get some. which you maybe do not want... i don't know what the
web page you access does, but if DOM storage is used, then previously stored data could easily reappear even though cache has been cleared.
i'm guessing you run the second set of websettings after exiting the first login. you'd think you'd want to run all those settings before loading a url, not after... what, exactly, do you mean by "same previous session"? what do these sessions look like?
in addition to all those settings you try to control, you may need to take into account the webview.db and webviewCache.db, which are separate caching entities that might need to be cleared. preferably, deleted. if you've looked at where webview stores cached data, you would have seen the databases in addition to the cached pages and images.
there is also the matter of cookies. you say you don't have any, but things like session id's are usually sent via a cookie.
you might also need to be aware of this:
"The username and password used for http authentication might be cached in the network stack itself.
WebView does not provide a special mechanism to clear HTTP authentication for implementing client logout.
The client logout mechanism should be implemented by the Web site designer (such as server sending a
HTTP 401 for invalidating credentials)."* in other words, clearing the webview cache may have nothing to do with
logging in and "logging out" (which apparently has no meaning for webview in any case).
*-from
https://android.googlesource.com/pl...ter/core/java/android/webkit/WebSettings.java
how, exactly, are you saving cached data? i won't ask why you're doing this, but i will ask what does it mean to "save the cached data"? and what does it mean to "extract" the cached data before loading url"? what does that extraction do? and what does it have to do with anything? i don't follow why you even mention it. why do you?
and, last, the system makes decisions regarding what it wants to cache based on request and response headers. unless you are aware of the contents of all those headers for the requests and responses that make up a "session", you may have little control over the inner workings of webview. pages and images (ie, data) are only a part of requests and responses. as an example, headers can contain caching instructions.